diff options
author | midipix <writeonce@midipix.org> | 2018-03-19 03:25:40 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-03-20 23:27:58 -0400 |
commit | 99ec4d21eec1ff5c8fb2d4b09402413fb084b8fa (patch) | |
tree | 4a6ef71ef4d2d91b52cb55023fe9f1cc0a336e7a /src/internal | |
parent | e7235fb6a483c1a4f4201b578957e1f62cd6efb7 (diff) | |
download | ntapi-99ec4d21eec1ff5c8fb2d4b09402413fb084b8fa.tar.bz2 ntapi-99ec4d21eec1ff5c8fb2d4b09402413fb084b8fa.tar.xz |
internals: cache the process's token user sid.
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/ntapi.c | 15 | ||||
-rw-r--r-- | src/internal/ntapi_impl.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index 2b4a525..88f3f14 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -93,6 +93,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) int32_t status; void * hntdll; size_t block_size; + size_t buf[64]; nt_oa oa; nt_cid cid; ntapi_zw_allocate_virtual_memory * pfn_zw_allocate_virtual_memory; @@ -477,6 +478,20 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) internals->htoken, NT_SE_CREATE_SYMBOLIC_LINK_PRIVILEGE); + /* sid */ + if ((status = __ntapi->zw_query_information_token( + internals->htoken, + NT_TOKEN_USER, + buf,sizeof(buf), + &block_size))) + return status; + + internals->sid = (nt_sid *)&internals->sid_buffer; + + __ntapi->tt_sid_copy( + internals->sid, + ((nt_sid_and_attributes *)buf)->sid); + /* done */ *pvtbl = &___ntapi_shadow; at_locked_inc(&__ntapi_init_idx); diff --git a/src/internal/ntapi_impl.h b/src/internal/ntapi_impl.h index 791dbc1..6021a48 100644 --- a/src/internal/ntapi_impl.h +++ b/src/internal/ntapi_impl.h @@ -82,6 +82,8 @@ typedef struct __attr_ptr_size_aligned__ _ntapi_internals { nt_port_name * subsystem; nt_security_descriptor seq_desc; nt_security_quality_of_service seq_qos; + nt_sid_any sid_buffer; + nt_sid * sid; void * hprocess; void * htoken; void * hport_tty_session; |