ReactOS 0.4.17-dev-684-ga6524ef
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
23ULONG CsrDebug = 0; // 0xFFFFFFFF;
24
34#ifdef __REACTOS__
35BOOLEAN CsrWindowsControl;
36ULONG CsrSubSystemType; // Known as SessionFirstProcessImageType in Windows 7+
37#endif
45
46
47/* PRIVATE FUNCTIONS **********************************************************/
48
49/* === INIT ROUTINES === */
50
51/*++
52 * @name CsrSetProcessSecurity
53 *
54 * The CsrSetProcessSecurity routine protects access to the CSRSS process
55 * from unauthorized tampering.
56 *
57 * @param None.
58 *
59 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
60 *
61 * @remarks None.
62 *
63 *--*/
67{
71 PTOKEN_USER TokenInfo = NULL;
73 PACL Dacl;
74 PSID UserSid;
75
76 /* Open our token */
78 if (!NT_SUCCESS(Status)) goto Quickie;
79
80 /* Get the Token User Length */
83 {
84 NtClose(hToken);
85 goto Quickie;
86 }
87
88 /* Allocate space for it */
90 if (!TokenInfo)
91 {
92 NtClose(hToken);
94 goto Quickie;
95 }
96
97 /* Now query the data */
98 Status = NtQueryInformationToken(hToken, TokenUser, TokenInfo, Length, &Length);
99 NtClose(hToken);
100 if (!NT_SUCCESS(Status)) goto Quickie;
101
102 /* Now check the SID Length */
103 UserSid = TokenInfo->User.Sid;
104 Length = RtlLengthSid(UserSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
105
106 /* Allocate a buffer for the Security Descriptor, with SID and DACL */
108 if (!ProcSd)
109 {
111 goto Quickie;
112 }
113
114 /* Set the pointer to the DACL */
116
117 /* Now create the SD itself */
119 if (!NT_SUCCESS(Status))
120 {
121 DPRINT1("CSRSS: SD creation failed - status = %lx\n", Status);
122 goto Quickie;
123 }
124
125 /* Create the DACL for it*/
127 if (!NT_SUCCESS(Status))
128 {
129 DPRINT1("CSRSS: DACL creation failed - status = %lx\n", Status);
130 goto Quickie;
131 }
132
133 /* Create the ACE */
140 UserSid);
141 if (!NT_SUCCESS(Status))
142 {
143 DPRINT1("CSRSS: ACE creation failed - status = %lx\n", Status);
144 goto Quickie;
145 }
146
147 /* Clear the DACL in the SD */
149 if (!NT_SUCCESS(Status))
150 {
151 DPRINT1("CSRSS: set DACL failed - status = %lx\n", Status);
152 goto Quickie;
153 }
154
155 /* Write the SD into the Process */
157 if (!NT_SUCCESS(Status))
158 {
159 DPRINT1("CSRSS: set process DACL failed - status = %lx\n", Status);
160 goto Quickie;
161 }
162
163 /* Free the memory and return */
164Quickie:
165 if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd);
166 if (TokenInfo) RtlFreeHeap(CsrHeap, 0, TokenInfo);
167 return Status;
168}
169
170/*++
171 * @name CsrSetDirectorySecurity
172 *
173 * The CsrSetDirectorySecurity routine sets the security descriptor for the
174 * specified Object Directory.
175 *
176 * @param ObjectDirectory
177 * Handle fo the Object Directory to protect.
178 *
179 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
180 *
181 * @remarks None.
182 *
183 *--*/
185NTAPI
187{
188 /* FIXME: Implement */
189 return STATUS_SUCCESS;
190}
191
192/*++
193 * @name GetDosDevicesProtection
194 *
195 * The GetDosDevicesProtection creates a security descriptor for the DOS Devices
196 * Object Directory.
197 *
198 * @param DosDevicesSd
199 * Pointer to the Security Descriptor to return.
200 *
201 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
202 *
203 * @remarks Depending on the DOS Devices Protection Mode (set in the registry),
204 * regular users may or may not have full access to the directory.
205 *
206 *--*/
208NTAPI
210{
214 PSID WorldSid, CreatorSid, AdminSid, SystemSid;
215 UCHAR KeyValueBuffer[0x40];
216 PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
220 PACL Dacl;
222 HANDLE hKey;
224 ULONG ResultLength, SidLength, AclLength;
225
226 /* Create the SD */
229
230 /* Initialize the System SID */
233 0, 0, 0, 0, 0, 0, 0,
234 &SystemSid);
236
237 /* Initialize the World SID */
240 0, 0, 0, 0, 0, 0, 0,
241 &WorldSid);
243
244 /* Initialize the Admin SID */
248 0, 0, 0, 0, 0, 0,
249 &AdminSid);
251
252 /* Initialize the Creator SID */
253 Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1,
255 0, 0, 0, 0, 0, 0, 0,
256 &CreatorSid);
258
259 /* Open the Session Manager Key */
262 &KeyName,
264 NULL,
265 NULL);
267 if (NT_SUCCESS(Status))
268 {
269 /* Read the key value */
270 RtlInitUnicodeString(&KeyName, L"ProtectionMode");
272 &KeyName,
274 KeyValueBuffer,
275 sizeof(KeyValueBuffer),
276 &ResultLength);
277
278 /* Make sure it's what we expect it to be */
279 KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer;
280 if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) &&
281 (*(PULONG)KeyValuePartialInfo->Data))
282 {
283 /* Save the Protection Mode */
284 ProtectionMode = *(PULONG)KeyValuePartialInfo->Data;
285 }
286
287 /* Close the handle */
288 NtClose(hKey);
289 }
290
291 /* Check the Protection Mode */
292 if (ProtectionMode & 3)
293 {
294 /* Calculate SID Lengths */
295 SidLength = RtlLengthSid(CreatorSid) + RtlLengthSid(SystemSid) +
297 AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
298
299 /* Allocate memory for the DACL */
301 ASSERT(Dacl != NULL);
302
303 /* Build the ACL and add 3 ACEs */
312
313 /* Edit the ACEs to make them inheritable */
314 Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace);
316 Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
317 Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace);
319 Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE;
320 Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
323
324 /* Set this DACL with the SD */
327 goto Quickie;
328 }
329 else
330 {
331 /* Calculate SID Lengths */
332 SidLength = RtlLengthSid(WorldSid) + RtlLengthSid(SystemSid);
333 AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength;
334
335 /* Allocate memory for the DACL */
337 ASSERT(Dacl != NULL);
338
339 /* Build the ACL and add 3 ACEs */
348
349 /* Edit the last ACE to make it inheritable */
350 Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace);
353
354 /* Set this DACL with the SD */
357 goto Quickie;
358 }
359
360/* FIXME: failure cases! Fail: */
361 /* Free the memory */
363
364/* FIXME: semi-failure cases! Quickie: */
365Quickie:
366 /* Free the SIDs */
367 RtlFreeSid(CreatorSid);
370 RtlFreeSid(SystemSid);
371
372 /* Return */
373 return Status;
374}
375
376/*++
377 * @name FreeDosDevicesProtection
378 *
379 * The FreeDosDevicesProtection frees the security descriptor that was created
380 * by GetDosDevicesProtection
381 *
382 * @param DosDevicesSd
383 * Pointer to the security descriptor to free.
384
385 * @return None.
386 *
387 * @remarks None.
388 *
389 *--*/
390VOID
391NTAPI
393{
394 PACL Dacl;
395 BOOLEAN Present, Default;
397
398 /* Get the DACL corresponding to this SD */
399 Status = RtlGetDaclSecurityDescriptor(DosDevicesSd, &Present, &Dacl, &Default);
401 ASSERT(Present);
402 ASSERT(Dacl != NULL);
403
404 /* Free it */
405 if ((NT_SUCCESS(Status)) && (Dacl)) RtlFreeHeap(CsrHeap, 0, Dacl);
406}
407
408/*++
409 * @name CsrCreateSessionObjectDirectory
410 *
411 * The CsrCreateSessionObjectDirectory routine creates the BaseNamedObjects,
412 * Session and Dos Devices directories for the specified session.
413 *
414 * @param Session
415 * Session ID for which to create the directories.
416 *
417 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
418 *
419 * @remarks None.
420 *
421 *--*/
423NTAPI
425{
426 WCHAR SessionBuffer[512], BnoBuffer[512];
427 UNICODE_STRING SessionString, BnoString;
429 HANDLE BnoHandle;
430 SECURITY_DESCRIPTOR DosDevicesSd;
432
433 /* Generate the session BNOLINKS directory name */
434 _swprintf(SessionBuffer, L"%ws\\BNOLINKS", SESSION_ROOT);
435 RtlInitUnicodeString(&SessionString, SessionBuffer);
436
437 /* Create it */
439 &SessionString,
441 NULL,
442 NULL);
446 if (!NT_SUCCESS(Status))
447 {
448 DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
449 "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
450 return Status;
451 }
452
453 /* Now add the Session ID */
454 _swprintf(SessionBuffer, L"%lu", Session);
455 RtlInitUnicodeString(&SessionString, SessionBuffer);
456
457 /* Create the per-session symlink to the BaseNamedObjects directory */
458 if (Session)
459 {
460 /* Use the session path */
461 _swprintf(BnoBuffer, L"%ws\\%lu\\BaseNamedObjects", SESSION_ROOT, Session);
462 RtlInitUnicodeString(&BnoString, BnoBuffer);
463 }
464 else
465 {
466 /* Use the direct name */
467 RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects");
468 }
470 &SessionString,
473 NULL);
477 &BnoString);
478 if (!NT_SUCCESS(Status))
479 {
480 DPRINT1("CSRSS: NtCreateSymbolicLinkObject failed in "
481 "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
482 return Status;
483 }
484
485 /* Create the \DosDevices security descriptor */
486 Status = GetDosDevicesProtection(&DosDevicesSd);
487 if (!NT_SUCCESS(Status)) return Status;
488
489 /* Now create a directory for this session */
490 _swprintf(SessionBuffer, L"%ws\\%lu", SESSION_ROOT, Session);
491 RtlInitUnicodeString(&SessionString, SessionBuffer);
492
493 /* Create the directory */
495 &SessionString,
497 0,
498 &DosDevicesSd);
502 if (!NT_SUCCESS(Status))
503 {
504 DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
505 "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
506 FreeDosDevicesProtection(&DosDevicesSd);
507 return Status;
508 }
509
510 /* Next, create a directory for this session's DOS Devices */
511 RtlInitUnicodeString(&SessionString, L"DosDevices");
513 &SessionString,
516 &DosDevicesSd);
520 if (!NT_SUCCESS(Status))
521 {
522 DPRINT1("CSRSS: NtCreateDirectoryObject failed in "
523 "CsrCreateSessionObjectDirectory - status = %lx\n", Status);
524 }
525
526 /* Release the security descriptor */
527 FreeDosDevicesProtection(&DosDevicesSd);
528
529 /* Return */
530 return Status;
531}
532
533/*++
534 * @name CsrParseServerCommandLine
535 *
536 * The CsrParseServerCommandLine routine parses the CSRSS command-line in the
537 * registry and performs operations for each entry found.
538 *
539 * @param ArgumentCount
540 * Number of arguments on the command line.
541 *
542 * @param Arguments
543 * Array of arguments.
544 *
545 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
546 *
547 * @remarks None.
548 *
549 *--*/
551NTAPI
553 IN PCHAR Arguments[])
554{
556 PCHAR ParameterName = NULL, ParameterValue = NULL, EntryPoint, ServerString;
557 ULONG i, DllIndex;
560
561 /* Set the Defaults */
564#ifdef __REACTOS__
565 CsrWindowsControl = FALSE;
566 CsrSubSystemType = IMAGE_SUBSYSTEM_UNKNOWN;
567#endif
569
570 /* Save our Session ID, and create a Directory for it */
571 SessionId = NtCurrentPeb()->SessionId;
573 if (!NT_SUCCESS(Status))
574 {
575 DPRINT1("CSRSS: CsrCreateSessionObjectDirectory failed (%lx)\n",
576 Status);
577
578 /* It's not fatal if the session ID isn't zero */
579 if (SessionId != 0) return Status;
581 }
582
583 /* Loop through every argument */
584 for (i = 1; i < ArgumentCount; i++)
585 {
586 /* Split Name and Value */
587 ParameterName = Arguments[i];
591 DPRINT("Name=%s, Value=%s\n", ParameterName, ParameterValue);
592
593 /* Check for Object Directory */
594 if (_stricmp(ParameterName, "ObjectDirectory") == 0)
595 {
596 /* Check if a session ID is specified */
597 if (SessionId != 0)
598 {
599 DPRINT1("Sessions not yet implemented\n");
601 }
602
603 /* Initialize the directory name */
606 &AnsiString,
607 TRUE);
609 if (!NT_SUCCESS(Status)) return Status;
610
611 /* Create it */
615 NULL,
616 NULL);
620 if (!NT_SUCCESS(Status)) return Status;
621
622 /* Secure it */
624 if (!NT_SUCCESS(Status)) return Status;
625 }
626 else if (_stricmp(ParameterName, "SubSystemType") == 0)
627 {
628#ifdef __REACTOS__
629 /* Well-known subsystems, specified by names */
630 if (_stricmp(ParameterValue, "windows") == 0)
631 {
632 /* Behaviour compatible with Windows 7+ */
633 if (CsrWindowsControl)
634 CsrSubSystemType = IMAGE_SUBSYSTEM_WINDOWS_GUI;
635 else
636 CsrSubSystemType = IMAGE_SUBSYSTEM_WINDOWS_CUI;
637 }
638 else if (_stricmp(ParameterValue, "posix") == 0)
639 {
640 CsrSubSystemType = IMAGE_SUBSYSTEM_POSIX_CUI;
641 }
642 else if (_stricmp(ParameterValue, "os2") == 0)
643 {
644 CsrSubSystemType = IMAGE_SUBSYSTEM_OS2_CUI;
645 }
646 else if (_stricmp(ParameterValue, "native") == 0)
647 {
648 CsrSubSystemType = IMAGE_SUBSYSTEM_NATIVE;
649 }
650 else
651 {
652 /* Another subsystem type, specified by a numerical value */
653 Status = RtlCharToInteger(ParameterValue, 0, &CsrSubSystemType);
654 }
655#else
656 /* Ignored */
657#endif
658 }
659 else if (_stricmp(ParameterName, "MaxRequestThreads") == 0)
660 {
662 0,
664 }
665 else if (_stricmp(ParameterName, "RequestThreads") == 0)
666 {
667 /* Ignored */
669 }
670 else if (_stricmp(ParameterName, "ProfileControl") == 0)
671 {
672 /* Related functionality ignored since NT 3.5 */
673 }
674 else if (_stricmp(ParameterName, "SharedSection") == 0)
675 {
676 /* Create the Section */
678 if (!NT_SUCCESS(Status))
679 {
680 DPRINT1("CSRSS: *** Invalid syntax for %s=%s (Status == %X)\n",
682 return Status;
683 }
684
685 /* Load us */
686 Status = CsrLoadServerDll("CSRSS" /* "CSRSRV" */, NULL, CSRSRV_SERVERDLL_INDEX);
687 }
688 else if (_stricmp(ParameterName, "ServerDll") == 0)
689 {
690 /* Loop the command line */
691 EntryPoint = NULL;
693 ServerString = ParameterValue;
694 while (*ServerString)
695 {
696 /* Check for the Entry Point */
697 if ((*ServerString == ':') && (!EntryPoint))
698 {
699 /* Found it. NULL-terminate and save it. */
700 *ServerString++ = ANSI_NULL;
701 EntryPoint = ServerString;
702 }
703
704 /* Check for the Dll Index */
705 if (*ServerString++ == ',') break;
706 }
707
708 /* Did we find something to load? */
709 if (!*ServerString)
710 {
711 DPRINT1("CSRSS: *** Invalid syntax for ServerDll=%s (Status == %X)\n",
713 return Status;
714 }
715
716 /* Convert it to a ULONG */
717 Status = RtlCharToInteger(ServerString, 10, &DllIndex);
718
719 /* Add a null char if it was valid */
720 if (NT_SUCCESS(Status)) ServerString[-1] = ANSI_NULL;
721
722 /* Load it */
723 if (CsrDebug & 1) DPRINT1("CSRSS: Loading ServerDll=%s:%s\n", ParameterValue, EntryPoint);
724 Status = CsrLoadServerDll(ParameterValue, EntryPoint, DllIndex);
725 if (!NT_SUCCESS(Status))
726 {
727 DPRINT1("CSRSS: *** Failed loading ServerDll=%s (Status == 0x%x)\n",
729 return Status;
730 }
731 }
732 else if (_stricmp(ParameterName, "Windows") == 0)
733 {
734#ifdef __REACTOS__
735 CsrWindowsControl = (_stricmp(ParameterValue, "On") == 0);
736#else
737 /* Ignored */
738#endif
739 }
740 else
741 {
742 /* Invalid parameter on the command line */
744 }
745 }
746
747 /* Return status */
748 return Status;
749}
750
751/*++
752 * @name CsrInitCsrRootProcess
753 *
754 * The CsrInitCsrRootProcess routine further initializes the CSR Root Process
755 * created by CsrInitializeProcessStructure, by allocating and initializing
756 * per-process data for each Server DLL.
757 *
758 * @param None.
759 *
760 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
761 *
762 * @remarks None.
763 *
764 *--*/
766NTAPI
768{
769 PVOID ProcessData;
770 PCSR_SERVER_DLL ServerDll;
771 ULONG i = 0;
772
773 /* All Server DLLs are now loaded, allocate a heap for the Root Process */
774 ProcessData = RtlAllocateHeap(CsrHeap,
777 if (!ProcessData)
778 {
779 DPRINT1("CSRSRV:%s: RtlAllocateHeap failed (Status=%08lx)\n",
781 return STATUS_NO_MEMORY;
782 }
783
784 /*
785 * Our Root Process was never officially initialized,
786 * so write the data for each Server DLL manually.
787 */
788
789 /* Loop every DLL */
790 for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
791 {
792 /* Get the current Server */
793 ServerDll = CsrLoadedServerDll[i];
794
795 /* Is it loaded, and does it have per process data? */
796 if (ServerDll && ServerDll->SizeOfProcessData)
797 {
798 /* It does, give it part of our allocated heap */
799 CsrRootProcess->ServerData[i] = ProcessData;
800
801 /* Move to the next heap position */
802 ProcessData = (PVOID)((ULONG_PTR)ProcessData +
803 ServerDll->SizeOfProcessData);
804 }
805 else
806 {
807 /* Nothing for this Server DLL */
809 }
810 }
811
812 /* Now initialize the Root Process manually as well */
813 for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
814 {
815 /* Get the current Server */
816 ServerDll = CsrLoadedServerDll[i];
817
818 /* Is it loaded, and does it a callback for new processes? */
819 if (ServerDll && ServerDll->NewProcessCallback)
820 {
821 /* Call the callback */
823 }
824 }
825
826 return STATUS_SUCCESS;
827}
828
829/*++
830 * @name CsrCreateLocalSystemSD
831 *
832 * The CsrCreateLocalSystemSD routine creates a Security Descriptor for
833 * the local account with PORT_ALL_ACCESS.
834 *
835 * @param LocalSystemSd
836 * Pointer to a pointer to the security descriptor to create.
837 *
838 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
839 *
840 * @remarks None.
841 *
842 *--*/
844NTAPI
846{
848 PSID SystemSid;
850 PSECURITY_DESCRIPTOR SystemSd;
851 PACL Dacl;
853
854 /* Initialize the System SID */
857 0, 0, 0, 0, 0, 0, 0,
858 &SystemSid);
859
860 /* Get the length of the SID */
861 Length = RtlLengthSid(SystemSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE);
862
863 /* Allocate a buffer for the Security Descriptor, with SID and DACL */
865
866 /* Set the pointer to the DACL */
868
869 /* Now create the SD itself */
871 if (!NT_SUCCESS(Status)) goto Quit;
872
873 /* Create the DACL for it */
875
876 /* Create the ACE */
878 if (!NT_SUCCESS(Status)) goto Quit;
879
880 /* Clear the DACL in the SD */
882 if (!NT_SUCCESS(Status)) goto Quit;
883
884Quit:
885 if (!NT_SUCCESS(Status))
886 {
887 RtlFreeHeap(CsrHeap, 0, SystemSd);
888 SystemSd = NULL;
889 }
890
891 /* Free the SID and return*/
892 RtlFreeSid(SystemSid);
893 *LocalSystemSd = SystemSd;
894 return Status;
895}
896
897/*++
898 * @name CsrSbApiPortInitialize
899 *
900 * The CsrSbApiPortInitialize routine initializes the LPC Port used for
901 * communications with the Session Manager (SM) and initializes the static
902 * thread that will handle connection requests and APIs.
903 *
904 * @param None
905 *
906 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
907 *
908 * @remarks None.
909 *
910 *--*/
912NTAPI
914{
915 ULONG Size;
919 HANDLE hRequestThread;
921
922 /* Calculate how much space we'll need for the Port Name */
923 Size = CsrDirectoryName.Length + sizeof(SB_PORT_NAME) + sizeof(WCHAR);
924
925 /* Create the buffer for it */
928
929 /* Setup the rest of the empty string */
932
933 /* Now append the full port name */
937 if (CsrDebug & 2) DPRINT1("CSRSS: Creating %wZ port and associated thread\n", &CsrSbApiPortName);
938
939 /* Create Security Descriptor for this Port */
941 if (!NT_SUCCESS(Status)) return Status;
942
943 /* Initialize the Attributes */
946 0,
947 NULL,
948 PortSd);
949
950 /* Create the Port Object */
953 sizeof(SB_CONNECTION_INFO),
954 sizeof(SB_API_MSG),
955 32 * sizeof(SB_API_MSG));
956 if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd);
957
958 if (NT_SUCCESS(Status))
959 {
960 /* Create the Thread to handle the API Requests */
962 NULL,
963 TRUE,
964 0,
965 0,
966 0,
968 NULL,
969 &hRequestThread,
970 &ClientId);
971 if (NT_SUCCESS(Status))
972 {
973 /* Add it as a Static Server Thread */
975 &ClientId,
976 0);
977
978 /* Activate it */
979 Status = NtResumeThread(hRequestThread, NULL);
980 }
981 }
982
983 return Status;
984}
985
986
987/* PUBLIC FUNCTIONS ***********************************************************/
988
989/*++
990 * @name CsrServerInitialization
991 * @implemented NT4
992 *
993 * The CsrServerInitialization routine is the native (not Server) entrypoint
994 * of this Server DLL. It serves as the entrypoint for CSRSS.
995 *
996 * @param ArgumentCount
997 * Number of arguments on the command line.
998 *
999 * @param Arguments
1000 * Array of arguments from the command line.
1001 *
1002 * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL otherwise.
1003 *
1004 * @remarks None.
1005 *
1006 *--*/
1008NTAPI
1010 IN PCHAR Arguments[])
1011{
1013
1014 /* Cache System Basic Information so we don't always request it */
1016 &CsrNtSysInfo,
1018 NULL);
1019 if (!NT_SUCCESS(Status))
1020 {
1021 DPRINT1("CSRSRV:%s: NtQuerySystemInformation failed (Status=0x%08lx)\n",
1023 return Status;
1024 }
1025
1026 /* Save our Heap */
1027 CsrHeap = RtlGetProcessHeap();
1028
1029 /* Set our Security Descriptor to protect the process */
1031 if (!NT_SUCCESS(Status))
1032 {
1033 DPRINT1("CSRSRV:%s: CsrSetProcessSecurity failed (Status=0x%08lx)\n",
1035 return Status;
1036 }
1037
1038 /* Set up Session Support */
1040 if (!NT_SUCCESS(Status))
1041 {
1042 DPRINT1("CSRSRV:%s: CsrInitializeSessions failed (Status=0x%08lx)\n",
1044 return Status;
1045 }
1046
1047 /* Set up Process Support and allocate the CSR Root Process */
1049 if (!NT_SUCCESS(Status))
1050 {
1051 DPRINT1("CSRSRV:%s: CsrInitializeProcessStructure failed (Status=0x%08lx)\n",
1053 return Status;
1054 }
1055
1056 /* Parse the command line */
1057 Status = CsrParseServerCommandLine(ArgumentCount, Arguments);
1058 if (!NT_SUCCESS(Status))
1059 {
1060 DPRINT1("CSRSRV:%s: CsrParseServerCommandLine failed (Status=0x%08lx)\n",
1062 return Status;
1063 }
1064
1065 /* Finish to initialize the CSR Root Process */
1067 if (!NT_SUCCESS(Status))
1068 {
1069 DPRINT1("CSRSRV:%s: CsrInitCsrRootProcess failed (Status=0x%08lx)\n",
1071 return Status;
1072 }
1073
1074 /* Now initialize our API Port */
1076 if (!NT_SUCCESS(Status))
1077 {
1078 DPRINT1("CSRSRV:%s: CsrApiPortInitialize failed (Status=0x%08lx)\n",
1080 return Status;
1081 }
1082
1083#ifdef __REACTOS__
1084 if (CsrSubSystemType != IMAGE_SUBSYSTEM_UNKNOWN)
1085 {
1086#endif
1087 /* Initialize the API Port for SM communication */
1089 if (!NT_SUCCESS(Status))
1090 {
1091 DPRINT1("CSRSRV:%s: CsrSbApiPortInitialize failed (Status=0x%08lx)\n",
1093 return Status;
1094 }
1095
1096 /* We're all set! Connect to SM! */
1099#ifdef __REACTOS__
1100 CsrSubSystemType,
1101#else
1103#endif
1104 &CsrSmApiPort);
1105 if (!NT_SUCCESS(Status))
1106 {
1107 DPRINT1("CSRSRV:%s: SmConnectToSm failed (Status=0x%08lx)\n",
1109 return Status;
1110 }
1111#ifdef __REACTOS__
1112 }
1113#endif
1114
1115 /* Have us handle Hard Errors */
1117 if (!NT_SUCCESS(Status))
1118 {
1119 DPRINT1("CSRSRV:%s: NtSetDefaultHardErrorPort failed (Status=0x%08lx)\n",
1121 return Status;
1122 }
1123
1124 /* Return status */
1125 return Status;
1126}
1127
1128/*++
1129 * @name CsrPopulateDosDevices
1130 * @unimplemented NT5.1
1131 *
1132 * The CsrPopulateDosDevices routine uses the DOS Device Map from the Kernel
1133 * to populate the Dos Devices Object Directory for the session.
1134 *
1135 * @param None.
1136 *
1137 * @return None.
1138 *
1139 * @remarks None.
1140 *
1141 *--*/
1142VOID
1143NTAPI
1145{
1146 DPRINT1("Deprecated API in r55585.\n");
1147 return;
1148}
1149
1150BOOL
1151NTAPI
1152DllMain(IN HINSTANCE hInstanceDll,
1155{
1156 /* We don't do much */
1157 UNREFERENCED_PARAMETER(hInstanceDll);
1160
1161 return TRUE;
1162}
1163
1164/* EOF */
#define NtCurrentPeb()
Definition: FLS.c:22
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
PSID WorldSid
Definition: globals.c:15
DWORD dwReason
Definition: misc.cpp:135
ULONG ProtectionMode
Definition: init.c:34
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
@ Ace
Definition: card.h:12
#define _stricmp
Definition: cat.c:22
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: cdrom.h:961
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: cdrom.h:963
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define CSRSRV_SERVERDLL_INDEX
Definition: csrmsg.h:20
PCSR_THREAD NTAPI CsrAddStaticServerThread(IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags)
Definition: thredsup.c:512
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define GENERIC_READ
Definition: compat.h:135
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
BOOLEAN WINAPI DllMain(HINSTANCE Instance, DWORD Reason, LPVOID Reserved)
Definition: init.c:14
static SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: security.c:14
@ AnsiString
Definition: dnslib.h:19
#define L(x)
Definition: resources.c:13
#define __FUNCTION__
Definition: types.h:116
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ SystemBasicInformation
Definition: ntddk_ex.h:11
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:24
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
NTSTATUS NTAPI NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
Definition: harderr.c:740
#define PROCESS_SUSPEND_RESUME
Definition: pstypes.h:163
#define PROCESS_TERMINATE
Definition: pstypes.h:153
#define PROCESS_VM_READ
Definition: pstypes.h:157
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:162
#define PROCESS_VM_WRITE
Definition: pstypes.h:158
#define PROCESS_VM_OPERATION
Definition: pstypes.h:156
#define PROCESS_DUP_HANDLE
#define PORT_ALL_ACCESS
Definition: lpctypes.h:51
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define ASSERT(a)
Definition: mode.c:44
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
struct _ACL ACL
struct _ACL * PACL
static PSID AdminSid
Definition: msgina.c:39
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1625
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
NTSYSAPI NTSTATUS NTAPI RtlGetAce(PACL Acl, ULONG AceIndex, PVOID *Ace)
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
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)
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
NTSYSAPI NTSTATUS NTAPI RtlGetDaclSecurityDescriptor(_In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Out_ PBOOLEAN DaclPresent, _Out_ PACL *Dacl, _Out_ PBOOLEAN DaclDefaulted)
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1270
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
@ KeyValuePartialInformation
Definition: nt_native.h:1185
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define KEY_READ
Definition: nt_native.h:1026
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1660
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)
#define GENERIC_ALL
Definition: nt_native.h:92
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3429
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
#define READ_CONTROL
Definition: nt_native.h:58
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1262
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSYSAPI NTSTATUS NTAPI RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value)
Definition: unicode.c:261
#define GENERIC_EXECUTE
Definition: nt_native.h:91
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
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
#define IMAGE_SUBSYSTEM_POSIX_CUI
Definition: ntimage.h:440
#define IMAGE_SUBSYSTEM_WINDOWS_CUI
Definition: ntimage.h:438
#define IMAGE_SUBSYSTEM_OS2_CUI
Definition: ntimage.h:439
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
#define IMAGE_SUBSYSTEM_NATIVE
Definition: ntimage.h:436
#define IMAGE_SUBSYSTEM_UNKNOWN
Definition: ntimage.h:435
NTSTATUS NTAPI NtCreatePort(OUT PHANDLE PortHandle, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG MaxConnectInfoLength, IN ULONG MaxDataLength, IN ULONG MaxPoolUsage)
Definition: create.c:222
NTSTATUS NTAPI NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle)
Definition: security.c:350
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:765
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
#define OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_PERMANENT
Definition: winternl.h:226
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
Definition: samrpc.c:14
#define REG_DWORD
Definition: sdbapi.c:615
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
NTSTATUS NTAPI SmConnectToSm(_In_opt_ PUNICODE_STRING SbApiPortName, _In_opt_ HANDLE SbApiPort, _In_opt_ ULONG ImageType, _Out_ PHANDLE SmApiPort)
Connects to the SM API port for registering a session callback port (Sb) associated to a subsystem,...
Definition: smclient.c:57
#define DPRINT
Definition: sndvol32.h:73
#define SB_PORT_NAME
Definition: srv.h:47
#define UNICODE_PATH_SEP
Definition: srv.h:49
#define SESSION_ROOT
Definition: srv.h:44
#define SM_REG_KEY
Definition: srv.h:41
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
PVOID ServerData[ANYSIZE_ARRAY]
Definition: csrsrv.h:60
PCSR_NEWPROCESS_CALLBACK NewProcessCallback
Definition: csrsrv.h:239
ULONG SizeOfProcessData
Definition: csrsrv.h:234
SID_AND_ATTRIBUTES User
Definition: setypes.h:1022
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSTATUS NTAPI CsrApiPortInitialize(VOID)
Definition: api.c:900
PCSR_PROCESS CsrRootProcess
Definition: procsup.c:22
VOID NTAPI CsrSbApiRequestThread(IN PVOID Parameter)
Definition: session.c:484
NTSTATUS NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
Definition: server.c:361
NTSTATUS NTAPI CsrInitializeNtSessionList(VOID)
Definition: session.c:53
NTSTATUS NTAPI CsrLoadServerDll(IN PCHAR DllString, IN PCHAR EntryPoint OPTIONAL, IN ULONG ServerId)
Definition: server.c:126
#define CSR_SERVER_DLL_MAX
Definition: api.h:34
NTSTATUS NTAPI CsrInitializeProcessStructure(VOID)
Definition: procsup.c:255
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX]
Definition: server.c:20
NTSTATUS NTAPI CsrSbApiPortInitialize(VOID)
Definition: init.c:913
PCSR_THREAD CsrSbApiRequestThreadPtr
Definition: init.c:30
VOID NTAPI FreeDosDevicesProtection(IN PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:392
ULONG CsrTotalPerProcessDataLength
Definition: init.c:39
NTSTATUS NTAPI CsrParseServerCommandLine(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:552
HANDLE BNOLinksDirectory
Definition: init.c:41
NTSTATUS NTAPI GetDosDevicesProtection(OUT PSECURITY_DESCRIPTOR DosDevicesSd)
Definition: init.c:209
ULONG SessionId
Definition: init.c:40
NTSTATUS NTAPI CsrCreateSessionObjectDirectory(IN ULONG Session)
Definition: init.c:424
NTSTATUS NTAPI CsrSetProcessSecurity(VOID)
Definition: init.c:66
UNICODE_STRING CsrDirectoryName
Definition: init.c:27
HANDLE CsrSbApiPort
Definition: init.c:29
HANDLE CsrSmApiPort
Definition: init.c:31
HANDLE DosDevicesDirectory
Definition: init.c:43
HANDLE CsrApiPort
Definition: init.c:33
ULONG CsrDebug
Definition: init.c:23
HANDLE SessionObjectDirectory
Definition: init.c:42
VOID NTAPI CsrPopulateDosDevices(VOID)
Definition: init.c:1144
ULONG CsrMaxApiRequestThreads
Definition: init.c:38
HANDLE CsrHeap
Definition: init.c:25
HANDLE CsrObjectDirectory
Definition: init.c:26
NTSTATUS NTAPI CsrInitCsrRootProcess(VOID)
Definition: init.c:767
NTSTATUS NTAPI CsrSetDirectorySecurity(IN HANDLE ObjectDirectory)
Definition: init.c:186
UNICODE_STRING CsrSbApiPortName
Definition: init.c:28
HANDLE hSbApiPort
Definition: init.c:32
SYSTEM_BASIC_INFORMATION CsrNtSysInfo
Definition: init.c:44
NTSTATUS NTAPI CsrServerInitialization(IN ULONG ArgumentCount, IN PCHAR Arguments[])
Definition: init.c:1009
NTSTATUS NTAPI CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd)
Definition: init.c:845
_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)
Queries a specific type of information in regard of an access token based upon the information class....
Definition: tokencls.c:473
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3782
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1279
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151
_In_ ULONG AclLength
Definition: rtlfuncs.h:1859
#define CONTAINER_INHERIT_ACE
Definition: setypes.h:747
#define INHERIT_ONLY_ACE
Definition: setypes.h:749
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define SECURITY_WORLD_SID_AUTHORITY
Definition: setypes.h:527
#define SECURITY_WORLD_RID
Definition: setypes.h:541
#define TOKEN_QUERY
Definition: setypes.h:940
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:574
#define ACL_REVISION2
Definition: setypes.h:43
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define OBJECT_INHERIT_ACE
Definition: setypes.h:746
@ TokenUser
Definition: setypes.h:978
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define SECURITY_CREATOR_OWNER_RID
Definition: setypes.h:545
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:827
#define ACL_REVISION
Definition: setypes.h:39
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652
#define SECURITY_CREATOR_SID_AUTHORITY
Definition: setypes.h:533