|
|
26e14f |
/***********************************************************/
|
|
|
26e14f |
/* ntux: native translation und extension */
|
|
|
26e14f |
/* Copyright (C) 2016 Z. Gilboa */
|
|
|
26e14f |
/* Released under GPLv2 and GPLv3; see COPYING.NTUX. */
|
|
|
26e14f |
/***********************************************************/
|
|
|
26e14f |
|
|
|
26e14f |
#include <ntapi/ntapi.h>
|
|
|
26e14f |
|
|
|
26e14f |
extern const ntapi_vtbl * ntux_ntapi;
|
|
|
26e14f |
|
|
|
26e14f |
void * ntux_memcpy(void * dst, const void * src, size_t n)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_generic_memcpy(dst,src,n);
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
void * ntux_memset(void * ch, int c, size_t n)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_generic_memset(ch,c,n);
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
char * ntux_strcpy(char * dst, const char * src)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_generic_memcpy(
|
|
|
26e14f |
dst,src,
|
|
|
26e14f |
ntux_ntapi->tt_string_null_offset_multibyte(src));
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
size_t ntux_strlen(const char * ch)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_string_null_offset_multibyte(ch);
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
int ntux_strcmp(const char * a, const char * b)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_strcmp_multibyte(a,b);
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
int ntux_strncmp(const char * a, const char * b, size_t n)
|
|
|
26e14f |
{
|
|
|
26e14f |
return ntux_ntapi->tt_strncmp_multibyte(a,b,n);
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
char * ntux_strchr(const char * ch, int c)
|
|
|
26e14f |
{
|
|
|
26e14f |
for (; *ch; ch++)
|
|
|
26e14f |
if (*ch == c)
|
|
|
26e14f |
return (char *)ch;
|
|
|
26e14f |
return 0;
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
char * ntux_strrchr(const char * ch, int c)
|
|
|
26e14f |
{
|
|
|
26e14f |
const char * base;
|
|
|
26e14f |
|
|
|
26e14f |
base = ch;
|
|
|
26e14f |
ch += ntux_ntapi->tt_string_null_offset_multibyte(ch);
|
|
|
26e14f |
|
|
|
26e14f |
for (; ch >= base; ch--)
|
|
|
26e14f |
if (*ch == c)
|
|
|
26e14f |
return (char *)ch;
|
|
|
26e14f |
return 0;
|
|
|
26e14f |
}
|
|
|
26e14f |
|
|
|
26e14f |
#ifdef NTUX_EXPORT
|
|
|
26e14f |
int __stdcall ntux_entry_point(void * hinstance, uint32_t reason, void * reserved)
|
|
|
26e14f |
{
|
|
|
26e14f |
(void)hinstance;
|
|
|
26e14f |
(void)reason;
|
|
|
26e14f |
(void)reserved;
|
|
|
26e14f |
|
|
|
26e14f |
return 1;
|
|
|
26e14f |
}
|
|
|
26e14f |
#endif
|