最近硬盘问题总是不断,拿去换了几个每次都说是新的结果一用就出问题...妈的奸商居然奸到我头上了,于是写个查ID的工具,看看还出问题还说换新的是不是给我新的!-_-#!!
代码基本上是网上抄得-_-#,结构太复杂,所以只能是边参考边敲代码了
主程序代码:
#include
<
stdio.h
>
#include
<
stdlib.h
>
#include
<
string
.h
>
#include
<
iostream.h
>
#include
<
windows.h
>
#include
"
HardID.h
"

void
CopyRight()
{
cout<<"/**************************************"<<" "
<<" HardDisk ID GetClass "<<" "
<<" Writen By Red_angelX 2007.3.23 "<<" "
<<"**************************************/"<<endl;
}

char
*
ConvertToString(DWORD diskdata [
256
],
int
firstIndex,
int
lastIndex)
{
static char string [1024];
int index = 0;
int position = 0;

// each integer has two characters stored in it backwards
for (index = firstIndex; index <= lastIndex; index++)
{
// get high byte for 1st character
string [position] = (char) (diskdata [index] / 256);
position++;

// get low byte for 2nd character
string [position] = (char) (diskdata [index] % 256);
position++;
}
// end the string
string [position] = '';

// cut off the trailing blanks
for (index = position - 1; index > 0 && ' ' == string [index]; index--)
string [index] = '';
return string;
}

//
Print Out The Result
void
PrintInfo(
int
drive,DWORD diskdata[
256
])
{
char string1 [1024];
__int64 sectors = 0;
int bytes = 0;

cout<<"Drive"<<drive<<" : "<<ConvertToString(diskdata, 27, 46)<<endl;

cout<<"Serial Number : "<<ConvertToString (diskdata, 10, 19)<<endl;

cout<<"Revision Number :"<<ConvertToString (diskdata, 23, 26)<<endl;
char* str_HardDesk_Form = new char[256];
switch (drive / 2)
{
case 0: str_HardDesk_Form ="Primary Controller";
break;
case 1: str_HardDesk_Form
代码基本上是网上抄得-_-#,结构太复杂,所以只能是边参考边敲代码了
主程序代码:


























































