Results 1 to 4 of 4

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

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    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
    4,418

    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
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE 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.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    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
    4,418

    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.
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE 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.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Posting Permissions

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



Click Here to Expand Forum to Full Width