能力值:
( LV9,RANK:250 )
|
-
-
2 楼
如果有网卡的话,获取网卡物理地址也行。
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
能否告知一下具体该如何操作?
谢谢
|
能力值:
( LV9,RANK:250 )
|
-
-
4 楼
百度搜下就有了。
#include <stdio.h>
#include <windows.h>
#include <Nb30.h>
#pragma comment(lib, "Netapi32.lib")
int getMAC(char * mac)
{
NCB ncb;
typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
} ASTAT, * PASTAT;
ASTAT Adapter;
typedef struct _LANA_ENUM
{
UCHAR length;
UCHAR lana[MAX_LANA];
} LANA_ENUM ;
LANA_ENUM lana_enum;
UCHAR uRetCode;
memset( &ncb, 0, sizeof(ncb) );
memset( &lana_enum, 0, sizeof(lana_enum));
ncb.ncb_command = NCBENUM;
ncb.ncb_buffer = (unsigned char *) &lana_enum;
ncb.ncb_length = sizeof(LANA_ENUM);
uRetCode = Netbios( &ncb );
if( uRetCode != NRC_GOODRET )
return uRetCode ;
for( int lana=0; lana<lana_enum.length; lana++ )
{
ncb.ncb_command = NCBRESET;
ncb.ncb_lana_num = lana_enum.lana[lana];
uRetCode = Netbios( &ncb );
if( uRetCode == NRC_GOODRET )
break ;
}
if( uRetCode != NRC_GOODRET )
return uRetCode;
memset( &ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = lana_enum.lana[0];
strcpy( (char* )ncb.ncb_callname, "*" );
ncb.ncb_buffer = (unsigned char *) &Adapter;
ncb.ncb_length = sizeof(Adapter);
uRetCode = Netbios( &ncb );
if( uRetCode != NRC_GOODRET )
return uRetCode ;
sprintf(mac,"%02X-%02X-%02X-%02X-%02X-%02X",
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] );
return 0;
}
int main(void)
{
char szMac[256] = {'\0'};
getMAC(szMac);
printf("%s\n", szMac);
return 0;
}
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
网卡地址不行,你如果要写注册程序,很容易被修改掉的.最好综合上硬盘等信息
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
现在没有办法确认电脑的唯一性
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
......读硬件编号啊
|
能力值:
( LV2,RANK:10 )
|
-
-
8 楼
用硬盘的编号,我一直都是这么用的,哈哈哈
|
能力值:
( LV2,RANK:10 )
|
-
-
9 楼
网卡地址肯定不行, 那个是在注册表里的,可以修改的
硬盘的编号也不是唯一的,
特别是现在有sata的新硬盘, 序列号不知道怎么读
|
能力值:
( LV9,RANK:1250 )
|
-
-
10 楼
把这几个及其他硬件信息综合在一块计算其SHA1值。
|
|
|