Author: fireball
Date: Fri Oct 23 12:30:21 2009
New Revision: 43696
URL:
http://svn.reactos.org/svn/reactos?rev=43696&view=rev
Log:
- Move all CSR-interacting functions to a standalone file (csr.c) and implement them
(ROS-specific, for Win2003 compatiblity they have to be at least commented out). Mainly
those are needed for proper shutdown/reboot in ReactOS.
Added:
branches/arwinss/reactos/dll/win32/user32/csr.c (with props)
Modified:
branches/arwinss/reactos/dll/win32/user32/misc.c
branches/arwinss/reactos/dll/win32/user32/user32.rbuild
branches/arwinss/reactos/dll/win32/user32/user_main.c
Added: branches/arwinss/reactos/dll/win32/user32/csr.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/csr.c (added)
+++ branches/arwinss/reactos/dll/win32/user32/csr.c [iso-8859-1] Fri Oct 23 12:30:21 2009
@@ -1,0 +1,142 @@
+/*
+ * COPYRIGHT: GNU LGPL v2.1 or any later version as
+ published by the Free Software Foundation
+ * PROJECT: ReactOS
+ * FILE: dll/win32/user32/csr.c
+ * PURPOSE: ReactOS-specific interaction with CSR
+ * PROGRAMMER: Aleksey Bragin <aleksey(a)reactos.org>
+ */
+
+/* INCLUDES ******************************************************************/
+
+/* C Headers */
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+
+/* SDK/NDK Headers */
+#define _USER32_
+#define OEMRESOURCE
+#define NTOS_MODE_USER
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <winuser.h>
+#include <windowsx.h>
+#include <winnls32.h>
+#include <ndk/ntndk.h>
+#include <ddk/ntstatus.h>
+
+/* CSRSS Headers */
+#include <csrss/csrss.h>
+
+/* FUNCTIONS ******************************************************************/
+
+/***********************************************************************
+ * ExitWindowsEx (USER32.@)
+ */
+BOOL WINAPI ExitWindowsEx( UINT uFlags, DWORD dwReason )
+{
+ CSR_API_MESSAGE Request;
+ ULONG CsrRequest;
+ NTSTATUS Status;
+
+ CsrRequest = MAKE_CSR_API(EXIT_REACTOS, CSR_GUI);
+ Request.Data.ExitReactosRequest.Flags = uFlags;
+ Request.Data.ExitReactosRequest.Reserved = dwReason;
+
+ Status = CsrClientCallServer(&Request,
+ NULL,
+ CsrRequest,
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/***********************************************************************
+ * RegisterServicesProcess (USER32.@)
+ */
+BOOL WINAPI RegisterServicesProcess(DWORD ServicesProcessId)
+{
+ CSR_API_MESSAGE Request;
+ ULONG CsrRequest;
+ NTSTATUS Status;
+
+ CsrRequest = MAKE_CSR_API(REGISTER_SERVICES_PROCESS, CSR_GUI);
+ Request.Data.RegisterServicesProcessRequest.ProcessId = (HANDLE)ServicesProcessId;
+
+ Status = CsrClientCallServer(&Request,
+ NULL,
+ CsrRequest,
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/***********************************************************************
+ * RegisterLogonProcess (USER32.@)
+ */
+BOOL WINAPI RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
+{
+ CSR_API_MESSAGE Request;
+ ULONG CsrRequest;
+ NTSTATUS Status;
+
+ CsrRequest = MAKE_CSR_API(REGISTER_LOGON_PROCESS, CSR_GUI);
+ Request.Data.RegisterLogonProcessRequest.ProcessId = dwProcessId;
+ Request.Data.RegisterLogonProcessRequest.Register = bRegister;
+
+ Status = CsrClientCallServer(&Request,
+ NULL,
+ CsrRequest,
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * SetLogonNotifyWindow (USER32.@)
+ */
+BOOL
+WINAPI
+SetLogonNotifyWindow (HWND Wnd, HWINSTA WinSta)
+{
+ /* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS???
*/
+ CSR_API_MESSAGE Request;
+ ULONG CsrRequest;
+ NTSTATUS Status;
+
+ CsrRequest = MAKE_CSR_API(SET_LOGON_NOTIFY_WINDOW, CSR_GUI);
+ Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
+
+ Status = CsrClientCallServer(&Request,
+ NULL,
+ CsrRequest,
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
+/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/user32/csr.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/arwinss/reactos/dll/win32/user32/misc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/misc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/misc.c [iso-8859-1] Fri Oct 23 12:30:21
2009
@@ -253,24 +253,6 @@
DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
{
FIXME("(0x%08x,0x%08x),stub!\n",x1,x2);
- return 1;
-}
-
-/***********************************************************************
- * RegisterLogonProcess (USER32.@)
- */
-BOOL WINAPI RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
-{
- FIXME("(%d,%d),stub!\n",dwProcessId,bRegister);
- return 1;
-}
-
-/***********************************************************************
- * SetLogonNotifyWindow (USER32.@)
- */
-DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
-{
- FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
return 1;
}
Modified: branches/arwinss/reactos/dll/win32/user32/user32.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/user32.rbuild [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/user32.rbuild [iso-8859-1] Fri Oct 23
12:30:21 2009
@@ -23,6 +23,7 @@
<file>class.c</file>
<file>clipboard.c</file>
<file>combo.c</file>
+ <file>csr.c</file>
<file>cursoricon.c</file>
<file>dde_client.c</file>
<file>dde_misc.c</file>
Modified: branches/arwinss/reactos/dll/win32/user32/user_main.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/user_main.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/user_main.c [iso-8859-1] Fri Oct 23 12:30:21
2009
@@ -356,45 +356,6 @@
return ret;
}
-
-/***********************************************************************
- * ExitWindowsEx (USER32.@)
- */
-BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reason )
-{
- static const WCHAR winebootW[] = {
'\\','w','i','n','e','b','o','o','t','.','e','x','e',0
};
- static const WCHAR killW[] = { '
','-','-','k','i','l','l',0 };
- static const WCHAR end_sessionW[] = { '
','-','-','e','n','d','-','s','e','s','s','i','o','n',0
};
- static const WCHAR forceW[] = { '
','-','-','f','o','r','c','e',0
};
- static const WCHAR shutdownW[] = { '
','-','-','s','h','u','t','d','o','w','n',0
};
-
- WCHAR cmdline[MAX_PATH + 64];
- PROCESS_INFORMATION pi;
- STARTUPINFOW si;
-
- GetSystemDirectoryW( cmdline, MAX_PATH );
- lstrcatW( cmdline, winebootW );
-
- if (flags & EWX_FORCE) lstrcatW( cmdline, killW );
- else
- {
- lstrcatW( cmdline, end_sessionW );
- if (flags & EWX_FORCEIFHUNG) lstrcatW( cmdline, forceW );
- }
- if (!(flags & EWX_REBOOT)) lstrcatW( cmdline, shutdownW );
-
- memset( &si, 0, sizeof si );
- si.cb = sizeof si;
- if (!CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL,
&si, &pi ))
- {
- ERR( "Failed to run %s\n", debugstr_w(cmdline) );
- return FALSE;
- }
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
- return TRUE;
-}
-
/***********************************************************************
* LockWorkStation (USER32.@)
*/
@@ -405,15 +366,6 @@
return FALSE;
}
-/***********************************************************************
- * RegisterServicesProcess (USER32.@)
- */
-int WINAPI RegisterServicesProcess(DWORD ServicesProcessId)
-{
- FIXME("(0x%x): stub\n", ServicesProcessId);
- return TRUE;
-}
-
BOOL WINAPI ClientThreadSetup()
{