At 08:15 AM 10/21/2004 -0700, Jared Sowers writeth:
>
>Mainly because I am new to c++ and did not know about it.... But anyway
the following code gives the output "failed with error 127: The specified
procedure could not be found."... any help?
>
>#include <windows.h>
>#include <iostream.h>
>
>
>int main() {
>      HKEY      hkey;
>     
>      if((RegOpenKeyEx(HKEY_CURRENT_USER,
>
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\test
"),
>                        0,
>                        1,
>                        &hkey)) == ERROR_SUCCESS) {

>From MSDN Library:

"The key identified by the hKey parameter must have been opened with
KEY_SET_VALUE access. To open the key, use the RegCreateKeyEx or
RegOpenKeyEx function."

So...to fix the problem (I, for one, don't know what "1" means - and don't
care for those who are looking in their Platform SDK), don't use numbers
for access permissions and just to make sure you have enough permissions,
give the call KEY_WRITE (which includes KEY_SET_VALUE).  Use the
appropriate mask values:

  if (RegOpenKeyEx(HKEY_CURRENT_USER,
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\test
"), 0, KEY_WRITE, &hkey) == ERROR_SUCCESS)

Try that - it should work even though I didn't try it out.


Thomas J. Hruska
[EMAIL PROTECTED]

Shining Light Productions
Home of the Nuclear Vision scripting language and ProtoNova web server.
http://www.slproweb.com/





To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=294855.5468653.6549235.3001176/D=groups/S=:HM/A=2376776/rand=781250288


Yahoo! Groups Links

Reply via email to