1 intGetmac (Char*mac)2 { 3 NCB NCB; 4 lana_enum Lana_enum;5 UCHAR Uretcode;6memset (&NCB,0,sizeof(NCB));7memset (&lana_enum,0,sizeof(Lana_enum));8Ncb.ncb_command =Ncbenum;9Ncb.ncb_buffer = (unsignedChar*) &Lana_enum;TenNcb.ncb_length =sizeof(lana_enum); OneUretcode = Netbios (&NCB); A if(Uretcode! =Nrc_goodret) - returnUretcode; - for(intLana=0; lana<lana_enum.length; lana++) the { -Ncb.ncb_command =Ncbreset; -Ncb.ncb_lana_num =Lana_enum.lana[lana]; -Uretcode = Netbios (&NCB); + if(Uretcode = =Nrc_goodret) - Break; + } A if(Uretcode! =Nrc_goodret) at returnUretcode; -memset (&NCB,0,sizeof(NCB)); -Ncb.ncb_command =Ncbastat; -Ncb.ncb_lana_num = lana_enum.lana[0]; -strcpy ((Char*) Ncb.ncb_callname,"*"); -Ncb.ncb_buffer = (unsignedChar*) &Adapter; inNcb.ncb_length =sizeof(Adapter); -Uretcode = Netbios (&NCB); to if(Uretcode! =Nrc_goodret) + returnUretcode; -sprintf (Mac,"%02x-%02x-%02x-%02x-%02x-%02x", theadapter.adapt.adapter_address[0], *adapter.adapt.adapter_address[1], $adapter.adapt.adapter_address[2],Panax Notoginsengadapter.adapt.adapter_address[3], -adapter.adapt.adapter_address[4], theadapter.adapt.adapter_address[5]); + return 0; A}
Get Mac address (VC)