dcsimg
Results 1 to 4 of 4

Thread: How do I get raw access to CD-ROM drive in VB6?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2008
    Posts
    992

    How do I get raw access to CD-ROM drive in VB6?

    If I want access to the main FILE SYSTEM (not actual drive) for any harddrive, floppy, CD-ROM etc, I can use the "drive letter" in conjunction with CreateFile with a string that has the drive letter like this: "\\.\C:" or "\\.\E".

    Now if I want to read the raw physical disk for a harddrive, starting with sector 1 (well before the start of the file system), I can use this for the file name in CreateFile instead: "\\.\PhysicalDrive0" or "\\.\PhysicalDrive1".

    But what is the equivalent for "\\.\PhysicalDrive#" when talking about a CD-ROM disk? Like a harddisk, there is a structure on a CD-ROM disk that exists outside the file system that defines many things such as where the file system itself starts, and what kind of file system is in (if it's Joliet or UDF, etc). To get these additional bytes of data, I CANNOT just read the file system defined by "\\.\E:" and instead will need raw disk access equivalent to "\\.\PhysicalDrive#" for a harddrive. Is there such a device string for raw reading a CD-ROM drive? If so, what is this string?

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,870

    Re: How do I get raw access to CD-ROM drive in VB6?

    Seems there is no "\\.\PhysicalDrive#" for removable devices
    https://stackoverflow.com/questions/...-the-drive-let
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2008
    Posts
    992

    Re: How do I get raw access to CD-ROM drive in VB6?

    Quote Originally Posted by Zvoni View Post
    Seems there is no "\\.\PhysicalDrive#" for removable devices
    https://stackoverflow.com/questions/...-the-drive-let
    What I meant is, is there a different WORD to use in place of "PhysicalDrive" when referring to a CDROM drive? Like would I need "\\.\CDROM#" or "\\.\OpticalDrive#", or something like that?

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,870

    Re: How do I get raw access to CD-ROM drive in VB6?

    From my link above:
    You normally want to use GetDriveType to figure out what kind of disk you have, and only if that says it's a DRIVE_FIXED do you attempt to find the drive number and use "\\.\PhysicalDriveN" with it.
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width