Partially implemented (handlers only)
[reactos.git] / reactos / lib / ntdll / csr / api.c
1 /* $Id: api.c,v 1.6 2000/04/25 23:22:55 ea Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/ntdll/csr/api.c
6 * PURPOSE: CSRSS API
7 */
8
9 /* INCLUDES *****************************************************************/
10
11 #include <ddk/ntddk.h>
12 #include <ntdll/csr.h>
13 #include <string.h>
14 #include <internal/ps.h>
15
16 #include <csrss/csrss.h>
17
18 #define NDEBUG
19 #include <ntdll/ntdll.h>
20
21 /* GLOBALS *******************************************************************/
22
23 static HANDLE WindowsApiPort;
24
25 /* FUNCTIONS *****************************************************************/
26
27 NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request,
28 PCSRSS_API_REPLY Reply,
29 ULONG Length,
30 ULONG ReplyLength)
31 {
32 NTSTATUS Status;
33
34 // DbgPrint("CsrClientCallServer(Request %x, Reply %x, Length %d, "
35 // "ReplyLength %d)\n", Request, Reply, Length, ReplyLength);
36
37 Request->Header.DataSize = Length;
38 Request->Header.MessageSize = sizeof(LPC_MESSAGE_HEADER) + Length;
39
40 Status = NtRequestWaitReplyPort(WindowsApiPort,
41 &Request->Header,
42 &Reply->Header);
43
44 // DbgPrint("Status %x\n", Status);
45
46 return(Status);
47 }
48
49 NTSTATUS STDCALL CsrClientConnectToServer(VOID)
50 {
51 NTSTATUS Status;
52 UNICODE_STRING PortName;
53 ULONG ConnectInfoLength;
54 CSRSS_API_REQUEST Request;
55 CSRSS_API_REPLY Reply;
56
57 RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
58 ConnectInfoLength = 0;
59 Status = NtConnectPort(&WindowsApiPort,
60 &PortName,
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 NULL,
66 &ConnectInfoLength);
67 if (!NT_SUCCESS(Status))
68 {
69 return(Status);
70 }
71
72 Request.Type = CSRSS_CONNECT_PROCESS;
73 Status = CsrClientCallServer(&Request,
74 &Reply,
75 sizeof(CSRSS_API_REQUEST),
76 sizeof(CSRSS_API_REPLY));
77 if (!NT_SUCCESS(Status))
78 {
79 return(Status);
80 }
81 if (!NT_SUCCESS(Reply.Status))
82 {
83 return(Reply.Status);
84 }
85 return(STATUS_SUCCESS);
86 }
87
88
89 NTSTATUS
90 STDCALL
91 CsrSetPriorityClass (
92 HANDLE hProcess,
93 DWORD * PriorityClass
94 )
95 {
96 /* FIXME: call csrss to get hProcess' priority */
97 *PriorityClass = PS_PRIORITY_CLASS_NORMAL;
98
99 return (STATUS_NOT_IMPLEMENTED);
100 }
101
102 /* EOF */