當前位置:首頁 » 硬碟大全 » vc獲取硬碟序列號
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

vc獲取硬碟序列號

發布時間: 2023-04-08 23:46:52

硬碟序列號最簡單查詢方法

電腦硬碟序列號最簡單的查詢方法如下:

操作環境:聯想(Lenovo)E76X,window7系統等。

1、滑鼠右鍵「計算機」,選擇「屬性」。

如何選擇硬碟?

1、固態硬碟也分為常見的為2.5寸的固態硬碟和M.2介面的長條硬碟,目前主流的是M.2的長條硬碟,一般支持NVME協議,讀寫速度一般在2000M每秒,高的能達到5000M每秒。而SATA口的固態硬碟上限也才500M每秒。有接近7倍的差距,所以買硬碟時一定認准M.2介面,支持NVME協議的硬碟。

如果不支持NVME協議,M.2介面但走SATA匯流排,速度還是最高500M每秒,所以要同時滿足M.2介面和支持NVME協議才行。

2、目前還有「PCIe4.0固態硬碟」,形態和M.2介面的形態是一樣的,不過速度最高可達7000M每秒,但需要CPU和主板的支持,好在目豎慧吵前英特爾13代,還有AMD主流主板,都支碧敬持PCIe4.0固態硬碟了。

3、PCIe介面的固態硬碟,不太常見,速度上對比M.2介面的固態硬碟也沒有什麼優勢,還要佔用一個PCIe插槽,所以不必太余侍關注。

❷ C# 獲取硬碟序列號

有兩種方法可以獲取:
1.採用WMI可以獲取(獲取部分硬碟),代碼如下:
public static List<string> GetHDIds()
{
List<string> hdIds = new List<string>();
try
{
//ManagementClass cimobject = new ManagementClass("Win32_DiskDrive");
ManagementClass cimobject = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection moc = cimobject.GetInstances();
foreach (ManagementObject mo in moc)
{
//String HDid = (string)mo.Properties["Model"].Value.ToString();//獲取的是硬碟名稱
String HDid = (string)mo.Properties["SerialNumber"].Value.ToString();
if (!string.IsNullOrEmpty(HDid))
{
hdIds.Add(HDid);
}
}
return hdIds;
}
catch (Exception r)
{
hdIds.Add("無法獲得硬碟信息!");
MessageBox.Show("硬碟錯誤信息:" + r.Message);
return hdIds;
}
}

2:採用一個免費的DLL,DiskID32.dll(網上下載)可以獲取大部分硬碟的序列號,和上一種方法結合應該可以獲取絕大多數的硬碟序列號,dll可以直接放在Debug目錄下,
//[DllImport("DiskID32.dll")]
//public static extern long DiskID32(ref byte DiskModel, ref byte DiskID);
//public static string GetDiskID()
//{
// byte[] DiskModel = new byte[31];
// byte[] DiskID = new byte[31];
// int i;
// string ID = "";
// if (DiskID32(ref DiskModel[0], ref DiskID[0]) != 1)
// {
// for (i = 0; i < 31; i++)
// {
// if (Convert.ToChar(DiskID[i]) != Convert.ToChar(0))
// {
// ID = ID + Convert.ToChar(DiskID[i]);
// }
// }
// ID = ID.Trim();
// }
// else
// {
// Console.WriteLine("獲取硬碟序列號出錯");
// }
// return ID;
//}

❸ VC++怎麼獲取計算機的機器碼

所謂機器的機器碼其實就是電腦的一些特徵碼,包括硬碟序列號、CPU編號、BIOS編號等等和硬體有關的編號。
你可以用在VC++中獲取這些編號,並用一定的演算法將他們組合後,就生成了一個機器碼,用這個機器碼按照一定的演算法生成一個注冊碼,這樣就對你的軟體進行了保護,使得只有擁有這個機器碼的機器才能安裝你的軟體。
獲取硬碟序列號的方法如下(代碼)
以驅動器C為例:
char
m_Volume[256];//卷標名
char
m_FileSysName[256];
DWORD
m_SerialNum;//序列號
DWORD
m_FileNameLength;
DWORD
m_FileSysFlag;
::GetVolumeInformation("c:\\",
m_Volume,
256,
&m_SerialNum,
&m_FileNameLength,
&m_FileSysFlag,
m_FileSysName,
256);
執行該函數後,m_Volume就是卷標名字元串,m_SerialNum就是序列號

