[USERSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 17 Dec 2014 23:03:36 +0000 (23:03 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 17 Dec 2014 23:03:36 +0000 (23:03 +0000)
- Set the process creation notify routine for BASE that needs to be called when a process is created.
Patch by Timo, see CORE-7505.

[BASESRV]
- Implement BaseSetProcessCreateNotify that just saves internally the notification function to be called when a process is created.
- Call the notification function where it should be.

CORE-7505

svn path=/trunk/; revision=65712

reactos/include/reactos/subsys/win/base.h
reactos/subsystems/win/basesrv/proc.c
reactos/win32ss/user/ntuser/ntstubs.c
reactos/win32ss/user/winsrv/usersrv/init.c
reactos/win32ss/user/winsrv/usersrv/usersrv.h

index 6667bcb..0f06dbb 100644 (file)
@@ -15,11 +15,13 @@ typedef
 BOOL
 (CALLBACK *BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(
     HANDLE NewProcessId,
-    HANDLE SourceThreadId,
-    DWORD dwUnknown,
-    ULONG CreateFlags);
+    HANDLE ParentThreadId,
+    ULONG  dwUnknown,
+    ULONG  CreateFlags);
 
-NTSTATUS WINAPI BaseSetProcessCreateNotify(BASE_PROCESS_CREATE_NOTIFY_ROUTINE);
+VOID
+NTAPI
+BaseSetProcessCreateNotify(IN BASE_PROCESS_CREATE_NOTIFY_ROUTINE ProcessCreateNotifyProc);
 
 typedef struct _NLS_USER_INFO
 {
index 2e9c5aa..c947451 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
+/* GLOBALS ********************************************************************/
+
+/* User notification procedure to be called when a process is created */
+static BASE_PROCESS_CREATE_NOTIFY_ROUTINE UserNotifyProcessCreate = NULL;
+
 /* PUBLIC SERVER APIS *********************************************************/
 
 CSR_API(BaseSrvDebugProcess)
@@ -167,7 +172,14 @@ CSR_API(BaseSrvCreateProcess)
         return Status;
     }
 
-    /* FIXME: Should notify user32 */
+    /* Call the user notification procedure */
+    if (UserNotifyProcessCreate)
+    {
+        UserNotifyProcessCreate(CreateProcessRequest->ClientId.UniqueProcess,
+                                Process->ClientId.UniqueThread,
+                                0,
+                                Flags);
+    }
 
     /* Check if this is a VDM process */
     if (CreateProcessRequest->VdmBinaryType)
@@ -295,12 +307,12 @@ CSR_API(BaseSrvSetProcessShutdownParam)
 
 /* PUBLIC API *****************************************************************/
 
-NTSTATUS
+VOID
 NTAPI
 BaseSetProcessCreateNotify(IN BASE_PROCESS_CREATE_NOTIFY_ROUTINE ProcessCreateNotifyProc)
 {
-    DPRINT("BASESRV: %s(%08lx) called\n", __FUNCTION__, ProcessCreateNotifyProc);
-    return STATUS_NOT_IMPLEMENTED;
+    /* Set the user notification procedure to be called when a process is created */
+    UserNotifyProcessCreate = ProcessCreateNotifyProc;
 }
 
 /* EOF */
index b3da24e..a75dafd 100644 (file)
@@ -709,9 +709,9 @@ BOOL
 NTAPI
 NtUserNotifyProcessCreate(
     HANDLE NewProcessId,
-    HANDLE SourceThreadId,
-    DWORD dwUnknown,
-    ULONG CreateFlags)
+    HANDLE ParentThreadId,
+    ULONG  dwUnknown,
+    ULONG  CreateFlags)
 {
     STUB;
     return FALSE;
index fc199b9..8a1b3d9 100644 (file)
@@ -261,6 +261,9 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
         return Status;
     }
 
+    /* Set the process creation notify routine for BASE */
+    BaseSetProcessCreateNotify(NtUserNotifyProcessCreate);
+
     /* Initialize the kernel mode subsystem */
     Status = NtUserInitialize(USER_VERSION,
                               ghPowerRequestEvent,
index 2e0f85b..bb281e6 100644 (file)
@@ -21,6 +21,9 @@
 
 // #define NTOS_MODE_USER
 
+/* BASE Header */
+#include <win/base.h>
+
 /* USER Headers */
 #include <win/winmsg.h>