Modified: trunk/reactos/subsys/csrss/api/process.c
Modified: trunk/reactos/subsys/csrss/api/wapi.c
Modified: trunk/reactos/subsys/csrss/include/api.h
Modified: trunk/reactos/subsys/csrss/include/conio.h
Modified: trunk/reactos/subsys/csrss/include/csrplugin.h
Modified: trunk/reactos/subsys/csrss/include/win32csr.h
Modified: trunk/reactos/subsys/csrss/init.c
--- trunk/reactos/subsys/csrss/api/process.c 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/api/process.c 2005-12-01 22:38:03 UTC (rev 19817)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
* reactos/subsys/csrss/api/process.c
*
* "\windows\ApiPort" port process management functions
@@ -115,6 +114,14 @@
{
DPRINT1("CsrCreateProcessData() failed\n");
}
+ else
+ {
+ pProcessData->Terminated = FALSE;
+
+ /* Set default shutdown parameters */
+ pProcessData->ShutdownLevel = 0x280;
+ pProcessData->ShutdownFlags = 0;
+ }
return pProcessData;
}
@@ -185,7 +192,35 @@
return STATUS_INVALID_PARAMETER;
}
+NTSTATUS STDCALL
+CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, PVOID Context)
+{
+ UINT Hash;
+ PCSRSS_PROCESS_DATA pProcessData;
+ NTSTATUS Status = STATUS_SUCCESS;
+ LOCK;
+
+ for (Hash = 0; Hash < (sizeof(ProcessData) / sizeof(*ProcessData)); Hash++)
+ {
+ pProcessData = ProcessData[Hash];
+ while (NULL != pProcessData)
+ {
+ Status = EnumProc(pProcessData, Context);
+ if (STATUS_SUCCESS != Status)
+ {
+ UNLOCK;
+ return Status;
+ }
+ pProcessData = pProcessData->next;
+ }
+ }
+
+ UNLOCK;
+
+ return Status;
+}
+
/**********************************************************************
* CSRSS API
*********************************************************************/
@@ -233,6 +268,7 @@
return(Request->Status = STATUS_INVALID_PARAMETER);
}
+ ProcessData->Terminated = TRUE;
Request->Status = STATUS_SUCCESS;
return STATUS_SUCCESS;
}
@@ -373,6 +409,13 @@
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
ProcessData = CsrGetProcessData(Request->Data.DuplicateHandleRequest.ProcessId);
+ if (NULL == ProcessData || ProcessData->Terminated)
+ {
+ DPRINT1("Invalid source process %d\n", Request->Data.DuplicateHandleRequest.ProcessId);
+ Request->Status = STATUS_INVALID_PARAMETER;
+ return Request->Status;
+ }
+
Request->Status = CsrGetObject(ProcessData, Request->Data.DuplicateHandleRequest.Handle, &Object);
if (! NT_SUCCESS(Request->Status))
{
--- trunk/reactos/subsys/csrss/api/wapi.c 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/api/wapi.c 2005-12-01 22:38:03 UTC (rev 19817)
@@ -13,6 +13,8 @@
#include <csrss.h>
#define NDEBUG
+
+#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
@@ -128,8 +130,8 @@
&Request->Header);
if (!NT_SUCCESS(Status))
{
- DPRINT1("CSR: NtReplyWaitReceivePort failed\n");
- break;
+ DPRINT1("NtReplyWaitReceivePort failed\n");
+ break;
}
/* If the connection was closed, handle that */
@@ -147,11 +149,17 @@
ProcessData = CsrGetProcessData(Request->Header.ClientId.UniqueProcess);
if (ProcessData == NULL)
{
- DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n",
+ DPRINT1("Message %d: Unable to find data for process 0x%x\n",
Request->Header.u2.s2.Type,
Request->Header.ClientId.UniqueProcess);
break;
}
+ if (ProcessData->Terminated)
+ {
+ DPRINT1("Message %d: process %d already terminated\n",
+ Request->Type, (ULONG)Request->Header.ClientId.UniqueProcess);
+ continue;
+ }
/* Call the Handler */
CsrApiCallHandler(ProcessData, Request);
--- trunk/reactos/subsys/csrss/include/api.h 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/include/api.h 2005-12-01 22:38:03 UTC (rev 19817)
@@ -50,6 +50,7 @@
struct _CSRSS_PROCESS_DATA * next;
LIST_ENTRY ProcessEntry;
PCONTROLDISPATCHER CtrlDispatcher;
+ BOOL Terminated;
} CSRSS_PROCESS_DATA, *PCSRSS_PROCESS_DATA;
typedef VOID (STDCALL *CSR_CLEANUP_OBJECT_PROC)(Object_t *Object);
@@ -110,10 +111,13 @@
VOID STDCALL CsrInitConsoleSupport(VOID);
/* api/process.c */
+typedef NTSTATUS (STDCALL *CSRSS_ENUM_PROCESS_PROC)(PCSRSS_PROCESS_DATA ProcessData,
+ PVOID Context);
VOID STDCALL CsrInitProcessData(VOID);
PCSRSS_PROCESS_DATA STDCALL CsrGetProcessData(HANDLE ProcessId);
PCSRSS_PROCESS_DATA STDCALL CsrCreateProcessData(HANDLE ProcessId);
NTSTATUS STDCALL CsrFreeProcessData( HANDLE Pid );
+NTSTATUS STDCALL CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, PVOID Context);
/* api/handle.c */
NTSTATUS FASTCALL CsrRegisterObjectDefinitions(PCSRSS_OBJECT_DEFINITION NewDefinitions);
--- trunk/reactos/subsys/csrss/include/conio.h 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/include/conio.h 2005-12-01 22:38:03 UTC (rev 19817)
@@ -100,6 +100,8 @@
LONG *LogicalY);
VOID FASTCALL ConioDrawConsole(PCSRSS_CONSOLE Console);
VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData);
+VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event, PCSRSS_PROCESS_DATA ProcessData,
+ DWORD Timeout);
/* api/conio.c */
CSR_API(CsrWriteConsole);
--- trunk/reactos/subsys/csrss/include/csrplugin.h 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/include/csrplugin.h 2005-12-01 22:38:03 UTC (rev 19817)
@@ -30,12 +30,15 @@
Object_t **Object);
typedef NTSTATUS (STDCALL *CSRSS_RELEASE_OBJECT_PROC)(PCSRSS_PROCESS_DATA ProcessData,
HANDLE Object );
+typedef NTSTATUS (STDCALL *CSRSS_ENUM_PROCESSES_PROC)(CSRSS_ENUM_PROCESS_PROC EnumProc,
+ PVOID Context);
typedef struct tagCSRSS_EXPORTED_FUNCS
{
CSRSS_INSERT_OBJECT_PROC CsrInsertObjectProc;
CSRSS_GET_OBJECT_PROC CsrGetObjectProc;
CSRSS_RELEASE_OBJECT_PROC CsrReleaseObjectProc;
+ CSRSS_ENUM_PROCESSES_PROC CsrEnumProcessesProc;
} CSRSS_EXPORTED_FUNCS, *PCSRSS_EXPORTED_FUNCS;
typedef BOOL (STDCALL *CSRPLUGIN_INIT_COMPLETE_PROC)(void);
--- trunk/reactos/subsys/csrss/include/win32csr.h 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/include/win32csr.h 2005-12-01 22:38:03 UTC (rev 19817)
@@ -11,6 +11,7 @@
#define WIN32CSR_H_INCLUDED
#include <windows.h>
+#include <commctrl.h>
extern HANDLE Win32CsrApiHeap;
extern HINSTANCE Win32CsrDllHandle;
@@ -24,13 +25,13 @@
long Type);
VOID FASTCALL Win32CsrUnlockObject(Object_t *Object);
-#ifndef TODO
NTSTATUS FASTCALL Win32CsrGetObject(PCSRSS_PROCESS_DATA ProcessData,
HANDLE Handle,
Object_t **Object);
NTSTATUS FASTCALL Win32CsrReleaseObject(PCSRSS_PROCESS_DATA ProcessData,
HANDLE Object);
-#endif
+NTSTATUS FASTCALL Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
+ PVOID Context);
#endif /* WIN32CSR_H_INCLUDED */
--- trunk/reactos/subsys/csrss/init.c 2005-12-01 22:35:53 UTC (rev 19816)
+++ trunk/reactos/subsys/csrss/init.c 2005-12-01 22:38:03 UTC (rev 19817)
@@ -200,6 +200,7 @@
Exports.CsrInsertObjectProc = CsrInsertObject;
Exports.CsrGetObjectProc = CsrGetObject;
Exports.CsrReleaseObjectProc = CsrReleaseObject;
+ Exports.CsrEnumProcessesProc = CsrEnumProcesses;
if (! (*InitProc)(&ApiDefinitions, &ObjectDefinitions, &InitCompleteProc,
&Exports, CsrssApiHeap))
{