Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Network Card ID

I will use the unique Network card ID to device bind my license file. How
can I obtain it? The GUIDGEN.exe and CoCreateGUID is doing this but how?Is
there an API?
[170 byte] By [Eyup Gurel] at [2007-11-9 23:49:42]
# 1 Re: Network Card ID
I assume you are talking about the MAC address. If you are using NT
the command IPCONFIG /ALL will show the MAC address under the heading: Physical
Address.

"Eyup Gurel" <egl@linkbilgisayar.com.tr> wrote:
>
>I will use the unique Network card ID to device bind my license file. How
>can I obtain it? The GUIDGEN.exe and CoCreateGUID is doing this but how?Is
>there an API?
Stephen at 2007-11-12 0:15:01 >
# 2 Re: Network Card ID
try this code:

#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] );
}
}
MIchael Howard at 2007-11-12 0:15:52 >
# 3 Re: Network Card ID
Hi Mike,

The Below code gives a linking error. Can u please specify which .lib file
to be included for the method NetBios()?
Thanx

Hrishi Dhruv

Note:
Linking Error Msg :
***********************

Linking...
Network.obj : error LNK2001: unresolved external symbol _Netbios@4
Debug/Network.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

************************
Network.exe - 2 error(s), 0 warning(s)

"MIchael Howard" <mikehow@microsoft.com> wrote:
>
>try this code:
>
>#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] );
> }
>}
>
Hrishi at 2007-11-12 0:16:55 >
# 4 Re: Network Card ID
Just go to Project->Settings then Link Tab and Add link to netapi32.dll :D
jay_sholey at 2007-11-12 0:17:56 >
# 5 Re: Network Card ID
Hello,

Is this a file that I need to download from M$?

Because I have XPHome and it does not have this file.:(

Thanks.
question at 2007-11-12 0:19:05 >