` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Hard drive serial number
1999-02-15 -- Ken Wagner
 
Here's the code to get the Serial Number. The Hex conversion is included. Windows however ignores leading zero's in the 4 + 4 display of the volume serial number. You can see this if you use My Computer and then right click on the the drive icon and select disk information. I trust this gets you closer to your goal. See code below. Best regards for a flawless compile, PROGRAM !"After global includes" MAP COMPILE('***',_WIDTH32_) MODULE('WIN32.LIB') GetVolumeInformationA(*CSTRING,*CSTRING,LONG,*ULONG,*ULONG,*ULONG,*CSTRING,ULONG),BOOL,PASCAL,RAW END END *** LOC:RootPathName CSTRING(255) LOC:VolNameBuffer CSTRING(255) LOC:VolNameSize LONG LOC:VolSerialNr ULONG LOC:MaxFCL ULONG LOC:MaxFCF ULONG LOC:FileSystem CSTRING(255) LOC:FileSystemSize ULONG LOC:Entries ULONG LOC:SerialNo STRING(8) LOC:Result BYTE H LONG S BYTE N SHORT CODE LOC:RootPathName = 'C:\' LOC:VolNameSize = SIZE(LOC:VolNameBuffer) LOC:FileSystemSize = SIZE(LOC:FileSystem) CLEAR(LOC:VolSerialNr) X# = GetVolumeInformationA(LOC:RootPathName, | LOC:VolNameBuffer, | LOC:VolNameSize, | LOC:VolSerialNr, | LOC:MaxFCL, | LOC:MaxFCF, | LOC:FileSystem, | LOC:FileSystemSize) DO DecToHex MESSAGE('X#: ' & X# & '|' & | LOC:RootPathName & '|' & | LOC:VolNameBuffer & '|' & | LOC:VolNameSize & '|' & | LOC:SerialNo & '|' & | LOC:MaxFCL & '|' & | LOC:MaxFCF & '|' & | LOC:FileSystem & '|' & | LOC:FileSystemSize) DecToHex ROUTINE N = 1 LOOP H = (16 ^ N) IF H > LOC:VolSerialNr THEN BREAK. N += 1 END N -= 1 LOOP LOC:Result = INT(LOC:VolSerialNr / (16^N)) CASE LOC:Result OF 0 LOC:SerialNo[8-N] = '0' OF 1 LOC:SerialNo[8-N] = '1' OF 2 LOC:SerialNo[8-N] = '2' OF 3 LOC:SerialNo[8-N] = '3' OF 4 LOC:SerialNo[8-N] = '4' OF 5 LOC:SerialNo[8-N] = '5' OF 6 LOC:SerialNo[8-N] = '6' OF 7 LOC:SerialNo[8-N] = '7' OF 8 LOC:SerialNo[8-N] = '8' OF 9 LOC:SerialNo[8-N] = '9' OF 10 LOC:SerialNo[8-N] = 'A' OF 11 LOC:SerialNo[8-N] = 'B' OF 12 LOC:SerialNo[8-N] = 'C' OF 13 LOC:SerialNo[8-N] = 'D' OF 14 LOC:SerialNo[8-N] = 'E' OF 15 LOC:SerialNo[8-N] = 'F' END IF N < 0 THEN BREAK. IF N > 0 LOC:VolSerialNr = LOC:VolSerialNr - (LOC:Result*(16^N)) END N -= 1 END


Today is December 3, 2024, 11:55 am
This article has been viewed 35215 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: