ReactOS 0.4.17-dev-1196-gb6224c3
server.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Client/Server Runtime SubSystem
4 * FILE: subsystems/win32/csrsrv/server.c
5 * PURPOSE: CSR Server DLL Server Functions
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "srv.h"
12
13#include <ndk/mmfuncs.h>
14
15#define NDEBUG
16#include <debug.h>
17
18/* DATA ***********************************************************************/
19
26
28{
29 CsrSrvClientConnect,
30 CsrSrvUnusedFunction, // <= WinNT4: CsrSrvThreadConnect
31 CsrSrvUnusedFunction, // <= WinNT4: CsrSrvProfileControl
32#if (NTDDI_VERSION < NTDDI_WS03)
33 CsrSrvIdentifyAlertableThread
34 CsrSrvSetPriorityClass
35#else
36 CsrSrvUnusedFunction, // <= WinXP : CsrSrvIdentifyAlertableThread
37 CsrSrvUnusedFunction // <= WinXP : CsrSrvSetPriorityClass
38#endif
39};
40
42{
43 TRUE,
44 FALSE,
45 FALSE,
46#if (NTDDI_VERSION < NTDDI_WS03)
47 TRUE,
48 TRUE
49#else
50 FALSE,
51 FALSE
52#endif
53};
54
55/*
56 * On Windows Server 2003, CSR Servers contain
57 * the API Names Table only in Debug Builds.
58 */
59#ifdef CSR_DBG
60PCHAR CsrServerApiNameTable[CsrpMaxApiNumber] =
61{
62 "ClientConnect",
63 "ThreadConnect",
64 "ProfileControl",
65 "IdentifyAlertableThread",
66 "SetPriorityClass"
67};
68#endif
69
70/* PRIVATE FUNCTIONS **********************************************************/
71
72/*++
73 * @name CsrServerDllInitialization
74 * @implemented NT4
75 *
76 * The CsrServerDllInitialization is the initialization routine
77 * for this Server DLL.
78 *
79 * @param LoadedServerDll
80 * Pointer to the CSR Server DLL structure representing this Server DLL.
81 *
82 * @return STATUS_SUCCESS.
83 *
84 * @remarks None.
85 *
86 *--*/
88{
89 /* Setup the DLL Object */
90 LoadedServerDll->ApiBase = CSRSRV_FIRST_API_NUMBER;
91 LoadedServerDll->HighestApiSupported = CsrpMaxApiNumber;
92 LoadedServerDll->DispatchTable = CsrServerApiDispatchTable;
93 LoadedServerDll->ValidTable = CsrServerApiServerValidTable;
94#ifdef CSR_DBG
95 LoadedServerDll->NameTable = CsrServerApiNameTable;
96#endif
97 LoadedServerDll->SizeOfProcessData = 0;
98 LoadedServerDll->ConnectCallback = NULL;
99 LoadedServerDll->DisconnectCallback = NULL;
100
101 /* All done */
102 return STATUS_SUCCESS;
103}
104
105/*++
106 * @name CsrLoadServerDll
107 * @implemented NT4
108 *
109 * The CsrLoadServerDll routine loads a CSR Server DLL and calls its entrypoint.
110 *
111 * @param DllString
112 * Pointer to the CSR Server DLL to load and call.
113 *
114 * @param EntryPoint
115 * Pointer to the name of the server's initialization function.
116 * If this parameter is NULL, the default ServerDllInitialize
117 * will be assumed.
118 *
119 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
120 *
121 * @remarks None.
122 *
123 *--*/
125NTAPI
127 IN PCHAR EntryPoint OPTIONAL,
128 IN ULONG ServerId)
129{
131 ANSI_STRING DllName;
132 UNICODE_STRING TempString, ErrorString;
134 HANDLE hServerDll = NULL;
135 ULONG Size;
136 PCSR_SERVER_DLL ServerDll;
137 STRING EntryPointString;
138 PCSR_SERVER_DLL_INIT_CALLBACK ServerDllInitProcedure;
140
141 /* Check if it's beyond the maximum we support */
142 if (ServerId >= CSR_SERVER_DLL_MAX) return STATUS_TOO_MANY_NAMES;
143
144 /* Check if it's already been loaded */
145 if (CsrLoadedServerDll[ServerId]) return STATUS_INVALID_PARAMETER;
146
147 /* Convert the name to Unicode */
148 ASSERT(DllString != NULL);
149 RtlInitAnsiString(&DllName, DllString);
150 Status = RtlAnsiStringToUnicodeString(&TempString, &DllName, TRUE);
151 if (!NT_SUCCESS(Status)) return Status;
152
153 /* If we are loading ourselves, don't actually load us */
154 if (ServerId != CSRSRV_SERVERDLL_INDEX)
155 {
156 /* Load the DLL */
157 Status = LdrLoadDll(NULL, 0, &TempString, &hServerDll);
158 if (!NT_SUCCESS(Status))
159 {
160 /* Setup error parameters */
161 Parameters[0] = (ULONG_PTR)&TempString;
162 Parameters[1] = (ULONG_PTR)&ErrorString;
163 RtlInitUnicodeString(&ErrorString, L"Default Load Path");
164
165 /* Send a hard error */
167 2,
168 3,
170 OptionOk,
171 &Response);
172 }
173
174 /* Get rid of the string */
175 RtlFreeUnicodeString(&TempString);
176 if (!NT_SUCCESS(Status)) return Status;
177 }
178
179 /* Allocate a CSR DLL Object */
180 Size = sizeof(CSR_SERVER_DLL) + DllName.MaximumLength;
182 if (!ServerDll)
183 {
184 if (hServerDll) LdrUnloadDll(hServerDll);
185 return STATUS_NO_MEMORY;
186 }
187
188 /* Set up the Object */
189 ServerDll->Length = Size;
190 ServerDll->SizeOfProcessData = 0;
191 ServerDll->SharedSection = CsrSrvSharedSectionHeap; // Send to the server dll our shared heap pointer.
192 ServerDll->Name.Length = DllName.Length;
193 ServerDll->Name.MaximumLength = DllName.MaximumLength;
194 ServerDll->Name.Buffer = (PCHAR)(ServerDll + 1);
195 if (DllName.Length)
196 {
197 strncpy(ServerDll->Name.Buffer, DllName.Buffer, DllName.Length);
198 }
199 ServerDll->ServerId = ServerId;
200 ServerDll->ServerHandle = hServerDll;
201
202 /* Now get the entrypoint */
203 if (hServerDll)
204 {
205 /* Initialize a string for the entrypoint, or use the default */
206 RtlInitAnsiString(&EntryPointString,
207 EntryPoint ? EntryPoint : "ServerDllInitialization");
208
209 /* Get a pointer to it */
210 Status = LdrGetProcedureAddress(hServerDll,
211 &EntryPointString,
212 0,
213 (PVOID)&ServerDllInitProcedure);
214 }
215 else
216 {
217 /* No handle, so we are loading ourselves */
218#ifdef CSR_DBG
219 RtlInitAnsiString(&EntryPointString, "CsrServerDllInitialization");
220#endif
221 ServerDllInitProcedure = CsrServerDllInitialization;
223 }
224
225 /* Check if we got the pointer, and call it */
226 if (NT_SUCCESS(Status))
227 {
228 /* Call the Server DLL entrypoint */
230 {
231 Status = ServerDllInitProcedure(ServerDll);
232 }
234 {
236#ifdef CSR_DBG
237 DPRINT1("CSRSS: Exception 0x%lx while calling Server DLL entrypoint %Z!%Z()\n",
238 Status, &DllName, &EntryPointString);
239#endif
240 }
241 _SEH2_END;
242
243 if (NT_SUCCESS(Status))
244 {
245 /*
246 * Add this Server's Per-Process Data Size to the total that each
247 * process will need.
248 */
250
251 /* Save the pointer in our list */
252 CsrLoadedServerDll[ServerDll->ServerId] = ServerDll;
253
254 /* Does it use our generic heap? */
255 if (ServerDll->SharedSection != CsrSrvSharedSectionHeap)
256 {
257 /* No, save the pointer to its shared section in our list */
258 CsrSrvSharedStaticServerData[ServerDll->ServerId] = ServerDll->SharedSection;
259 }
260 }
261 }
262
263 if (!NT_SUCCESS(Status))
264 {
265 /* Server Init failed, unload it */
266 if (hServerDll) LdrUnloadDll(hServerDll);
267
268 /* Delete the Object */
269 RtlFreeHeap(CsrHeap, 0, ServerDll);
270 }
271
272 /* Return to caller */
273 return Status;
274}
275
276/*++
277 * @name CsrSrvClientConnect
278 *
279 * The CsrSrvClientConnect CSR API handles a new connection to a server DLL.
280 *
281 * @param ApiMessage
282 * Pointer to the CSR API Message for this request.
283 *
284 * @param ReplyCode
285 * Optional reply to this request.
286 *
287 * @return STATUS_SUCCESS in case of success, STATUS_INVALID_PARAMETER
288 * or STATUS_TOO_MANY_NAMES in case of failure.
289 *
290 * @remarks None.
291 *
292 *--*/
293CSR_API(CsrSrvClientConnect)
294{
296 PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage->Data.CsrClientConnect;
297 PCSR_SERVER_DLL ServerDll;
298 PCSR_PROCESS CurrentProcess = CsrGetClientThread()->Process;
299
300 /* Set default reply */
301 *ReplyCode = CsrReplyImmediately;
302
303 /* Validate the ServerID */
304 if (ClientConnect->ServerId >= CSR_SERVER_DLL_MAX)
305 {
307 }
308 else if (!CsrLoadedServerDll[ClientConnect->ServerId])
309 {
311 }
312
313 /* Validate the Message Buffer */
314 if (!(CsrValidateMessageBuffer(ApiMessage,
315 &ClientConnect->ConnectionInfo,
316 ClientConnect->ConnectionInfoSize,
317 sizeof(BYTE))))
318 {
319 /* Fail due to buffer overflow or other invalid buffer */
321 }
322
323 /* Load the Server DLL */
324 ServerDll = CsrLoadedServerDll[ClientConnect->ServerId];
325
326 /* Check if it has a Connect Callback */
327 if (ServerDll->ConnectCallback)
328 {
329 /* Call the callback */
330 Status = ServerDll->ConnectCallback(CurrentProcess,
331 ClientConnect->ConnectionInfo,
332 &ClientConnect->ConnectionInfoSize);
333 }
334 else
335 {
336 /* Assume success */
338 }
339
340 /* Return status */
341 return Status;
342}
343
344/*++
345 * @name CsrSrvCreateSharedSection
346 *
347 * The CsrSrvCreateSharedSection creates the Shared Section that all
348 * CSR Server DLLs and Clients can use to share data.
349 *
350 * @param ParameterValue
351 * Specially formatted string from our registry command-line which
352 * specifies various arguments for the shared section.
353 *
354 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
355 *
356 * @remarks None.
357 *
358 *--*/
360NTAPI
362{
363 PCHAR SizeValue = ParameterValue;
364 ULONG Size;
366 LARGE_INTEGER SectionSize;
367 SIZE_T ViewSize = 0;
369
370 /* If there's no parameter, fail */
372
373 /* Find the first comma, and null terminate */
374 while (*SizeValue)
375 {
376 if (*SizeValue == ',')
377 {
378 *SizeValue++ = ANSI_NULL;
379 break;
380 }
381 else
382 {
383 SizeValue++;
384 }
385 }
386
387 /* Make sure it's valid */
388 if (!*SizeValue) return STATUS_INVALID_PARAMETER;
389
390 /* Convert it to an integer */
391 Status = RtlCharToInteger(SizeValue, 0, &Size);
392 if (!NT_SUCCESS(Status)) return Status;
393
394 /* Multiply by 1024 entries and round to page size */
396
397 /* Create the Secion */
398 SectionSize.LowPart = CsrSrvSharedSectionSize;
399 SectionSize.HighPart = 0;
402 NULL,
403 &SectionSize,
406 NULL);
407 if (!NT_SUCCESS(Status)) return Status;
408
409 /* Map the section */
413 0,
414 0,
415 NULL,
416 &ViewSize,
417 ViewUnmap,
420 if (!NT_SUCCESS(Status))
421 {
422 /* Fail */
424 return Status;
425 }
426
427 /* FIXME: Write the value to registry */
428
429 /* The Heap is the same place as the Base */
431
432 /* Create the heap */
436 PAGE_SIZE,
437 0,
438 0)))
439 {
440 /* Failure, unmap section and return */
443 return STATUS_NO_MEMORY;
444 }
445
446 /* Now allocate space from the heap for the Shared Data */
449 CSR_SERVER_DLL_MAX * sizeof(PVOID));
451
452 /* Write the values to the PEB */
454#if (NTDDI_VERSION < NTDDI_LONGHORN)
456#endif
458
459 /* Return */
460 return STATUS_SUCCESS;
461}
462
463/*++
464 * @name CsrSrvAttachSharedSection
465 *
466 * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new
467 * CSR Process' address space, and returns the pointers to the section
468 * through the Connection Info structure.
469 *
470 * @param CsrProcess
471 * Pointer to the CSR Process that is attempting a connection.
472 *
473 * @param ConnectInfo
474 * Pointer to the CSR Connection Info structure for the incoming
475 * connection.
476 *
477 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
478 *
479 * @remarks None.
480 *
481 *--*/
483NTAPI
485 OUT PCSR_API_CONNECTINFO ConnectInfo)
486{
488 SIZE_T ViewSize = 0;
489
490 /* Check if we have a process */
491 if (CsrProcess)
492 {
493 /* Map the section into this process */
495 CsrProcess->ProcessHandle,
497 0,
498 0,
499 NULL,
500 &ViewSize,
501 ViewUnmap,
504 if (!NT_SUCCESS(Status)) return Status;
505 }
506
507 /* Write the values in the Connection Info structure */
508 ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase;
509 ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap;
510 ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData;
511
512 /* Return success */
513 return STATUS_SUCCESS;
514}
515
516#if (NTDDI_VERSION < NTDDI_WS03)
517
518/*++
519 * @name CsrSrvIdentifyAlertableThread
520 * @implemented NT4, up to WinXP
521 *
522 * The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
523 *
524 * @param ApiMessage
525 * Pointer to the CSR API Message for this request.
526 *
527 * @param ReplyCode
528 * Pointer to an optional reply to this request.
529 *
530 * @return STATUS_SUCCESS.
531 *
532 * @remarks Deprecated.
533 *
534 *--*/
535CSR_API(CsrSrvIdentifyAlertableThread)
536{
537 PCSR_THREAD CsrThread = CsrGetClientThread();
538
539 UNREFERENCED_PARAMETER(ApiMessage);
540 UNREFERENCED_PARAMETER(ReplyCode);
541
542 /* Set the alertable flag */
543 CsrThread->Flags |= CsrThreadAlertable;
544
545 /* Return success */
546 return STATUS_SUCCESS;
547}
548
549/*++
550 * @name CsrSrvSetPriorityClass
551 * @implemented NT4, up to WinXP
552 *
553 * The CsrSrvSetPriorityClass CSR API is deprecated.
554 *
555 * @param ApiMessage
556 * Pointer to the CSR API Message for this request.
557 *
558 * @param ReplyCode
559 * Pointer to an optional reply to this request.
560 *
561 * @return STATUS_SUCCESS.
562 *
563 * @remarks Deprecated.
564 *
565 *--*/
566CSR_API(CsrSrvSetPriorityClass)
567{
568 UNREFERENCED_PARAMETER(ApiMessage);
569 UNREFERENCED_PARAMETER(ReplyCode);
570
571 /* Deprecated */
572 return STATUS_SUCCESS;
573}
574
575#endif // (NTDDI_VERSION < NTDDI_WS03)
576
577/*++
578 * @name CsrSrvUnusedFunction
579 * @implemented NT4
580 *
581 * The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
582 *
583 * @param ApiMessage
584 * Pointer to the CSR API Message for this request.
585 *
586 * @param ReplyCode
587 * Pointer to an optional reply to this request.
588 *
589 * @return STATUS_INVALID_PARAMETER.
590 *
591 * @remarks CsrSrvSetPriorityClass does not use this stub because
592 * it must return success.
593 *
594 *--*/
595CSR_API(CsrSrvUnusedFunction)
596{
597 UNREFERENCED_PARAMETER(ApiMessage);
598 UNREFERENCED_PARAMETER(ReplyCode);
599
600 /* Deprecated */
602}
603
604/* PUBLIC FUNCTIONS ***********************************************************/
605
606/*++
607 * @name CsrSetCallingSpooler
608 * @implemented NT4
609 *
610 * the CsrSetCallingSpooler routine is deprecated.
611 *
612 * @param Reserved
613 * Deprecated
614 *
615 * @return None.
616 *
617 * @remarks This routine was used in archaic versions of NT for Printer Drivers.
618 *
619 *--*/
620VOID
621NTAPI
623{
624 /* Deprecated */
625 return;
626}
627
628/*++
629 * @name CsrUnhandledExceptionFilter
630 * @implemented NT5
631 *
632 * The CsrUnhandledExceptionFilter routine handles all exceptions
633 * within SEH-protected blocks.
634 *
635 * @param ExceptionPointers
636 * System-defined Argument.
637 *
638 * @return EXCEPTION_EXECUTE_HANDLER.
639 *
640 * @remarks None.
641 *
642 *--*/
644NTAPI
646{
649 BOOLEAN OldValue;
651 UNICODE_STRING ErrorSource;
652 ULONG_PTR ErrorParameters[4];
654
655 DPRINT1("CsrUnhandledExceptionFilter called\n");
656
657 /* Check if a debugger is installed */
659 &DebuggerInfo,
660 sizeof(DebuggerInfo),
661 NULL);
662
663 /* Check if this is Session 0, and the Debugger is Enabled */
664 if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) &&
665 (DebuggerInfo.KernelDebuggerEnabled))
666 {
667 /* Call the Unhandled Exception Filter */
668 Result = RtlUnhandledExceptionFilter(ExceptionInfo);
670 {
671 /* We're going to raise an error. Get Shutdown Privilege first */
673 TRUE,
674 TRUE,
675 &OldValue);
676
677 /* Use the Process token if that failed */
678 if (Status == STATUS_NO_TOKEN)
679 {
681 TRUE,
682 FALSE,
683 &OldValue);
684 }
685 if (!NT_SUCCESS(Status))
686 {
687 DPRINT1("CsrUnhandledExceptionFilter(): RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE) failed, Status = 0x%08lx\n", Status);
688 goto NoPrivilege;
689 }
690
691 /* Initialize our Name String */
692 RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem");
693
694 /* Set the parameters */
695 ErrorParameters[0] = (ULONG_PTR)&ErrorSource;
696 ErrorParameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
697 ErrorParameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
698 ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
699
700 /* Bugcheck */
702 4,
703 1,
704 ErrorParameters,
706 &Response);
707 }
708
709NoPrivilege:
710 /* Just terminate us */
712 ExceptionInfo->ExceptionRecord->ExceptionCode);
713 }
714
715 return Result;
716}
717
718/* EOF */
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3505
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:3097
NTSTATUS NTAPI NtMapViewOfSection(_In_ HANDLE SectionHandle, _In_ HANDLE ProcessHandle, _Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress, _In_ ULONG_PTR ZeroBits, _In_ SIZE_T CommitSize, _Inout_opt_ PLARGE_INTEGER SectionOffset, _Inout_ PSIZE_T ViewSize, _In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition, _In_ ULONG AllocationType, _In_ ULONG Win32Protect)
Definition: section.c:3278
#define NtCurrentPeb()
Definition: FLS.c:22
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
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: cdrom.h:963
#define CSRSRV_SERVERDLL_INDEX
Definition: csrmsg.h:20
#define CSRSRV_FIRST_API_NUMBER
Definition: csrmsg.h:21
@ CsrpMaxApiNumber
Definition: csrmsg.h:31
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1430
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define CSR_API(n)
Definition: csrsrv.h:176
struct _CSR_SERVER_DLL CSR_SERVER_DLL
NTSTATUS(NTAPI * PCSR_API_ROUTINE)(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
Definition: csrsrv.h:171
NTSTATUS(NTAPI * PCSR_SERVER_DLL_INIT_CALLBACK)(IN PCSR_SERVER_DLL LoadedServerDll)
Definition: csrsrv.h:253
@ CsrReplyImmediately
Definition: csrsrv.h:131
@ CsrThreadAlertable
Definition: csrsrv.h:104
#define CSR_SERVER_DLL_INIT(n)
Definition: csrsrv.h:255
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
#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
enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
ULONG SessionId
Definition: dllmain.c:28
PPEB Peb
Definition: dllmain.c:27
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define ROUND_UP(n, align)
Definition: eventvwr.h:34
@ SystemKernelDebuggerInformation
Definition: ntddk_ex.h:46
std::wstring STRING
Definition: fontsub.cpp:33
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:92
NTSTATUS NTAPI LdrUnloadDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1305
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
Definition: ldrapi.c:312
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
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:573
@ OptionShutdownSystem
Definition: extypes.h:197
@ OptionOk
Definition: extypes.h:192
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:412
#define SEC_NO_CHANGE
Definition: mmtypes.h:95
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
#define MEM_TOP_DOWN
Definition: nt_native.h:1324
#define HEAP_CLASS_7
Definition: nt_native.h:1720
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1310
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1296
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
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 NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define NtCurrentProcess()
Definition: nt_native.h:1660
@ ViewUnmap
Definition: nt_native.h:1282
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3434
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSYSAPI NTSTATUS NTAPI RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value)
Definition: unicode.c:261
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1311
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define ANSI_NULL
#define SEC_BASED
#define STATUS_NO_TOKEN
Definition: ntstatus.h:454
#define STATUS_TOO_MANY_NAMES
Definition: ntstatus.h:535
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:792
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:203
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
strncpy
Definition: string.h:335
LONG NTAPI RtlUnhandledExceptionFilter(_In_ PEXCEPTION_POINTERS ExceptionInfo)
Definition: exception.c:313
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
Definition: ncftp.h:89
USHORT MaximumLength
Definition: env_spec_w32.h:377
ULONG ConnectionInfoSize
Definition: csrmsg.h:87
PVOID ConnectionInfo
Definition: csrmsg.h:86
ANSI_STRING Name
Definition: csrsrv.h:218
PVOID SharedSection
Definition: csrsrv.h:238
ULONG ServerId
Definition: csrsrv.h:220
ULONG Length
Definition: csrsrv.h:217
HANDLE ServerHandle
Definition: csrsrv.h:219
ULONG SizeOfProcessData
Definition: csrsrv.h:234
PCSR_CONNECT_CALLBACK ConnectCallback
Definition: csrsrv.h:235
ULONG Flags
Definition: csrsrv.h:72
PVOID ReadOnlySharedMemoryHeap
Definition: ntddk_ex.h:262
PVOID ReadOnlySharedMemoryBase
Definition: ntddk_ex.h:261
PVOID * ReadOnlyStaticServerData
Definition: ntddk_ex.h:263
ULONG CsrTotalPerProcessDataLength
Definition: init.c:39
NTSTATUS NTAPI CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll)
#define CSR_SERVER_DLL_MAX
Definition: api.h:34
HANDLE CsrHeap
Definition: init.c:25
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:44
EXCEPTION_DISPOSITION NTAPI CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
Definition: server.c:645
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber]
Definition: server.c:41
PCSR_API_ROUTINE CsrServerApiDispatchTable[CsrpMaxApiNumber]
Definition: server.c:27
NTSTATUS NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
Definition: server.c:361
NTSTATUS NTAPI CsrLoadServerDll(IN PCHAR DllString, IN PCHAR EntryPoint OPTIONAL, IN ULONG ServerId)
Definition: server.c:126
NTSTATUS NTAPI CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, OUT PCSR_API_CONNECTINFO ConnectInfo)
Definition: server.c:484
VOID NTAPI CsrSetCallingSpooler(ULONG Reserved)
Definition: server.c:622
ULONG CsrSrvSharedSectionSize
Definition: server.c:24
PVOID CsrSrvSharedSectionHeap
Definition: server.c:21
PVOID * CsrSrvSharedStaticServerData
Definition: server.c:23
HANDLE CsrSrvSharedSection
Definition: server.c:25
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]
Definition: server.c:20
PVOID CsrSrvSharedSectionBase
Definition: server.c:22
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ULONG LowPart
Definition: typedefs.h:106
PKPROCESS CsrProcess
Definition: videoprt.c:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
unsigned char BYTE
Definition: xxhash.c:193