[OT] Czym sprawdzić adres MAC karty sieciowej wW2K?

0

zupełnie jak w temacie w W9x było winipcfg a tu nie mam pojęcia.

Pomocy!!!

0

Start->Uruchom->cmd->ipconfig /all

0

Ciężko to zrobić ale ofkors wszystko jest możliwe oto kod..

USES
NB30

[code]

type
TNBLanaResources = (lrAlloc, lrFree);

type
PMACAddress = ^TMACAddress;
TMACAddress = array[0..5] of Byte;

function GetLanaEnum(LanaEnum: PLanaEnum): Byte;
var
LanaEnumNCB: PNCB;
begin
New(LanaEnumNCB);
ZeroMemory(LanaEnumNCB, SizeOf(TNCB));
try
with LanaEnumNCB^ do
begin
ncb_buffer := PChar(LanaEnum);
ncb_length := SizeOf(TLanaEnum);
ncb_command := Char(NCBENUM);
NetBios(LanaEnumNCB);
Result := Byte(ncb_cmd_cplt);
end;
finally
Dispose(LanaEnumNCB);
end;
end;

function GetMACAddress(LanaNum: Byte; MACAddress: PMACAddress): Byte;
var
AdapterStatus: PAdapterStatus;
StatNCB: PNCB;
begin
New(StatNCB);
ZeroMemory(StatNCB, SizeOf(TNCB));
StatNCB.ncb_length := SizeOf(TAdapterStatus) + 255 * SizeOf(TNameBuffer);
GetMem(AdapterStatus, StatNCB.ncb_length);
try
with StatNCB^ do
begin
ZeroMemory(MACAddress, SizeOf(TMACAddress));
ncb_buffer := PChar(AdapterStatus);
ncb_callname := '* ' + #0;
ncb_lana_num := Char(LanaNum);
ncb_command := Char(NCBASTAT);
NetBios(StatNCB);
Result := Byte(ncb_cmd_cplt);
if Result = NRC_GOODRET then
MoveMemory(MACAddress, AdapterStatus, SizeOf(TMACAddress));
end;
finally
FreeMem(AdapterStatus);
Dispose(StatNCB);
end;
end;

{Teraz procka tora odczyta MACA}

procedure TfrmMain.CzytajMac;
var
LanaNum: Byte;
MACAddress: PMACAddress;
RetCode: Byte;
begin
LanaNum := StrToInt(ComboBox1.Text);
New(MACAddress);
try
RetCode := GetMACAddress(LanaNum, MACAddress);
if RetCode = NRC_GOODRET then
begin
lbMac.Text:= Format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',
[MACAddress[0], MACAddress[1], MACAddress[2],
MACAddress[3], MACAddress[4], MACAddress[5]]);
//Powyżej własnie wyswietlamy MACa
end else
begin
Beep;
lbMac.TEXT := 'Błąd;//lub błąd
ShowMessage('Pobieranie zakończone błędem! RetCode = $' + IntToHex(RetCode, 2));
end;
finally
Dispose(MACAddress);
end;
[/code]
PS. Ja ten programik pisalem dość dawno wiec nie wiem na 100% czy zadziala, mi wtedy dzialał

0

thx all! [cya]

1 użytkowników online, w tym zalogowanych: 0, gości: 1