Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. system phisycal drive

system phisycal drive

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R RomTibi

    How can we determine the phisycal drive where is installed the running operating sistem (windows)?

    36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

    R Offline
    R Offline
    Rajesh R Subramanian
    wrote on last edited by
    #2

    GetWindowsDirectory()[^] should help you. It will give you the whole path, but you can find the drive from the path.

    "Real men drive manual transmission" - Rajesh.

    R 1 Reply Last reply
    0
    • R RomTibi

      How can we determine the phisycal drive where is installed the running operating sistem (windows)?

      36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #3

      You can use the ExpandEnvironmentStrings API with the %SYSTEMDRIVE% environment variable.

      1 Reply Last reply
      0
      • R Rajesh R Subramanian

        GetWindowsDirectory()[^] should help you. It will give you the whole path, but you can find the drive from the path.

        "Real men drive manual transmission" - Rajesh.

        R Offline
        R Offline
        RomTibi
        wrote on last edited by
        #4

        GetWindowsDirectory()

        returns a path like **X:\**win64. I need to determine what

        \\.\PhisycalDriveN

        hosts the X: partition. Any solution?

        36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

        J 1 Reply Last reply
        0
        • R RomTibi

          GetWindowsDirectory()

          returns a path like **X:\**win64. I need to determine what

          \\.\PhisycalDriveN

          hosts the X: partition. Any solution?

          36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #5

          May be this MSDN example [^] is helpful.

          R 1 Reply Last reply
          0
          • J Jochen Arndt

            May be this MSDN example [^] is helpful.

            R Offline
            R Offline
            RomTibi
            wrote on last edited by
            #6

            I write an app for media erasure. It displays via DISK_GEOMETRY and Device IoControl PhisycalDriveX. It is important not to try erasure on the phisycal device that holds the OS. So, I need to see if the OS that runs is located on a phisycal drive that I intend to erase. Probably is better to skip that device.

            36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

            J 1 Reply Last reply
            0
            • R RomTibi

              I write an app for media erasure. It displays via DISK_GEOMETRY and Device IoControl PhisycalDriveX. It is important not to try erasure on the phisycal device that holds the OS. So, I need to see if the OS that runs is located on a phisycal drive that I intend to erase. Probably is better to skip that device.

              36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #7

              There is no API function returning the physical devive. You must use GetWindowsDirectory() and then determine the device for the drive letter.

              R 1 Reply Last reply
              0
              • J Jochen Arndt

                There is no API function returning the physical devive. You must use GetWindowsDirectory() and then determine the device for the drive letter.

                R Offline
                R Offline
                RomTibi
                wrote on last edited by
                #8

                ... and how to determine the device for the drive letter? :(

                36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                P J 2 Replies Last reply
                0
                • R RomTibi

                  ... and how to determine the device for the drive letter? :(

                  36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                  P Offline
                  P Offline
                  parths
                  wrote on last edited by
                  #9

                  Use the QueryDosDevice[^] function to get the physical device name from the drive name. Make sure the drive name does not contain the trailing '\' (e.g: use "c:" instead of "c:\\") This will give you something like \Device\HardDisk0 or whatever is relevant to your machine. I hope this helps

                  "It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman "Philosophy is a study that lets us be unhappy more intelligently." -Anon.

                  1 Reply Last reply
                  0
                  • R RomTibi

                    ... and how to determine the device for the drive letter? :(

                    36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                    J Offline
                    J Offline
                    Jochen Arndt
                    wrote on last edited by
                    #10

                    See the link from my previous post. It does not contain a ready-to-use solution, but contains enough information to do it yourself.

                    1 Reply Last reply
                    0
                    • R RomTibi

                      How can we determine the phisycal drive where is installed the running operating sistem (windows)?

                      36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                      R Offline
                      R Offline
                      RomTibi
                      wrote on last edited by
                      #11

                      The answer is here: http://www.cplusplus.com/forum/windows/12196/[^]

                      36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups