Topic : Retrieving MAC Adapter Address Using NETBIOS Last Updated: January 22, 1998 Location : http://www.pcausa.com/whitepapers/netbiosmacaddr.txt ====================================================================== Date: Mon, 25 Aug 1997 09:34:25 -0400 From: david goldberg Subject: Re: Retrieve network card address? Here's a chunk of code that we use. Normally we only run under Win 95, but I believe it works on NT also. Info on the Netbios() call should be available in the MS VC help files. Hope this helps - Dave Goldberg NCB ncb; struct { ADAPTER_STATUS status; NAME_BUFFER names[10]; } data; int i; // do a "get adapter status" command memset(&ncb, '\0', sizeof(NCB)); memset(&data, '\0', sizeof(data)); ncb.ncb_command = NCBASTAT; ncb.ncb_buffer = &data; ncb.ncb_length = sizeof(data); ncb.ncb_lana_num = 0; strcpy((char *) ncb.ncb_callname, "* "); // must be 15 chars? Netbios(&ncb); if (ncb.ncb_retcode != NRC_GOODRET) return ncb.ncb_retcode; for (i = 0; i < 6; i++) EthernetAddress[i] = data.status.adapter_address[i]; ==================== From: Scott Lee Newsgroups: microsoft.public.win32.programmer.networks Subject: Re: Hardware MAC address (how to get it) Date: Thursday, October 09, 1997 11:57 AM Thanks for your inputs. I got it working using Netbios. The CoCreateGuID api is not reliable. Also, MS said that this api may change. here is the snibit of the code Here is a section of code that gets the MAC address. It works on Win95 Win98 Win NT 3.51 , 4.0, 5.0. This was tested while the machine is connected to a Token Ring Network and Dialed out. // using Netbios interface to get the mac address // enumerate lana number memset( &ncb,0,sizeof(ncb)); ncb.ncb_command = NCBENUM; uRc=Netbios(&ncb); ncb.ncb_buffer=(char*)&lanaenum; ncb.ncb_length=sizeof(lanaenum); uRc=Netbios(&ncb); if (uRc) return 1; for( i=0 ; i