J
hier noch ne ähnliche variante, versuchs mal damit (bei mir funzt es)
String GetAdapterInfo(int adapter_num)
{ NCB Ncb;
memset(&Ncb, 0, sizeof(Ncb));
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = adapter_num;
if (Netbios(&Ncb) != NRC_GOODRET) return 0;
memset(&Ncb, 0, sizeof(Ncb));
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = adapter_num;
strcpy((char *) Ncb.ncb_callname, "*");
struct ASTAT { ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff[30];
} Adapter;
memset(&Adapter, 0, sizeof(Adapter));
Ncb.ncb_buffer = (unsigned char *)&Adapter;
Ncb.ncb_length = sizeof(Adapter);
if (Netbios(&Ncb) == 0)
{ String macaddr = "";
for(int i =0; i < 6; i++)
macaddr += IntToHex(Adapter.adapt.adapter_address[i],2);
return macaddr;
} else return 0;
}
String getMacID()
{ LANA_ENUM AdapterList;
NCB Ncb;
memset(&Ncb, 0, sizeof(NCB));
Ncb.ncb_command = NCBENUM;
Ncb.ncb_buffer = (unsigned char *)&AdapterList;
Ncb.ncb_length = sizeof(AdapterList);
Netbios(&Ncb);
return (AdapterList.length>0) ? GetAdapterInfo(AdapterList.lana[0]) : String("error");
}