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. RegCreateKeyEx failed in Vista

RegCreateKeyEx failed in Vista

Scheduled Pinned Locked Moved C / C++ / MFC
helpwindows-adminquestion
6 Posts 6 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.
  • D Offline
    D Offline
    dharani
    wrote on last edited by
    #1

    Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

    redindian

    R C D J H 5 Replies Last reply
    0
    • D dharani

      Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

      redindian

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Did you check the return value?

      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

      1 Reply Last reply
      0
      • D dharani

        Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

        redindian

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Do you have the correct access rights ?

        Cédric Moonen Software developer
        Charting control [v1.3]

        1 Reply Last reply
        0
        • D dharani

          Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

          redindian

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

          dharani wrote:

          I call RegCreateKeyEx to create a key in the Vista registry , but it fails .

          Straight from the docs: If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.

          "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
          • D dharani

            Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

            redindian

            J Offline
            J Offline
            James R Twine
            wrote on last edited by
            #5

            dharani wrote:

            KEY_ALL_ACCESS

            Never do that - only request the access levels that you really need.    Peace!

            -=- James
            Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
            Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
            See DeleteFXPFiles

            1 Reply Last reply
            0
            • D dharani

              Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }

              redindian

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

              What was return value of dwResult ?

              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