www.pudn.com > get_adapter_address.zip > get_adapter_address.txt, change:1999-09-28,size:1002b


int GetAdapterAddr(int AdapterId,UCHAR *AdapterAddr)  
{  
NCB Ncb;  
UCHAR uRetCode;  
LANA_ENUM lenum;  
typedef struct _ASTAT_ {  
ADAPTER_STATUS adapt;  
NAME_BUFFER NameBuff [30];  
}ASTAT;  
ASTAT Adapter;  
 
memset( &Ncb, 0, sizeof(Ncb) );  
Ncb.ncb_command = NCBENUM;  
Ncb.ncb_buffer = (UCHAR *)&lenum;  
Ncb.ncb_length = sizeof(lenum);  
uRetCode = Netbios( &Ncb );  
if(uRetCode!=0x0) return(0);  
if(AdapterId>=lenum.length) return(0);  
 
memset( &Ncb, 0, sizeof(Ncb) );  
Ncb.ncb_command = NCBRESET;  
Ncb.ncb_lana_num = lenum.lana[AdapterId];  
uRetCode = Netbios( &Ncb );  
if(uRetCode!=0x0) return(0);  
 
memset( &Ncb, 0, sizeof (Ncb) );  
Ncb.ncb_command = NCBASTAT;  
Ncb.ncb_lana_num = lenum.lana[AdapterId];  
strcpy( (char *)Ncb.ncb_callname, "* " );  
Ncb.ncb_buffer = (unsigned char *)&Adapter;  
Ncb.ncb_length = sizeof(Adapter);  
uRetCode = Netbios( &Ncb );  
if(uRetCode!=0x0) return(0);  
 
memcpy(AdapterAddr,Adapter.adapt.adapter_address,6);  
return(1);  
}