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
This commit is contained in:
Alex Ionescu 2005-06-22 04:02:32 +00:00
parent 321df5d69c
commit 3e604d23e7
32 changed files with 1290 additions and 1553 deletions

View file

@ -7,51 +7,52 @@
#include <ntos.h>
#endif
#define CSR_NATIVE 0x0000
#define CSR_CONSOLE 0x0001
#define CSR_GUI 0x0002
/*
typedef union _CSR_API_NUMBER
{
WORD Index; // CSRSS API number
WORD Subsystem; // 0=NTDLL;1=KERNEL32;2=KERNEL32
} CSR_API_NUMBER, *PCSR_API_NUMBER;
*/
typedef ULONG CSR_API_NUMBER;
#define MAKE_CSR_API(Number, Server) \
((Server) << 16) + Number
#define CSR_CSRSS_SECTION_SIZE (65536)
typedef __declspec(noreturn) VOID CALLBACK(*PCONTROLDISPATCHER)(DWORD);
typedef struct
{
} CSRSS_CONNECT_PROCESS_REQUEST, *PCSRSS_CONNECT_PROCESS_REQUEST;
typedef struct
{
} CSRSS_CONNECT_PROCESS_REPLY, *PCSRSS_CONNECT_PROCESS_REPLY;
} CSRSS_CONNECT_PROCESS, *PCSRSS_CONNECT_PROCESS;
typedef struct
{
HANDLE NewProcessId;
ULONG Flags;
PCONTROLDISPATCHER CtrlDispatcher;
} CSRSS_CREATE_PROCESS_REQUEST, *PCSRSS_CREATE_PROCESS_REQUEST;
typedef struct
{
HANDLE Console;
HANDLE InputHandle;
HANDLE OutputHandle;
} CSRSS_CREATE_PROCESS_REPLY, *PCSRSS_CREATE_PROCESS_REPLY;
} CSRSS_CREATE_PROCESS, *PCSRSS_CREATE_PROCESS;
typedef struct
{
} CSRSS_TERMINATE_PROCESS_REQUEST, *PCSRSS_TERMINATE_PROCESS_REQUEST;
typedef struct
{
} CSRSS_TERMINATE_PROCESS_REPLY, *PCSRSS_TERMINATE_PROCESS_REPLY;
} CSRSS_TERMINATE_PROCESS, *PCSRSS_TERMINATE_PROCESS;
typedef struct
{
ULONG nMaxIds;
} CSRSS_GET_PROCESS_LIST_REQUEST, *PCSRSS_GET_PROCESS_LIST_REQUEST;
typedef struct
{
ULONG nProcessIdsCopied;
ULONG nProcessIdsTotal;
HANDLE ProcessId[1];
} CSRSS_GET_PROCESS_LIST_REPLY, *PCSRSS_GET_PROCESS_LIST_REPLY;
} CSRSS_GET_PROCESS_LIST, *PCSRSS_GET_PROCESS_LIST;
typedef struct
{
@ -59,12 +60,8 @@ typedef struct
BOOL Unicode;
ULONG NrCharactersToWrite;
BYTE Buffer[1];
} CSRSS_WRITE_CONSOLE_REQUEST, *PCSRSS_WRITE_CONSOLE_REQUEST;
typedef struct
{
ULONG NrCharactersWritten;
} CSRSS_WRITE_CONSOLE_REPLY, *PCSRSS_WRITE_CONSOLE_REPLY;
} CSRSS_WRITE_CONSOLE, *PCSRSS_WRITE_CONSOLE;
typedef struct
{
@ -72,54 +69,34 @@ typedef struct
BOOL Unicode;
WORD NrCharactersToRead;
WORD nCharsCanBeDeleted; /* number of chars already in buffer that can be backspaced */
} CSRSS_READ_CONSOLE_REQUEST, *PCSRSS_READ_CONSOLE_REQUEST;
typedef struct
{
HANDLE EventHandle;
ULONG NrCharactersRead;
BYTE Buffer[1];
} CSRSS_READ_CONSOLE_REPLY, *PCSRSS_READ_CONSOLE_REPLY;
} CSRSS_READ_CONSOLE, *PCSRSS_READ_CONSOLE;
typedef struct
{
PCONTROLDISPATCHER CtrlDispatcher;
} CSRSS_ALLOC_CONSOLE_REQUEST, *PCSRSS_ALLOC_CONSOLE_REQUEST;
typedef struct
{
HANDLE Console;
HANDLE InputHandle;
HANDLE OutputHandle;
} CSRSS_ALLOC_CONSOLE_REPLY, *PCSRSS_ALLOC_CONSOLE_REPLY;
} CSRSS_ALLOC_CONSOLE, *PCSRSS_ALLOC_CONSOLE;
typedef struct
{
} CSRSS_FREE_CONSOLE_REQUEST, *PCSRSS_FREE_CONSOLE_REQUEST;
typedef struct
{
} CSRSS_FREE_CONSOLE_REPLY, *PCSRSS_FREE_CONSOLE_REPLY;
} CSRSS_FREE_CONSOLE, *PCSRSS_FREE_CONSOLE;
typedef struct
{
HANDLE ConsoleHandle;
} CSRSS_SCREEN_BUFFER_INFO_REQUEST, *PCSRSS_SCREEN_BUFFER_INFO_REQUEST;
typedef struct
{
CONSOLE_SCREEN_BUFFER_INFO Info;
} CSRSS_SCREEN_BUFFER_INFO_REPLY, *PCSRSS_SCREEN_BUFFER_INFO_REPLY;
} CSRSS_SCREEN_BUFFER_INFO, *PCSRSS_SCREEN_BUFFER_INFO;
typedef struct
{
HANDLE ConsoleHandle;
COORD Position;
} CSRSS_SET_CURSOR_REQUEST, *PCSRSS_SET_CURSOR_REQUEST;
typedef struct
{
} CSRSS_SET_CURSOR_REPLY, *PCSRSS_SET_CURSOR_REPLY;
} CSRSS_SET_CURSOR, *PCSRSS_SET_CURSOR;
typedef struct
{
@ -132,12 +109,8 @@ typedef struct
} Char;
COORD Position;
WORD Length;
} CSRSS_FILL_OUTPUT_REQUEST, *PCSRSS_FILL_OUTPUT_REQUEST;
typedef struct
{
ULONG NrCharactersWritten;
} CSRSS_FILL_OUTPUT_REPLY, *PCSRSS_FILL_OUTPUT_REPLY;
} CSRSS_FILL_OUTPUT, *PCSRSS_FILL_OUTPUT;
typedef struct
{
@ -145,24 +118,16 @@ typedef struct
CHAR Attribute;
COORD Coord;
WORD Length;
} CSRSS_FILL_OUTPUT_ATTRIB_REQUEST, *PCSRSS_FILL_OUTPUT_ATTRIB_REQUEST;
typedef struct
{
} CSRSS_FILL_OUTPUT_ATTRIB_REPLY, *PCSRSS_FILL_OUTPUT_ATTRIB_REPLY;
} CSRSS_FILL_OUTPUT_ATTRIB, *PCSRSS_FILL_OUTPUT_ATTRIB;
typedef struct
{
HANDLE ConsoleHandle;
BOOL Unicode;
} CSRSS_READ_INPUT_REQUEST, *PCSRSS_READ_INPUT_REQUEST;
typedef struct
{
INPUT_RECORD Input;
BOOL MoreEvents;
HANDLE Event;
} CSRSS_READ_INPUT_REPLY, *PCSRSS_READ_INPUT_REPLY;
} CSRSS_READ_INPUT, *PCSRSS_READ_INPUT;
typedef struct
{
@ -171,13 +136,9 @@ typedef struct
WORD Length;
COORD Coord;
CHAR String[1];
} CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST, *PCSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST;
typedef struct
{
COORD EndCoord;
ULONG NrCharactersWritten;
} CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REPLY, *PCSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REPLY;
} CSRSS_WRITE_CONSOLE_OUTPUT_CHAR, *PCSRSS_WRITE_CONSOLE_OUTPUT_CHAR;
typedef struct
{
@ -185,114 +146,69 @@ typedef struct
WORD Length;
COORD Coord;
CHAR String[1];
} CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST, *PCSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST;
typedef struct
{
COORD EndCoord;
} CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REPLY, *PCSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REPLY;
typedef struct
{
HANDLE ConsoleHandle;
} CSRSS_GET_CURSOR_INFO_REQUEST, *PCSRSS_GET_CURSOR_INFO_REQUEST;
typedef struct
{
CONSOLE_CURSOR_INFO Info;
} CSRSS_GET_CURSOR_INFO_REPLY, *PCSRSS_GET_CURSOR_INFO_REPLY;
} CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB, *PCSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB;
typedef struct
{
HANDLE ConsoleHandle;
CONSOLE_CURSOR_INFO Info;
} CSRSS_SET_CURSOR_INFO_REQUEST, *PCSRSS_SET_CURSOR_INFO_REQUEST;
} CSRSS_GET_CURSOR_INFO, *PCSRSS_GET_CURSOR_INFO;
typedef struct
{
} CSRSS_SET_CURSOR_INFO_REPLY, *PCSRSS_SET_CURSOR_INFO_REPLY;
HANDLE ConsoleHandle;
CONSOLE_CURSOR_INFO Info;
} CSRSS_SET_CURSOR_INFO, *PCSRSS_SET_CURSOR_INFO;
typedef struct
{
HANDLE ConsoleHandle;
CHAR Attrib;
} CSRSS_SET_ATTRIB_REQUEST, *PCSRSS_SET_ATTRIB_REQUEST;
typedef struct
{
} CSRSS_SET_ATTRIB_REPLY, *PCSRSS_SET_ATTRIB_REPLY;
} CSRSS_SET_ATTRIB, *PCSRSS_SET_ATTRIB;
typedef struct
{
HANDLE ConsoleHandle;
DWORD Mode;
} CSRSS_SET_CONSOLE_MODE_REQUEST, *PCSRSS_SET_CONSOLE_MODE_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_MODE_REPLY, *PCSRSS_SET_CONSOLE_MODE_REPLY;
} CSRSS_SET_CONSOLE_MODE, *PCSRSS_SET_CONSOLE_MODE;
typedef struct
{
HANDLE ConsoleHandle;
} CSRSS_GET_CONSOLE_MODE_REQUEST, *PCSRSS_GET_CONSOLE_MODE_REQUEST;
typedef struct
{
DWORD ConsoleMode;
} CSRSS_GET_CONSOLE_MODE_REPLY, *PCSRSS_GET_CONSOLE_MODE_REPLY;
} CSRSS_GET_CONSOLE_MODE, *PCSRSS_GET_CONSOLE_MODE;
typedef struct
{
/* may want to add some parameters here someday */
} CSRSS_CREATE_SCREEN_BUFFER_REQUEST, *PCSRSS_CREATE_SCREEN_BUFFER_REQUEST;
typedef struct
{
HANDLE OutputHandle; /* handle to newly created screen buffer */
} CSRSS_CREATE_SCREEN_BUFFER_REPLY, *PCSRSS_CREATE_SCREEN_BUFFER_REPLY;
} CSRSS_CREATE_SCREEN_BUFFER, *PCSRSS_CREATE_SCREEN_BUFFER;
typedef struct
{
HANDLE OutputHandle; /* handle to screen buffer to switch to */
} CSRSS_SET_SCREEN_BUFFER_REQUEST, *PCSRSS_SET_SCREEN_BUFFER_REQUEST;
typedef struct
{
} CSRSS_SET_SCREEN_BUFFER_REPLY, *PCSRSS_SET_SCREEN_BUFFER_REPLY;
} CSRSS_SET_SCREEN_BUFFER, *PCSRSS_SET_SCREEN_BUFFER;
typedef struct
{
HANDLE UniqueThread;
} CSRSS_IDENTIFY_ALERTABLE_THREAD_REQUEST, *PCSRSS_IDENTIFY_ALERTABLE_THREAD_REQUEST;
typedef struct
{
CLIENT_ID Cid;
} CSRSS_IDENTIFY_ALERTABLE_THREAD_REPLY, *PCSRSS_IDENTIFY_ALERTABLE_THREAD_REPLY;
} CSRSS_IDENTIFY_ALERTABLE_THREAD, *PCSRSS_IDENTIFY_ALERTABLE_THREAD;
typedef struct
{
HANDLE Console;
DWORD Length;
WCHAR Title[1];
} CSRSS_SET_TITLE_REQUEST, *PCSRSS_SET_TITLE_REQUEST;
typedef struct
{
} CSRSS_SET_TITLE_REPLY, *PCSRSS_SET_TITLE_REPLY;
} CSRSS_SET_TITLE, *PCSRSS_SET_TITLE;
typedef struct
{
HANDLE ConsoleHandle;
} CSRSS_GET_TITLE_REQUEST, *PCSRSS_GET_TITLE_REQUEST;
typedef struct
{
HANDLE ConsoleHandle;
DWORD Length;
WCHAR Title[1];
} CSRSS_GET_TITLE_REPLY, *PCSRSS_GET_TITLE_REPLY;
} CSRSS_GET_TITLE, *PCSRSS_GET_TITLE;
typedef struct
{
@ -302,21 +218,12 @@ typedef struct
COORD BufferCoord;
SMALL_RECT WriteRegion;
CHAR_INFO* CharInfo;
} CSRSS_WRITE_CONSOLE_OUTPUT_REQUEST, *PCSRSS_WRITE_CONSOLE_OUTPUT_REQUEST;
typedef struct
{
SMALL_RECT WriteRegion;
} CSRSS_WRITE_CONSOLE_OUTPUT_REPLY, *PCSRSS_WRITE_CONSOLE_OUTPUT_REPLY;
} CSRSS_WRITE_CONSOLE_OUTPUT, *PCSRSS_WRITE_CONSOLE_OUTPUT;
typedef struct
{
HANDLE ConsoleInput;
} CSRSS_FLUSH_INPUT_BUFFER_REQUEST, *PCSRSS_FLUSH_INPUT_BUFFER_REQUEST;
typedef struct
{
} CSRSS_FLUSH_INPUT_BUFFER_REPLY, *PCSRSS_FLUSH_INPUT_BUFFER_REPLY;
} CSRSS_FLUSH_INPUT_BUFFER, *PCSRSS_FLUSH_INPUT_BUFFER;
typedef struct
{
@ -327,11 +234,7 @@ typedef struct
SMALL_RECT ClipRectangle;
COORD DestinationOrigin;
CHAR_INFO Fill;
} CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER_REQUEST, *PCSRSS_SCROLL_CONSOLE_SCREEN_BUFFER_REQUEST;
typedef struct
{
} CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER_REPLY, *PCSRSS_SCROLL_CONSOLE_SCREEN_BUFFER_REPLY;
} CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER, *PCSRSS_SCROLL_CONSOLE_SCREEN_BUFFER;
typedef struct
{
@ -339,76 +242,48 @@ typedef struct
BOOL Unicode;
DWORD NumCharsToRead;
COORD ReadCoord;
}CSRSS_READ_CONSOLE_OUTPUT_CHAR_REQUEST, *PCSRSS_READ_CONSOLE_OUTPUT_CHAR_REQUEST;
typedef struct
{
COORD EndCoord;
DWORD CharsRead;
CHAR String[1];
}CSRSS_READ_CONSOLE_OUTPUT_CHAR_REPLY, *PCSRSS_READ_CONSOLE_OUTPUT_CHAR_REPLY;
}CSRSS_READ_CONSOLE_OUTPUT_CHAR, *PCSRSS_READ_CONSOLE_OUTPUT_CHAR;
typedef struct
{
HANDLE ConsoleHandle;
DWORD NumAttrsToRead;
COORD ReadCoord;
}CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REQUEST, *PCSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REQUEST;
typedef struct
{
COORD EndCoord;
CHAR String[1];
}CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REPLY, *PCSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REPLY;
}CSRSS_READ_CONSOLE_OUTPUT_ATTRIB, *PCSRSS_READ_CONSOLE_OUTPUT_ATTRIB;
typedef struct
{
HANDLE ConsoleHandle;
}CSRSS_GET_NUM_INPUT_EVENTS_REQUEST, *PCSRSS_GET_NUM_INPUT_EVENTS_REQUEST;
typedef struct
{
DWORD NumInputEvents;
}CSRSS_GET_NUM_INPUT_EVENTS_REPLY, *PCSRSS_GET_NUM_INPUT_EVENTS_REPLY;
}CSRSS_GET_NUM_INPUT_EVENTS, *PCSRSS_GET_NUM_INPUT_EVENTS;
typedef struct
{
HANDLE ProcessId;
} CSRSS_REGISTER_SERVICES_PROCESS_REQUEST, *PCSRSS_REGISTER_SERVICES_PROCESS_REQUEST;
typedef struct
{
} CSRSS_REGISTER_SERVICES_PROCESS_REPLY, *PCSRSS_REGISTER_SERVICES_PROCESS_REPLY;
} CSRSS_REGISTER_SERVICES_PROCESS, *PCSRSS_REGISTER_SERVICES_PROCESS;
typedef struct
{
UINT Flags;
DWORD Reserved;
} CSRSS_EXIT_REACTOS_REQUEST, *PCSRSS_EXIT_REACTOS_REQUEST;
typedef struct
{
} CSRSS_EXIT_REACTOS_REPLY, *PCSRSS_EXIT_REACTOS_REPLY;
} CSRSS_EXIT_REACTOS, *PCSRSS_EXIT_REACTOS;
typedef struct
{
DWORD Level;
DWORD Flags;
} CSRSS_SET_SHUTDOWN_PARAMETERS_REQUEST, *PCSRSS_SET_SHUTDOWN_PARAMETERS_REQUEST;
typedef struct
{
} CSRSS_SET_SHUTDOWN_PARAMETERS_REPLY, *PCSRSS_SET_SHUTDOWN_PARAMETERS_REPLY;
typedef struct
{
} CSRSS_GET_SHUTDOWN_PARAMETERS_REQUEST, *PCSRSS_GET_SHUTDOWN_PARAMETERS_REQUEST;
} CSRSS_SET_SHUTDOWN_PARAMETERS, *PCSRSS_SET_SHUTDOWN_PARAMETERS;
typedef struct
{
DWORD Level;
DWORD Flags;
} CSRSS_GET_SHUTDOWN_PARAMETERS_REPLY, *PCSRSS_GET_SHUTDOWN_PARAMETERS_REPLY;
} CSRSS_GET_SHUTDOWN_PARAMETERS, *PCSRSS_GET_SHUTDOWN_PARAMETERS;
typedef struct
{
@ -416,12 +291,7 @@ typedef struct
BOOL Unicode;
DWORD Length;
INPUT_RECORD* InputRecord;
} CSRSS_PEEK_CONSOLE_INPUT_REQUEST, *PCSRSS_PEEK_CONSOLE_INPUT_REQUEST;
typedef struct
{
DWORD Length;
} CSRSS_PEEK_CONSOLE_INPUT_REPLY, *PCSRSS_PEEK_CONSOLE_INPUT_REPLY;
} CSRSS_PEEK_CONSOLE_INPUT, *PCSRSS_PEEK_CONSOLE_INPUT;
typedef struct
{
@ -431,12 +301,7 @@ typedef struct
COORD BufferCoord;
SMALL_RECT ReadRegion;
CHAR_INFO* CharInfo;
} CSRSS_READ_CONSOLE_OUTPUT_REQUEST, *PCSRSS_READ_CONSOLE_OUTPUT_REQUEST;
typedef struct
{
SMALL_RECT ReadRegion;
} CSRSS_READ_CONSOLE_OUTPUT_REPLY, *PCSRSS_READ_CONSOLE_OUTPUT_REPLY;
} CSRSS_READ_CONSOLE_OUTPUT, *PCSRSS_READ_CONSOLE_OUTPUT;
typedef struct
{
@ -444,59 +309,33 @@ typedef struct
BOOL Unicode;
DWORD Length;
INPUT_RECORD* InputRecord;
} CSRSS_WRITE_CONSOLE_INPUT_REQUEST, *PCSRSS_WRITE_CONSOLE_INPUT_REQUEST;
typedef struct
{
DWORD Length;
} CSRSS_WRITE_CONSOLE_INPUT_REPLY, *PCSRSS_WRITE_CONSOLE_INPUT_REPLY;
typedef struct
{
} CSRSS_GET_INPUT_HANDLE_REQUEST, *PCSRSS_GET_INPUT_HANDLE_REQUEST;
} CSRSS_WRITE_CONSOLE_INPUT, *PCSRSS_WRITE_CONSOLE_INPUT;
typedef struct
{
HANDLE InputHandle;
} CSRSS_GET_INPUT_HANDLE_REPLY, *PCSRSS_GET_INPUT_HANDLE_REPLY;
typedef struct
{
} CSRSS_GET_OUTPUT_HANDLE_REQUEST, *PCSRSS_GET_OUTPUT_HANDLE_REQUEST;
} CSRSS_GET_INPUT_HANDLE, *PCSRSS_GET_INPUT_HANDLE;
typedef struct
{
HANDLE OutputHandle;
} CSRSS_GET_OUTPUT_HANDLE_REPLY, *PCSRSS_GET_OUTPUT_HANDLE_REPLY;
} CSRSS_GET_OUTPUT_HANDLE, *PCSRSS_GET_OUTPUT_HANDLE;
typedef struct
{
HANDLE Handle;
} CSRSS_CLOSE_HANDLE_REQUEST, *PCSRSS_CLOSE_HANDLE_REQUEST;
typedef struct
{
} CSRSS_CLOSE_HANDLE_REPLY, *PCSRSS_CLOSE_HANDLE_REPLY;
} CSRSS_CLOSE_HANDLE, *PCSRSS_CLOSE_HANDLE;
typedef struct
{
HANDLE Handle;
} CSRSS_VERIFY_HANDLE_REQUEST, *PCSRSS_VERIFY_HANDLE_REQUEST;
typedef struct
{
} CSRSS_VERIFY_HANDLE_REPLY, *PCSRSS_VERIFY_HANDLE_REPLY;
} CSRSS_VERIFY_HANDLE, *PCSRSS_VERIFY_HANDLE;
typedef struct
{
HANDLE Handle;
HANDLE ProcessId;
} CSRSS_DUPLICATE_HANDLE_REQUEST, *PCSRSS_DUPLICATE_HANDLE_REQUEST;
typedef struct
{
HANDLE Handle;
} CSRSS_DUPLICATE_HANDLE_REPLY, *PCSRSS_DUPLICATE_HANDLE_REPLY;
} CSRSS_DUPLICATE_HANDLE, *PCSRSS_DUPLICATE_HANDLE;
#define CONSOLE_HARDWARE_STATE_GET 0
#define CONSOLE_HARDWARE_STATE_SET 1
@ -509,204 +348,149 @@ typedef struct
HANDLE ConsoleHandle;
DWORD SetGet; /* 0=get; 1=set */
DWORD State;
} CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST, *PCSRSS_SETGET_CONSOLE_HW_STATE_REQUEST;
typedef struct
{
HANDLE ConsoleHandle;
DWORD SetGet; /* 0=get; 1=set */
DWORD State;
} CSRSS_SETGET_CONSOLE_HW_STATE_REPLY, *PCSRSS_SETGET_CONSOLE_HW_STATE_REPLY;
typedef struct
{
} CSRSS_GET_CONSOLE_WINDOW_REQUEST, *PCSRSS_GET_CONSOLE_WINDOW_REQUEST;
} CSRSS_SETGET_CONSOLE_HW_STATE, *PCSRSS_SETGET_CONSOLE_HW_STATE;
typedef struct
{
HWND WindowHandle;
} CSRSS_GET_CONSOLE_WINDOW_REPLY, *PCSRSS_GET_CONSOLE_WINDOW_REPLY;
} CSRSS_GET_CONSOLE_WINDOW, *PCSRSS_GET_CONSOLE_WINDOW;
typedef struct
{
HICON WindowIcon;
} CSRSS_SET_CONSOLE_ICON_REQUEST, *PCSRSS_SET_CONSOLE_ICON_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_ICON_REPLY, *PCSRSS_SET_CONSOLE_ICON_REPLY;
} CSRSS_SET_CONSOLE_ICON, *PCSRSS_SET_CONSOLE_ICON;
typedef struct
{
HDESK DesktopHandle;
} CSRSS_CREATE_DESKTOP_REQUEST, *PCSRSS_CREATE_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_CREATE_DESKTOP_REPLY, *PCSRSS_CREATE_DESKTOP_REPLY;
} CSRSS_CREATE_DESKTOP, *PCSRSS_CREATE_DESKTOP;
typedef struct
{
HWND DesktopWindow;
ULONG Width;
ULONG Height;
} CSRSS_SHOW_DESKTOP_REQUEST, *PCSRSS_SHOW_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_SHOW_DESKTOP_REPLY, *PCSRSS_SHOW_DESKTOP_REPLY;
} CSRSS_SHOW_DESKTOP, *PCSRSS_SHOW_DESKTOP;
typedef struct
{
HWND DesktopWindow;
} CSRSS_HIDE_DESKTOP_REQUEST, *PCSRSS_HIDE_DESKTOP_REQUEST;
typedef struct
{
} CSRSS_HIDE_DESKTOP_REPLY, *PCSRSS_HIDE_DESKTOP_REPLY;
} CSRSS_HIDE_DESKTOP, *PCSRSS_HIDE_DESKTOP;
typedef struct
{
HWND LogonNotifyWindow;
} CSRSS_SET_LOGON_NOTIFY_WINDOW_REQUEST, *PCSRSS_SET_LOGON_NOTIFY_WINDOW_REQUEST;
typedef struct
{
} CSRSS_SET_LOGON_NOTIFY_WINDOW_REPLY, *PCSRSS_SET_LOGON_NOTIFY_WINDOW_REPLY;
} CSRSS_SET_LOGON_NOTIFY_WINDOW, *PCSRSS_SET_LOGON_NOTIFY_WINDOW;
typedef struct
{
HANDLE ProcessId;
BOOL Register;
} CSRSS_REGISTER_LOGON_PROCESS_REQUEST, *PCSRSS_REGISTER_LOGON_PROCESS_REQUEST;
typedef struct
{
} CSRSS_REGISTER_LOGON_PROCESS_REPLY, *PCSRSS_REGISTER_LOGON_PROCESS_REPLY;
typedef struct
{
} CSRSS_GET_CONSOLE_CP_REQUEST, *PCSRSS_GET_CONSOLE_CP_REQUEST;
} CSRSS_REGISTER_LOGON_PROCESS, *PCSRSS_REGISTER_LOGON_PROCESS;
typedef struct
{
UINT CodePage;
} CSRSS_GET_CONSOLE_CP_REPLY, *PCSRSS_GET_CONSOLE_CP_REPLY;
} CSRSS_GET_CONSOLE_CP, *PCSRSS_GET_CONSOLE_CP;
typedef struct
{
UINT CodePage;
} CSRSS_SET_CONSOLE_CP_REQUEST, *PCSRSS_SET_CONSOLE_CP_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_CP_REPLY, *PCSRSS_SET_CONSOLE_CP_REPLY;
typedef struct
{
} CSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST, *PCSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST;
} CSRSS_SET_CONSOLE_CP, *PCSRSS_SET_CONSOLE_CP;
typedef struct
{
UINT CodePage;
} CSRSS_GET_CONSOLE_OUTPUT_CP_REPLY, *PCSRSS_GET_CONSOLE_OUTPUT_CP_REPLY;
} CSRSS_GET_CONSOLE_OUTPUT_CP, *PCSRSS_GET_CONSOLE_OUTPUT_CP;
typedef struct
{
UINT CodePage;
} CSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST, *PCSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_OUTPUT_CP_REPLY, *PCSRSS_SET_CONSOLE_OUTPUT_CP_REPLY;
typedef struct
{
} CSRSS_GET_INPUT_WAIT_HANDLE_REQUEST, *PCSRSS_GET_INPUT_WAIT_HANDLE_REQUEST;
} CSRSS_SET_CONSOLE_OUTPUT_CP, *PCSRSS_SET_CONSOLE_OUTPUT_CP;
typedef struct
{
HANDLE InputWaitHandle;
} CSRSS_GET_INPUT_WAIT_HANDLE_REPLY, *PCSRSS_GET_INPUT_WAIT_HANDLE_REPLY;
} CSRSS_GET_INPUT_WAIT_HANDLE, *PCSRSS_GET_INPUT_WAIT_HANDLE;
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
#define CSRSS_MAX_WRITE_CONSOLE \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE))
#define CSRSS_MAX_SET_TITLE_REQUEST (MAX_MESSAGE_DATA - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - LPC_MESSAGE_BASE_SIZE)
#define CSRSS_MAX_SET_TITLE (MAX_MESSAGE_DATA - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - LPC_MESSAGE_BASE_SIZE)
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST ))
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR ))
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ((MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST )) / 2)
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ((MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB )) / 2)
#define CSRSS_MAX_READ_CONSOLE_REQUEST (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE_REQUEST ))
#define CSRSS_MAX_READ_CONSOLE (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE ))
#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR_REQUEST))
#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR))
#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REQUEST))
#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB))
/* WCHARs, not bytes! */
#define CSRSS_MAX_TITLE_LENGTH 80
#define CSRSS_CREATE_PROCESS (0x0)
#define CSRSS_TERMINATE_PROCESS (0x1)
#define CSRSS_WRITE_CONSOLE (0x2)
#define CSRSS_READ_CONSOLE (0x3)
#define CSRSS_ALLOC_CONSOLE (0x4)
#define CSRSS_FREE_CONSOLE (0x5)
#define CSRSS_CONNECT_PROCESS (0x6)
#define CSRSS_SCREEN_BUFFER_INFO (0x7)
#define CSRSS_SET_CURSOR (0x8)
#define CSRSS_FILL_OUTPUT (0x9)
#define CSRSS_READ_INPUT (0xA)
#define CSRSS_WRITE_CONSOLE_OUTPUT_CHAR (0xB)
#define CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB (0xC)
#define CSRSS_FILL_OUTPUT_ATTRIB (0xD)
#define CSRSS_GET_CURSOR_INFO (0xE)
#define CSRSS_SET_CURSOR_INFO (0xF)
#define CSRSS_SET_ATTRIB (0x10)
#define CSRSS_GET_CONSOLE_MODE (0x11)
#define CSRSS_SET_CONSOLE_MODE (0x12)
#define CSRSS_CREATE_SCREEN_BUFFER (0x13)
#define CSRSS_SET_SCREEN_BUFFER (0x14)
#define CSRSS_SET_TITLE (0x15)
#define CSRSS_GET_TITLE (0x16)
#define CSRSS_WRITE_CONSOLE_OUTPUT (0x17)
#define CSRSS_FLUSH_INPUT_BUFFER (0x18)
#define CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER (0x19)
#define CSRSS_READ_CONSOLE_OUTPUT_CHAR (0x1A)
#define CSRSS_READ_CONSOLE_OUTPUT_ATTRIB (0x1B)
#define CSRSS_GET_NUM_INPUT_EVENTS (0x1C)
#define CSRSS_REGISTER_SERVICES_PROCESS (0x1D)
#define CSRSS_EXIT_REACTOS (0x1E)
#define CSRSS_GET_SHUTDOWN_PARAMETERS (0x1F)
#define CSRSS_SET_SHUTDOWN_PARAMETERS (0x20)
#define CSRSS_PEEK_CONSOLE_INPUT (0x21)
#define CSRSS_READ_CONSOLE_OUTPUT (0x22)
#define CSRSS_WRITE_CONSOLE_INPUT (0x23)
#define CSRSS_GET_INPUT_HANDLE (0x24)
#define CSRSS_GET_OUTPUT_HANDLE (0x25)
#define CSRSS_CLOSE_HANDLE (0x26)
#define CSRSS_VERIFY_HANDLE (0x27)
#define CSRSS_DUPLICATE_HANDLE (0x28)
#define CSRSS_SETGET_CONSOLE_HW_STATE (0x29)
#define CSRSS_GET_CONSOLE_WINDOW (0x2A)
#define CSRSS_CREATE_DESKTOP (0x2B)
#define CSRSS_SHOW_DESKTOP (0x2C)
#define CSRSS_HIDE_DESKTOP (0x2D)
#define CSRSS_SET_CONSOLE_ICON (0x2E)
#define CSRSS_SET_LOGON_NOTIFY_WINDOW (0x2F)
#define CSRSS_REGISTER_LOGON_PROCESS (0x30)
#define CSRSS_GET_CONSOLE_CP (0x31)
#define CSRSS_SET_CONSOLE_CP (0x32)
#define CSRSS_GET_CONSOLE_OUTPUT_CP (0x33)
#define CSRSS_SET_CONSOLE_OUTPUT_CP (0x34)
#define CSRSS_GET_INPUT_WAIT_HANDLE (0x35)
#define CSRSS_GET_PROCESS_LIST (0x36)
#define CREATE_PROCESS (0x0)
#define TERMINATE_PROCESS (0x1)
#define WRITE_CONSOLE (0x2)
#define READ_CONSOLE (0x3)
#define ALLOC_CONSOLE (0x4)
#define FREE_CONSOLE (0x5)
#define CONNECT_PROCESS (0x6)
#define SCREEN_BUFFER_INFO (0x7)
#define SET_CURSOR (0x8)
#define FILL_OUTPUT (0x9)
#define READ_INPUT (0xA)
#define WRITE_CONSOLE_OUTPUT_CHAR (0xB)
#define WRITE_CONSOLE_OUTPUT_ATTRIB (0xC)
#define FILL_OUTPUT_ATTRIB (0xD)
#define GET_CURSOR_INFO (0xE)
#define SET_CURSOR_INFO (0xF)
#define SET_ATTRIB (0x10)
#define GET_CONSOLE_MODE (0x11)
#define SET_CONSOLE_MODE (0x12)
#define CREATE_SCREEN_BUFFER (0x13)
#define SET_SCREEN_BUFFER (0x14)
#define SET_TITLE (0x15)
#define GET_TITLE (0x16)
#define WRITE_CONSOLE_OUTPUT (0x17)
#define FLUSH_INPUT_BUFFER (0x18)
#define SCROLL_CONSOLE_SCREEN_BUFFER (0x19)
#define READ_CONSOLE_OUTPUT_CHAR (0x1A)
#define READ_CONSOLE_OUTPUT_ATTRIB (0x1B)
#define GET_NUM_INPUT_EVENTS (0x1C)
#define REGISTER_SERVICES_PROCESS (0x1D)
#define EXIT_REACTOS (0x1E)
#define GET_SHUTDOWN_PARAMETERS (0x1F)
#define SET_SHUTDOWN_PARAMETERS (0x20)
#define PEEK_CONSOLE_INPUT (0x21)
#define READ_CONSOLE_OUTPUT (0x22)
#define WRITE_CONSOLE_INPUT (0x23)
#define GET_INPUT_HANDLE (0x24)
#define GET_OUTPUT_HANDLE (0x25)
#define CLOSE_HANDLE (0x26)
#define VERIFY_HANDLE (0x27)
#define DUPLICATE_HANDLE (0x28)
#define SETGET_CONSOLE_HW_STATE (0x29)
#define GET_CONSOLE_WINDOW (0x2A)
#define CREATE_DESKTOP (0x2B)
#define SHOW_DESKTOP (0x2C)
#define HIDE_DESKTOP (0x2D)
#define SET_CONSOLE_ICON (0x2E)
#define SET_LOGON_NOTIFY_WINDOW (0x2F)
#define REGISTER_LOGON_PROCESS (0x30)
#define GET_CONSOLE_CP (0x31)
#define SET_CONSOLE_CP (0x32)
#define GET_CONSOLE_OUTPUT_CP (0x33)
#define SET_CONSOLE_OUTPUT_CP (0x34)
#define GET_INPUT_WAIT_HANDLE (0x35)
#define GET_PROCESS_LIST (0x36)
/* Keep in sync with definition below. */
#define CSRSS_REQUEST_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG))
#define CSRSS_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG) + sizeof(NTSTATUS))
typedef struct
typedef struct _CSR_API_MESSAGE
{
union
{
@ -715,118 +499,65 @@ typedef struct
{
BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE];
ULONG Type;
union
{
CSRSS_CREATE_PROCESS_REQUEST CreateProcessRequest;
CSRSS_CONNECT_PROCESS_REQUEST ConnectRequest;
CSRSS_WRITE_CONSOLE_REQUEST WriteConsoleRequest;
CSRSS_READ_CONSOLE_REQUEST ReadConsoleRequest;
CSRSS_ALLOC_CONSOLE_REQUEST AllocConsoleRequest;
CSRSS_SCREEN_BUFFER_INFO_REQUEST ScreenBufferInfoRequest;
CSRSS_SET_CURSOR_REQUEST SetCursorRequest;
CSRSS_FILL_OUTPUT_REQUEST FillOutputRequest;
CSRSS_READ_INPUT_REQUEST ReadInputRequest;
CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REQUEST WriteConsoleOutputCharRequest;
CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REQUEST WriteConsoleOutputAttribRequest;
CSRSS_FILL_OUTPUT_ATTRIB_REQUEST FillOutputAttribRequest;
CSRSS_SET_CURSOR_INFO_REQUEST SetCursorInfoRequest;
CSRSS_GET_CURSOR_INFO_REQUEST GetCursorInfoRequest;
CSRSS_SET_ATTRIB_REQUEST SetAttribRequest;
CSRSS_SET_CONSOLE_MODE_REQUEST SetConsoleModeRequest;
CSRSS_GET_CONSOLE_MODE_REQUEST GetConsoleModeRequest;
CSRSS_CREATE_SCREEN_BUFFER_REQUEST CreateScreenBufferRequest;
CSRSS_SET_SCREEN_BUFFER_REQUEST SetScreenBufferRequest;
CSRSS_SET_TITLE_REQUEST SetTitleRequest;
CSRSS_GET_TITLE_REQUEST GetTitleRequest;
CSRSS_WRITE_CONSOLE_OUTPUT_REQUEST WriteConsoleOutputRequest;
CSRSS_FLUSH_INPUT_BUFFER_REQUEST FlushInputBufferRequest;
CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER_REQUEST ScrollConsoleScreenBufferRequest;
CSRSS_READ_CONSOLE_OUTPUT_CHAR_REQUEST ReadConsoleOutputCharRequest;
CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REQUEST ReadConsoleOutputAttribRequest;
CSRSS_GET_NUM_INPUT_EVENTS_REQUEST GetNumInputEventsRequest;
CSRSS_REGISTER_SERVICES_PROCESS_REQUEST RegisterServicesProcessRequest;
CSRSS_EXIT_REACTOS_REQUEST ExitReactosRequest;
CSRSS_SET_SHUTDOWN_PARAMETERS_REQUEST SetShutdownParametersRequest;
CSRSS_GET_SHUTDOWN_PARAMETERS_REQUEST GetShutdownParametersRequest;
CSRSS_PEEK_CONSOLE_INPUT_REQUEST PeekConsoleInputRequest;
CSRSS_READ_CONSOLE_OUTPUT_REQUEST ReadConsoleOutputRequest;
CSRSS_WRITE_CONSOLE_INPUT_REQUEST WriteConsoleInputRequest;
CSRSS_CLOSE_HANDLE_REQUEST CloseHandleRequest;
CSRSS_VERIFY_HANDLE_REQUEST VerifyHandleRequest;
CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest;
CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest;
CSRSS_GET_CONSOLE_WINDOW_REQUEST GetConsoleWindowRequest;
CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest;
CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest;
CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest;
CSRSS_SET_CONSOLE_ICON_REQUEST SetConsoleIconRequest;
CSRSS_SET_LOGON_NOTIFY_WINDOW_REQUEST SetLogonNotifyWindowRequest;
CSRSS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest;
CSRSS_GET_CONSOLE_CP_REQUEST GetConsoleCodePage;
CSRSS_SET_CONSOLE_CP_REQUEST SetConsoleCodePage;
CSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE_REQUEST GetConsoleInputWaitHandle;
CSRSS_GET_PROCESS_LIST_REQUEST GetProcessListRequest;
} Data;
};
};
} CSRSS_API_REQUEST, *PCSRSS_API_REQUEST;
typedef struct
{
union
{
LPC_MESSAGE Header;
struct
{
BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE];
NTSTATUS Status;
union
{
CSRSS_CREATE_PROCESS_REPLY CreateProcessReply;
CSRSS_CONNECT_PROCESS_REPLY ConnectReply;
CSRSS_FILL_OUTPUT_REPLY FillOutputReply;
CSRSS_WRITE_CONSOLE_REPLY WriteConsoleReply;
CSRSS_READ_CONSOLE_REPLY ReadConsoleReply;
CSRSS_ALLOC_CONSOLE_REPLY AllocConsoleReply;
CSRSS_SCREEN_BUFFER_INFO_REPLY ScreenBufferInfoReply;
CSRSS_READ_INPUT_REPLY ReadInputReply;
CSRSS_WRITE_CONSOLE_OUTPUT_CHAR_REPLY WriteConsoleOutputCharReply;
CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB_REPLY WriteConsoleOutputAttribReply;
CSRSS_GET_CURSOR_INFO_REPLY GetCursorInfoReply;
CSRSS_GET_CONSOLE_MODE_REPLY GetConsoleModeReply;
CSRSS_CREATE_SCREEN_BUFFER_REPLY CreateScreenBufferReply;
CSRSS_GET_TITLE_REPLY GetTitleReply;
CSRSS_WRITE_CONSOLE_OUTPUT_REPLY WriteConsoleOutputReply;
CSRSS_READ_CONSOLE_OUTPUT_CHAR_REPLY ReadConsoleOutputCharReply;
CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REPLY ReadConsoleOutputAttribReply;
CSRSS_GET_NUM_INPUT_EVENTS_REPLY GetNumInputEventsReply;
CSRSS_SET_SHUTDOWN_PARAMETERS_REPLY SetShutdownParametersReply;
CSRSS_GET_SHUTDOWN_PARAMETERS_REPLY GetShutdownParametersReply;
CSRSS_PEEK_CONSOLE_INPUT_REPLY PeekConsoleInputReply;
CSRSS_READ_CONSOLE_OUTPUT_REPLY ReadConsoleOutputReply;
CSRSS_WRITE_CONSOLE_INPUT_REPLY WriteConsoleInputReply;
CSRSS_GET_INPUT_HANDLE_REPLY GetInputHandleReply;
CSRSS_GET_OUTPUT_HANDLE_REPLY GetOutputHandleReply;
CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply;
CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply;
CSRSS_GET_CONSOLE_WINDOW_REPLY GetConsoleWindowReply;
CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply;
CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply;
CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply;
CSRSS_SET_CONSOLE_ICON_REPLY SetConsoleIconReply;
CSRSS_SET_LOGON_NOTIFY_WINDOW_REPLY SetLogonNotifyWindowReply;
CSRSS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply;
CSRSS_GET_CONSOLE_CP_REPLY GetConsoleCodePage;
CSRSS_SET_CONSOLE_CP_REPLY SetConsoleCodePage;
CSRSS_GET_CONSOLE_OUTPUT_CP_REPLY GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REPLY SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE_REPLY GetConsoleInputWaitHandle;
CSRSS_GET_PROCESS_LIST_REPLY GetProcessListReply;
CSRSS_CREATE_PROCESS CreateProcessRequest;
CSRSS_CONNECT_PROCESS ConnectRequest;
CSRSS_WRITE_CONSOLE WriteConsoleRequest;
CSRSS_READ_CONSOLE ReadConsoleRequest;
CSRSS_ALLOC_CONSOLE AllocConsoleRequest;
CSRSS_SCREEN_BUFFER_INFO ScreenBufferInfoRequest;
CSRSS_SET_CURSOR SetCursorRequest;
CSRSS_FILL_OUTPUT FillOutputRequest;
CSRSS_READ_INPUT ReadInputRequest;
CSRSS_WRITE_CONSOLE_OUTPUT_CHAR WriteConsoleOutputCharRequest;
CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB WriteConsoleOutputAttribRequest;
CSRSS_FILL_OUTPUT_ATTRIB FillOutputAttribRequest;
CSRSS_SET_CURSOR_INFO SetCursorInfoRequest;
CSRSS_GET_CURSOR_INFO GetCursorInfoRequest;
CSRSS_SET_ATTRIB SetAttribRequest;
CSRSS_SET_CONSOLE_MODE SetConsoleModeRequest;
CSRSS_GET_CONSOLE_MODE GetConsoleModeRequest;
CSRSS_CREATE_SCREEN_BUFFER CreateScreenBufferRequest;
CSRSS_SET_SCREEN_BUFFER SetScreenBufferRequest;
CSRSS_SET_TITLE SetTitleRequest;
CSRSS_GET_TITLE GetTitleRequest;
CSRSS_WRITE_CONSOLE_OUTPUT WriteConsoleOutputRequest;
CSRSS_FLUSH_INPUT_BUFFER FlushInputBufferRequest;
CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER ScrollConsoleScreenBufferRequest;
CSRSS_READ_CONSOLE_OUTPUT_CHAR ReadConsoleOutputCharRequest;
CSRSS_READ_CONSOLE_OUTPUT_ATTRIB ReadConsoleOutputAttribRequest;
CSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest;
CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
CSRSS_EXIT_REACTOS ExitReactosRequest;
CSRSS_SET_SHUTDOWN_PARAMETERS SetShutdownParametersRequest;
CSRSS_GET_SHUTDOWN_PARAMETERS GetShutdownParametersRequest;
CSRSS_PEEK_CONSOLE_INPUT PeekConsoleInputRequest;
CSRSS_READ_CONSOLE_OUTPUT ReadConsoleOutputRequest;
CSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest;
CSRSS_GET_INPUT_HANDLE GetInputHandleRequest;
CSRSS_GET_OUTPUT_HANDLE GetOutputHandleRequest;
CSRSS_CLOSE_HANDLE CloseHandleRequest;
CSRSS_VERIFY_HANDLE VerifyHandleRequest;
CSRSS_DUPLICATE_HANDLE DuplicateHandleRequest;
CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest;
CSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest;
CSRSS_CREATE_DESKTOP CreateDesktopRequest;
CSRSS_SHOW_DESKTOP ShowDesktopRequest;
CSRSS_HIDE_DESKTOP HideDesktopRequest;
CSRSS_SET_CONSOLE_ICON SetConsoleIconRequest;
CSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest;
CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest;
CSRSS_GET_CONSOLE_CP GetConsoleCodePage;
CSRSS_SET_CONSOLE_CP SetConsoleCodePage;
CSRSS_GET_CONSOLE_OUTPUT_CP GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle;
CSRSS_GET_PROCESS_LIST GetProcessListRequest;
} Data;
};
};
} CSRSS_API_REPLY, *PCSRSS_API_REPLY;
} CSR_API_MESSAGE, *PCSR_API_MESSAGE;
#endif /* __INCLUDE_CSRSS_CSRSS_H */

