summaryrefslogtreecommitdiffhomepage
path: root/include/ntapi/nt_mount.h
blob: dd2e223a98b33b486450e4b368d829411806bfc4 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef _NT_MOUNT_H_
#define _NT_MOUNT_H_

#include "nt_abi.h"
#include "nt_ioctl.h"
#include "nt_statfs.h"

/* hash mark */
/* {'\\','D','e','v','i','c','e','\\'} */
#define __DEVICE_PATH_PREFIX_LEN	(8 * sizeof(wchar16_t))
#define __DEVICE_PATH_PREFIX_HASH	(0xDA6FA40B)

/* {'\\','D','e','v','i','c','e','\\','M','u','p','\\'} */
#define __DEVICE_MUP_PREFIX_LEN		(12 * sizeof(wchar16_t))
#define __DEVICE_MUP_PREFIX_HASH	(0x0CEBB5F6)

/* {'\\','?','?','\\','V','o','l','u','m','e','{'} */
#define __VOLUME_PATH_PREFIX_LEN	(11 * sizeof(wchar16_t))
#define __VOLUME_PATH_PREFIX_HASH	(0xFEBA8529)

/* {'\\','D','o','s','D','e','v','i','c','e','s'} */
#define __DOS_DEVICES_PREFIX_LEN	(11 * sizeof(wchar16_t))
#define __DOS_DEVICES_PREFIX_HASH	(0x565D0514)


typedef enum _nt_mount_moint_type {
	NT_MOUNT_POINT_NONE,
	NT_MOUNT_POINT_DEVICE,
	NT_MOUNT_POINT_VOLUME,
	NT_MOUNT_POINT_DIRECTORY
} nt_mount_moint_type;

/* reparse tag values */
#define NT_IO_REPARSE_TAG_RESERVED_ZERO		(0x00000000)
#define NT_IO_REPARSE_TAG_RESERVED_ONE		(0x00000001)
#define NT_IO_REPARSE_TAG_MOUNT_POINT		(0xA0000003)
#define NT_IO_REPARSE_TAG_HSM			(0xC0000004)
#define NT_IO_REPARSE_TAG_HSM2			(0x80000006)
#define NT_IO_REPARSE_TAG_DRIVER_EXTENDER	(0x80000005)
#define NT_IO_REPARSE_TAG_SIS			(0x80000007)
#define NT_IO_REPARSE_TAG_DFS			(0x8000000A)
#define NT_IO_REPARSE_TAG_DFSR			(0x80000012)
#define NT_IO_REPARSE_TAG_FILTER_MANAGER	(0x8000000B)
#define NT_IO_REPARSE_TAG_SYMLINK		(0xA000000C)


typedef struct _nt_mount_dev_name {
	uint16_t	name_length;
	wchar16_t	name[];
} nt_mount_dev_name;


typedef struct _nt_mount_mgr_mount_point {
	uint32_t 	symlink_name_offset;
	uint16_t	symlink_name_length;
	uint32_t	unique_id_offset;
	uint16_t	unique_id_length;
	uint32_t	device_name_offset;
	uint16_t	device_name_length;
} nt_mount_mgr_mount_point, nt_mount_point;


typedef struct _nt_mount_mgr_mount_point_param {
	uint32_t 	symlink_name_offset;
	uint16_t	symlink_name_length;
	uint32_t	unique_id_offset;
	uint16_t	unique_id_length;
	uint32_t	device_name_offset;
	uint16_t	device_name_length;
	uint16_t	mount_points_offset;
	wchar16_t	device_name[];
} nt_mount_mgr_mount_point_param, nt_mount_point_param;


typedef struct _nt_mount_mgr_mount_points {
	uint32_t			size;
	uint32_t			number;
	nt_mount_mgr_mount_point	mount_points[];
} nt_mount_mgr_mount_points, nt_mount_points;


typedef struct _nt_mount_point_reparse_buffer {
	uint32_t	reparse_tag;
	uint16_t	reparse_data_length;
	uint16_t	reserved;
	uint16_t	substitute_name_offset;
	uint16_t	substitute_name_length;
	uint16_t	print_name_offset;
	uint16_t	print_name_length;
	uintptr_t	path_buffer[];
} nt_mount_point_reparse_buffer, nt_mprb;


typedef struct _nt_dos_devices_name {
	wchar16_t	dos_devices_prefix[11];
	wchar16_t	slash;
	wchar16_t	letter;
	wchar16_t	colon;
} nt_dos_devices_name;


typedef int32_t __stdcall	ntapi_tt_get_dos_drive_device_handle(
	__out	void **			hdevice,
	__in	wchar16_t		drive_letter);


typedef int32_t __stdcall	ntapi_tt_get_dos_drive_root_handle(
	__out	void **			hroot,
	__in	wchar16_t		drive_letter);


typedef int32_t __stdcall	ntapi_tt_get_dos_drive_device_name(
	__in	void *			hdevice		__optional,
	__in	wchar16_t		drive_letter	__optional,
	__out	nt_mount_dev_name *	buffer,
	__in	uint32_t		buffer_size);


typedef int32_t __stdcall	ntapi_tt_get_dos_drive_mount_points(
	__in	void *			hdevice		__optional,
	__in	wchar16_t		drive_letter	__optional,
	__in	nt_mount_dev_name *	dev_name	__optional,
	__out	void *			buffer,
	__in	uint32_t		buffer_size);


typedef int32_t __stdcall	ntapi_tt_dev_mount_points_to_statfs(
	__in		nt_mount_points *	mount_points,
	__in_out	nt_statfs *		statfs);


typedef int32_t __stdcall	ntapi_tt_get_dos_drive_letter_from_device(
	__in	void *			hdevice		__optional,
	__out	wchar16_t *		drive_letter,
	__in	nt_mount_dev_name *	dev_name	__optional,
	__out	void *			buffer,
	__in	uint32_t		buffer_size);

#endif