1eb45a0d0ae11631ef32ab5743743eae969d87fa
[reactos.git] / reactos / subsys / smss / initobdir.c
1 /* $Id$
2 *
3 * initobdir.c - Session Manager object directories
4 *
5 * ReactOS Operating System
6 *
7 * --------------------------------------------------------------------
8 *
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
22 * MA 02139, USA.
23 *
24 * --------------------------------------------------------------------
25 */
26 #include "smss.h"
27
28 #define NDEBUG
29 #include <debug.h>
30
31 static NTSTATUS STDCALL
32 SmpObjectDirectoryQueryRoutine(PWSTR ValueName,
33 ULONG ValueType,
34 PVOID ValueData,
35 ULONG ValueLength,
36 PVOID Context,
37 PVOID EntryContext)
38 {
39 OBJECT_ATTRIBUTES ObjectAttributes;
40 UNICODE_STRING UnicodeString;
41 HANDLE WindowsDirectory;
42 NTSTATUS Status = STATUS_SUCCESS;
43
44 #ifndef NDEBUG
45 DbgPrint("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
46 DbgPrint("ValueData '%S'\n", (PWSTR)ValueData);
47 #endif
48 if (ValueType != REG_SZ)
49 {
50 return(STATUS_SUCCESS);
51 }
52
53 RtlInitUnicodeString(&UnicodeString,
54 (PWSTR)ValueData);
55
56 InitializeObjectAttributes(&ObjectAttributes,
57 &UnicodeString,
58 0,
59 NULL,
60 NULL);
61
62 Status = ZwCreateDirectoryObject(&WindowsDirectory,
63 0,
64 &ObjectAttributes);
65
66 return(Status);
67 }
68
69
70 NTSTATUS
71 SmCreateObjectDirectories(VOID)
72 {
73 RTL_QUERY_REGISTRY_TABLE QueryTable[2];
74 NTSTATUS Status;
75
76 RtlZeroMemory(&QueryTable,
77 sizeof(QueryTable));
78
79 QueryTable[0].Name = L"ObjectDirectories";
80 QueryTable[0].QueryRoutine = SmpObjectDirectoryQueryRoutine;
81
82 Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
83 SM_REGISTRY_ROOT_NAME,
84 QueryTable,
85 NULL,
86 NULL);
87
88 return(Status);
89 }
90
91 /* EOF */