Blob Blame History Raw
/*********************************************************/
/*  toksvc: a framework-native token broker service      */
/*  Copyright (C) 2020  Z. Gilboa                        */
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
/*********************************************************/

#include <psxtypes/psxtypes.h>
#include <ntapi/nt_object.h>
#include <ntapi/nt_guid.h>
#include <ntapi/ntapi.h>

#include <toksvc/toksvc.h>
#include "toksvc_init_impl.h"
#include "toksvc_driver_impl.h"
#include "toksvc_nolibc_impl.h"

int toks_string_to_guid(const char (*guidstr)[40], struct _nt_guid * uuid)
{
	toks_init();

	return ntapi->tt_string_to_guid_utf8(
		guidstr[0],uuid);
}

void toks_guid_to_string(const struct _nt_guid * uuid, char (*guidstr)[40])
{
	struct _nt_guid_str_utf8 buf;
	void *                   addr;
	char *                   ch;

	toks_init();

	ntapi->tt_guid_to_string_utf8(
		uuid,&buf);

	addr = &buf.lbrace;
	ch   = addr;

	toks_memcpy(
		guidstr[0],
		ch,sizeof(buf));

	guidstr[0][39] = 0;
}