RegGetValue vs RegQueryValueEx

I have a program encoded by someone else. It has a RegGetValue function, which is used as:

uFuncReturnValue = RegOpenKeyExA( HKEY_LOCAL_MACHINE, acSubKey, NULL, KEY_READ | KEY_WRITE, &hRegistry ); //Store signature of the disk in the first 32 bytes of structVal if( uFuncReturnValue != ERROR_SUCCESS ) { printf("Unable to open registry with error %u\n", uFuncReturnValue); exit(EXIT_FAILURE);; } uFuncReturnValue = RegGetValueA( hRegistry, NULL, "\\DosDevices\\C:", RRF_RT_REG_BINARY, NULL, (LPVOID)&structVal, &dwSize ); 

This block of code works fine in Windows 7, but returns an error on startup in Windows XP (32 bits). Since 32-bit xp does not have a RegGetValue function, so I'm trying to use RegQueryValueEX , but I am having trouble passing arguments to this function. I think you need to use something like:

 uFuncReturnValue = RegQueryValueExA ( hRegistry, "\\DosDevices\\J:", NULL, NULL, (LPBYTE) &structVal, &dwSize ); 

But something is wrong here, because the code compiles successfully, but when I execute it, I get a message:

The program '(128) myProgram.exe: Native "exited with code 1 (0x1).

Can anyone help me here?

+6
windows registry
source share

No one has answered this question yet.

See related questions:

130
Why doesn't Environment.Exit () end the program anymore?
26
Getting the name / description of a Windows system error code from its hexadecimal number
5
Is HKLM \ SYSTEM \ CurrentControlSet \ Control \ TimeZoneInformation \ TimeZoneKeyName damaged?
one
How to initialize a disk on a Windows 2008/2012 server through a C ++ program
one
try changing ActivePowerScheme: RegOpenKeyEx failed with error 0
one
RegQueryValue error, but RegQueryValueEx returns
0
Removing 32 registry keys from application 64
0
Scan the COM dll registry without administrator privileges
0
Registry functions do not work in some circumstances
0
Get the machine name from the registry using RegQueryValueEx

All Articles