3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/io/symlink.c
6 * PURPOSE: Implements symbolic links
7 * PROGRAMMER: David Welch (welch@mcmail.com)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/se.h>
18 #include <internal/debug.h>
21 /* FUNCTIONS ****************************************************************/
23 /**********************************************************************
25 * IoCreateSymbolicLink
37 IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName,
38 PUNICODE_STRING DeviceName)
40 OBJECT_ATTRIBUTES ObjectAttributes;
44 assert_irql(PASSIVE_LEVEL);
46 DPRINT("IoCreateSymbolicLink(SymbolicLinkName %wZ, DeviceName %wZ)\n",
50 InitializeObjectAttributes(&ObjectAttributes,
56 Status = NtCreateSymbolicLinkObject(&Handle,
57 SYMBOLIC_LINK_ALL_ACCESS,
60 if (!NT_SUCCESS(Status))
62 DPRINT1("NtCreateSymbolicLinkObject() failed (Status %lx)\n", Status);
68 return(STATUS_SUCCESS);
72 /**********************************************************************
74 * IoCreateUnprotectedSymbolicLink
86 IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName,
87 PUNICODE_STRING DeviceName)
89 SECURITY_DESCRIPTOR SecurityDescriptor;
90 OBJECT_ATTRIBUTES ObjectAttributes;
94 assert_irql(PASSIVE_LEVEL);
96 DPRINT("IoCreateUnprotectedSymbolicLink(SymbolicLinkName %wZ, DeviceName %wZ)\n",
100 Status = RtlCreateSecurityDescriptor(&SecurityDescriptor,
101 SECURITY_DESCRIPTOR_REVISION);
102 if (!NT_SUCCESS(Status))
104 DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n", Status);
108 Status = RtlSetDaclSecurityDescriptor(&SecurityDescriptor,
112 if (!NT_SUCCESS(Status))
114 DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n", Status);
118 InitializeObjectAttributes(&ObjectAttributes,
122 &SecurityDescriptor);
124 Status = NtCreateSymbolicLinkObject(&Handle,
125 SYMBOLIC_LINK_ALL_ACCESS,
128 if (!NT_SUCCESS(Status))
130 DPRINT1("NtCreateSymbolicLinkObject() failed (Status %lx)\n", Status);
136 return(STATUS_SUCCESS);
140 /**********************************************************************
142 * IoDeleteSymbolicLink
154 IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName)
156 OBJECT_ATTRIBUTES ObjectAttributes;
160 assert_irql(PASSIVE_LEVEL);
162 DPRINT("IoDeleteSymbolicLink (SymbolicLinkName %S)\n",
163 SymbolicLinkName->Buffer);
165 InitializeObjectAttributes(&ObjectAttributes,
171 Status = NtOpenSymbolicLinkObject(&Handle,
172 SYMBOLIC_LINK_ALL_ACCESS,
174 if (!NT_SUCCESS(Status))
177 Status = NtMakeTemporaryObject(Handle);