Author: greatlrd
Date: Tue Dec 12 20:56:27 2006
New Revision: 25131
URL: http://svn.reactos.org/svn/reactos?rev=25131&view=rev
Log:
remove fireball hack in changedisplay, do not hard code the display number,
with this patch we are now extract the display number from the desktop and use it
patch was wroten by me and janderwald. I was to lazy finish it so janderwald did finish it
thanks janderwald.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Tue Dec 12 20:56:27 2006
@@ -2925,9 +2925,30 @@
/* Check if pDeviceName is NULL, we need to retrieve it */
if (pDeviceName == NULL)
- {
- /* FIXME: It is a hack, but there is no proper way right now */
- RtlInitUnicodeString(&InDeviceName, L"\\\\.\\DISPLAY1");
+ {
+ WCHAR szBuffer[MAX_DRIVER_NAME];
+ PDC DC;
+ PWINDOW_OBJECT Wnd=NULL;
+ HWND hWnd;
+ HDC hDC;
+
+ hWnd = IntGetDesktopWindow();
+ if (hWnd && !(Wnd = UserGetWindowObject(hWnd)))
+ {
+ return FALSE;
+ }
+
+ hDC = (HDC)UserGetWindowDC(Wnd);
+
+ DC = DC_LockDc(hDC);
+ if (NULL == DC)
+ {
+ return FALSE;
+ }
+ swprintf (szBuffer, L"\\\\.\\DISPLAY%lu", ((GDIDEVICE *)DC->GDIDevice)->DisplayNumber);
+ DC_UnlockDc(DC);
+
+ RtlInitUnicodeString(&InDeviceName, szBuffer);
pDeviceName = &InDeviceName;
}
Author: fireball
Date: Tue Dec 12 15:18:17 2006
New Revision: 25129
URL: http://svn.reactos.org/svn/reactos?rev=25129&view=rev
Log:
ChangeDisplaySettingsEx() can be called with NULL DeviceName. In this case, we should look it up, instead of BSODing.
Right now, this case is fixed by substituting the value to a hardcoded one "\\.\DISPLAY1" in case of NULL and call is made to store the values in registry.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Tue Dec 12 15:18:17 2006
@@ -2914,6 +2914,7 @@
UNICODE_STRING DeviceName;
UNICODE_STRING RegistryKey;
+ UNICODE_STRING InDeviceName;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE DevInstRegKey;
ULONG NewValue;
@@ -2921,6 +2922,14 @@
DPRINT1("set CDS_UPDATEREGISTRY \n");
dwflags &= ~CDS_UPDATEREGISTRY;
+
+ /* Check if pDeviceName is NULL, we need to retrieve it */
+ if (pDeviceName == NULL)
+ {
+ /* FIXME: It is a hack, but there is no proper way right now */
+ RtlInitUnicodeString(&InDeviceName, L"\\\\.\\DISPLAY1");
+ pDeviceName = &InDeviceName;
+ }
Status = GetVideoDeviceName(&DeviceName, pDeviceName);
if (!NT_SUCCESS(Status))