Registry functions are returned "not found" on keys that certainly exist. I have the correct encoding and using double backslash so that is not a problem.
Here is the key export result:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Netmon3] "NetmonVersion"="3.4.2350.0" "NPLVersion"="03.02" "InstallDir"="C:\\prog\\netmon3\\" "NetmonEdition"="Capture and Parser Engine"
Here is the function call:
x = RegOpenKeyExA( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Netmon3", 0, KEY_READ, &hKey);
The return value of x is 2, which means ERROR_FILE_NOT_FOUND . Using just " SOFTWARE\\Microsoft " as the line works fine.
Calling RegGetValue () has the same problem:
x = RegGetValueA( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Netmon3", "InstallDir", RRF_RT_ANY, NULL, (PVOID)install_directory, &BufferSize );
Again, I get 2 as a result, which means it is not found.
I checked the permissions for it, and all "Users" have "Read" permissions.
No matter what I am missing, I need to see something obvious, but I break my brains, I do not see this.
-
Marsh Ray has the following answer: I was building a 32-bit version on a 64-bit system, and the installation of Netmon3 was 64-bit. Changing the build settings to 64-bit fixed the problem.