❹ VC++ MFC如何獲取CPU ID及硬碟的序列號

// 「獲得Intel CPU ID」按鈕消息處理函數
void CIntelCPUIDDlg::OnBtnCPUID()
{
unsigned long s1,s2;
unsigned char vendor_id[]="------------";//CPU提供商ID
CString str1,str2,str3;
// 以下為獲得CPU ID的匯編語言指令
_asm // 得到CPU提供商信息
{
xor eax,eax // 將eax清0
cpuid // 獲取CPUID的指令
mov dword ptr vendor_id,ebx
mov dword ptr vendor_id[+4],edx
mov dword ptr vendor_id[+8],ecx
}
str1.Format("%s",vendor_id);

_asm // 得到CPU ID的高32位
{
mov eax,01h
xor edx,edx
cpuid
mov s2,eax
}
str2.Format("%08X-",s2);

_asm // 得到CPU ID的低64位
{
mov eax,03h
xor ecx,ecx
xor edx,edx
cpuid
mov s1,edx
mov s2,ecx
}
str3.Format("%08X-%08X\n",s1,s2);

str2=str2+str3;
m_editVendor.SetWindowText(str1);
m_editCPUID.SetWindowText(str2);
}

// GetHDSerial.cpp: implementation of the CGetHDSerial class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GetHDSerial.h"

char m_buffer[256];
WORD m_serial[256];
DWORD m_OldInterruptAddress;
DWORDLONG m_IDTR;

// 等待硬碟空閑
static unsigned int WaitHardDiskIdle()
{
BYTE byTemp;

Waiting:
_asm
{
mov dx, 0x1f7
in al, dx
cmp al, 0x80
jb Endwaiting
jmp Waiting
}
Endwaiting:
_asm
{
mov byTemp, al
}
return byTemp;
}

//中斷服務程序
void _declspec( naked )InterruptProcess(void)
{
int byTemp;
int i;
WORD temp;
//保存寄存器值
_asm
{
push eax
push ebx
push ecx
push edx
push esi
}

WaitHardDiskIdle();//等待硬碟空閑狀態
_asm
{
mov dx, 0x1f6
mov al, 0xa0
out dx, al
}
byTemp = WaitHardDiskIdle(); //若直接在Ring3級執行等待命令,會進入死循環
if ((byTemp&0x50)!=0x50)
{
_asm // 恢復中斷現場並退出中斷服務程序
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}

_asm
{
mov dx, 0x1f6 //命令埠1f6,選擇驅動器0
mov al, 0xa0
out dx, al
inc dx
mov al, 0xec
out dx, al //發送讀驅動器參數命令
}
byTemp = WaitHardDiskIdle();
if ((byTemp&0x58)!=0x58)
{
_asm // 恢復中斷現場並退出中斷服務程序
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}
//讀取硬碟控制器的全部信息
for (i=0;i<256;i++)
{
_asm
{
mov dx, 0x1f0
in ax, dx
mov temp, ax
}
m_serial[i] = temp;
}
_asm
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CGetHDSerial::CGetHDSerial()
{

}

CGetHDSerial::~CGetHDSerial()
{

}
// 讀取硬碟序列號函數
char* CGetHDSerial::GetHDSerial()
{
m_buffer[0]='\n';
// 得到當前操作系統版本
OSVERSIONINFO OSVersionInfo;
OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx( &OSVersionInfo);
if (OSVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
{
// Windows 9x/ME下讀取硬碟序列號
WORD m_wWin9xHDSerial[256];
Win9xReadHDSerial(m_wWin9xHDSerial);
strcpy (m_buffer, WORDToChar (m_wWin9xHDSerial, 10, 19));
}
else
{
// Windows NT/2000/XP下讀取硬碟序列號
DWORD m_wWinNTHDSerial[256];
// 判斷是否有SCSI硬碟
if ( ! WinNTReadIDEHDSerial(m_wWinNTHDSerial))
WinNTReadSCSIHDSerial(m_wWinNTHDSerial);
strcpy (m_buffer, DWORDToChar (m_wWinNTHDSerial, 10, 19));
}
return m_buffer;
}

// Windows9X/ME系統下讀取硬碟序列號
void _stdcall CGetHDSerial::Win9xReadHDSerial(WORD * buffer)
{
int i;
for(i=0;i<256;i++)
buffer[i]=0;
_asm
{
push eax
//獲取修改的中斷的中斷描述符(中斷門)地址
sidt m_IDTR
mov eax,dword ptr [m_IDTR+02h]
add eax,3*08h+04h
cli
//保存原先的中斷入口地址
push ecx
mov ecx,dword ptr [eax]
mov cx,word ptr [eax-04h]
mov dword ptr m_OldInterruptAddress,ecx
pop ecx
//設置修改的中斷入口地址為新的中斷處理程序入口地址
push ebx
lea ebx,InterruptProcess
mov word ptr [eax-04h],bx
shr ebx,10h
mov word ptr [eax+02h],bx
pop ebx
//執行中斷,轉到Ring 0(類似CIH病毒原理)
int 3h
//恢復原先的中斷入口地址
push ecx
mov ecx,dword ptr m_OldInterruptAddress
mov word ptr [eax-04h],cx
shr ecx,10h
mov word ptr [eax+02h],cx
pop ecx
sti
pop eax
}
for(i=0;i<256;i++)
buffer[i]=m_serial[i];
}

// Windows 9x/ME系統下,將字類型(WORD)的硬碟信息轉換為字元類型(char)
char * CGetHDSerial::WORDToChar (WORD diskdata [256], int firstIndex, int lastIndex)
{
static char string [1024];
int index = 0;
int position = 0;

// 按照高位元組在前,低位元組在後的順序將字數組diskdata 中內容存入到字元串string中
for (index = firstIndex; index <= lastIndex; index++)
{
// 存入字中的高位元組
string [position] = (char) (diskdata [index] / 256);
position++;
// 存入字中的低位元組
string [position] = (char) (diskdata [index] % 256);
position++;
}
// 添加字元串結束標志
string [position] = '\0';

// 刪除字元串中空格
for (index = position - 1; index > 0 && ' ' == string [index]; index--)
string [index] = '\0';

return string;
}

// Windows NT/2000/XP系統下,將雙字類型(DWORD)的硬碟信息轉換為字元類型(char)
char* CGetHDSerial::DWORDToChar (DWORD diskdata [256], int firstIndex, int lastIndex)
{
static char string [1024];
int index = 0;
int position = 0;

// 按照高位元組在前,低位元組在後的順序將雙字中的低字存入到字元串string中
for (index = firstIndex; index <= lastIndex; index++)
{
// 存入低字中的高位元組
string [position] = (char) (diskdata [index] / 256);
position++;
// 存入低字中的低位元組
string [position] = (char) (diskdata [index] % 256);
position++;
}
// 添加字元串結束標志
string [position] = '\0';

// 刪除字元串中空格
for (index = position - 1; index > 0 && ' ' == string [index]; index--)
string [index] = '\0';

return string;
}

// Windows NT/2000/XP下讀取IDE硬碟序列號
BOOL CGetHDSerial::WinNTReadIDEHDSerial(DWORD * buffer)
{
BYTE IdOutCmd [sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1];
BOOL bFlag = FALSE;
int drive = 0;
char driveName [256];
HANDLE hPhysicalDriveIOCTL = 0;

sprintf (driveName, "\\\\.\\PhysicalDrive%d", drive);
// Windows NT/2000/XP下創建文件需要管理員許可權
hPhysicalDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);

if (hPhysicalDriveIOCTL != INVALID_HANDLE_VALUE)
{
GETVERSIONOUTPARAMS VersionParams;
DWORD cbBytesReturned = 0;

// 得到驅動器的IO控制器版本
memset ((void*) &VersionParams, 0, sizeof(VersionParams));
if(DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_GET_VERSION,
NULL, 0, &VersionParams,
sizeof(VersionParams),
&cbBytesReturned, NULL) )
{
if (VersionParams.bIDEDeviceMap > 0)
{
BYTE bIDCmd = 0; // IDE或者ATAPI識別命令
SENDCMDINPARAMS scip;

// 如果驅動器是光碟機,採用命令IDE_ATAPI_IDENTIFY, command,
// 否則採用命令IDE_ATA_IDENTIFY讀取驅動器信息
bIDCmd = (VersionParams.bIDEDeviceMap >> drive & 0x10)?
IDE_ATAPI_IDENTIFY : IDE_ATA_IDENTIFY;

memset (&scip, 0, sizeof(scip));
memset (IdOutCmd, 0, sizeof(IdOutCmd));
// 獲取驅動器信息
if (WinNTGetIDEHDInfo (hPhysicalDriveIOCTL,
&scip,
(PSENDCMDOUTPARAMS)&IdOutCmd,
(BYTE) bIDCmd,
(BYTE) drive,
&cbBytesReturned))
{
int m = 0;
USHORT *pIdSector = (USHORT *)
((PSENDCMDOUTPARAMS) IdOutCmd) -> bBuffer;

for (m = 0; m < 256; m++)
buffer[m] = pIdSector [m];
bFlag = TRUE; // 讀取硬碟信息成功
}
}
}
CloseHandle (hPhysicalDriveIOCTL); // 關閉句柄
}
return bFlag;
}

