| gizdaman (4) | |||
|
I have posted it in beginners forum already, but got no answer yet. I am trying to add an application to run on startup in Windows. I am using RegSetValueEx() to do this:
When I compile the code above, it runs fine, does not give any error. When I check for the return value of both ReturnOpenKeyEx and RegSetValueEx, they return ERROR_SUCCESS. But the key is not placed in the registry. Any ideas? Btw I am running Windows 7 x64. | |||
|
|
|||
| modoran (1245) | |
|
You should use RegDisableReflectionKey() API to disable registry reflection (certain registry keys are "redirected" for 32 bit processes in 64 bit versions of windows): http://msdn.microsoft.com/en-us/library/windows/desktop/ms724858(v=vs.85).aspx For more information read here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724072(v=vs.85).aspx | |
|
|
|
| gizdaman (4) | |||
|
In Windows 7 the registry reflection is deleted, so the RegDisableReflectionKey() doesn't help. Although with accessing an alternate registry view, you can access a 64-bit key either from a 32-bit or 64-bit application. So I had to add KEY_WOW64_64KEY flag to the samDesired parameter of RegOpenKeyEx(). The final code looks like this:
And it works now. Thanks for helping! | |||
|
|
|||