Commit 5c9eb190 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winemac: Directly use ntdll to write display settings.

parent ffa7c409
......@@ -178,6 +178,14 @@ static BOOL read_registry_settings(const WCHAR *device_name, DEVMODEW *dm)
}
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)
{
WCHAR wine_mac_reg_key[MAX_PATH];
......@@ -199,23 +207,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->dmDisplayFlags);
ret &= set_setting_value(hkey, "DefaultSettings.XPanning", dm->dmPosition.x);
ret &= set_setting_value(hkey, "DefaultSettings.YPanning", dm->dmPosition.y);
ret &= set_setting_value(hkey, "DefaultSettings.Orientation", dm->dmDisplayOrientation);
ret &= set_setting_value(hkey, "DefaultSettings.FixedOutput", dm->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->dmDisplayFlags);
set_value("DefaultSettings.XPanning", &dm->dmPosition.x);
set_value("DefaultSettings.YPanning", &dm->dmPosition.y);
set_value("DefaultSettings.Orientation", &dm->dmDisplayOrientation);
set_value("DefaultSettings.FixedOutput", &dm->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