Blame src/object/ntapi_tt_sid.c

e7235f
/********************************************************/
e7235f
/*  ntapi: Native API core library                      */
64e606
/*  Copyright (C) 2013--2021  SysDeer Technologies, LLC */
e7235f
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
e7235f
/********************************************************/
e7235f
e7235f
#include <psxtypes/psxtypes.h>
e7235f
#include <ntapi/nt_object.h>
e7235f
#include "ntapi_impl.h"
e7235f
e7235f
void __stdcall __ntapi_tt_sid_copy(
e7235f
	__out	nt_sid *	dst,
e7235f
	__in	const nt_sid *	src)
e7235f
{
e7235f
	int i;
e7235f
e7235f
	dst->revision             = src->revision;
e7235f
	dst->sub_authority_count  = src->sub_authority_count;
e7235f
	dst->identifier_authority = src->identifier_authority;
e7235f
e7235f
	for (i=0; i<src->sub_authority_count; i++)
e7235f
		dst->sub_authority[i] = src->sub_authority[i];
e7235f
}
227c15
227c15
int32_t __stdcall __ntapi_tt_sid_compare(
227c15
	__in	const nt_sid *	sida,
227c15
	__in	const nt_sid *	sidb)
227c15
{
227c15
	int			i;
227c15
	int32_t			a;
227c15
	int32_t			b;
227c15
	const unsigned char *	va;
227c15
	const unsigned char *	vb;
227c15
227c15
	if ((a = sida->revision) - (b = sidb->revision))
227c15
		return a-b;
227c15
227c15
	if ((a = sida->sub_authority_count) - (b = sidb->sub_authority_count))
227c15
		return a-b;
227c15
227c15
	va=sida->identifier_authority.value;
227c15
	vb=sidb->identifier_authority.value;
227c15
227c15
	for (i=0; i<6; i++)
227c15
		if ((a = va[i]) - (b = vb[i]))
227c15
			return a-b;
227c15
227c15
	for (i=0; i<sida->sub_authority_count; i++)
227c15
		if ((a = sida->sub_authority[i]) - (b = sidb->sub_authority[i]))
227c15
			return a-b;
227c15
227c15
	return 0;
227c15
}