ReactOS  0.4.14-dev-608-gd495a4f
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  ServerDllInitProcedure = CsrServerDllInitialization;
210  }
211 
212  /* Check if we got the pointer, and call it */
213  if (NT_SUCCESS(Status))
214  {
215  /* Get the result from the Server DLL */
216  Status = ServerDllInitProcedure(ServerDll);
217  if (NT_SUCCESS(Status))
218  {
219  /*
220  * Add this Server's Per-Process Data Size to the total that each
221  * process will need.
222  */
224 
225  /* Save the pointer in our list */
226  CsrLoadedServerDll[ServerDll->ServerId] = ServerDll;
227 
228  /* Does it use our generic heap? */
229  if (ServerDll->SharedSection != CsrSrvSharedSectionHeap)
230  {
231  /* No, save the pointer to its shared section in our list */
232  CsrSrvSharedStaticServerData[ServerDll->ServerId] = ServerDll->SharedSection;
233  }
234  }
235  }
236 
237  if (!NT_SUCCESS(Status))
238  {
239  /* Server Init failed, unload it */
240  if (hServerDll) LdrUnloadDll(hServerDll);
241 
242  /* Delete the Object */
243  RtlFreeHeap(CsrHeap, 0, ServerDll);
244  }
245 
246  /* Return to caller */
247  return Status;
248 }
249 
250 /*++
251  * @name CsrSrvClientConnect
252  *
253  * The CsrSrvClientConnect CSR API handles a new connection to a server DLL.
254  *
255  * @param ApiMessage
256  * Pointer to the CSR API Message for this request.
257  *
258  * @param ReplyCode
259  * Optional reply to this request.
260  *
261  * @return STATUS_SUCCESS in case of success, STATUS_INVALID_PARAMETER
262  * or STATUS_TOO_MANY_NAMES in case of failure.
263  *
264  * @remarks None.
265  *
266  *--*/
267 CSR_API(CsrSrvClientConnect)
268 {
270  PCSR_CLIENT_CONNECT ClientConnect = &ApiMessage->Data.CsrClientConnect;
271  PCSR_SERVER_DLL ServerDll;
273 
274  /* Set default reply */
275  *ReplyCode = CsrReplyImmediately;
276 
277  /* Validate the ServerID */
278  if (ClientConnect->ServerId >= CSR_SERVER_DLL_MAX)
279  {
280  return STATUS_TOO_MANY_NAMES;
281  }
282  else if (!CsrLoadedServerDll[ClientConnect->ServerId])
283  {
285  }
286 
287  /* Validate the Message Buffer */
288  if (!(CsrValidateMessageBuffer(ApiMessage,
289  &ClientConnect->ConnectionInfo,
290  ClientConnect->ConnectionInfoSize,
291  sizeof(BYTE))))
292  {
293  /* Fail due to buffer overflow or other invalid buffer */
295  }
296 
297  /* Load the Server DLL */
298  ServerDll = CsrLoadedServerDll[ClientConnect->ServerId];
299 
300  /* Check if it has a Connect Callback */
301  if (ServerDll->ConnectCallback)
302  {
303  /* Call the callback */
305  ClientConnect->ConnectionInfo,
306  &ClientConnect->ConnectionInfoSize);
307  }
308  else
309  {
310  /* Assume success */
312  }
313 
314  /* Return status */
315  return Status;
316 }
317 
318 /*++
319  * @name CsrSrvCreateSharedSection
320  *
321  * The CsrSrvCreateSharedSection creates the Shared Section that all
322  * CSR Server DLLs and Clients can use to share data.
323  *
324  * @param ParameterValue
325  * Specially formatted string from our registry command-line which
326  * specifies various arguments for the shared section.
327  *
328  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
329  *
330  * @remarks None.
331  *
332  *--*/
333 NTSTATUS
334 NTAPI
336 {
337  PCHAR SizeValue = ParameterValue;
338  ULONG Size;
340  LARGE_INTEGER SectionSize;
341  SIZE_T ViewSize = 0;
342  PPEB Peb = NtCurrentPeb();
343 
344  /* If there's no parameter, fail */
346 
347  /* Find the first comma, and null terminate */
348  while (*SizeValue)
349  {
350  if (*SizeValue == ',')
351  {
352  *SizeValue++ = ANSI_NULL;
353  break;
354  }
355  else
356  {
357  SizeValue++;
358  }
359  }
360 
361  /* Make sure it's valid */
362  if (!*SizeValue) return STATUS_INVALID_PARAMETER;
363 
364  /* Convert it to an integer */
365  Status = RtlCharToInteger(SizeValue, 0, &Size);
366  if (!NT_SUCCESS(Status)) return Status;
367 
368  /* Multiply by 1024 entries and round to page size */
370 
371  /* Create the Secion */
372  SectionSize.LowPart = CsrSrvSharedSectionSize;
373  SectionSize.HighPart = 0;
376  NULL,
377  &SectionSize,
380  NULL);
381  if (!NT_SUCCESS(Status)) return Status;
382 
383  /* Map the section */
387  0,
388  0,
389  NULL,
390  &ViewSize,
391  ViewUnmap,
392  MEM_TOP_DOWN,
394  if (!NT_SUCCESS(Status))
395  {
396  /* Fail */
398  return Status;
399  }
400 
401  /* FIXME: Write the value to registry */
402 
403  /* The Heap is the same place as the Base */
405 
406  /* Create the heap */
410  PAGE_SIZE,
411  0,
412  0)))
413  {
414  /* Failure, unmap section and return */
417  return STATUS_NO_MEMORY;
418  }
419 
420  /* Now allocate space from the heap for the Shared Data */
423  CSR_SERVER_DLL_MAX * sizeof(PVOID));
425 
426  /* Write the values to the PEB */
430 
431  /* Return */
432  return STATUS_SUCCESS;
433 }
434 
435 /*++
436  * @name CsrSrvAttachSharedSection
437  *
438  * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new
439  * CSR Process' address space, and returns the pointers to the section
440  * through the Connection Info structure.
441  *
442  * @param CsrProcess
443  * Pointer to the CSR Process that is attempting a connection.
444  *
445  * @param ConnectInfo
446  * Pointer to the CSR Connection Info structure for the incoming
447  * connection.
448  *
449  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
450  *
451  * @remarks None.
452  *
453  *--*/
454 NTSTATUS
455 NTAPI
457  OUT PCSR_API_CONNECTINFO ConnectInfo)
458 {
460  SIZE_T ViewSize = 0;
461 
462  /* Check if we have a process */
463  if (CsrProcess)
464  {
465  /* Map the section into this process */
467  CsrProcess->ProcessHandle,
469  0,
470  0,
471  NULL,
472  &ViewSize,
473  ViewUnmap,
476  if (!NT_SUCCESS(Status)) return Status;
477  }
478 
479  /* Write the values in the Connection Info structure */
480  ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase;
481  ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap;
482  ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData;
483 
484  /* Return success */
485  return STATUS_SUCCESS;
486 }
487 
488 /*++
489  * @name CsrSrvIdentifyAlertableThread
490  * @implemented NT4
491  *
492  * The CsrSrvIdentifyAlertableThread CSR API marks a CSR Thread as alertable.
493  *
494  * @param ApiMessage
495  * Pointer to the CSR API Message for this request.
496  *
497  * @param ReplyCode
498  * Pointer to an optional reply to this request.
499  *
500  * @return STATUS_SUCCESS.
501  *
502  * @remarks None.
503  *
504  *--*/
505 CSR_API(CsrSrvIdentifyAlertableThread)
506 {
507  PCSR_THREAD CsrThread = CsrGetClientThread();
508 
509  /* Set the alertable flag */
510  CsrThread->Flags |= CsrThreadAlertable;
511 
512  /* Return success */
513  return STATUS_SUCCESS;
514 }
515 
516 /*++
517  * @name CsrSrvSetPriorityClass
518  * @implemented NT4
519  *
520  * The CsrSrvSetPriorityClass CSR API is deprecated.
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 None.
531  *
532  *--*/
533 CSR_API(CsrSrvSetPriorityClass)
534 {
535  /* Deprecated */
536  return STATUS_SUCCESS;
537 }
538 
539 /*++
540  * @name CsrSrvUnusedFunction
541  * @implemented NT4
542  *
543  * The CsrSrvUnusedFunction CSR API is a stub for deprecated APIs.
544  *
545  * The CsrSrvSetPriorityClass CSR API is deprecated.
546  *
547  * @param ApiMessage
548  * Pointer to the CSR API Message for this request.
549  *
550  * @param ReplyCode
551  * Pointer to an optional reply to this request.
552  *
553  * @return STATUS_INVALID_PARAMETER.
554  *
555  * @remarks CsrSrvSetPriorityClass does not use this stub because
556  * it must return success.
557  *
558  *--*/
559 CSR_API(CsrSrvUnusedFunction)
560 {
561  /* Deprecated */
563 }
564 
565 /* PUBLIC FUNCTIONS ***********************************************************/
566 
567 /*++
568  * @name CsrSetCallingSpooler
569  * @implemented NT4
570  *
571  * the CsrSetCallingSpooler routine is deprecated.
572  *
573  * @param Reserved
574  * Deprecated
575  *
576  * @return None.
577  *
578  * @remarks This routine was used in archaic versions of NT for Printer Drivers.
579  *
580  *--*/
581 VOID
582 NTAPI
584 {
585  /* Deprecated */
586  return;
587 }
588 
589 /*++
590  * @name CsrUnhandledExceptionFilter
591  * @implemented NT5
592  *
593  * The CsrUnhandledExceptionFilter routine handles all exceptions
594  * within SEH-protected blocks.
595  *
596  * @param ExceptionPointers
597  * System-defined Argument.
598  *
599  * @return EXCEPTION_EXECUTE_HANDLER.
600  *
601  * @remarks None.
602  *
603  *--*/
605 NTAPI
607 {
610  BOOLEAN OldValue;
612  UNICODE_STRING ErrorSource;
613  ULONG_PTR ErrorParameters[4];
614  ULONG Response;
615 
616  DPRINT1("CsrUnhandledExceptionFilter called\n");
617 
618  /* Check if a debugger is installed */
620  &DebuggerInfo,
621  sizeof(DebuggerInfo),
622  NULL);
623 
624  /* Check if this is Session 0, and the Debugger is Enabled */
625  if ((NtCurrentPeb()->SessionId != 0) && (NT_SUCCESS(Status)) &&
626  (DebuggerInfo.KernelDebuggerEnabled))
627  {
628  /* Call the Unhandled Exception Filter */
629  Result = RtlUnhandledExceptionFilter(ExceptionInfo);
631  {
632  /* We're going to raise an error. Get Shutdown Privilege first */
634  TRUE,
635  TRUE,
636  &OldValue);
637 
638  /* Use the Process token if that failed */
639  if (Status == STATUS_NO_TOKEN)
640  {
642  TRUE,
643  FALSE,
644  &OldValue);
645  }
646 
647  /* Initialize our Name String */
648  RtlInitUnicodeString(&ErrorSource, L"Windows SubSystem");
649 
650  /* Set the parameters */
651  ErrorParameters[0] = (ULONG_PTR)&ErrorSource;
652  ErrorParameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
653  ErrorParameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
654  ErrorParameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
655 
656  /* Bugcheck */
658  4,
659  1,
660  ErrorParameters,
662  &Response);
663  }
664 
665  /* Just terminate us */
667  ExceptionInfo->ExceptionRecord->ExceptionCode);
668  }
669 
670  return Result;
671 }
672 
673 /* 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:38
#define CsrGetClientThread()
Definition: csrsrv.h:77
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3782
#define TRUE
Definition: types.h:120
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:456
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 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:1315
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:606
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:33
#define CSR_SERVER_DLL_MAX
Definition: api.h:34
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#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 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
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:346
VOID NTAPI CsrSetCallingSpooler(ULONG Reserved)
Definition: server.c:583
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:1209
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:872
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:104
unsigned char BYTE
Definition: mem.h:68
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:359
Status
Definition: gdiplustypes.h:24
struct _CSR_SERVER_DLL CSR_SERVER_DLL
ULONG_PTR SIZE_T
Definition: typedefs.h:78
LONG NTAPI RtlUnhandledExceptionFilter(IN struct _EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:306
NTSTATUS NTAPI LdrUnloadDll(IN PVOID BaseAddress)
Definition: ldrapi.c:1322
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:246
CSR_SERVER_DLL_INIT(CsrServerDllInitialization)
Definition: server.c:77
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DPRINT1
Definition: precomp.h:8
#define OUT
Definition: typedefs.h:39
_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:335
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 PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
ULONG Flags
Definition: csrsrv.h:72
HANDLE CsrHeap
Definition: init.c:25
#define STATUS_TOO_MANY_NAMES
Definition: ntstatus.h:427
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:2938
BOOLEAN CsrServerApiServerValidTable[CsrpMaxApiNumber]
Definition: server.c:36
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:656
#define SEC_NO_CHANGE
Definition: mmtypes.h:94
CSR_API(CsrSrvClientConnect)
Definition: server.c:267
#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