Commit 91d6e8b4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Directly use ntdll for registry access in write_registry_settings.

parent bdbbc346
EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = winex11.drv
IMPORTS = uuid user32 gdi32 advapi32 win32u
IMPORTS = uuid user32 gdi32 win32u
DELAYIMPORTS = comctl32 ole32 shell32 imm32
EXTRAINCL = $(X_CFLAGS)
EXTRALIBS = $(X_LIBS) $(X_EXTRA_LIBS)
......
......@@ -319,6 +319,13 @@ static BOOL read_registry_settings(const WCHAR *device_name, DEVMODEW *dm)
return ret;
}
static BOOL set_setting_value( HKEY hkey, const char *name, DWORD val )
{
WCHAR nameW[128];
UNICODE_STRING str = { asciiz_to_unicode( nameW, name ) - sizeof(WCHAR), sizeof(nameW), nameW };
return !NtSetValueKey( hkey, &str, 0, REG_DWORD, &val, sizeof(val) );
}
static BOOL write_registry_settings(const WCHAR *device_name, const DEVMODEW *dm)
{
HANDLE mutex;
......@@ -332,23 +339,17 @@ static BOOL write_registry_settings(const WCHAR *device_name, const DEVMODEW *dm
return FALSE;
}
#define set_value(name, data) \
if (RegSetValueExA(hkey, name, 0, REG_DWORD, (const BYTE*)(data), sizeof(DWORD))) \
ret = FALSE
ret &= set_setting_value( hkey, "DefaultSettings.BitsPerPel", dm->dmBitsPerPel );
ret &= set_setting_value( hkey, "DefaultSettings.XResolution", dm->dmPelsWidth );
ret &= set_setting_value( hkey, "DefaultSettings.YResolution", dm->dmPelsHeight );
ret &= set_setting_value( hkey, "DefaultSettings.VRefresh", dm->dmDisplayFrequency );
ret &= set_setting_value( hkey, "DefaultSettings.Flags", dm->u2.dmDisplayFlags );
ret &= set_setting_value( hkey, "DefaultSettings.XPanning", dm->u1.s2.dmPosition.x );
ret &= set_setting_value( hkey, "DefaultSettings.YPanning", dm->u1.s2.dmPosition.y );
ret &= set_setting_value( hkey, "DefaultSettings.Orientation", dm->u1.s2.dmDisplayOrientation );
ret &= set_setting_value( hkey, "DefaultSettings.FixedOutput", dm->u1.s2.dmDisplayFixedOutput );
set_value("DefaultSettings.BitsPerPel", &dm->dmBitsPerPel);
set_value("DefaultSettings.XResolution", &dm->dmPelsWidth);
set_value("DefaultSettings.YResolution", &dm->dmPelsHeight);
set_value("DefaultSettings.VRefresh", &dm->dmDisplayFrequency);
set_value("DefaultSettings.Flags", &dm->u2.dmDisplayFlags);
set_value("DefaultSettings.XPanning", &dm->u1.s2.dmPosition.x);
set_value("DefaultSettings.YPanning", &dm->u1.s2.dmPosition.y);
set_value("DefaultSettings.Orientation", &dm->u1.s2.dmDisplayOrientation);
set_value("DefaultSettings.FixedOutput", &dm->u1.s2.dmDisplayFixedOutput);
#undef set_value
RegCloseKey(hkey);
NtClose( hkey );
release_display_device_init_mutex(mutex);
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment