Skip to content

Commit 7353af1

Browse files
committed
[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/apidispatch.htm 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)!
1 parent d575e82 commit 7353af1

File tree

5 files changed

+75
-42
lines changed

5 files changed

+75
-42
lines changed

dll/ntdll/csr/api.c

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,55 +35,66 @@ CsrNewThread(VOID)
3535
*/
3636
NTSTATUS
3737
NTAPI
38-
CsrSetPriorityClass(HANDLE hProcess,
39-
PULONG PriorityClass)
38+
CsrIdentifyAlertableThread(VOID)
4039
{
40+
#if (NTDDI_VERSION < NTDDI_WS03)
4141
NTSTATUS Status;
4242
CSR_API_MESSAGE ApiMessage;
43-
PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
43+
PCSR_IDENTIFY_ALERTABLE_THREAD IdentifyAlertableThread;
4444

4545
/* Set up the data for CSR */
46-
DbgBreakPoint();
47-
SetPriorityClass->hProcess = hProcess;
48-
SetPriorityClass->PriorityClass = *PriorityClass;
46+
IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread;
47+
IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId;
4948

5049
/* Call it */
5150
Status = CsrClientCallServer(&ApiMessage,
5251
NULL,
53-
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpSetPriorityClass),
54-
sizeof(CSR_SET_PRIORITY_CLASS));
55-
56-
/* Return what we got, if requested */
57-
if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass;
52+
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertableThread),
53+
sizeof(*IdentifyAlertableThread));
5854

5955
/* Return to caller */
6056
return Status;
57+
#else
58+
/* Deprecated */
59+
return STATUS_SUCCESS;
60+
#endif
6161
}
6262

6363
/*
6464
* @implemented
6565
*/
6666
NTSTATUS
6767
NTAPI
68-
CsrIdentifyAlertableThread(VOID)
68+
CsrSetPriorityClass(IN HANDLE Process,
69+
IN OUT PULONG PriorityClass)
6970
{
71+
#if (NTDDI_VERSION < NTDDI_WS03)
7072
NTSTATUS Status;
7173
CSR_API_MESSAGE ApiMessage;
72-
PCSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
74+
PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
7375

7476
/* Set up the data for CSR */
75-
DbgBreakPoint();
76-
IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread;
77-
IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId;
77+
SetPriorityClass->hProcess = Process;
78+
SetPriorityClass->PriorityClass = *PriorityClass;
7879

7980
/* Call it */
8081
Status = CsrClientCallServer(&ApiMessage,
8182
NULL,
82-
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertable),
83-
sizeof(CSR_IDENTIFY_ALTERTABLE_THREAD));
83+
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpSetPriorityClass),
84+
sizeof(*SetPriorityClass));
85+
86+
/* Return what we got, if requested */
87+
if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass;
8488

8589
/* Return to caller */
8690
return Status;
91+
#else
92+
UNREFERENCED_PARAMETER(Process);
93+
UNREFERENCED_PARAMETER(PriorityClass);
94+
95+
/* Deprecated */
96+
return STATUS_INVALID_PARAMETER;
97+
#endif
8798
}
8899

89100
/* EOF */

sdk/include/reactos/subsys/csr/csr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ CsrProbeForWrite(IN PVOID Address,
8080
IN ULONG Length,
8181
IN ULONG Alignment);
8282

83-
NTSTATUS
84-
NTAPI
85-
CsrIdentifyAlertableThread(VOID);
86-
8783
HANDLE
8884
NTAPI
8985
CsrGetProcessId(VOID);
@@ -92,6 +88,10 @@ NTSTATUS
9288
NTAPI
9389
CsrNewThread(VOID);
9490

91+
NTSTATUS
92+
NTAPI
93+
CsrIdentifyAlertableThread(VOID);
94+
9595
NTSTATUS
9696
NTAPI
9797
CsrSetPriorityClass(IN HANDLE Process,

sdk/include/reactos/subsys/csr/csrmsg.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ typedef enum _CSRSRV_API_NUMBER
2525
CsrpClientConnect = CSRSRV_FIRST_API_NUMBER,
2626
CsrpThreadConnect,
2727
CsrpProfileControl,
28-
CsrpIdentifyAlertable,
28+
CsrpIdentifyAlertableThread,
2929
CsrpSetPriorityClass,
3030

3131
CsrpMaxApiNumber
@@ -65,22 +65,20 @@ C_ASSERT(sizeof(CSR_API_CONNECTINFO) == 0x24);
6565
C_ASSERT(sizeof(CSR_API_CONNECTINFO) <= LPC_MAX_DATA_LENGTH);
6666

6767

68-
typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD
68+
#if (NTDDI_VERSION < NTDDI_WS03)
69+
70+
typedef struct _CSR_IDENTIFY_ALERTABLE_THREAD
6971
{
7072
CLIENT_ID Cid;
71-
} CSR_IDENTIFY_ALTERTABLE_THREAD, *PCSR_IDENTIFY_ALTERTABLE_THREAD;
73+
} CSR_IDENTIFY_ALERTABLE_THREAD, *PCSR_IDENTIFY_ALERTABLE_THREAD;
7274

7375
typedef struct _CSR_SET_PRIORITY_CLASS
7476
{
7577
HANDLE hProcess;
7678
ULONG PriorityClass;
7779
} CSR_SET_PRIORITY_CLASS, *PCSR_SET_PRIORITY_CLASS;
7880

79-
typedef struct
80-
{
81-
HANDLE UniqueThread;
82-
CLIENT_ID Cid;
83-
} CSRSS_IDENTIFY_ALERTABLE_THREAD, *PCSRSS_IDENTIFY_ALERTABLE_THREAD;
81+
#endif // (NTDDI_VERSION < NTDDI_WS03)
8482

8583
typedef struct _CSR_CLIENT_CONNECT
8684
{
@@ -114,9 +112,10 @@ typedef struct _CSR_API_MESSAGE
114112
union
115113
{
116114
CSR_CLIENT_CONNECT CsrClientConnect;
115+
#if (NTDDI_VERSION < NTDDI_WS03)
117116
CSR_SET_PRIORITY_CLASS SetPriorityClass;
118-
CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
119-
117+
CSR_IDENTIFY_ALERTABLE_THREAD IdentifyAlertableThread;
118+
#endif
120119
//
121120
// This padding is used to make the CSR_API_MESSAGE structure
122121
// large enough to hold full other API_MESSAGE-type structures

subsystems/win32/csrsrv/api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ extern HANDLE CsrObjectDirectory;
6666

6767
CSR_API(CsrSrvClientConnect);
6868
CSR_API(CsrSrvUnusedFunction);
69+
#if (NTDDI_VERSION < NTDDI_WS03)
6970
CSR_API(CsrSrvIdentifyAlertableThread);
7071
CSR_API(CsrSrvSetPriorityClass);
72+
#endif
7173

7274

7375
NTSTATUS

subsystems/win32/csrsrv/server.c

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,29 @@ HANDLE CsrSrvSharedSection = NULL;
2727
PCSR_API_ROUTINE CsrServerApiDispatchTable[CsrpMaxApiNumber] =
2828
{
2929
CsrSrvClientConnect,
30-
CsrSrvUnusedFunction,
31-
CsrSrvUnusedFunction,
32-
CsrSrvIdentifyAlertableThread,
30+
CsrSrvUnusedFunction, // <= WinNT4: CsrSrvThreadConnect
31+
CsrSrvUnusedFunction, // <= WinNT4: CsrSrvProfileControl
32+
#if (NTDDI_VERSION < NTDDI_WS03)
33+
CsrSrvIdentifyAlertableThread
3334
CsrSrvSetPriorityClass
35+
#else
36+
CsrSrvUnusedFunction, // <= WinXP : CsrSrvIdentifyAlertableThread
37+
CsrSrvUnusedFunction // <= WinXP : CsrSrvSetPriorityClass
38+
#endif
3439
};
3540

3641
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber] =
3742
{
3843
TRUE,
3944
FALSE,
40-
TRUE,
45+
FALSE,
46+
#if (NTDDI_VERSION < NTDDI_WS03)
4147
TRUE,
4248
TRUE
49+
#else
50+
FALSE,
51+
FALSE
52+
#endif
4353
};
4454

4555
/*
@@ -501,9 +511,11 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
501511
return STATUS_SUCCESS;
502512
}
503513

514+
#if (NTDDI_VERSION < NTDDI_WS03)
515+
504516
/*++
505517
* @name CsrSrvIdentifyAlertableThread
506-
* @implemented NT4
518+
* @implemented NT4, up to WinXP
507519
*
508520
* The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
509521
*
@@ -515,13 +527,16 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
515527
*
516528
* @return STATUS_SUCCESS.
517529
*
518-
* @remarks None.
530+
* @remarks Deprecated.
519531
*
520532
*--*/
521533
CSR_API(CsrSrvIdentifyAlertableThread)
522534
{
523535
PCSR_THREAD CsrThread = CsrGetClientThread();
524536

537+
UNREFERENCED_PARAMETER(ApiMessage);
538+
UNREFERENCED_PARAMETER(ReplyCode);
539+
525540
/* Set the alertable flag */
526541
CsrThread->Flags |= CsrThreadAlertable;
527542

@@ -531,7 +546,7 @@ CSR_API(CsrSrvIdentifyAlertableThread)
531546

532547
/*++
533548
* @name CsrSrvSetPriorityClass
534-
* @implemented NT4
549+
* @implemented NT4, up to WinXP
535550
*
536551
* The CsrSrvSetPriorityClass CSR API is deprecated.
537552
*
@@ -543,23 +558,26 @@ CSR_API(CsrSrvIdentifyAlertableThread)
543558
*
544559
* @return STATUS_SUCCESS.
545560
*
546-
* @remarks None.
561+
* @remarks Deprecated.
547562
*
548563
*--*/
549564
CSR_API(CsrSrvSetPriorityClass)
550565
{
566+
UNREFERENCED_PARAMETER(ApiMessage);
567+
UNREFERENCED_PARAMETER(ReplyCode);
568+
551569
/* Deprecated */
552570
return STATUS_SUCCESS;
553571
}
554572

573+
#endif // (NTDDI_VERSION < NTDDI_WS03)
574+
555575
/*++
556576
* @name CsrSrvUnusedFunction
557577
* @implemented NT4
558578
*
559579
* The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
560580
*
561-
* The CsrSrvSetPriorityClass CSR API is deprecated.
562-
*
563581
* @param ApiMessage
564582
* Pointer to the CSR API Message for this request.
565583
*
@@ -574,6 +592,9 @@ CSR_API(CsrSrvSetPriorityClass)
574592
*--*/
575593
CSR_API(CsrSrvUnusedFunction)
576594
{
595+
UNREFERENCED_PARAMETER(ApiMessage);
596+
UNREFERENCED_PARAMETER(ReplyCode);
597+
577598
/* Deprecated */
578599
return STATUS_INVALID_PARAMETER;
579600
}

0 commit comments

Comments
 (0)