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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can i get Partition name from partition number?

How can i get Partition name from partition number?

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 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.
  • B Offline
    B Offline
    Banks K
    wrote on last edited by
    #1

    Hello All, i have to find Partition name like(New Volume(K:)) but by using partition number because i am having PARTITION_INFORMATION structure in the project. now i am unable to get PArtition Name by using Partition Number. if you have any idea about this please please share with me. thanks bankey

    N 1 Reply Last reply
    0
    • B Banks K

      Hello All, i have to find Partition name like(New Volume(K:)) but by using partition number because i am having PARTITION_INFORMATION structure in the project. now i am unable to get PArtition Name by using Partition Number. if you have any idea about this please please share with me. thanks bankey

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      the volume name can be found out from the from GetVolumeInformation(). This function requires the drive letter not the partion number.If you manage to get the drive letter, you can get the volume name. If there is no staright way for doing this, you can use the below method. You can use the QueryDosDevice() function to find the diive letter from parition name. for eg consider the below code. If 'c' is the first partion, the tcDeviceName will contain \Device\HarddiskVolume1. and if you give 'd:', it will be \Device\HarddiskVolume2 and so on TCHAR tcDeviceName[50]; QueryDosDevice( _T("C:"), tcDeviceName, 50 ); suppose you got 1 in the PARTITION_INFORMATION. then make string like "\Device\HarddiskVolume1". Now starting from A to Z, put a loop and call the QueryDosDevice. Compare the device name with the "\Device\HarddiskVolume1". If it matches, you have the drive letter.

      nave [OpenedFileFinder]

      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