diff --git a/include/ntapi/nt_symlink.h b/include/ntapi/nt_symlink.h new file mode 100644 index 0000000..b92fc9f --- /dev/null +++ b/include/ntapi/nt_symlink.h @@ -0,0 +1,97 @@ +#ifndef _NT_SYMLINK_H_ +#define _NT_SYMLINK_H_ + +#include +#include "nt_object.h" + +typedef enum _nt_symlinkd_opcode { + NT_SYMLINKD_OPCODE_BASE = 0x200000, + /* primary connection */ + NT_SYMLINKD_CONNECT = NT_SYMLINKD_OPCODE_BASE, + NT_SYMLINKD_DISCONNECT, + NT_SYMLINKD_QUERY, + NT_SYMLINKD_SET, + /* daemon information */ + NT_SYMLINKD_QUERY_INFORMATION_SERVER, + NT_SYMLINKD_QUERY_INFORMATION_SESSION, + NT_SYMLINKD_QUERY_INFORMATION_PROCESS, + NT_SYMLINKD_QUERY_INFORMATION_THREAD, + NT_SYMLINKD_QUERY_INFORMATION_DEVICE, + NT_SYMLINKD_QUERY_INFORMATION_VOLUME, + NT_SYMLINKD_QUERY_INFORMATION_DIRECTORY, + NT_SYMLINKD_QUERY_INFORMATION_FILE, + /* symlink creation */ + NT_SYMLINKD_CREATE_SYMLINK, + NT_SYMLINKD_CREATE_JUNCTION, + /* exclusive upper limit */ + NT_SYMLINKD_OPCODE_CAP +} nt_symlinkd_opcode; + + +typedef struct __attr_ptr_size_aligned__ _nt_symlinkd_reparse_data { + void * hdstdir; + uint16_t dir_name_offset; + uint16_t dir_name_length; + uint16_t base_name_offset; + uint16_t base_name_length; + uint16_t reparse_data_offset; + uint16_t reparse_data_length; + uint32_t flags; + wchar16_t path_buffer[]; +} nt_symlinkd_reparse_data; + + +typedef struct __attr_ptr_size_aligned__ _nt_symlinkd_msg_info { + uintptr_t msg_id; + uint32_t opcode; + int32_t status; + void * reserved; +} nt_symlinkd_msg_info; + + +typedef struct __attr_ptr_size_aligned__ _nt_symlinkd_create_info { + void * hdstdir; + void * hsection; + uint32_t mapsize; + uint32_t offset; + void * hsymlink; + nt_iosb iosb; +} nt_symlinkd_create_info; + +typedef struct __attr_ptr_size_aligned__ _nt_symlinkd_create_msg { + nt_port_message header; + struct { + nt_symlinkd_msg_info msginfo; + nt_symlinkd_create_info lnkinfo; + } data; +} nt_symlinkd_create_msg; + + +__assert_aligned_size(nt_symlinkd_reparse_data, __SIZEOF_POINTER__); +__assert_aligned_size(nt_symlinkd_msg_info, __SIZEOF_POINTER__); +__assert_aligned_size(nt_symlinkd_create_msg, __SIZEOF_POINTER__); + +/* symlink creation bits */ +#define NT_SYMLINK_CREATE_DEFAULT 0x0000 +#define NT_SYMLINK_CREATE_CURRENT_PROCESS 0x0000 +#define NT_SYMLINK_CREATE_ALLOW_CHILD_DAEMON 0x0001 +#define NT_SYMLINK_CREATE_ALLOW_SESSION_DAEMON 0x0002 +#define NT_SYMLINK_CREATE_ALLOW_SYSTEM_DAEMON 0x0004 + +#define NT_SYMLINK_CREATE_ALLOW_ANY_DAEMON NT_SYMLINK_CREATE_ALLOW_CHILD_DAEMON \ + | NT_SYMLINK_CREATE_ALLOW_SESSION_DAEMON \ + | NT_SYMLINK_CREATE_ALLOW_SYSTEM_DAEMON + +typedef int32_t __stdcall ntapi_tt_create_symlink( + __out void ** hsymlink __optional, + __in void * hevent __optional, + __in nt_io_apc_routine * apc_routine __optional, + __in void * apc_context __optional, + __out nt_iosb * iosb, + __in uint32_t options, + __in void * input_buffer, + __in uint32_t input_buffer_length, + __out void * output_buffer __optional, + __in uint32_t output_buffer_length); + +#endif diff --git a/project/headers.mk b/project/headers.mk index 84db879..753da98 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -37,6 +37,7 @@ API_HEADERS = \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_statfs.h \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_status.h \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_string.h \ + $(PROJECT_DIR)/include/$(PACKAGE)/./nt_symlink.h \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_sync.h \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_sysinfo.h \ $(PROJECT_DIR)/include/$(PACKAGE)/./nt_termios.h \