Blob Blame History Raw
#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