[ros-diffs] [rharabien] 51169: [WIN32K] Rename IntResetMonitorSize to IntUpdateMonitorSize Use IntUpdateMonitorSize instead of setting monitor size manually when attaching monitor Change display device name fr...

rharabien at svn.reactos.org rharabien at svn.reactos.org
Sun Mar 27 01:12:26 UTC 2011


Author: rharabien
Date: Sun Mar 27 01:12:25 2011
New Revision: 51169

URL: http://svn.reactos.org/svn/reactos?rev=51169&view=rev
Log:
[WIN32K]
Rename IntResetMonitorSize to IntUpdateMonitorSize
Use IntUpdateMonitorSize instead of setting monitor size manually when attaching monitor
Change display device name from VIDEOx to DISPLAYx as it is in Windows (fixes user32:monitor winetest)

[USER32]
Return FALSE in EnumDisplayMonitors if EnumProc returned FALSE (fixes user32:monitor winetest)

Modified:
    trunk/reactos/dll/win32/user32/misc/display.c
    trunk/reactos/subsystems/win32/win32k/eng/device.c
    trunk/reactos/subsystems/win32/win32k/include/monitor.h
    trunk/reactos/subsystems/win32/win32k/ntuser/display.c
    trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c

Modified: trunk/reactos/dll/win32/user32/misc/display.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/display.c?rev=51169&r1=51168&r2=51169&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] Sun Mar 27 01:12:25 2011
@@ -116,6 +116,7 @@
     HMONITOR *hMonitorList;
     LPRECT pRectList;
     HANDLE hHeap;
+    BOOL ret = FALSE;
 
     /* get list of monitors/rects */
     iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, NULL, NULL, 0);
@@ -139,18 +140,15 @@
     pRectList = HeapAlloc(hHeap, 0, sizeof (RECT) * iCount);
     if (pRectList == NULL)
     {
-        HeapFree(hHeap, 0, hMonitorList);
         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        return FALSE;
+        goto cleanup;
     }
 
     iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, hMonitorList, pRectList, iCount);
     if (iCount <= 0)
     {
         /* FIXME: SetLastError() */
-        HeapFree(hHeap, 0, hMonitorList);
-        HeapFree(hHeap, 0, pRectList);
-        return FALSE;
+        goto cleanup;
     }
 
     /* enumerate list */
@@ -167,11 +165,17 @@
         }
 
         if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
-            break;
-    }
-    HeapFree(hHeap, 0, hMonitorList);
-    HeapFree(hHeap, 0, pRectList);
-    return TRUE;
+            goto cleanup; /* return FALSE */
+    }
+    
+    ret = TRUE;
+    
+cleanup:
+    if(hMonitorList)
+        HeapFree(hHeap, 0, hMonitorList);
+    if(pRectList)
+        HeapFree(hHeap, 0, pRectList);
+    return ret;
 }
 
 

Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/device.c?rev=51169&r1=51168&r2=51169&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] Sun Mar 27 01:12:25 2011
@@ -90,7 +90,7 @@
                      pustrDeviceName->Length);
 
     /* Create a win device name (FIXME: virtual devices!) */
-    swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\VIDEO%d", (int)giDevNum);
+    swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\DISPLAY%d", (int)giDevNum);
 
     /* Allocate a buffer for the strings */
     cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);

Modified: trunk/reactos/subsystems/win32/win32k/include/monitor.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/monitor.h?rev=51169&r1=51168&r2=51169&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/monitor.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/monitor.h [iso-8859-1] Sun Mar 27 01:12:25 2011
@@ -40,7 +40,7 @@
 
 NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber);
 NTSTATUS IntDetachMonitor(PDEVOBJ *pGdiDevice);
-NTSTATUS IntResetMonitorSize(IN PDEVOBJ *pGdiDevice);
+NTSTATUS IntUpdateMonitorSize(IN PDEVOBJ *pGdiDevice);
 PMONITOR FASTCALL UserGetMonitorObject(IN HMONITOR);
 PMONITOR FASTCALL IntGetPrimaryMonitor(VOID);
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/display.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/display.c?rev=51169&r1=51168&r2=51169&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Sun Mar 27 01:12:25 2011
@@ -766,7 +766,7 @@
         //IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
 
         /* Set new size of the monitor */
-        IntResetMonitorSize(ppdev);
+        IntUpdateMonitorSize(ppdev);
 
         /* Remove all cursor clipping */
         UserClipCursor(NULL);

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c?rev=51169&r1=51168&r2=51169&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] Sun Mar 27 01:12:25 2011
@@ -157,16 +157,7 @@
     }
 
     Monitor->GdiDevice = pGdiDevice;
-    Monitor->rcMonitor.left  = 0;
-    Monitor->rcMonitor.top   = 0;
-    Monitor->rcMonitor.right  = Monitor->rcMonitor.left + pGdiDevice->gdiinfo.ulHorzRes;
-    Monitor->rcMonitor.bottom = Monitor->rcMonitor.top + pGdiDevice->gdiinfo.ulVertRes;
-    Monitor->rcWork = Monitor->rcMonitor;
     Monitor->cWndStack = 0;
-
-    Monitor->hrgnMonitor = IntSysCreateRectRgnIndirect( &Monitor->rcMonitor );
-
-    IntGdiSetRegionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
 
     if (gMonitorList == NULL)
     {
@@ -184,6 +175,8 @@
         }
         Monitor->Prev = p;
     }
+    
+    IntUpdateMonitorSize(pGdiDevice);
 
     return STATUS_SUCCESS;
 }
@@ -246,7 +239,7 @@
     return STATUS_SUCCESS;
 }
 
-/* IntResetMonitorSize
+/* IntUpdateMonitorSize
  *
  * Reset size of the monitor using atached device
  *
@@ -259,7 +252,7 @@
  *   Returns a NTSTATUS
  */
 NTSTATUS
-IntResetMonitorSize(IN PDEVOBJ *pGdiDevice)
+IntUpdateMonitorSize(IN PDEVOBJ *pGdiDevice)
 {
 	PMONITOR Monitor;
 
@@ -701,13 +694,10 @@
     /* fill device name */
     if (MonitorInfo.cbSize == sizeof (MONITORINFOEXW))
     {
-        WCHAR nul = L'\0';
-        INT len = Monitor->DeviceName.Length;
-        if (len >= CCHDEVICENAME * sizeof (WCHAR))
-            len = (CCHDEVICENAME - 1) * sizeof (WCHAR);
-
-        memcpy(MonitorInfo.szDevice, Monitor->DeviceName.Buffer, len);
-        memcpy(MonitorInfo.szDevice + (len / sizeof (WCHAR)), &nul, sizeof (WCHAR));
+        RtlStringCbCopyNW(MonitorInfo.szDevice,
+                          sizeof(MonitorInfo.szDevice),
+                          Monitor->DeviceName.Buffer,
+                          Monitor->DeviceName.Length);
     }
 
     /* output data */




More information about the Ros-diffs mailing list