Search code examples
windowslanguage-agnosticserial-numbercd-rom

CD-ROM identification through serial number


I am interested in CD identification.

My Question:

Is there a serial number that can be retrieved programmatically?

Edit (Resolved):

  1. VB version
  2. Delphi version

Solution

  • Try this code in VB

    Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    Private Sub Form_Load()
        Dim Serial As Long
        'Get the volume information
        GetVolumeInformation "d:\", vbNullString, 255, Serial, 0, 0, vbNullString, 255
    
        MsgBox Hex(Serial)
    End Sub 
    

    This should serve as a proof of concept for you. You can adapt this to your language of choice.

    Taken from here: VB Forums