Reactos

[CSR][NTDLL] Move the CSR subsystem into its own "csr" sub-directory. (#4802)

Move CSRSS, CSRSRV there, as well as CSR client calls from NTDLL into a "CSRLIB" library.

+94 -43
+1 -4
dll/ntdll/CMakeLists.txt
··· 18 18 ${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys) 19 19 20 20 list(APPEND SOURCE 21 - csr/api.c 22 - csr/capture.c 23 - csr/connect.c 24 21 dbg/dbgui.c 25 22 ldr/ldrapi.c 26 23 ldr/ldrinit.c ··· 60 57 set_subsystem(ntdll console) 61 58 ################# END HACK ################# 62 59 63 - target_link_libraries(ntdll rtl rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB}) 60 + target_link_libraries(ntdll csrlib rtl rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB}) 64 61 65 62 if (STACK_PROTECTOR) 66 63 target_sources(ntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
+9 -10
dll/ntdll/csr/api.c subsystems/csr/csrlib/api.c
··· 1 1 /* 2 - * COPYRIGHT: See COPYING in the top level directory 3 - * PROJECT: ReactOS kernel 4 - * FILE: dll/ntdll/csr/api.c 5 - * PURPOSE: CSR APIs exported through NTDLL 6 - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) 2 + * PROJECT: ReactOS Client/Server Runtime SubSystem 3 + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 + * PURPOSE: CSR Client Library - API LPC Implementation 5 + * COPYRIGHT: Copyright 2005-2012 Alex Ionescu <alex@relsoft.net> 6 + * Copyright 2012-2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 7 7 */ 8 8 9 9 /* INCLUDES *******************************************************************/ 10 10 11 - #include <ntdll.h> 11 + #include "csrlib.h" 12 + 13 + #define NTOS_MODE_USER 14 + #include <ndk/psfuncs.h> 12 15 13 16 #define NDEBUG 14 17 #include <debug.h> 15 - 16 - /* GLOBALS ********************************************************************/ 17 - 18 - extern HANDLE CsrApiPort; 19 18 20 19 /* FUNCTIONS ******************************************************************/ 21 20
+6 -11
dll/ntdll/csr/capture.c subsystems/csr/csrlib/capture.c
··· 1 1 /* 2 - * COPYRIGHT: See COPYING in the top level directory 3 - * PROJECT: ReactOS kernel 4 - * FILE: dll/ntdll/csr/capture.c 5 - * PURPOSE: Routines for probing and capturing CSR API Messages 6 - * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) 7 - * Hermes Belusca-Maito (hermes.belusca@sfr.fr) 2 + * PROJECT: ReactOS Client/Server Runtime SubSystem 3 + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 + * PURPOSE: CSR Client Library - CSR API Messages probing and capturing 5 + * COPYRIGHT: Copyright 2005 Alex Ionescu <alex@relsoft.net> 6 + * Copyright 2012-2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 8 7 */ 9 8 10 9 /* INCLUDES *******************************************************************/ 11 10 12 - #include <ntdll.h> 11 + #include "csrlib.h" 13 12 14 13 #define NDEBUG 15 14 #include <debug.h> 16 - 17 - /* GLOBALS ********************************************************************/ 18 - 19 - extern HANDLE CsrPortHeap; 20 15 21 16 /* FUNCTIONS ******************************************************************/ 22 17
+15 -11
dll/ntdll/csr/connect.c subsystems/csr/csrlib/connect.c
··· 1 1 /* 2 - * COPYRIGHT: See COPYING in the top level directory 3 - * PROJECT: ReactOS kernel 4 - * FILE: dll/ntdll/csr/connect.c 5 - * PURPOSE: Routines for connecting and calling CSR 6 - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) 2 + * PROJECT: ReactOS Client/Server Runtime SubSystem 3 + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 + * PURPOSE: CSR Client Library - CSR connection and calling 5 + * COPYRIGHT: Copyright 2005-2013 Alex Ionescu <alex@relsoft.net> 6 + * Copyright 2012-2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 7 7 */ 8 8 9 9 /* INCLUDES *******************************************************************/ 10 10 11 - #include <ntdll.h> 11 + #include "csrlib.h" 12 12 13 + #define NTOS_MODE_USER 14 + #include <ndk/ldrfuncs.h> 13 15 #include <ndk/lpcfuncs.h> 14 - #include <csr/csrsrv.h> 16 + #include <ndk/mmfuncs.h> 17 + #include <ndk/obfuncs.h> 18 + #include <ndk/umfuncs.h> 19 + 20 + #include <csrsrv.h> // For CSR_CSRSS_SECTION_SIZE 15 21 16 22 #define NDEBUG 17 23 #include <debug.h> ··· 29 35 IN PPORT_MESSAGE Reply); 30 36 31 37 PCSR_SERVER_API_ROUTINE CsrServerApiRoutine; 32 - 33 - #define UNICODE_PATH_SEP L"\\" 34 38 35 39 /* FUNCTIONS ******************************************************************/ 36 40 ··· 80 84 } 81 85 82 86 /* Create the name */ 83 - RtlAppendUnicodeToString(&PortName, ObjectDirectory ); 84 - RtlAppendUnicodeToString(&PortName, UNICODE_PATH_SEP); 87 + RtlAppendUnicodeToString(&PortName, ObjectDirectory); 88 + RtlAppendUnicodeToString(&PortName, L"\\"); 85 89 RtlAppendUnicodeToString(&PortName, CSR_PORT_NAME); 86 90 87 91 /* Create a section for the port memory */
-3
dll/ntdll/include/ntdll.h
··· 43 43 /* Internal NTDLL */ 44 44 #include "ntdllp.h" 45 45 46 - /* CSRSS Headers */ 47 - #include <csr/csr.h> 48 - 49 46 /* PSEH */ 50 47 #include <pseh/pseh2.h> 51 48
+1 -1
sdk/include/reactos/subsys/csr/csrsrv.h
··· 23 23 24 24 /* TYPES **********************************************************************/ 25 25 26 - // Used in ntdll/csr/connect.c 26 + // Used in csr/connect.c 27 27 #define CSR_CSRSS_SECTION_SIZE 65536 28 28 29 29 typedef struct _CSR_NT_SESSION
+1 -1
subsystems/CMakeLists.txt
··· 1 1 2 + add_subdirectory(csr) 2 3 add_subdirectory(mvdm) 3 4 add_subdirectory(win) 4 - add_subdirectory(win32)
+13
subsystems/csr/csrlib/CMakeLists.txt
··· 1 + 2 + add_definitions(-D_NTSYSTEM_) 3 + 4 + include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys/csr) 5 + 6 + list(APPEND SOURCE 7 + api.c 8 + capture.c 9 + connect.c) 10 + 11 + add_library(csrlib ${SOURCE}) 12 + add_pch(csrlib csrlib.h SOURCE) 13 + add_dependencies(csrlib psdk)
+17
subsystems/csr/csrlib/csrdll.spec
··· 1 + @ stdcall CsrAllocateCaptureBuffer(long long) 2 + @ stdcall CsrAllocateMessagePointer(ptr long ptr) 3 + @ stdcall CsrCaptureMessageBuffer(ptr ptr long ptr) 4 + @ stdcall CsrCaptureMessageMultiUnicodeStringsInPlace(ptr long ptr) 5 + @ stdcall CsrCaptureMessageString(ptr str long long ptr) 6 + @ stdcall CsrCaptureTimeout(long ptr) 7 + @ stdcall CsrClientCallServer(ptr ptr long long) 8 + @ stdcall CsrClientConnectToServer(str long ptr ptr ptr) 9 + @ stdcall CsrFreeCaptureBuffer(ptr) 10 + @ stdcall CsrGetProcessId() 11 + @ stdcall CsrIdentifyAlertableThread() 12 + @ stdcall -version=0x502 CsrNewThread() 13 + @ stdcall -version=0x502 CsrProbeForRead(ptr long long) 14 + @ stdcall -version=0x502 CsrProbeForWrite(ptr long long) 15 + @ stdcall CsrSetPriorityClass(ptr ptr) 16 + @ stdcall -stub -version=0x600+ CsrVerifyRegion(ptr long) 17 + @ stdcall -stub -version=0x600+ RtlRegisterThreadWithCsrss()
+29
subsystems/csr/csrlib/csrlib.h
··· 1 + /* 2 + * PROJECT: ReactOS Client/Server Runtime SubSystem 3 + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 + * PURPOSE: CSR Client Library - Main Header 5 + * COPYRIGHT: Copyright 2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 6 + */ 7 + 8 + #ifndef _CSRLIB_H_ 9 + #define _CSRLIB_H_ 10 + 11 + /* INCLUDES ******************************************************************/ 12 + 13 + /* PSDK/NDK Headers */ 14 + #define WIN32_NO_STATUS 15 + //#include <windef.h> 16 + #define NTOS_MODE_USER 17 + #include <ndk/rtlfuncs.h> 18 + 19 + /* CSRSS Headers */ 20 + #include <csr.h> 21 + 22 + /* GLOBALS ********************************************************************/ 23 + 24 + extern HANDLE CsrApiPort; 25 + extern HANDLE CsrPortHeap; 26 + 27 + #endif /* _CSRLIB_H_ */ 28 + 29 + /* EOF */
+1
subsystems/win32/CMakeLists.txt subsystems/csr/CMakeLists.txt
··· 1 1 2 + add_subdirectory(csrlib) 2 3 add_subdirectory(csrsrv) 3 4 add_subdirectory(csrss)
+1 -2
subsystems/win32/csrsrv/CMakeLists.txt subsystems/csr/csrsrv/CMakeLists.txt
··· 1 1 2 - include_directories(${REACTOS_SOURCE_DIR}/subsystems/win32/csrss/include) 3 2 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys) 4 3 5 4 spec2def(csrsrv.dll csrsrv.spec ADD_IMPORTLIB) ··· 20 19 ${CMAKE_CURRENT_BINARY_DIR}/csrsrv.def) 21 20 22 21 set_module_type(csrsrv nativedll) 23 - target_link_libraries(csrsrv ${PSEH_LIB} smlib) 22 + target_link_libraries(csrsrv smlib ${PSEH_LIB}) 24 23 add_importlibs(csrsrv ntdll) 25 24 add_pch(csrsrv srv.h SOURCE) 26 25 add_dependencies(csrsrv psdk bugcodes)
subsystems/win32/csrsrv/api.c subsystems/csr/csrsrv/api.c
subsystems/win32/csrsrv/api.h subsystems/csr/csrsrv/api.h
subsystems/win32/csrsrv/csrsrv.rc subsystems/csr/csrsrv/csrsrv.rc
subsystems/win32/csrsrv/csrsrv.spec subsystems/csr/csrsrv/csrsrv.spec
subsystems/win32/csrsrv/init.c subsystems/csr/csrsrv/init.c
subsystems/win32/csrsrv/procsup.c subsystems/csr/csrsrv/procsup.c
subsystems/win32/csrsrv/server.c subsystems/csr/csrsrv/server.c
subsystems/win32/csrsrv/session.c subsystems/csr/csrsrv/session.c
subsystems/win32/csrsrv/srv.h subsystems/csr/csrsrv/srv.h
subsystems/win32/csrsrv/status.h subsystems/csr/csrsrv/status.h
subsystems/win32/csrsrv/thredsup.c subsystems/csr/csrsrv/thredsup.c
subsystems/win32/csrsrv/wait.c subsystems/csr/csrsrv/wait.c
subsystems/win32/csrss/CMakeLists.txt subsystems/csr/csrss/CMakeLists.txt
subsystems/win32/csrss/csrss.c subsystems/csr/csrss/csrss.c
subsystems/win32/csrss/csrss.rc subsystems/csr/csrss/csrss.rc