summaryrefslogtreecommitdiffhomepage
path: root/include/ntapi/nt_string.h
blob: f85887d1ce7a3c4042c11fdd93aa21d5a254a347 (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#ifndef _NT_STRING_H_
#define _NT_STRING_H_

#include "nt_abi.h"
#include "nt_object.h"

typedef void * __cdecl ntapi_memset(
	void *dest,
	int c,
	size_t count);

typedef int __cdecl ntapi_sprintf(
	char * buffer,
	const char * format,
	...);

typedef int __cdecl ntapi_snprintf(
	char * buffer,
	size_t size,
	const char * format,
	...);

typedef int __cdecl ntapi_vsprintf(
	char * buffer,
	const char * format,
	va_list ap);

typedef int __cdecl ntapi_vsnprintf(
	char * buffer,
	size_t size,
	const char * format,
	va_list ap);


typedef size_t __cdecl ntapi_strlen(const char * str);


typedef size_t __cdecl ntapi_wcslen(const wchar16_t * str);


typedef void ntapi_rtl_init_unicode_string(
    __out 	nt_unicode_string *	str_dest,
    __in	wchar16_t *		str_src);


/* yes, there exists a reason (but feel free to scold me nonetheless) */
typedef size_t __cdecl ntapi_tt_string_null_offset_multibyte(
	__in	const char *	str);

typedef size_t __cdecl ntapi_tt_string_null_offset_short(
	__in	const int16_t *	str);

typedef size_t __cdecl ntapi_tt_string_null_offset_dword(
	__in	const int32_t *	str);

typedef size_t __cdecl ntapi_tt_string_null_offset_qword(
	__in	const int64_t *	str);

typedef size_t __cdecl ntapi_tt_string_null_offset_ptrsize(
	__in	const intptr_t *str);

typedef int    __cdecl ntapi_tt_strcmp_multibyte(
	__in	const char *	a,
	__in	const char *	b);

typedef int    __cdecl ntapi_tt_strcmp_utf16(
	__in	const wchar16_t * a,
	__in	const wchar16_t * b);

typedef int    __cdecl ntapi_tt_strncmp_multibyte(
	__in	const char *	a,
	__in	const char *	b,
	__in	size_t		n);

typedef int    __cdecl ntapi_tt_strncmp_utf16(
	__in	const wchar16_t * a,
	__in	const wchar16_t * b,
	__in	size_t		  n);

typedef void __cdecl		ntapi_tt_init_unicode_string_from_utf16(
	__out 	nt_unicode_string *	str_dest,
	__in	wchar16_t *		str_src);


typedef void * __cdecl		ntapi_tt_aligned_block_memset(
	__in	void *			block,
	__in	uintptr_t		val,
	__in	size_t			bytes);

typedef uintptr_t * __cdecl	ntapi_tt_aligned_block_memcpy(
	__in	uintptr_t *		dst,
	__in	const uintptr_t *	src,
	__in	size_t			bytes);

typedef void * __cdecl		ntapi_tt_aligned_block_memlock(
	__in	void *			block,
	__in	size_t			bytes);

typedef wchar16_t * __cdecl	ntapi_tt_memcpy_utf16(
	__in	wchar16_t *		dst,
	__in	const wchar16_t *	src,
	__in	size_t			bytes);


typedef wchar16_t * __cdecl	ntapi_tt_aligned_memcpy_utf16(
	__in	uintptr_t *		dst,
	__in	const uintptr_t *	src,
	__in	size_t			bytes);


typedef void * __cdecl		ntapi_tt_generic_memset(
	__in	void *			dst,
	__in	uintptr_t		val,
	__in	size_t			bytes);

typedef void * __cdecl	ntapi_tt_generic_memcpy(
	__in	void *			dst,
	__in	const void *		src,
	__in	size_t			bytes);

typedef void __fastcall	ntapi_tt_uint16_to_hex_utf16(
	__in	const uint16_t	key,
	__out	wchar16_t *	formatted_key);


typedef void __fastcall	ntapi_tt_uint32_to_hex_utf16(
	__in	const uint32_t	key,
	__out	wchar16_t *	formatted_key);


typedef void __fastcall	ntapi_tt_uint64_to_hex_utf16(
	__in	const uint64_t	key,
	__out	wchar16_t *	formatted_key);


typedef void __fastcall	ntapi_tt_uintptr_to_hex_utf16(
	__in	const uintptr_t	key,
	__out	wchar16_t *	formatted_key);


typedef int32_t __fastcall ntapi_tt_hex_utf16_to_uint16(
	__in	const wchar16_t	hex_key_utf16[4],
	__out	uint16_t *	key);


typedef int32_t __fastcall ntapi_tt_hex_utf16_to_uint32(
	__in	const wchar16_t	hex_key_utf16[8],
	__out	uint32_t *	key);


typedef int32_t __fastcall ntapi_tt_hex_utf16_to_uint64(
	__in	const wchar16_t	hex_key_utf16[16],
	__out	uint64_t *	key);


typedef int32_t __fastcall ntapi_tt_hex_utf16_to_uintptr(
	__in	const wchar16_t	hex_key_utf16[],
	__out	uintptr_t *	key);


typedef void __fastcall ntapi_tt_uint16_to_hex_utf8(
	__in	const uint32_t	key,
	__out	unsigned char *	buffer);


typedef void __fastcall ntapi_tt_uint32_to_hex_utf8(
	__in	const uint32_t	key,
	__out	unsigned char *	buffer);


typedef void __fastcall ntapi_tt_uint64_to_hex_utf8(
	__in	const uint64_t	key,
	__out	unsigned char *	buffer);


typedef void __fastcall ntapi_tt_uintptr_to_hex_utf8(
	__in	const uintptr_t	key,
	__out	unsigned char *	buffer);


typedef int32_t __stdcall	ntapi_tt_uintptr_to_dec_utf16(
	__in	uintptr_t	key,
	__out	wchar16_t *	wstrbuf,
	__in	size_t		buflen,
	__out	ssize_t *	length);


typedef int32_t __stdcall	ntapi_tt_uintptr_to_dec_utf8(
	__in	uintptr_t	key,
	__out	unsigned char *	strbuf,
	__in	size_t		buflen,
	__out	ssize_t *	length);


typedef int32_t __stdcall	ntapi_tt_uintptr_to_dec_null_utf16(
	__in	uintptr_t	key,
	__out	wchar16_t *	wstrbuf,
	__in	size_t		buflen,
	__out	ssize_t *	length);


typedef int32_t __stdcall	ntapi_tt_uintptr_to_dec_null_utf8(
	__in	uintptr_t	key,
	__out	unsigned char *	strbuf,
	__in	size_t		buflen,
	__out	ssize_t *	length);

typedef int32_t __stdcall	ntapi_tt_dec_utf16_to_uint16(
	__in	const wchar16_t *	wch_arg,
	__in	const wchar16_t *	wch_cap,
	__out	uint16_t *		key);

typedef int32_t __stdcall	ntapi_tt_dec_utf16_to_uint32(
	__in	const wchar16_t *	wch_arg,
	__in	const wchar16_t *	wch_cap,
	__out	uint32_t *		key);

typedef int32_t __stdcall	ntapi_tt_dec_utf16_to_uint64(
	__in	const wchar16_t *	wch_arg,
	__in	const wchar16_t *	wch_cap,
	__out	uint64_t *		key);

typedef int32_t __stdcall	ntapi_tt_dec_utf16_to_uintptr(
	__in	const wchar16_t *	wch_arg,
	__in	const wchar16_t *	wch_cap,
	__out	uintptr_t *		key);

#endif