ReactOS 0.4.15-dev-7942-gd23573b
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 */
456
457 /* Return */
458 return STATUS_SUCCESS;
459}
460
461/*++
462 * @name CsrSrvAttachSharedSection
463 *
464 * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new
465 * CSR Process' address space, and returns the pointers to the section
466 * through the Connection Info structure.
467 *
468 * @param CsrProcess
469 * Pointer to the CSR Process that is attempting a connection.
470 *
471 * @param ConnectInfo
472 * Pointer to the CSR Connection Info structure for the incoming
473 * connection.
474 *
475 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
476 *
477 * @remarks None.
478 *
479 *--*/
481NTAPI
483 OUT PCSR_API_CONNECTINFO ConnectInfo)
484{
486 SIZE_T ViewSize = 0;
487
488 /* Check if we have a process */
489 if (CsrProcess)
490 {
491 /* Map the section into this process */
493 CsrProcess->ProcessHandle,
495 0,
496 0,
497 NULL,
498 &ViewSize,
499 ViewUnmap,
502 if (!NT_SUCCESS(Status)) return Status;
503 }
504
505 /* Write the values in the Connection Info structure */
506 ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase;
507 ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap;
508 ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData;
509
510 /* Return success */
511 return STATUS_SUCCESS;
512}
513
514#if (NTDDI_VERSION < NTDDI_WS03)
515
516/*++
517 * @name CsrSrvIdentifyAlertableThread
518 * @implemented NT4, up to WinXP
519 *
520 * The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
521 *
522 * @param ApiMessage
523 * Pointer to the CSR API Message for this request.
524 *
525 * @param ReplyCode
526 * Pointer to an optional reply to this request.
527 *
528 * @return STATUS_SUCCESS.
529 *
530 * @remarks Deprecated.
531 *
532 *--*/
533CSR_API(CsrSrvIdentifyAlertableThread)
534{
535 PCSR_THREAD CsrThread = CsrGetClientThread();
536
537 UNREFERENCED_PARAMETER(ApiMessage);
538 UNREFERENCED_PARAMETER(ReplyCode);
539
540 /* Set the alertable flag */
541 CsrThread->Flags |= CsrThreadAlertable;
542
543 /* Return success */
544 return STATUS_SUCCESS;
545}
546
547/*++
548 * @name CsrSrvSetPriorityClass
549 * @implemented NT4, up to WinXP
550 *
551 * The CsrSrvSetPriorityClass CSR API is deprecated.
552 *
553 * @param ApiMessage
554 * Pointer to the CSR API Message for this request.
555 *
556 * @param ReplyCode
557 * Pointer to an optional reply to this request.
558 *
559 * @return STATUS_SUCCESS.
560 *
561 * @remarks Deprecated.
562 *
563 *--*/
564CSR_API(CsrSrvSetPriorityClass)
565{
566 UNREFERENCED_PARAMETER(ApiMessage);
567 UNREFERENCED_PARAMETER(ReplyCode);
568
569 /* Deprecated */
570 return STATUS_SUCCESS;
571}
572
573#endif // (NTDDI_VERSION < NTDDI_WS03)
574
575/*++
576 * @name CsrSrvUnusedFunction
577 * @implemented NT4
578 *
579 * The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
580 *
581 * @param ApiMessage
582 * Pointer to the CSR API Message for this request.
583 *
584 * @param ReplyCode
585 * Pointer to an optional reply to this request.
586 *
587 * @return STATUS_INVALID_PARAMETER.
588 *
589 * @remarks CsrSrvSetPriorityClass does not use this stub because
590 * it must return success.
591 *
592 *--*/
593CSR_API(CsrSrvUnusedFunction)
594{
595 UNREFERENCED_PARAMETER(ApiMessage);
596 UNREFERENCED_PARAMETER(ReplyCode);
597
598 /* Deprecated */
600}
601
602/* PUBLIC FUNCTIONS ***********************************************************/
603
604/*++
605 * @name CsrSetCallingSpooler
606 * @implemented NT4
607 *
608 * the CsrSetCallingSpooler routine is deprecated.
609 *
610 * @param Reserved
611 * Deprecated
612 *
613 * @return None.
614 *
615 * @remarks This routine was used in archaic versions of NT for Printer Drivers.
616 *
617 *--*/
618VOID
619NTAPI
621{
622 /* Deprecated */
623 return;
624}
625
626/*++
627 * @name CsrUnhandledExceptionFilter
628 * @implemented NT5
629 *
630 * The CsrUnhandledExceptionFilter routine handles all exceptions
631 * within SEH-protected blocks.
632 *
633 * @param ExceptionPointers
634 * System-defined Argument.
635 *
636 * @return EXCEPTION_EXECUTE_HANDLER.
637 *
638 * @remarks None.
639 *
640 *--*/
642NTAPI
644{
647 BOOLEAN OldValue;
649 UNICODE_STRING ErrorSource;
650 ULONG_PTR ErrorParameters[4];
652
653 DPRINT1("CsrUnhandledExceptionFilter called\n");
654
655 /* Check if a debugger is installed */
657 &DebuggerInfo,
658 sizeof(DebuggerInfo),
659 NULL);
660
661 /* Check if this is Session 0, and the Debugger is Enabled */
662 if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) &&
663 (DebuggerInfo.KernelDebuggerEnabled))
664 {
665 /* Call the Unhandled Exception Filter */
666 Result = RtlUnhandledExceptionFilter(ExceptionInfo);
668 {
669 /* We're going to raise an error. Get Shutdown Privilege first */
671 TRUE,
672 TRUE,
673 &OldValue);
674
675 /* Use the Process token if that failed */
676 if (Status == STATUS_NO_TOKEN)
677 {
679 TRUE,
680 FALSE,
681 &OldValue);
682 }
683 if (!NT_SUCCESS(Status))
684 {
685 DPRINT1("CsrUnhandledExceptionFilter(): RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE) failed, Status = 0x%08lx\n", Status);
686 goto NoPrivilege;
687 }
688
689 /* Initialize our Name String */
690 RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem");
691
692 /* Set the parameters */
693 ErrorParameters[0] = (ULONG_PTR)&ErrorSource;
694 ErrorParameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
695 ErrorParameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
696 ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
697
698 /* Bugcheck */
700 4,
701 1,
702 ErrorParameters,
704 &Response);
705 }
706
707NoPrivilege:
708 /* Just terminate us */
710 ExceptionInfo->ExceptionRecord->ExceptionCode);
711 }
712
713 return Result;
714}
715
716/* EOF */
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3848
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:3441
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3622
#define NtCurrentPeb()
Definition: FLS.c:22
unsigned char BOOLEAN
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
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:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
_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 NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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 ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define ROUND_UP(n, align)
Definition: eventvwr.h:34
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
@ SystemKernelDebuggerInformation
Definition: ntddk_ex.h:46
std::wstring STRING
Definition: fontsub.cpp:33
Status
Definition: gdiplustypes.h:25
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:85
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
NTSTATUS NTAPI LdrUnloadDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1331
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:829
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
@ OptionShutdownSystem
Definition: extypes.h:192
@ OptionOk
Definition: extypes.h:187
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#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:1321
#define HEAP_CLASS_7
Definition: nt_native.h:1717
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
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:1323
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:1657
@ ViewUnmap
Definition: nt_native.h:1279
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
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:1308
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define ANSI_NULL
#define SEC_BASED
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
#define STATUS_TOO_MANY_NAMES
Definition: ntstatus.h:441
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
#define L(x)
Definition: ntvdm.h:50
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:158
LONG NTAPI RtlUnhandledExceptionFilter(IN struct _EXCEPTION_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:643
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:482
VOID NTAPI CsrSetCallingSpooler(ULONG Reserved)
Definition: server.c:620
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:4533
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_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