Author: hbelusca
Date: Fri Nov 28 23:42:40 2014
New Revision: 65521
URL:
http://svn.reactos.org/svn/reactos?rev=65521&view=rev
Log:
[USER32]
- Move to an appropriate file, and correctly implement (i.e. via CSR call to USERSRV)
EndTask.
[USERSRV]
- Hackplement SrvEndTask using our old code.
Part 4/X
CORE-8322
Modified:
trunk/reactos/include/reactos/subsys/win/winmsg.h
trunk/reactos/win32ss/user/user32/misc/exit.c
trunk/reactos/win32ss/user/user32/misc/misc.c
trunk/reactos/win32ss/user/winsrv/usersrv/shutdown.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 23:42:40
2014
@@ -42,6 +42,14 @@
DWORD Reserved;
} USER_EXIT_REACTOS, *PUSER_EXIT_REACTOS;
+typedef struct _USER_END_TASK
+{
+ DWORD LastError;
+ HWND WndHandle;
+ BOOL Force;
+ BOOL Success;
+} USER_END_TASK, *PUSER_END_TASK;
+
typedef struct _USER_GET_THREAD_CONSOLE_DESKTOP
{
ULONG_PTR ThreadId;
@@ -71,6 +79,7 @@
union
{
USER_EXIT_REACTOS ExitReactosRequest;
+ USER_END_TASK EndTaskRequest;
USER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest;
USER_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
USER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest;
Modified: trunk/reactos/win32ss/user/user32/misc/exit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/e…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/exit.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/exit.c [iso-8859-1] Fri Nov 28 23:42:40 2014
@@ -86,4 +86,38 @@
return TRUE;
}
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+EndTask(HWND hWnd,
+ BOOL fShutDown,
+ BOOL fForce)
+{
+ USER_API_MESSAGE ApiMessage;
+ PUSER_END_TASK EndTaskRequest = &ApiMessage.Data.EndTaskRequest;
+
+ UNREFERENCED_PARAMETER(fShutDown);
+
+ // EndTaskRequest->LastError = ERROR_SUCCESS;
+ EndTaskRequest->WndHandle = hWnd;
+ EndTaskRequest->Force = fForce;
+
+ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpEndTask),
+ sizeof(*EndTaskRequest));
+ if (!NT_SUCCESS(ApiMessage.Status))
+ {
+ UserSetLastNTError(ApiMessage.Status);
+ return FALSE;
+ }
+
+ if (EndTaskRequest->LastError != ERROR_SUCCESS)
+ UserSetLastError(EndTaskRequest->LastError);
+
+ return EndTaskRequest->Success;
+}
+
/* EOF */
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 23:42:40 2014
@@ -150,29 +150,6 @@
dwWin32Error = RtlNtStatusToDosError( Status );
NtCurrentTeb()->LastErrorValue = dwWin32Error;
return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-EndTask(
- HWND hWnd,
- BOOL fShutDown,
- BOOL fForce)
-{
- SendMessageW(hWnd, WM_CLOSE, 0, 0);
-
- if (IsWindow(hWnd))
- {
- if (fForce)
- return DestroyWindow(hWnd);
- else
- return FALSE;
}
return TRUE;
Modified: trunk/reactos/win32ss/user/winsrv/usersrv/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/usersr…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/usersrv/shutdown.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/usersrv/shutdown.c [iso-8859-1] Fri Nov 28 23:42:40
2014
@@ -940,20 +940,45 @@
CSR_API(SrvEndTask)
{
+ PUSER_END_TASK EndTaskRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.EndTaskRequest;
+
+ // FIXME: This is HACK-plemented!!
+ DPRINT1("SrvEndTask is HACKPLEMENTED!!\n");
+
+ SendMessageW(EndTaskRequest->WndHandle, WM_CLOSE, 0, 0);
+ // PostMessageW(EndTaskRequest->WndHandle, WM_CLOSE, 0, 0);
+
+ if (IsWindow(EndTaskRequest->WndHandle))
+ {
+ if (EndTaskRequest->Force)
+ {
+ EndTaskRequest->Success = DestroyWindow(EndTaskRequest->WndHandle);
+ EndTaskRequest->LastError = GetLastError();
+ }
+ else
+ {
+ EndTaskRequest->Success = FALSE;
+ }
+ }
+ else
+ {
+ EndTaskRequest->LastError = ERROR_SUCCESS;
+ EndTaskRequest->Success = TRUE;
+ }
+
+ return STATUS_SUCCESS;
+}
+
+CSR_API(SrvLogon)
+{
DPRINT1("%s not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
}
-CSR_API(SrvLogon)
+CSR_API(SrvRecordShutdownReason)
{
DPRINT1("%s not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
}
-CSR_API(SrvRecordShutdownReason)
-{
- DPRINT1("%s not yet implemented\n", __FUNCTION__);
- return STATUS_NOT_IMPLEMENTED;
-}
-
/* EOF */