Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6627425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:00:44+00:00 2026-05-25T22:00:44+00:00

Why The Following Code always reports C:\ although It reports different Device Name handle

  • 0

Why The Following Code always reports C:\ although It reports different Device Name

  handle = FindFirstVolumeW(volName, sizeof(volName));
  do{
    wchar_t wVolName[MAX_PATH];
    QString::fromWCharArray(volName).toWCharArray(wVolName);//make a copy of volName on wVolName
    wVolName[wcslen(volName)-1] = L'\0';
    wchar_t wDeviceName[MAX_PATH];
    int charCount = 0;
    charCount = QueryDosDeviceW(&wVolName[4], wDeviceName, ARRAYSIZE(wDeviceName));

    qDebug() << QString::fromWCharArray(wVolName) << "Device: " << QString::fromWCharArray(wDeviceName);//print wVolName and wDeviceName

    wchar_t driveName[MAX_PATH];
    GetVolumePathName(wDeviceName, driveName, MAX_PATH);
    CloseHandle(handle);

    qDebug() << QString::fromWCharArray(driveName);

  }while(FindNextVolume(handle, volName, sizeof(volName)));
  FindVolumeClose(handle);

Output:

"\\?\Volume{5c77cc58-d5ab-11e0-a0ec-806d6172696f}" Device:  "\Device\HarddiskVolume2" 
"C:\" 
"\\?\Volume{5c77cc59-d5ab-11e0-a0ec-806d6172696f}" Device:  "\Device\HarddiskVolume3" 
"C:\" 
"\\?\Volume{5c77cc57-d5ab-11e0-a0ec-806d6172696f}" Device:  "\Device\CdRom0" 
"C:\" 
"\\?\Volume{5c77cc56-d5ab-11e0-a0ec-806d6172696f}" Device:  "\Device\Floppy0" 
"C:\" 
"\\?\Volume{8d974f2c-e9a1-11e0-b7da-0013d407432f}" Device:  "\Device\Harddisk1\DP(1)0-    0+8" 
"C:\" 

Why doesn’t it report D, E, etc ..

EDIT

and How can I derive the Drive Letter assigned to the Volume

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:00:45+00:00Added an answer on May 25, 2026 at 10:00 pm

    From the GetVolumePathName documentation:

    If you specify a relative directory or file name without a volume
    qualifier, GetVolumePathName returns the drive letter of the current
    volume.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

DataAnnotations does not work with buddy class. The following code always validate true. Why
I am using following PHP code for trigger creation but always get error, please
The following code always returns false (which is incorrect, as the user has Full
The following code always uses more then ten seconds. I have upgraded the server,
I have the following code that always fails with an Abstract Error: arch :=
Following code always print paths with double slashes: use JSON; use File::Spec; my $installdir
I always use the following code to drop a database in SQL Server. IF
When I try to run the following code it always spits out the hex
Why does the following code always return true even when an exception is thrown?
What im doing wrong this time? The following code always returns 4 bytes only,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.