2005-01-03 23:02:15 +00:00
|
|
|
/* $Id$
|
2003-12-02 11:38:47 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* FILE: subsys/csrss/include/api.h
|
|
|
|
* PURPOSE: CSRSS API interface
|
|
|
|
*/
|
|
|
|
|
2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2001-08-14 12:57:16 +00:00
|
|
|
|
2005-06-20 11:56:10 +00:00
|
|
|
#define NTOS_MODE_USER
|
|
|
|
#include <ndk/ntndk.h>
|
1999-06-08 22:50:59 +00:00
|
|
|
|
1999-12-22 14:48:30 +00:00
|
|
|
#include <csrss/csrss.h>
|
1999-06-08 22:50:59 +00:00
|
|
|
|
2010-03-10 04:59:39 +00:00
|
|
|
typedef enum _CSR_THREAD_FLAGS
|
|
|
|
{
|
|
|
|
CsrThreadAltertable = 0x1,
|
|
|
|
CsrThreadInTermination = 0x2,
|
|
|
|
CsrThreadTerminated = 0x4,
|
|
|
|
CsrThreadIsServerThread = 0x10
|
|
|
|
} CSR_THREAD_FLAGS, *PCSR_THREAD_FLAGS;
|
|
|
|
|
2010-03-09 20:23:22 +00:00
|
|
|
typedef enum _SHUTDOWN_RESULT
|
|
|
|
{
|
|
|
|
CsrShutdownCsrProcess = 1,
|
|
|
|
CsrShutdownNonCsrProcess,
|
|
|
|
CsrShutdownCancelled
|
|
|
|
} SHUTDOWN_RESULT, *PSHUTDOWN_RESULT;
|
|
|
|
|
|
|
|
typedef enum _CSR_SHUTDOWN_FLAGS
|
|
|
|
{
|
|
|
|
CsrShutdownSystem = 4,
|
|
|
|
CsrShutdownOther = 8
|
|
|
|
} CSR_SHUTDOWN_FLAGS, *PCSR_SHUTDOWN_FLAGS;
|
|
|
|
|
|
|
|
typedef enum _CSR_PROCESS_FLAGS
|
|
|
|
{
|
|
|
|
CsrProcessTerminating = 0x1,
|
|
|
|
CsrProcessSkipShutdown = 0x2,
|
|
|
|
CsrProcessCreateNewGroup = 0x100,
|
|
|
|
CsrProcessTerminated = 0x200,
|
|
|
|
CsrProcessLastThreadTerminated = 0x400,
|
|
|
|
CsrProcessIsConsoleApp = 0x800
|
|
|
|
} CSR_PROCESS_FLAGS, *PCSR_PROCESS_FLAGS;
|
|
|
|
|
2003-01-11 15:51:48 +00:00
|
|
|
typedef struct _CSRSS_PROCESS_DATA
|
1999-12-22 14:48:30 +00:00
|
|
|
{
|
2010-05-22 23:47:54 +00:00
|
|
|
struct tagCSRSS_CONSOLE *Console;
|
|
|
|
struct tagCSRSS_CONSOLE *ParentConsole;
|
2005-07-31 21:23:40 +00:00
|
|
|
BOOL bInheritHandles;
|
2005-05-26 19:22:45 +00:00
|
|
|
RTL_CRITICAL_SECTION HandleTableLock;
|
2001-12-02 23:34:43 +00:00
|
|
|
ULONG HandleTableSize;
|
2010-05-23 00:51:29 +00:00
|
|
|
struct _CSRSS_HANDLE *HandleTable;
|
2005-01-26 00:03:05 +00:00
|
|
|
HANDLE ProcessId;
|
2008-08-02 17:01:22 +00:00
|
|
|
DWORD ProcessGroup;
|
2005-04-03 13:04:10 +00:00
|
|
|
HANDLE Process;
|
2002-10-20 16:40:12 +00:00
|
|
|
ULONG ShutdownLevel;
|
|
|
|
ULONG ShutdownFlags;
|
2001-12-02 23:34:43 +00:00
|
|
|
HANDLE ConsoleEvent;
|
|
|
|
PVOID CsrSectionViewBase;
|
|
|
|
ULONG CsrSectionViewSize;
|
2007-06-14 19:09:32 +00:00
|
|
|
HANDLE ServerCommunicationPort;
|
2003-01-11 15:51:48 +00:00
|
|
|
struct _CSRSS_PROCESS_DATA * next;
|
2003-08-18 10:58:49 +00:00
|
|
|
LIST_ENTRY ProcessEntry;
|
|
|
|
PCONTROLDISPATCHER CtrlDispatcher;
|
2005-12-01 22:38:03 +00:00
|
|
|
BOOL Terminated;
|
2010-03-09 20:23:22 +00:00
|
|
|
ULONG Flags;
|
|
|
|
ULONG ThreadCount;
|
|
|
|
LIST_ENTRY ThreadList;
|
1999-12-22 14:48:30 +00:00
|
|
|
} CSRSS_PROCESS_DATA, *PCSRSS_PROCESS_DATA;
|
2005-05-08 04:07:56 +00:00
|
|
|
|
2010-03-09 20:23:22 +00:00
|
|
|
typedef struct _CSR_THREAD
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CreateTime;
|
|
|
|
LIST_ENTRY Link;
|
|
|
|
LIST_ENTRY HashLinks;
|
|
|
|
CLIENT_ID ClientId;
|
|
|
|
PCSRSS_PROCESS_DATA Process;
|
|
|
|
//struct _CSR_WAIT_BLOCK *WaitBlock;
|
|
|
|
HANDLE ThreadHandle;
|
|
|
|
ULONG Flags;
|
|
|
|
ULONG ReferenceCount;
|
|
|
|
ULONG ImpersonationCount;
|
|
|
|
} CSR_THREAD, *PCSR_THREAD;
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
typedef NTSTATUS (WINAPI *CSRSS_API_PROC)(PCSRSS_PROCESS_DATA ProcessData,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
PCSR_API_MESSAGE Request);
|
2003-12-02 11:38:47 +00:00
|
|
|
|
|
|
|
typedef struct _CSRSS_API_DEFINITION
|
|
|
|
{
|
|
|
|
ULONG Type;
|
|
|
|
ULONG MinRequestSize;
|
|
|
|
CSRSS_API_PROC Handler;
|
|
|
|
} CSRSS_API_DEFINITION, *PCSRSS_API_DEFINITION;
|
|
|
|
|
|
|
|
#define CSRSS_DEFINE_API(Func, Handler) \
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
{ Func, sizeof(CSRSS_##Func), Handler }
|
1999-06-08 22:50:59 +00:00
|
|
|
|
2003-12-02 11:38:47 +00:00
|
|
|
typedef struct _CSRSS_LISTEN_DATA
|
|
|
|
{
|
|
|
|
HANDLE ApiPortHandle;
|
|
|
|
ULONG ApiDefinitionsCount;
|
|
|
|
PCSRSS_API_DEFINITION *ApiDefinitions;
|
|
|
|
} CSRSS_LISTEN_DATA, *PCSRSS_LISTEN_DATA;
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
#define CSR_API(n) NTSTATUS WINAPI n (\
|
2001-08-14 12:57:16 +00:00
|
|
|
PCSRSS_PROCESS_DATA ProcessData,\
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
PCSR_API_MESSAGE Request)
|
2000-05-26 05:43:33 +00:00
|
|
|
|
2005-03-20 22:55:05 +00:00
|
|
|
/* init.c */
|
|
|
|
extern HANDLE hBootstrapOk;
|
2010-05-23 00:51:29 +00:00
|
|
|
NTSTATUS NTAPI CsrServerInitialization(ULONG ArgumentCount, PCHAR Arguments[]);
|
2005-03-20 22:55:05 +00:00
|
|
|
|
2001-08-14 12:57:16 +00:00
|
|
|
/* api/process.c */
|
|
|
|
CSR_API(CsrConnectProcess);
|
|
|
|
CSR_API(CsrCreateProcess);
|
|
|
|
CSR_API(CsrTerminateProcess);
|
2010-03-10 06:49:53 +00:00
|
|
|
CSR_API(CsrSrvCreateThread);
|
2010-05-23 00:51:29 +00:00
|
|
|
CSR_API(CsrGetShutdownParameters);
|
|
|
|
CSR_API(CsrSetShutdownParameters);
|
1999-12-22 14:48:30 +00:00
|
|
|
|
|
|
|
/* api/wapi.c */
|
2003-12-02 11:38:47 +00:00
|
|
|
NTSTATUS FASTCALL CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions);
|
|
|
|
VOID FASTCALL CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
PCSR_API_MESSAGE Request);
|
2008-11-29 22:48:58 +00:00
|
|
|
DWORD WINAPI ServerSbApiPortThread (PVOID PortHandle);
|
2010-05-23 00:51:29 +00:00
|
|
|
VOID NTAPI ClientConnectionThread(HANDLE ServerPort);
|
1999-12-30 01:51:42 +00:00
|
|
|
|
|
|
|
extern HANDLE CsrssApiHeap;
|
|
|
|
|
|
|
|
/* api/process.c */
|
2008-11-29 22:48:58 +00:00
|
|
|
typedef NTSTATUS (WINAPI *CSRSS_ENUM_PROCESS_PROC)(PCSRSS_PROCESS_DATA ProcessData,
|
2005-12-01 22:38:03 +00:00
|
|
|
PVOID Context);
|
2008-11-29 22:48:58 +00:00
|
|
|
VOID WINAPI CsrInitProcessData(VOID);
|
|
|
|
PCSRSS_PROCESS_DATA WINAPI CsrGetProcessData(HANDLE ProcessId);
|
|
|
|
PCSRSS_PROCESS_DATA WINAPI CsrCreateProcessData(HANDLE ProcessId);
|
|
|
|
NTSTATUS WINAPI CsrFreeProcessData( HANDLE Pid );
|
|
|
|
NTSTATUS WINAPI CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, PVOID Context);
|
2010-03-09 20:23:22 +00:00
|
|
|
PCSR_THREAD NTAPI CsrAddStaticServerThread(IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags);
|
|
|
|
PCSR_THREAD NTAPI CsrLocateThreadInProcess(IN PCSRSS_PROCESS_DATA CsrProcess OPTIONAL, IN PCLIENT_ID Cid);
|
|
|
|
PCSR_THREAD NTAPI CsrLocateThreadByClientId(OUT PCSRSS_PROCESS_DATA *Process OPTIONAL, IN PCLIENT_ID ClientId);
|
2010-03-10 06:49:53 +00:00
|
|
|
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSRSS_PROCESS_DATA *CsrProcess OPTIONAL);
|
|
|
|
NTSTATUS NTAPI CsrCreateThread(IN PCSRSS_PROCESS_DATA CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId);
|
|
|
|
NTSTATUS NTAPI CsrUnlockProcess(IN PCSRSS_PROCESS_DATA CsrProcess);
|
|
|
|
|
|
|
|
//hack
|
|
|
|
VOID NTAPI CsrThreadRefcountZero(IN PCSR_THREAD CsrThread);
|
|
|
|
|
2003-12-02 11:38:47 +00:00
|
|
|
/* api/user.c */
|
|
|
|
CSR_API(CsrRegisterServicesProcess);
|
2004-07-12 20:09:35 +00:00
|
|
|
|
2003-12-02 11:38:47 +00:00
|
|
|
/* EOF */
|