summaryrefslogtreecommitdiffhomepage
path: root/include/ntapi/nt_symlink.h
blob: a64a456e9a02b2361d329daec9b47254a3a3debc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef _NT_SYMLINK_H_
#define _NT_SYMLINK_H_

#include "nt_abi.h"
#include "nt_compiler.h"
#include "nt_object.h"
#include "nt_port.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