Tag: OS Io for Ar CTI code size ad
Function getmacaddress (Index: integer): string;
VaR
NCB: tncb; {NetBIOS control block}
Adapters: tadapterstatus; {Nic status structure}
Lananum: tlanaenum; {NetBIOS Lana}
I: integer;
RC: Char; {code returned by NETBIOS}
STR: string;
Begin
Result: = '';
Try
Zeromemory (@ NCB, sizeof (NCB); {NetBIOS control block erasing}
NCB. ncb_command: = CHR (ncbenum); {Enum}
RC: = NetBIOS (@ NCB); {return code}
NCB. ncb_buffer: = @ lananum; {process The enum command again}
NCB. ncb_length: = sizeof (lananum );
RC: = NetBIOS (@ NCB); {return code}
If ord (RC) <> 0 Then exit;
Zeromemory (@ NCB, sizeof (NCB); {NetBIOS control block erasing}
NCB. ncb_command: = CHR (ncbreset );
NCB. ncb_lana_num: = lananum. Lana [Index];
RC: = NetBIOS (@ NCB );
If ord (RC) <> 0 Then exit;
Zeromemory (@ NCB, sizeof (NCB); {obtain the NIC status}
NCB. ncb_command: = CHR (ncbastat );
NCB. ncb_lana_num: = lananum. Lana [Index];
Strpcopy (NCB. ncb_callname ,'*');
NCB. ncb_buffer: = @ adapters;
NCB. ncb_length: = sizeof (adapters );
RC: = NetBIOS (@ NCB );
STR: = ''; {convert the MAC address to a string}
For I: = 0 to 5 do
STR: = STR + inttohex (INTEGER (adapters. adapter_address [I]), 2 );
Result: = STR;
Finally
End;
End;