diff options
author | midipix <writeonce@midipix.org> | 2018-03-27 00:00:28 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-03-29 21:56:21 -0400 |
commit | 227c1560530dc822180e71690795d4a97d2d7310 (patch) | |
tree | 4a76b1872d53e29f9a09bd2930056f18ba1695ee | |
parent | 808392f1ac4bbd56563f655a099b6870fdeb377b (diff) | |
download | ntapi-227c1560530dc822180e71690795d4a97d2d7310.tar.bz2 ntapi-227c1560530dc822180e71690795d4a97d2d7310.tar.xz |
sid helper interfaces: added ntapi_tt_sid_compare().
-rw-r--r-- | include/ntapi/nt_object.h | 5 | ||||
-rw-r--r-- | include/ntapi/ntapi.h | 1 | ||||
-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 |
5 files changed, 38 insertions, 0 deletions
diff --git a/include/ntapi/nt_object.h b/include/ntapi/nt_object.h index b76b43b..c89467e 100644 --- a/include/ntapi/nt_object.h +++ b/include/ntapi/nt_object.h @@ -569,4 +569,9 @@ typedef void __stdcall ntapi_tt_sid_copy( __in const nt_sid * src); +typedef int32_t __stdcall ntapi_tt_sid_compare( + __in const nt_sid * sida, + __in const nt_sid * sidb); + + #endif diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h index d25116c..fbd5694 100644 --- a/include/ntapi/ntapi.h +++ b/include/ntapi/ntapi.h @@ -374,6 +374,7 @@ typedef struct _ntapi_vtbl { ntapi_tt_open_keyed_object_directory * tt_open_keyed_object_directory; ntapi_tt_create_keyed_object_directory_entry * tt_create_keyed_object_directory_entry; ntapi_tt_sid_copy * tt_sid_copy; + ntapi_tt_sid_compare * tt_sid_compare; /* nt_crc32.h */ ntapi_tt_buffer_crc32 * tt_buffer_crc32; 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; +} |