+typedef struct _CSTRING {
+ USHORT Length;
+ USHORT MaximumLength;
+ CONST CHAR *Buffer;
+} CSTRING, *PCSTRING;
+
+typedef struct _UNICODE_STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+#ifdef MIDL_PASS
+ [size_is(MaximumLength / 2), length_is((Length) / 2)] PUSHORT Buffer;
+#else
+ _Field_size_bytes_part_(MaximumLength, Length) PWCH Buffer;
+#endif
+} UNICODE_STRING, *PUNICODE_STRING;
+typedef const UNICODE_STRING* PCUNICODE_STRING;
+
+typedef USHORT RTL_STRING_LENGTH_TYPE;
+
+#ifdef __cplusplus
+extern "C++" template<typename _Type> struct _RTL_remove_const_template;
+extern "C++" template<typename _Type> struct _RTL_remove_const_template<const _Type&> { typedef _Type type; };
+#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
+ (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
+extern "C++" template<class _Ty> struct _RTL_CONSTANT_STRING_type_check_template;
+extern "C++" template<class _Ty, int _Count> struct _RTL_CONSTANT_STRING_type_check_template<const _Ty (&)[_Count]> { typedef char type; };
+#define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
+#else
+# define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
+char _RTL_CONSTANT_STRING_type_check(const void *s);
+#endif
+#define RTL_CONSTANT_STRING(s) { \
+ sizeof(s)-sizeof((s)[0]), \
+ sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
+ _RTL_CONSTANT_STRING_remove_const_macro(s) }
+
+#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
+ WCHAR _var ## _buffer[_size]; \
+ __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
+ UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
+ __pragma(warning(pop))
+
+#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
+ const WCHAR _var##_buffer[] = _string; \
+ __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
+ const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
+ __pragma(warning(pop))
+
+#define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
+ extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
+
+#define ANSI_NULL ((CHAR)0)
+#define UNICODE_NULL ((WCHAR)0)
+#define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
+#define UNICODE_STRING_MAX_CHARS (32767)
+