diff options
Diffstat (limited to 'src/object')
-rw-r--r-- | src/object/ntapi_tt_sid.c | 30 |
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; +} |