Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.11.13;
Скачать: CL | DM;

Вниз

При отключении компа от хаба/свитча, не прочитывается MAC   Найти похожие ветки 

 
Akim2   (2003-08-29 16:47) [0]

Хелп плиз subj. Для чтения использую NetBios


 
Vlad Oshin ©   (2003-08-29 17:30) [1]


> Akim2 (29.08.03 16:47)

как делаешь?


 
Akim2   (2003-08-29 17:50) [2]

Пример взят с Source.ru.

function GetAdapterInfo(Lana: Char): String;
var
Adapter: TAdapterStatus;
NCB: TNCB;
begin
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBRESET);
NCB.ncb_lana_num := Lana;
if Netbios(@NCB) <> Char(NRC_GOODRET) then
begin
Result := "mac not found";
Exit;
end;

FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBASTAT);
NCB.ncb_lana_num := Lana;
NCB.ncb_callname := "*";

FillChar(Adapter, SizeOf(Adapter), 0);
NCB.ncb_buffer := @Adapter;
NCB.ncb_length := SizeOf(Adapter);
if Netbios(@NCB) <> Char(NRC_GOODRET) then
begin
Result := "mac not found";
Exit;
end;
Result :=
IntToHex(Byte(Adapter.adapter_address[0]), 2) + "-" +
IntToHex(Byte(Adapter.adapter_address[1]), 2) + "-" +
IntToHex(Byte(Adapter.adapter_address[2]), 2) + "-" +
IntToHex(Byte(Adapter.adapter_address[3]), 2) + "-" +
IntToHex(Byte(Adapter.adapter_address[4]), 2) + "-" +
IntToHex(Byte(Adapter.adapter_address[5]), 2);
end;

function GetMACAddress: string;
var
AdapterList: TLanaEnum;
NCB: TNCB;
begin
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBENUM);
NCB.ncb_buffer := @AdapterList;
NCB.ncb_length := SizeOf(AdapterList);
Netbios(@NCB);
if Byte(AdapterList.length) > 0 then
Result := GetAdapterInfo(AdapterList.lana[0])
else
Result := "mac not found";
end;



Страницы: 1 вся ветка

Текущий архив: 2003.11.13;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.024 c
1-41195
в
2003-11-01 14:22
2003.11.13
массив из строк: удаление дубликатов


4-42326
AlexRush
2003-09-03 12:12
2003.11.13
GDI. Compatible DC и Transformation functions


1-41502
ghg
2003-10-28 14:20
2003.11.13
TStringgrid


1-41415
Ломброзо
2003-10-29 17:06
2003.11.13
ListBox и LB_ITEMATPOS


4-42225
JS
2003-09-02 16:45
2003.11.13
Global memory