1 /* $Id: symlink.c,v 1.34 2004/08/15 16:39:03 chorns Exp $
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 *****************************************************************/
16 #include <internal/debug.h>
19 /* FUNCTIONS ****************************************************************/
21 /**********************************************************************
23 * IoCreateSymbolicLink
36 IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName
,
37 PUNICODE_STRING DeviceName
)
39 OBJECT_ATTRIBUTES ObjectAttributes
;
43 assert_irql(PASSIVE_LEVEL
);
45 DPRINT("IoCreateSymbolicLink(SymbolicLinkName %wZ, DeviceName %wZ)\n",
49 InitializeObjectAttributes(&ObjectAttributes
,
55 Status
= NtCreateSymbolicLinkObject(&Handle
,
56 SYMBOLIC_LINK_ALL_ACCESS
,
59 if (!NT_SUCCESS(Status
))
61 DPRINT1("NtCreateSymbolicLinkObject() failed (Status %lx)\n", Status
);
67 return(STATUS_SUCCESS
);
71 /**********************************************************************
73 * 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
155 IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName
)
157 OBJECT_ATTRIBUTES ObjectAttributes
;
161 assert_irql(PASSIVE_LEVEL
);
163 DPRINT("IoDeleteSymbolicLink (SymbolicLinkName %S)\n",
164 SymbolicLinkName
->Buffer
);
166 InitializeObjectAttributes(&ObjectAttributes
,
172 Status
= NtOpenSymbolicLinkObject(&Handle
,
173 SYMBOLIC_LINK_ALL_ACCESS
,
175 if (!NT_SUCCESS(Status
))
178 Status
= NtMakeTemporaryObject(Handle
);