uses NB30;
function MACAdresse: string;
const
V = '00-00-00-00-00-00';
M = '-';
var
STA: ^TAdapterStatus;
PLE: PLanaEnum;
X, Y: Integer;
ID: string;
NCB: PNCB;
begin
NCB := AllocMem(SizeOf(TNCB));
PLE := AllocMem(SizeOf(TLanaEnum));
STA := AllocMem(SizeOf(TAdapterStatus));
PLE.Length := #0;
NCB.ncb_command := '7';
NCB.ncb_buffer := PChar(PLE);
NCB.ncb_length := SizeOf(PLE);
Netbios(NCB);
X := 0;
repeat
ID := '';
zeromemory(NCB, SizeOf(TNCB));
NCB.ncb_command := '2';
NCB.ncb_lana_num := PLE.lana[X];
Netbios(NCB);
zeromemory(NCB, SizeOf(TNCB));
NCB.ncb_command := '3';
NCB.ncb_lana_num := PLE.lana[X];
FillChar(NCB.ncb_callname, 16, #32);
NCB.ncb_callname[0] := '*';
NCB.ncb_buffer := PChar(STA);
NCB.ncb_length := SizeOf(TAdapterStatus);
if Netbios(NCB) in [#0, #6] then
for y := 0 to 5 do begin
ID := ID + IntToHex(Byte(STA.adapter_address[y]), 2);
if y < 5 then ID := ID + M;
end;
Inc(X);
until (ID <> V) or (X >= Byte(PLE.Length));
FreeMem(NCB);
FreeMem(STA);
FreeMem(PLE);
Result := ID;
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(macadresse);
end;