ReactOS  0.4.14-dev-323-g6fe6a88
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 */
29 HANDLE BaseSrvHeap = NULL; // Our own heap.
30 HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
31 PBASE_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
114 PCHAR 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 
152 NTSTATUS
153 NTAPI
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 
173 NTSTATUS
174 NTAPI
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");
204  Status = NtQueryValueKey(hKey,
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 ||
226  !NT_SUCCESS(NtQuerySystemInformation(SystemObjectSecurityMode, &ObjectSecurityMode, sizeof(ULONG), NULL)))
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 */
348 FreeAndReturn:
349  RtlFreeSid(RestrictedSid);
351  RtlFreeSid(SystemSid);
352 
353 Return:
354  return Status;
355 }
356 
357 VOID
358 NTAPI
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;
376  PSECURITY_DESCRIPTOR BnoSd;
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);
412  ASSERT(Success);
413 
414  /* Create the system directory */
415  wcscat(SystemRootString.Buffer, L"\\System32");
416  Success = RtlCreateUnicodeString(&BaseSrvWindowsSystemDirectory,
417  SystemRootString.Buffer);
418  ASSERT(Success);
419 
420  /* Create the kernel32 path */
421  wcscat(SystemRootString.Buffer, L"\\kernel32.dll");
423  SystemRootString.Buffer);
424  ASSERT(Success);
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 */
439  sizeof(BASE_STATIC_SERVER_DATA));
441 
442  /* Process timezone information */
448  NULL);
450 
451  /* Make a shared heap copy of the Windows directory */
452  BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory;
453  HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
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;
464  HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
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);
482  HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
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 */
527  sizeof(BaseStaticServerData->SysInfo),
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);
596  Status = NtCreateSymbolicLinkObject(&SymHandle,
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);
610  Status = NtCreateSymbolicLinkObject(&SymHandle,
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);
624  Status = NtCreateSymbolicLinkObject(&SymHandle,
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 
657 NTSTATUS
658 NTAPI
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 
682 VOID
683 NTAPI
685 {
686  /* Cleanup VDM resources */
687  BaseSrvCleanupVDMResources(CsrProcess);
688 }
689 
690 CSR_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 
719 BOOL
720 NTAPI
721 DllMain(IN HINSTANCE hInstanceDll,
722  IN DWORD dwReason,
723  IN LPVOID lpReserved)
724 {
725  UNREFERENCED_PARAMETER(hInstanceDll);
727  UNREFERENCED_PARAMETER(lpReserved);
728 
730  {
732  }
733 
734  return TRUE;
735 }
736 
737 /* EOF */
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
VOID BaseCleanupDefineDosDevice(VOID)
Definition: dosdev.c:39
signed char * PCHAR
Definition: retypes.h:7
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
UNICODE_STRING BaseSrvKernel32DllPath
Definition: nls.c:25
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define IN
Definition: typedefs.h:38
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:546
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
USHORT MaximumLength
Definition: env_spec_w32.h:370
HANDLE BaseSrvHeap
Definition: init.c:29
#define RTL_REGISTRY_WINDOWS_NT
Definition: nt_native.h:164
#define KEY_READ
Definition: nt_native.h:1023
NTSTATUS NTAPI CreateBaseAcls(OUT PACL *Dacl, OUT PACL *RestrictedDacl)
Definition: init.c:175
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define DIRECTORY_CREATE_OBJECT
Definition: nt_native.h:1256
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
UNICODE_STRING WindowsDirectory
Definition: base.h:113
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN DefaultSeparateVDM
Definition: base.h:126
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
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:283
#define SM_REG_KEY
Definition: basesrv.h:73
#define OBJ_PERMANENT
Definition: winternl.h:226
NTSTATUS NTAPI BaseSrvNlsConnect(IN PCSR_PROCESS CsrProcess, IN OUT PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoLength)
Definition: nls.c:135
NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(_Out_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG Revision)
uint16_t * PWCHAR
Definition: typedefs.h:54
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 SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1267
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSectionAndSpinCount(_In_ PRTL_CRITICAL_SECTION CriticalSection, _In_ ULONG SpinCount)
UNICODE_STRING WindowsSystemDirectory
Definition: base.h:114
NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL Acl, ULONG AclSize, ULONG AclRevision)
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
DWORD dwReason
Definition: misc.cpp:154
#define OBJ_OPENIF
Definition: winternl.h:229
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
CSR_SERVER_DLL_INIT(ServerDllInitialization)
Definition: init.c:690
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE BaseSrvDllInstance
Definition: init.c:25
NTSTATUS NTAPI NtSetInformationObject(IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, IN PVOID ObjectInformation, IN ULONG Length)
Definition: oblife.c:1735
NTSTATUS(NTAPI * PCSR_API_ROUTINE)(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
Definition: csrsrv.h:171
NTSTATUS NTAPI BaseSrvInitializeIniFileMappings(IN PBASE_STATIC_SERVER_DATA StaticServerData)
Definition: init.c:154
UNICODE_STRING NamedObjectDirectory
Definition: base.h:115
unsigned char BOOLEAN
BOOLEAN LUIDDeviceMapsEnabled
Definition: base.h:133
#define ACL_REVISION2
Definition: setypes.h:43
struct _ACL ACL
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN)
Definition: bufpool.h:45
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSTATUS NTAPI BaseClientConnectRoutine(IN PCSR_PROCESS CsrProcess, IN OUT PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoLength)
Definition: init.c:659
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
#define DLL_PROCESS_DETACH
Definition: compat.h:119
PBASE_STATIC_SERVER_DATA BaseStaticServerData
Definition: init.c:31
#define NtCurrentProcess()
Definition: nt_native.h:1657
SYSTEM_BASIC_INFORMATION SysInfo
Definition: base.h:122
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
NTSYSAPI NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING *, UNICODE_STRING *, ULONG *)
#define DIRECTORY_TRAVERSE
Definition: nt_native.h:1255
VOID BaseInitializeVDM(VOID)
Definition: vdm.c:588
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 DIRECTORY_CREATE_SUBDIRECTORY
Definition: nt_native.h:1257
BOOLEAN IsWowTaskReady
Definition: base.h:127
struct _BASESRV_API_CONNECTINFO * PBASESRV_API_CONNECTINFO
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UNICODE_STRING WindowsSys32x86Directory
Definition: base.h:128
#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 MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
#define SECURITY_WORLD_RID
Definition: setypes.h:513
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define BASESRV_FIRST_API_NUMBER
Definition: basemsg.h:16
#define READ_CONTROL
Definition: nt_native.h:58
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
Definition: init.c:359
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1553
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
PSID WorldSid
Definition: globals.c:15
VOID NTAPI BaseClientDisconnectRoutine(IN PCSR_PROCESS CsrProcess)
Definition: init.c:684
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:773
PINIFILE_MAPPING BaseSrvIniFileMapping
Definition: init.c:36
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define NtCurrentPeb()
Definition: FLS.c:20
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
HANDLE BaseSrvSharedHeap
Definition: init.c:30
WCHAR CSDVersion[128]
Definition: base.h:121
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int * PULONG
Definition: retypes.h:1
#define SECURITY_RESTRICTED_CODE_RID
Definition: setypes.h:541
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
VOID NTAPI BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData)
Definition: nls.c:112
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER]
Definition: init.c:39
VOID BaseInitDefineDosDevice(VOID)
Definition: dosdev.c:34
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:39
VOID BaseSrvCleanupVDMResources(IN PCSR_PROCESS CsrProcess)
Definition: vdm.c:297
unsigned int ULONG
Definition: retypes.h:1
#define DIRECTORY_QUERY
Definition: nt_native.h:1254
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
RTL_CRITICAL_SECTION BaseSrvDDDBSMCritSec
Definition: dosdev.c:27
ULONG TermsrvClientTimeZoneChangeNum
Definition: base.h:134
#define REG_NONE
Definition: nt_native.h:1492
SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay
Definition: base.h:123
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define REG_DWORD
Definition: sdbapi.c:596
BOOLEAN WINAPI DllMain(HINSTANCE Instance, DWORD Reason, LPVOID Reserved)
Definition: init.c:14
ULONG TermsrvClientTimeZoneId
Definition: base.h:132
BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER]
Definition: init.c:74
ULONG ACCESS_MASK
Definition: nt_native.h:40
_In_ ULONG AclLength
Definition: rtlfuncs.h:1844
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: database.c:19
ULONG SessionId
Definition: init.c:33
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14