ChangeDisplay

1. Add debug msg
2. Corrent some return value for CDS_UPDATEREGISTRY
3. Remove #ifdef CDS_VIDEOPARAMETERS  


svn path=/trunk/; revision=15484
This commit is contained in:
Magnus Olsen 2005-05-24 19:52:43 +00:00
parent d3f81ff12b
commit d92b106774

View file

@ -2509,6 +2509,8 @@ IntChangeDisplaySettings(
BOOLEAN SetPrimary = FALSE; BOOLEAN SetPrimary = FALSE;
LONG Ret; LONG Ret;
DPRINT1("display flag : %x\n",dwflags);
if ((dwflags & CDS_UPDATEREGISTRY) == CDS_UPDATEREGISTRY) if ((dwflags & CDS_UPDATEREGISTRY) == CDS_UPDATEREGISTRY)
{ {
/* Check global, reset and noreset flags */ /* Check global, reset and noreset flags */
@ -2530,13 +2532,17 @@ IntChangeDisplaySettings(
switch (dwflags) switch (dwflags)
{ {
case 0: /* Dynamically change graphics mode */ case 0: /* Dynamically change graphics mode */
DPRINT1("flag 0 UNIMPLEMENT \n");
Ret = DISP_CHANGE_FAILED; Ret = DISP_CHANGE_FAILED;
break; break;
case CDS_FULLSCREEN: /* Given mode is temporary */ case CDS_FULLSCREEN: /* Given mode is temporary */
DPRINT1("flag CDS_FULLSCREEN UNIMPLEMENT \n");
Ret = DISP_CHANGE_FAILED; Ret = DISP_CHANGE_FAILED;
break; break;
case CDS_UPDATEREGISTRY: case CDS_UPDATEREGISTRY:
{ {
UNICODE_STRING ObjectName; UNICODE_STRING ObjectName;
@ -2551,6 +2557,8 @@ IntChangeDisplaySettings(
HANDLE DevInstRegKey; HANDLE DevInstRegKey;
ULONG NewValue; ULONG NewValue;
DPRINT1("set CDS_UPDATEREGISTRY \n");
/* Get device name (pDeviceName is "\.\xxx") */ /* Get device name (pDeviceName is "\.\xxx") */
for (LastSlash = pDeviceName->Length / sizeof(WCHAR); LastSlash > 0; LastSlash--) for (LastSlash = pDeviceName->Length / sizeof(WCHAR); LastSlash > 0; LastSlash--)
{ {
@ -2619,44 +2627,49 @@ IntChangeDisplaySettings(
{ {
RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.BitsPerPel"); RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.BitsPerPel");
NewValue = DevMode->dmBitsPerPel; NewValue = DevMode->dmBitsPerPel;
Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue)); Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue));
} }
if (NT_SUCCESS(Status) && DevMode->dmFields & DM_PELSWIDTH) if (NT_SUCCESS(Status) && DevMode->dmFields & DM_PELSWIDTH)
{ {
RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.XResolution"); RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.XResolution");
NewValue = DevMode->dmPelsWidth; NewValue = DevMode->dmPelsWidth;
Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue)); Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue));
} }
if (NT_SUCCESS(Status) && DevMode->dmFields & DM_PELSHEIGHT) if (NT_SUCCESS(Status) && DevMode->dmFields & DM_PELSHEIGHT)
{ {
RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.YResolution"); RtlInitUnicodeString(&RegistryKey, L"DefaultSettings.YResolution");
NewValue = DevMode->dmPelsHeight; NewValue = DevMode->dmPelsHeight;
Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue)); Status = ZwSetValueKey(DevInstRegKey, &RegistryKey, 0, REG_DWORD, &NewValue, sizeof(NewValue));
} }
ZwClose(DevInstRegKey); ZwClose(DevInstRegKey);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
Ret = DISP_CHANGE_RESTART; Ret = DISP_CHANGE_RESTART;
else else
Ret = DISP_CHANGE_FAILED; /* return DISP_CHANGE_NOTUPDATED when we can save to reg only vaild for NT */
Ret = DISP_CHANGE_NOTUPDATED;
break; break;
} }
case CDS_TEST: /* Test if the mode could be set */ case CDS_TEST: /* Test if the mode could be set */
DPRINT1("flag CDS_TEST UNIMPLEMENT");
Ret = DISP_CHANGE_FAILED; Ret = DISP_CHANGE_FAILED;
break; break;
#ifdef CDS_VIDEOPARAMETERS
case CDS_VIDEOPARAMETERS: case CDS_VIDEOPARAMETERS:
if (lParam == NULL)
return DISP_CHANGE_BADPARAM; if (lParam == NULL) return DISP_CHANGE_BADPARAM;
DPRINT1("flag CDS_VIDEOPARAMETERS UNIMPLEMENT");
Ret = DISP_CHANGE_FAILED; Ret = DISP_CHANGE_FAILED;
break; break;
#endif
default: default:
DPRINT1("flag DISP_CHANGE_BADFLAGS\n");
Ret = DISP_CHANGE_BADFLAGS; Ret = DISP_CHANGE_BADFLAGS;
break; break;
} }