/*********************************************************/
/* toksvc: a framework-native token broker service */
/* Copyright (C) 2020 SysDeer Technologies, LLC */
/* 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_uuid(const char (*guidstr)[40], struct toks_uuid * uuid)
{
int32_t status;
struct _nt_guid guid;
toks_init();
status = ntapi->tt_string_to_guid_utf8(
guidstr[0],&guid);
if (status == NT_STATUS_SUCCESS)
toks_guid_to_uuid(&guid,uuid);
return status;
}
void toks_uuid_to_string(const struct toks_uuid * uuid, char (*guidstr)[40])
{
struct _nt_guid_str_utf8 buf;
void * addr;
char * ch;
struct _nt_guid guid;
toks_init();
toks_uuid_to_guid(uuid,&guid);
ntapi->tt_guid_to_string_utf8(
&guid,&buf);
addr = &buf.lbrace;
ch = addr;
toks_memcpy(
guidstr[0],
ch,sizeof(buf));
guidstr[0][39] = 0;
}