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 Corruption

Registry Corruption

Scheduled Pinned Locked Moved C / C++ / MFC
helpcomwindows-admin
5 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.
  • A Offline
    A Offline
    aman2006
    wrote on last edited by
    #1

    Hi I am writing a program which Creates Three entries into the windows registry but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied" and after that it does not allow to create a entry into the registry, it seems that registry got corrupted but windows still works fine. I don't know. Is it the problem of Rights to write into the registrry or something else.This program works fine on my machine but does not works on some machines. Please help... BOOL CGenUniqueKeyXDlg::SaveValueToRegistry(char *pcszValue) { DWORD dwLen = 0; int nReturnVal; HKEY m_hContextKey; DWORD dwDisp; nReturnVal = RegCreateKeyEx(HKEY_LOCAL_MACHINE , //Handle to a currently open key REG_LOC_PATH, // Sub Key Name 0, //Reserved NULL, 0, KEY_WRITE, NULL, &m_hContextKey, &dwDisp ); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } nReturnVal = RegSetValueEx(m_hContextKey, UNIQUE_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } strcpy(pcszValue,m_SyncURL);//"http://Nopd/CiteCapture/MDCSync.aspx"; nReturnVal = RegSetValueEx(m_hContextKey, URL_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); strcpy(pcszValue,m_Port); nReturnVal = RegSetValueEx(m_hContextKey, COM_PORT, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); RegCloseKey( m_hContextKey ); return TRUE; } Any input will be appreciated Thanks Shailesh

    D M 2 Replies Last reply
    0
    • A aman2006

      Hi I am writing a program which Creates Three entries into the windows registry but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied" and after that it does not allow to create a entry into the registry, it seems that registry got corrupted but windows still works fine. I don't know. Is it the problem of Rights to write into the registrry or something else.This program works fine on my machine but does not works on some machines. Please help... BOOL CGenUniqueKeyXDlg::SaveValueToRegistry(char *pcszValue) { DWORD dwLen = 0; int nReturnVal; HKEY m_hContextKey; DWORD dwDisp; nReturnVal = RegCreateKeyEx(HKEY_LOCAL_MACHINE , //Handle to a currently open key REG_LOC_PATH, // Sub Key Name 0, //Reserved NULL, 0, KEY_WRITE, NULL, &m_hContextKey, &dwDisp ); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } nReturnVal = RegSetValueEx(m_hContextKey, UNIQUE_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } strcpy(pcszValue,m_SyncURL);//"http://Nopd/CiteCapture/MDCSync.aspx"; nReturnVal = RegSetValueEx(m_hContextKey, URL_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); strcpy(pcszValue,m_Port); nReturnVal = RegSetValueEx(m_hContextKey, COM_PORT, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); RegCloseKey( m_hContextKey ); return TRUE; } Any input will be appreciated Thanks Shailesh

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

      aman2006 wrote: ...but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied"... Are you sure you have 'write' permission on those particular machines? Much like you can with folders and shares, the registry can be tuned to allow/disallow certain users/groups.


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      A 1 Reply Last reply
      0
      • D David Crow

        aman2006 wrote: ...but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied"... Are you sure you have 'write' permission on those particular machines? Much like you can with folders and shares, the registry can be tuned to allow/disallow certain users/groups.


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        A Offline
        A Offline
        aman2006
        wrote on last edited by
        #3

        If i don't have write permission on that machine how can i write my entries in the Registry. In my code i am passing the Write Registry Permission as a parameter. Actuall i have made a installable with installed shield which runs my program at last for creating some entries. But it is corrupting the registry.... What about code is that fine or seems some problem????? thnaks Shailesh

        D 1 Reply Last reply
        0
        • A aman2006

          If i don't have write permission on that machine how can i write my entries in the Registry. In my code i am passing the Write Registry Permission as a parameter. Actuall i have made a installable with installed shield which runs my program at last for creating some entries. But it is corrupting the registry.... What about code is that fine or seems some problem????? thnaks Shailesh

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

          One way to tell would be to use regedit.exe to try and write something to the same spot in the registry as the code is. Be sure and log in using the same credentials as the person running your code.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          1 Reply Last reply
          0
          • A aman2006

            Hi I am writing a program which Creates Three entries into the windows registry but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied" and after that it does not allow to create a entry into the registry, it seems that registry got corrupted but windows still works fine. I don't know. Is it the problem of Rights to write into the registrry or something else.This program works fine on my machine but does not works on some machines. Please help... BOOL CGenUniqueKeyXDlg::SaveValueToRegistry(char *pcszValue) { DWORD dwLen = 0; int nReturnVal; HKEY m_hContextKey; DWORD dwDisp; nReturnVal = RegCreateKeyEx(HKEY_LOCAL_MACHINE , //Handle to a currently open key REG_LOC_PATH, // Sub Key Name 0, //Reserved NULL, 0, KEY_WRITE, NULL, &m_hContextKey, &dwDisp ); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } nReturnVal = RegSetValueEx(m_hContextKey, UNIQUE_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); if(nReturnVal != ERROR_SUCCESS) { ShowRegError(nReturnVal); return FALSE; } strcpy(pcszValue,m_SyncURL);//"http://Nopd/CiteCapture/MDCSync.aspx"; nReturnVal = RegSetValueEx(m_hContextKey, URL_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); strcpy(pcszValue,m_Port); nReturnVal = RegSetValueEx(m_hContextKey, COM_PORT, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char)); RegCloseKey( m_hContextKey ); return TRUE; } Any input will be appreciated Thanks Shailesh

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            You're asking for write access to a key under HKLM. RegCreateKeyEx() is returning access denied, which means the user doesn't have write privileges to that key. Run your code as a restricted user (not admin) and you'll see the same error. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- #include "witty-quote.h"

            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