xref: /reactos/subsystems/csr/csrlib/api.c (revision 1de09c47)
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 - 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  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "csrlib.h"
12 
13 #define NTOS_MODE_USER
14 #include <ndk/psfuncs.h>
15 
16 #define NDEBUG
17 #include <debug.h>
18 
19 /* FUNCTIONS ******************************************************************/
20 
21 /*
22  * @implemented
23  */
24 NTSTATUS
25 NTAPI
26 CsrNewThread(VOID)
27 {
28     /* Register the termination port to CSR's */
29     return NtRegisterThreadTerminatePort(CsrApiPort);
30 }
31 
32 /*
33  * @implemented
34  */
35 NTSTATUS
36 NTAPI
37 CsrIdentifyAlertableThread(VOID)
38 {
39 #if (NTDDI_VERSION < NTDDI_WS03)
40     NTSTATUS Status;
41     CSR_API_MESSAGE ApiMessage;
42     PCSR_IDENTIFY_ALERTABLE_THREAD IdentifyAlertableThread;
43 
44     /* Set up the data for CSR */
45     IdentifyAlertableThread = &ApiMessage.Data.IdentifyAlertableThread;
46     IdentifyAlertableThread->Cid = NtCurrentTeb()->ClientId;
47 
48     /* Call it */
49     Status = CsrClientCallServer(&ApiMessage,
50                                  NULL,
51                                  CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertableThread),
52                                  sizeof(*IdentifyAlertableThread));
53 
54     /* Return to caller */
55     return Status;
56 #else
57     /* Deprecated */
58     return STATUS_SUCCESS;
59 #endif
60 }
61 
62 /*
63  * @implemented
64  */
65 NTSTATUS
66 NTAPI
67 CsrSetPriorityClass(
68     _In_ HANDLE Process,
69     _Inout_ PULONG PriorityClass)
70 {
71 #if (NTDDI_VERSION < NTDDI_WS03)
72     NTSTATUS Status;
73     CSR_API_MESSAGE ApiMessage;
74     PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
75 
76     /* Set up the data for CSR */
77     SetPriorityClass->hProcess = Process;
78     SetPriorityClass->PriorityClass = *PriorityClass;
79 
80     /* Call it */
81     Status = CsrClientCallServer(&ApiMessage,
82                                  NULL,
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;
88 
89     /* Return to caller */
90     return Status;
91 #else
92     UNREFERENCED_PARAMETER(Process);
93     UNREFERENCED_PARAMETER(PriorityClass);
94 
95     /* Deprecated */
96     return STATUS_INVALID_PARAMETER;
97 #endif
98 }
99 
100 /* EOF */
101