die Mac-Adressen bekommst du mit folgenden beiden funktionen:
Delphi-Quellcode:
function GetMacAddressCount: Byte;
var AdapterList: ^TLanaEnum;
NCB: TNCB;
begin
new(AdapterList);
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBENUM);
NCB.ncb_buffer := PChar(AdapterList);
NCB.ncb_length := SizeOf(AdapterList^);
Netbios(@NCB);
Result := Byte(AdapterList.length);
dispose(AdapterList);
end;
function GetMACAddress(ANewworkcardIndex: Byte = 0): string;
var AdapterList: TLanaEnum;
NCB: TNCB;
begin
FillChar(NCB, SizeOf(NCB), 0);
AdapterList.length := char(0);
NCB.ncb_command := Char(NCBENUM);
NCB.ncb_buffer := @AdapterList;
NCB.ncb_length := SizeOf(AdapterList);
Netbios(@NCB);
if Byte(AdapterList.length) > ANewworkcardIndex then
Result := GetAdapterInfo(AdapterList.lana[ANewworkcardIndex])
else
Result := 'mac not found';
end;