Author: greatlrd
Date: Sun May 4 09:31:20 2008
New Revision: 33270
URL:
http://svn.reactos.org/svn/reactos?rev=33270&view=rev
Log:
Speed optimize NtUserEnumDisplaySettings bit by remove
COPY_DEVMODE_VALUE_TO_CALLER macro and using SEH directly
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Sun May 4 09:31:20
2008
@@ -890,15 +890,6 @@
return NtUserGetDCEx(hWnd, NULL, NULL == hWnd ? DCX_CACHE | DCX_WINDOW :
DCX_USESTYLE);
}
-#define COPY_DEVMODE_VALUE_TO_CALLER(dst, src, member) \
- Status = MmCopyToCaller(&(dst)->member, &(src)->member, sizeof
((src)->member)); \
- if (!NT_SUCCESS(Status)) \
- { \
- SetLastNtError(Status); \
- ExFreePool(src); \
- return FALSE; \
- }
-
BOOL
STDCALL
NtUserEnumDisplaySettings(
@@ -916,7 +907,7 @@
/* Copy the devmode */
_SEH_TRY
{
- ProbeForRead(&lpDevMode->dmSize, sizeof(DEVMODEW), 1);
+ ProbeForRead(lpDevMode, sizeof(DEVMODEW), 1);
Size = lpDevMode->dmSize;
ExtraSize = lpDevMode->dmDriverExtra;
}
@@ -963,11 +954,23 @@
RtlFreeUnicodeString(pSafeDeviceName);
/* Copy some information back */
- COPY_DEVMODE_VALUE_TO_CALLER(lpDevMode, pSafeDevMode, dmPelsWidth);
- COPY_DEVMODE_VALUE_TO_CALLER(lpDevMode, pSafeDevMode, dmPelsHeight);
- COPY_DEVMODE_VALUE_TO_CALLER(lpDevMode, pSafeDevMode, dmBitsPerPel);
- COPY_DEVMODE_VALUE_TO_CALLER(lpDevMode, pSafeDevMode, dmDisplayFrequency);
- COPY_DEVMODE_VALUE_TO_CALLER(lpDevMode, pSafeDevMode, dmDisplayFlags);
+ _SEH_TRY
+ {
+ ProbeForWrite(lpDevMode,Size, 1);
+ lpDevMode->dmPelsWidth = pSafeDevMode->dmPelsWidth;
+ lpDevMode->dmPelsHeight = pSafeDevMode->dmPelsHeight;
+ lpDevMode->dmBitsPerPel = pSafeDevMode->dmBitsPerPel;
+ lpDevMode->dmDisplayFrequency = pSafeDevMode->dmDisplayFrequency;
+ lpDevMode->dmDisplayFlags = pSafeDevMode->dmDisplayFlags;
+ }
+ _SEH_HANDLE
+ {
+ DPRINT1("Warning crash here \n");
+ SetLastNtError(_SEH_GetExceptionCode());
+ _SEH_YIELD(return FALSE);
+ }
+ _SEH_END;
+
/* output private/extra driver data */
if (ExtraSize > 0)
@@ -984,8 +987,6 @@
ExFreePool(pSafeDevMode);
return TRUE;
}
-
-#undef COPY_DEVMODE_VALUE_TO_CALLER
LONG
STDCALL