xref: /reactos/subsystems/csr/csrlib/api.c (revision d2aeaba5)
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(IN HANDLE Process,
68                     IN OUT PULONG PriorityClass)
69 {
70 #if (NTDDI_VERSION < NTDDI_WS03)
71     NTSTATUS Status;
72     CSR_API_MESSAGE ApiMessage;
73     PCSR_SET_PRIORITY_CLASS SetPriorityClass = &ApiMessage.Data.SetPriorityClass;
74 
75     /* Set up the data for CSR */
76     SetPriorityClass->hProcess = Process;
77     SetPriorityClass->PriorityClass = *PriorityClass;
78 
79     /* Call it */
80     Status = CsrClientCallServer(&ApiMessage,
81                                  NULL,
82                                  CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpSetPriorityClass),
83                                  sizeof(*SetPriorityClass));
84 
85     /* Return what we got, if requested */
86     if (*PriorityClass) *PriorityClass = SetPriorityClass->PriorityClass;
87 
88     /* Return to caller */
89     return Status;
90 #else
91     UNREFERENCED_PARAMETER(Process);
92     UNREFERENCED_PARAMETER(PriorityClass);
93 
94     /* Deprecated */
95     return STATUS_INVALID_PARAMETER;
96 #endif
97 }
98 
99 /* EOF */
100