From 227c1560530dc822180e71690795d4a97d2d7310 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 27 Mar 2018 00:00:28 +0000 Subject: sid helper interfaces: added ntapi_tt_sid_compare(). --- src/object/ntapi_tt_sid.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/object') diff --git a/src/object/ntapi_tt_sid.c b/src/object/ntapi_tt_sid.c index d93775c..a35b9a7 100644 --- a/src/object/ntapi_tt_sid.c +++ b/src/object/ntapi_tt_sid.c @@ -21,3 +21,33 @@ void __stdcall __ntapi_tt_sid_copy( for (i=0; isub_authority_count; i++) dst->sub_authority[i] = src->sub_authority[i]; } + +int32_t __stdcall __ntapi_tt_sid_compare( + __in const nt_sid * sida, + __in const nt_sid * sidb) +{ + int i; + int32_t a; + int32_t b; + const unsigned char * va; + const unsigned char * vb; + + if ((a = sida->revision) - (b = sidb->revision)) + return a-b; + + if ((a = sida->sub_authority_count) - (b = sidb->sub_authority_count)) + return a-b; + + va=sida->identifier_authority.value; + vb=sidb->identifier_authority.value; + + for (i=0; i<6; i++) + if ((a = va[i]) - (b = vb[i])) + return a-b; + + for (i=0; isub_authority_count; i++) + if ((a = sida->sub_authority[i]) - (b = sidb->sub_authority[i])) + return a-b; + + return 0; +} -- cgit v1.2.3