mirror of
https://github.com/reactos/reactos.git
synced 2024-09-17 16:20:20 +00:00
e1ef078741
The idea then would be to have the following behaviour (when specifying the following options in the kernel command line): /DEBUGPORT=COMi --> load KDCOM.DLL and use COMi port (i == 1,2,3,4) if possible. /DEBUGPORT=FOO --> load KDFOO.DLL (useful for KDUSB.DLL, KD1394.DLL, KDBAZIS.DLL for VirtualKD, etc...) /DEBUGPORT=ROSDBG:[COMi|SCREEN|FILE|GDB|...] --> load KDROSDBG.DLL which contains the ROS kernel debugger, and use COMi or SCREEN or... as output port. svn path=/branches/kd++/; revision=58883
119 lines
3.5 KiB
C
119 lines
3.5 KiB
C
/*
|
|
* PROJECT: ReactOS Kernel
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* FILE: ntoskrnl/io/symlink.c
|
|
* PURPOSE: I/O Wrappers for Symbolic Links
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
* Eric Kohl
|
|
*/
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
#include <ntoskrnl.h>
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
NTSTATUS
|
|
NTAPI
|
|
IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
|
|
IN PUNICODE_STRING DeviceName)
|
|
{
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
HANDLE Handle;
|
|
NTSTATUS Status;
|
|
PAGED_CODE();
|
|
|
|
/* Initialize the object attributes and create the link */
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
SymbolicLinkName,
|
|
OBJ_PERMANENT | OBJ_CASE_INSENSITIVE,
|
|
NULL,
|
|
SePublicDefaultSd);
|
|
Status = ZwCreateSymbolicLinkObject(&Handle,
|
|
SYMBOLIC_LINK_ALL_ACCESS,
|
|
&ObjectAttributes,
|
|
DeviceName);
|
|
if (NT_SUCCESS(Status)) ZwClose(Handle);
|
|
|
|
/* Return status */
|
|
return Status;
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
NTSTATUS
|
|
NTAPI
|
|
IoCreateUnprotectedSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
|
|
IN PUNICODE_STRING DeviceName)
|
|
{
|
|
SECURITY_DESCRIPTOR SecurityDescriptor;
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
HANDLE Handle;
|
|
NTSTATUS Status;
|
|
PAGED_CODE();
|
|
|
|
/* Create an SD */
|
|
Status = RtlCreateSecurityDescriptor(&SecurityDescriptor,
|
|
SECURITY_DESCRIPTOR_REVISION);
|
|
if (!NT_SUCCESS(Status)) return Status;
|
|
|
|
/* Set the DACL */
|
|
Status = RtlSetDaclSecurityDescriptor(&SecurityDescriptor,
|
|
TRUE,
|
|
NULL,
|
|
TRUE);
|
|
if (!NT_SUCCESS(Status)) return Status;
|
|
|
|
/* Initialize the object attributes and create the link */
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
SymbolicLinkName,
|
|
OBJ_PERMANENT | OBJ_CASE_INSENSITIVE,
|
|
NULL,
|
|
&SecurityDescriptor);
|
|
Status = ZwCreateSymbolicLinkObject(&Handle,
|
|
SYMBOLIC_LINK_ALL_ACCESS,
|
|
&ObjectAttributes,
|
|
DeviceName);
|
|
if (NT_SUCCESS(Status)) ZwClose(Handle);
|
|
|
|
/* Return status */
|
|
return Status;
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
NTSTATUS
|
|
NTAPI
|
|
IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
|
|
{
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
HANDLE Handle;
|
|
NTSTATUS Status;
|
|
PAGED_CODE();
|
|
|
|
/* Initialize the object attributes and open the link */
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
SymbolicLinkName,
|
|
OBJ_CASE_INSENSITIVE,
|
|
NULL,
|
|
NULL);
|
|
Status = ZwOpenSymbolicLinkObject(&Handle, DELETE, &ObjectAttributes);
|
|
if (!NT_SUCCESS(Status)) return Status;
|
|
|
|
/* Make the link temporary and close its handle */
|
|
Status = ZwMakeTemporaryObject(Handle);
|
|
if (NT_SUCCESS(Status)) ZwClose(Handle);
|
|
|
|
/* Return status */
|
|
return Status;
|
|
}
|
|
|
|
/* EOF */
|