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

  • SEARCH
  • Home
  • 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 7165071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:10:49+00:00 2026-05-28T14:10:49+00:00

I’m searching about this since last week, almost all links about DriveLetter x DevicePath/Volume/Device

  • 0

I’m searching about this since last week, almost all links about DriveLetter x DevicePath/Volume/Device ID/whatever are purple for me.

I’m developing an application that List some sotorage devices and also HDI/WPD devices using SetupApi functions with these guids GUID_DEVINTERFACE_USB_DEVICE “A5DCBF10-6530-11D2-901F-00C04FB951ED”, GUID_DEVINTERFACE_VOLUME “53F5630D-B6BF-11D0-94F2-00A0C91EFB8B”.

So… I already able to map devices with drive letter. How?
With SetupApi result, using DevicePath to get a DiskNumber and PartitionNumber with DeviceIOControl. And it’s ok!!! Actually not all.
Actually to CDROM drives I can’t get it.

Here’s my code.

int bytesReturned = 0;
IOCTL.DiskExtents de1 = new IOCTL.DiskExtents();
int numDiskExtents = 0;
IntPtr ptrDe1 = Marshal.AllocHGlobal(Marshal.SizeOf(de1));
bool result = IOCTL.DeviceIoControl(FileHandle, IOCTL.IOControlCodes.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, IntPtr.Zero, 0, ptrDe1, Marshal.SizeOf(de1), bytesReturned, null);
if ((!result)) {
    Marshal.FreeHGlobal(ptrDe1);
    //libera a memória alocada.
    throw new System.ComponentModel.Win32Exception(); //is thrown here
} else {
    de1 = Marshal.PtrToStructure(ptrDe1, typeof(IOCTL.DiskExtents));
    Marshal.FreeHGlobal(ptrDe1);
    return de1.first.DiskNumber;
}

For all CDROM drive I have, an IncorrectFunction is thrown.

For get the FileHandle I use both, Drive Letter (like “\.\D:”) and Device Path. And both fail.

I don’t know if I am doing something wrong, ’cause this work for USB Mass Storage and hard disks.

Thanks.

  • 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-28T14:10:50+00:00Added an answer on May 28, 2026 at 2:10 pm

    Now I’m using VolumeName from DevicePath instead of DiskNumber and PartitionNumber.
    We get a VolumeName from “\.\C:” and the DevicePath.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

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.