ReactOS  0.4.15-dev-1377-ga59cecd
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 */
79  {
80  NtClose(hToken);
81  goto Quickie;
82  }
83 
84  /* Allocate space for it */
86  if (!TokenInfo)
87  {
88  NtClose(hToken);
90  goto Quickie;
91  }
92 
93  /* Now query the data */
94  Status = NtQueryInformationToken(hToken, TokenUser, TokenInfo, Length, &Length);
95  NtClose(hToken);
96  if (!NT_SUCCESS(Status)) goto Quickie;
97 
98  /* Now check the SID Length */
99  UserSid = TokenInfo->User.Sid;
100  Length = RtlLengthSid(UserSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
101 
102  /* Allocate a buffer for the Security Descriptor, with SID and DACL */
104  if (!ProcSd)
105  {
107  goto Quickie;
108  }
109 
110  /* Set the pointer to the DACL */
112 
113  /* Now create the SD itself */
115  if (!NT_SUCCESS(Status))
116  {
117  DPRINT1("CSRSS: SD creation failed - status = %lx\n", Status);
118  goto Quickie;
119  }
120 
121  /* Create the DACL for it*/
123  if (!NT_SUCCESS(Status))
124  {
125  DPRINT1("CSRSS: DACL creation failed - status = %lx\n", Status);
126  goto Quickie;
127  }
128 
129  /* Create the ACE */
131  ACL_REVISION,
136  UserSid);
137  if (!NT_SUCCESS(Status))
138  {
139  DPRINT1("CSRSS: ACE creation failed - status = %lx\n", Status);
140  goto Quickie;
141  }
142 
143  /* Clear the DACL in the SD */
145  if (!NT_SUCCESS(Status))
146  {
147  DPRINT1("CSRSS: set DACL failed - status = %lx\n", Status);
148  goto Quickie;
149  }
150 
151  /* Write the SD into the Process */
153  if (!NT_SUCCESS(Status))
154  {
155  DPRINT1("CSRSS: set process DACL failed - status = %lx\n", Status);
156  goto Quickie;
157  }
158 
159  /* Free the memory and return */
160 Quickie:
161  if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd);
162  if (TokenInfo) RtlFreeHeap(CsrHeap, 0, TokenInfo);
163  return Status;
164 }
165 
166 /*++
167  * @name CsrSetDirectorySecurity
168  *
169  * The CsrSetDirectorySecurity routine sets the security descriptor for the
170  * specified Object Directory.
171  *
172  * @param ObjectDirectory
173  * Handle fo the Object Directory to protect.
174  *
175  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
176  *
177  * @remarks None.
178  *
179  *--*/
180 NTSTATUS
181 NTAPI
183 {
184  /* FIXME: Implement */
185  return STATUS_SUCCESS;
186 }
187 
188 /*++
189  * @name GetDosDevicesProtection
190  *
191  * The GetDosDevicesProtection creates a security descriptor for the DOS Devices
192  * Object Directory.
193  *
194  * @param DosDevicesSd
195  * Pointer to the Security Descriptor to return.
196  *
197  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
198  *
199  * @remarks Depending on the DOS Devices Protection Mode (set in the registry),
200  * regular users may or may not have full access to the directory.
201  *
202  *--*/
203 NTSTATUS
204 NTAPI
206 {
210  PSID WorldSid, CreatorSid, AdminSid, SystemSid;
211  UCHAR KeyValueBuffer[0x40];
212  PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
214  ULONG ProtectionMode = 0;
216  PACL Dacl;
218  HANDLE hKey;
220  ULONG ResultLength, SidLength, AclLength;
221 
222  /* Create the SD */
225 
226  /* Initialize the System SID */
229  0, 0, 0, 0, 0, 0, 0,
230  &SystemSid);
232 
233  /* Initialize the World SID */
236  0, 0, 0, 0, 0, 0, 0,
237  &WorldSid);
239 
240  /* Initialize the Admin SID */
244  0, 0, 0, 0, 0, 0,
245  &AdminSid);
247 
248  /* Initialize the Creator SID */
249  Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1,
251  0, 0, 0, 0, 0, 0, 0,
252  &CreatorSid);
254 
255  /* Open the Session Manager Key */
258  &KeyName,
260  NULL,
261  NULL);
263  if (NT_SUCCESS(Status))
264  {
265  /* Read the key value */
266  RtlInitUnicodeString(&KeyName, L"ProtectionMode");
268  &KeyName,
270  KeyValueBuffer,
271  sizeof(KeyValueBuffer),
272  &ResultLength);
273 
274  /* Make sure it's what we expect it to be */
275  KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer;
276  if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) &&
277  (*(PULONG)KeyValuePartialInfo->Data))
278  {
279  /* Save the Protection Mode */
280  ProtectionMode = *(PULONG)KeyValuePartialInfo->Data;
281  }
282 
283  /* Close the handle */
284  NtClose(hKey);
285  }
286 
287  /* Check the Protection Mode */
288  if (ProtectionMode & 3)
289  {
290  /* Calculate SID Lengths */
291  SidLength = RtlLengthSid(CreatorSid) + RtlLengthSid(SystemSid) +
293  AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
294 
295  /* Allocate memory for the DACL */
297  ASSERT(Dacl != NULL);
298 
299  /* Build the ACL and add 3 ACEs */
308 
309  /* Edit the ACEs to make them inheritable */
310  Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace);
312  Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
313  Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace);
315  Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
316  Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
319 
320  /* Set this DACL with the SD */
323  goto Quickie;
324  }
325  else
326  {
327  /* Calculate SID Lengths */
328  SidLength = RtlLengthSid(WorldSid) + RtlLengthSid(SystemSid);
329  AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
330 
331  /* Allocate memory for the DACL */
333  ASSERT(Dacl != NULL);
334 
335  /* Build the ACL and add 3 ACEs */
344 
345  /* Edit the last ACE to make it inheritable */
346  Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
349 
350  /* Set this DACL with the SD */
353  goto Quickie;
354  }
355 
356 /* FIXME: failure cases! Fail: */
357  /* Free the memory */
358  RtlFreeHeap(CsrHeap, 0, Dacl);
359 
360 /* FIXME: semi-failure cases! Quickie: */
361 Quickie:
362  /* Free the SIDs */
363  RtlFreeSid(CreatorSid);
366  RtlFreeSid(SystemSid);
367 
368  /* Return */
369  return Status;
370 }
371 
372 /*++
373  * @name FreeDosDevicesProtection
374  *
375  * The FreeDosDevicesProtection frees the security descriptor that was created
376  * by GetDosDevicesProtection
377  *
378  * @param DosDevicesSd
379  * Pointer to the security descriptor to free.
380 
381  * @return None.
382  *
383  * @remarks None.
384  *
385  *--*/
386 VOID
387 NTAPI
389 {
390  PACL Dacl;
391  BOOLEAN Present, Default;
393 
394  /* Get the DACL corresponding to this SD */
395  Status = RtlGetDaclSecurityDescriptor(DosDevicesSd, &Present, &Dacl, &Default);
397  ASSERT(Present);
398  ASSERT(Dacl != NULL);
399 
400  /* Free it */
401  if ((NT_SUCCESS(Status)) && (Dacl)) RtlFreeHeap(CsrHeap, 0, Dacl);
402 }
403 
404 /*++
405  * @name CsrCreateSessionObjectDirectory
406  *
407  * The CsrCreateSessionObjectDirectory routine creates the BaseNamedObjects,
408  * Session and Dos Devices directories for the specified session.
409  *
410  * @param Session
411  * Session ID for which to create the directories.
412  *
413  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
414  *
415  * @remarks None.
416  *
417  *--*/
418 NTSTATUS
419 NTAPI
421 {
422  WCHAR SessionBuffer[512], BnoBuffer[512];
423  UNICODE_STRING SessionString, BnoString;
425  HANDLE BnoHandle;
426  SECURITY_DESCRIPTOR DosDevicesSd;
428 
429  /* Generate the Session BNOLINKS Directory name */
430  swprintf(SessionBuffer, L"%ws\\BNOLINKS", SESSION_ROOT);
431  RtlInitUnicodeString(&SessionString, SessionBuffer);
432 
433  /* Create it */
435  &SessionString,
437  NULL,
438  NULL);
442  if (!NT_SUCCESS(Status))
443  {
444  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
445  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
446  return Status;
447  }
448 
449  /* Now add the Session ID */
450  swprintf(SessionBuffer, L"%ld", Session);
451  RtlInitUnicodeString(&SessionString, SessionBuffer);
452 
453  /* Check if this is the first Session */
454  if (Session)
455  {
456  /* Not the first, so the name will be slighly more complex */
457  swprintf(BnoBuffer, L"%ws\\%ld\\BaseNamedObjects", SESSION_ROOT, Session);
458  RtlInitUnicodeString(&BnoString, BnoBuffer);
459  }
460  else
461  {
462  /* Use the direct name */
463  RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects");
464  }
465 
466  /* Create the symlink */
468  &SessionString,
471  NULL);
472  Status = NtCreateSymbolicLinkObject(&BnoHandle,
475  &BnoString);
476  if (!NT_SUCCESS(Status))
477  {
478  DPRINT1("CSRSS: NtCreateSymbolicLinkObject failed in "
479  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
480  return Status;
481  }
482 
483  /* Create the \DosDevices Security Descriptor */
484  Status = GetDosDevicesProtection(&DosDevicesSd);
485  if (!NT_SUCCESS(Status)) return Status;
486 
487  /* Now create a directory for this session */
488  swprintf(SessionBuffer, L"%ws\\%ld", SESSION_ROOT, Session);
489  RtlInitUnicodeString(&SessionString, SessionBuffer);
490 
491  /* Create the directory */
493  &SessionString,
495  0,
496  &DosDevicesSd);
500  if (!NT_SUCCESS(Status))
501  {
502  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
503  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
504  FreeDosDevicesProtection(&DosDevicesSd);
505  return Status;
506  }
507 
508  /* Next, create a directory for this session's DOS Devices */
509  RtlInitUnicodeString(&SessionString, L"DosDevices");
511  &SessionString,
514  &DosDevicesSd);
518  if (!NT_SUCCESS(Status))
519  {
520  DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
521  "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
522  }
523 
524  /* Release the Security Descriptor */
525  FreeDosDevicesProtection(&DosDevicesSd);
526 
527  /* Return */
528  return Status;
529 }
530 
531 /*++
532  * @name CsrParseServerCommandLine
533  *
534  * The CsrParseServerCommandLine routine parses the CSRSS command-line in the
535  * registry and performs operations for each entry found.
536  *
537  * @param ArgumentCount
538  * Number of arguments on the command line.
539  *
540  * @param Arguments
541  * Array of arguments.
542  *
543  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
544  *
545  * @remarks None.
546  *
547  *--*/
548 NTSTATUS
549 NTAPI
551  IN PCHAR Arguments[])
552 {
554  PCHAR ParameterName = NULL, ParameterValue = NULL, EntryPoint, ServerString;
555  ULONG i, DllIndex;
558 
559  /* Set the Defaults */
563 
564  /* Save our Session ID, and create a Directory for it */
565  SessionId = NtCurrentPeb()->SessionId;
567  if (!NT_SUCCESS(Status))
568  {
569  DPRINT1("CSRSS: CsrCreateSessionObjectDirectory failed (%lx)\n",
570  Status);
571 
572  /* It's not fatal if the session ID isn't zero */
573  if (SessionId != 0) return Status;
575  }
576 
577  /* Loop through every argument */
578  for (i = 1; i < ArgumentCount; i++)
579  {
580  /* Split Name and Value */
581  ParameterName = Arguments[i];
585  DPRINT("Name=%s, Value=%s\n", ParameterName, ParameterValue);
586 
587  /* Check for Object Directory */
588  if (_stricmp(ParameterName, "ObjectDirectory") == 0)
589  {
590  /* Check if a session ID is specified */
591  if (SessionId != 0)
592  {
593  DPRINT1("Sessions not yet implemented\n");
594  ASSERT(SessionId);
595  }
596 
597  /* Initialize the directory name */
600  &AnsiString,
601  TRUE);
602  ASSERT(NT_SUCCESS(Status) || SessionId != 0);
603  if (!NT_SUCCESS(Status)) return Status;
604 
605  /* Create it */
609  NULL,
610  NULL);
614  if (!NT_SUCCESS(Status)) return Status;
615 
616  /* Secure it */
618  if (!NT_SUCCESS(Status)) return Status;
619  }
620  else if (_stricmp(ParameterName, "SubSystemType") == 0)
621  {
622  /* Ignored */
623  }
624  else if (_stricmp(ParameterName, "MaxRequestThreads") == 0)
625  {
627  0,
629  }
630  else if (_stricmp(ParameterName, "RequestThreads") == 0)
631  {
632  /* Ignored */
634  }
635  else if (_stricmp(ParameterName, "ProfileControl") == 0)
636  {
637  /* Ignored */
638  }
639  else if (_stricmp(ParameterName, "SharedSection") == 0)
640  {
641  /* Create the Section */
643  if (!NT_SUCCESS(Status))
644  {
645  DPRINT1("CSRSS: *** Invalid syntax for %s=%s (Status == %X)\n",
647  return Status;
648  }
649 
650  /* Load us */
651  Status = CsrLoadServerDll("CSRSS" /* "CSRSRV" */, NULL, CSRSRV_SERVERDLL_INDEX);
652  }
653  else if (_stricmp(ParameterName, "ServerDll") == 0)
654  {
655  /* Loop the command line */
656  EntryPoint = NULL;
658  ServerString = ParameterValue;
659  while (*ServerString)
660  {
661  /* Check for the Entry Point */
662  if ((*ServerString == ':') && (!EntryPoint))
663  {
664  /* Found it. Add a nullchar and save it */
665  *ServerString++ = ANSI_NULL;
666  EntryPoint = ServerString;
667  }
668 
669  /* Check for the Dll Index */
670  if (*ServerString++ == ',') break;
671  }
672 
673  /* Did we find something to load? */
674  if (!*ServerString)
675  {
676  DPRINT1("CSRSS: *** Invalid syntax for ServerDll=%s (Status == %X)\n",
678  return Status;
679  }
680 
681  /* Convert it to a ULONG */
682  Status = RtlCharToInteger(ServerString, 10, &DllIndex);
683 
684  /* Add a null char if it was valid */
685  if (NT_SUCCESS(Status)) ServerString[-1] = ANSI_NULL;
686 
687  /* Load it */
688  if (CsrDebug & 1) DPRINT1("CSRSS: Loading ServerDll=%s:%s\n", ParameterValue, EntryPoint);
689  Status = CsrLoadServerDll(ParameterValue, EntryPoint, DllIndex);
690  if (!NT_SUCCESS(Status))
691  {
692  DPRINT1("CSRSS: *** Failed loading ServerDll=%s (Status == 0x%x)\n",
694  return Status;
695  }
696  }
697  else if (_stricmp(ParameterName, "Windows") == 0)
698  {
699  /* Ignored */
700  // Check whether we want to start in pure GUI or pure CLI.
701  }
702  else
703  {
704  /* Invalid parameter on the command line */
706  }
707  }
708 
709  /* Return status */
710  return Status;
711 }
712 
713 /*++
714  * @name CsrInitCsrRootProcess
715  *
716  * The CsrInitCsrRootProcess routine further initializes the CSR Root Process
717  * created by CsrInitializeProcessStructure, by allocating and initializing
718  * per-process data for each Server DLL.
719  *
720  * @param None.
721  *
722  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
723  *
724  * @remarks None.
725  *
726  *--*/
727 NTSTATUS
728 NTAPI
730 {
731  PVOID ProcessData;
732  PCSR_SERVER_DLL ServerDll;
733  ULONG i = 0;
734 
735  /* All Server DLLs are now loaded, allocate a heap for the Root Process */
736  ProcessData = RtlAllocateHeap(CsrHeap,
739  if (!ProcessData)
740  {
741  DPRINT1("CSRSRV:%s: RtlAllocateHeap failed (Status=%08lx)\n",
743  return STATUS_NO_MEMORY;
744  }
745 
746  /*
747  * Our Root Process was never officially initialized,
748  * so write the data for each Server DLL manually.
749  */
750 
751  /* Loop every DLL */
752  for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
753  {
754  /* Get the current Server */
755  ServerDll = CsrLoadedServerDll[i];
756 
757  /* Is it loaded, and does it have per process data? */
758  if (ServerDll && ServerDll->SizeOfProcessData)
759  {
760  /* It does, give it part of our allocated heap */
761  CsrRootProcess->ServerData[i] = ProcessData;
762 
763  /* Move to the next heap position */
764  ProcessData = (PVOID)((ULONG_PTR)ProcessData +
765  ServerDll->SizeOfProcessData);
766  }
767  else
768  {
769  /* Nothing for this Server DLL */
771  }
772  }
773 
774  /* Now initialize the Root Process manually as well */
775  for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
776  {
777  /* Get the current Server */
778  ServerDll = CsrLoadedServerDll[i];
779 
780  /* Is it loaded, and does it a callback for new processes? */
781  if (ServerDll && ServerDll->NewProcessCallback)
782  {
783  /* Call the callback */
785  }
786  }
787 
788  return STATUS_SUCCESS;
789 }
790 
791 /*++
792  * @name CsrCreateLocalSystemSD
793  *
794  * The CsrCreateLocalSystemSD routine creates a Security Descriptor for
795  * the local account with PORT_ALL_ACCESS.
796  *
797  * @param LocalSystemSd
798  * Pointer to a pointer to the security descriptor to create.
799  *
800  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
801  *
802  * @remarks None.
803  *
804  *--*/
805 NTSTATUS
806 NTAPI
808 {
810  PSID SystemSid;
811  ULONG Length;
812  PSECURITY_DESCRIPTOR SystemSd;
813  PACL Dacl;
815 
816  /* Initialize the System SID */
819  0, 0, 0, 0, 0, 0, 0,
820  &SystemSid);
821 
822  /* Get the length of the SID */
823  Length = RtlLengthSid(SystemSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
824 
825  /* Allocate a buffer for the Security Descriptor, with SID and DACL */
827 
828  /* Set the pointer to the DACL */
830 
831  /* Now create the SD itself */
833  if (!NT_SUCCESS(Status)) goto Quit;
834 
835  /* Create the DACL for it */
837 
838  /* Create the ACE */
840  if (!NT_SUCCESS(Status)) goto Quit;
841 
842  /* Clear the DACL in the SD */
844  if (!NT_SUCCESS(Status)) goto Quit;
845 
846 Quit:
847  if (!NT_SUCCESS(Status))
848  {
849  RtlFreeHeap(CsrHeap, 0, SystemSd);
850  SystemSd = NULL;
851  }
852 
853  /* Free the SID and return*/
854  RtlFreeSid(SystemSid);
855  *LocalSystemSd = SystemSd;
856  return Status;
857 }
858 
859 /*++
860  * @name CsrSbApiPortInitialize
861  *
862  * The CsrSbApiPortInitialize routine initializes the LPC Port used for
863  * communications with the Session Manager (SM) and initializes the static
864  * thread that will handle connection requests and APIs.
865  *
866  * @param None
867  *
868  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
869  *
870  * @remarks None.
871  *
872  *--*/
873 NTSTATUS
874 NTAPI
876 {
877  ULONG Size;
878  PSECURITY_DESCRIPTOR PortSd;
881  HANDLE hRequestThread;
883 
884  /* Calculate how much space we'll need for the Port Name */
885  Size = CsrDirectoryName.Length + sizeof(SB_PORT_NAME) + sizeof(WCHAR);
886 
887  /* Create the buffer for it */
890 
891  /* Setup the rest of the empty string */
894 
895  /* Now append the full port name */
899  if (CsrDebug & 2) DPRINT1("CSRSS: Creating %wZ port and associated thread\n", &CsrSbApiPortName);
900 
901  /* Create Security Descriptor for this Port */
902  Status = CsrCreateLocalSystemSD(&PortSd);
903  if (!NT_SUCCESS(Status)) return Status;
904 
905  /* Initialize the Attributes */
908  0,
909  NULL,
910  PortSd);
911 
912  /* Create the Port Object */
915  sizeof(SB_CONNECTION_INFO),
916  sizeof(SB_API_MSG),
917  32 * sizeof(SB_API_MSG));
918  if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd);
919 
920  if (NT_SUCCESS(Status))
921  {
922  /* Create the Thread to handle the API Requests */
924  NULL,
925  TRUE,
926  0,
927  0,
928  0,
930  NULL,
931  &hRequestThread,
932  &ClientId);
933  if (NT_SUCCESS(Status))
934  {
935  /* Add it as a Static Server Thread */
937  &ClientId,
938  0);
939 
940  /* Activate it */
941  Status = NtResumeThread(hRequestThread, NULL);
942  }
943  }
944 
945  return Status;
946 }
947 
948 
949 /* PUBLIC FUNCTIONS ***********************************************************/
950 
951 /*++
952  * @name CsrServerInitialization
953  * @implemented NT4
954  *
955  * The CsrServerInitialization routine is the native (not Server) entrypoint
956  * of this Server DLL. It serves as the entrypoint for CSRSS.
957  *
958  * @param ArgumentCount
959  * Number of arguments on the command line.
960  *
961  * @param Arguments
962  * Array of arguments from the command line.
963  *
964  * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
965  *
966  * @remarks None.
967  *
968  *--*/
969 NTSTATUS
970 NTAPI
972  IN PCHAR Arguments[])
973 {
975 
976  /* Cache System Basic Information so we don't always request it */
978  &CsrNtSysInfo,
979  sizeof(SYSTEM_BASIC_INFORMATION),
980  NULL);
981  if (!NT_SUCCESS(Status))
982  {
983  DPRINT1("CSRSRV:%s: NtQuerySystemInformation failed (Status=0x%08lx)\n",
985  return Status;
986  }
987 
988  /* Save our Heap */
989  CsrHeap = RtlGetProcessHeap();
990 
991  /* Set our Security Descriptor to protect the process */
993  if (!NT_SUCCESS(Status))
994  {
995  DPRINT1("CSRSRV:%s: CsrSetProcessSecurity failed (Status=0x%08lx)\n",
997  return Status;
998  }
999 
1000  /* Set up Session Support */
1002  if (!NT_SUCCESS(Status))
1003  {
1004  DPRINT1("CSRSRV:%s: CsrInitializeSessions failed (Status=0x%08lx)\n",
1005  __FUNCTION__, Status);
1006  return Status;
1007  }
1008 
1009  /* Set up Process Support and allocate the CSR Root Process */
1011  if (!NT_SUCCESS(Status))
1012  {
1013  DPRINT1("CSRSRV:%s: CsrInitializeProcessStructure failed (Status=0x%08lx)\n",
1014  __FUNCTION__, Status);
1015  return Status;
1016  }
1017 
1018  /* Parse the command line */
1019  Status = CsrParseServerCommandLine(ArgumentCount, Arguments);
1020  if (!NT_SUCCESS(Status))
1021  {
1022  DPRINT1("CSRSRV:%s: CsrParseServerCommandLine failed (Status=0x%08lx)\n",
1023  __FUNCTION__, Status);
1024  return Status;
1025  }
1026 
1027  /* Finish to initialize the CSR Root Process */
1029  if (!NT_SUCCESS(Status))
1030  {
1031  DPRINT1("CSRSRV:%s: CsrInitCsrRootProcess failed (Status=0x%08lx)\n",
1032  __FUNCTION__, Status);
1033  return Status;
1034  }
1035 
1036  /* Now initialize our API Port */
1038  if (!NT_SUCCESS(Status))
1039  {
1040  DPRINT1("CSRSRV:%s: CsrApiPortInitialize failed (Status=0x%08lx)\n",
1041  __FUNCTION__, Status);
1042  return Status;
1043  }
1044 
1045  /* Initialize the API Port for SM communication */
1047  if (!NT_SUCCESS(Status))
1048  {
1049  DPRINT1("CSRSRV:%s: CsrSbApiPortInitialize failed (Status=0x%08lx)\n",
1050  __FUNCTION__, Status);
1051  return Status;
1052  }
1053 
1054  /* We're all set! Connect to SM! */
1056  CsrSbApiPort,
1058  &CsrSmApiPort);
1059  if (!NT_SUCCESS(Status))
1060  {
1061  DPRINT1("CSRSRV:%s: SmConnectToSm failed (Status=0x%08lx)\n",
1062  __FUNCTION__, Status);
1063  return Status;
1064  }
1065 
1066  /* Have us handle Hard Errors */
1068  if (!NT_SUCCESS(Status))
1069  {
1070  DPRINT1("CSRSRV:%s: NtSetDefaultHardErrorPort failed (Status=0x%08lx)\n",
1071  __FUNCTION__, Status);
1072  return Status;
1073  }
1074 
1075  /* Return status */
1076  return Status;
1077 }
1078 
1079 /*++
1080  * @name CsrPopulateDosDevices
1081  * @unimplemented NT5.1
1082  *
1083  * The CsrPopulateDosDevices routine uses the DOS Device Map from the Kernel
1084  * to populate the Dos Devices Object Directory for the session.
1085  *
1086  * @param None.
1087  *
1088  * @return None.
1089  *
1090  * @remarks None.
1091  *
1092  *--*/
1093 VOID
1094 NTAPI
1096 {
1097  DPRINT1("Deprecated API in r55585.\n");
1098  return;
1099 }
1100 
1101 BOOL
1102 NTAPI
1103 DllMain(IN HINSTANCE hInstanceDll,
1104  IN DWORD dwReason,
1105  IN LPVOID lpReserved)
1106 {
1107  /* We don't do much */
1108  UNREFERENCED_PARAMETER(hInstanceDll);
1110  UNREFERENCED_PARAMETER(lpReserved);
1111 
1112  return TRUE;
1113 }
1114 
1115 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSYSAPI NTSTATUS NTAPI RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value)
Definition: unicode.c:261
#define IN
Definition: typedefs.h:39
#define GENERIC_ALL
Definition: nt_native.h:92
NTSTATUS NTAPI CsrParseServerCommandLine(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:550
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:546
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI CsrInitializeProcessStructure(VOID)
Definition: procsup.c:254
ULONG SizeOfProcessData
Definition: csrsrv.h:234
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#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 TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS NTAPI GetDosDevicesProtection(OUT PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:205
#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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PCSR_THREAD CsrSbApiRequestThreadPtr
Definition: init.c:30
NTSTATUS NTAPI CsrSetDirectorySecurity(IN HANDLE ObjectDirectory)
Definition: init.c:182
_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
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
#define PROCESS_SUSPEND_RESUME
Definition: pstypes.h:159
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
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:1095
#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
#define OBJ_OPENIF
Definition: winternl.h:229
NTSTATUS NTAPI CsrServerInitialization(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:971
NTSYSAPI NTSTATUS NTAPI RtlGetDaclSecurityDescriptor(_In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Out_ PBOOLEAN DaclPresent, _Out_ PACL *Dacl, _Out_ PBOOLEAN DaclDefaulted)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
VOID NTAPI FreeDosDevicesProtection(IN PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:388
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:65
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
PCSR_PROCESS CsrRootProcess
Definition: procsup.c:22
DWORD dwReason
Definition: misc.cpp:154
NTSTATUS NTAPI CsrSbApiPortInitialize(VOID)
Definition: init.c:875
HANDLE CsrObjectDirectory
Definition: init.c:26
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 FALSE
Definition: types.h: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
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:1834
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:40
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
Definition: server.c:351
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
void * PVOID
Definition: retypes.h:9
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
NTSTATUS NTAPI CsrCreateSessionObjectDirectory(IN ULONG Session)
Definition: init.c:420
#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
Status
Definition: gdiplustypes.h:24
#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:1163
#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
#define ASSERT(a)
Definition: mode.c:45
__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:729
#define SECURITY_WORLD_RID
Definition: setypes.h:513
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define READ_CONTROL
Definition: nt_native.h:58
#define SECURITY_CREATOR_OWNER_RID
Definition: setypes.h:517
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1552
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd)
Definition: init.c:807
static const WCHAR L[]
Definition: oid.c:1250
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: cdrom.h:960
PSID WorldSid
Definition: globals.c:15
HANDLE SessionObjectDirectory
Definition: init.c:38
#define OBJ_PERMANENT
Definition: winternl.h:226
#define GENERIC_READ
Definition: compat.h:135
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)
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
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
#define NtCurrentPeb()
Definition: FLS.c:20
unsigned short USHORT
Definition: pedump.c:61
FxAutoRegKey hKey
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
#define UNICODE_PATH_SEP
Definition: connect.c:33
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
unsigned int * PULONG
Definition: retypes.h:1
_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
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:40
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI CsrApiPortInitialize(VOID)
Definition: api.c:896
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
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
#define INHERIT_ONLY_ACE
Definition: setypes.h:717
#define STATUS_SUCCESS
Definition: shellext.h:65
HANDLE BNOLinksDirectory
Definition: init.c:37
PCSR_NEWPROCESS_CALLBACK NewProcessCallback
Definition: csrsrv.h:239
#define GENERIC_EXECUTE
Definition: nt_native.h:91
#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