mirror of
https://github.com/solemnwarning/ipxwrapper
synced 2024-12-30 16:45:37 +01:00
Fix error when reading from registry under Windows XP compatibility mode.
This commit is contained in:
parent
75bf09b66e
commit
2f81d15087
13
src/common.c
13
src/common.c
@ -248,6 +248,19 @@ char *reg_get_string(HKEY key, const char *name, const char *default_value)
|
|||||||
|
|
||||||
if(buffer != NULL)
|
if(buffer != NULL)
|
||||||
{
|
{
|
||||||
|
/* RegQueryValueEx() fails with ERROR_INVALID_PARAMETER
|
||||||
|
* when a size of zero is provided with a non-NULL buffer
|
||||||
|
* pointer when running under Windows XP compatibility
|
||||||
|
* mode (but not under actual Windows XP), so we need to
|
||||||
|
* skip the RegQueryValueEx() call when the value is an
|
||||||
|
* empty string.
|
||||||
|
*/
|
||||||
|
if(value_size == 0)
|
||||||
|
{
|
||||||
|
buffer[0] = '\0';
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
reg_err = RegQueryValueEx(key, name, NULL, &value_type, (BYTE*)(buffer), &value_size);
|
reg_err = RegQueryValueEx(key, name, NULL, &value_type, (BYTE*)(buffer), &value_size);
|
||||||
if(reg_err == ERROR_SUCCESS)
|
if(reg_err == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user