Im trying to set an existing registry key.

#include <iostream>
#include <windows.h>
using namespace std;


int main()
{
	HKEY hk;
	char* data = "VALUE";
	
	RegOpenKeyEx(
		HKEY_CURRENT_USER,  
		NULL,
		(DWORD)0, 
		KEY_SET_VALUE, 
		&hk);

	RegSetKeyValue(
		hk, 
		(LPCTSTR)"Software\\Microsoft\\Command Processor",
		(LPCTSTR)"Autorun",
		REG_SZ,
		(LPCVOID)data,
		(DWORD)strlen(data));
}

I get an 'Entry Point Not Found' error (The procedure entry point RegSetKeyValueW could not be located in the dynamic link library ADVAPI32.dll.)

I also read somewhere that i may need at least windows vista to use these functions?

If so how can i edit the registry in C++ with windows XP (media center edition)?

Anyone? Is it possible to do without .net?

you can use some <URL SNIPPED>system tools to fix your problems

Needing vista to use those functions is BS. The functions without Ex at the end are windows 3.1 (and above) compatible and the ones with Ex at the end are Win32 compatible.

Why are you using the Win32 function to set the value, but the Windows 3.1 function to open the key? I doubt that's your problem, but just wondering.

Also, have you tried opening the subkey directly when you call RegOpenKey rather than opening the top key and trying to set it's sub-key value with SetKeyValue to see if you still get the error doing it that way?

What about checking to see if RegOpenKey returns an error or ERROR_SUCCESS? I don't see any error checking in your code. Presumably you're checking the return values in the debugger?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.