1
0
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:
Daniel Collins 2024-09-12 11:37:47 +01:00
parent 75bf09b66e
commit 2f81d15087

View File

@ -248,6 +248,19 @@ char *reg_get_string(HKEY key, const char *name, const char *default_value)
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);
if(reg_err == ERROR_SUCCESS)
{