mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[SYSSETUP][UNATTENDED] Allow changing the resolution automatically. CORE-13315
svn path=/trunk/; revision=74679
This commit is contained in:
parent
acc9f33775
commit
31391c60b1
2 changed files with 72 additions and 0 deletions
|
@ -56,3 +56,11 @@ LocaleID = 409
|
||||||
; [GuiRunOnce]
|
; [GuiRunOnce]
|
||||||
; %SystemRoot%\system32\cmd.exe
|
; %SystemRoot%\system32\cmd.exe
|
||||||
|
|
||||||
|
|
||||||
|
; enable this section to change resolution / bpp
|
||||||
|
; setting a value to 0 or skipping it will leave it unchanged
|
||||||
|
; [Display]
|
||||||
|
; BitsPerPel = 32
|
||||||
|
; XResolution = 1440
|
||||||
|
; YResolution = 900
|
||||||
|
; VRefresh = 0
|
||||||
|
|
|
@ -2211,6 +2211,70 @@ ProcessUnattendInf(
|
||||||
}
|
}
|
||||||
while (SetupFindNextLine(&InfContext, &InfContext));
|
while (SetupFindNextLine(&InfContext, &InfContext));
|
||||||
|
|
||||||
|
if (SetupFindFirstLineW(pSetupData->hUnattendedInf,
|
||||||
|
L"Display",
|
||||||
|
NULL,
|
||||||
|
&InfContext))
|
||||||
|
{
|
||||||
|
DEVMODEW dm = { { 0 } };
|
||||||
|
dm.dmSize = sizeof(dm);
|
||||||
|
if (EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
int iValue;
|
||||||
|
if (!SetupGetStringFieldW(&InfContext,
|
||||||
|
0,
|
||||||
|
szName,
|
||||||
|
sizeof(szName) / sizeof(WCHAR),
|
||||||
|
&LineLength))
|
||||||
|
{
|
||||||
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SetupGetStringFieldW(&InfContext,
|
||||||
|
1,
|
||||||
|
szValue,
|
||||||
|
sizeof(szValue) / sizeof(WCHAR),
|
||||||
|
&LineLength))
|
||||||
|
{
|
||||||
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
iValue = _wtoi(szValue);
|
||||||
|
DPRINT1("Name %S Value %i\n", szName, iValue);
|
||||||
|
|
||||||
|
if (!iValue)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!wcscmp(szName, L"BitsPerPel"))
|
||||||
|
{
|
||||||
|
dm.dmFields |= DM_BITSPERPEL;
|
||||||
|
dm.dmBitsPerPel = iValue;
|
||||||
|
}
|
||||||
|
else if (!wcscmp(szName, L"XResolution"))
|
||||||
|
{
|
||||||
|
dm.dmFields |= DM_PELSWIDTH;
|
||||||
|
dm.dmPelsWidth = iValue;
|
||||||
|
}
|
||||||
|
else if (!wcscmp(szName, L"YResolution"))
|
||||||
|
{
|
||||||
|
dm.dmFields |= DM_PELSHEIGHT;
|
||||||
|
dm.dmPelsHeight = iValue;
|
||||||
|
}
|
||||||
|
else if (!wcscmp(szName, L"VRefresh"))
|
||||||
|
{
|
||||||
|
dm.dmFields |= DM_DISPLAYFREQUENCY;
|
||||||
|
dm.dmDisplayFrequency = iValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (SetupFindNextLine(&InfContext, &InfContext));
|
||||||
|
|
||||||
|
ChangeDisplaySettingsW(&dm, CDS_UPDATEREGISTRY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
|
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in a new issue