获取硬盘序列号Word下载.docx

上传人:b****2 文档编号:884327 上传时间:2023-04-29 格式:DOCX 页数:33 大小:96.35KB
下载 相关 举报
获取硬盘序列号Word下载.docx_第1页
第1页 / 共33页
获取硬盘序列号Word下载.docx_第2页
第2页 / 共33页
获取硬盘序列号Word下载.docx_第3页
第3页 / 共33页
获取硬盘序列号Word下载.docx_第4页
第4页 / 共33页
获取硬盘序列号Word下载.docx_第5页
第5页 / 共33页
获取硬盘序列号Word下载.docx_第6页
第6页 / 共33页
获取硬盘序列号Word下载.docx_第7页
第7页 / 共33页
获取硬盘序列号Word下载.docx_第8页
第8页 / 共33页
获取硬盘序列号Word下载.docx_第9页
第9页 / 共33页
获取硬盘序列号Word下载.docx_第10页
第10页 / 共33页
获取硬盘序列号Word下载.docx_第11页
第11页 / 共33页
获取硬盘序列号Word下载.docx_第12页
第12页 / 共33页
获取硬盘序列号Word下载.docx_第13页
第13页 / 共33页
获取硬盘序列号Word下载.docx_第14页
第14页 / 共33页
获取硬盘序列号Word下载.docx_第15页
第15页 / 共33页
获取硬盘序列号Word下载.docx_第16页
第16页 / 共33页
获取硬盘序列号Word下载.docx_第17页
第17页 / 共33页
获取硬盘序列号Word下载.docx_第18页
第18页 / 共33页
获取硬盘序列号Word下载.docx_第19页
第19页 / 共33页
获取硬盘序列号Word下载.docx_第20页
第20页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

获取硬盘序列号Word下载.docx

《获取硬盘序列号Word下载.docx》由会员分享,可在线阅读,更多相关《获取硬盘序列号Word下载.docx(33页珍藏版)》请在冰点文库上搜索。

获取硬盘序列号Word下载.docx

if(ERROR_SUCCESS==dwResult)

IP_ADAPTER_INFO*piai2=piai;

while(piai2!

=NULL&

&

(uSystemInfoLen+piai2->

AddressLength)<

4096U)

CopyMemory(szSystemInfo+uSystemInfoLen,piai2->

Address,piai2->

AddressLength);

uSystemInfoLen+=piai2->

AddressLength;

piai2=piai2->

Next;

}

else

uErrorCode=0xF0000000U+dwResult;

VERIFY(HeapFree(GetProcessHeap(),0,piai));

returnFALSE;

uErrorCode=0xE0000000U+dwResult;

if(uErrorCode!

=0U)

//硬盘序列号,注意:

有的硬盘没有序列号

OSVERSIONINFOovi={0};

ovi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);

GetVersionEx(&

ovi);

if(ovi.dwPlatformId!

=VER_PLATFORM_WIN32_NT)

//OnlyWindows2000,WindowsXP,WindowsServer2003...

if(!

WinNTHDSerialNumAsPhysicalRead(szSystemInfo,&

uSystemInfoLen,1024))

WinNTHDSerialNumAsScsiRead(szSystemInfo,&

uSystemInfoLen,1024);

//CPUID

BOOLbException=FALSE;

BYTEszCpu[16] 

={0};

UINTuCpuID 

=0U;

__try

_asm

moveax,0

cpuid

movdwordptrszCpu[0],ebx

movdwordptrszCpu[4],edx

movdwordptrszCpu[8],ecx

moveax,1

movuCpuID,edx

__except(EXCEPTION_EXECUTE_HANDLER)

bException=TRUE;

bException)

CopyMemory(szSystemInfo+uSystemInfoLen,&

uCpuID,sizeof(UINT));

uSystemInfoLen+=sizeof(UINT);

uCpuID=strlen((char*)szCpu);

CopyMemory(szSystemInfo+uSystemInfoLen,szCpu,uCpuID);

uSystemInfoLen+=uCpuID;

//BIOS编号,支持AMI,AWARD,PHOENIX

SIZE_Tssize;

LARGE_INTEGERso;

so.LowPart=0x000f0000;

so.HighPart=0x00000000;

ssize=0xffff;

wchar_tstrPH[30]=L\\device\\physicalmemory;

DWORDba=0;

UNICODE_STRINGstruniph;

struniph.Buffer=strPH;

struniph.Length=0x2c;

struniph.MaximumLength=0x2e;

OBJECT_ATTRIBUTESobj_ar;

obj_ar.Attributes=64;

obj_ar.Length=24;

obj_ar.ObjectName=&

struniph;

obj_ar.RootDirectory=0;

obj_ar.SecurityDescriptor=0;

obj_ar.SecurityQualityOfService=0;

HMODULEhinstLib=LoadLibrary("

ntdll.dll"

);

ZWOSZWopenS=(ZWOS)GetProcAddress(hinstLib,"

ZwOpenSection"

ZWMVZWmapV=(ZWMV)GetProcAddress(hinstLib,"

ZwMapViewOfSection"

ZWUMVZWunmapV=(ZWUMV)GetProcAddress(hinstLib,"

ZwUnmapViewOfSection"

//调用函数,对物理内存进行映射

HANDLEhSection;

if(0==ZWopenS(&

hSection,4,&

obj_ar)&

0==ZWmapV(

(HANDLE)hSection, 

//打开Section时得到的句柄

(HANDLE)0xFFFFFFFF,//将要映射进程的句柄,

&

ba, 

//映射的基址

0,

0xFFFF, 

//分配的大小

so, 

//物理内存的地址

ssize, 

//指向读取内存块大小的指针

1, 

//子进程的可继承性设定

0, 

//分配类型

//保护类型

))

//执行后会在当前进程的空间开辟一段64k的空间,并把f000:

0000到f000:

ffff处的内容映射到这里

//映射的基址由ba返回,如果映射不再有用,应该用ZwUnmapViewOfSection断开映射

BYTE*pBiosSerial=(BYTE*)ba;

UINTuBiosSerialLen=FindAwardBios(&

pBiosSerial);

if(uBiosSerialLen==0U)

uBiosSerialLen=FindAmiBios(&

uBiosSerialLen=FindPhoenixBios(&

if(uBiosSerialLen!

CopyMemory(szSystemInfo+uSystemInfoLen,pBiosSerial,uBiosSerialLen);

uSystemInfoLen+=uBiosSerialLen;

ZWunmapV((HANDLE)0xFFFFFFFF,(void*)ba);

//完毕,系统特征码已取得。

  以下是其中用到的某些结构及函数的定义:

#define 

FILE_DEVICE_SCSI 

0x0000001b

IOCTL_SCSI_MINIPORT_IDENTIFY 

((FILE_DEVICE_SCSI<

<

16)+0x0501)

IOCTL_SCSI_MINIPORT0x0004D008 

// 

seeNTDDSCSI.Hfordefinition

IDENTIFY_BUFFER_SIZE 

512

SENDIDLENGTH 

(sizeof(SENDCMDOUTPARAMS)+IDENTIFY_BUFFER_SIZE)

IDE_ATAPI_IDENTIFY 

0xA1 

ReturnsIDsectorforATAPI.

IDE_ATA_IDENTIFY 

0xEC 

ReturnsIDsectorforATA.

DFP_RECEIVE_DRIVE_DATA 

0x0007c088

typedefstruct_IDSECTOR

{

USHORT 

wGenConfig;

wNumCyls;

wReserved;

wNumHeads;

wBytesPerTrack;

wBytesPerSector;

wSectorsPerTrack;

wVendorUnique[3];

CHAR 

sSerialNumber[20];

wBufferType;

wBufferSize;

wECCSize;

sFirmwareRev[8];

sModelNumber[40];

wMoreVendorUnique;

wDoubleWordIO;

wCapabilities;

wReserved1;

wPIOTiming;

wDMATiming;

wBS;

wNumCurrentCyls;

wNumCurrentHeads;

wNumCurrentSectorsPerTrack;

ULONG 

ulCurrentSectorCapacity;

wMultSectorStuff;

ulTotalAddressableSectors;

wSingleWordDMA;

wMultiWordDMA;

BYTE 

bReserved[128];

}IDSECTOR,*PIDSECTOR;

typedefstruct_DRIVERSTATUS

bDriverError;

Errorcodefromdriver,or0ifnoerror.

bIDEStatus;

ContentsofIDEErrorregister.

OnlyvalidwhenbDriverErrorisSMART_IDE_ERROR.

bReserved[2];

Reservedforfutureexpansion.

DWORD 

dwReserved[2];

}DRIVERSTATUS,*PDRIVERSTATUS,*LPDRIVERSTATUS;

typedefstruct_SENDCMDOUTPARAMS

cBufferSize;

SizeofbBufferinbytes

DRIVERSTATUS 

DriverStatus;

Driverstatusstructure.

bBuffer[1];

Bufferofarbitrarylengthinwhichtostorethedatareadfromthe 

//drive.

}SENDCMDOUTPARAMS,*PSENDCMDOUTPARAMS,*LPSENDCMDOUTPARAMS;

typedefstruct_SRB_IO_CONTROL

ULONGHeaderLength;

UCHARSignature[8];

ULONGTimeout;

ULONGControlCode;

ULONGReturnCode;

ULONGLength;

}SRB_IO_CONTROL,*PSRB_IO_CONTROL;

typedefstruct_IDEREGS

BYTEbFeaturesReg;

//UsedforspecifyingSMART"

commands"

.

BYTEbSectorCountReg;

//IDEsectorcountregister

BYTEbSectorNumberReg;

//IDEsectornumberregister

BYTEbCylLowReg;

//IDElowordercylindervalue

BYTEbCylHighReg;

//IDEhighordercylindervalue

BYTEbDriveHeadReg;

//IDEdrive/headregister

BYTEbCommandReg;

//ActualIDEcommand.

BYTEbReserved;

//reservedforfutureuse. 

Mustbezero.

}IDEREGS,*PIDEREGS,*LPIDEREGS;

typedefstruct_SENDCMDINPARAMS

Buffersizeinbytes

IDEREGS 

irDriveRegs;

Structurewithdriveregistervalues.

BYTEbDriveNumber;

Physicaldrivenumbertosend

commandto(0,1,2,3).

BYTEbReserved[3];

dwReserved[4];

Forfutureuse.

Inputbuffer.

}SENDCMDINPARAMS,*PSENDCMDINPARAMS,*LPSENDCMDINPARAMS;

typedefstruct_GETVERSIONOUTPARAMS

BYTEbVersion;

//Binarydriverversion.

BYTEbRevision;

//Binarydriverrevision.

//Notused.

BYTEbIDEDeviceMap;

//BitmapofIDEdevices.

DWORDfCapabilities;

//Bitmaskofdrivercapabilities.

DWORDdwReserved[4];

//Forfutureuse.

}GETVERSIONOUTPARAMS,*PGETVERSIONOUTPARAMS,*LPGETVERSIONOUTPARAMS;

//////////////////////////////////////////////////////////////////////

//结构定义

typedefstruct_UNICODE_STRING

{

Length;

//长度

MaximumLength;

//最大长度

PWSTR 

Buffer;

//缓存指针

}UNICODE_STRING,*PUNICODE_STRING;

typedefstruct_OBJECT_ATTRIBUTES

//长度18h

HANDLERootDirectory;

// 

00000000

PUNICODE_STRINGObjectName;

//指向对象名的指针

ULONGAttributes;

//对

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2