RegCreateKey Creating Key in HKEY_USERS rather than HKEY_CURRENT_USER Hive
Keywords: HKEY_CURRENT_USER
Question:
key=RegCreateKey(@REGCURRENT,"Software\ODBC\ODBC.INI\Tide") RegSetValue(key, "[Autostop]", "yes") RegCloseKey(key)Why does this insist on placing itself in the HKEY_USERS Default section. HELP!!! this is and function from within a script I wrote. When executed from within a script it will not place the key in the right area (HKEY_CURRENT_USER), it places it in HKEY_USERS???It is a compiled EXE that is pushed down to a machine and then executed. The computers will be receiving this push at all hours so it could be at a login prompt (winnt) or logged in. I am currently testing on a nt machine that has a "user" logged in...
Answer:
If it is "pushed" down, then more than likely it is running as a service and as such runs as the "default" server regardless of who might be logged in at the time.If I were to theorize on a possible solution it might be to update the "RunOnce" section of the @REGMACHINE part of the registry to launch another exe to run when the user logs in so that it runs as an user under the user. That should update the proper registry key.
Article ID: W14166Filename: RegCreateKey Creating Key in Wrong Reg Hive.txt