RegGetValue与RegQueryValueEx

cho*_*hoc 7 windows registry

我有一个由其他人编码的程序.它有一个函数RegGetValue用作:

 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
                        );
Run Code Online (Sandbox Code Playgroud)

此代码块在Windows 7上完美运行,但在Windows XP(32位)上运行时返回错误.因为32位xp没有RegGetValue函数所以我试图使用RegQueryValueEX但是我在向这个函数传递参数时遇到了问题.我认为它应该用于某些事情:

uFuncReturnValue = RegQueryValueExA ( hRegistry, 
                                  "\\DosDevices\\J:",
                                  NULL,
                                  NULL,
                                  (LPBYTE) &structVal,
                                  &dwSize
                                  );
Run Code Online (Sandbox Code Playgroud)

但是这里有些错误,因为代码编译成功,但是当我执行它时,我收到一条消息:

程序'(128)myProgram.exe:Native'已退出代码1(0x1).

有人可以帮我吗?