ReactOS  0.4.14-dev-342-gdc047f9
init.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/init.c
5  * PURPOSE: CSR Server DLL Initialization
6  * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7  * ReactOS Portable Systems Group
8  */
9 
10 /* INCLUDES *******************************************************************/
11 
12 #include "srv.h"
13 
14 #include <winreg.h>
15 #include <ndk/cmfuncs.h>
16 
17 #define NDEBUG
18 #include <debug.h>
19 
20 /* DATA ***********************************************************************/
21 
22 // Debug Flag
23 ULONG CsrDebug = 0; // 0xFFFFFFFF;
24 
41 
42 
43 /* PRIVATE FUNCTIONS **********************************************************/
44 
45 /* === INIT ROUTINES === */
46 
47 /*++
48  * @name CsrSetProcessSecurity
49  *
50  * The CsrSetProcessSecurity routine protects access to the CSRSS process
51  * from unauthorized tampering.
52  *
53  * @param None.
54  *
55  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
56  *
57  * @remarks None.
58  *
59  *--*/
61 NTAPI
63 {
65  HANDLE hToken, hProcess = NtCurrentProcess();
66  ULONG Length;
67  PTOKEN_USER TokenInfo = NULL;
68  PSECURITY_DESCRIPTOR ProcSd = NULL;
69  PACL Dacl;
70  PSID UserSid;
71 
72  /* Open our token */
74  if (!NT_SUCCESS(Status)) goto Quickie;
75 
76  /* Get the Token User Length */
78 
79  /* Allocate space for it */
81  if (!TokenInfo)
82  {
84  goto Quickie;
85  }
86 
87  /* Now query the data */
88  Status = NtQueryInformationToken(hToken, TokenUser, TokenInfo, Length, &Length);
89  NtClose(hToken);
90  if (!NT_SUCCESS(Status)) goto Quickie;
91 
92  /* Now check the SID Length */
93  UserSid = TokenInfo->User.Sid;
94  Length = RtlLengthSid(UserSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
95 
96  /* Allocate a buffer for the Security Descriptor, with SID and DACL */
98  if (!ProcSd)
99  {
101  goto Quickie;
102  }
103 
104  /* Set the pointer to the DACL */
106 
107  /* Now create the SD itself */
109  if (!NT_SUCCESS(Status))
110  {
111  DPRINT1("CSRSS: SD creation failed - status = %lx\n", Status);
112  goto Quickie;
113  }
114 
115  /* Create the DACL for it*/
117  if (!NT_SUCCESS(Status))
118  {
119  DPRINT1("CSRSS: DACL creation failed - status = %lx\n", Status);
120  goto Quickie;
121  }
122 
123  /* Create the ACE */
125  ACL_REVISION,
130  UserSid);
131  if (!NT_SUCCESS(Status))
132  {
133  DPRINT1("CSRSS: ACE creation failed - status = %lx\n", Status);
134  goto Quickie;
135  }
136 
137  /* Clear the DACL in the SD */
139  if (!NT_SUCCESS(Status))
140  {
141  DPRINT1("CSRSS: set DACL failed - status = %lx\n", Status);
142  goto Quickie;
143  }
144 
145  /* Write the SD into the Process */
147  if (!NT_SUCCESS(Status))
148  {
149  DPRINT1("CSRSS: set process DACL failed - status = %lx\n", Status);
150  goto Quickie;
151  }
152 
153  /* Free the memory and return */
154 Quickie:
155  if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd);
156  RtlFreeHeap(CsrHeap, 0, TokenInfo);
157  return Status;
158 }
159 
160 /*++
161  * @name CsrSetDirectorySecurity
162  *
163  * The CsrSetDirectorySecurity routine sets the security descriptor for the
164  * specified Object Directory.
165  *
166  * @param ObjectDirectory
167  * Handle fo the Object Directory to protect.
168  *
169  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
170  *
171  * @remarks None.
172  *
173  *--*/
174 NTSTATUS
175 NTAPI
177 {
178  /* FIXME: Implement */
179  return STATUS_SUCCESS;
180 }
181 
182 /*++
183  * @name GetDosDevicesProtection
184  *
185  * The GetDosDevicesProtection creates a security descriptor for the DOS Devices
186  * Object Directory.
187  *
188  * @param DosDevicesSd
189  * Pointer to the Security Descriptor to return.
190  *
191  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
192  *
193  * @remarks Depending on the DOS Devices Protection Mode (set in the registry),
194  * regular users may or may not have full access to the directory.
195  *
196  *--*/
197 NTSTATUS
198 NTAPI
200 {
204  PSID WorldSid, CreatorSid, AdminSid, SystemSid;
205  UCHAR KeyValueBuffer[0x40];
206  PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
208  ULONG ProtectionMode = 0;
210  PACL Dacl;
212  HANDLE hKey;
214  ULONG ResultLength, SidLength, AclLength;
215 
216  /* Create the SD */
219 
220  /* Initialize the System SID */
223  0, 0, 0, 0, 0, 0, 0,
224  &SystemSid);
226 
227  /* Initialize the World SID */
230  0, 0, 0, 0, 0, 0, 0,
231  &WorldSid);
233 
234  /* Initialize the Admin SID */
238  0, 0, 0, 0, 0, 0,
239  &AdminSid);
241 
242  /* Initialize the Creator SID */
243  Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1,
245  0, 0, 0, 0, 0, 0, 0,
246  &CreatorSid);
248 
249  /* Open the Session Manager Key */
252  &KeyName,
254  NULL,
255  NULL);
257  if (NT_SUCCESS(Status))
258  {
259  /* Read the key value */
260  RtlInitUnicodeString(&KeyName, L"ProtectionMode");
261  Status = NtQueryValueKey(hKey,
262  &KeyName,
264  KeyValueBuffer,
265  sizeof(KeyValueBuffer),
266  &ResultLength);
267 
268  /* Make sure it's what we expect it to be */
269  KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer;
270  if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) &&
271  (*(PULONG)KeyValuePartialInfo->Data))
272  {
273  /* Save the Protection Mode */
274  ProtectionMode = *(PULONG)KeyValuePartialInfo->Data;
275  }
276 
277  /* Close the handle */
278  NtClose(hKey);
279  }
280 
281  /* Check the Protection Mode */
282  if (ProtectionMode & 3)
283  {
284  /* Calculate SID Lengths */
285  SidLength = RtlLengthSid(CreatorSid) + RtlLengthSid(SystemSid) +
287  AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
288 
289  /* Allocate memory for the DACL */
291  ASSERT(Dacl != NULL);
292 
293  /* Build the ACL and add 3 ACEs */
302 
303  /* Edit the ACEs to make them inheritable */
304  Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace);
306  Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
307  Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace);
309  Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
310  Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
313 
314  /* Set this DACL with the SD */
317  goto Quickie;
318  }
319  else
320  {
321  /* Calculate SID Lengths */
322  SidLength = RtlLengthSid(WorldSid) + RtlLengthSid(SystemSid);
323  AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
324 
325  /* Allocate memory for the DACL */
327  ASSERT(Dacl != NULL);
328 
329  /* Build the ACL and add 3 ACEs */
338 
339  /* Edit the last ACE to make it inheritable */
340  Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
343 
344  /* Set this DACL with the SD */
347  goto Quickie;
348  }
349 
350 /* FIXME: failure cases! Fail: */
351  /* Free the memory */
352  RtlFreeHeap(CsrHeap, 0, Dacl);
353 
354 /* FIXME: semi-failure cases! Quickie: */
355 Quickie:
356  /* Free the SIDs */
357  RtlFreeSid(CreatorSid);
360  RtlFreeSid(SystemSid);
361 
362  /* Return */
363  return Status;
364 }
365 
366 /*++
367  * @name FreeDosDevicesProtection
368  *
369  * The FreeDosDevicesProtection frees the security descriptor that was created
370  * by GetDosDevicesProtection
371  *
372  * @param DosDevicesSd
373  * Pointer to the security descriptor to free.
374 
375  * @return None.
376  *
377  * @remarks None.
378  *
379  *--*/
380 VOID
381 NTAPI
383 {
384  PACL Dacl;
385  BOOLEAN Present, Default;
387 
388  /* Get the DACL corresponding to this SD */
389  Status = RtlGetDaclSecurityDescriptor(DosDevicesSd, &Present, &Dacl, &Default);
391  ASSERT(Present);
392  ASSERT(Dacl != NULL);
393 
394  /* Free it */
395  if ((NT_SUCCESS(Status)) && (Dacl)) RtlFreeHeap(CsrHeap, 0, Dacl);
396 }
397 
398 /*++
399  * @name CsrCreateSessionObjectDirectory
400  *
401  * The CsrCreateSessionObjectDirectory routine creates the BaseNamedObjects,
402  * Session and Dos Devices directories for the specified session.
403  *
404  * @param Session
405  * Session ID for which to create the directories.
406  *
407  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
408  *
409  * @remarks None.
410  *
411  *--*/
412 NTSTATUS
413 NTAPI
415 {
416  WCHAR SessionBuffer[512], BnoBuffer[512];
417  UNICODE_STRING SessionString, BnoString;
419  HANDLE BnoHandle;
420  SECURITY_DESCRIPTOR DosDevicesSd;
422 
423  /* Generate the Session BNOLINKS Directory name */
424  swprintf(SessionBuffer, L"%ws\\BNOLINKS", SESSION_ROOT);
425  RtlInitUnicodeString(&SessionString, SessionBuffer);
426 
427  /* Create it */
429  &SessionString,
431  NULL,
432  NULL);
436  if (!NT_SUCCESS(Status))
437  {
438  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
439  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
440  return Status;
441  }
442 
443  /* Now add the Session ID */
444  swprintf(SessionBuffer, L"%ld", Session);
445  RtlInitUnicodeString(&SessionString, SessionBuffer);
446 
447  /* Check if this is the first Session */
448  if (Session)
449  {
450  /* Not the first, so the name will be slighly more complex */
451  swprintf(BnoBuffer, L"%ws\\%ld\\BaseNamedObjects", SESSION_ROOT, Session);
452  RtlInitUnicodeString(&BnoString, BnoBuffer);
453  }
454  else
455  {
456  /* Use the direct name */
457  RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects");
458  }
459 
460  /* Create the symlink */
462  &SessionString,
465  NULL);
466  Status = NtCreateSymbolicLinkObject(&BnoHandle,
469  &BnoString);
470  if (!NT_SUCCESS(Status))
471  {
472  DPRINT1("CSRSS: NtCreateSymbolicLinkObject failed in "
473  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
474  return Status;
475  }
476 
477  /* Create the \DosDevices Security Descriptor */
478  Status = GetDosDevicesProtection(&DosDevicesSd);
479  if (!NT_SUCCESS(Status)) return Status;
480 
481  /* Now create a directory for this session */
482  swprintf(SessionBuffer, L"%ws\\%ld", SESSION_ROOT, Session);
483  RtlInitUnicodeString(&SessionString, SessionBuffer);
484 
485  /* Create the directory */
487  &SessionString,
489  0,
490  &DosDevicesSd);
494  if (!NT_SUCCESS(Status))
495  {
496  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
497  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
498  FreeDosDevicesProtection(&DosDevicesSd);
499  return Status;
500  }
501 
502  /* Next, create a directory for this session's DOS Devices */
503  RtlInitUnicodeString(&SessionString, L"DosDevices");
505  &SessionString,
508  &DosDevicesSd);
512  if (!NT_SUCCESS(Status))
513  {
514  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
515  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
516  }
517 
518  /* Release the Security Descriptor */
519  FreeDosDevicesProtection(&DosDevicesSd);
520 
521  /* Return */
522  return Status;
523 }
524 
525 /*++
526  * @name CsrParseServerCommandLine
527  *
528  * The CsrParseServerCommandLine routine parses the CSRSS command-line in the
529  * registry and performs operations for each entry found.
530  *
531  * @param ArgumentCount
532  * Number of arguments on the command line.
533  *
534  * @param Arguments
535  * Array of arguments.
536  *
537  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
538  *
539  * @remarks None.
540  *
541  *--*/
542 NTSTATUS
543 NTAPI
545  IN PCHAR Arguments[])
546 {
548  PCHAR ParameterName = NULL, ParameterValue = NULL, EntryPoint, ServerString;
549  ULONG i, DllIndex;
552 
553  /* Set the Defaults */
557 
558  /* Save our Session ID, and create a Directory for it */
559  SessionId = NtCurrentPeb()->SessionId;
561  if (!NT_SUCCESS(Status))
562  {
563  DPRINT1("CSRSS: CsrCreateSessionObjectDirectory failed (%lx)\n",
564  Status);
565 
566  /* It's not fatal if the session ID isn't zero */
567  if (SessionId != 0) return Status;
569  }
570 
571  /* Loop through every argument */
572  for (i = 1; i < ArgumentCount; i++)
573  {
574  /* Split Name and Value */
575  ParameterName = Arguments[i];
579  DPRINT("Name=%s, Value=%s\n", ParameterName, ParameterValue);
580 
581  /* Check for Object Directory */
582  if (_stricmp(ParameterName, "ObjectDirectory") == 0)
583  {
584  /* Check if a session ID is specified */
585  if (SessionId != 0)
586  {
587  DPRINT1("Sessions not yet implemented\n");
588  ASSERT(SessionId);
589  }
590 
591  /* Initialize the directory name */
594  &AnsiString,
595  TRUE);
596  ASSERT(NT_SUCCESS(Status) || SessionId != 0);
597  if (!NT_SUCCESS(Status)) return Status;
598 
599  /* Create it */
603  NULL,
604  NULL);
608  if (!NT_SUCCESS(Status)) return Status;
609 
610  /* Secure it */
612  if (!NT_SUCCESS(Status)) return Status;
613  }
614  else if (_stricmp(ParameterName, "SubSystemType") == 0)
615  {
616  /* Ignored */
617  }
618  else if (_stricmp(ParameterName, "MaxRequestThreads") == 0)
619  {
621  0,
623  }
624  else if (_stricmp(ParameterName, "RequestThreads") == 0)
625  {
626  /* Ignored */
628  }
629  else if (_stricmp(ParameterName, "ProfileControl") == 0)
630  {
631  /* Ignored */
632  }
633  else if (_stricmp(ParameterName, "SharedSection") == 0)
634  {
635  /* Create the Section */
637  if (!NT_SUCCESS(Status))
638  {
639  DPRINT1("CSRSS: *** Invalid syntax for %s=%s (Status == %X)\n",
641  return Status;
642  }
643 
644  /* Load us */
645  Status = CsrLoadServerDll("CSRSS" /* "CSRSRV" */, NULL, CSRSRV_SERVERDLL_INDEX);
646  }
647  else if (_stricmp(ParameterName, "ServerDll") == 0)
648  {
649  /* Loop the command line */
650  EntryPoint = NULL;
652  ServerString = ParameterValue;
653  while (*ServerString)
654  {
655  /* Check for the Entry Point */
656  if ((*ServerString == ':') && (!EntryPoint))
657  {
658  /* Found it. Add a nullchar and save it */
659  *ServerString++ = ANSI_NULL;
660  EntryPoint = ServerString;
661  }
662 
663  /* Check for the Dll Index */
664  if (*ServerString++ == ',') break;
665  }
666 
667  /* Did we find something to load? */
668  if (!*ServerString)
669  {
670  DPRINT1("CSRSS: *** Invalid syntax for ServerDll=%s (Status == %X)\n",
672  return Status;
673  }
674 
675  /* Convert it to a ULONG */
676  Status = RtlCharToInteger(ServerString, 10, &DllIndex);
677 
678  /* Add a null char if it was valid */
679  if (NT_SUCCESS(Status)) ServerString[-1] = ANSI_NULL;
680 
681  /* Load it */
682  if (CsrDebug & 1) DPRINT1("CSRSS: Loading ServerDll=%s:%s\n", ParameterValue, EntryPoint);
683  Status = CsrLoadServerDll(ParameterValue, EntryPoint, DllIndex);
684  if (!NT_SUCCESS(Status))
685  {
686  DPRINT1("CSRSS: *** Failed loading ServerDll=%s (Status == 0x%x)\n",
688  return Status;
689  }
690  }
691  else if (_stricmp(ParameterName, "Windows") == 0)
692  {
693  /* Ignored */
694  // Check whether we want to start in pure GUI or pure CLI.
695  }
696  else
697  {
698  /* Invalid parameter on the command line */
700  }
701  }
702 
703  /* Return status */
704  return Status;
705 }
706 
707 /*++
708  * @name CsrInitCsrRootProcess
709  *
710  * The CsrInitCsrRootProcess routine further initializes the CSR Root Process
711  * created by CsrInitializeProcessStructure, by allocating and initializing
712  * per-process data for each Server DLL.
713  *
714  * @param None.
715  *
716  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
717  *
718  * @remarks None.
719  *
720  *--*/
721 NTSTATUS
722 NTAPI
724 {
725  PVOID ProcessData;
726  PCSR_SERVER_DLL ServerDll;
727  ULONG i = 0;
728 
729  /* All Server DLLs are now loaded, allocate a heap for the Root Process */
730  ProcessData = RtlAllocateHeap(CsrHeap,
733  if (!ProcessData)
734  {
735  DPRINT1("CSRSRV:%s: RtlAllocateHeap failed (Status=%08lx)\n",
737  return STATUS_NO_MEMORY;
738  }
739 
740  /*
741  * Our Root Process was never officially initialized,
742  * so write the data for each Server DLL manually.
743  */
744 
745  /* Loop every DLL */
746  for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
747  {
748  /* Get the current Server */
749  ServerDll = CsrLoadedServerDll[i];
750 
751  /* Is it loaded, and does it have per process data? */
752  if (ServerDll && ServerDll->SizeOfProcessData)
753  {
754  /* It does, give it part of our allocated heap */
755  CsrRootProcess->ServerData[i] = ProcessData;
756 
757  /* Move to the next heap position */
758  ProcessData = (PVOID)((ULONG_PTR)ProcessData +
759  ServerDll->SizeOfProcessData);
760  }
761  else
762  {
763  /* Nothing for this Server DLL */
765  }
766  }
767 
768  /* Now initialize the Root Process manually as well */
769  for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
770  {
771  /* Get the current Server */
772  ServerDll = CsrLoadedServerDll[i];
773 
774  /* Is it loaded, and does it a callback for new processes? */
775  if (ServerDll && ServerDll->NewProcessCallback)
776  {
777  /* Call the callback */
779  }
780  }
781 
782  return STATUS_SUCCESS;
783 }
784 
785 /*++
786  * @name CsrCreateLocalSystemSD
787  *
788  * The CsrCreateLocalSystemSD routine creates a Security Descriptor for
789  * the local account with PORT_ALL_ACCESS.
790  *
791  * @param LocalSystemSd
792  * Pointer to a pointer to the security descriptor to create.
793  *
794  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
795  *
796  * @remarks None.
797  *
798  *--*/
799 NTSTATUS
800 NTAPI
802 {
804  PSID SystemSid;
805  ULONG Length;
806  PSECURITY_DESCRIPTOR SystemSd;
807  PACL Dacl;
809 
810  /* Initialize the System SID */
813  0, 0, 0, 0, 0, 0, 0,
814  &SystemSid);
815 
816  /* Get the length of the SID */
817  Length = RtlLengthSid(SystemSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
818 
819  /* Allocate a buffer for the Security Descriptor, with SID and DACL */
821 
822  /* Set the pointer to the DACL */
824 
825  /* Now create the SD itself */
827  if (!NT_SUCCESS(Status)) goto Quit;
828 
829  /* Create the DACL for it */
831 
832  /* Create the ACE */
834  if (!NT_SUCCESS(Status)) goto Quit;
835 
836  /* Clear the DACL in the SD */
838  if (!NT_SUCCESS(Status)) goto Quit;
839 
840 Quit:
841  if (!NT_SUCCESS(Status))
842  {
843  RtlFreeHeap(CsrHeap, 0, SystemSd);
844  SystemSd = NULL;
845  }
846 
847  /* Free the SID and return*/
848  RtlFreeSid(SystemSid);
849  *LocalSystemSd = SystemSd;
850  return Status;
851 }
852 
853 /*++
854  * @name CsrSbApiPortInitialize
855  *
856  * The CsrSbApiPortInitialize routine initializes the LPC Port used for
857  * communications with the Session Manager (SM) and initializes the static
858  * thread that will handle connection requests and APIs.
859  *
860  * @param None
861  *
862  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
863  *
864  * @remarks None.
865  *
866  *--*/
867 NTSTATUS
868 NTAPI
870 {
871  ULONG Size;
872  PSECURITY_DESCRIPTOR PortSd;
875  HANDLE hRequestThread;
877 
878  /* Calculate how much space we'll need for the Port Name */
879  Size = CsrDirectoryName.Length + sizeof(SB_PORT_NAME) + sizeof(WCHAR);
880 
881  /* Create the buffer for it */
884 
885  /* Setup the rest of the empty string */
888 
889  /* Now append the full port name */
893  if (CsrDebug & 2) DPRINT1("CSRSS: Creating %wZ port and associated thread\n", &CsrSbApiPortName);
894 
895  /* Create Security Descriptor for this Port */
896  Status = CsrCreateLocalSystemSD(&PortSd);
897  if (!NT_SUCCESS(Status)) return Status;
898 
899  /* Initialize the Attributes */
902  0,
903  NULL,
904  PortSd);
905 
906  /* Create the Port Object */
909  sizeof(SB_CONNECTION_INFO),
910  sizeof(SB_API_MSG),
911  32 * sizeof(SB_API_MSG));
912  if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd);
913 
914  if (NT_SUCCESS(Status))
915  {
916  /* Create the Thread to handle the API Requests */
918  NULL,
919  TRUE,
920  0,
921  0,
922  0,
924  NULL,
925  &hRequestThread,
926  &ClientId);
927  if (NT_SUCCESS(Status))
928  {
929  /* Add it as a Static Server Thread */
931  &ClientId,
932  0);
933 
934  /* Activate it */
935  Status = NtResumeThread(hRequestThread, NULL);
936  }
937  }
938 
939  return Status;
940 }
941 
942 
943 /* PUBLIC FUNCTIONS ***********************************************************/
944 
945 /*++
946  * @name CsrServerInitialization
947  * @implemented NT4
948  *
949  * The CsrServerInitialization routine is the native (not Server) entrypoint
950  * of this Server DLL. It serves as the entrypoint for CSRSS.
951  *
952  * @param ArgumentCount
953  * Number of arguments on the command line.
954  *
955  * @param Arguments
956  * Array of arguments from the command line.
957  *
958  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
959  *
960  * @remarks None.
961  *
962  *--*/
963 NTSTATUS
964 NTAPI
966  IN PCHAR Arguments[])
967 {
969 
970  /* Cache System Basic Information so we don't always request it */
972  &CsrNtSysInfo,
973  sizeof(SYSTEM_BASIC_INFORMATION),
974  NULL);
975  if (!NT_SUCCESS(Status))
976  {
977  DPRINT1("CSRSRV:%s: NtQuerySystemInformation failed (Status=0x%08lx)\n",
979  return Status;
980  }
981 
982  /* Save our Heap */
983  CsrHeap = RtlGetProcessHeap();
984 
985  /* Set our Security Descriptor to protect the process */
987  if (!NT_SUCCESS(Status))
988  {
989  DPRINT1("CSRSRV:%s: CsrSetProcessSecurity failed (Status=0x%08lx)\n",
991  return Status;
992  }
993 
994  /* Set up Session Support */
996  if (!NT_SUCCESS(Status))
997  {
998  DPRINT1("CSRSRV:%s: CsrInitializeSessions failed (Status=0x%08lx)\n",
1000  return Status;
1001  }
1002 
1003  /* Set up Process Support and allocate the CSR Root Process */
1005  if (!NT_SUCCESS(Status))
1006  {
1007  DPRINT1("CSRSRV:%s: CsrInitializeProcessStructure failed (Status=0x%08lx)\n",
1008  __FUNCTION__, Status);
1009  return Status;
1010  }
1011 
1012  /* Parse the command line */
1013  Status = CsrParseServerCommandLine(ArgumentCount, Arguments);
1014  if (!NT_SUCCESS(Status))
1015  {
1016  DPRINT1("CSRSRV:%s: CsrParseServerCommandLine failed (Status=0x%08lx)\n",
1017  __FUNCTION__, Status);
1018  return Status;
1019  }
1020 
1021  /* Finish to initialize the CSR Root Process */
1023  if (!NT_SUCCESS(Status))
1024  {
1025  DPRINT1("CSRSRV:%s: CsrInitCsrRootProcess failed (Status=0x%08lx)\n",
1026  __FUNCTION__, Status);
1027  return Status;
1028  }
1029 
1030  /* Now initialize our API Port */
1032  if (!NT_SUCCESS(Status))
1033  {
1034  DPRINT1("CSRSRV:%s: CsrApiPortInitialize failed (Status=0x%08lx)\n",
1035  __FUNCTION__, Status);
1036  return Status;
1037  }
1038 
1039  /* Initialize the API Port for SM communication */
1041  if (!NT_SUCCESS(Status))
1042  {
1043  DPRINT1("CSRSRV:%s: CsrSbApiPortInitialize failed (Status=0x%08lx)\n",
1044  __FUNCTION__, Status);
1045  return Status;
1046  }
1047 
1048  /* We're all set! Connect to SM! */
1050  CsrSbApiPort,
1052  &CsrSmApiPort);
1053  if (!NT_SUCCESS(Status))
1054  {
1055  DPRINT1("CSRSRV:%s: SmConnectToSm failed (Status=0x%08lx)\n",
1056  __FUNCTION__, Status);
1057  return Status;
1058  }
1059 
1060  /* Have us handle Hard Errors */
1062  if (!NT_SUCCESS(Status))
1063  {
1064  DPRINT1("CSRSRV:%s: NtSetDefaultHardErrorPort failed (Status=0x%08lx)\n",
1065  __FUNCTION__, Status);
1066  return Status;
1067  }
1068 
1069  /* Return status */
1070  return Status;
1071 }
1072 
1073 /*++
1074  * @name CsrPopulateDosDevices
1075  * @unimplemented NT5.1
1076  *
1077  * The CsrPopulateDosDevices routine uses the DOS Device Map from the Kernel
1078  * to populate the Dos Devices Object Directory for the session.
1079  *
1080  * @param None.
1081  *
1082  * @return None.
1083  *
1084  * @remarks None.
1085  *
1086  *--*/
1087 VOID
1088 NTAPI
1090 {
1091  DPRINT1("Deprecated API in r55585.\n");
1092  return;
1093 }
1094 
1095 BOOL
1096 NTAPI
1097 DllMain(IN HINSTANCE hInstanceDll,
1098  IN DWORD dwReason,
1099  IN LPVOID lpReserved)
1100 {
1101  /* We don't do much */
1102  UNREFERENCED_PARAMETER(hInstanceDll);
1104  UNREFERENCED_PARAMETER(lpReserved);
1105 
1106  return TRUE;
1107 }
1108 
1109 /* EOF */
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
signed char * PCHAR
Definition: retypes.h:7
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSYSAPI NTSTATUS NTAPI RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value)
Definition: unicode.c:261
#define IN
Definition: typedefs.h:38
#define GENERIC_ALL
Definition: nt_native.h:92
NTSTATUS NTAPI CsrParseServerCommandLine(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:544
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:546
#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)
NTSTATUS NTAPI CsrInitializeProcessStructure(VOID)
Definition: procsup.c:254
ULONG SizeOfProcessData
Definition: csrsrv.h:234
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:761
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:158
USHORT MaximumLength
Definition: env_spec_w32.h:370
static PSID AdminSid
Definition: msgina.c:39
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS NTAPI GetDosDevicesProtection(OUT PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:199
#define SB_PORT_NAME
Definition: srv.h:47
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
LONG NTSTATUS
Definition: precomp.h:26
static SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: security.c:14
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define SM_REG_KEY
Definition: basesrv.h:73
PCSR_THREAD CsrSbApiRequestThreadPtr
Definition: init.c:30
NTSTATUS NTAPI CsrSetDirectorySecurity(IN HANDLE ObjectDirectory)
Definition: init.c:176
#define OBJ_PERMANENT
Definition: winternl.h:226
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSTATUS NTAPI CsrSetProcessSecurity(VOID)
Definition: init.c:62
NTSYSAPI NTSTATUS NTAPI RtlGetAce(PACL Acl, ULONG AceIndex, PVOID *Ace)
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
NTSTATUS NTAPI NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
Definition: harderr.c:742
NTSTATUS NTAPI NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle)
Definition: security.c:350
VOID NTAPI CsrSbApiRequestThread(IN PVOID Parameter)
Definition: session.c:484
#define PROCESS_SUSPEND_RESUME
Definition: pstypes.h:159
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
Definition: sid.c:290
VOID NTAPI CsrPopulateDosDevices(VOID)
Definition: init.c:1089
#define _stricmp
Definition: cat.c:22
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1267
#define CSR_SERVER_DLL_MAX
Definition: api.h:34
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSTATUS NTAPI CsrServerInitialization(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:965
NTSYSAPI NTSTATUS NTAPI RtlGetDaclSecurityDescriptor(_In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Out_ PBOOLEAN DaclPresent, _Out_ PACL *Dacl, _Out_ PBOOLEAN DaclDefaulted)
VOID NTAPI FreeDosDevicesProtection(IN PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:382
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
PCSR_PROCESS CsrRootProcess
Definition: procsup.c:22
DWORD dwReason
Definition: misc.cpp:154
#define OBJ_OPENIF
Definition: winternl.h:229
NTSTATUS NTAPI CsrSbApiPortInitialize(VOID)
Definition: init.c:869
HANDLE CsrObjectDirectory
Definition: init.c:26
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
UNICODE_STRING CsrSbApiPortName
Definition: init.c:28
PCSR_THREAD NTAPI CsrAddStaticServerThread(IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags)
Definition: thredsup.c:511
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define ANSI_NULL
HANDLE DosDevicesDirectory
Definition: init.c:39
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PROCESS_DUP_HANDLE
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: card.h:12
unsigned char BOOLEAN
#define ACL_REVISION2
Definition: setypes.h:43
struct _ACL ACL
smooth NULL
Definition: ftsmooth.c:416
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
Definition: samrpc.c:14
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Definition: token.c:1839
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:40
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
Definition: server.c:335
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
void * PVOID
Definition: retypes.h:9
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
NTSTATUS NTAPI CsrCreateSessionObjectDirectory(IN ULONG Session)
Definition: init.c:414
#define NtCurrentProcess()
Definition: nt_native.h:1657
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
struct _ACL * PACL
Definition: security.c:104
#define CONTAINER_INHERIT_ACE
Definition: setypes.h:715
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
#define PROCESS_VM_WRITE
Definition: pstypes.h:154
NTSTATUS NTAPI NtCreatePort(OUT PHANDLE PortHandle, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG MaxConnectInfoLength, IN ULONG MaxDataLength, IN ULONG MaxPoolUsage)
Definition: create.c:212
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
PVOID ServerData[ANYSIZE_ARRAY]
Definition: csrsrv.h:60
#define TOKEN_QUERY
Definition: setypes.h:874
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SECURITY_WORLD_SID_AUTHORITY
Definition: setypes.h:499
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
ULONG ProtectionMode
Definition: init.c:34
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG CsrMaxApiRequestThreads
Definition: init.c:34
NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
NTSTATUS NTAPI CsrInitCsrRootProcess(VOID)
Definition: init.c:723
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define SECURITY_WORLD_RID
Definition: setypes.h:513
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define READ_CONTROL
Definition: nt_native.h:58
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SECURITY_CREATOR_OWNER_RID
Definition: setypes.h:517
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: classpnp.h:1209
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1553
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd)
Definition: init.c:801
static const WCHAR L[]
Definition: oid.c:1250
PSID WorldSid
Definition: globals.c:15
HANDLE SessionObjectDirectory
Definition: init.c:38
#define GENERIC_READ
Definition: compat.h:124
NTSYSAPI NTSTATUS NTAPI RtlCreateUserThread(_In_ PVOID ThreadContext, _Out_ HANDLE *OutThreadHandle, _Reserved_ PVOID Reserved1, _Reserved_ PVOID Reserved2, _Reserved_ PVOID Reserved3, _Reserved_ PVOID Reserved4, _Reserved_ PVOID Reserved5, _Reserved_ PVOID Reserved6, _Reserved_ PVOID Reserved7, _Reserved_ PVOID Reserved8)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
HANDLE CsrSbApiPort
Definition: init.c:29
HANDLE hSbApiPort
Definition: init.c:32
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:773
HANDLE CsrSmApiPort
Definition: init.c:31
ULONG CsrTotalPerProcessDataLength
Definition: init.c:35
#define PROCESS_TERMINATE
Definition: pstypes.h:149
#define NtCurrentPeb()
Definition: FLS.c:20
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define CSRSRV_SERVERDLL_INDEX
Definition: csrmsg.h:20
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: classpnp.h:1209
#define UNICODE_PATH_SEP
Definition: connect.c:33
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
unsigned int * PULONG
Definition: retypes.h:1
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define DPRINT1
Definition: precomp.h:8
UNICODE_STRING CsrDirectoryName
Definition: init.c:27
NTSTATUS NTAPI CsrLoadServerDll(IN PCHAR DllString, IN PCHAR EntryPoint OPTIONAL, IN ULONG ServerId)
Definition: server.c:116
NTSTATUS NTAPI SmConnectToSm(IN PUNICODE_STRING SbApiPortName, IN HANDLE SbApiPort, IN ULONG ImageType, OUT PHANDLE SmApiPort)
Definition: smclient.c:68
#define ACL_REVISION
Definition: setypes.h:39
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define PROCESS_VM_READ
Definition: pstypes.h:153
#define PORT_ALL_ACCESS
Definition: lpctypes.h:47
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI CsrApiPortInitialize(VOID)
Definition: api.c:882
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
SID_AND_ATTRIBUTES User
Definition: setypes.h:956
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define PROCESS_VM_OPERATION
Definition: pstypes.h:152
ULONG CsrDebug
Definition: init.c:23
NTSTATUS NTAPI CsrInitializeNtSessionList(VOID)
Definition: session.c:53
#define INHERIT_ONLY_ACE
Definition: setypes.h:717
HANDLE BNOLinksDirectory
Definition: init.c:37
PCSR_NEWPROCESS_CALLBACK NewProcessCallback
Definition: csrsrv.h:239
#define GENERIC_EXECUTE
Definition: nt_native.h:91
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define __FUNCTION__
Definition: types.h:112
#define REG_DWORD
Definition: sdbapi.c:596
#define SESSION_ROOT
Definition: srv.h:44
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
BOOLEAN WINAPI DllMain(HINSTANCE Instance, DWORD Reason, LPVOID Reserved)
Definition: init.c:14
#define OBJECT_INHERIT_ACE
Definition: setypes.h:714
HANDLE CsrHeap
Definition: init.c:25
_In_ ULONG AclLength
Definition: rtlfuncs.h:1844
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define SECURITY_CREATOR_SID_AUTHORITY
Definition: setypes.h:505
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]
Definition: server.c:20
ULONG SessionId
Definition: init.c:33
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
HANDLE CsrApiPort
Definition: init.c:33