ReactOS 0.4.17-dev-1137-g7772194
connect.c
Go to the documentation of this file.
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 - CSR connection and calling
5 * COPYRIGHT: Copyright 2005-2013 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/ldrfuncs.h>
15#include <ndk/lpcfuncs.h>
16#include <ndk/mmfuncs.h>
17#include <ndk/obfuncs.h>
18#include <ndk/umfuncs.h>
19
20#include <csrsrv.h> // For CSR_CSRSS_SECTION_SIZE
21
22#define NDEBUG
23#include <debug.h>
24
25/* GLOBALS ********************************************************************/
26
32
33typedef NTSTATUS
37
39
40/* FUNCTIONS ******************************************************************/
41
42static NTSTATUS
44 _In_ PCWSTR ObjectDirectory)
45{
47 SIZE_T PortNameLength;
49 LARGE_INTEGER CsrSectionViewSize;
50 HANDLE CsrSectionHandle;
51 PORT_VIEW LpcWrite;
52 REMOTE_PORT_VIEW LpcRead;
55 PSID SystemSid = NULL;
56 CSR_API_CONNECTINFO ConnectionInfo;
57 ULONG ConnectionInfoLength = sizeof(ConnectionInfo);
58
59 DPRINT("%s(%S)\n", __FUNCTION__, ObjectDirectory);
60
61 /* Calculate the total port name size */
62 PortNameLength = ((wcslen(ObjectDirectory) + 1) * sizeof(WCHAR)) +
63 sizeof(CSR_PORT_NAME);
64 if (PortNameLength > UNICODE_STRING_MAX_BYTES)
65 {
66 DPRINT1("PortNameLength too big: %Iu\n", PortNameLength);
68 }
69
70 /* Set the port name */
71 PortName.Length = 0;
72 PortName.MaximumLength = (USHORT)PortNameLength;
73
74 /* Allocate a buffer for it */
75 PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, PortNameLength);
76 if (PortName.Buffer == NULL)
77 {
79 }
80
81 /* Create the name */
82 RtlAppendUnicodeToString(&PortName, ObjectDirectory);
85
86 /* Create a section for the port memory */
87 CsrSectionViewSize.QuadPart = CSR_CSRSS_SECTION_SIZE;
88 Status = NtCreateSection(&CsrSectionHandle,
90 NULL,
91 &CsrSectionViewSize,
94 NULL);
95 if (!NT_SUCCESS(Status))
96 {
97 DPRINT1("Failure allocating CSR Section\n");
98 return Status;
99 }
100
101 /* Set up the port view structures to match them with the section */
102 LpcWrite.Length = sizeof(LpcWrite);
103 LpcWrite.SectionHandle = CsrSectionHandle;
104 LpcWrite.SectionOffset = 0;
105 LpcWrite.ViewSize = CsrSectionViewSize.u.LowPart;
106 LpcWrite.ViewBase = 0;
107 LpcWrite.ViewRemoteBase = 0;
108 LpcRead.Length = sizeof(LpcRead);
109 LpcRead.ViewSize = 0;
110 LpcRead.ViewBase = 0;
111
112 /* Setup the QoS */
115 SecurityQos.EffectiveOnly = TRUE;
116
117 /* Setup the connection info */
118 ConnectionInfo.DebugFlags = 0;
119
120 /* Create a SID for us */
122 1,
124 0,
125 0,
126 0,
127 0,
128 0,
129 0,
130 0,
131 &SystemSid);
132 if (!NT_SUCCESS(Status))
133 {
134 /* Failure */
135 DPRINT1("Couldn't allocate SID\n");
136 NtClose(CsrSectionHandle);
137 return Status;
138 }
139
140 /* Connect to the port */
142 &PortName,
143 &SecurityQos,
144 &LpcWrite,
145 SystemSid,
146 &LpcRead,
147 NULL,
148 &ConnectionInfo,
149 &ConnectionInfoLength);
150 RtlFreeSid(SystemSid);
151 NtClose(CsrSectionHandle);
152 if (!NT_SUCCESS(Status))
153 {
154 /* Failure */
155 DPRINT1("Couldn't connect to CSR port\n");
156 return Status;
157 }
158
159 /* Save the delta between the sections, for capture usage later */
161 (ULONG_PTR)LpcWrite.ViewBase;
162
163 /* Save the Process */
164 CsrProcessId = ConnectionInfo.ServerProcessId;
165
166 /* Save CSR Section data */
167 NtCurrentPeb()->ReadOnlySharedMemoryBase = ConnectionInfo.SharedSectionBase;
168#if (NTDDI_VERSION < NTDDI_LONGHORN)
169 NtCurrentPeb()->ReadOnlySharedMemoryHeap = ConnectionInfo.SharedSectionHeap;
170#endif
171 NtCurrentPeb()->ReadOnlyStaticServerData = ConnectionInfo.SharedStaticServerData;
172
173 /* Create the port heap */
175 LpcWrite.ViewBase,
176 LpcWrite.ViewSize,
177 PAGE_SIZE,
178 0,
179 0);
180 if (CsrPortHeap == NULL)
181 {
182 /* Failure */
183 DPRINT1("Couldn't create heap for CSR port\n");
187 }
188
189 /* Return success */
190 return STATUS_SUCCESS;
191}
192
193/*
194 * @implemented
195 */
197NTAPI
199 _In_ PCWSTR ObjectDirectory,
200 _In_ ULONG ServerId,
201 _In_ PVOID ConnectionInfo,
202 _Inout_ PULONG ConnectionInfoSize,
203 _Out_ PBOOLEAN ServerToServerCall)
204{
206 PIMAGE_NT_HEADERS NtHeader;
207
208 DPRINT("CsrClientConnectToServer: %lx %p\n", ServerId, ConnectionInfo);
209
210 /* Validate the Connection Info */
211 if (ConnectionInfo && (!ConnectionInfoSize || !*ConnectionInfoSize))
212 {
213 DPRINT1("Connection info given, but no length\n");
215 }
216
217 /* Check if we're inside a CSR Process */
219 {
220 /* Tell the client that we're already inside CSR */
221 if (ServerToServerCall) *ServerToServerCall = TRUE;
222 return STATUS_SUCCESS;
223 }
224
225 /*
226 * We might be in a CSR Process but not know it, if this is the first call.
227 * So let's find out.
228 */
229 if (!(NtHeader = RtlImageNtHeader(NtCurrentPeb()->ImageBaseAddress)))
230 {
231 /* The image isn't valid */
232 DPRINT1("Invalid image\n");
234 }
236
237 /* Now we can check if we are inside or not */
239 {
240 UNICODE_STRING CsrSrvName;
241 HANDLE hCsrSrv;
242 ANSI_STRING CsrServerRoutineName;
243
244 /* We're inside, so let's find csrsrv */
245 RtlInitUnicodeString(&CsrSrvName, L"csrsrv");
247 NULL,
248 &CsrSrvName,
249 &hCsrSrv);
250
251 /* Now get the Server to Server routine */
252 RtlInitAnsiString(&CsrServerRoutineName, "CsrCallServerFromServer");
254 &CsrServerRoutineName,
255 0L,
257
258 /* Use the local heap as port heap */
259 CsrPortHeap = RtlGetProcessHeap();
260
261 /* Tell the caller we're inside the server */
262 if (ServerToServerCall) *ServerToServerCall = InsideCsrProcess;
263 return STATUS_SUCCESS;
264 }
265
266 /* Now check if connection info is given */
267 if (ConnectionInfo)
268 {
269 CSR_API_MESSAGE ApiMessage;
270 PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage.Data.CsrClientConnect;
271 PCSR_CAPTURE_BUFFER CaptureBuffer;
272
273 /* Well, we're definitely in a client now */
275
276 /* Do we have a connection to CSR yet? */
277 if (!CsrApiPort)
278 {
279 /* No, set it up now */
280 Status = CsrpConnectToServer(ObjectDirectory);
281 if (!NT_SUCCESS(Status))
282 {
283 /* Failed */
284 DPRINT1("Failure to connect to CSR\n");
285 return Status;
286 }
287 }
288
289 /* Setup the connect message header */
290 ClientConnect->ServerId = ServerId;
291 ClientConnect->ConnectionInfoSize = *ConnectionInfoSize;
292
293 /* Setup a buffer for the connection info */
294 CaptureBuffer = CsrAllocateCaptureBuffer(1, ClientConnect->ConnectionInfoSize);
295 if (CaptureBuffer == NULL)
296 {
298 }
299
300 /* Capture the connection info data */
301 CsrCaptureMessageBuffer(CaptureBuffer,
302 ConnectionInfo,
303 ClientConnect->ConnectionInfoSize,
304 &ClientConnect->ConnectionInfo);
305
306 /* Return the allocated length */
307 *ConnectionInfoSize = ClientConnect->ConnectionInfoSize;
308
309 /* Call CSR */
310 Status = CsrClientCallServer(&ApiMessage,
311 CaptureBuffer,
313 sizeof(*ClientConnect));
314
315 /* Copy the updated connection info data back into the user buffer */
316 RtlMoveMemory(ConnectionInfo,
317 ClientConnect->ConnectionInfo,
318 *ConnectionInfoSize);
319
320 /* Free the capture buffer */
321 CsrFreeCaptureBuffer(CaptureBuffer);
322 }
323 else
324 {
325 /* No connection info, just return */
327 }
328
329 /* Let the caller know if this was server to server */
330 DPRINT("Status was: 0x%lx. Are we in server: 0x%x\n", Status, InsideCsrProcess);
331 if (ServerToServerCall) *ServerToServerCall = InsideCsrProcess;
332
333 return Status;
334}
335
336#if 0
337//
338// Structures can be padded at the end, causing the size of the entire structure
339// minus the size of the last field, not to be equal to the offset of the last
340// field.
341//
342typedef struct _TEST_EMBEDDED
343{
344 ULONG One;
345 ULONG Two;
346 ULONG Three;
347} TEST_EMBEDDED;
348
349typedef struct _TEST
350{
352 TEST_EMBEDDED Three;
353} TEST;
354
355C_ASSERT(sizeof(PORT_MESSAGE) == 0x18);
357C_ASSERT(sizeof(TEST_EMBEDDED) == 0xC);
358
359C_ASSERT(sizeof(TEST) != (sizeof(TEST_EMBEDDED) + sizeof(PORT_MESSAGE)));
360C_ASSERT((sizeof(TEST) - sizeof(TEST_EMBEDDED)) != FIELD_OFFSET(TEST, Three));
361#endif
362
363/*
364 * @implemented
365 */
367NTAPI
369 _Inout_ PCSR_API_MESSAGE ApiMessage,
370 _Inout_opt_ PCSR_CAPTURE_BUFFER CaptureBuffer,
371 _In_ CSR_API_NUMBER ApiNumber,
373{
375
376 /* Make sure the length is valid */
377 if (DataLength > (MAXSHORT - sizeof(CSR_API_MESSAGE)))
378 {
379 DPRINT1("DataLength too big: %lu\n", DataLength);
381 }
382
383 /* Fill out the Port Message Header */
384 ApiMessage->Header.u2.ZeroInit = 0;
385 /* DataLength = user_data_size + anything between
386 * header and data, including intermediate padding */
387 ApiMessage->Header.u1.s1.DataLength = (CSHORT)DataLength +
388 FIELD_OFFSET(CSR_API_MESSAGE, Data) - sizeof(ApiMessage->Header);
389 /* TotalLength = header_size + DataLength + any structure trailing padding */
390 ApiMessage->Header.u1.s1.TotalLength = (CSHORT)DataLength +
391 sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data);
392
393 /* Fill out the CSR Header */
394 ApiMessage->ApiNumber = ApiNumber;
395 ApiMessage->CsrCaptureData = NULL;
396
397 DPRINT("API: %lx, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n",
398 ApiNumber,
399 ApiMessage->Header.u1.s1.DataLength,
400 ApiMessage->Header.u1.s1.TotalLength);
401
402 /* Check if we are already inside a CSR Server */
403 if (!InsideCsrProcess)
404 {
405 ULONG PointerCount;
406 PULONG_PTR OffsetPointer;
407
408 /* Check if we got a Capture Buffer */
409 if (CaptureBuffer)
410 {
411 /*
412 * We have to convert from our local (client) view
413 * to the remote (server) view.
414 */
415 ApiMessage->CsrCaptureData = (PCSR_CAPTURE_BUFFER)
416 ((ULONG_PTR)CaptureBuffer + CsrPortMemoryDelta);
417
418 /* Lock the buffer */
419 CaptureBuffer->BufferEnd = NULL;
420
421 /*
422 * Each client pointer inside the CSR message is converted into
423 * a server pointer, and each pointer to these message pointers
424 * is converted into an offset.
425 */
426 PointerCount = CaptureBuffer->PointerCount;
427 OffsetPointer = CaptureBuffer->PointerOffsetsArray;
428 while (PointerCount--)
429 {
430 if (*OffsetPointer != 0)
431 {
432 *(PULONG_PTR)*OffsetPointer += CsrPortMemoryDelta;
433 *OffsetPointer -= (ULONG_PTR)ApiMessage;
434 }
435 ++OffsetPointer;
436 }
437 }
438
439 /* Send the LPC Message */
441 &ApiMessage->Header,
442 &ApiMessage->Header);
443
444 /* Check if we got a Capture Buffer */
445 if (CaptureBuffer)
446 {
447 /*
448 * We have to convert back from the remote (server) view
449 * to our local (client) view.
450 */
451 ApiMessage->CsrCaptureData = (PCSR_CAPTURE_BUFFER)
452 ((ULONG_PTR)ApiMessage->CsrCaptureData - CsrPortMemoryDelta);
453
454 /*
455 * Convert back the offsets into pointers to CSR message
456 * pointers, and convert back these message server pointers
457 * into client pointers.
458 */
459 PointerCount = CaptureBuffer->PointerCount;
460 OffsetPointer = CaptureBuffer->PointerOffsetsArray;
461 while (PointerCount--)
462 {
463 if (*OffsetPointer != 0)
464 {
465 *OffsetPointer += (ULONG_PTR)ApiMessage;
466 *(PULONG_PTR)*OffsetPointer -= CsrPortMemoryDelta;
467 }
468 ++OffsetPointer;
469 }
470 }
471
472 /* Check for success */
473 if (!NT_SUCCESS(Status))
474 {
475 /* We failed. Overwrite the return value with the failure. */
476 DPRINT1("LPC Failed: %lx\n", Status);
477 ApiMessage->Status = Status;
478 }
479 }
480 else
481 {
482 /* This is a server-to-server call */
483 DPRINT("Server-to-server call\n");
484
485 /* Save our CID; we check this equality inside CsrValidateMessageBuffer */
486 ApiMessage->Header.ClientId = NtCurrentTeb()->ClientId;
487
488 /* Do a direct call */
489 Status = CsrServerApiRoutine(ApiMessage, ApiMessage);
490
491 /* Check for success */
492 if (!NT_SUCCESS(Status))
493 {
494 /* We failed. Overwrite the return value with the failure. */
495 ApiMessage->Status = Status;
496 }
497 }
498
499 /* Return the CSR Result */
500 DPRINT("Got back: 0x%lx\n", ApiMessage->Status);
501 return ApiMessage->Status;
502}
503
504/*
505 * @implemented
506 */
507HANDLE
508NTAPI
510{
511 return CsrProcessId;
512}
513
514/* EOF */
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3090
#define NtCurrentPeb()
Definition: FLS.c:22
static UNICODE_STRING PortName
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
@ Three
Definition: card.h:12
@ Two
Definition: card.h:12
#define CSR_CREATE_API_NUMBER(ServerId, ApiId)
Definition: csrmsg.h:37
#define CSRSRV_SERVERDLL_INDEX
Definition: csrmsg.h:20
#define CSR_PORT_NAME
Definition: csrmsg.h:17
ULONG CSR_API_NUMBER
Definition: csrmsg.h:35
struct _CSR_CAPTURE_BUFFER * PCSR_CAPTURE_BUFFER
@ CsrpClientConnect
Definition: csrmsg.h:25
#define CSR_CSRSS_SECTION_SIZE
Definition: csrsrv.h:27
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG DataLength
Definition: dispmprt.h:233
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define NTSTATUS
Definition: precomp.h:19
#define RtlImageNtHeader
Definition: compat.h:806
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define L(x)
Definition: resources.c:13
#define __FUNCTION__
Definition: types.h:116
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
Status
Definition: gdiplustypes.h:24
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define C_ASSERT(e)
Definition: intsafe.h:73
#define NtCurrentTeb
NTSTATUS NTAPI LdrGetDllHandle(_In_opt_ PWSTR DllPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *DllHandle)
Definition: ldrapi.c:770
NTSTATUS NTAPI LdrGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress)
Definition: ldrapi.c:789
@ SecurityImpersonation
Definition: lsa.idl:57
#define TEST(x)
Definition: precomp.h:20
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
#define _Inout_
Definition: no_sal2.h:162
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1296
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define SEC_RESERVE
Definition: nt_native.h:1326
NTSYSAPI PVOID NTAPI RtlCreateHeap(IN ULONG Flags, IN PVOID HeapBase OPTIONAL, IN ULONG ReserveSize OPTIONAL, IN ULONG CommitSize OPTIONAL, IN PVOID Lock OPTIONAL, IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3434
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define UNICODE_STRING_MAX_BYTES
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
Definition: sid.c:290
#define IMAGE_SUBSYSTEM_NATIVE
Definition: ntimage.h:436
NTSTATUS NTAPI NtSecureConnectPort(OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN PSID ServerSid OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
Definition: connect.c:80
NTSTATUS NTAPI NtRequestWaitReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest, IN OUT PPORT_MESSAGE LpcReply)
Definition: send.c:696
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:453
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:592
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
Definition: samrpc.c:14
PCSR_CAPTURE_BUFFER NTAPI CsrAllocateCaptureBuffer(_In_ ULONG ArgumentCount, _In_ ULONG BufferSize)
Definition: capture.c:87
VOID NTAPI CsrFreeCaptureBuffer(_In_ _Frees_ptr_ PCSR_CAPTURE_BUFFER CaptureBuffer)
Definition: capture.c:210
VOID NTAPI CsrCaptureMessageBuffer(_Inout_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_opt_ PVOID MessageBuffer, _In_ ULONG MessageLength, _Out_ PVOID *CapturedData)
Definition: capture.c:189
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
Definition: comm.c:65
HANDLE ServerProcessId
Definition: csrmsg.h:57
PVOID SharedStaticServerData
Definition: csrmsg.h:51
PVOID SharedSectionBase
Definition: csrmsg.h:50
PVOID SharedSectionHeap
Definition: csrmsg.h:52
union _CSR_API_MESSAGE::@4306::@4308::@4310 Data
CSR_CLIENT_CONNECT CsrClientConnect
Definition: csrmsg.h:114
ULONG ConnectionInfoSize
Definition: csrmsg.h:87
PVOID ConnectionInfo
Definition: csrmsg.h:86
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
LPC_PVOID ViewBase
LPC_HANDLE SectionHandle
LPC_PVOID ViewRemoteBase
ULONG SectionOffset
LPC_SIZE_T ViewSize
SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
Definition: lsa.idl:66
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: lsa.idl:65
Definition: tmrqueue.c:14
USHORT MaximumLength
Definition: env_spec_w32.h:370
ULONG_PTR CsrPortMemoryDelta
Definition: connect.c:30
NTSTATUS(NTAPI * PCSR_SERVER_API_ROUTINE)(_In_ PCSR_API_MESSAGE Request, _Inout_ PCSR_API_MESSAGE Reply)
Definition: connect.c:34
HANDLE CsrApiPort
Definition: connect.c:27
HANDLE CsrProcessId
Definition: connect.c:28
HANDLE NTAPI CsrGetProcessId(VOID)
Definition: connect.c:509
static NTSTATUS CsrpConnectToServer(_In_ PCWSTR ObjectDirectory)
Definition: connect.c:43
HANDLE CsrPortHeap
Definition: connect.c:29
NTSTATUS NTAPI CsrClientConnectToServer(_In_ PCWSTR ObjectDirectory, _In_ ULONG ServerId, _In_ PVOID ConnectionInfo, _Inout_ PULONG ConnectionInfoSize, _Out_ PBOOLEAN ServerToServerCall)
Definition: connect.c:198
BOOLEAN InsideCsrProcess
Definition: connect.c:31
PCSR_SERVER_API_ROUTINE CsrServerApiRoutine
Definition: connect.c:38
NTSTATUS NTAPI CsrClientCallServer(_Inout_ PCSR_API_MESSAGE ApiMessage, _Inout_opt_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_ CSR_API_NUMBER ApiNumber, _In_ ULONG DataLength)
Definition: connect.c:368
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define MAXSHORT
Definition: umtypes.h:114
short CSHORT
Definition: umtypes.h:127
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2750 u
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:574
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define SECURITY_DYNAMIC_TRACKING
Definition: setypes.h:103