Blame src/helper/toks_guid_string.c

8da24d
/*********************************************************/
8da24d
/*  toksvc: a framework-native token broker service      */
8da24d
/*  Copyright (C) 2020  Z. Gilboa                        */
8da24d
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
8da24d
/*********************************************************/
8da24d
8da24d
#include <psxtypes/psxtypes.h>
8da24d
#include <ntapi/nt_object.h>
8da24d
#include <ntapi/nt_guid.h>
8da24d
#include <ntapi/ntapi.h>
8da24d
8da24d
#include <toksvc/toksvc.h>
8da24d
#include "toksvc_init_impl.h"
8da24d
#include "toksvc_driver_impl.h"
8da24d
#include "toksvc_nolibc_impl.h"
8da24d
8da24d
int toks_string_to_guid(const char (*guidstr)[40], struct _nt_guid * uuid)
8da24d
{
8da24d
	toks_init();
8da24d
8da24d
	return ntapi->tt_string_to_guid_utf8(
8da24d
		guidstr[0],uuid);
8da24d
}
8da24d
8da24d
void toks_guid_to_string(const struct _nt_guid * uuid, char (*guidstr)[40])
8da24d
{
8da24d
	struct _nt_guid_str_utf8 buf;
8da24d
	void *                   addr;
8da24d
	char *                   ch;
8da24d
8da24d
	toks_init();
8da24d
8da24d
	ntapi->tt_guid_to_string_utf8(
8da24d
		uuid,&buf;;
8da24d
8da24d
	addr = &buf.lbrace;
8da24d
	ch   = addr;
8da24d
8da24d
	toks_memcpy(
8da24d
		guidstr[0],
8da24d
		ch,sizeof(buf));
8da24d
8da24d
	guidstr[0][39] = 0;
8da24d
}