summaryrefslogtreecommitdiffhomepage
path: root/src/object
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-03-27 00:00:28 +0000
committermidipix <writeonce@midipix.org>2018-03-29 21:56:21 -0400
commit227c1560530dc822180e71690795d4a97d2d7310 (patch)
tree4a76b1872d53e29f9a09bd2930056f18ba1695ee /src/object
parent808392f1ac4bbd56563f655a099b6870fdeb377b (diff)
downloadntapi-227c1560530dc822180e71690795d4a97d2d7310.tar.bz2
ntapi-227c1560530dc822180e71690795d4a97d2d7310.tar.xz
sid helper interfaces: added ntapi_tt_sid_compare().
Diffstat (limited to 'src/object')
-rw-r--r--src/object/ntapi_tt_sid.c30
1 files changed, 30 insertions, 0 deletions
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; i<src->sub_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; i<sida->sub_authority_count; i++)
+ if ((a = sida->sub_authority[i]) - (b = sidb->sub_authority[i]))
+ return a-b;
+
+ return 0;
+}