summaryrefslogtreecommitdiffhomepage
path: root/src/string/ntapi_tt_init_unicode_string_from_utf16.c
blob: 310c35e7cb99aba3a7a407b7794ecc17b9beff00 (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
/********************************************************/
/*  ntapi: Native API core library                      */
/*  Copyright (C) 2013--2021  SysDeer Technologies, LLC */
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
/********************************************************/

#include <psxtypes/psxtypes.h>
#include <pemagine/pemagine.h>
#include <ntapi/nt_object.h>
#include <ntapi/ntapi.h>
#include "ntapi_impl.h"

void __ntapi_tt_init_unicode_string_from_utf16(
    __out 	nt_unicode_string *	str_dest,
    __in	wchar16_t *		str_src)
{
	if ((intptr_t)str_src) {
		str_dest->strlen = (uint16_t)__ntapi->tt_string_null_offset_short((const int16_t *)str_src);
		str_dest->maxlen = str_dest->strlen + sizeof(uint16_t);
		str_dest->buffer = (uint16_t *)str_src;
	} else {
		str_dest->strlen = 0;
		str_dest->maxlen = 0;
		str_dest->buffer = (uint16_t *)0;
	}
}