这是C的,你应该很容易改为戴妃的!<br>#include <windows.h> <br>#include <wincon.h> <br>#include <stdlib.h><br>#include <stdio.h> <br>#include <time.h> <br><br>typedef struct _ASTAT_ {<br> ADAPTER_STATUS adapt; <br> NAME_BUFFER NameBuff [30];<br> }ASTAT, * PASTAT; <br><br>ASTAT Adapter; <br> <br>void main (void) <br>{ <br> NCB Ncb;<br> UCHAR uRetCode;<br> char NetName[50];<br> LANA_ENUM lenum;<br> int i;<br> memset( &Ncb, 0, sizeof(Ncb) );<br> Ncb.ncb_command = NCBENUM;<br> Ncb.ncb_buffer = (UCHAR *)&lenum;<br> Ncb.ncb_length = sizeof(lenum);<br> uRetCode = Netbios( &Ncb );<br> printf( "The NCBENUM return code is: 0x%x /n", uRetCode );<br> for(i=0; i < lenum.length ;i++)<br> {<br> memset( &Ncb, 0, sizeof(Ncb) );<br> Ncb.ncb_command = NCBRESET;<br> Ncb.ncb_lana_num = lenum.lana;<br> uRetCode = Netbios( &Ncb );<br> <br> printf( "The NCBRESET on LANA %d return code is: 0x%x /n",<br> lenum.lana, uRetCode );<br> <br> memset( &Ncb, 0, sizeof (Ncb) );<br> Ncb.ncb_command = NCBASTAT;<br> Ncb.ncb_lana_num = lenum.lana;<br> strcpy( Ncb.ncb_callname, "* " );<br> Ncb.ncb_buffer = (char *) &Adapter;<br> Ncb.ncb_length = sizeof(Adapter);<br> uRetCode = Netbios( &Ncb );<br> printf( "The NCBASTAT on LANA %d return code is: 0x%x /n",<br> lenum.lana, uRetCode );<br> if ( uRetCode == 0 )<br> {<br> printf( "The Ethernet Number on LANA %d is:"<br> "%02x%02x%02x%02x%02x%02x/n",<br> lenum.lana,<br> Adapter.adapt.adapter_address[0],<br> Adapter.adapt.adapter_address[1],<br> Adapter.adapt.adapter_address[2],<br> Adapter.adapt.adapter_address[3],<br> Adapter.adapt.adapter_address[4],<br> Adapter.adapt.adapter_address[5] );<br> }<br> }<br>}