Author: jgardou Date: Fri May 28 23:58:33 2010 New Revision: 47386
URL: http://svn.reactos.org/svn/reactos?rev=47386&view=rev Log: [USER32] - Change ChangeDisplaySettingsExA to look more like wine's one [WIN32K] - Return correct value if buffer is to small in UserChangeDisplaySettings (wine tests) - Do not set an invalid size to the devmode we're passing ti UserChangeDisplaySettings, we might access garbage Now all ChangeDisplaySettings related wine tests pass.
Modified: branches/reactos-yarotows/dll/win32/user32/misc/display.c branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c
Modified: branches/reactos-yarotows/dll/win32/user32/misc/display.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/dll/win32/user3... ============================================================================== --- branches/reactos-yarotows/dll/win32/user32/misc/display.c [iso-8859-1] (original) +++ branches/reactos-yarotows/dll/win32/user32/misc/display.c [iso-8859-1] Fri May 28 23:58:33 2010 @@ -457,7 +457,6 @@ LONG rc; UNICODE_STRING DeviceName; PUNICODE_STRING pDeviceName = &DeviceName; - LPDEVMODEW pDevModeW;
if (lpszDeviceName != NULL) { @@ -471,14 +470,19 @@ pDeviceName = NULL;
if (lpDevMode != NULL) + { + LPDEVMODEW pDevModeW; pDevModeW = GdiConvertToDevmodeW(lpDevMode); + if(pDevModeW) + { + rc = NtUserChangeDisplaySettings ( pDeviceName, pDevModeW, hwnd, dwflags, lParam ); + RtlFreeHeap(GetProcessHeap(), 0, pDevModeW); + } + else + rc = DISP_CHANGE_SUCCESSFUL; + } else - pDevModeW = NULL; - - rc = NtUserChangeDisplaySettings ( pDeviceName, pDevModeW, hwnd, dwflags, lParam ); - - if (pDevModeW != NULL) - RtlFreeHeap(GetProcessHeap(), 0, pDevModeW); + rc = NtUserChangeDisplaySettings ( pDeviceName, NULL, hwnd, dwflags, lParam );
if (lpszDeviceName != NULL) RtlFreeUnicodeString ( &DeviceName ); @@ -539,6 +543,6 @@ DWORD dwflags) { if(lpDevMode) - lpDevMode->dmDriverExtra = 0; + lpDevMode->dmDriverExtra = 0; return ChangeDisplaySettingsExW ( NULL, lpDevMode, NULL, dwflags, 0 ); }
Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Fri May 28 23:58:33 2010 @@ -708,7 +708,7 @@ } } else if (pdm->dmSize < FIELD_OFFSET(DEVMODEW, dmFields)) - return DISP_CHANGE_FAILED; + return DISP_CHANGE_BADMODE; /* This is what winXP SP3 returns */ else dm = *pdm;
@@ -899,7 +899,6 @@ /* Probe and copy the full DEVMODE */ ProbeForRead(lpDevMode, dmLocal.dmSize, 1); RtlCopyMemory(&dmLocal, lpDevMode, dmLocal.dmSize); - dmLocal.dmSize = sizeof(dmLocal); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {