Author: jimtabor
Date: Tue Jun 10 16:57:16 2008
New Revision: 33922
URL:
http://svn.reactos.org/svn/reactos?rev=33922&view=rev
Log:
Retool SetSysColors and use SEH.
Modified:
trunk/reactos/dll/win32/user32/include/user32p.h
trunk/reactos/dll/win32/user32/windows/defwnd.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Tue Jun 10 16:57:16
2008
@@ -69,9 +69,6 @@
#define NtUserGetSysColors(ColorRefs, count) \
(BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count),
TWOPARAM_ROUTINE_GETSYSCOLORS)
-#define NtUserSetSysColors(ColorRefs, count) \
- (BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count),
TWOPARAM_ROUTINE_SETSYSCOLORS)
-
#define NtUserSetCaretBlinkTime(uMSeconds) \
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Tue Jun 10 16:57:16 2008
@@ -110,27 +110,7 @@
CONST INT *lpaElements,
CONST COLORREF *lpaRgbValues)
{
- BOOL Ret;
- struct
- {
- INT *Elements;
- COLORREF *Colors;
- } ChangeSysColors;
-
- ChangeSysColors.Elements = (INT*)lpaElements;
- ChangeSysColors.Colors = (COLORREF*)lpaRgbValues;
-
- if(cElements > 0)
- {
- Ret = NtUserSetSysColors(&ChangeSysColors, cElements);
- }
- else
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- Ret = FALSE;
- }
-
- return Ret;
+ return NtUserSetSysColors(cElements, lpaElements, lpaRgbValues, 0);
}
void
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Tue Jun 10 16:57:16 2008
@@ -2230,12 +2230,12 @@
HWND hwndShell,
HWND hwndShellListView);
-DWORD
+BOOL
NTAPI
NtUserSetSysColors(
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
+ int cElements,
+ IN INT *lpaElements,
+ IN COLORREF *lpaRgbValues,
DWORD Unknown3);
BOOL
@@ -2639,7 +2639,6 @@
#define TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES 0xfffd0063
#define TWOPARAM_ROUTINE_GETSYSCOLORPENS 0xfffd0064
#define TWOPARAM_ROUTINE_GETSYSCOLORS 0xfffd0065
-#define TWOPARAM_ROUTINE_SETSYSCOLORS 0xfffd0066 // use NtUserSetSysColors
#define TWOPARAM_ROUTINE_ROS_SHOWWINDOW 0x1000
#define TWOPARAM_ROUTINE_ROS_ISACTIVEICON 0x1001
#define TWOPARAM_ROUTINE_ROS_NCDESTROY 0x1002
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Tue Jun 10
16:57:16 2008
@@ -521,17 +521,39 @@
return 0;
}
-DWORD
+BOOL
STDCALL
NtUserSetSysColors(
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
+ int cElements,
+ IN INT *lpaElements,
+ IN COLORREF *lpaRgbValues,
DWORD Unknown3)
{
- UNIMPLEMENTED
-
- return 0;
+ DWORD Ret = FALSE;
+ NTSTATUS Status = STATUS_SUCCESS;
+ UserEnterExclusive();
+ _SEH_TRY
+ {
+ ProbeForRead(lpaElements,
+ sizeof(INT),
+ 1);
+ ProbeForRead(lpaRgbValues,
+ sizeof(INT),
+ 1);
+ Ret = IntSetSysColors(cElements, lpaElements, lpaRgbValues);
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ Ret = FALSE;
+ }
+ UserLeave();
+ return Ret;
}
DWORD
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Tue Jun 10
16:57:16 2008
@@ -611,53 +611,6 @@
case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
RETURN( (DWORD)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
-
- case TWOPARAM_ROUTINE_SETSYSCOLORS:
- {
- DWORD Ret = 0;
- PVOID Buffer;
- struct
- {
- INT *Elements;
- COLORREF *Colors;
- }
- ChangeSysColors;
-
- /* FIXME - we should make use of SEH here... */
-
- Status = MmCopyFromCaller(&ChangeSysColors, (PVOID)Param1,
sizeof(ChangeSysColors));
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- RETURN( 0);
- }
-
- Buffer = ExAllocatePool(PagedPool, (Param2 * sizeof(INT)) + (Param2 *
sizeof(COLORREF)));
- if(Buffer != NULL)
- {
- INT *Elements = (INT*)Buffer;
- COLORREF *Colors = (COLORREF*)Buffer + Param2;
-
- Status = MmCopyFromCaller(Elements, ChangeSysColors.Elements, Param2 *
sizeof(INT));
- if(NT_SUCCESS(Status))
- {
- Status = MmCopyFromCaller(Colors, ChangeSysColors.Colors, Param2 *
sizeof(COLORREF));
- if(NT_SUCCESS(Status))
- {
- Ret = (DWORD)IntSetSysColors((UINT)Param2, Elements, Colors);
- }
- else
- SetLastNtError(Status);
- }
- else
- SetLastNtError(Status);
-
- ExFreePool(Buffer);
- }
-
-
- RETURN( Ret);
- }
case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES:
case TWOPARAM_ROUTINE_GETSYSCOLORPENS: