https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7353af1e3dce135d77341…
commit 7353af1e3dce135d773411635d385495916a1ea0
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Nov 21 23:46:11 2021 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Nov 22 00:13:34 2021 +0100
[NTDLL:CSR][CSRSRV] Start to deprecate CSR functions removed on Windows 2003.
The server-side CsrSrvIdentifyAlertableThread and CsrSrvSetPriorityClass
functions are completely removed in Win2k3+, and are since stubbed by
CsrSrvUnusedFunction instead. They however were present up to Windows XP,
albeit with an extremely minimal implementation.
The corresponding client-side CsrIdentifyAlertableThread and CsrSetPriorityClass
now become just stubs that either trivially succeed or fail, respectively.
See
https://www.geoffchappell.com/studies/windows/win32/csrsrv/api/srvinit/apid…
for more information.
- Fix typo "al*T*ertable" --> "alertable".
- Remove ROS-specific CSRSS_IDENTIFY_ALERTABLE_THREAD that was
deprecated since ages (at least before 2005)!
---
dll/ntdll/csr/api.c | 47 ++++++++++++++++++++-------------
sdk/include/reactos/subsys/csr/csr.h | 8 +++---
sdk/include/reactos/subsys/csr/csrmsg.h | 19 +++++++------
subsystems/win32/csrsrv/api.h | 2 ++
subsystems/win32/csrsrv/server.c | 41 +++++++++++++++++++++-------
5 files changed, 75 insertions(+), 42 deletions(-)
diff --git a/dll/ntdll/csr/api.c b/dll/ntdll/csr/api.c
index fd0687e3b7f..b0ddf0478a7 100644
--- a/dll/ntdll/csr/api.c
+++ b/dll/ntdll/csr/api.c
@@ -35,29 +35,29 @@ CsrNewThread(VOID)
*/
NTSTATUS
NTAPI
-CsrSetPriorityClass(HANDLE hProcess,
- PULONG PriorityClass)
+CsrIdentifyAlertableThread(VOID)
{
+#if (NTDDI_VERSION < NTDDI_WS03)
NTSTATUS Status;
CSR_API_MESSAGE ApiMessage;
- PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
+ PCSR_IDENTIFY_ALERTABLE_THREAD IdentifyAlertableThread;
/* Set up the data for CSR */
- DbgBreakPoint();
- SetPriorityClass->hProcess = hProcess;
- SetPriorityClass->PriorityClass = *PriorityClass;
+ IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread;
+ IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId;
/* Call it */
Status = CsrClientCallServer(&ApiMessage,
NULL,
- CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX,
CsrpSetPriorityClass),
- sizeof(CSR_SET_PRIORITY_CLASS));
-
- /* Return what we got, if requested */
- if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass;
+ CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX,
CsrpIdentifyAlertableThread),
+ sizeof(*IdentifyAlertableThread));
/* Return to caller */
return Status;
+#else
+ /* Deprecated */
+ return STATUS_SUCCESS;
+#endif
}
/*
@@ -65,25 +65,36 @@ CsrSetPriorityClass(HANDLE hProcess,
*/
NTSTATUS
NTAPI
-CsrIdentifyAlertableThread(VOID)
+CsrSetPriorityClass(IN HANDLE Process,
+ IN OUT PULONG PriorityClass)
{
+#if (NTDDI_VERSION < NTDDI_WS03)
NTSTATUS Status;
CSR_API_MESSAGE ApiMessage;
- PCSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
+ PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
/* Set up the data for CSR */
- DbgBreakPoint();
- IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread;
- IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId;
+ SetPriorityClass->hProcess = Process;
+ SetPriorityClass->PriorityClass = *PriorityClass;
/* Call it */
Status = CsrClientCallServer(&ApiMessage,
NULL,
- CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX,
CsrpIdentifyAlertable),
- sizeof(CSR_IDENTIFY_ALTERTABLE_THREAD));
+ CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX,
CsrpSetPriorityClass),
+ sizeof(*SetPriorityClass));
+
+ /* Return what we got, if requested */
+ if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass;
/* Return to caller */
return Status;
+#else
+ UNREFERENCED_PARAMETER(Process);
+ UNREFERENCED_PARAMETER(PriorityClass);
+
+ /* Deprecated */
+ return STATUS_INVALID_PARAMETER;
+#endif
}
/* EOF */
diff --git a/sdk/include/reactos/subsys/csr/csr.h b/sdk/include/reactos/subsys/csr/csr.h
index e778b11051e..ae531e2a0ae 100644
--- a/sdk/include/reactos/subsys/csr/csr.h
+++ b/sdk/include/reactos/subsys/csr/csr.h
@@ -80,10 +80,6 @@ CsrProbeForWrite(IN PVOID Address,
IN ULONG Length,
IN ULONG Alignment);
-NTSTATUS
-NTAPI
-CsrIdentifyAlertableThread(VOID);
-
HANDLE
NTAPI
CsrGetProcessId(VOID);
@@ -92,6 +88,10 @@ NTSTATUS
NTAPI
CsrNewThread(VOID);
+NTSTATUS
+NTAPI
+CsrIdentifyAlertableThread(VOID);
+
NTSTATUS
NTAPI
CsrSetPriorityClass(IN HANDLE Process,
diff --git a/sdk/include/reactos/subsys/csr/csrmsg.h
b/sdk/include/reactos/subsys/csr/csrmsg.h
index 4823d3a1261..759e6eab0e9 100644
--- a/sdk/include/reactos/subsys/csr/csrmsg.h
+++ b/sdk/include/reactos/subsys/csr/csrmsg.h
@@ -25,7 +25,7 @@ typedef enum _CSRSRV_API_NUMBER
CsrpClientConnect = CSRSRV_FIRST_API_NUMBER,
CsrpThreadConnect,
CsrpProfileControl,
- CsrpIdentifyAlertable,
+ CsrpIdentifyAlertableThread,
CsrpSetPriorityClass,
CsrpMaxApiNumber
@@ -65,10 +65,12 @@ C_ASSERT(sizeof(CSR_API_CONNECTINFO) == 0x24);
C_ASSERT(sizeof(CSR_API_CONNECTINFO) <= LPC_MAX_DATA_LENGTH);
-typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD
+#if (NTDDI_VERSION < NTDDI_WS03)
+
+typedef struct _CSR_IDENTIFY_ALERTABLE_THREAD
{
CLIENT_ID Cid;
-} CSR_IDENTIFY_ALTERTABLE_THREAD, *PCSR_IDENTIFY_ALTERTABLE_THREAD;
+} CSR_IDENTIFY_ALERTABLE_THREAD, *PCSR_IDENTIFY_ALERTABLE_THREAD;
typedef struct _CSR_SET_PRIORITY_CLASS
{
@@ -76,11 +78,7 @@ typedef struct _CSR_SET_PRIORITY_CLASS
ULONG PriorityClass;
} CSR_SET_PRIORITY_CLASS, *PCSR_SET_PRIORITY_CLASS;
-typedef struct
-{
- HANDLE UniqueThread;
- CLIENT_ID Cid;
-} CSRSS_IDENTIFY_ALERTABLE_THREAD, *PCSRSS_IDENTIFY_ALERTABLE_THREAD;
+#endif // (NTDDI_VERSION < NTDDI_WS03)
typedef struct _CSR_CLIENT_CONNECT
{
@@ -114,9 +112,10 @@ typedef struct _CSR_API_MESSAGE
union
{
CSR_CLIENT_CONNECT CsrClientConnect;
+#if (NTDDI_VERSION < NTDDI_WS03)
CSR_SET_PRIORITY_CLASS SetPriorityClass;
- CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
-
+ CSR_IDENTIFY_ALERTABLE_THREAD IdentifyAlertableThread;
+#endif
//
// This padding is used to make the CSR_API_MESSAGE structure
// large enough to hold full other API_MESSAGE-type structures
diff --git a/subsystems/win32/csrsrv/api.h b/subsystems/win32/csrsrv/api.h
index 0c1fe773471..a9df4217d95 100644
--- a/subsystems/win32/csrsrv/api.h
+++ b/subsystems/win32/csrsrv/api.h
@@ -66,8 +66,10 @@ extern HANDLE CsrObjectDirectory;
CSR_API(CsrSrvClientConnect);
CSR_API(CsrSrvUnusedFunction);
+#if (NTDDI_VERSION < NTDDI_WS03)
CSR_API(CsrSrvIdentifyAlertableThread);
CSR_API(CsrSrvSetPriorityClass);
+#endif
NTSTATUS
diff --git a/subsystems/win32/csrsrv/server.c b/subsystems/win32/csrsrv/server.c
index 3fce78b7fc5..e8998ab738a 100644
--- a/subsystems/win32/csrsrv/server.c
+++ b/subsystems/win32/csrsrv/server.c
@@ -27,19 +27,29 @@ HANDLE CsrSrvSharedSection = NULL;
PCSR_API_ROUTINE CsrServerApiDispatchTable[CsrpMaxApiNumber] =
{
CsrSrvClientConnect,
- CsrSrvUnusedFunction,
- CsrSrvUnusedFunction,
- CsrSrvIdentifyAlertableThread,
+ CsrSrvUnusedFunction, // <= WinNT4: CsrSrvThreadConnect
+ CsrSrvUnusedFunction, // <= WinNT4: CsrSrvProfileControl
+#if (NTDDI_VERSION < NTDDI_WS03)
+ CsrSrvIdentifyAlertableThread
CsrSrvSetPriorityClass
+#else
+ CsrSrvUnusedFunction, // <= WinXP : CsrSrvIdentifyAlertableThread
+ CsrSrvUnusedFunction // <= WinXP : CsrSrvSetPriorityClass
+#endif
};
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber] =
{
TRUE,
FALSE,
- TRUE,
+ FALSE,
+#if (NTDDI_VERSION < NTDDI_WS03)
TRUE,
TRUE
+#else
+ FALSE,
+ FALSE
+#endif
};
/*
@@ -501,9 +511,11 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
return STATUS_SUCCESS;
}
+#if (NTDDI_VERSION < NTDDI_WS03)
+
/*++
* @name CsrSrvIdentifyAlertableThread
- * @implemented NT4
+ * @implemented NT4, up to WinXP
*
* The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
*
@@ -515,13 +527,16 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
*
* @return STATUS_SUCCESS.
*
- * @remarks None.
+ * @remarks Deprecated.
*
*--*/
CSR_API(CsrSrvIdentifyAlertableThread)
{
PCSR_THREAD CsrThread = CsrGetClientThread();
+ UNREFERENCED_PARAMETER(ApiMessage);
+ UNREFERENCED_PARAMETER(ReplyCode);
+
/* Set the alertable flag */
CsrThread->Flags |= CsrThreadAlertable;
@@ -531,7 +546,7 @@ CSR_API(CsrSrvIdentifyAlertableThread)
/*++
* @name CsrSrvSetPriorityClass
- * @implemented NT4
+ * @implemented NT4, up to WinXP
*
* The CsrSrvSetPriorityClass CSR API is deprecated.
*
@@ -543,23 +558,26 @@ CSR_API(CsrSrvIdentifyAlertableThread)
*
* @return STATUS_SUCCESS.
*
- * @remarks None.
+ * @remarks Deprecated.
*
*--*/
CSR_API(CsrSrvSetPriorityClass)
{
+ UNREFERENCED_PARAMETER(ApiMessage);
+ UNREFERENCED_PARAMETER(ReplyCode);
+
/* Deprecated */
return STATUS_SUCCESS;
}
+#endif // (NTDDI_VERSION < NTDDI_WS03)
+
/*++
* @name CsrSrvUnusedFunction
* @implemented NT4
*
* The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
*
- * The CsrSrvSetPriorityClass CSR API is deprecated.
- *
* @param ApiMessage
* Pointer to the CSR API Message for this request.
*
@@ -574,6 +592,9 @@ CSR_API(CsrSrvSetPriorityClass)
*--*/
CSR_API(CsrSrvUnusedFunction)
{
+ UNREFERENCED_PARAMETER(ApiMessage);
+ UNREFERENCED_PARAMETER(ReplyCode);
+
/* Deprecated */
return STATUS_INVALID_PARAMETER;
}