I want the code of a certain function

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 1
Reputation: boshkash1986 is an unknown quantity at this point 
Solved Threads: 0
boshkash1986 boshkash1986 is offline Offline
Newbie Poster

I want the code of a certain function

 
0
  #1
Nov 3rd, 2004
Please i want the code of the function which could get the serial number of the Hard-disk of any computer

Please Can anyone help ?
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,151
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 952
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: I want the code of a certain function

 
0
  #2
Nov 3rd, 2004
Here is a little Delphi code that gives you just a hint:
  1. // get the hard drive serial number (Delphi Pascal)
  2. procedure TForm1.SerialNumberButtonClick(Sender: TObject);
  3. var
  4. VolumeSerialNumber : DWORD;
  5. MaximumComponentLength : DWORD;
  6. FileSystemFlags : DWORD;
  7. SerialNumber : string;
  8. begin
  9. GetVolumeInformation('c:\',
  10. nil,
  11. 0,
  12. @VolumeSerialNumber,
  13. MaximumComponentLength,
  14. FileSystemFlags,
  15. nil,
  16. 0);
  17. SerialNumber := IntToHex(HiWord(VolumeSerialNumber), 4)
  18. + '-' +
  19. IntToHex(LoWord(VolumeSerialNumber), 4);
  20. Memo1.Lines.Add(SerialNumber);
  21. end;
  22.  
It uses the WinApi function:
  1. BOOL GetVolumeInformation(
  2. LPCTSTR lpRootPathName, // address of root directory of the file system
  3. LPTSTR lpVolumeNameBuffer, // address of name of the volume
  4. DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
  5. LPDWORD lpVolumeSerialNumber, // address of volume serial number
  6. LPDWORD lpMaximumComponentLength, // address of system's maximum filename length
  7. LPDWORD lpFileSystemFlags, // address of file system flags
  8. LPTSTR lpFileSystemNameBuffer, // address of name of file system
  9. DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
  10. );
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2133 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC