ReactOS 0.4.15-dev-7788-g1ad9096
init.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Base API Server DLL
4 * FILE: subsystems/win/basesrv/init.c
5 * PURPOSE: Initialization
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 * Pierre Schweitzer (pierre@reactos.org)
9 */
10
11/* INCLUDES *******************************************************************/
12
13#include "basesrv.h"
14#include "vdm.h"
15
16#include <winreg.h>
17
18#define NDEBUG
19#include <debug.h>
20
21#include "api.h"
22
23/* GLOBALS ********************************************************************/
24
27
28/* Memory */
29HANDLE BaseSrvHeap = NULL; // Our own heap.
30HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
31PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
32
35
37
38// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
40{
41 BaseSrvCreateProcess,
42 BaseSrvCreateThread,
43 BaseSrvGetTempFile,
44 BaseSrvExitProcess,
45 BaseSrvDebugProcess,
46 BaseSrvCheckVDM,
47 BaseSrvUpdateVDMEntry,
48 BaseSrvGetNextVDMCommand,
49 BaseSrvExitVDM,
50 BaseSrvIsFirstVDM,
51 BaseSrvGetVDMExitCode,
52 BaseSrvSetReenterCount,
53 BaseSrvSetProcessShutdownParam,
54 BaseSrvGetProcessShutdownParam,
55 BaseSrvNlsSetUserInfo,
56 BaseSrvNlsSetMultipleUserInfo,
57 BaseSrvNlsCreateSection,
58 BaseSrvSetVDMCurDirs,
59 BaseSrvGetVDMCurDirs,
60 BaseSrvBatNotification,
61 BaseSrvRegisterWowExec,
62 BaseSrvSoundSentryNotification,
63 BaseSrvRefreshIniFileMapping,
64 BaseSrvDefineDosDevice,
65 BaseSrvSetTermsrvAppInstallMode,
66 BaseSrvNlsUpdateCacheCount,
67 BaseSrvSetTermsrvClientTimeZone,
68 BaseSrvSxsCreateActivationContext,
69 BaseSrvDebugProcess,
70 BaseSrvRegisterThread,
71 BaseSrvNlsGetUserInfo,
72};
73
75{
76 TRUE, // BaseSrvCreateProcess
77 TRUE, // BaseSrvCreateThread
78 TRUE, // BaseSrvGetTempFile
79 FALSE, // BaseSrvExitProcess
80 FALSE, // BaseSrvDebugProcess
81 TRUE, // BaseSrvCheckVDM
82 TRUE, // BaseSrvUpdateVDMEntry
83 TRUE, // BaseSrvGetNextVDMCommand
84 TRUE, // BaseSrvExitVDM
85 TRUE, // BaseSrvIsFirstVDM
86 TRUE, // BaseSrvGetVDMExitCode
87 TRUE, // BaseSrvSetReenterCount
88 TRUE, // BaseSrvSetProcessShutdownParam
89 TRUE, // BaseSrvGetProcessShutdownParam
90 TRUE, // BaseSrvNlsSetUserInfo
91 TRUE, // BaseSrvNlsSetMultipleUserInfo
92 TRUE, // BaseSrvNlsCreateSection
93 TRUE, // BaseSrvSetVDMCurDirs
94 TRUE, // BaseSrvGetVDMCurDirs
95 TRUE, // BaseSrvBatNotification
96 TRUE, // BaseSrvRegisterWowExec
97 TRUE, // BaseSrvSoundSentryNotification
98 TRUE, // BaseSrvRefreshIniFileMapping
99 TRUE, // BaseSrvDefineDosDevice
100 TRUE, // BaseSrvSetTermsrvAppInstallMode
101 TRUE, // BaseSrvNlsUpdateCacheCount
102 TRUE, // BaseSrvSetTermsrvClientTimeZone
103 TRUE, // BaseSrvSxsCreateActivationContext
104 FALSE, // BaseSrvDebugProcess
105 TRUE, // BaseSrvRegisterThread
106 TRUE, // BaseSrvNlsGetUserInfo
107};
108
109/*
110 * On Windows Server 2003, CSR Servers contain
111 * the API Names Table only in Debug Builds.
112 */
113#ifdef CSR_DBG
114PCHAR BaseServerApiNameTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] =
115{
116 "BaseCreateProcess",
117 "BaseCreateThread",
118 "BaseGetTempFile",
119 "BaseExitProcess",
120 "BaseDebugProcess",
121 "BaseCheckVDM",
122 "BaseUpdateVDMEntry",
123 "BaseGetNextVDMCommand",
124 "BaseExitVDM",
125 "BaseIsFirstVDM",
126 "BaseGetVDMExitCode",
127 "BaseSetReenterCount",
128 "BaseSetProcessShutdownParam",
129 "BaseGetProcessShutdownParam",
130 "BaseNlsSetUserInfo",
131 "BaseNlsSetMultipleUserInfo",
132 "BaseNlsCreateSection",
133 "BaseSetVDMCurDirs",
134 "BaseGetVDMCurDirs",
135 "BaseBatNotification",
136 "BaseRegisterWowExec",
137 "BaseSoundSentryNotification",
138 "BaseRefreshIniFileMapping",
139 "BaseDefineDosDevice",
140 "BaseSetTermsrvAppInstallMode",
141 "BaseNlsUpdateCacheCount",
142 "BaseSetTermsrvClientTimeZone",
143 "BaseSxsCreateActivationContext",
144 "BaseSrvDebugProcessStop",
145 "BaseRegisterThread",
146 "BaseNlsGetUserInfo",
147};
148#endif
149
150/* FUNCTIONS ******************************************************************/
151
153NTAPI
155{
156 /* Allocate the mapping blob */
159 sizeof(*BaseSrvIniFileMapping));
161 {
162 DPRINT1("BASESRV: Unable to allocate memory in shared heap for IniFileMapping\n");
163 return STATUS_NO_MEMORY;
164 }
165
166 /* Set it*/
167 StaticServerData->IniFileMapping = BaseSrvIniFileMapping;
168
169 /* FIXME: Do the work to initialize the mappings */
170 return STATUS_SUCCESS;
171}
172
174NTAPI
176 OUT PACL* RestrictedDacl)
177{
178 PSID SystemSid, WorldSid, RestrictedSid;
182 UCHAR KeyValueBuffer[0x40];
183 PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
187 HANDLE hKey;
189 ULONG ObjectSecurityMode;
190 ACCESS_MASK WorldAccess, RestrictedAccess;
191
192 /* Open the Session Manager Key */
195 &KeyName,
197 NULL,
198 NULL);
200 if (NT_SUCCESS(Status))
201 {
202 /* Read the key value */
203 RtlInitUnicodeString(&KeyName, L"ProtectionMode");
205 &KeyName,
207 KeyValueBuffer,
208 sizeof(KeyValueBuffer),
209 &ResultLength);
210
211 /* Make sure it's what we expect it to be */
212 KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer;
213 if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) &&
214 (*(PULONG)KeyValuePartialInfo->Data))
215 {
216 /* Save the Protection Mode */
217 ProtectionMode = *(PULONG)KeyValuePartialInfo->Data;
218 }
219
220 /* Close the handle */
221 NtClose(hKey);
222 }
223
224 /* Get object security mode */
225 if (SessionId == 0 ||
227 {
228 ObjectSecurityMode = 0;
229 }
230
231 /* Allocate the System SID */
234 0, 0, 0, 0, 0, 0, 0,
235 &SystemSid);
236 if (!NT_SUCCESS(Status))
237 {
238 return Status;
239 }
240
241 /* Allocate the World SID */
244 0, 0, 0, 0, 0, 0, 0,
245 &WorldSid);
246 if (!NT_SUCCESS(Status))
247 {
248 RtlFreeSid(SystemSid);
249 goto Return;
250 }
251
252 /* Allocate the restricted SID */
255 0, 0, 0, 0, 0, 0, 0,
256 &RestrictedSid);
257 if (!NT_SUCCESS(Status))
258 {
260 RtlFreeSid(SystemSid);
261 goto Return;
262 }
263
264 /* Allocate one ACL with 3 ACEs each for one SID */
265 AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) +
266 RtlLengthSid(SystemSid) +
268 RtlLengthSid(RestrictedSid);
270 if (*Dacl == NULL)
271 {
273 goto FreeAndReturn;
274 }
275
276 /* Set the correct header fields */
278 if (!NT_SUCCESS(Status))
279 {
281 goto FreeAndReturn;
282 }
283
284 /* Setup access for anyone depending on object security mode */
285 if (ObjectSecurityMode != 0)
286 {
287 /*
288 * If we have restrictions on security mode, make it read only
289 * it also means session ID is not 0
290 */
291 WorldAccess = DIRECTORY_QUERY | DIRECTORY_TRAVERSE;
292 }
293 else
294 {
295 /* Otherwise, open wide */
297 }
298
299 /* Give the appropriate rights to each SID */
302 {
304 }
305
306 /* Now allocate the restricted DACL */
307 *RestrictedDacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength);
308 if (*RestrictedDacl == NULL)
309 {
312 goto FreeAndReturn;
313 }
314
315 /* Initialize it */
316 Status = RtlCreateAcl(*RestrictedDacl, AclLength, ACL_REVISION2);
317 if (!NT_SUCCESS(Status))
318 {
319 RtlFreeHeap(BaseSrvHeap, 0, *RestrictedDacl);
321 goto FreeAndReturn;
322 }
323
324 /* Setup access for restricted sid depending on session id and protection mode */
325 if (SessionId == 0 || (ProtectionMode & 3) == 0)
326 {
327 /* If we have no session ID or if protection mode is not set, then open wide */
329 }
330 else
331 {
332 /* Otherwise, make read only */
333 RestrictedAccess = READ_CONTROL | DIRECTORY_QUERY | DIRECTORY_TRAVERSE;
334 }
335
336 /* And add the same ACEs as before */
337 Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, WorldAccess, WorldSid);
338 if (NT_SUCCESS(Status))
339 {
340 Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid);
341 if (NT_SUCCESS(Status))
342 {
343 Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, RestrictedAccess, RestrictedSid);
344 }
345 }
346
347 /* The SIDs are captured, can free them now */
348FreeAndReturn:
349 RtlFreeSid(RestrictedSid);
351 RtlFreeSid(SystemSid);
352
353Return:
354 return Status;
355}
356
357VOID
358NTAPI
360{
363 WCHAR BnoBuffer[100];
365 PWCHAR HeapBuffer;
366 UNICODE_STRING SystemRootString;
367 UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%");
368 UNICODE_STRING BaseSrvCSDString;
369 UNICODE_STRING BaseSrvWindowsDirectory;
370 UNICODE_STRING BaseSrvWindowsSystemDirectory;
371 UNICODE_STRING BnoString;
373 HANDLE BaseSrvNamedObjectDirectory;
374 HANDLE BaseSrvRestrictedObjectDirectory;
375 PACL BnoDacl, BnoRestrictedDacl;
377 HANDLE SymHandle;
378 UNICODE_STRING DirectoryName, SymlinkName;
379 ULONG LuidEnabled;
380 RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[2] =
381 {
382 {
383 NULL,
385 L"CSDVersion",
386 &BaseSrvCSDString,
387 REG_NONE, NULL, 0
388 },
389
390 {0}
391 };
392
393 /* Initialize the memory */
394 BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
395 BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
396
397 /* Get the session ID */
398 SessionId = NtCurrentPeb()->SessionId;
399
400 /* Get the Windows directory */
401 RtlInitEmptyUnicodeString(&SystemRootString, Buffer, sizeof(Buffer));
403 &UnexpandedSystemRootString,
404 &SystemRootString,
405 NULL);
407
408 /* Create the base directory */
409 Buffer[SystemRootString.Length / sizeof(WCHAR)] = UNICODE_NULL;
410 Success = RtlCreateUnicodeString(&BaseSrvWindowsDirectory,
411 SystemRootString.Buffer);
413
414 /* Create the system directory */
415 wcscat(SystemRootString.Buffer, L"\\System32");
416 Success = RtlCreateUnicodeString(&BaseSrvWindowsSystemDirectory,
417 SystemRootString.Buffer);
419
420 /* Create the kernel32 path */
421 wcscat(SystemRootString.Buffer, L"\\kernel32.dll");
423 SystemRootString.Buffer);
425
426 if (SessionId != 0)
427 {
428 swprintf(BnoBuffer, L"\\Sessions\\%ld\\BaseNamedObjects", SessionId);
429 }
430 else
431 {
432 wcscpy(BnoBuffer, L"\\BaseNamedObjects");
433 }
434 RtlInitUnicodeString(&BnoString, BnoBuffer);
435
436 /* Allocate the server data */
441
442 /* Process timezone information */
448 NULL);
450
451 /* Make a shared heap copy of the Windows directory */
452 BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory;
454 0,
455 BaseSrvWindowsDirectory.MaximumLength);
456 ASSERT(HeapBuffer);
457 RtlCopyMemory(HeapBuffer,
459 BaseSrvWindowsDirectory.MaximumLength);
461
462 /* Make a shared heap copy of the System directory */
463 BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory;
465 0,
466 BaseSrvWindowsSystemDirectory.MaximumLength);
467 ASSERT(HeapBuffer);
468 RtlCopyMemory(HeapBuffer,
470 BaseSrvWindowsSystemDirectory.MaximumLength);
472
473 /* This string is not used */
474 RtlInitEmptyUnicodeString(&BaseStaticServerData->WindowsSys32x86Directory,
475 NULL,
476 0);
477
478 /* Make a shared heap copy of the BNO directory */
481 sizeof(UNICODE_NULL);
483 0,
485 ASSERT(HeapBuffer);
486 RtlCopyMemory(HeapBuffer,
490
491 /*
492 * Confirmed that in Windows, CSDNumber and RCNumber are actually Length
493 * and MaximumLength of the CSD String, since the same UNICODE_STRING is
494 * being queried twice, the first time as a ULONG!
495 *
496 * Somehow, in Windows this doesn't cause a buffer overflow, but it might
497 * in ReactOS, so this code is disabled until someone figures out WTF.
498 */
501
502 /* Initialize the CSD string and query its value from the registry */
503 RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer));
505 L"",
506 BaseServerRegistryConfigurationTable,
507 NULL,
508 NULL);
509 if (NT_SUCCESS(Status))
510 {
511 /* Copy into the shared buffer */
513 BaseSrvCSDString.Buffer,
514 BaseSrvCSDString.Length / sizeof(WCHAR));
515 }
516 else
517 {
518 /* Indicate nothing is there */
519 BaseSrvCSDString.Length = 0;
520 }
521 /* NULL-terminate */
522 BaseStaticServerData->CSDVersion[BaseSrvCSDString.Length / sizeof(WCHAR)] = UNICODE_NULL;
523
524 /* Cache the system information */
528 NULL);
530
531 /* Setup the ini file mappings */
534
535 /* FIXME: Should query the registry for these */
538
539 /* Allocate a security descriptor and create it */
540 BnoSd = RtlAllocateHeap(BaseSrvHeap, 0, 1024);
541 ASSERT(BnoSd);
544
545 /* Create the BNO and \Restricted DACLs */
546 Status = CreateBaseAcls(&BnoDacl, &BnoRestrictedDacl);
548
549 /* Set the BNO DACL as active for now */
550 Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoDacl, FALSE);
552
553 /* Create the BNO directory */
555 &BnoString,
557 NULL,
558 BnoSd);
559 Status = NtCreateDirectoryObject(&BaseSrvNamedObjectDirectory,
563
564 /* Check if we are session 0 */
565 if (SessionId == 0)
566 {
567 /* Mark this as a session 0 directory */
568 Status = NtSetInformationObject(BaseSrvNamedObjectDirectory,
569 ObjectSessionInformation,
570 NULL,
571 0);
573 }
574
575 /* Check if LUID device maps are enabled */
578 &LuidEnabled,
579 sizeof(LuidEnabled),
580 NULL);
583
584 /* Initialize Global */
587 {
588 /* Make Global point back to BNO */
589 RtlInitUnicodeString(&DirectoryName, L"Global");
590 RtlInitUnicodeString(&SymlinkName, L"\\BaseNamedObjects");
592 &DirectoryName,
594 BaseSrvNamedObjectDirectory,
595 BnoSd);
599 &SymlinkName);
600 if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle);
601
602 /* Make local point back to \Sessions\x\BNO */
603 RtlInitUnicodeString(&DirectoryName, L"Local");
604 ASSERT(SessionId == 0);
606 &DirectoryName,
608 BaseSrvNamedObjectDirectory,
609 BnoSd);
613 &BnoString);
614 if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle);
615
616 /* Make Session point back to BNOLINKS */
617 RtlInitUnicodeString(&DirectoryName, L"Session");
618 RtlInitUnicodeString(&SymlinkName, L"\\Sessions\\BNOLINKS");
620 &DirectoryName,
622 BaseSrvNamedObjectDirectory,
623 BnoSd);
627 &SymlinkName);
628 if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle);
629
630 /* Create the BNO\Restricted directory and set the restricted DACL */
631 RtlInitUnicodeString(&DirectoryName, L"Restricted");
632 Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoRestrictedDacl, FALSE);
635 &DirectoryName,
637 BaseSrvNamedObjectDirectory,
638 BnoSd);
639 Status = NtCreateDirectoryObject(&BaseSrvRestrictedObjectDirectory,
643 }
644 else
645 {
646 /* That should never happen */
647 ASSERT(FALSE);
648 }
649
650 /* Initialize NLS */
652
653 /* Finally, set the pointer */
654 LoadedServerDll->SharedSection = BaseStaticServerData;
655}
656
658NTAPI
660 IN OUT PVOID ConnectionInfo,
661 IN OUT PULONG ConnectionInfoLength)
662{
663 PBASESRV_API_CONNECTINFO ConnectInfo = (PBASESRV_API_CONNECTINFO)ConnectionInfo;
664
665 if ( ConnectionInfo == NULL ||
666 ConnectionInfoLength == NULL ||
667 *ConnectionInfoLength != sizeof(*ConnectInfo) )
668 {
669 DPRINT1("BASESRV: Connection failed - ConnectionInfo = 0x%p ; ConnectionInfoLength = 0x%p (%lu), expected %lu\n",
670 ConnectionInfo,
671 ConnectionInfoLength,
672 ConnectionInfoLength ? *ConnectionInfoLength : (ULONG)-1,
673 sizeof(*ConnectInfo));
674
676 }
677
678 /* Do the NLS connection */
679 return BaseSrvNlsConnect(CsrProcess, ConnectionInfo, ConnectionInfoLength);
680}
681
682VOID
683NTAPI
685{
686 /* Cleanup VDM resources */
688}
689
690CSR_SERVER_DLL_INIT(ServerDllInitialization)
691{
692 /* Setup the DLL Object */
693 LoadedServerDll->ApiBase = BASESRV_FIRST_API_NUMBER;
694 LoadedServerDll->HighestApiSupported = BasepMaxApiNumber;
695 LoadedServerDll->DispatchTable = BaseServerApiDispatchTable;
696 LoadedServerDll->ValidTable = BaseServerApiServerValidTable;
697#ifdef CSR_DBG
698 LoadedServerDll->NameTable = BaseServerApiNameTable;
699#endif
700 LoadedServerDll->SizeOfProcessData = 0;
701 LoadedServerDll->ConnectCallback = BaseClientConnectRoutine;
702 LoadedServerDll->DisconnectCallback = BaseClientDisconnectRoutine;
703 LoadedServerDll->ShutdownProcessCallback = NULL;
704
705 BaseSrvDllInstance = LoadedServerDll->ServerHandle;
706
707 BaseInitializeStaticServerData(LoadedServerDll);
708
709 /* Initialize DOS devices management */
711
712 /* Initialize VDM support */
714
715 /* All done */
716 return STATUS_SUCCESS;
717}
718
719BOOL
720NTAPI
721DllMain(IN HINSTANCE hInstanceDll,
723 IN LPVOID lpReserved)
724{
725 UNREFERENCED_PARAMETER(hInstanceDll);
727 UNREFERENCED_PARAMETER(lpReserved);
728
730 {
732 }
733
734 return TRUE;
735}
736
737/* EOF */
#define NtCurrentPeb()
Definition: FLS.c:22
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
PSID WorldSid
Definition: globals.c:15
DWORD dwReason
Definition: misc.cpp:154
static SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: security.c:40
#define BASESRV_FIRST_API_NUMBER
Definition: basemsg.h:16
@ BasepMaxApiNumber
Definition: basemsg.h:53
struct _BASESRV_API_CONNECTINFO * PBASESRV_API_CONNECTINFO
ULONG ProtectionMode
Definition: init.c:34
RTL_CRITICAL_SECTION BaseSrvDDDBSMCritSec
Definition: dosdev.c:27
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
Definition: bufpool.h:45
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
NTSTATUS(NTAPI * PCSR_API_ROUTINE)(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
Definition: csrsrv.h:171
#define CSR_SERVER_DLL_INIT(n)
Definition: csrsrv.h:255
#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:32
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOLEAN WINAPI DllMain(HINSTANCE Instance, DWORD Reason, LPVOID Reserved)
Definition: init.c:14
static SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: security.c:14
#define swprintf
Definition: precomp.h:40
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ SystemTimeOfDayInformation
Definition: ntddk_ex.h:14
@ SystemBasicInformation
Definition: ntddk_ex.h:11
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
#define OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_PERMANENT
Definition: winternl.h:226
NTSYSAPI NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING *, UNICODE_STRING *, ULONG *)
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
@ ProcessLUIDDeviceMapsEnabled
Definition: winternl.h:884
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
#define ASSERT(a)
Definition: mode.c:44
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
struct _ACL ACL
@ SystemObjectSecurityMode
Definition: extypes.h:287
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1593
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSectionAndSpinCount(_In_ PRTL_CRITICAL_SECTION CriticalSection, _In_ ULONG SpinCount)
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1267
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define DIRECTORY_CREATE_OBJECT
Definition: nt_native.h:1256
@ KeyValuePartialInformation
Definition: nt_native.h:1182
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define KEY_READ
Definition: nt_native.h:1023
#define DIRECTORY_QUERY
Definition: nt_native.h:1254
#define DIRECTORY_TRAVERSE
Definition: nt_native.h:1255
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1657
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 RTL_REGISTRY_WINDOWS_NT
Definition: nt_native.h:164
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
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:1259
#define REG_NONE
Definition: nt_native.h:1492
#define DIRECTORY_CREATE_SUBDIRECTORY
Definition: nt_native.h:1257
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
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
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:59
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:765
NTSTATUS NTAPI NtSetInformationObject(IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, IN PVOID ObjectInformation, IN ULONG Length)
Definition: oblife.c:1824
#define BOOLEAN
Definition: pedump.c:73
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_SUCCESS
Definition: shellext.h:65
#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)
BOOLEAN LUIDDeviceMapsEnabled
Definition: base.h:141
ULONG TermsrvClientTimeZoneChangeNum
Definition: base.h:142
UNICODE_STRING NamedObjectDirectory
Definition: base.h:123
BOOLEAN IsWowTaskReady
Definition: base.h:135
UNICODE_STRING WindowsDirectory
Definition: base.h:121
ULONG TermsrvClientTimeZoneId
Definition: base.h:140
SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay
Definition: base.h:131
BOOLEAN DefaultSeparateVDM
Definition: base.h:134
UNICODE_STRING WindowsSys32x86Directory
Definition: base.h:136
SYSTEM_BASIC_INFORMATION SysInfo
Definition: base.h:130
UNICODE_STRING WindowsSystemDirectory
Definition: base.h:122
WCHAR CSDVersion[128]
Definition: base.h:129
USHORT MaximumLength
Definition: env_spec_w32.h:370
ULONG SessionId
Definition: init.c:40
VOID BaseCleanupDefineDosDevice(VOID)
Definition: dosdev.c:39
VOID NTAPI BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData)
Definition: nls.c:117
VOID BaseInitDefineDosDevice(VOID)
Definition: dosdev.c:34
NTSTATUS NTAPI BaseSrvNlsConnect(IN PCSR_PROCESS CsrProcess, IN OUT PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoLength)
Definition: nls.c:140
HANDLE BaseSrvSharedHeap
Definition: init.c:30
NTSTATUS NTAPI BaseClientConnectRoutine(IN PCSR_PROCESS CsrProcess, IN OUT PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoLength)
Definition: init.c:659
VOID NTAPI BaseClientDisconnectRoutine(IN PCSR_PROCESS CsrProcess)
Definition: init.c:684
BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER]
Definition: init.c:74
PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER]
Definition: init.c:39
UNICODE_STRING BaseSrvKernel32DllPath
Definition: nls.c:25
NTSTATUS NTAPI CreateBaseAcls(OUT PACL *Dacl, OUT PACL *RestrictedDacl)
Definition: init.c:175
HANDLE BaseSrvHeap
Definition: init.c:29
HANDLE BaseSrvDllInstance
Definition: init.c:25
PBASE_STATIC_SERVER_DATA BaseStaticServerData
Definition: init.c:31
PINIFILE_MAPPING BaseSrvIniFileMapping
Definition: init.c:36
NTSTATUS NTAPI BaseSrvInitializeIniFileMappings(IN PBASE_STATIC_SERVER_DATA StaticServerData)
Definition: init.c:154
VOID NTAPI BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
Definition: init.c:359
VOID BaseSrvCleanupVDMResources(IN PCSR_PROCESS CsrProcess)
Definition: vdm.c:296
VOID BaseInitializeVDM(VOID)
Definition: vdm.c:587
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
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
PKPROCESS CsrProcess
Definition: videoprt.c:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:286
_In_ ULONG AclLength
Definition: rtlfuncs.h:1842
#define SECURITY_WORLD_SID_AUTHORITY
Definition: setypes.h:527
#define SECURITY_WORLD_RID
Definition: setypes.h:541
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:574
#define ACL_REVISION2
Definition: setypes.h:43
#define SECURITY_RESTRICTED_CODE_RID
Definition: setypes.h:569
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180