Main.MacInWin History

Hide minor edits - Show changes to output

2007-04-05,07:15 下午 by 140.112.29.173 -
2007-01-02,02:57 下午 by 61.229.48.236 -
Changed line 1 from:
* When compiling by MingW32, you should give linker option with -lnetapi32
to
* When compiling by MingW32, you should give linker option with @@-lnetapi32@@
2007-01-02,02:57 下午 by 61.229.48.236 -
Changed lines 52-54 from:
=]
to
=]

** Also see: [[ MacInLinux | Retrieval MAC address in Linux ]]
2007-01-02,02:50 下午 by 61.229.48.236 -
Changed lines 2-3 from:

=CPP [=
to
*
=cpp [=
2007-01-02,02:49 下午 by 61.229.48.236 -
Added lines 1-52:
* When compiling by MingW32, you should give linker option with -lnetapi32

=CPP [=
#include <windows.h>
#include <wincon.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
}ASTAT, * PASTAT;

ASTAT Adapter;

void main (void)
{
NCB ncb;
UCHAR uRetCode;
char NetName[50];

memset( &ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBRESET;
ncb.ncb_lana_num = 0;

uRetCode = Netbios( &ncb );
printf( "The NCBRESET return code is: 0x%x \n", uRetCode );

memset( &ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = 0;

strcpy( ncb.ncb_callname, "* " );
ncb.ncb_buffer = (char *) &Adapter;
ncb.ncb_length = sizeof(Adapter);

uRetCode = Netbios( &ncb );
printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
if ( uRetCode == 0 )
{
printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x\n",
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] );
}
}
=]
 

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.