df65eca50d19b4c4cecc42bde7e2c51a3e648104
[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 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
45 DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
46 if (ValueType != REG_SZ)
47 {
48 return(STATUS_SUCCESS);
49 }
50
51 RtlInitUnicodeString(&UnicodeString,
52 (PWSTR)ValueData);
53
54 InitializeObjectAttributes(&ObjectAttributes,
55 &UnicodeString,
56 0,
57 NULL,
58 NULL);
59
60 Status = ZwCreateDirectoryObject(&WindowsDirectory,
61 0,
62 &ObjectAttributes);
63
64 return(Status);
65 }
66
67
68 NTSTATUS
69 SmCreateObjectDirectories(VOID)
70 {
71 RTL_QUERY_REGISTRY_TABLE QueryTable[2];
72 NTSTATUS Status;
73
74 RtlZeroMemory(&QueryTable,
75 sizeof(QueryTable));
76
77 QueryTable[0].Name = L"ObjectDirectories";
78 QueryTable[0].QueryRoutine = SmpObjectDirectoryQueryRoutine;
79
80 Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
81 SM_REGISTRY_ROOT_NAME,
82 QueryTable,
83 NULL,
84 NULL);
85
86 return(Status);
87 }
88
89 /* EOF */