Add information letting us know creation deletion of services has worked.
[reactos.git] / reactos / subsys / smss / initdosdev.c
1 /* $Id$
2 *
3 * initdosdev.c - Define symbolic links to kernel devices (MS-DOS names).
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
27 #include "smss.h"
28
29 #define NDEBUG
30 #include <debug.h>
31
32 static NTSTATUS STDCALL
33 SmpDosDevicesQueryRoutine(PWSTR ValueName,
34 ULONG ValueType,
35 PVOID ValueData,
36 ULONG ValueLength,
37 PVOID Context,
38 PVOID EntryContext)
39 {
40 OBJECT_ATTRIBUTES ObjectAttributes;
41 UNICODE_STRING DeviceName;
42 UNICODE_STRING LinkName;
43 HANDLE LinkHandle;
44 WCHAR LinkBuffer[80];
45 NTSTATUS Status;
46
47 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
48 DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
49
50 if (ValueType != REG_SZ)
51 {
52 return(STATUS_SUCCESS);
53 }
54
55 swprintf(LinkBuffer,
56 L"\\??\\%s",
57 ValueName);
58 RtlInitUnicodeString(&LinkName,
59 LinkBuffer);
60 RtlInitUnicodeString(&DeviceName,
61 (PWSTR)ValueData);
62
63 DPRINT("SM: Linking %wZ --> %wZ\n",
64 &LinkName,
65 &DeviceName);
66
67 /* create symbolic link */
68 InitializeObjectAttributes(&ObjectAttributes,
69 &LinkName,
70 OBJ_PERMANENT|OBJ_CASE_INSENSITIVE,
71 NULL,
72 NULL);
73 Status = NtCreateSymbolicLinkObject(&LinkHandle,
74 SYMBOLIC_LINK_ALL_ACCESS,
75 &ObjectAttributes,
76 &DeviceName);
77 if (!NT_SUCCESS(Status))
78 {
79 DPRINT1("%s: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
80 __FUNCTION__,
81 &LinkName,
82 &DeviceName);
83 }
84 NtClose(LinkHandle);
85
86 return(Status);
87 }
88
89
90 NTSTATUS
91 SmInitDosDevices(VOID)
92 {
93 RTL_QUERY_REGISTRY_TABLE QueryTable[2];
94 NTSTATUS Status;
95
96 RtlZeroMemory(&QueryTable,
97 sizeof(QueryTable));
98
99 QueryTable[0].QueryRoutine = SmpDosDevicesQueryRoutine;
100
101 Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
102 L"\\Session Manager\\DOS Devices",
103 QueryTable,
104 NULL,
105 NULL);
106 return(Status);
107 }
108
109 /* EOF */