The ID given is the MAC address. The following code enumerates all LANA numbers, performs a reset (NCBREST), and an adapter status (NCBASTAT). Sample Code #include #include #include #include #include typedef struct _ASTAT_ { ADAPTER_STATUS adapt; NAME_BUFFER NameBuff [30]; }ASTAT, * PASTAT; ASTAT Adapter; void main (void) { NCB Ncb; UCHAR uRetCode; char NetName[50]; LANA_ENUM lenum; int i; memset( &Ncb, 0, sizeof(Ncb) ); Ncb.ncb_command = NCBENUM; Ncb.ncb_buffer = (UCHAR *)&lenum; Ncb.ncb_length = sizeof(lenum); uRetCode = Netbios( &Ncb ); printf( "The NCBENUM return code is: 0x%x \n", uRetCode ); for(i=0; i < lenum.length ;i++) { memset( &Ncb, 0, sizeof(Ncb) ); Ncb.ncb_command = NCBRESET; Ncb.ncb_lana_num = lenum.lana[i]; uRetCode = Netbios( &Ncb ); printf( "The NCBRESET on LANA %d return code is: 0x%x \n", lenum.lana[i], uRetCode ); memset( &Ncb, 0, sizeof (Ncb) ); Ncb.ncb_command = NCBASTAT; Ncb.ncb_lana_num = lenum.lana[i]; strcpy( Ncb.ncb_callname, "* " ); Ncb.ncb_buffer = (char *) &Adapter; Ncb.ncb_length = sizeof(Adapter); uRetCode = Netbios( &Ncb ); printf( "The NCBASTAT on LANA %d return code is: 0x%x \n", lenum.lana[i], uRetCode ); if ( uRetCode == 0 ) { printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n", lenum.lana[i], Adapter.adapt.adapter_address[0], Adapter.adapt.adapter_address[1], Adapter.adapt.adapter_address[2], Adapter.adapt.adapter_address[3], Adapter.adapt.adapter_address[4], Adapter.adapt.adapter_address[5] ); } } } APPLIES TO • Microsoft Platform Software Development Kit-January 2000 Edition, when used with: o Microsoft Windows NT Advanced Server 3.1 o Microsoft Windows NT Server 3.5 o Microsoft Windows NT Server 3.51 o Microsoft Windows NT Server 4.0 Standard Edition o Microsoft Windows NT Workstation 3.1 o Microsoft Windows NT Workstation 3.5 o Microsoft Windows NT Workstation 3.51 o Microsoft Windows NT Workstation 4.0 Developer Edition o the operating system: Microsoft Windows 2000 o Microsoft Windows 98 Standard Edition o Microsoft Windows 95 o Microsoft Windows 98 Standard Edition Ack : Microsoft site .


This entry was posted on 5:35 AM and is filed under . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

0 comments: