I am trying to get factory serial number of HD but dont know how.I have searched but only found some sources about 8 digit volume number which is given by Getvolumeinformation. Any help will be appreciated.Thanks
Posted on 2001-01-31 15:03:00 by LaptoniC
Use the GetVolumeInformation API. The following is pasted from the MSDN help CD's. ********************************************************* The GetVolumeInformation function retrieves information about a file system and volume whose root directory is specified. BOOL GetVolumeInformation( LPCTSTR lpRootPathName, // root directory LPTSTR lpVolumeNameBuffer, // volume name buffer DWORD nVolumeNameSize, // length of name buffer LPDWORD lpVolumeSerialNumber, // volume serial number LPDWORD lpMaximumComponentLength, // maximum file name length LPDWORD lpFileSystemFlags, // file system options LPTSTR lpFileSystemNameBuffer, // file system name buffer DWORD nFileSystemNameSize // length of file system name buffer ); Parameters lpRootPathName Pointer to a string that contains the root directory of the volume to be described. If this parameter is NULL, the root of the current directory is used. A trailing backslash is required. For example, you would specify \\MyServer\MyShare as \\MyServer\MyShare\, or the C drive as "C:\". lpVolumeNameBuffer Pointer to a buffer that receives the name of the specified volume. nVolumeNameSize Specifies the length, in TCHARs, of the volume name buffer. This parameter is ignored if the volume name buffer is not supplied. lpVolumeSerialNumber Pointer to a variable that receives the volume serial number. This parameter can be NULL if the serial number is not required. Windows 95/98: If the queried volume is a network drive, the serial number will not be returned. lpMaximumComponentLength Pointer to a variable that receives the maximum length, in TCHARs, of a file name component supported by the specified file system. A file name component is that portion of a file name between backslashes. The value stored in variable pointed to by *lpMaximumComponentLength is used to indicate that long names are supported by the specified file system. For example, for a FAT file system supporting long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the NTFS file system. lpFileSystemFlags Pointer to a variable that receives flags associated with the specified file system. This parameter can be any combination of the following flags; however, FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED are mutually exclusive.
Posted on 2001-01-31 17:13:00 by Alan Mason
If the factory serial # differs from the volume one, there's probably no way to get it by software. The maker may choose not to expose the factory serial # to the system. If so, you'd have to open up the case, take out the drive, and inspect it.
Posted on 2001-01-31 17:28:00 by Xmas
Hi Xmas you are wrong :) there is a serial number of each HDD that can be very easy read (for a vast number of modern hdd) from a dos window... Problem is that its exposed as a reply to some outs to HDD ports...Win95 may let you do that...but windows 2k will not! Also the ports and values to send and receive from are diffrent from one HDD to another for win 95 try use the WinIO dll...for win2k a vxd is required... there are diffrent methods to get that number based on HDD producer...so you will have to read all major HDD producer's docs GetVolumeinfo...only returns software number written to root dir at format time ...easy to change with a any simple program :) (or PartitionMagic) Bogdan This message was edited by BogdanOntanu, on 1/31/2001 11:44:15 PM
Posted on 2001-01-31 23:42:00 by BogdanOntanu
Before you go out and write a Vxd, there are Win32 API methods which can be used to access any disk interupt, incluing 13h, (certain) 21h, etc. Use CreateFile to open a handle to the "VWin32.VxD". Then you can use DeviceIoControl to acess many functions. All you need is the docs to them, which i cannot find on the net, so you will have to order the MSDN DDK cd.
Posted on 2001-02-01 03:48:00 by X
I've pasted the description of this API call from the MSDN CD's. The second parameter is troublesome. ************************************************** Header file: Winbase.h Windows CE versions: 1.0 and later Syntax BOOL DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ); Parameters hDevice Handle to the device that is to perform the operation. Call the CreateFile function to obtain a device handle. dwIoControlCode Specifies the control code for the operation. This value identifies the specific operation to be performed and the type of device on which the operation is to be performed. No specific values are defined for the dwIoControlCode parameter. However, the writer of a custom device driver can define IOCTL_XXXX control codes, per the CTL_CODE macro. These control codes can then be advertised, and an application can use these control codes with DeviceIoControl to perform the driver-specific functions. lpInBuffer Long pointer to a buffer that contains the data required to perform the operation. This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not require input data. nInBufferSize Size, in bytes, of the buffer pointed to by lpInBuffer. lpOutBuffer Long pointer to a buffer that receives the operationís output data. This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not produce output data. nOutBufferSize Size, in bytes, of the buffer pointed to by lpOutBuffer. lpBytesReturned Long pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer. The lpBytesReturned parameter cannot be NULL. Even when an operation produces no output data, and lpOutBuffer can be NULL, the DeviceIoControl function makes use of the variable pointed to by lpBytesReturned. After such an operation, the value of the variable is without meaning. lpOverlapped Ignored; set to NULL. Return Values Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError. Remarks When passed parameters such as DISK_IOCTL_GETINFO, the DeviceIoControl function does not change the dwBytesReturned parameter. This is because the IOCTL_GETINFO command interface returns the information to the input buffer specified with the lpOutBuffer parameter. DeviceIoControl sets dwBytesReturned only when the control code writes into the output buffer. Many other DISK_IOCTL_GET* command codes return this information in the input buffer, as well. See Also CreateEvent, CreateFile
Posted on 2001-02-01 18:32:00 by Xmas
BogdanOntanu: Don't speak to quick that serial number you get in a DOS box is the same as the one given with GetVolumeInformation and DOES CHANGE EVERY TIME YOU FORMAT THE DRIVE! This is true on every harddrive I have ever used except the ancient 20mb and 85mb drives which I'm sure nobody running any form of Win32 will have (Unless your designing for win32s). This is the same for 3-1/2 inch disks too, the serial number changes when you format, this is also now the same for Burned CD's you can specify a SerialNumber if you want to override the default one! Besides what is the purpose of this? An anti-pirating system? Remember people with registered copies of your program may change hard drives. :P See ya, Ben
Posted on 2001-02-02 01:45:00 by cyberben