Форум: "Система";
Текущий архив: 2002.07.22;
Скачать: [xml.tar.bz2];
ВнизMacAddress Найти похожие ветки
← →
_TOLTEC (2002-04-25 15:10) [0]Как узнать макадрес сетевой карты?
← →
Anatoly Podgoretsky (2002-04-25 15:28) [1]Через netbios, модуль nb30.pas
← →
n\a (2002-05-01 22:08) [2]конкретнее:
uses NB30;
function GetMACAdress:String;
var
NCB : PNCB;
Adapter: PAdapterStatus;
URetCode: Pchar;
RetCode: char;
I: Integer;
Lenum: PlanaEnum;
_SystemID: String;
TMPSTR: String;
begin
Result:="";
_SystemID:="";
Getmem(NCB,sizeof(TNCB));
Fillchar(NCB^,Sizeof(TNCB),0);
Getmem(Lenum,sizeof(TLanaEnum));
Fillchar(Lenum^,Sizeof(TLanaEnum),0);
Getmem(Adapter,sizeof(TAdapterStatus));
Fillchar(Adapter^,Sizeof(TAdapterStatus),0);
Lenum.Length:=chr(0);
NCB.ncb_command:=chr(NCBENUM);
NCB.ncb_buffer:=pointer(Lenum);
NCB.ncb_length:=sizeof(Lenum);
RetCode:=Netbios(NCB);
i:=0;
repeat
Fillchar(NCB^,Sizeof(TNCB),0);
Ncb.ncb_command:= chr(NCBRESET);
Ncb.ncb_lana_num:=lenum.lana[I];
RetCode:= Netbios(Ncb);
Fillchar(NCB^,Sizeof(TNCB),0);
Ncb.ncb_command:= chr(NCBASTAT);
Ncb.ncb_lana_num:= lenum.lana[I];
Ncb.ncb_callname:="* ";
Ncb.ncb_buffer:=pointer(Adapter);
Ncb.ncb_length:=sizeof(TAdapterStatus);
RetCode:= Netbios(Ncb);
if (RetCode=chr(0)) or (RetCode=chr(6)) then begin
_SystemId:=SysUtils.inttohex(ord(Adapter.adapter_address[0]),2)+"-"+
SysUtils.inttohex(ord(Adapter.adapter_address[1]),2)+"-"+
SysUtils.inttohex(ord(Adapter.adapter_address[2]),2)+"-"+
SysUtils.inttohex(ord(Adapter.adapter_address[3]),2)+"-"+
SysUtils.inttohex(ord(Adapter.adapter_address[4]),2)+"-"+
SysUtils.inttohex(ord(Adapter.adapter_address[5]),2);
end;
inc(i);
until (I>=ord(Lenum.length)) or (_SystemID<>"00-00-00-00-00-00");
FreeMem(NCB);
FreeMem(Adapter);
FreeMem(Lenum);
GetMacAdress:=_SystemID;
end;
← →
_toltec (2002-05-02 02:22) [3]спасибо
Страницы: 1 вся ветка
Форум: "Система";
Текущий архив: 2002.07.22;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.004 c