DeHSeT Administrator
Mesaj Sayısı : 109 Aktiflik Puanı : 328 Kayıt tarihi : 05/06/09 Yaş : 28 Nerden : iSYaNßuL
| Konu: Bilgisayarın MAC adresini Almak Ptsi Haz. 08, 2009 8:06 am | |
| - Kod:
-
[color=#000000][color=#0000bb][font=Courier New]ses NB30[/font][/color][font=Courier New][color=#007700]; function [/color][color=#0000bb]GetAdapterInfo[/color][color=#007700]([/color][color=#0000bb]Lana[/color][color=#007700]: [/color][color=#0000bb]Char[/color][color=#007700]): [/color][color=#0000bb]String[/color][/font][font=Courier New][color=#007700]; var [/color][color=#0000bb]Adapter[/color][color=#007700]: [/color][color=#0000bb]TAdapterStatus[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]NCB[/color][color=#007700]: [/color][color=#0000bb]TNCB[/color][/font][color=#007700][font=Courier New]; [/font][/color][font=Courier New][color=#0000bb]begin FillChar[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700], [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700]), [/color][color=#0000bb]0[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_command [/color][color=#007700]:= [/color][color=#0000bb]Char[/color][color=#007700]([/color][color=#0000bb]NCBRESET[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_lana_num [/color][color=#007700]:= [/color][color=#0000bb]Lana[/color][/font][font=Courier New][color=#007700]; if [/color][color=#0000bb]Netbios[/color][color=#007700](@[/color][color=#0000bb]NCB[/color][color=#007700]) <> [/color][color=#0000bb]Char[/color][color=#007700]([/color][color=#0000bb]NRC_GOODRET[/color][color=#007700]) [/color][/font][font=Courier New][color=#0000bb]then begin Result [/color][color=#007700]:= [/color][color=#dd0000]'mac not found'[/color][/font][font=Courier New][color=#007700]; Exit; [/color][color=#0000bb]end[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]FillChar[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700], [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700]), [/color][color=#0000bb]0[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_command [/color][color=#007700]:= [/color][color=#0000bb]Char[/color][color=#007700]([/color][color=#0000bb]NCBASTAT[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_lana_num [/color][color=#007700]:= [/color][color=#0000bb]Lana[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_callname [/color][color=#007700]:= [/color][color=#dd0000]'*'[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]FillChar[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700], [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700]), [/color][color=#0000bb]0[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_buffer [/color][color=#007700]:= @[/color][color=#0000bb]Adapter[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_length [/color][color=#007700]:= [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][/font][font=Courier New][color=#007700]); if [/color][color=#0000bb]Netbios[/color][color=#007700](@[/color][color=#0000bb]NCB[/color][color=#007700]) <> [/color][color=#0000bb]Char[/color][color=#007700]([/color][color=#0000bb]NRC_GOODRET[/color][color=#007700]) [/color][/font][font=Courier New][color=#0000bb]then begin Result [/color][color=#007700]:= [/color][color=#dd0000]'mac not found'[/color][/font][font=Courier New][color=#007700]; Exit; [/color][color=#0000bb]end[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]Result [/color][/font][font=Courier New][color=#007700]:= [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]]), [/color][color=#0000bb]2[/color][color=#007700]) + [/color][color=#dd0000]'-' [/color][/font][font=Courier New][color=#007700]+ [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]1[/color][color=#007700]]), [/color][color=#0000bb]2[/color][color=#007700]) + [/color][color=#dd0000]'-' [/color][/font][font=Courier New][color=#007700]+ [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]2[/color][color=#007700]]), [/color][color=#0000bb]2[/color][color=#007700]) + [/color][color=#dd0000]'-' [/color][/font][font=Courier New][color=#007700]+ [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]3[/color][color=#007700]]), [/color][color=#0000bb]2[/color][color=#007700]) + [/color][color=#dd0000]'-' [/color][/font][font=Courier New][color=#007700]+ [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]4[/color][color=#007700]]), [/color][color=#0000bb]2[/color][color=#007700]) + [/color][color=#dd0000]'-' [/color][/font][font=Courier New][color=#007700]+ [/color][color=#0000bb]IntToHex[/color][color=#007700]([/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]Adapter[/color][color=#007700].[/color][color=#0000bb]adapter_address[/color][color=#007700][[/color][color=#0000bb]5[/color][color=#007700]]), [/color][color=#0000bb]2[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]end[/color][/font][font=Courier New][color=#007700]; function [/color][color=#0000bb]GetMACAddress[/color][color=#007700]: [/color][color=#0000bb]string[/color][/font][font=Courier New][color=#007700]; var [/color][color=#0000bb]AdapterList[/color][color=#007700]: [/color][color=#0000bb]TLanaEnum[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]NCB[/color][color=#007700]: [/color][color=#0000bb]TNCB[/color][/font][color=#007700][font=Courier New]; [/font][/color][font=Courier New][color=#0000bb]begin FillChar[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700], [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]NCB[/color][color=#007700]), [/color][color=#0000bb]0[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_command [/color][color=#007700]:= [/color][color=#0000bb]Char[/color][color=#007700]([/color][color=#0000bb]NCBENUM[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_buffer [/color][color=#007700]:= @[/color][color=#0000bb]AdapterList[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]NCB[/color][color=#007700].[/color][color=#0000bb]ncb_length [/color][color=#007700]:= [/color][color=#0000bb]SizeOf[/color][color=#007700]([/color][color=#0000bb]AdapterList[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]Netbios[/color][color=#007700](@[/color][color=#0000bb]NCB[/color][/font][font=Courier New][color=#007700]); if [/color][color=#0000bb]Byte[/color][color=#007700]([/color][color=#0000bb]AdapterList[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]) > [/color][/font][font=Courier New][color=#0000bb]0 then Result [/color][color=#007700]:= [/color][color=#0000bb]GetAdapterInfo[/color][color=#007700]([/color][color=#0000bb]AdapterList[/color][color=#007700].[/color][color=#0000bb]lana[/color][color=#007700][[/color][color=#0000bb]0[/color][/font][font=Courier New][color=#007700]]) else [/color][color=#0000bb]Result [/color][color=#007700]:= [/color][color=#dd0000]'mac not found'[/color][/font][font=Courier New][color=#007700]; [/color][color=#0000bb]end[/color][/font][color=#007700][font=Courier New]; [/font][/color][font=Courier New][color=#ff8000]// usage [/color][color=#0000bb]procedure TForm1[/color][color=#007700].[/color][color=#0000bb]Button1Click[/color][color=#007700]([/color][color=#0000bb]Sender[/color][color=#007700]: [/color][color=#0000bb]TObject[/color][/font][color=#007700][font=Courier New]); [/font][/color][font=Courier New][color=#0000bb]begin ShowMessage[/color][color=#007700]([/color][color=#0000bb]GetMACAddress[/color][/font][font=Courier New][color=#007700]); [/color][color=#0000bb]end[/color][/font][color=#007700][font=Courier New]; [/font] [/color][/color] | |
|