Highlighted
Absent Member.
Absent Member.
1691 views

[archive] Hard disk serial number...

[Migrated content. Thread originally posted on 07 June 2008]

I did find some codes on the net, but it's not working with Acu-Compiler.

Anyway, hope someone will find it.

Regards
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...

Hello,

Does anyone would like to share a program to get the internal hard disk serial number in windows platform?

Regards...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...

The API function GetVolumeInformation will give you the serial number.

I am afraid I have no code showing this right away, perhaps someone has.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...

I am pretty sure I made a sample program of this once and posted in the forum, have you searched in old posts?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...

I scanned this forum, but nothing....
I appreciate if you can post it again.
Regards,
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...


       IDENTIFICATION  DIVISION.
       PROGRAM-ID.     GetVolumeInformation.
       WORKING-STORAGE SECTION.
       77  BufferSize               PIC X(4) COMP-N.
       77  VolumeSerialNumber       PIC X(4) COMP-N.
       77  MaximumComponentLength   PIC X(4) COMP-N.
       77  FileSystemFlags          PIC X(4) COMP-N.
       77  RootPathName             PIC X(2048).
       77  VolumeName               PIC X(2048).
       77  FileSystemName           PIC X(2048).
       77  DisplayVolumeSerial      PIC 9(10).
       PROCEDURE   DIVISION.
       MAIN-LOGIC.
           CALL    "[EMAIL="KERNEL32.DLL@WINAPI"]KERNEL32.DLL@WINAPI[/EMAIL]".
           MOVE    2048             TO BufferSize.
           CALL    "GetCurrentDirectoryA" USING
                   BY VALUE         BufferSize
                   BY REFERENCE     RootPathName.
                   
           DISPLAY MESSAGE BOX
                   RootPathName
                   TITLE            "Current directory"
                   ICON             01
                   TYPE             01.
           MOVE    LOW-VALUE        TO RootPathName(4:1).
           CALL    "GetVolumeInformationA" USING
                   BY REFERENCE     RootPathName
                   BY REFERENCE     VolumeName
                   BY VALUE         BufferSize
                   BY REFERENCE     VolumeSerialNumber
                   BY REFERENCE     MaximumComponentLength
                   BY REFERENCE     FileSystemFlags
                   BY REFERENCE     FileSystemName
                   BY VALUE         BufferSize.
           MOVE    VolumeSerialNumber TO DisplayVolumeSerial.
           DISPLAY MESSAGE BOX
                   "Disk:"          x"09" x"09" RootPathName x"0a"
                   "Volume:"        x"09" x"09" VolumeName x"0a"
                   "File system:"   x"09" FileSystemName x"0a"
                   "Vol Serial:"    x"09" x"09" DisplayVolumeSerial
                   TITLE            "Volume information"
                   ICON             01
                   TYPE             01.
           CANCEL  "KERNEL32.DLL".
           GOBACK.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Hard disk serial number...

Thank you very very very very musch, you've done for me a great help.

Regards...
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.