3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/io/symlink.c
6 * PURPOSE: Implements symbolic links
8 * PROGRAMMERS: David Welch (welch@mcmail.com)
11 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
18 /* FUNCTIONS ****************************************************************/
20 /**********************************************************************
22 * IoCreateSymbolicLink
35 IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName
,
36 PUNICODE_STRING DeviceName
)
38 OBJECT_ATTRIBUTES ObjectAttributes
;
42 ASSERT_IRQL(PASSIVE_LEVEL
);
44 DPRINT("IoCreateSymbolicLink(SymbolicLinkName %wZ, DeviceName %wZ)\n",
48 InitializeObjectAttributes(&ObjectAttributes
,
54 Status
= ZwCreateSymbolicLinkObject(&Handle
,
55 SYMBOLIC_LINK_ALL_ACCESS
,
58 if (!NT_SUCCESS(Status
))
60 DPRINT1("ZwCreateSymbolicLinkObject() failed (Status %lx)\n", Status
);
66 return(STATUS_SUCCESS
);
70 /**********************************************************************
72 * IoCreateUnprotectedSymbolicLink
85 IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName
,
86 PUNICODE_STRING DeviceName
)
88 SECURITY_DESCRIPTOR SecurityDescriptor
;
89 OBJECT_ATTRIBUTES ObjectAttributes
;
93 ASSERT_IRQL(PASSIVE_LEVEL
);
95 DPRINT("IoCreateUnprotectedSymbolicLink(SymbolicLinkName %wZ, DeviceName %wZ)\n",
99 Status
= RtlCreateSecurityDescriptor(&SecurityDescriptor
,
100 SECURITY_DESCRIPTOR_REVISION
);
101 if (!NT_SUCCESS(Status
))
103 DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n", Status
);
107 Status
= RtlSetDaclSecurityDescriptor(&SecurityDescriptor
,
111 if (!NT_SUCCESS(Status
))
113 DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n", Status
);
117 InitializeObjectAttributes(&ObjectAttributes
,
121 &SecurityDescriptor
);
123 Status
= ZwCreateSymbolicLinkObject(&Handle
,
124 SYMBOLIC_LINK_ALL_ACCESS
,
127 if (!NT_SUCCESS(Status
))
129 DPRINT1("ZwCreateSymbolicLinkObject() failed (Status %lx)\n", Status
);
135 return(STATUS_SUCCESS
);
139 /**********************************************************************
141 * 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
= ZwOpenSymbolicLinkObject(&Handle
,
172 SYMBOLIC_LINK_ALL_ACCESS
,
174 if (!NT_SUCCESS(Status
))
177 Status
= ZwMakeTemporaryObject(Handle
);