Author: hbelusca
Date: Fri Nov 28 20:34:16 2014
New Revision: 65513
URL:
http://svn.reactos.org/svn/reactos?rev=65513&view=rev
Log:
[USER32]
- Call GetThreadConsoleDesktop of CONSRV if needed, in GetThreadDesktop (in case the
process is a console app).
- Introduce two last-error helpers UserSetLast(NT)Error which work the same as the
(Base)SetLast(NT)Error of kernel32, needed for CSR status errors etc...
[WINSRV]
- Improve the stub of SrvGetThreadConsoleDesktop (it needs to success, and atm. it always
zeroes-out the returned console desktop handle).
Modified:
trunk/reactos/include/reactos/subsys/win/winmsg.h
trunk/reactos/win32ss/user/user32/include/user32p.h
trunk/reactos/win32ss/user/user32/misc/desktop.c
trunk/reactos/win32ss/user/user32/misc/misc.c
trunk/reactos/win32ss/user/winsrv/usersrv/init.c
Modified: trunk/reactos/include/reactos/subsys/win/winmsg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
==============================================================================
--- trunk/reactos/include/reactos/subsys/win/winmsg.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/win/winmsg.h [iso-8859-1] Fri Nov 28 20:34:16
2014
@@ -36,18 +36,24 @@
} USERSRV_API_NUMBER, *PUSERSRV_API_NUMBER;
-typedef struct
+typedef struct _USER_EXIT_REACTOS
{
UINT Flags;
DWORD Reserved;
} USER_EXIT_REACTOS, *PUSER_EXIT_REACTOS;
-typedef struct
+typedef struct _USER_GET_THREAD_CONSOLE_DESKTOP
+{
+ ULONG_PTR ThreadId;
+ HANDLE ConsoleDesktop;
+} USER_GET_THREAD_CONSOLE_DESKTOP, *PUSER_GET_THREAD_CONSOLE_DESKTOP;
+
+typedef struct _USER_REGISTER_SERVICES_PROCESS
{
ULONG_PTR ProcessId;
} USER_REGISTER_SERVICES_PROCESS, *PUSER_REGISTER_SERVICES_PROCESS;
-typedef struct
+typedef struct _USER_REGISTER_LOGON_PROCESS
{
ULONG_PTR ProcessId;
BOOL Register;
@@ -65,6 +71,7 @@
union
{
USER_EXIT_REACTOS ExitReactosRequest;
+ USER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest;
USER_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
USER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest;
} Data;
Modified: trunk/reactos/win32ss/user/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/includ…
==============================================================================
--- trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] Fri Nov 28 20:34:16
2014
@@ -68,6 +68,8 @@
VOID FASTCALL MessageCleanup(VOID);
/* definitions for misc.c */
+VOID WINAPI UserSetLastError(IN DWORD dwErrCode);
+VOID WINAPI UserSetLastNTError(IN NTSTATUS Status);
PCALLPROCDATA FASTCALL ValidateCallProc(HANDLE hCallProc);
PWND FASTCALL ValidateHwnd(HWND hwnd);
PWND FASTCALL ValidateHwndOrDesk(HWND hwnd);
Modified: trunk/reactos/win32ss/user/user32/misc/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/d…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/desktop.c [iso-8859-1] Fri Nov 28 20:34:16
2014
@@ -548,7 +548,23 @@
GetThreadDesktop(
DWORD dwThreadId)
{
- return NtUserGetThreadDesktop(dwThreadId, 0);
+ USER_API_MESSAGE ApiMessage;
+ PUSER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest =
&ApiMessage.Data.GetThreadConsoleDesktopRequest;
+
+ GetThreadConsoleDesktopRequest->ThreadId = dwThreadId;
+
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX,
UserpGetThreadConsoleDesktop),
+ sizeof(*GetThreadConsoleDesktopRequest));
+ if (!NT_SUCCESS(ApiMessage.Status))
+ {
+ UserSetLastNTError(ApiMessage.Status);
+ return NULL;
+ }
+
+ return NtUserGetThreadDesktop(dwThreadId,
+
(DWORD)GetThreadConsoleDesktopRequest->ConsoleDesktop);
}
Modified: trunk/reactos/win32ss/user/user32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/m…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/misc.c [iso-8859-1] Fri Nov 28 20:34:16 2014
@@ -1,28 +1,9 @@
/*
- * ReactOS kernel
- * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/*
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/misc.c
* PURPOSE: Misc
* PROGRAMMER: Thomas Weidenmueller (w3seek(a)users.sourceforge.net)
- * UPDATE HISTORY:
- * 19-11-2003 Created
*/
/* INCLUDES ******************************************************************/
@@ -34,6 +15,30 @@
WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* FUNCTIONS *****************************************************************/
+
+VOID
+WINAPI
+UserSetLastError(IN DWORD dwErrCode)
+{
+ /*
+ * Equivalent of SetLastError in kernel32, but without breaking
+ * into the debugger nor checking whether the last old error is
+ * the same as the one we are going to set.
+ */
+ NtCurrentTeb()->LastErrorValue = dwErrCode;
+}
+
+VOID
+WINAPI
+UserSetLastNTError(IN NTSTATUS Status)
+{
+ /*
+ * Equivalent of BaseSetLastNTError in kernel32, but using
+ * UserSetLastError: convert from NT to Win32, then set.
+ */
+ UserSetLastError(RtlNtStatusToDosError(Status));
+}
+
/*
* @implemented
Modified: trunk/reactos/win32ss/user/winsrv/usersrv/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/usersr…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/usersrv/init.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/usersrv/init.c [iso-8859-1] Fri Nov 28 20:34:16
2014
@@ -121,8 +121,15 @@
CSR_API(SrvGetThreadConsoleDesktop)
{
+ PUSER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.GetThreadConsoleDesktopRequest;
+
DPRINT1("%s not yet implemented\n", __FUNCTION__);
- return STATUS_NOT_IMPLEMENTED;
+
+ /* Return nothing for the moment... */
+ GetThreadConsoleDesktopRequest->ConsoleDesktop = NULL;
+
+ /* Always succeeds */
+ return STATUS_SUCCESS;
}
CSR_API(SrvDeviceEvent)