|
-
July 8th, 1999, 10:52 AM
#1
Hard drive serial number
Hi,
Does anyone know how to read/get a hard drive's serial number? (win95/98/NT4)
Thanks!
Peter Segerdahl
-
July 8th, 1999, 11:32 AM
#2
Re: Hard drive serial number
I went through a lot of posting to get the following code. But it does work:
char RootPathName[MAX_PATH];
char VolumeNameBuffer[MAX_PATH];
DWORD VolumeNameSize=MAX_PATH;
DWORD VolumeSerialNumber=0;
DWORD MaximumComponentLength=0;
DWORD FileSystemFlags=0;
char FileSystemNameBuffer[MAX_PATH];
DWORD FileSystemNameSize=MAX_PATH;
strcpy(RootPathName,"C:\\");
GetVolumeInformation(RootPathName, VolumeNameBuffer, VolumeNameSize, &VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags, FileSystemNameBuffer, FileSystemNameSize);
CString tmpstr;
tmpstr.Format("%x",VolumeSerialNumber);
m_Reg.SetWindowText( tmpstr );
I used it for a registration code on one of my programs.
Thanks!
Nathan Strandberg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|