RegCreateKeyEx
-
Hi All, Im creating a dll and I want to put in the code a way to create a registry key. Im only trying to do something very simple - (1) Create a registry key & (2) Have a vaule pointing to the root of c:\ Ive just tried the basic regcreatekeyex method and although it compiles it does not actually create anything and I think ive missed something very fundamental here (please forgive the noobie status). Here is the code: DWORD dwRes, dwDisposition; SECURITY_ATTRIBUTES sa; LONG lRes; HKEY hkSub = NULL; lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0, KEY_READ | KEY_WRITE, &sa, &hkSub, &dwDisposition); It compiles fine but when i run regedit and try to find "mykey" it comes up with nothing. Any help would be greatly appreciated. Thanks Nic :confused:
-
Hi All, Im creating a dll and I want to put in the code a way to create a registry key. Im only trying to do something very simple - (1) Create a registry key & (2) Have a vaule pointing to the root of c:\ Ive just tried the basic regcreatekeyex method and although it compiles it does not actually create anything and I think ive missed something very fundamental here (please forgive the noobie status). Here is the code: DWORD dwRes, dwDisposition; SECURITY_ATTRIBUTES sa; LONG lRes; HKEY hkSub = NULL; lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0, KEY_READ | KEY_WRITE, &sa, &hkSub, &dwDisposition); It compiles fine but when i run regedit and try to find "mykey" it comes up with nothing. Any help would be greatly appreciated. Thanks Nic :confused:
try: lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hkSub, &dwDisposition); Since you don^t fill the security attributes struct, passing a NULL pointer should do what you want. Same with classname..... Greetings, Davy