// WindowsNT/2000/XP系統下讀取SCSI硬碟序列號
BOOL CGetHDSerial::WinNTReadSCSIHDSerial (DWORD * buffer)
{
buffer[0]='\n';
int controller = 0;
HANDLE hScsiDriveIOCTL = 0;
char driveName [256];
sprintf (driveName, "\\\\.\\Scsi%d:", controller);
// Windows NT/2000/XP下任何許可權都可以進行
hScsiDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);

if (hScsiDriveIOCTL != INVALID_HANDLE_VALUE)
{
int drive = 0;
DWORD mmy;
for (drive = 0; drive < 2; drive++)
{
char buffer [sizeof (SRB_IO_CONTROL) + SENDIDLENGTH];
SRB_IO_CONTROL *p = (SRB_IO_CONTROL *) buffer;
SENDCMDINPARAMS *pin =
(SENDCMDINPARAMS *) (buffer + sizeof (SRB_IO_CONTROL));
// 准備參數
memset (buffer, 0, sizeof (buffer));
p -> HeaderLength = sizeof (SRB_IO_CONTROL);
p -> Timeout = 10000;
p -> Length = SENDIDLENGTH;
p -> ControlCode = IOCTL_SCSI_MINIPORT_IDENTIFY;
strncpy ((char *) p -> Signature, "SCSIDISK", 8);
pin -> irDriveRegs.bCommandReg = IDE_ATA_IDENTIFY;
pin -> bDriveNumber = drive;
// 得到SCSI硬碟信息
if (DeviceIoControl (hScsiDriveIOCTL, IOCTL_SCSI_MINIPORT,
buffer,
sizeof (SRB_IO_CONTROL) +
sizeof (SENDCMDINPARAMS) - 1,
buffer,
sizeof (SRB_IO_CONTROL) + SENDIDLENGTH,
&mmy, NULL))
{
SENDCMDOUTPARAMS *pOut =
(SENDCMDOUTPARAMS *) (buffer + sizeof (SRB_IO_CONTROL));
IDSECTOR *pId = (IDSECTOR *) (pOut -> bBuffer);
if (pId -> sModelNumber [0])
{
int n = 0;
USHORT *pIdSector = (USHORT *) pId;

for (n = 0; n < 256; n++)
buffer[n] =pIdSector [n];
return TRUE; // 讀取成功
}
}
}
CloseHandle (hScsiDriveIOCTL); // 關閉句柄
}
return FALSE; // 讀取失敗
}

// Windows NT/2000/XP下讀取IDE設備信息
BOOL CGetHDSerial::WinNTGetIDEHDInfo (HANDLE hPhysicalDriveIOCTL, PSENDCMDINPARAMS pSCIP,
PSENDCMDOUTPARAMS pSCOP, BYTE bIDCmd, BYTE bDriveNum,
PDWORD lpcbBytesReturned)
{
// 為讀取設備信息准備參數
pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;
pSCIP -> irDriveRegs.bFeaturesReg = 0;
pSCIP -> irDriveRegs.bSectorCountReg = 1;
pSCIP -> irDriveRegs.bSectorNumberReg = 1;
pSCIP -> irDriveRegs.bCylLowReg = 0;
pSCIP -> irDriveRegs.bCylHighReg = 0;

// 計算驅動器位置
pSCIP -> irDriveRegs.bDriveHeadReg = 0xA0 | ((bDriveNum & 1) << 4);

// 設置讀取命令
pSCIP -> irDriveRegs.bCommandReg = bIDCmd;
pSCIP -> bDriveNumber = bDriveNum;
pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;

// 讀取驅動器信息
return ( DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_GET_DRIVE_INFO,
(LPVOID) pSCIP,
sizeof(SENDCMDINPARAMS) - 1,
(LPVOID) pSCOP,
sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1,
lpcbBytesReturned, NULL) );
}

