Peter Segerdahl
July 8th, 1999, 10:52 AM
Hi,
Does anyone know how to read/get a hard drive's serial number? (win95/98/NT4)
Thanks!
Peter Segerdahl
Nathan Strandberg
July 8th, 1999, 11:32 AM
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