2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/io/symlink.c
5 * PURPOSE: I/O Wrappers for Symbolic Links
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
10 /* INCLUDES *****************************************************************/
16 /* FUNCTIONS ****************************************************************/
23 IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName
,
24 IN PUNICODE_STRING DeviceName
)
26 OBJECT_ATTRIBUTES ObjectAttributes
;
31 /* Initialize the object attributes and create the link */
32 InitializeObjectAttributes(&ObjectAttributes
,
34 OBJ_PERMANENT
| OBJ_CASE_INSENSITIVE
,
37 Status
= ZwCreateSymbolicLinkObject(&Handle
,
38 SYMBOLIC_LINK_ALL_ACCESS
,
41 if (NT_SUCCESS(Status
)) ZwClose(Handle
);
52 IoCreateUnprotectedSymbolicLink(IN PUNICODE_STRING SymbolicLinkName
,
53 IN PUNICODE_STRING DeviceName
)
55 SECURITY_DESCRIPTOR SecurityDescriptor
;
56 OBJECT_ATTRIBUTES ObjectAttributes
;
62 Status
= RtlCreateSecurityDescriptor(&SecurityDescriptor
,
63 SECURITY_DESCRIPTOR_REVISION
);
64 if (!NT_SUCCESS(Status
)) return Status
;
67 Status
= RtlSetDaclSecurityDescriptor(&SecurityDescriptor
,
71 if (!NT_SUCCESS(Status
)) return Status
;
73 /* Initialize the object attributes and create the link */
74 InitializeObjectAttributes(&ObjectAttributes
,
76 OBJ_PERMANENT
| OBJ_CASE_INSENSITIVE
,
79 Status
= ZwCreateSymbolicLinkObject(&Handle
,
80 SYMBOLIC_LINK_ALL_ACCESS
,
83 if (NT_SUCCESS(Status
)) ZwClose(Handle
);
94 IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName
)
96 OBJECT_ATTRIBUTES ObjectAttributes
;
101 /* Initialize the object attributes and open the link */
102 InitializeObjectAttributes(&ObjectAttributes
,
104 OBJ_CASE_INSENSITIVE
,
107 Status
= ZwOpenSymbolicLinkObject(&Handle
, DELETE
, &ObjectAttributes
);
108 if (!NT_SUCCESS(Status
)) return Status
;
110 /* Make the link temporary and close its handle */
111 Status
= ZwMakeTemporaryObject(Handle
);
112 if (NT_SUCCESS(Status
)) ZwClose(Handle
);