### c++ regcreatekeyex compile error

I want photoshop to start at my computer at work. Its not compile help me! Can u explain me what is the 5 and 6 arguments? Can i do KEY_CREATE_LINK instead of key all access? When i use KEY_CREATE_LINK can i modify registry values set to KEY_CREATE_LINK?

my code:
`RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\MICROSOFT\\WINDOWS\\CURRENTVERSION\\RUN\\photoshop",0,NULL,REG_OPTION_BACKUP_RESTORE,KEY_ALL_ACCESS,NULL,&myhwnd,NULL) ;`

the function doenst return ERROR_SUCESS
how to fix it? maybe its because of the av?
WHY U USE \\ FOR THE PATH OF THE KEY??
Last edited on
<snip>

Andy

(I read the message backwards and gave a solution to fix the symptom. But now I've finished reading up the message, I think the starting premise is flawed.)
Last edited on
help me
Backslashes are used for escape sequences so to get a single backslash, you need to double them up e.g.

 ```"\\" gives you \ "\"" gives you " etc... ```

And if I'm not mistaken, creating a key in HKLM requires elevated privileges. If the function doesn't return ERROR_SUCCESS, what does it return? Have you looked up the return value to see why it's failing?

For reference: http://msdn.microsoft.com/en-us/library/ms724844(VS.85).aspx
Last edited on
As lodger said you may need higher privileges you can use UAC, to create run-time UAC windows you can use this: http://www.codeproject.com/Articles/320748/Haephrati-Elevating-during-runtime

Do be aware it is a tutorial not a code snippet, if it fails even with elevated privileges, there could be some sort of error , check Error Values.

There should be no errors as you should be having complete system access excluding NT AUTHORITY\SYSTEM user account. Normally I don't do this because some AV's block access to vulnerable processes\registry so try inject it into csrss.exe then change the registry from csrss.exe memory space although if that is also blocked, I would suspect some Malware or something shady.
Topic archived. No new replies allowed.