❺ C\C++如何獲取硬碟的序列號和使用時間

可以試試使用WMI(在msdn上有詳細的信息):
硬碟序列號: 用Win32_PhysicalMedia class.
CPU編號: 用Win32_Processor class.
BIOS編號: 用Win32_BIOS class.

下面例子取得硬碟的序列號,其他的用法也類似(msdn上的例子,把Win32_OperatingSystem改成了Win32_PhysicalMedia):

#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <Wbemidl.h>

# pragma comment(lib, "wbemuuid.lib")

int main(int argc, char **argv)
{
HRESULT hres;

// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------

hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
cout << "Failed to initialize COM library. Error code = 0x"
<< hex << hres << endl;
return 1; // Program has failed.
}

// Step 2: --------------------------------------------------
// Set general COM security levels --------------------------
// Note: If you are using Windows 2000, you need to specify -
// the default authentication credentials for a user by using
// a SOLE_AUTHENTICATION_LIST structure in the pAuthList ----
// parameter of CoInitializeSecurity ------------------------

hres = CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);

if (FAILED(hres))
{
cout << "Failed to initialize security. Error code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}

// Step 3: ---------------------------------------------------
// Obtain the initial locator to WMI -------------------------

IWbemLocator *pLoc = NULL;

hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);

if (FAILED(hres))
{
cout << "Failed to create IWbemLocator object."
<< " Err code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}

// Step 4: -----------------------------------------------------
// Connect to WMI through the IWbemLocator::ConnectServer method

IWbemServices *pSvc = NULL;

// Connect to the root\cimv2 namespace with
// the current user and obtain pointer pSvc
// to make IWbemServices calls.
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
NULL, // User name. NULL = current user
NULL, // User password. NULL = current
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
0, // Context object
&pSvc // pointer to IWbemServices proxy
);

if (FAILED(hres))
{
cout << "Could not connect. Error code = 0x"
<< hex << hres << endl;
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}

cout << "Connected to ROOT\\CIMV2 WMI namespace" << endl;

// Step 5: --------------------------------------------------
// Set security levels on the proxy -------------------------

hres = CoSetProxyBlanket(
pSvc, // Indicates the proxy to set
RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx
RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
NULL, // client identity
EOAC_NONE // proxy capabilities
);

if (FAILED(hres))
{
cout << "Could not set proxy blanket. Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}

// Step 6: --------------------------------------------------
// Use the IWbemServices pointer to make requests of WMI ----

// For example, get the name of the operating system
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_PhysicalMedia"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);

if (FAILED(hres))
{
cout << "Query for physical media failed."
<< " Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}

// Step 7: -------------------------------------------------
// Get the data from the query in step 6 -------------------

IWbemClassObject *pclsObj;
ULONG uReturn = 0;

while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn);

if(0 == uReturn)
{
break;
}

VARIANT vtProp;

// Get the value of the Name property
hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0);

wcout << "Serial Number : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
}

// Cleanup
// ========

pSvc->Release();
pLoc->Release();
pEnumerator->Release();
pclsObj->Release();
CoUninitialize();

return 0; // Program successfully completed.
}

❻ 大神們,幫我用VC實現獲取硬碟序列號的類吧,用C++實現,獲取硬碟序列號存到一個字元串里。

用GetVolumeInformation吧,下面是一段示例,不是我寫的,應該有效。

#include "stdafx.h"
#include<iostream>
using namespace std;
#include <Windows.h>

LPTSTR namebuf=new char[12];
DWORD namesize=12;
DWORD serialnumber;
DWORD maxlen;
DWORD fileflag;
LPTSTR sysnamebuf=new char[10];
DWORD sysnamesize=10;
//int num=m_disklist.GetItemCount();
int main()
{
::GetVolumeInformation("C:\\",namebuf,namesize,&serialnumber,&maxlen,&fileflag,
sysnamebuf,sysnamesize);
cout << hex<< serialnumber<<endl;

return 0;
}

❼ 怎樣查看硬碟序列號

查看硬碟序列號方法,操作方法如下。

1、首先進入系統按Win+R打開運行面板,輸入cmd按回車鍵。