Module: wine Branch: master Commit: eb69da2a9cbbc4f9893ca6ae43420c71f9b63571 URL: https://source.winehq.org/git/wine.git/?a=commit;h=eb69da2a9cbbc4f9893ca6ae4...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jul 1 16:22:26 2021 +0200
ntdll: Implement NtQueryInformationToken(TokenSessionId).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46595 Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/security.c | 7 +++++-- include/wine/server_protocol.h | 4 ++-- server/protocol.def | 1 + server/request.h | 11 ++++++----- server/token.c | 1 + server/trace.c | 1 + 6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c index 6a088e84e4d..b998750d798 100644 --- a/dlls/ntdll/unix/security.c +++ b/dlls/ntdll/unix/security.c @@ -418,10 +418,13 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c break;
case TokenSessionId: + SERVER_START_REQ( get_token_info ) { - *(DWORD *)info = 0; - FIXME("QueryInformationToken( ..., TokenSessionId, ...) semi-stub\n"); + req->handle = wine_server_obj_handle( token ); + status = wine_server_call( req ); + if (!status) *(DWORD *)info = reply->session_id; } + SERVER_END_REQ; break;
case TokenVirtualizationEnabled: diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index d6815b7e349..867f99a7627 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -4913,12 +4913,12 @@ struct get_token_info_reply struct reply_header __header; luid_t token_id; luid_t modified_id; + unsigned int session_id; int primary; int impersonation_level; int elevation; int group_count; int privilege_count; - char __pad_44[4]; };
@@ -6252,7 +6252,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 723 +#define SERVER_PROTOCOL_VERSION 724
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 8eb7e3e99ca..10402ca2db3 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3432,6 +3432,7 @@ struct handle_info @REPLY luid_t token_id; /* locally-unique identifier of the token */ luid_t modified_id; /* locally-unique identifier of the modified version of the token */ + unsigned int session_id; /* token session id */ int primary; /* is the token primary or impersonation? */ int impersonation_level; /* level of impersonation */ int elevation; /* elevation type */ diff --git a/server/request.h b/server/request.h index 19e5a2a84f1..a5490fd215a 100644 --- a/server/request.h +++ b/server/request.h @@ -2088,11 +2088,12 @@ C_ASSERT( FIELD_OFFSET(struct get_token_info_request, handle) == 12 ); C_ASSERT( sizeof(struct get_token_info_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, token_id) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, modified_id) == 16 ); -C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, primary) == 24 ); -C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, impersonation_level) == 28 ); -C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, elevation) == 32 ); -C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, group_count) == 36 ); -C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, privilege_count) == 40 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, session_id) == 24 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, primary) == 28 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, impersonation_level) == 32 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, elevation) == 36 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, group_count) == 40 ); +C_ASSERT( FIELD_OFFSET(struct get_token_info_reply, privilege_count) == 44 ); C_ASSERT( sizeof(struct get_token_info_reply) == 48 ); C_ASSERT( FIELD_OFFSET(struct create_linked_token_request, handle) == 12 ); C_ASSERT( sizeof(struct create_linked_token_request) == 16 ); diff --git a/server/token.c b/server/token.c index 9c72c2a6bed..5d2fc9555a2 100644 --- a/server/token.c +++ b/server/token.c @@ -1601,6 +1601,7 @@ DECL_HANDLER(get_token_info) { reply->token_id = token->token_id; reply->modified_id = token->modified_id; + reply->session_id = token->session_id; reply->primary = token->primary; reply->impersonation_level = token->impersonation_level; reply->elevation = token->elevation; diff --git a/server/trace.c b/server/trace.c index f27cc47170b..c65694ad644 100644 --- a/server/trace.c +++ b/server/trace.c @@ -4251,6 +4251,7 @@ static void dump_get_token_info_reply( const struct get_token_info_reply *req ) { dump_luid( " token_id=", &req->token_id ); dump_luid( ", modified_id=", &req->modified_id ); + fprintf( stderr, ", session_id=%08x", req->session_id ); fprintf( stderr, ", primary=%d", req->primary ); fprintf( stderr, ", impersonation_level=%d", req->impersonation_level ); fprintf( stderr, ", elevation=%d", req->elevation );