ReactOS  0.4.15-dev-4927-gfe8f806
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
60 PCHAR 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  *--*/
124 NTSTATUS
125 NTAPI
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;
139  ULONG Response;
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,
169  Parameters,
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 */
229  _SEH2_TRY
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  *--*/
293 CSR_API(CsrSrvClientConnect)
294 {
296  PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage->Data.CsrClientConnect;
297  PCSR_SERVER_DLL ServerDll;
299 
300  /* Set default reply */
301  *ReplyCode = CsrReplyImmediately;
302 
303  /* Validate the ServerID */
304  if (ClientConnect->ServerId >= CSR_SERVER_DLL_MAX)
305  {
306  return STATUS_TOO_MANY_NAMES;
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 */
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  *--*/
359 NTSTATUS
360 NTAPI
362 {
363  PCHAR SizeValue = ParameterValue;
364  ULONG Size;
366  LARGE_INTEGER SectionSize;
367  SIZE_T ViewSize = 0;
368  PPEB Peb = NtCurrentPeb();
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,
418  MEM_TOP_DOWN,
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  *--*/
480 NTSTATUS
481 NTAPI
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  *--*/
533 CSR_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  *--*/
564 CSR_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  *--*/
593 CSR_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  *--*/
618 VOID
619 NTAPI
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  *--*/
642 NTAPI
644 {
647  BOOLEAN OldValue;
649  UNICODE_STRING ErrorSource;
650  ULONG_PTR ErrorParameters[4];
651  ULONG Response;
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 
707 NoPrivilege:
708  /* Just terminate us */
710  ExceptionInfo->ExceptionRecord->ExceptionCode);
711  }
712 
713  return Result;
714 }
715 
716 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
NTSYSAPI NTSTATUS NTAPI RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value)
Definition: unicode.c:261
#define IN
Definition: typedefs.h:39
#define CsrGetClientThread()
Definition: csrsrv.h:77
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3861
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
PCSR_CONNECT_CALLBACK ConnectCallback
Definition: csrsrv.h:235
PPEB Peb
Definition: dllmain.c:27
#define ROUND_UP(n, align)
Definition: eventvwr.h:31
ULONG SizeOfProcessData
Definition: csrsrv.h:234
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
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:3454
NTSTATUS NTAPI CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, OUT PCSR_API_CONNECTINFO ConnectInfo)
Definition: server.c:482
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
PVOID CsrSrvSharedSectionHeap
Definition: server.c:21
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
PCSR_API_ROUTINE CsrServerApiDispatchTable[CsrpMaxApiNumber]
Definition: server.c:27
ULONG CsrSrvSharedSectionSize
Definition: server.c:24
ULONG SessionId
Definition: dllmain.c:28
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1430
PVOID ReadOnlySharedMemoryHeap
Definition: ntddk_ex.h:262
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PVOID ConnectionInfo
Definition: csrmsg.h:86
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
ANSI_STRING Name
Definition: csrsrv.h:218
EXCEPTION_DISPOSITION NTAPI CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
Definition: server.c:643
NTSTATUS NTAPI CsrLoadServerDll(IN PCHAR DllString, IN PCHAR EntryPoint OPTIONAL, IN ULONG ServerId)
Definition: server.c:126
ULONG CsrTotalPerProcessDataLength
Definition: init.c:35
PKPROCESS CsrProcess
Definition: videoprt.c:39
#define CSR_SERVER_DLL_MAX
Definition: api.h:34
_SEH2_TRY
Definition: create.c:4226
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
#define SEC_BASED
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
NTSTATUS NTAPI CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll)
#define L(x)
Definition: ntvdm.h:50
PVOID * CsrSrvSharedStaticServerData
Definition: server.c:23
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
#define ANSI_NULL
#define SEC_RESERVE
Definition: nt_native.h:1323
NTSTATUS(NTAPI * PCSR_API_ROUTINE)(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
Definition: csrsrv.h:171
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
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:3635
NTSTATUS NTAPI LdrGetProcedureAddress(IN PVOID BaseAddress, IN PANSI_STRING Name, IN ULONG Ordinal, OUT PVOID *ProcedureAddress)
Definition: ldrapi.c:823
PVOID CsrSrvSharedSectionBase
Definition: server.c:22
unsigned char BOOLEAN
_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:426
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
ULONG ServerId
Definition: csrsrv.h:220
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define PCHAR
Definition: match.c:90
HANDLE ServerHandle
Definition: csrsrv.h:219
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
USHORT MaximumLength
Definition: env_spec_w32.h:377
ULONG CurrentProcess
Definition: shell.c:125
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define HEAP_CLASS_7
Definition: nt_native.h:1717
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
ULONG ConnectionInfoSize
Definition: csrmsg.h:87
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
VOID NTAPI CsrSetCallingSpooler(ULONG Reserved)
Definition: server.c:620
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
Definition: ncftp.h:89
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:40
std::wstring STRING
Definition: fontsub.cpp:33
#define CSRSRV_FIRST_API_NUMBER
Definition: csrmsg.h:21
PVOID SharedSection
Definition: csrsrv.h:238
ULONG LowPart
Definition: typedefs.h:106
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(IN PWSTR SearchPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *BaseAddress)
Definition: ldrapi.c:310
ULONG Length
Definition: csrsrv.h:217
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)
#define PAGE_SIZE
Definition: env_spec_w32.h:49
unsigned char BYTE
Definition: xxhash.c:193
struct _CSR_SERVER_DLL CSR_SERVER_DLL
ULONG_PTR SIZE_T
Definition: typedefs.h:80
LONG NTAPI RtlUnhandledExceptionFilter(IN struct _EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:313
NTSTATUS NTAPI LdrUnloadDll(IN PVOID BaseAddress)
Definition: ldrapi.c:1322
_SEH2_END
Definition: create.c:4400
HANDLE CsrSrvSharedSection
Definition: server.c:25
#define NtCurrentPeb()
Definition: FLS.c:22
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define CSRSRV_SERVERDLL_INDEX
Definition: csrmsg.h:20
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
CSR_SERVER_DLL_INIT(CsrServerDllInitialization)
Definition: server.c:87
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: cdrom.h:960
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DPRINT1
Definition: precomp.h:8
#define OUT
Definition: typedefs.h:40
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
NTSTATUS NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
Definition: server.c:361
unsigned int ULONG
Definition: retypes.h:1
PVOID ReadOnlySharedMemoryBase
Definition: ntddk_ex.h:261
enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct Response Response
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define ULONG_PTR
Definition: config.h:101
PVOID * ReadOnlyStaticServerData
Definition: ntddk_ex.h:263
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
ULONG Flags
Definition: csrsrv.h:72
#define STATUS_SUCCESS
Definition: shellext.h:65
HANDLE CsrHeap
Definition: init.c:25
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define STATUS_TOO_MANY_NAMES
Definition: ntstatus.h:441
NTSTATUS(NTAPI * PCSR_SERVER_DLL_INIT_CALLBACK)(IN PCSR_SERVER_DLL LoadedServerDll)
Definition: csrsrv.h:253
#define MEM_TOP_DOWN
Definition: nt_native.h:1321
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber]
Definition: server.c:41
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
#define SEC_NO_CHANGE
Definition: mmtypes.h:94
CSR_API(CsrSrvClientConnect)
Definition: server.c:293
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]
Definition: server.c:20
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68