The ZwOpenSymbolicLinkObject routine returns a handle to an existing symbolic link.
NTSTATUS
ZwOpenSymbolicLinkObject(
OUT PHANDLE LinkHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes
);
Declared in ntddk.h. Include ntddk.h.
ZwOpenSymbolicLinkObject returns STATUS_SUCCESS if the symbolic link was opened, or the appropriate error status on failure.
Driver routines that run in a process context other than that of the system process must set the OBJ_KERNEL_HANDLE attribute for the ObjectAttributes parameter of ZwOpenSymbolicLinkObject. This restricts the use of the handle returned by ZwOpenSymbolicLinkObject to processes running only in kernel mode. Otherwise, the handle can be accessed by the process in whose context the driver is running. Drivers can call InitializeObjectAttributes to set the OBJ_KERNEL_HANDLE attribute as follows.
InitializeObjectAttributes(&ObjectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
Callers of this routine must be running at IRQL = PASSIVE_LEVEL.
ACCESS_MASK, InitializeObjectAttributes, ZwQuerySymbolicLinkObject