views:

214

answers:

0

I have a program coded by someone else. It has a function RegGetValue 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 perfectly on Windows 7 but returns error when run on Windows XP (32 bit). As 32-bit xp don't have RegGetValue function so I am trying to make use of RegQueryValueEX but I am having problem in passing arguments to this function. I think it should be used some thing 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' has exited with code 1 (0x1).

Can someone help me here please?