https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d2aeaba5f8ecfa82c527c…
commit d2aeaba5f8ecfa82c527cee3597fdd9ca64d9f2f
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Oct 23 18:02:38 2022 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Oct 29 17:17:29 2022 +0200
[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.
---
dll/ntdll/CMakeLists.txt | 5 +---
dll/ntdll/include/ntdll.h | 3 ---
sdk/include/reactos/subsys/csr/csrsrv.h | 2 +-
subsystems/CMakeLists.txt | 2 +-
subsystems/{win32 => csr}/CMakeLists.txt | 1 +
subsystems/csr/csrlib/CMakeLists.txt | 13 ++++++++++
{dll/ntdll/csr => subsystems/csr/csrlib}/api.c | 19 +++++++-------
{dll/ntdll/csr => subsystems/csr/csrlib}/capture.c | 17 +++++--------
{dll/ntdll/csr => subsystems/csr/csrlib}/connect.c | 26 +++++++++++--------
subsystems/csr/csrlib/csrdll.spec | 17 +++++++++++++
subsystems/csr/csrlib/csrlib.h | 29 ++++++++++++++++++++++
subsystems/{win32 => csr}/csrsrv/CMakeLists.txt | 3 +--
subsystems/{win32 => csr}/csrsrv/api.c | 0
subsystems/{win32 => csr}/csrsrv/api.h | 0
subsystems/{win32 => csr}/csrsrv/csrsrv.rc | 0
subsystems/{win32 => csr}/csrsrv/csrsrv.spec | 0
subsystems/{win32 => csr}/csrsrv/init.c | 0
subsystems/{win32 => csr}/csrsrv/procsup.c | 0
subsystems/{win32 => csr}/csrsrv/server.c | 0
subsystems/{win32 => csr}/csrsrv/session.c | 0
subsystems/{win32 => csr}/csrsrv/srv.h | 0
subsystems/{win32 => csr}/csrsrv/status.h | 0
subsystems/{win32 => csr}/csrsrv/thredsup.c | 0
subsystems/{win32 => csr}/csrsrv/wait.c | 0
subsystems/{win32 => csr}/csrss/CMakeLists.txt | 0
subsystems/{win32 => csr}/csrss/csrss.c | 0
subsystems/{win32 => csr}/csrss/csrss.rc | 0
27 files changed, 94 insertions(+), 43 deletions(-)
diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt
index fbcd5272eb1..6d383bd6df4 100644
--- a/dll/ntdll/CMakeLists.txt
+++ b/dll/ntdll/CMakeLists.txt
@@ -18,9 +18,6 @@ include_directories(
${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
list(APPEND SOURCE
- csr/api.c
- csr/capture.c
- csr/connect.c
dbg/dbgui.c
ldr/ldrapi.c
ldr/ldrinit.c
@@ -60,7 +57,7 @@ set_module_type(ntdll win32dll ENTRYPOINT 0)
set_subsystem(ntdll console)
################# END HACK #################
-target_link_libraries(ntdll rtl rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB})
+target_link_libraries(ntdll csrlib rtl rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB})
if (STACK_PROTECTOR)
target_sources(ntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
diff --git a/dll/ntdll/include/ntdll.h b/dll/ntdll/include/ntdll.h
index 61b656feb27..007d5f42f55 100644
--- a/dll/ntdll/include/ntdll.h
+++ b/dll/ntdll/include/ntdll.h
@@ -43,9 +43,6 @@
/* Internal NTDLL */
#include "ntdllp.h"
-/* CSRSS Headers */
-#include <csr/csr.h>
-
/* PSEH */
#include <pseh/pseh2.h>
diff --git a/sdk/include/reactos/subsys/csr/csrsrv.h
b/sdk/include/reactos/subsys/csr/csrsrv.h
index 39fc5adfd2e..4f63c9bd152 100644
--- a/sdk/include/reactos/subsys/csr/csrsrv.h
+++ b/sdk/include/reactos/subsys/csr/csrsrv.h
@@ -23,7 +23,7 @@
/* TYPES **********************************************************************/
-// Used in ntdll/csr/connect.c
+// Used in csr/connect.c
#define CSR_CSRSS_SECTION_SIZE 65536
typedef struct _CSR_NT_SESSION
diff --git a/subsystems/CMakeLists.txt b/subsystems/CMakeLists.txt
index d77ca2fc6d4..ee58a57c40b 100644
--- a/subsystems/CMakeLists.txt
+++ b/subsystems/CMakeLists.txt
@@ -1,4 +1,4 @@
+add_subdirectory(csr)
add_subdirectory(mvdm)
add_subdirectory(win)
-add_subdirectory(win32)
diff --git a/subsystems/win32/CMakeLists.txt b/subsystems/csr/CMakeLists.txt
similarity index 66%
rename from subsystems/win32/CMakeLists.txt
rename to subsystems/csr/CMakeLists.txt
index 59bf8c3511c..487c1293343 100644
--- a/subsystems/win32/CMakeLists.txt
+++ b/subsystems/csr/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(csrlib)
add_subdirectory(csrsrv)
add_subdirectory(csrss)
diff --git a/subsystems/csr/csrlib/CMakeLists.txt b/subsystems/csr/csrlib/CMakeLists.txt
new file mode 100644
index 00000000000..7e8be938676
--- /dev/null
+++ b/subsystems/csr/csrlib/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+add_definitions(-D_NTSYSTEM_)
+
+include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys/csr)
+
+list(APPEND SOURCE
+ api.c
+ capture.c
+ connect.c)
+
+add_library(csrlib ${SOURCE})
+add_pch(csrlib csrlib.h SOURCE)
+add_dependencies(csrlib psdk)
diff --git a/dll/ntdll/csr/api.c b/subsystems/csr/csrlib/api.c
similarity index 83%
rename from dll/ntdll/csr/api.c
rename to subsystems/csr/csrlib/api.c
index b0ddf0478a7..b1611d1f34f 100644
--- a/dll/ntdll/csr/api.c
+++ b/subsystems/csr/csrlib/api.c
@@ -1,22 +1,21 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: dll/ntdll/csr/api.c
- * PURPOSE: CSR APIs exported through NTDLL
- * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ * PROJECT: ReactOS Client/Server Runtime SubSystem
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: CSR Client Library - API LPC Implementation
+ * COPYRIGHT: Copyright 2005-2012 Alex Ionescu <alex(a)relsoft.net>
+ * Copyright 2012-2022 Hermès Bélusca-Maïto
<hermes.belusca-maito(a)reactos.org>
*/
/* INCLUDES *******************************************************************/
-#include <ntdll.h>
+#include "csrlib.h"
+
+#define NTOS_MODE_USER
+#include <ndk/psfuncs.h>
#define NDEBUG
#include <debug.h>
-/* GLOBALS ********************************************************************/
-
-extern HANDLE CsrApiPort;
-
/* FUNCTIONS ******************************************************************/
/*
diff --git a/dll/ntdll/csr/capture.c b/subsystems/csr/csrlib/capture.c
similarity index 95%
rename from dll/ntdll/csr/capture.c
rename to subsystems/csr/csrlib/capture.c
index 9252a521f0a..c5b6b10cb59 100644
--- a/dll/ntdll/csr/capture.c
+++ b/subsystems/csr/csrlib/capture.c
@@ -1,23 +1,18 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: dll/ntdll/csr/capture.c
- * PURPOSE: Routines for probing and capturing CSR API Messages
- * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net)
- * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ * PROJECT: ReactOS Client/Server Runtime SubSystem
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: CSR Client Library - CSR API Messages probing and capturing
+ * COPYRIGHT: Copyright 2005 Alex Ionescu <alex(a)relsoft.net>
+ * Copyright 2012-2022 Hermès Bélusca-Maïto
<hermes.belusca-maito(a)reactos.org>
*/
/* INCLUDES *******************************************************************/
-#include <ntdll.h>
+#include "csrlib.h"
#define NDEBUG
#include <debug.h>
-/* GLOBALS ********************************************************************/
-
-extern HANDLE CsrPortHeap;
-
/* FUNCTIONS ******************************************************************/
/*
diff --git a/dll/ntdll/csr/connect.c b/subsystems/csr/csrlib/connect.c
similarity index 96%
rename from dll/ntdll/csr/connect.c
rename to subsystems/csr/csrlib/connect.c
index 98033274e44..51d7c006f75 100644
--- a/dll/ntdll/csr/connect.c
+++ b/subsystems/csr/csrlib/connect.c
@@ -1,17 +1,23 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: dll/ntdll/csr/connect.c
- * PURPOSE: Routines for connecting and calling CSR
- * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ * PROJECT: ReactOS Client/Server Runtime SubSystem
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: CSR Client Library - CSR connection and calling
+ * COPYRIGHT: Copyright 2005-2013 Alex Ionescu <alex(a)relsoft.net>
+ * Copyright 2012-2022 Hermès Bélusca-Maïto
<hermes.belusca-maito(a)reactos.org>
*/
/* INCLUDES *******************************************************************/
-#include <ntdll.h>
+#include "csrlib.h"
+#define NTOS_MODE_USER
+#include <ndk/ldrfuncs.h>
#include <ndk/lpcfuncs.h>
-#include <csr/csrsrv.h>
+#include <ndk/mmfuncs.h>
+#include <ndk/obfuncs.h>
+#include <ndk/umfuncs.h>
+
+#include <csrsrv.h> // For CSR_CSRSS_SECTION_SIZE
#define NDEBUG
#include <debug.h>
@@ -30,8 +36,6 @@ typedef NTSTATUS
PCSR_SERVER_API_ROUTINE CsrServerApiRoutine;
-#define UNICODE_PATH_SEP L"\\"
-
/* FUNCTIONS ******************************************************************/
NTSTATUS
@@ -80,8 +84,8 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
}
/* Create the name */
- RtlAppendUnicodeToString(&PortName, ObjectDirectory );
- RtlAppendUnicodeToString(&PortName, UNICODE_PATH_SEP);
+ RtlAppendUnicodeToString(&PortName, ObjectDirectory);
+ RtlAppendUnicodeToString(&PortName, L"\\");
RtlAppendUnicodeToString(&PortName, CSR_PORT_NAME);
/* Create a section for the port memory */
diff --git a/subsystems/csr/csrlib/csrdll.spec b/subsystems/csr/csrlib/csrdll.spec
new file mode 100644
index 00000000000..5d170a92a81
--- /dev/null
+++ b/subsystems/csr/csrlib/csrdll.spec
@@ -0,0 +1,17 @@
+@ stdcall CsrAllocateCaptureBuffer(long long)
+@ stdcall CsrAllocateMessagePointer(ptr long ptr)
+@ stdcall CsrCaptureMessageBuffer(ptr ptr long ptr)
+@ stdcall CsrCaptureMessageMultiUnicodeStringsInPlace(ptr long ptr)
+@ stdcall CsrCaptureMessageString(ptr str long long ptr)
+@ stdcall CsrCaptureTimeout(long ptr)
+@ stdcall CsrClientCallServer(ptr ptr long long)
+@ stdcall CsrClientConnectToServer(str long ptr ptr ptr)
+@ stdcall CsrFreeCaptureBuffer(ptr)
+@ stdcall CsrGetProcessId()
+@ stdcall CsrIdentifyAlertableThread()
+@ stdcall -version=0x502 CsrNewThread()
+@ stdcall -version=0x502 CsrProbeForRead(ptr long long)
+@ stdcall -version=0x502 CsrProbeForWrite(ptr long long)
+@ stdcall CsrSetPriorityClass(ptr ptr)
+@ stdcall -stub -version=0x600+ CsrVerifyRegion(ptr long)
+@ stdcall -stub -version=0x600+ RtlRegisterThreadWithCsrss()
diff --git a/subsystems/csr/csrlib/csrlib.h b/subsystems/csr/csrlib/csrlib.h
new file mode 100644
index 00000000000..ed65a07d192
--- /dev/null
+++ b/subsystems/csr/csrlib/csrlib.h
@@ -0,0 +1,29 @@
+/*
+ * PROJECT: ReactOS Client/Server Runtime SubSystem
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: CSR Client Library - Main Header
+ * COPYRIGHT: Copyright 2022 Hermès Bélusca-Maïto
<hermes.belusca-maito(a)reactos.org>
+ */
+
+#ifndef _CSRLIB_H_
+#define _CSRLIB_H_
+
+/* INCLUDES ******************************************************************/
+
+/* PSDK/NDK Headers */
+#define WIN32_NO_STATUS
+//#include <windef.h>
+#define NTOS_MODE_USER
+#include <ndk/rtlfuncs.h>
+
+/* CSRSS Headers */
+#include <csr.h>
+
+/* GLOBALS ********************************************************************/
+
+extern HANDLE CsrApiPort;
+extern HANDLE CsrPortHeap;
+
+#endif /* _CSRLIB_H_ */
+
+/* EOF */
diff --git a/subsystems/win32/csrsrv/CMakeLists.txt
b/subsystems/csr/csrsrv/CMakeLists.txt
similarity index 81%
rename from subsystems/win32/csrsrv/CMakeLists.txt
rename to subsystems/csr/csrsrv/CMakeLists.txt
index 3ee512e5dd9..72fe79b9083 100644
--- a/subsystems/win32/csrsrv/CMakeLists.txt
+++ b/subsystems/csr/csrsrv/CMakeLists.txt
@@ -1,5 +1,4 @@
-include_directories(${REACTOS_SOURCE_DIR}/subsystems/win32/csrss/include)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
spec2def(csrsrv.dll csrsrv.spec ADD_IMPORTLIB)
@@ -20,7 +19,7 @@ add_library(csrsrv MODULE
${CMAKE_CURRENT_BINARY_DIR}/csrsrv.def)
set_module_type(csrsrv nativedll)
-target_link_libraries(csrsrv ${PSEH_LIB} smlib)
+target_link_libraries(csrsrv smlib ${PSEH_LIB})
add_importlibs(csrsrv ntdll)
add_pch(csrsrv srv.h SOURCE)
add_dependencies(csrsrv psdk bugcodes)
diff --git a/subsystems/win32/csrsrv/api.c b/subsystems/csr/csrsrv/api.c
similarity index 100%
rename from subsystems/win32/csrsrv/api.c
rename to subsystems/csr/csrsrv/api.c
diff --git a/subsystems/win32/csrsrv/api.h b/subsystems/csr/csrsrv/api.h
similarity index 100%
rename from subsystems/win32/csrsrv/api.h
rename to subsystems/csr/csrsrv/api.h
diff --git a/subsystems/win32/csrsrv/csrsrv.rc b/subsystems/csr/csrsrv/csrsrv.rc
similarity index 100%
rename from subsystems/win32/csrsrv/csrsrv.rc
rename to subsystems/csr/csrsrv/csrsrv.rc
diff --git a/subsystems/win32/csrsrv/csrsrv.spec b/subsystems/csr/csrsrv/csrsrv.spec
similarity index 100%
rename from subsystems/win32/csrsrv/csrsrv.spec
rename to subsystems/csr/csrsrv/csrsrv.spec
diff --git a/subsystems/win32/csrsrv/init.c b/subsystems/csr/csrsrv/init.c
similarity index 100%
rename from subsystems/win32/csrsrv/init.c
rename to subsystems/csr/csrsrv/init.c
diff --git a/subsystems/win32/csrsrv/procsup.c b/subsystems/csr/csrsrv/procsup.c
similarity index 100%
rename from subsystems/win32/csrsrv/procsup.c
rename to subsystems/csr/csrsrv/procsup.c
diff --git a/subsystems/win32/csrsrv/server.c b/subsystems/csr/csrsrv/server.c
similarity index 100%
rename from subsystems/win32/csrsrv/server.c
rename to subsystems/csr/csrsrv/server.c
diff --git a/subsystems/win32/csrsrv/session.c b/subsystems/csr/csrsrv/session.c
similarity index 100%
rename from subsystems/win32/csrsrv/session.c
rename to subsystems/csr/csrsrv/session.c
diff --git a/subsystems/win32/csrsrv/srv.h b/subsystems/csr/csrsrv/srv.h
similarity index 100%
rename from subsystems/win32/csrsrv/srv.h
rename to subsystems/csr/csrsrv/srv.h
diff --git a/subsystems/win32/csrsrv/status.h b/subsystems/csr/csrsrv/status.h
similarity index 100%
rename from subsystems/win32/csrsrv/status.h
rename to subsystems/csr/csrsrv/status.h
diff --git a/subsystems/win32/csrsrv/thredsup.c b/subsystems/csr/csrsrv/thredsup.c
similarity index 100%
rename from subsystems/win32/csrsrv/thredsup.c
rename to subsystems/csr/csrsrv/thredsup.c
diff --git a/subsystems/win32/csrsrv/wait.c b/subsystems/csr/csrsrv/wait.c
similarity index 100%
rename from subsystems/win32/csrsrv/wait.c
rename to subsystems/csr/csrsrv/wait.c
diff --git a/subsystems/win32/csrss/CMakeLists.txt b/subsystems/csr/csrss/CMakeLists.txt
similarity index 100%
rename from subsystems/win32/csrss/CMakeLists.txt
rename to subsystems/csr/csrss/CMakeLists.txt
diff --git a/subsystems/win32/csrss/csrss.c b/subsystems/csr/csrss/csrss.c
similarity index 100%
rename from subsystems/win32/csrss/csrss.c
rename to subsystems/csr/csrss/csrss.c
diff --git a/subsystems/win32/csrss/csrss.rc b/subsystems/csr/csrss/csrss.rc
similarity index 100%
rename from subsystems/win32/csrss/csrss.rc
rename to subsystems/csr/csrss/csrss.rc