ReactOS  0.4.15-dev-994-ga9f6032
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,
31  CsrSrvUnusedFunction,
32  CsrSrvIdentifyAlertableThread,
33  CsrSrvSetPriorityClass
34 };
35 
37 {
38  TRUE,
39  FALSE,
40  TRUE,
41  TRUE,
42  TRUE
43 };
44 
45 /*
46  * On Windows Server 2003, CSR Servers contain
47  * the API Names Table only in Debug Builds.
48  */
49 #ifdef CSR_DBG
50 PCHAR CsrServerApiNameTable[CsrpMaxApiNumber] =
51 {
52  "ClientConnect",
53  "ThreadConnect",
54  "ProfileControl",
55  "IdentifyAlertableThread",
56  "SetPriorityClass"
57 };
58 #endif
59 
60 /* PRIVATE FUNCTIONS **********************************************************/
61 
62 /*++
63  * @name CsrServerDllInitialization
64  * @implemented NT4
65  *
66  * The CsrServerDllInitialization is the initialization routine
67  * for this Server DLL.
68  *
69  * @param LoadedServerDll
70  * Pointer to the CSR Server DLL structure representing this Server DLL.
71  *
72  * @return STATUS_SUCCESS.
73  *
74  * @remarks None.
75  *
76  *--*/
78 {
79  /* Setup the DLL Object */
80  LoadedServerDll->ApiBase = CSRSRV_FIRST_API_NUMBER;
81  LoadedServerDll->HighestApiSupported = CsrpMaxApiNumber;
82  LoadedServerDll->DispatchTable = CsrServerApiDispatchTable;
83  LoadedServerDll->ValidTable = CsrServerApiServerValidTable;
84 #ifdef CSR_DBG
85  LoadedServerDll->NameTable = CsrServerApiNameTable;
86 #endif
87  LoadedServerDll->SizeOfProcessData = 0;
88  LoadedServerDll->ConnectCallback = NULL;
89  LoadedServerDll->DisconnectCallback = NULL;
90 
91  /* All done */
92  return STATUS_SUCCESS;
93 }
94 
95 /*++
96  * @name CsrLoadServerDll
97  * @implemented NT4
98  *
99  * The CsrLoadServerDll routine loads a CSR Server DLL and calls its entrypoint.
100  *
101  * @param DllString
102  * Pointer to the CSR Server DLL to load and call.
103  *
104  * @param EntryPoint
105  * Pointer to the name of the server's initialization function.
106  * If this parameter is NULL, the default ServerDllInitialize
107  * will be assumed.
108  *
109  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
110  *
111  * @remarks None.
112  *
113  *--*/
114 NTSTATUS
115 NTAPI
117  IN PCHAR EntryPoint OPTIONAL,
118  IN ULONG ServerId)
119 {
121  ANSI_STRING DllName;
122  UNICODE_STRING TempString, ErrorString;
124  HANDLE hServerDll = NULL;
125  ULONG Size;
126  PCSR_SERVER_DLL ServerDll;
127  STRING EntryPointString;
128  PCSR_SERVER_DLL_INIT_CALLBACK ServerDllInitProcedure;
129  ULONG Response;
130 
131  /* Check if it's beyond the maximum we support */
132  if (ServerId >= CSR_SERVER_DLL_MAX) return STATUS_TOO_MANY_NAMES;
133 
134  /* Check if it's already been loaded */
135  if (CsrLoadedServerDll[ServerId]) return STATUS_INVALID_PARAMETER;
136 
137  /* Convert the name to Unicode */
138  ASSERT(DllString != NULL);
139  RtlInitAnsiString(&DllName, DllString);
140  Status = RtlAnsiStringToUnicodeString(&TempString, &DllName, TRUE);
141  if (!NT_SUCCESS(Status)) return Status;
142 
143  /* If we are loading ourselves, don't actually load us */
144  if (ServerId != CSRSRV_SERVERDLL_INDEX)
145  {
146  /* Load the DLL */
147  Status = LdrLoadDll(NULL, 0, &TempString, &hServerDll);
148  if (!NT_SUCCESS(Status))
149  {
150  /* Setup error parameters */
151  Parameters[0] = (ULONG_PTR)&TempString;
152  Parameters[1] = (ULONG_PTR)&ErrorString;
153  RtlInitUnicodeString(&ErrorString, L"Default Load Path");
154 
155  /* Send a hard error */
157  2,
158  3,
159  Parameters,
160  OptionOk,
161  &Response);
162  }
163 
164  /* Get rid of the string */
165  RtlFreeUnicodeString(&TempString);
166  if (!NT_SUCCESS(Status)) return Status;
167  }
168 
169  /* Allocate a CSR DLL Object */
170  Size = sizeof(CSR_SERVER_DLL) + DllName.MaximumLength;
172  if (!ServerDll)
173  {
174  if (hServerDll) LdrUnloadDll(hServerDll);
175  return STATUS_NO_MEMORY;
176  }
177 
178  /* Set up the Object */
179  ServerDll->Length = Size;
180  ServerDll->SizeOfProcessData = 0;
181  ServerDll->SharedSection = CsrSrvSharedSectionHeap; // Send to the server dll our shared heap pointer.
182  ServerDll->Name.Length = DllName.Length;
183  ServerDll->Name.MaximumLength = DllName.MaximumLength;
184  ServerDll->Name.Buffer = (PCHAR)(ServerDll + 1);
185  if (DllName.Length)
186  {
187  strncpy(ServerDll->Name.Buffer, DllName.Buffer, DllName.Length);
188  }
189  ServerDll->ServerId = ServerId;
190  ServerDll->ServerHandle = hServerDll;
191 
192  /* Now get the entrypoint */
193  if (hServerDll)
194  {
195  /* Initialize a string for the entrypoint, or use the default */
196  RtlInitAnsiString(&EntryPointString,
197  EntryPoint ? EntryPoint : "ServerDllInitialization");
198 
199  /* Get a pointer to it */
200  Status = LdrGetProcedureAddress(hServerDll,
201  &EntryPointString,
202  0,
203  (PVOID)&ServerDllInitProcedure);
204  }
205  else
206  {
207  /* No handle, so we are loading ourselves */
208 #ifdef CSR_DBG
209  RtlInitAnsiString(&EntryPointString, "CsrServerDllInitialization");
210 #endif
211  ServerDllInitProcedure = CsrServerDllInitialization;
213  }
214 
215  /* Check if we got the pointer, and call it */
216  if (NT_SUCCESS(Status))
217  {
218  /* Call the Server DLL entrypoint */
219  _SEH2_TRY
220  {
221  Status = ServerDllInitProcedure(ServerDll);
222  }
224  {
226 #ifdef CSR_DBG
227  DPRINT1("CSRSS: Exception 0x%lx while calling Server DLL entrypoint %Z!%Z()\n",
228  Status, &DllName, &EntryPointString);
229 #endif
230  }
231  _SEH2_END;
232 
233  if (NT_SUCCESS(Status))
234  {
235  /*
236  * Add this Server's Per-Process Data Size to the total that each
237  * process will need.
238  */
240 
241  /* Save the pointer in our list */
242  CsrLoadedServerDll[ServerDll->ServerId] = ServerDll;
243 
244  /* Does it use our generic heap? */
245  if (ServerDll->SharedSection != CsrSrvSharedSectionHeap)
246  {
247  /* No, save the pointer to its shared section in our list */
248  CsrSrvSharedStaticServerData[ServerDll->ServerId] = ServerDll->SharedSection;
249  }
250  }
251  }
252 
253  if (!NT_SUCCESS(Status))
254  {
255  /* Server Init failed, unload it */
256  if (hServerDll) LdrUnloadDll(hServerDll);
257 
258  /* Delete the Object */
259  RtlFreeHeap(CsrHeap, 0, ServerDll);
260  }
261 
262  /* Return to caller */
263  return Status;
264 }
265 
266 /*++
267  * @name CsrSrvClientConnect
268  *
269  * The CsrSrvClientConnect CSR API handles a new connection to a server DLL.
270  *
271  * @param ApiMessage
272  * Pointer to the CSR API Message for this request.
273  *
274  * @param ReplyCode
275  * Optional reply to this request.
276  *
277  * @return STATUS_SUCCESS in case of success, STATUS_INVALID_PARAMETER
278  * or STATUS_TOO_MANY_NAMES in case of failure.
279  *
280  * @remarks None.
281  *
282  *--*/
283 CSR_API(CsrSrvClientConnect)
284 {
286  PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage->Data.CsrClientConnect;
287  PCSR_SERVER_DLL ServerDll;
289 
290  /* Set default reply */
291  *ReplyCode = CsrReplyImmediately;
292 
293  /* Validate the ServerID */
294  if (ClientConnect->ServerId >= CSR_SERVER_DLL_MAX)
295  {
296  return STATUS_TOO_MANY_NAMES;
297  }
298  else if (!CsrLoadedServerDll[ClientConnect->ServerId])
299  {
301  }
302 
303  /* Validate the Message Buffer */
304  if (!(CsrValidateMessageBuffer(ApiMessage,
305  &ClientConnect->ConnectionInfo,
306  ClientConnect->ConnectionInfoSize,
307  sizeof(BYTE))))
308  {
309  /* Fail due to buffer overflow or other invalid buffer */
311  }
312 
313  /* Load the Server DLL */
314  ServerDll = CsrLoadedServerDll[ClientConnect->ServerId];
315 
316  /* Check if it has a Connect Callback */
317  if (ServerDll->ConnectCallback)
318  {
319  /* Call the callback */
321  ClientConnect->ConnectionInfo,
322  &ClientConnect->ConnectionInfoSize);
323  }
324  else
325  {
326  /* Assume success */
328  }
329 
330  /* Return status */
331  return Status;
332 }
333 
334 /*++
335  * @name CsrSrvCreateSharedSection
336  *
337  * The CsrSrvCreateSharedSection creates the Shared Section that all
338  * CSR Server DLLs and Clients can use to share data.
339  *
340  * @param ParameterValue
341  * Specially formatted string from our registry command-line which
342  * specifies various arguments for the shared section.
343  *
344  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
345  *
346  * @remarks None.
347  *
348  *--*/
349 NTSTATUS
350 NTAPI
352 {
353  PCHAR SizeValue = ParameterValue;
354  ULONG Size;
356  LARGE_INTEGER SectionSize;
357  SIZE_T ViewSize = 0;
358  PPEB Peb = NtCurrentPeb();
359 
360  /* If there's no parameter, fail */
362 
363  /* Find the first comma, and null terminate */
364  while (*SizeValue)
365  {
366  if (*SizeValue == ',')
367  {
368  *SizeValue++ = ANSI_NULL;
369  break;
370  }
371  else
372  {
373  SizeValue++;
374  }
375  }
376 
377  /* Make sure it's valid */
378  if (!*SizeValue) return STATUS_INVALID_PARAMETER;
379 
380  /* Convert it to an integer */
381  Status = RtlCharToInteger(SizeValue, 0, &Size);
382  if (!NT_SUCCESS(Status)) return Status;
383 
384  /* Multiply by 1024 entries and round to page size */
386 
387  /* Create the Secion */
388  SectionSize.LowPart = CsrSrvSharedSectionSize;
389  SectionSize.HighPart = 0;
392  NULL,
393  &SectionSize,
396  NULL);
397  if (!NT_SUCCESS(Status)) return Status;
398 
399  /* Map the section */
403  0,
404  0,
405  NULL,
406  &ViewSize,
407  ViewUnmap,
408  MEM_TOP_DOWN,
410  if (!NT_SUCCESS(Status))
411  {
412  /* Fail */
414  return Status;
415  }
416 
417  /* FIXME: Write the value to registry */
418 
419  /* The Heap is the same place as the Base */
421 
422  /* Create the heap */
426  PAGE_SIZE,
427  0,
428  0)))
429  {
430  /* Failure, unmap section and return */
433  return STATUS_NO_MEMORY;
434  }
435 
436  /* Now allocate space from the heap for the Shared Data */
439  CSR_SERVER_DLL_MAX * sizeof(PVOID));
441 
442  /* Write the values to the PEB */
446 
447  /* Return */
448  return STATUS_SUCCESS;
449 }
450 
451 /*++
452  * @name CsrSrvAttachSharedSection
453  *
454  * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new
455  * CSR Process' address space, and returns the pointers to the section
456  * through the Connection Info structure.
457  *
458  * @param CsrProcess
459  * Pointer to the CSR Process that is attempting a connection.
460  *
461  * @param ConnectInfo
462  * Pointer to the CSR Connection Info structure for the incoming
463  * connection.
464  *
465  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
466  *
467  * @remarks None.
468  *
469  *--*/
470 NTSTATUS
471 NTAPI
473  OUT PCSR_API_CONNECTINFO ConnectInfo)
474 {
476  SIZE_T ViewSize = 0;
477 
478  /* Check if we have a process */
479  if (CsrProcess)
480  {
481  /* Map the section into this process */
483  CsrProcess->ProcessHandle,
485  0,
486  0,
487  NULL,
488  &ViewSize,
489  ViewUnmap,
492  if (!NT_SUCCESS(Status)) return Status;
493  }
494 
495  /* Write the values in the Connection Info structure */
496  ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase;
497  ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap;
498  ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData;
499 
500  /* Return success */
501  return STATUS_SUCCESS;
502 }
503 
504 /*++
505  * @name CsrSrvIdentifyAlertableThread
506  * @implemented NT4
507  *
508  * The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
509  *
510  * @param ApiMessage
511  * Pointer to the CSR API Message for this request.
512  *
513  * @param ReplyCode
514  * Pointer to an optional reply to this request.
515  *
516  * @return STATUS_SUCCESS.
517  *
518  * @remarks None.
519  *
520  *--*/
521 CSR_API(CsrSrvIdentifyAlertableThread)
522 {
523  PCSR_THREAD CsrThread = CsrGetClientThread();
524 
525  /* Set the alertable flag */
526  CsrThread->Flags |= CsrThreadAlertable;
527 
528  /* Return success */
529  return STATUS_SUCCESS;
530 }
531 
532 /*++
533  * @name CsrSrvSetPriorityClass
534  * @implemented NT4
535  *
536  * The CsrSrvSetPriorityClass CSR API is deprecated.
537  *
538  * @param ApiMessage
539  * Pointer to the CSR API Message for this request.
540  *
541  * @param ReplyCode
542  * Pointer to an optional reply to this request.
543  *
544  * @return STATUS_SUCCESS.
545  *
546  * @remarks None.
547  *
548  *--*/
549 CSR_API(CsrSrvSetPriorityClass)
550 {
551  /* Deprecated */
552  return STATUS_SUCCESS;
553 }
554 
555 /*++
556  * @name CsrSrvUnusedFunction
557  * @implemented NT4
558  *
559  * The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
560  *
561  * The CsrSrvSetPriorityClass CSR API is deprecated.
562  *
563  * @param ApiMessage
564  * Pointer to the CSR API Message for this request.
565  *
566  * @param ReplyCode
567  * Pointer to an optional reply to this request.
568  *
569  * @return STATUS_INVALID_PARAMETER.
570  *
571  * @remarks CsrSrvSetPriorityClass does not use this stub because
572  * it must return success.
573  *
574  *--*/
575 CSR_API(CsrSrvUnusedFunction)
576 {
577  /* Deprecated */
579 }
580 
581 /* PUBLIC FUNCTIONS ***********************************************************/
582 
583 /*++
584  * @name CsrSetCallingSpooler
585  * @implemented NT4
586  *
587  * the CsrSetCallingSpooler routine is deprecated.
588  *
589  * @param Reserved
590  * Deprecated
591  *
592  * @return None.
593  *
594  * @remarks This routine was used in archaic versions of NT for Printer Drivers.
595  *
596  *--*/
597 VOID
598 NTAPI
600 {
601  /* Deprecated */
602  return;
603 }
604 
605 /*++
606  * @name CsrUnhandledExceptionFilter
607  * @implemented NT5
608  *
609  * The CsrUnhandledExceptionFilter routine handles all exceptions
610  * within SEH-protected blocks.
611  *
612  * @param ExceptionPointers
613  * System-defined Argument.
614  *
615  * @return EXCEPTION_EXECUTE_HANDLER.
616  *
617  * @remarks None.
618  *
619  *--*/
621 NTAPI
623 {
626  BOOLEAN OldValue;
628  UNICODE_STRING ErrorSource;
629  ULONG_PTR ErrorParameters[4];
630  ULONG Response;
631 
632  DPRINT1("CsrUnhandledExceptionFilter called\n");
633 
634  /* Check if a debugger is installed */
636  &DebuggerInfo,
637  sizeof(DebuggerInfo),
638  NULL);
639 
640  /* Check if this is Session 0, and the Debugger is Enabled */
641  if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) &&
642  (DebuggerInfo.KernelDebuggerEnabled))
643  {
644  /* Call the Unhandled Exception Filter */
645  Result = RtlUnhandledExceptionFilter(ExceptionInfo);
647  {
648  /* We're going to raise an error. Get Shutdown Privilege first */
650  TRUE,
651  TRUE,
652  &OldValue);
653 
654  /* Use the Process token if that failed */
655  if (Status == STATUS_NO_TOKEN)
656  {
658  TRUE,
659  FALSE,
660  &OldValue);
661  }
662  if (!NT_SUCCESS(Status))
663  {
664  DPRINT1("CsrUnhandledExceptionFilter(): RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE) failed, Status = 0x%08lx\n", Status);
665  goto NoPrivilege;
666  }
667 
668  /* Initialize our Name String */
669  RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem");
670 
671  /* Set the parameters */
672  ErrorParameters[0] = (ULONG_PTR)&ErrorSource;
673  ErrorParameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
674  ErrorParameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
675  ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
676 
677  /* Bugcheck */
679  4,
680  1,
681  ErrorParameters,
683  &Response);
684  }
685 
686 NoPrivilege:
687  /* Just terminate us */
689  ExceptionInfo->ExceptionRecord->ExceptionCode);
690  }
691 
692  return Result;
693 }
694 
695 /* 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:3782
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
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:3373
NTSTATUS NTAPI CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, OUT PCSR_API_CONNECTINFO ConnectInfo)
Definition: server.c:472
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:553
PVOID CsrSrvSharedSectionHeap
Definition: server.c:21
#define TRUE
Definition: types.h:120
#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:1426
PVOID ReadOnlySharedMemoryHeap
Definition: ntddk_ex.h:262
PVOID ConnectionInfo
Definition: csrmsg.h:88
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:622
NTSTATUS NTAPI CsrLoadServerDll(IN PCHAR DllString, IN PCHAR EntryPoint OPTIONAL, IN ULONG ServerId)
Definition: server.c:116
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 SEC_BASED
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
NTSTATUS NTAPI CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll)
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:11
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:3554
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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
smooth NULL
Definition: ftsmooth.c:416
_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
USHORT MaximumLength
Definition: env_spec_w32.h:377
ULONG CurrentProcess
Definition: shell.c:125
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define HEAP_CLASS_7
Definition: nt_native.h:1717
ULONG ConnectionInfoSize
Definition: csrmsg.h:89
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
VOID NTAPI CsrSetCallingSpooler(ULONG Reserved)
Definition: server.c:599
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Definition: ncftp.h:89
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:40
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
std::wstring STRING
Definition: fontsub.cpp:33
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: classpnp.h:1402
Status
Definition: gdiplustypes.h:24
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:876
static const WCHAR L[]
Definition: oid.c:1250
#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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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:306
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:20
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:77
#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:351
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:6
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
ULONG Flags
Definition: csrsrv.h:72
HANDLE CsrHeap
Definition: init.c:25
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#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
return STATUS_SUCCESS
Definition: btrfs.c:3014
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber]
Definition: server.c:36
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:670
#define SEC_NO_CHANGE
Definition: mmtypes.h:94
CSR_API(CsrSrvClientConnect)
Definition: server.c:283
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]
Definition: server.c:20
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68