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 8708149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:03:25+00:00 2026-06-13T04:03:25+00:00

I am developing a C# windows application using .NET Framework v3.5. Every USB device

  • 0

I am developing a C# windows application using .NET Framework v3.5.

Every USB device should have a unique instance id that distinguishes a it from other devices of the same type on a computer.

In case that the device InstanceID is not unique, the PnP manager modifies the InstanceID, and combines it with the corresponding DeviceTypeID, to create a device instance ID that is unique in the system.

I need to find if the USB Device Instance Id is unique system-wide.

I can use IRP_MN_QUERY_CAPABILITIES to retrieve the device capabilities,
and then check the UniqueID member of the DEVICE_CAPABILITIES to indicate if a instance ID is unique across the system.

My questions are:

  1. How can I use IRP_MN_QUERY_CAPABILITIES in c#
  2. Is there a C++ sample code on how to use this query?
  3. Is there any other way to know if the instance id is not unique?
  • 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-06-13T04:03:27+00:00Added an answer on June 13, 2026 at 4:03 am

    I found a solution, I used SetupDiGetDeviceRegistryProperty and asked for the DEVICE_CAPABILITIES structure

     private static bool IsDeviceIdUnique(IntPtr usbDev, NativeMethods.SP_DEVINFO_DATA devInfoData,string deviceId)
        {
            uint bufferSize;
            uint propertyRegDataType;
            var buffer = new byte[WinConstants.MAX_PATH];
            NativeMethods.SetupDiGetDeviceRegistryProperty(usbDev, ref devInfoData, WinConstants.SPDRP_CAPABILITIES, out propertyRegDataType, buffer, WinConstants.MAX_PATH, out bufferSize);
            var capabilities = BitConverter.ToUInt32(buffer, 0);
            return (capabilities & WinConstants.CM_DEVCAP_UNIQUEID) == WinConstants.CM_DEVCAP_UNIQUEID;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Windows Application using the .net Framework 2.0 and Visual C#(Microsoft
I'm developing a Windows Mobile 5.0 and above application using .Net Compact Framework 2.0
I'm developing a application for Windows Mobile using C#(.Net Compact Framework 3.5), but I
I am developing a windows application in .NET framework, using C#. At the time
I am developing a windows application in .NET framework, using C#. At the time
I am developing an Windows Forms application using VB.NET that offers the user to
We developing an Application using .NET Framework 4.0 (C#) windows forms based application. Now,
I'm developing a Windows Mobile 5.0 or above WinForm application using .NET Compact Framework
Hai I am Developing an Windows application using C#.Net where I have to block
I'm developing simple C# application using Windows.Forms on .NET. I need some button that

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.