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. Registry key

Registry key

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-admin
10 Posts 4 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.
  • F Offline
    F Offline
    ftsOne
    wrote on last edited by
    #1

    Hi, Is there a way to get the full path from an open HKEY; How can I get from HKEY hKey to HKEY_LOCAL_MACHINE\SOFTWARE\.........? Thanks.

    J H 2 Replies Last reply
    0
    • F ftsOne

      Hi, Is there a way to get the full path from an open HKEY; How can I get from HKEY hKey to HKEY_LOCAL_MACHINE\SOFTWARE\.........? Thanks.

      J Offline
      J Offline
      Jhony george
      wrote on last edited by
      #2

      ftsOne wrote:

      Is there a way to get the full path

      Yes, we can.. REGOPENKEY - To open the Registry REGQUERYVALE - belongs to ur queried value REGCLOSEKEY - closing the registry... this kind of API's are there.

      Born to win...!

      F 1 Reply Last reply
      0
      • J Jhony george

        ftsOne wrote:

        Is there a way to get the full path

        Yes, we can.. REGOPENKEY - To open the Registry REGQUERYVALE - belongs to ur queried value REGCLOSEKEY - closing the registry... this kind of API's are there.

        Born to win...!

        F Offline
        F Offline
        ftsOne
        wrote on last edited by
        #3

        Hi and thanks for the quick reply. I know of those API's and googled, yahooed, and whatever else I could think of, just in case I've missed anything. What I've found is that hKey will give me something like Microsoft\MediaPlayer but not HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer. What I need is to determine if hKey is actually pointing to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft and not to HKEY_CURRENT_USER\SOFTWARE\Microsoft. Any insight would be greatly appreciated.

        J 1 Reply Last reply
        0
        • F ftsOne

          Hi and thanks for the quick reply. I know of those API's and googled, yahooed, and whatever else I could think of, just in case I've missed anything. What I've found is that hKey will give me something like Microsoft\MediaPlayer but not HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer. What I need is to determine if hKey is actually pointing to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft and not to HKEY_CURRENT_USER\SOFTWARE\Microsoft. Any insight would be greatly appreciated.

          J Offline
          J Offline
          Jhony george
          wrote on last edited by
          #4

          ftsOne wrote:

          What I've found is that hKey will give me something like Microsoft\MediaPlayer but not HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer.

          No, it is giving full path only... Hope u gone through this page..If not... http://msdn2.microsoft.com/en-us/library/ms724909(VS.85).aspx[^] have a look... we will get full path ya

          Born to win...!

          F 1 Reply Last reply
          0
          • J Jhony george

            ftsOne wrote:

            What I've found is that hKey will give me something like Microsoft\MediaPlayer but not HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer.

            No, it is giving full path only... Hope u gone through this page..If not... http://msdn2.microsoft.com/en-us/library/ms724909(VS.85).aspx[^] have a look... we will get full path ya

            Born to win...!

            F Offline
            F Offline
            ftsOne
            wrote on last edited by
            #5

            Hi again, Yeah, I went through that page. I also scrutinized everything that started with Reg... That API only gives you the value associated with the open key. It does not give you the full path to the key. I can enumerate the values and subkeys. What I need is the path to the open key. Thanks again.

            J 1 Reply Last reply
            0
            • F ftsOne

              Hi again, Yeah, I went through that page. I also scrutinized everything that started with Reg... That API only gives you the value associated with the open key. It does not give you the full path to the key. I can enumerate the values and subkeys. What I need is the path to the open key. Thanks again.

              J Offline
              J Offline
              Jhony george
              wrote on last edited by
              #6

              Can u send me ur code..i will check it ..and i will tell U

              Born to win...!

              F 1 Reply Last reply
              0
              • J Jhony george

                Can u send me ur code..i will check it ..and i will tell U

                Born to win...!

                F Offline
                F Offline
                ftsOne
                wrote on last edited by
                #7

                void SearchHive(HKEY hive) { HKEY hKey; DWORD dwIndex = 0; LONG lRet; DWORD cbName = IS_KEY_LEN; TCHAR szSubKeyName[IS_KEY_LEN]; if (::RegOpenKeyEx(hive, NULL, 0, KEY_READ, &hKey) != ERROR_SUCCESS || g_bCancelSearch) goto Stop; while (((lRet = ::RegEnumKeyEx(hKey, dwIndex, szSubKeyName, &cbName, NULL,NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS) && g_bCancelSearch != true) { // Do we have a key to open? if (lRet == ERROR_SUCCESS) { /********************************************** Do Something with the key hKey is an open HKEY handle returned by ::RegOpenKeyEx szSubKeyName is the key in string format returned by ::RegEnumKeyEx at dwIndex usually something like 'SOFTWARE' or 'HARDWARE' what is the human readable format for hKey for example: convertHKEYtoString(hKey) would return something like HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyApp\MySettings /*********************************************/ } dwIndex++; cbName = IS_KEY_LEN; } Stop: //No more subkeys ::RegCloseKey(hKey); }

                1 Reply Last reply
                0
                • F ftsOne

                  Hi, Is there a way to get the full path from an open HKEY; How can I get from HKEY hKey to HKEY_LOCAL_MACHINE\SOFTWARE\.........? Thanks.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  And see A Registry Class[^].

                  F 1 Reply Last reply
                  0
                  • H Hamid Taebi

                    And see A Registry Class[^].

                    F Offline
                    F Offline
                    ftsOne
                    wrote on last edited by
                    #9

                    Hi, I have found several registry classes here at code project actually. All of them assume you have the path (ie: HKEY_LOCAL_MACHINE\SOFTWARE\MyApp) to open the hKey. I have the an open hKey and want the path in a string format to display it on a control. '0X80000000' means nothing to the user, where as 'HKEY_LOCAL_MACHINE\SOFTWARE\MyApp' would be helpfull. I can walk the key from a predefined key like HKLM forward, what I need is to walk backwards back to HKLM.

                    D 1 Reply Last reply
                    0
                    • F ftsOne

                      Hi, I have found several registry classes here at code project actually. All of them assume you have the path (ie: HKEY_LOCAL_MACHINE\SOFTWARE\MyApp) to open the hKey. I have the an open hKey and want the path in a string format to display it on a control. '0X80000000' means nothing to the user, where as 'HKEY_LOCAL_MACHINE\SOFTWARE\MyApp' would be helpfull. I can walk the key from a predefined key like HKLM forward, what I need is to walk backwards back to HKLM.

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      I guess the bigger question is why do you need this information? Perhaps if you explained, we might could offer a different approach.

                      "Love people and use things, not love things and use people." - Unknown

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      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