   registry editing access
  Hello everyone,I'm trying to write something to the registry, but it's always returning ERROR_ACCESS_DENIED when i try to open HKEY_LOCAL_MACHINE, at the moment i have:LONG WriteToRegistry ( char* path, UINT pathSize ){HKEY key;LONG result = RegOpenKeyExA ( HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\Run", NULL, KEY_WRITE, &key);if ( result != ERROR_SUCCESS )return result; //it always returns here, and its 5 (ERROR_ACCESS_DENIED)result = RegSetKeyValueA ( key, "", "Windows Manager", REG_SZ, path, pathSize );RegCloseKey ( key );return result;}how can i get access to read/write to the HKLM?Thanks in advance.-Hassan   
Quote:Original post by matt1Your blog is very much useful and rocking dear. you have provided detailed knowledge and information about today's latest technologies, online communications and other businesses LINKREMOVED. If you want to get the knowledge of latest technologies, then you must take a latest information. For the some developing success, you can get information about web development. Thanks a lot for your great post. I really enjoy your post and also wait for your latest posts. Well done.huh? blog? useful? detailed knowledge? what.   ;  That's probably a keylogger, don't click the link.   ;Quote:Original post by HassanbasilQuote:Original post by matt1Your blog is very much useful and rocking dear. you have provided detailed knowledge and information about today's latest technologies, online communications and other businesses LINKREMOVED. If you want to get the knowledge of latest technologies, then you must take a latest information. For the some developing success, you can get information about web development. Thanks a lot for your great post. I really enjoy your post and also wait for your latest posts. Well done.huh? blog? useful? detailed knowledge? what.He is either a blatantly dumb spammer (look into the details), or a braindead spam bot.   ;  You will need to run your application as an administrator. You can get Windows to prompt to run as an administrator automatically by embedding a manifest file.Of course, running as an administrator is not very practical, so only do so if you absolutely need to write to that key.   ;Quote:Original post by benryvesYou will need to run your application as an administrator. You can get Windows to prompt to run as an administrator automatically by embedding a manifest file.Of course, running as an administrator is not very practical, so only do so if you absolutely need to write to that key.is there any easier way? i dont seem to get anything written on that page, do i need to write some xml code or something?   ;Quote:Original post by Hassanbasilis there any easier way? i dont seem to get anything written on that page, do i need to write some xml code or something?You could ask the user to run the program as an administrator manually (possibly displaying an error message to that effect when running the application without administrative rights). Alternatively you could name the executable something that Windows automatically assumes requires administrative privileges (include the word "setup", "install" or "patch" in there somewhere), though neither is very elegant.This blog has a slightly less intimidating guide to using manifest files to prompt for elevation.   ;Quote:Original post by benryvesAlternatively you could name the executable something that Windows automatically assumes requires administrative privileges (include the word "setup", "install" or "patch" in there somewhere)hmm, if i add "setup" in the file name, it gains administrator access?   ;Quote:Original post by HassanbasilQuote:Original post by benryvesAlternatively you could name the executable something that Windows automatically assumes requires administrative privileges (include the word "setup", "install" or "patch" in there somewhere)hmm, if i add "setup" in the file name, it gains administrator access?Vista (and presumably 7) will assume that it requires administrator privileges (as most installers usually do) and will prompt the user to elevate when they run the application. If you rename your executable to contain one of those words note that Windows automatically adds the UAC shield to its icon. This won't help you with old versions of Windows, though. It is a fragile workaround at best.   ;  i havn't tried doing that on xp, does it also require the administrator access? well, i think i found an alternative way, i hope it works.   