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. SetupAPI library:SetupDiGetDeviceRegistryProperty function issue (VC++ 6.0)!

SetupAPI library:SetupDiGetDeviceRegistryProperty function issue (VC++ 6.0)!

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++toolsquestion
6 Posts 3 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.
  • C Offline
    C Offline
    callousfantom
    wrote on last edited by
    #1

    Hi, I'm fairly new to VC++ and I'm trying to develop a device manager type of utility.The problem I'm facing is with SPDRP_INSTALL_STATE property. Whenever I try to retreive this property I get the following error at compile time. error C2065: 'SPDRP_INSTALL_STATE' : undeclared identifier My syntax is: SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,&dwT,(PBYTE)&dwIS,sizeof(dwIS),NULL); where dwIS and dwT are both DWORD. I also tried the following syntax: SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,NULL,0,&reqSz); szBuf=(char *)malloc(reqSz); SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,(unsigned char *)szBuf,reqSz,&reqSz); Both give the same compilation error.I should also like to point out that the latter snippet works with other properties like SPDRP_DEVICETYPE. I've hit a dead end because of this as I need to know if the device is working properly.Any ideas?? Do I need to use cfgmgr32.h ?(Although I doubt it) Please help :((

    N 1 Reply Last reply
    0
    • C callousfantom

      Hi, I'm fairly new to VC++ and I'm trying to develop a device manager type of utility.The problem I'm facing is with SPDRP_INSTALL_STATE property. Whenever I try to retreive this property I get the following error at compile time. error C2065: 'SPDRP_INSTALL_STATE' : undeclared identifier My syntax is: SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,&dwT,(PBYTE)&dwIS,sizeof(dwIS),NULL); where dwIS and dwT are both DWORD. I also tried the following syntax: SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,NULL,0,&reqSz); szBuf=(char *)malloc(reqSz); SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,(unsigned char *)szBuf,reqSz,&reqSz); Both give the same compilation error.I should also like to point out that the latter snippet works with other properties like SPDRP_DEVICETYPE. I've hit a dead end because of this as I need to know if the device is working properly.Any ideas?? Do I need to use cfgmgr32.h ?(Although I doubt it) Please help :((

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      Do you have an old SDK? I don't know, but both values are defined in setupapi.h on my installation (w/o any #ifdefs) #define SPDRP_DEVTYPE (0x00000019) // Device Type (R/W) #define SPDRP_INSTALL_STATE (0x00000022) // Device Install State (R)

      home

      C 1 Reply Last reply
      0
      • N Niklas L

        Do you have an old SDK? I don't know, but both values are defined in setupapi.h on my installation (w/o any #ifdefs) #define SPDRP_DEVTYPE (0x00000019) // Device Type (R/W) #define SPDRP_INSTALL_STATE (0x00000022) // Device Install State (R)

        home

        C Offline
        C Offline
        callousfantom
        wrote on last edited by
        #3

        Well it must be old since it is the setupAPI.h that originally came with VC++ 6.0.0.8167 in 1998. And I checked the setupAPI.h and it doesn't have SPDRP_INSTALL_STATE property defined in it. So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones? Wouldn't there be any compatibility issues then? Even the SetupDiGetClassDevsEx in this header uses 6 parameters instead of 7 as in the newer version. But it works fine so I didn't bother!

        N L 2 Replies Last reply
        0
        • C callousfantom

          Well it must be old since it is the setupAPI.h that originally came with VC++ 6.0.0.8167 in 1998. And I checked the setupAPI.h and it doesn't have SPDRP_INSTALL_STATE property defined in it. So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones? Wouldn't there be any compatibility issues then? Even the SetupDiGetClassDevsEx in this header uses 6 parameters instead of 7 as in the newer version. But it works fine so I didn't bother!

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          It sounds a bit risky just updating parts of the SDK. There could in theory be other dependencies you don't know of. On the other hand, it might just work perfectly. Advice you, I will not.

          home

          1 Reply Last reply
          0
          • C callousfantom

            Well it must be old since it is the setupAPI.h that originally came with VC++ 6.0.0.8167 in 1998. And I checked the setupAPI.h and it doesn't have SPDRP_INSTALL_STATE property defined in it. So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones? Wouldn't there be any compatibility issues then? Even the SetupDiGetClassDevsEx in this header uses 6 parameters instead of 7 as in the newer version. But it works fine so I didn't bother!

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            callousfantom wrote:

            So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones?

            Visual Studio 6 is a very old development platform which was released way before even Windows XP was available. It is a very good IDE and there are many software developers still using it. You need to bring it up-to-date. I highly recommend the following: 1.) Install Visual Studio service pack 6[^] 2.) Install Windows Server 2003 Platform SDK[^] The Windows Server 2003 PSDK was the last SDK which was guaranteed to be compatiable with VC6... if you want to try a later SDK your on your own. Best Wishes, -David Delaune

            C 1 Reply Last reply
            0
            • L Lost User

              callousfantom wrote:

              So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones?

              Visual Studio 6 is a very old development platform which was released way before even Windows XP was available. It is a very good IDE and there are many software developers still using it. You need to bring it up-to-date. I highly recommend the following: 1.) Install Visual Studio service pack 6[^] 2.) Install Windows Server 2003 Platform SDK[^] The Windows Server 2003 PSDK was the last SDK which was guaranteed to be compatiable with VC6... if you want to try a later SDK your on your own. Best Wishes, -David Delaune

              C Offline
              C Offline
              callousfantom
              wrote on last edited by
              #6

              Thanks guys! I upgraded using the service pack 6 and used the latest SDK and that solved the problem:)

              modified on Wednesday, June 17, 2009 1:23 AM

              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