View file

@ -34,9 +34,7 @@
#else
/* User-Mode NDK */
#include "umtypes.h" /* Native Types in DDK/IFS but not in PSDK */
#ifdef READY_FOR_NEW_NTDLL /* This hack will be removed in the next commit */
#include "umfuncs.h" /* User-Mode NT Library Functions */
#endif
#endif
/* Shared NDK */

View file

@ -187,7 +187,6 @@ typedef struct _RTL_HANDLE_TABLE
PRTL_HANDLE FirstFree; /* pointer to first free handle */
PRTL_HANDLE LastUsed; /* pointer to last allocated handle */
} RTL_HANDLE_TABLE, *PRTL_HANDLE_TABLE;
#ifdef READY_FOR_NEW_NTDLL
typedef struct _LOCK_INFORMATION
{
ULONG LockCount;
@ -204,7 +203,6 @@ typedef struct _MODULE_INFORMATION
DEBUG_MODULE_INFORMATION ModuleEntry[1];
} MODULE_INFORMATION, *PMODULE_INFORMATION;
/* END REVIEW AREA */
#endif
typedef struct _EXCEPTION_REGISTRATION
{

View file

@ -11,24 +11,30 @@
#include "ldrtypes.h"
#include "lpctypes.h"
#include "rtltypes.h"
#include <csrss/csrss.h> /* FIXME: Temporary */
/* PROTOTYPES ****************************************************************/
/*
* CSR Functions
*/
NTSTATUS
STDCALL
CsrClientConnectToServer(VOID);
NTSTATUS
STDCALL
CsrClientConnectToServer(
PWSTR ObjectDirectory,
ULONG ServerId,
PVOID Unknown,
PVOID Context,
ULONG ContextLength,
PULONG Unknown2
);
NTSTATUS
STDCALL
STDCALL
CsrClientCallServer(
PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply OPTIONAL,
ULONG Length,
ULONG ReplyLength
struct _CSR_API_MESSAGE *Request,
PVOID CapturedBuffer OPTIONAL,
ULONG ApiNumber,
ULONG RequestLength
);
NTSTATUS

View file

@ -564,6 +564,7 @@ typedef struct _PEB *PPEB;
typedef ULONG KPROCESSOR_MODE;
typedef struct _OBJECT_TYPE *POBJECT_TYPE;
struct _ETHREAD;
struct _CSR_API_MESSAGE;
struct _EVENT_TRACE_HEADER; /* <--- We might want to declare this one */
typedef ULONG EXECUTION_STATE;

View file

@ -45,7 +45,7 @@
#include "ntos/zw.h"
#include "ntos/dbgfuncs.h"
#include "ntos/service.h"
#include "ntdll/csr.h"
//#include "ntdll/csr.h"
#include "ntdll/dbg.h"
#include "ntdll/ldr.h"
#include "ntdll/rtl.h"

View file

@ -71,8 +71,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName,
HANDLE FileHandle;
NTSTATUS Status;
ULONG FileAttributes, Flags = 0;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
PVOID EaBuffer = NULL;
ULONG EaLength = 0;
@ -177,19 +176,18 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName,
if (0 == _wcsicmp(L"CONOUT$", lpFileName))
{
/* FIXME: Send required access rights to Csrss */
Request.Type = CSRSS_GET_OUTPUT_HANDLE;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
NULL,
MAKE_CSR_API(GET_OUTPUT_HANDLE, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
{
SetLastErrorByStatus(Status);
return INVALID_HANDLE_VALUE;
}
else
{
return Reply.Data.GetOutputHandleReply.OutputHandle;
return Request.Data.GetOutputHandleRequest.OutputHandle;
}
}
@ -197,19 +195,18 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName,
if (0 == _wcsicmp(L"CONIN$", lpFileName))
{
/* FIXME: Send required access rights to Csrss */
Request.Type = CSRSS_GET_INPUT_HANDLE;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
NULL,
MAKE_CSR_API(GET_INPUT_HANDLE, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
{
SetLastErrorByStatus(Status);
return INVALID_HANDLE_VALUE;
}
else
{
return Reply.Data.GetInputHandleReply.InputHandle;
return Request.Data.GetInputHandleRequest.InputHandle;
}
}

View file

@ -11,9 +11,11 @@
/* PSDK/NDK Headers */
#include <windows.h>
#define NTOS_MODE_USER
#define READY_FOR_NEW_NTDLL
#include <ndk/ntndk.h>
/* CSRSS Header */
#include <csrss/csrss.h>
/* C Headers */
#include <wchar.h>

File diff suppressed because it is too large Load diff

View file

@ -98,7 +98,12 @@ DllMain(HANDLE hDll,
/*
* Connect to the csrss server
*/
Status = CsrClientConnectToServer();
Status = CsrClientConnectToServer(NULL,
0,
NULL,
NULL,
0,
NULL);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to connect to csrss.exe (Status %lx)\n",

View file

@ -740,8 +740,8 @@ CreateProcessW(LPCWSTR lpApplicationName,
ULONG retlen;
PRTL_USER_PROCESS_PARAMETERS Ppb;
UNICODE_STRING CommandLine_U;
CSRSS_API_REQUEST CsrRequest;
CSRSS_API_REPLY CsrReply;
CSR_API_MESSAGE CsrRequest;
ULONG Request;
PWCHAR s, e;
ULONG i;
UNICODE_STRING CurrentDirectory_U;
@ -1156,7 +1156,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
/*
* Tell the csrss server we are creating a new process
*/
CsrRequest.Type = CSRSS_CREATE_PROCESS;
Request = CREATE_PROCESS;
CsrRequest.Data.CreateProcessRequest.NewProcessId =
(HANDLE)ProcessBasicInfo.UniqueProcessId;
if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
@ -1175,15 +1175,15 @@ CreateProcessW(LPCWSTR lpApplicationName,
CsrRequest.Data.CreateProcessRequest.Flags = dwCreationFlags;
CsrRequest.Data.CreateProcessRequest.CtrlDispatcher = ConsoleControlDispatcher;
Status = CsrClientCallServer(&CsrRequest,
&CsrReply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
NULL,
MAKE_CSR_API(Request, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
{
DbgPrint("Failed to tell csrss about new process. Expect trouble.\n");
}
Ppb->hConsole = CsrReply.Data.CreateProcessReply.Console;
Ppb->hConsole = CsrRequest.Data.CreateProcessRequest.Console;
InputSet = FALSE;
OutputSet = FALSE;
@ -1217,23 +1217,23 @@ CreateProcessW(LPCWSTR lpApplicationName,
/* Check if new console was created, use it for input and output if
not overridden */
if (0 != (dwCreationFlags & CREATE_NEW_CONSOLE)
&& NT_SUCCESS(Status) && NT_SUCCESS(CsrReply.Status))
&& NT_SUCCESS(Status) && NT_SUCCESS(CsrRequest.Status))
{
if (! InputSet)
{
Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
Ppb->hStdInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
InputSet = TRUE;
InputDup = FALSE;
}
if (! OutputSet)
{
Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
OutputSet = TRUE;
OutputDup = FALSE;
}
if (! ErrorSet)
{
Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdError = CsrRequest.Data.CreateProcessRequest.OutputHandle;
ErrorSet = TRUE;
ErrorDup = FALSE;
}
@ -1261,7 +1261,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
{
if (IsConsoleHandle(Ppb->hStdInput))
{
Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
Ppb->hStdInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
}
else
{
@ -1284,7 +1284,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
{
if (IsConsoleHandle(Ppb->hStdOutput))
{
Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
}
else
{
@ -1307,20 +1307,20 @@ CreateProcessW(LPCWSTR lpApplicationName,
{
if (IsConsoleHandle(Ppb->hStdError))
{
CsrRequest.Type = CSRSS_DUPLICATE_HANDLE;
Request = DUPLICATE_HANDLE;
CsrRequest.Data.DuplicateHandleRequest.ProcessId = (HANDLE)ProcessBasicInfo.UniqueProcessId;
CsrRequest.Data.DuplicateHandleRequest.Handle = CsrReply.Data.CreateProcessReply.OutputHandle;
CsrRequest.Data.DuplicateHandleRequest.Handle = CsrRequest.Data.CreateProcessRequest.OutputHandle;
Status = CsrClientCallServer(&CsrRequest,
&CsrReply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
NULL,
MAKE_CSR_API(Request, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
{
Ppb->hStdError = INVALID_HANDLE_VALUE;
}
else
{
Ppb->hStdError = CsrReply.Data.DuplicateHandleReply.Handle;
Ppb->hStdError = CsrRequest.Data.DuplicateHandleRequest.Handle;
}
}
else

View file

@ -98,23 +98,23 @@ BOOL STDCALL
GetProcessShutdownParameters (LPDWORD lpdwLevel,
LPDWORD lpdwFlags)
{
CSRSS_API_REQUEST CsrRequest;
CSRSS_API_REPLY CsrReply;
CSR_API_MESSAGE CsrRequest;
ULONG Request;
NTSTATUS Status;
CsrRequest.Type = CSRSS_GET_SHUTDOWN_PARAMETERS;
Request = GET_SHUTDOWN_PARAMETERS;
Status = CsrClientCallServer(&CsrRequest,
&CsrReply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
NULL,
MAKE_CSR_API(Request, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
{
SetLastErrorByStatus (Status);
return(FALSE);
}
*lpdwLevel = CsrReply.Data.GetShutdownParametersReply.Level;
*lpdwFlags = CsrReply.Data.GetShutdownParametersReply.Flags;
*lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level;
*lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags;
return(TRUE);
}
@ -127,19 +127,19 @@ BOOL STDCALL
SetProcessShutdownParameters (DWORD dwLevel,
DWORD dwFlags)
{
CSRSS_API_REQUEST CsrRequest;
CSRSS_API_REPLY CsrReply;
CSR_API_MESSAGE CsrRequest;
ULONG Request;
NTSTATUS Status;
CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel;
CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags;
CsrRequest.Type = CSRSS_SET_SHUTDOWN_PARAMETERS;
Request = SET_SHUTDOWN_PARAMETERS;
Status = CsrClientCallServer(&CsrRequest,
&CsrReply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
NULL,
MAKE_CSR_API(Request, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
{
SetLastErrorByStatus (Status);
return(FALSE);
@ -571,20 +571,20 @@ FlushInstructionCache (HANDLE hProcess,
VOID STDCALL
ExitProcess(UINT uExitCode)
{
CSRSS_API_REQUEST CsrRequest;
CSRSS_API_REPLY CsrReply;
CSR_API_MESSAGE CsrRequest;
ULONG Request;
NTSTATUS Status;
/* unload all dll's */
LdrShutdownProcess ();
/* notify csrss of process termination */
CsrRequest.Type = CSRSS_TERMINATE_PROCESS;
Request = TERMINATE_PROCESS;
Status = CsrClientCallServer(&CsrRequest,
&CsrReply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
NULL,
MAKE_CSR_API(Request, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
{
DPRINT("Failed to tell csrss about terminating process\n");
}

View file

@ -28,29 +28,7 @@ static HANDLE CsrCommHeap = NULL;
/* FUNCTIONS *****************************************************************/
/* Possible CsrClientCallServer (the NT one):
#define CSR_CCS_NATIVE 0x0000
#define CSR_CCS_CSR 0x0001
#define CSR_CCS_GUI 0x0002
typedef union _CSR_CCS_API
{
WORD Index; // CSRSS API number
WORD Subsystem; // 0=NTDLL;1=KERNEL32;2=KERNEL32
} CSR_CCS_API, * PCSR_CCS_API;
NTSTATUS STDCALL
CsrClientCallServer(PVOID Request,
PVOID Unknown OPTIONAL,
CSR_CCS_API CsrApi,
ULONG SizeOfData);
Request is the family of PCSRSS_XXX_REQUEST objects.
XXX_REQUEST depend on the CsrApiNumber.Index.
*/
/* Possible CsrClientCallServer (the NT one): */
NTSTATUS STDCALL
CsrCaptureParameterBuffer(PVOID ParameterBuffer,
@ -84,41 +62,57 @@ CsrReleaseParameterBuffer(PVOID ClientAddress)
/*
* @implemented
*/
NTSTATUS STDCALL
CsrClientCallServer(PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply OPTIONAL,
ULONG Length,
ULONG ReplyLength)
NTSTATUS
STDCALL
CsrClientCallServer(PCSR_API_MESSAGE Request,
PVOID CapturedBuffer OPTIONAL,
CSR_API_NUMBER ApiNumber,
ULONG RequestLength)
{
NTSTATUS Status;
if (INVALID_HANDLE_VALUE == WindowsApiPort)
NTSTATUS Status;
DPRINT("CSR: CsrClientCallServer!\n");
/* Make sure it's valid */
if (INVALID_HANDLE_VALUE == WindowsApiPort)
{
DbgPrint ("NTDLL.%s: client not connected to CSRSS!\n", __FUNCTION__);
return (STATUS_UNSUCCESSFUL);
DPRINT1("NTDLL.%s: client not connected to CSRSS!\n", __FUNCTION__);
return (STATUS_UNSUCCESSFUL);
}
Request->Header.DataSize = Length - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = Length;
Status = NtRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
(Reply?&Reply->Header:&Request->Header));
return(Status);
/* Fill out the header */
Request->Type = ApiNumber;
Request->Header.DataSize = RequestLength - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = RequestLength;
DPRINT("CSR: API: %x, DataSize: %x, MessageSize: %x\n",
ApiNumber,
Request->Header.DataSize,
Request->Header.MessageSize);
/* Send the LPC Message */
Status = NtRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
&Request->Header);
DPRINT("Got back: %x\n", Status);
return(Status);
}
/*
* @implemented
*/
NTSTATUS STDCALL
CsrClientConnectToServer(VOID)
NTSTATUS
STDCALL
CsrClientConnectToServer(PWSTR ObjectDirectory,
ULONG ServerId,
PVOID Unknown,
PVOID Context,
ULONG ContextLength,
PULONG Unknown2)
{
NTSTATUS Status;
UNICODE_STRING PortName = RTL_CONSTANT_STRING(L"\\Windows\\ApiPort");
ULONG ConnectInfoLength;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
LPC_SECTION_WRITE LpcWrite;
HANDLE CsrSectionHandle;
LARGE_INTEGER CsrSectionViewSize;
@ -175,18 +169,17 @@ CsrClientConnectToServer(VOID)
return(STATUS_NO_MEMORY);
}
Request.Type = CSRSS_CONNECT_PROCESS;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
NULL,
MAKE_CSR_API(CONNECT_PROCESS, CSR_NATIVE),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status))
{
return(Status);
}
if (!NT_SUCCESS(Reply.Status))
if (!NT_SUCCESS(Request.Status))
{
return(Reply.Status);
return(Request.Status);
}
return(STATUS_SUCCESS);
}

View file

@ -14,7 +14,7 @@ CsrCaptureMessageBuffer@16
CsrCaptureMessageString@20
CsrCaptureTimeout@8
CsrClientCallServer@16
CsrClientConnectToServer@0
CsrClientConnectToServer@24
CsrFreeCaptureBuffer@4
CsrIdentifyAlertableThread@0
CsrNewThread@0

View file

@ -11,7 +11,6 @@
/* SDK/DDK/NDK Headers. */
#include <windows.h>
#define NTOS_MODE_USER
#define READY_FOR_NEW_NTDLL
#include <ndk/ntndk.h>
/* Internal NTDLL */

View file

@ -17,6 +17,9 @@
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
/* CSRSS Headers */
#include <csrss/csrss.h>
/* External Win32K Headers */
#include <win32k/ntuser.h>
#include <win32k/caret.h>

View file

@ -8,7 +8,6 @@
*/
#include <user32.h>
#include <ntdll/csr.h>
/*
* Sequence of events:
@ -71,19 +70,19 @@ BOOL STDCALL
ExitWindowsEx(UINT uFlags,
DWORD dwReserved)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
ULONG CsrRequest;
NTSTATUS Status;
Request.Type = CSRSS_EXIT_REACTOS;
CsrRequest = MAKE_CSR_API(EXIT_REACTOS, CSR_GUI);
Request.Data.ExitReactosRequest.Flags = uFlags;
Request.Data.ExitReactosRequest.Reserved = dwReserved;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
NULL,
CsrRequest,
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return(FALSE);
@ -99,18 +98,18 @@ ExitWindowsEx(UINT uFlags,
BOOL STDCALL
RegisterServicesProcess(DWORD ServicesProcessId)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
ULONG CsrRequest;
NTSTATUS Status;
Request.Type = CSRSS_REGISTER_SERVICES_PROCESS;
CsrRequest = MAKE_CSR_API(REGISTER_SERVICES_PROCESS, CSR_GUI);
Request.Data.RegisterServicesProcessRequest.ProcessId = (HANDLE)ServicesProcessId;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
NULL,
CsrRequest,
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return(FALSE);

View file

@ -29,7 +29,6 @@
/* INCLUDES ******************************************************************/
#include <user32.h>
#include <ntdll/csr.h>
/* FUNCTIONS *****************************************************************/
@ -84,18 +83,18 @@ STDCALL
SetLogonNotifyWindow (HWND Wnd, HWINSTA WinSta)
{
/* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
ULONG CsrRequest;
NTSTATUS Status;
Request.Type = CSRSS_SET_LOGON_NOTIFY_WINDOW;
CsrRequest = MAKE_CSR_API(SET_LOGON_NOTIFY_WINDOW, CSR_GUI);
Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
NULL,
CsrRequest,
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return(FALSE);

View file

@ -198,16 +198,15 @@ CSR_API(CsrCreateProcess)
{
PCSRSS_PROCESS_DATA NewProcessData;
NTSTATUS Status;
CSRSS_API_REQUEST ApiRequest;
CSRSS_API_REPLY ApiReply;
CSR_API_MESSAGE ApiRequest;
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
NewProcessData = CsrCreateProcessData(Request->Data.CreateProcessRequest.NewProcessId);
if (NewProcessData == NULL)
{
Reply->Status = STATUS_NO_MEMORY;
Request->Status = STATUS_NO_MEMORY;
return(STATUS_NO_MEMORY);
}
@ -221,35 +220,32 @@ CSR_API(CsrCreateProcess)
}
else if (Request->Data.CreateProcessRequest.Flags & CREATE_NEW_CONSOLE)
{
ApiRequest.Type = CSRSS_ALLOC_CONSOLE;
ApiRequest.Header.DataSize = sizeof(CSRSS_ALLOC_CONSOLE_REQUEST);
ApiRequest.Header.MessageSize = LPC_MESSAGE_BASE_SIZE + sizeof(CSRSS_ALLOC_CONSOLE_REQUEST);
ApiRequest.Type = ALLOC_CONSOLE;
ApiRequest.Header.DataSize = sizeof(CSRSS_ALLOC_CONSOLE);
ApiRequest.Header.MessageSize = LPC_MESSAGE_BASE_SIZE + sizeof(CSRSS_ALLOC_CONSOLE);
ApiRequest.Data.AllocConsoleRequest.CtrlDispatcher = Request->Data.CreateProcessRequest.CtrlDispatcher;
ApiReply.Header.DataSize = sizeof(CSRSS_ALLOC_CONSOLE_REPLY);
ApiReply.Header.MessageSize = LPC_MESSAGE_BASE_SIZE + sizeof(CSRSS_ALLOC_CONSOLE_REPLY);
CsrApiCallHandler(NewProcessData, &ApiRequest);
CsrApiCallHandler(NewProcessData, &ApiRequest, &ApiReply);
Reply->Status = ApiReply.Status;
if (! NT_SUCCESS(Reply->Status))
Request->Status = ApiRequest.Status;
if (! NT_SUCCESS(Request->Status))
{
CsrFreeProcessData(Request->Data.CreateProcessRequest.NewProcessId);
return Reply->Status;
return Request->Status;
}
Reply->Data.CreateProcessReply.InputHandle = ApiReply.Data.AllocConsoleReply.InputHandle;
Reply->Data.CreateProcessReply.OutputHandle = ApiReply.Data.AllocConsoleReply.OutputHandle;
Request->Data.CreateProcessRequest.InputHandle = ApiRequest.Data.AllocConsoleRequest.InputHandle;
Request->Data.CreateProcessRequest.OutputHandle = ApiRequest.Data.AllocConsoleRequest.OutputHandle;
}
else
{
NewProcessData->Console = ProcessData->Console;
InterlockedIncrement( &(ProcessData->Console->Header.ReferenceCount) );
CsrInsertObject(NewProcessData,
&Reply->Data.CreateProcessReply.InputHandle,
&Request->Data.CreateProcessRequest.InputHandle,
(Object_t *)NewProcessData->Console);
RtlEnterCriticalSection(&ProcessDataLock );
CsrInsertObject( NewProcessData,
&Reply->Data.CreateProcessReply.OutputHandle,
&Request->Data.CreateProcessRequest.OutputHandle,
&(NewProcessData->Console->ActiveBuffer->Header) );
RtlLeaveCriticalSection(&ProcessDataLock);
@ -258,7 +254,7 @@ CSR_API(CsrCreateProcess)
{
DbgPrint( "CSR: NtDuplicateObject() failed: %x\n", Status );
CsrFreeProcessData( NewProcessData->ProcessId );
Reply->Status = Status;
Request->Status = Status;
return Status;
}
NewProcessData->CtrlDispatcher = Request->Data.CreateProcessRequest.CtrlDispatcher;
@ -267,193 +263,193 @@ CSR_API(CsrCreateProcess)
RtlLeaveCriticalSection(&ProcessDataLock);
}
Reply->Data.CreateProcessReply.Console = NewProcessData->Console;
Request->Data.CreateProcessRequest.Console = NewProcessData->Console;
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return(STATUS_SUCCESS);
}
CSR_API(CsrTerminateProcess)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY);
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Request->Header.DataSize = sizeof(CSR_API_MESSAGE);
if (ProcessData == NULL)
{
return(Reply->Status = STATUS_INVALID_PARAMETER);
return(Request->Status = STATUS_INVALID_PARAMETER);
}
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return STATUS_SUCCESS;
}
CSR_API(CsrConnectProcess)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return(STATUS_SUCCESS);
}
CSR_API(CsrGetShutdownParameters)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
return(Reply->Status = STATUS_INVALID_PARAMETER);
return(Request->Status = STATUS_INVALID_PARAMETER);
}
Reply->Data.GetShutdownParametersReply.Level = ProcessData->ShutdownLevel;
Reply->Data.GetShutdownParametersReply.Flags = ProcessData->ShutdownFlags;
Request->Data.GetShutdownParametersRequest.Level = ProcessData->ShutdownLevel;
Request->Data.GetShutdownParametersRequest.Flags = ProcessData->ShutdownFlags;
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return(STATUS_SUCCESS);
}
CSR_API(CsrSetShutdownParameters)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
return(Reply->Status = STATUS_INVALID_PARAMETER);
return(Request->Status = STATUS_INVALID_PARAMETER);
}
ProcessData->ShutdownLevel = Request->Data.SetShutdownParametersRequest.Level;
ProcessData->ShutdownFlags = Request->Data.SetShutdownParametersRequest.Flags;
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return(STATUS_SUCCESS);
}
CSR_API(CsrGetInputHandle)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
Reply->Data.GetInputHandleReply.InputHandle = INVALID_HANDLE_VALUE;
Reply->Status = STATUS_INVALID_PARAMETER;
Request->Data.GetInputHandleRequest.InputHandle = INVALID_HANDLE_VALUE;
Request->Status = STATUS_INVALID_PARAMETER;
}
else if (ProcessData->Console)
{
Reply->Status = CsrInsertObject(ProcessData,
&Reply->Data.GetInputHandleReply.InputHandle,
Request->Status = CsrInsertObject(ProcessData,
&Request->Data.GetInputHandleRequest.InputHandle,
(Object_t *)ProcessData->Console);
}
else
{
Reply->Data.GetInputHandleReply.InputHandle = INVALID_HANDLE_VALUE;
Reply->Status = STATUS_SUCCESS;
Request->Data.GetInputHandleRequest.InputHandle = INVALID_HANDLE_VALUE;
Request->Status = STATUS_SUCCESS;
}
return Reply->Status;
return Request->Status;
}
CSR_API(CsrGetOutputHandle)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
Reply->Data.GetOutputHandleReply.OutputHandle = INVALID_HANDLE_VALUE;
Reply->Status = STATUS_INVALID_PARAMETER;
Request->Data.GetOutputHandleRequest.OutputHandle = INVALID_HANDLE_VALUE;
Request->Status = STATUS_INVALID_PARAMETER;
}
else if (ProcessData->Console)
{
RtlEnterCriticalSection(&ProcessDataLock);
Reply->Status = CsrInsertObject(ProcessData,
&Reply->Data.GetOutputHandleReply.OutputHandle,
Request->Status = CsrInsertObject(ProcessData,
&Request->Data.GetOutputHandleRequest.OutputHandle,
&(ProcessData->Console->ActiveBuffer->Header));
RtlLeaveCriticalSection(&ProcessDataLock);
}
else
{
Reply->Data.GetOutputHandleReply.OutputHandle = INVALID_HANDLE_VALUE;
Reply->Status = STATUS_SUCCESS;
Request->Data.GetOutputHandleRequest.OutputHandle = INVALID_HANDLE_VALUE;
Request->Status = STATUS_SUCCESS;
}
return Reply->Status;
return Request->Status;
}
CSR_API(CsrCloseHandle)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
Reply->Status = STATUS_INVALID_PARAMETER;
Request->Status = STATUS_INVALID_PARAMETER;
}
else
{
Reply->Status = CsrReleaseObject(ProcessData, Request->Data.CloseHandleRequest.Handle);
Request->Status = CsrReleaseObject(ProcessData, Request->Data.CloseHandleRequest.Handle);
}
return Reply->Status;
return Request->Status;
}
CSR_API(CsrVerifyHandle)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Reply->Status = CsrVerifyObject(ProcessData, Request->Data.VerifyHandleRequest.Handle);
if (!NT_SUCCESS(Reply->Status))
Request->Status = CsrVerifyObject(ProcessData, Request->Data.VerifyHandleRequest.Handle);
if (!NT_SUCCESS(Request->Status))
{
DPRINT("CsrVerifyObject failed, status=%x\n", Reply->Status);
DPRINT("CsrVerifyObject failed, status=%x\n", Request->Status);
}
return Reply->Status;
return Request->Status;
}
CSR_API(CsrDuplicateHandle)
{
Object_t *Object;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
ProcessData = CsrGetProcessData(Request->Data.DuplicateHandleRequest.ProcessId);
Reply->Status = CsrGetObject(ProcessData, Request->Data.DuplicateHandleRequest.Handle, &Object);
if (! NT_SUCCESS(Reply->Status))
Request->Status = CsrGetObject(ProcessData, Request->Data.DuplicateHandleRequest.Handle, &Object);
if (! NT_SUCCESS(Request->Status))
{
DPRINT("CsrGetObject failed, status=%x\n", Reply->Status);
DPRINT("CsrGetObject failed, status=%x\n", Request->Status);
}
else
{
Reply->Status = CsrInsertObject(ProcessData,
&Reply->Data.DuplicateHandleReply.Handle,
Request->Status = CsrInsertObject(ProcessData,
&Request->Data.DuplicateHandleRequest.Handle,
Object);
}
return Reply->Status;
return Request->Status;
}
CSR_API(CsrGetInputWaitHandle)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ProcessData == NULL)
{
Reply->Data.GetConsoleInputWaitHandle.InputWaitHandle = INVALID_HANDLE_VALUE;
Reply->Status = STATUS_INVALID_PARAMETER;
Request->Data.GetConsoleInputWaitHandle.InputWaitHandle = INVALID_HANDLE_VALUE;
Request->Status = STATUS_INVALID_PARAMETER;
}
else
{
Reply->Data.GetConsoleInputWaitHandle.InputWaitHandle = ProcessData->ConsoleEvent;
Reply->Status = STATUS_SUCCESS;
Request->Data.GetConsoleInputWaitHandle.InputWaitHandle = ProcessData->ConsoleEvent;
Request->Status = STATUS_SUCCESS;
}
return Reply->Status;
return Request->Status;
}
/* EOF */

View file

@ -31,8 +31,8 @@ CSR_API(CsrRegisterServicesProcess)
{
NTSTATUS Status;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (ServicesProcessIdValid == TRUE)
{
@ -46,7 +46,7 @@ CSR_API(CsrRegisterServicesProcess)
Status = STATUS_SUCCESS;
}
Reply->Status = Status;
Request->Status = Status;
return(Status);
}

View file

@ -66,29 +66,34 @@ CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions)
return STATUS_SUCCESS;
}
VOID FASTCALL
VOID
FASTCALL
CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply)
PCSR_API_MESSAGE Request)
{
BOOL Found;
BOOL Found = FALSE;
unsigned DefIndex;
ULONG Type;
DPRINT("CSR: Calling handler for type: %x.\n", Request->Type);
Type = Request->Type & 0xFFFF; /* FIXME: USE MACRO */
DPRINT("CSR: API Number: %x ServerID: %x\n",Type, Request->Type >> 16);
Found = FALSE;
/* FIXME: Extract DefIndex instead of looping */
for (DefIndex = 0; ! Found && DefIndex < ApiDefinitionsCount; DefIndex++)
{
if (ApiDefinitions[DefIndex].Type == Request->Type)
if (ApiDefinitions[DefIndex].Type == Type)
{
if (Request->Header.DataSize < ApiDefinitions[DefIndex].MinRequestSize)
{
DPRINT1("Request type %d min request size %d actual %d\n",
Request->Type, ApiDefinitions[DefIndex].MinRequestSize,
Type, ApiDefinitions[DefIndex].MinRequestSize,
Request->Header.DataSize);
Reply->Status = STATUS_INVALID_PARAMETER;
Request->Status = STATUS_INVALID_PARAMETER;
}
else
{
(ApiDefinitions[DefIndex].Handler)(ProcessData, Request, Reply);
(ApiDefinitions[DefIndex].Handler)(ProcessData, Request);
Found = TRUE;
}
}
@ -96,60 +101,75 @@ CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
if (! Found)
{
DPRINT1("CSR: Unknown request type 0x%x\n", Request->Type);
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Status = STATUS_INVALID_SYSTEM_SERVICE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Request->Status = STATUS_INVALID_SYSTEM_SERVICE;
}
}
static void STDCALL
STATIC
VOID
STDCALL
ClientConnectionThread(HANDLE ServerPort)
{
NTSTATUS Status;
LPC_MAX_MESSAGE LpcReply;
LPC_MAX_MESSAGE LpcRequest;
PCSRSS_API_REQUEST Request;
PCSRSS_PROCESS_DATA ProcessData;
PCSRSS_API_REPLY Reply;
NTSTATUS Status;
LPC_MAX_MESSAGE LpcReply;
LPC_MAX_MESSAGE LpcRequest;
PCSR_API_MESSAGE Request;
PCSR_API_MESSAGE Reply;
PCSRSS_PROCESS_DATA ProcessData;
DPRINT("CSR: %s called", __FUNCTION__);
DPRINT("CSR: %s called", __FUNCTION__);
Reply = NULL;
for (;;)
/* Loop and reply/wait for a new message */
for (;;)
{
Status = NtReplyWaitReceivePort(ServerPort,
0,
&Reply->Header,
&LpcRequest.Header);
if (! NT_SUCCESS(Status))
/* Send the reply and wait for a new request */
Status = NtReplyWaitReceivePort(ServerPort,
0,
&Reply->Header,
&LpcRequest.Header);
if (!NT_SUCCESS(Status))
{
DPRINT1("CSR: NtReplyWaitReceivePort failed\n");
break;
DPRINT1("CSR: NtReplyWaitReceivePort failed\n");
break;
}
/* If the connection was closed, handle that */
if (LpcRequest.Header.MessageType == LPC_PORT_CLOSED)
{
CsrFreeProcessData( LpcRequest.Header.ClientId.UniqueProcess );
break;
}
/* Get the CSR Message */
Request = (PCSR_API_MESSAGE)&LpcRequest;
Reply = (PCSR_API_MESSAGE)&LpcReply;
DPRINT("CSR: Got CSR API: %x [Message Origin: %x]\n",
Request->Type,
Request->Header.ClientId.UniqueProcess);
/* Get the Process Data */
ProcessData = CsrGetProcessData(LpcRequest.Header.ClientId.UniqueProcess);
if (ProcessData == NULL)
{
DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n",
LpcRequest.Header.MessageType,
LpcRequest.Header.ClientId.UniqueProcess);
break;
}
if (LpcRequest.Header.MessageType == LPC_PORT_CLOSED)
{
CsrFreeProcessData( LpcRequest.Header.ClientId.UniqueProcess );
break;
}
Request = (PCSRSS_API_REQUEST)&LpcRequest;
Reply = (PCSRSS_API_REPLY)&LpcReply;
ProcessData = CsrGetProcessData(LpcRequest.Header.ClientId.UniqueProcess);
if (ProcessData == NULL)
{
DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n",
LpcRequest.Header.MessageType, LpcRequest.Header.ClientId.UniqueProcess);
break;
}
CsrApiCallHandler(ProcessData, Request, Reply);
/* Call the Handler */
CsrApiCallHandler(ProcessData, Request);
/* Send back the reply */
Reply = Request;
}
NtClose(ServerPort);
RtlRosExitUserThread(STATUS_SUCCESS);
/* Close the port and exit the thread */
NtClose(ServerPort);
RtlRosExitUserThread(STATUS_SUCCESS);
}
/**********************************************************************

View file

@ -36,7 +36,6 @@
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <csrss/csrss.h>
#include <rosrtl/string.h>
#include <reactos/buildno.h>
#include "api.h"

View file

@ -59,19 +59,17 @@ typedef struct tagCSRSS_OBJECT_DEFINITION
} CSRSS_OBJECT_DEFINITION, *PCSRSS_OBJECT_DEFINITION;
typedef NTSTATUS (STDCALL *CSRSS_API_PROC)(PCSRSS_PROCESS_DATA ProcessData,
PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply);
PCSR_API_MESSAGE Request);
typedef struct _CSRSS_API_DEFINITION
{
ULONG Type;
ULONG MinRequestSize;
ULONG MinReplySize;
CSRSS_API_PROC Handler;
} CSRSS_API_DEFINITION, *PCSRSS_API_DEFINITION;
#define CSRSS_DEFINE_API(Func, Handler) \
{ Func, sizeof(Func##_REQUEST), sizeof(Func##_REPLY), Handler }
{ Func, sizeof(CSRSS_##Func), Handler }
typedef struct _CSRSS_LISTEN_DATA
{
@ -82,8 +80,7 @@ typedef struct _CSRSS_LISTEN_DATA
#define CSR_API(n) NTSTATUS STDCALL n (\
PCSRSS_PROCESS_DATA ProcessData,\
PCSRSS_API_REQUEST Request,\
PCSRSS_API_REPLY Reply)
PCSR_API_MESSAGE Request)
/* init.c */
extern HANDLE hBootstrapOk;
@ -100,8 +97,7 @@ VOID STDCALL PrintString (char* fmt, ...);
/* api/wapi.c */
NTSTATUS FASTCALL CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions);
VOID FASTCALL CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply);
PCSR_API_MESSAGE Request);
DWORD STDCALL ServerApiPortThread (PVOID PortHandle);
DWORD STDCALL ServerSbApiPortThread (PVOID PortHandle);
DWORD STDCALL Console_Api( PVOID unused );

View file

@ -12,9 +12,7 @@
#include <windows.h>
#define NTOS_MODE_USER
#define READY_FOR_NEW_NTDLL
#include <ndk/ntndk.h>
#include <rosrtl/string.h>
#include <sm/helper.h>
#include "api.h"
@ -150,7 +148,7 @@ static NTSTATUS
CsrpInitVideo (ULONG argc, PWSTR* argv)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DeviceName;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\??\\DISPLAY1");
IO_STATUS_BLOCK Iosb;
HANDLE VideoHandle = (HANDLE) 0;
NTSTATUS Status = STATUS_SUCCESS;
@ -159,7 +157,6 @@ CsrpInitVideo (ULONG argc, PWSTR* argv)
InitializeVideoAddressSpace();
RtlRosInitUnicodeStringFromLiteral(&DeviceName, L"\\??\\DISPLAY1");
InitializeObjectAttributes(&ObjectAttributes,
&DeviceName,
0,
@ -246,19 +243,19 @@ CsrpInitWin32Csr (ULONG argc, PWSTR* argv)
CSRSS_API_DEFINITION NativeDefinitions[] =
{
CSRSS_DEFINE_API(CSRSS_CREATE_PROCESS, CsrCreateProcess),
CSRSS_DEFINE_API(CSRSS_TERMINATE_PROCESS, CsrTerminateProcess),
CSRSS_DEFINE_API(CSRSS_CONNECT_PROCESS, CsrConnectProcess),
CSRSS_DEFINE_API(CSRSS_REGISTER_SERVICES_PROCESS, CsrRegisterServicesProcess),
CSRSS_DEFINE_API(CSRSS_GET_SHUTDOWN_PARAMETERS, CsrGetShutdownParameters),
CSRSS_DEFINE_API(CSRSS_SET_SHUTDOWN_PARAMETERS, CsrSetShutdownParameters),
CSRSS_DEFINE_API(CSRSS_GET_INPUT_HANDLE, CsrGetInputHandle),
CSRSS_DEFINE_API(CSRSS_GET_OUTPUT_HANDLE, CsrGetOutputHandle),
CSRSS_DEFINE_API(CSRSS_CLOSE_HANDLE, CsrCloseHandle),
CSRSS_DEFINE_API(CSRSS_VERIFY_HANDLE, CsrVerifyHandle),
CSRSS_DEFINE_API(CSRSS_DUPLICATE_HANDLE, CsrDuplicateHandle),
CSRSS_DEFINE_API(CSRSS_GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
{ 0, 0, 0, NULL }
CSRSS_DEFINE_API(CREATE_PROCESS, CsrCreateProcess),
CSRSS_DEFINE_API(TERMINATE_PROCESS, CsrTerminateProcess),
CSRSS_DEFINE_API(CONNECT_PROCESS, CsrConnectProcess),
CSRSS_DEFINE_API(REGISTER_SERVICES_PROCESS, CsrRegisterServicesProcess),
CSRSS_DEFINE_API(GET_SHUTDOWN_PARAMETERS, CsrGetShutdownParameters),
CSRSS_DEFINE_API(SET_SHUTDOWN_PARAMETERS, CsrSetShutdownParameters),
CSRSS_DEFINE_API(GET_INPUT_HANDLE, CsrGetInputHandle),
CSRSS_DEFINE_API(GET_OUTPUT_HANDLE, CsrGetOutputHandle),
CSRSS_DEFINE_API(CLOSE_HANDLE, CsrCloseHandle),
CSRSS_DEFINE_API(VERIFY_HANDLE, CsrVerifyHandle),
CSRSS_DEFINE_API(DUPLICATE_HANDLE, CsrDuplicateHandle),
CSRSS_DEFINE_API(GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
{ 0, 0, NULL }
};
static NTSTATUS STDCALL
@ -467,7 +464,7 @@ CsrpApiRegisterDef (ULONG argc, PWSTR* argv)
static NTSTATUS
CsrpCCTS (ULONG argc, PWSTR* argv)
{
return CsrClientConnectToServer();
return CsrClientConnectToServer(NULL, 0, NULL, NULL, 0, NULL);
}
/**********************************************************************

File diff suppressed because it is too large Load diff

View file

@ -206,15 +206,15 @@ CSR_API(CsrCreateDesktop)
DPRINT("CsrCreateDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (! BgInitialized)
{
BgInitialized = TRUE;
if (! DtbgInit())
{
return Reply->Status = STATUS_UNSUCCESSFUL;
return Request->Status = STATUS_UNSUCCESSFUL;
}
}
@ -227,7 +227,7 @@ CSR_API(CsrCreateDesktop)
if (NULL == ThreadData.Event)
{
DPRINT1("Failed to create event (error %d)\n", GetLastError());
return Reply->Status = STATUS_UNSUCCESSFUL;
return Request->Status = STATUS_UNSUCCESSFUL;
}
ThreadHandle = CreateThread(NULL,
0,
@ -239,16 +239,16 @@ CSR_API(CsrCreateDesktop)
{
CloseHandle(ThreadData.Event);
DPRINT1("Failed to create desktop window thread.\n");
return Reply->Status = STATUS_UNSUCCESSFUL;
return Request->Status = STATUS_UNSUCCESSFUL;
}
CloseHandle(ThreadHandle);
WaitForSingleObject(ThreadData.Event, INFINITE);
CloseHandle(ThreadData.Event);
Reply->Status = ThreadData.Status;
Request->Status = ThreadData.Status;
return Reply->Status;
return Request->Status;
}
CSR_API(CsrShowDesktop)
@ -256,8 +256,8 @@ CSR_API(CsrShowDesktop)
PRIVATE_NOTIFY_DESKTOP nmh;
DPRINT("CsrShowDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow;
nmh.hdr.idFrom = 0;
@ -266,13 +266,13 @@ CSR_API(CsrShowDesktop)
nmh.ShowDesktop.Width = (int)Request->Data.ShowDesktopRequest.Width;
nmh.ShowDesktop.Height = (int)Request->Data.ShowDesktopRequest.Height;
Reply->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
Request->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
WM_NOTIFY,
(WPARAM)nmh.hdr.hwndFrom,
(LPARAM)&nmh)
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
return Request->Status;
}
CSR_API(CsrHideDesktop)
@ -280,20 +280,20 @@ CSR_API(CsrHideDesktop)
PRIVATE_NOTIFY_DESKTOP nmh;
DPRINT("CsrHideDesktop\n");
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow;
nmh.hdr.idFrom = 0;
nmh.hdr.code = PM_HIDE_DESKTOP;
Reply->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
Request->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
WM_NOTIFY,
(WPARAM)nmh.hdr.hwndFrom,
(LPARAM)&nmh)
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
return Reply->Status;
return Request->Status;
}
BOOL FASTCALL

View file

@ -29,50 +29,50 @@ static CSRSS_EXPORTED_FUNCS CsrExports;
static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
{
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE, CsrWriteConsole),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE, CsrReadConsole),
CSRSS_DEFINE_API(CSRSS_ALLOC_CONSOLE, CsrAllocConsole),
CSRSS_DEFINE_API(CSRSS_FREE_CONSOLE, CsrFreeConsole),
CSRSS_DEFINE_API(CSRSS_SCREEN_BUFFER_INFO, CsrGetScreenBufferInfo),
CSRSS_DEFINE_API(CSRSS_SET_CURSOR, CsrSetCursor),
CSRSS_DEFINE_API(CSRSS_FILL_OUTPUT, CsrFillOutputChar),
CSRSS_DEFINE_API(CSRSS_READ_INPUT, CsrReadInputEvent),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR, CsrWriteConsoleOutputChar),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB, CsrWriteConsoleOutputAttrib),
CSRSS_DEFINE_API(CSRSS_FILL_OUTPUT_ATTRIB, CsrFillOutputAttrib),
CSRSS_DEFINE_API(CSRSS_GET_CURSOR_INFO, CsrGetCursorInfo),
CSRSS_DEFINE_API(CSRSS_SET_CURSOR_INFO, CsrSetCursorInfo),
CSRSS_DEFINE_API(CSRSS_SET_ATTRIB, CsrSetTextAttrib),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_MODE, CsrGetConsoleMode),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_MODE, CsrSetConsoleMode),
CSRSS_DEFINE_API(CSRSS_CREATE_SCREEN_BUFFER, CsrCreateScreenBuffer),
CSRSS_DEFINE_API(CSRSS_SET_SCREEN_BUFFER, CsrSetScreenBuffer),
CSRSS_DEFINE_API(CSRSS_SET_TITLE, CsrSetTitle),
CSRSS_DEFINE_API(CSRSS_GET_TITLE, CsrGetTitle),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_OUTPUT, CsrWriteConsoleOutput),
CSRSS_DEFINE_API(CSRSS_FLUSH_INPUT_BUFFER, CsrFlushInputBuffer),
CSRSS_DEFINE_API(CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER, CsrScrollConsoleScreenBuffer),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT_CHAR, CsrReadConsoleOutputChar),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB, CsrReadConsoleOutputAttrib),
CSRSS_DEFINE_API(CSRSS_GET_NUM_INPUT_EVENTS, CsrGetNumberOfConsoleInputEvents),
CSRSS_DEFINE_API(CSRSS_EXIT_REACTOS, CsrExitReactos),
CSRSS_DEFINE_API(CSRSS_PEEK_CONSOLE_INPUT, CsrPeekConsoleInput),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
CSRSS_DEFINE_API(CSRSS_SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_WINDOW, CsrGetConsoleWindow),
CSRSS_DEFINE_API(CSRSS_CREATE_DESKTOP, CsrCreateDesktop),
CSRSS_DEFINE_API(CSRSS_SHOW_DESKTOP, CsrShowDesktop),
CSRSS_DEFINE_API(CSRSS_HIDE_DESKTOP, CsrHideDesktop),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_ICON, CsrSetConsoleIcon),
CSRSS_DEFINE_API(CSRSS_SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
CSRSS_DEFINE_API(CSRSS_REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_CP, CsrGetConsoleCodePage),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_CP, CsrSetConsoleCodePage),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
CSRSS_DEFINE_API(CSRSS_GET_PROCESS_LIST, CsrGetProcessList),
{ 0, 0, 0, NULL }
CSRSS_DEFINE_API(WRITE_CONSOLE, CsrWriteConsole),
CSRSS_DEFINE_API(READ_CONSOLE, CsrReadConsole),
CSRSS_DEFINE_API(ALLOC_CONSOLE, CsrAllocConsole),
CSRSS_DEFINE_API(FREE_CONSOLE, CsrFreeConsole),
CSRSS_DEFINE_API(SCREEN_BUFFER_INFO, CsrGetScreenBufferInfo),
CSRSS_DEFINE_API(SET_CURSOR, CsrSetCursor),
CSRSS_DEFINE_API(FILL_OUTPUT, CsrFillOutputChar),
CSRSS_DEFINE_API(READ_INPUT, CsrReadInputEvent),
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_CHAR, CsrWriteConsoleOutputChar),
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_ATTRIB, CsrWriteConsoleOutputAttrib),
CSRSS_DEFINE_API(FILL_OUTPUT_ATTRIB, CsrFillOutputAttrib),
CSRSS_DEFINE_API(GET_CURSOR_INFO, CsrGetCursorInfo),
CSRSS_DEFINE_API(SET_CURSOR_INFO, CsrSetCursorInfo),
CSRSS_DEFINE_API(SET_ATTRIB, CsrSetTextAttrib),
CSRSS_DEFINE_API(GET_CONSOLE_MODE, CsrGetConsoleMode),
CSRSS_DEFINE_API(SET_CONSOLE_MODE, CsrSetConsoleMode),
CSRSS_DEFINE_API(CREATE_SCREEN_BUFFER, CsrCreateScreenBuffer),
CSRSS_DEFINE_API(SET_SCREEN_BUFFER, CsrSetScreenBuffer),
CSRSS_DEFINE_API(SET_TITLE, CsrSetTitle),
CSRSS_DEFINE_API(GET_TITLE, CsrGetTitle),
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT, CsrWriteConsoleOutput),
CSRSS_DEFINE_API(FLUSH_INPUT_BUFFER, CsrFlushInputBuffer),
CSRSS_DEFINE_API(SCROLL_CONSOLE_SCREEN_BUFFER, CsrScrollConsoleScreenBuffer),
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_CHAR, CsrReadConsoleOutputChar),
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_ATTRIB, CsrReadConsoleOutputAttrib),
CSRSS_DEFINE_API(GET_NUM_INPUT_EVENTS, CsrGetNumberOfConsoleInputEvents),
CSRSS_DEFINE_API(EXIT_REACTOS, CsrExitReactos),
CSRSS_DEFINE_API(PEEK_CONSOLE_INPUT, CsrPeekConsoleInput),
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
CSRSS_DEFINE_API(WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
CSRSS_DEFINE_API(SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
CSRSS_DEFINE_API(GET_CONSOLE_WINDOW, CsrGetConsoleWindow),
CSRSS_DEFINE_API(CREATE_DESKTOP, CsrCreateDesktop),
CSRSS_DEFINE_API(SHOW_DESKTOP, CsrShowDesktop),
CSRSS_DEFINE_API(HIDE_DESKTOP, CsrHideDesktop),
CSRSS_DEFINE_API(SET_CONSOLE_ICON, CsrSetConsoleIcon),
CSRSS_DEFINE_API(SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
CSRSS_DEFINE_API(REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
CSRSS_DEFINE_API(GET_CONSOLE_CP, CsrGetConsoleCodePage),
CSRSS_DEFINE_API(SET_CONSOLE_CP, CsrSetConsoleCodePage),
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
{ 0, 0, NULL }
};
static CSRSS_OBJECT_DEFINITION Win32CsrObjectDefinitions[] =

View file

@ -24,15 +24,15 @@ static HANDLE LogonProcess = NULL;
CSR_API(CsrRegisterLogonProcess)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (Request->Data.RegisterLogonProcessRequest.Register)
{
if (0 != LogonProcess)
{
Reply->Status = STATUS_LOGON_SESSION_EXISTS;
return Reply->Status;
Request->Status = STATUS_LOGON_SESSION_EXISTS;
return Request->Status;
}
LogonProcess = Request->Data.RegisterLogonProcessRequest.ProcessId;
}
@ -42,74 +42,74 @@ CSR_API(CsrRegisterLogonProcess)
{
DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
LogonProcess, Request->Header.ClientId.UniqueProcess);
Reply->Status = STATUS_NOT_LOGON_PROCESS;
return Reply->Status;
Request->Status = STATUS_NOT_LOGON_PROCESS;
return Request->Status;
}
LogonProcess = 0;
}
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return Reply->Status;
return Request->Status;
}
CSR_API(CsrSetLogonNotifyWindow)
{
DWORD WindowCreator;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (0 == GetWindowThreadProcessId(Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow,
&WindowCreator))
{
DPRINT1("Can't get window creator\n");
Reply->Status = STATUS_INVALID_HANDLE;
return Reply->Status;
Request->Status = STATUS_INVALID_HANDLE;
return Request->Status;
}
if (WindowCreator != (DWORD)LogonProcess)
{
DPRINT1("Trying to register window not created by winlogon as notify window\n");
Reply->Status = STATUS_ACCESS_DENIED;
return Reply->Status;
Request->Status = STATUS_ACCESS_DENIED;
return Request->Status;
}
LogonNotifyWindow = Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow;
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
return Reply->Status;
return Request->Status;
}
CSR_API(CsrExitReactos)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
if (NULL == LogonNotifyWindow)
{
DPRINT1("No LogonNotifyWindow registered\n");
Reply->Status = STATUS_NOT_FOUND;
return Reply->Status;
Request->Status = STATUS_NOT_FOUND;
return Request->Status;
}
/* FIXME Inside 2000 says we should impersonate the caller here */
Reply->Status = SendMessageW(LogonNotifyWindow, PM_WINLOGON_EXITWINDOWS,
Request->Status = SendMessageW(LogonNotifyWindow, PM_WINLOGON_EXITWINDOWS,
(WPARAM) Request->Header.ClientId.UniqueProcess,
(LPARAM) Request->Data.ExitReactosRequest.Flags);
/* If the message isn't handled, the return value is 0, so 0 doesn't indicate success.
Success is indicated by a 1 return value, if anything besides 0 or 1 it's a
NTSTATUS value */
if (1 == Reply->Status)
if (1 == Request->Status)
{
Reply->Status = STATUS_SUCCESS;
Request->Status = STATUS_SUCCESS;
}
else if (0 == Reply->Status)
else if (0 == Request->Status)
{
Reply->Status = STATUS_NOT_IMPLEMENTED;
Request->Status = STATUS_NOT_IMPLEMENTED;
}
return Reply->Status;
return Request->Status;
}
/* EOF */

View file

@ -13,7 +13,7 @@
extern PEPROCESS CsrProcess;
extern NTSTATUS FASTCALL CsrInit(void);
extern NTSTATUS FASTCALL CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply);
extern NTSTATUS FASTCALL CsrNotify(PCSR_API_MESSAGE Request);
extern NTSTATUS FASTCALL CsrCloseHandle(HANDLE Handle);
NTSTATUS
STDCALL

View file

@ -41,7 +41,7 @@ CsrInit(void)
NTSTATUS FASTCALL
CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
CsrNotify(PCSR_API_MESSAGE Request)
{
NTSTATUS Status;
PEPROCESS OldProcess;
@ -51,8 +51,8 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
return STATUS_INVALID_PORT_HANDLE;
}
Request->Header.DataSize = sizeof(CSRSS_API_REQUEST) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSRSS_API_REQUEST);
Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
/* Switch to the process in which the WindowsApiPort handle is valid */
OldProcess = PsGetCurrentProcess();
@ -62,7 +62,7 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
}
Status = ZwRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
&Reply->Header);
&Request->Header);
if (CsrProcess != OldProcess)
{
KeDetachProcess();
@ -70,7 +70,7 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
if (NT_SUCCESS(Status))
{
Status = Reply->Status;
Status = Request->Status;
}
return Status;

View file

@ -506,15 +506,14 @@ BOOL FASTCALL IntDesktopUpdatePerUserSettings(BOOL bEnable)
NTSTATUS FASTCALL
IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
Request.Type = CSRSS_SHOW_DESKTOP;
Request.Type = MAKE_CSR_API(SHOW_DESKTOP, CSR_GUI);
Request.Data.ShowDesktopRequest.DesktopWindow = Desktop->DesktopWindow;
Request.Data.ShowDesktopRequest.Width = Width;
Request.Data.ShowDesktopRequest.Height = Height;
return CsrNotify(&Request, &Reply);
return CsrNotify(&Request);
}
NTSTATUS FASTCALL
@ -729,8 +728,7 @@ NtUserCreateDesktop(
UNICODE_STRING DesktopName;
NTSTATUS Status;
HDESK Desktop;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
DPRINT("CreateDesktop: %wZ\n", lpszDesktopName);
@ -842,7 +840,7 @@ NtUserCreateDesktop(
/*
* Create a handle for CSRSS and notify CSRSS
*/
Request.Type = CSRSS_CREATE_DESKTOP;
Request.Type = MAKE_CSR_API(CREATE_DESKTOP, CSR_GUI);
Status = CsrInsertObject(Desktop,
GENERIC_ALL,
(HANDLE*)&Request.Data.CreateDesktopRequest.DesktopHandle);
@ -854,7 +852,7 @@ NtUserCreateDesktop(
return NULL;
}
Status = CsrNotify(&Request, &Reply);
Status = CsrNotify(&Request);
if (! NT_SUCCESS(Status))
{
CsrCloseHandle(Request.Data.CreateDesktopRequest.DesktopHandle);

View file

@ -51,8 +51,7 @@ IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
{
PEPROCESS Process;
NTSTATUS Status;
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
CSR_API_MESSAGE Request;
Status = PsLookupProcessByProcessId(ProcessId,
&Process);
@ -87,11 +86,11 @@ IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
ObDereferenceObject(Process);
Request.Type = CSRSS_REGISTER_LOGON_PROCESS;
Request.Type = MAKE_CSR_API(REGISTER_LOGON_PROCESS, CSR_GUI);
Request.Data.RegisterLogonProcessRequest.ProcessId = ProcessId;
Request.Data.RegisterLogonProcessRequest.Register = Register;
Status = CsrNotify(&Request, &Reply);
Status = CsrNotify(&Request);
if (! NT_SUCCESS(Status))
{
DPRINT1("Failed to register logon process with CSRSS\n");