Blame src/internal/toksvc_nolibc_impl.c

ca007d
/*********************************************************/
ca007d
/*  toksvc: a framework-native token broker service      */
d91fa0
/*  Copyright (C) 2020  SysDeer Technologies, LLC        */
ca007d
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
ca007d
/*********************************************************/
ca007d
ca007d
#include <ntapi/ntapi.h>
ca007d
ca007d
extern const ntapi_vtbl * toks_ntapi;
ca007d
ca007d
void * toks_memcpy(void * dst, const void * src, size_t n)
ca007d
{
ca007d
	return toks_ntapi->tt_generic_memcpy(dst,src,n);
ca007d
}
ca007d
ca007d
void * toks_memset(void * ch, int c, size_t n)
ca007d
{
ca007d
	return toks_ntapi->tt_generic_memset(ch,c,n);
ca007d
}
ca007d
ca007d
char * toks_strcpy(char * dst, const char * src)
ca007d
{
ca007d
	return toks_ntapi->tt_generic_memcpy(
ca007d
		dst,src,
ca007d
		toks_ntapi->tt_string_null_offset_multibyte(src));
ca007d
}
ca007d
ca007d
size_t toks_strlen(const char * ch)
ca007d
{
ca007d
	return toks_ntapi->tt_string_null_offset_multibyte(ch);
ca007d
}
ca007d
ca007d
int toks_strcmp(const char * a, const char * b)
ca007d
{
ca007d
	return toks_ntapi->tt_strcmp_multibyte(a,b);
ca007d
}
ca007d
ca007d
int toks_strncmp(const char * a, const char * b, size_t n)
ca007d
{
ca007d
	return toks_ntapi->tt_strncmp_multibyte(a,b,n);
ca007d
}
ca007d
ca007d
char * toks_strchr(const char * ch, int c)
ca007d
{
ca007d
	for (; *ch; ch++)
ca007d
		if (*ch == c)
ca007d
			return (char *)ch;
ca007d
	return 0;
ca007d
}
ca007d
ca007d
char * toks_strrchr(const char * ch, int c)
ca007d
{
ca007d
	const char * base;
ca007d
ca007d
	base = ch;
ca007d
	ch  += toks_ntapi->tt_string_null_offset_multibyte(ch);
ca007d
ca007d
	for (; ch >= base; ch--)
ca007d
		if (*ch == c)
ca007d
			return (char *)ch;
ca007d
	return 0;
ca007d
}
ca007d
ca007d
#ifdef TOKS_EXPORT
ca007d
int __stdcall toksvc_entry_point(void * hinstance, uint32_t reason, void * reserved)
ca007d
{
ca007d
	(void)hinstance;
ca007d
	(void)reason;
ca007d
	(void)reserved;
ca007d
ca007d
	return 1;
ca007d
}
ca007d
#endif