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. How can I Get Value of SPDRP_LEGACYBUSTYPE ?

How can I Get Value of SPDRP_LEGACYBUSTYPE ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 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.
  • 0 Offline
    0 Offline
    002comp
    wrote on last edited by
    #1

    Hello Friends I am using SetupDigetRegistryProperty to access USB Devices. So,regarding that I was trying to access Property SPDRP_LEGACYBUSTYPE which is described like this

    Quote:

    SPDRP_LEGACYBUSTYPE The function retrieves the device's legacy bus type as an INTERFACE_TYPE value (defined in Wdm.h and Ntddk.h).

    I tried to get this value in char ,it returns some special character. I tried to catch in DWORD,it returns some number.

     DWORD DataT;
     LPTSTR buffer = NULL;
     DWORD buffersize = 0;
    

    SetupDiGetDeviceRegistryProperty(
    hDevInfoSet,
    &DeviceInfoData,
    SPDRP_LEGACYBUSTYPE,
    &DataT,
    (PBYTE)buffer,
    buffersize,
    &buffersize)

    Any Ideas? Regards Y

    J 1 Reply Last reply
    0
    • 0 002comp

      Hello Friends I am using SetupDigetRegistryProperty to access USB Devices. So,regarding that I was trying to access Property SPDRP_LEGACYBUSTYPE which is described like this

      Quote:

      SPDRP_LEGACYBUSTYPE The function retrieves the device's legacy bus type as an INTERFACE_TYPE value (defined in Wdm.h and Ntddk.h).

      I tried to get this value in char ,it returns some special character. I tried to catch in DWORD,it returns some number.

       DWORD DataT;
       LPTSTR buffer = NULL;
       DWORD buffersize = 0;
      

      SetupDiGetDeviceRegistryProperty(
      hDevInfoSet,
      &DeviceInfoData,
      SPDRP_LEGACYBUSTYPE,
      &DataT,
      (PBYTE)buffer,
      buffersize,
      &buffersize)

      Any Ideas? Regards Y

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

      See DEVPKEY_Device_LegacyBusType[^] and INTERFACE_TYPE[^]. The property is of type DEVPROP_TYPE_INT32[^] requiring a buffer size of at least sizeof(LONG).

      0 2 Replies Last reply
      0
      • J Jochen Arndt

        See DEVPKEY_Device_LegacyBusType[^] and INTERFACE_TYPE[^]. The property is of type DEVPROP_TYPE_INT32[^] requiring a buffer size of at least sizeof(LONG).

        0 Offline
        0 Offline
        002comp
        wrote on last edited by
        #3

        Thanks jochen for your Reply. I tried ur way but it is not the value that I was looking For. May be you can give more Ideas. here is what I want. When I right Click on USB Device from Device manager,it open up properties Dialog where we can select property and its value. Here, I found one property "bus relation" which I am trying to get using SetupDi calls. Bus relation value is showing like this : USBPRINT\CANONIP4200\6&19ACF&0&USB001 This is the device Instance Id. But when I tried to get same using SetDiGetDeviceInstanceId,it gives me like USB\VID_04A9&PID_10A2\C34BBD How can I get USBPRINT\CANONIP4200\6&19ACF&0&USB001 ? Regards Y

        J 1 Reply Last reply
        0
        • J Jochen Arndt

          See DEVPKEY_Device_LegacyBusType[^] and INTERFACE_TYPE[^]. The property is of type DEVPROP_TYPE_INT32[^] requiring a buffer size of at least sizeof(LONG).

          0 Offline
          0 Offline
          002comp
          wrote on last edited by
          #4

          Thanks jochen for your Reply. I tried ur way but it is not the value that I was looking For. May be you can give more Ideas. here is what I want. When I right Click on USB Device from Device manager,it open up properties Dialog where we can select property and its value. Here, I found one property "bus relation" Bus relation value is showing like this : USBPRINT\CANONIP4200\6&19ACF&0&USB001 This is the device Instance Id. But when I tried to get same using SetDiGetDeviceInstanceId,it gives me like USB\VID_04A9&PID_10A2\C34BBD How can I get USBPRINT\CANONIP4200\6&19ACF&0&USB001 ? Regards Y

          1 Reply Last reply
          0
          • 0 002comp

            Thanks jochen for your Reply. I tried ur way but it is not the value that I was looking For. May be you can give more Ideas. here is what I want. When I right Click on USB Device from Device manager,it open up properties Dialog where we can select property and its value. Here, I found one property "bus relation" which I am trying to get using SetupDi calls. Bus relation value is showing like this : USBPRINT\CANONIP4200\6&19ACF&0&USB001 This is the device Instance Id. But when I tried to get same using SetDiGetDeviceInstanceId,it gives me like USB\VID_04A9&PID_10A2\C34BBD How can I get USBPRINT\CANONIP4200\6&19ACF&0&USB001 ? Regards Y

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

            At first you may read Retrieving Device Relations[^] for some background on device relations. Some googling found this site http://www.techtalkz.com/microsoft-device-drivers/262178-getting-bus-relations-device.html[^] which may help you.

            0 1 Reply Last reply
            0
            • J Jochen Arndt

              At first you may read Retrieving Device Relations[^] for some background on device relations. Some googling found this site http://www.techtalkz.com/microsoft-device-drivers/262178-getting-bus-relations-device.html[^] which may help you.

              0 Offline
              0 Offline
              002comp
              wrote on last edited by
              #6

              Thanks A Lot jochen I followed your post and get succeed in getting Bus Relation value[Device Id] which gives me Printer name. Thank you Very Much Again. Regards Y

              J 1 Reply Last reply
              0
              • 0 002comp

                Thanks A Lot jochen I followed your post and get succeed in getting Bus Relation value[Device Id] which gives me Printer name. Thank you Very Much Again. Regards Y

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

                Nice to hear that you solved the problem and thank you for the feedback.

                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