Fix W->A conversions in EnumDisplaySettingsExA. This is dedicated to Caroline!
Modified: trunk/reactos/lib/user32/misc/display.c

Modified: trunk/reactos/lib/user32/misc/display.c
--- trunk/reactos/lib/user32/misc/display.c	2005-03-02 22:17:34 UTC (rev 13801)
+++ trunk/reactos/lib/user32/misc/display.c	2005-03-02 22:29:11 UTC (rev 13802)
@@ -200,22 +200,32 @@
 {
   BOOL rc;
   UNICODE_STRING DeviceName;
+  LPDEVMODEW lpDevModeW;
 
+  lpDevModeW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+                         sizeof(DEVMODEW) + lpDevMode->dmDriverExtra);
+  if ( lpDevModeW == NULL )
+    {
+      SetLastError ( ERROR_OUTOFMEMORY );
+      return FALSE;
+    }
+
   if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
     {
       SetLastError ( ERROR_OUTOFMEMORY );
       return FALSE;
     }
 
-  /*
-   * NOTE: We don't need to convert between DEVMODEW and DEVMODEA because
-   * only dmBitsPerPel, dmPelsWidth, dmPelsHeight, dmDisplayFlags and
-   * dmDisplayFrequency fields are set.
-   */
-  rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, (LPDEVMODEW)lpDevMode,
+  lpDevModeW->dmSize = sizeof(DEVMODEW);
+  lpDevModeW->dmDriverExtra = 0;
+
+  rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, lpDevModeW,
                                    dwFlags );
 
+  RosRtlDevModeW2A ( lpDevMode, lpDevModeW );
+
   RtlFreeUnicodeString ( &DeviceName );
+  HeapFree ( GetProcessHeap(), 0, lpDevModeW );
 
   return rc;
 }