diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/ntapi.c | 1 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 1 | ||||
-rw-r--r-- | src/object/ntapi_tt_sid.c | 30 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index 6421cb1..f0b4431 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -167,6 +167,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) __ntapi->tt_open_keyed_object_directory = __ntapi_tt_open_keyed_object_directory; __ntapi->tt_create_keyed_object_directory_entry = __ntapi_tt_create_keyed_object_directory_entry; __ntapi->tt_sid_copy = __ntapi_tt_sid_copy; + __ntapi->tt_sid_compare = __ntapi_tt_sid_compare; /* nt_crc32.h */ __ntapi->tt_buffer_crc32 = __ntapi_tt_buffer_crc32; diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h index c8567f1..5aaae4c 100644 --- a/src/internal/ntapi_fnapi.h +++ b/src/internal/ntapi_fnapi.h @@ -29,6 +29,7 @@ ntapi_tt_create_keyed_object_directory __ntapi_tt_create_keyed_object_directory ntapi_tt_open_keyed_object_directory __ntapi_tt_open_keyed_object_directory; ntapi_tt_create_keyed_object_directory_entry __ntapi_tt_create_keyed_object_directory_entry; ntapi_tt_sid_copy __ntapi_tt_sid_copy; +ntapi_tt_sid_compare __ntapi_tt_sid_compare; /* nt_crc32.h */ ntapi_tt_buffer_crc32 __ntapi_tt_buffer_crc32; 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; +} |