reactos/base/system/smss/initdosdev.c
Cameron Gutman 29fa274d6d - Create another branch for networking fixes
- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers)
 - If someone wants to delete aicom-network-fixes, they are welcome to
 - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea

svn path=/branches/aicom-network-branch/; revision=44353
2009-12-02 03:23:19 +00:00

92 lines
2.1 KiB
C

/*
* PROJECT: ReactOS Session Manager
* LICENSE: GPL v2 or later - See COPYING in the top level directory
* FILE: base/system/smss/initdosdev.c
* PURPOSE: Define symbolic links to kernel devices (MS-DOS names).
* PROGRAMMERS: ReactOS Development Team
*/
/* INCLUDES ******************************************************************/
#include "smss.h"
#define NDEBUG
#include <debug.h>
static NTSTATUS NTAPI
SmpDosDevicesQueryRoutine(PWSTR ValueName,
ULONG ValueType,
PVOID ValueData,
ULONG ValueLength,
PVOID Context,
PVOID EntryContext)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DeviceName;
UNICODE_STRING LinkName;
HANDLE LinkHandle;
WCHAR LinkBuffer[80];
NTSTATUS Status;
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
if (ValueType != REG_SZ)
{
return(STATUS_SUCCESS);
}
swprintf(LinkBuffer,
L"\\??\\%s",
ValueName);
RtlInitUnicodeString(&LinkName,
LinkBuffer);
RtlInitUnicodeString(&DeviceName,
(PWSTR)ValueData);
DPRINT("SM: Linking %wZ --> %wZ\n",
&LinkName,
&DeviceName);
/* create symbolic link */
InitializeObjectAttributes(&ObjectAttributes,
&LinkName,
OBJ_PERMANENT|OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtCreateSymbolicLinkObject(&LinkHandle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes,
&DeviceName);
if (!NT_SUCCESS(Status))
{
DPRINT1("%s: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
__FUNCTION__,
&LinkName,
&DeviceName);
}
NtClose(LinkHandle);
return(Status);
}
NTSTATUS
SmInitDosDevices(VOID)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
NTSTATUS Status;
RtlZeroMemory(&QueryTable,
sizeof(QueryTable));
QueryTable[0].QueryRoutine = SmpDosDevicesQueryRoutine;
Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
L"\\Session Manager\\DOS Devices",
QueryTable,
NULL,
NULL);
return(Status);
}
/* EOF */