From 6f1c8571162506923638dbfd6eccd76e5c4ac823 Mon Sep 17 00:00:00 2001 From: midipix Date: Jun 27 2020 16:04:49 +0000 Subject: daemon: toks_daemon_acquire(): clean-up the queue code path. --- diff --git a/src/daemon/toks_daemon_acquire.c b/src/daemon/toks_daemon_acquire.c index 44884e1..f55adcd 100644 --- a/src/daemon/toks_daemon_acquire.c +++ b/src/daemon/toks_daemon_acquire.c @@ -215,7 +215,6 @@ int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx * dctx) nt_oa oa; struct toks_token * token; struct toks_token * tocap; - nt_filetime pcnt; msg = &dctx->reply; @@ -255,18 +254,12 @@ int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx * dctx) return status; } - token = toks_get_driver_tokens(dctx->driver_ctx); - tocap = &token[toks_get_driver_atokens(dctx->driver_ctx)]; - - for (; token->self && (tokensyncinfo.hevent) { + if ((dctx->ftokens == 0) && !msg->syncinfo.hevent) { ntapi->zw_close(client.hprocess); return NT_STATUS_TIMEOUT; } - toks_query_performance_counters(dctx->driver_ctx,&pcnt); + toks_query_performance_counters(dctx->driver_ctx,&dctx->pcnt); if (dctx->ftokens == 0) { status = ntapi->zw_open_process( @@ -283,7 +276,7 @@ int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx * dctx) msg->syncinfo.ipckeys[0] = ntapi->tt_buffer_crc32( msg->header.msg_id, - &pcnt,sizeof(pcnt)); + &dctx->pcnt,sizeof(dctx->pcnt)); msg->syncinfo.ipckeys[1] = ntapi->tt_buffer_crc32( msg->header.msg_id, @@ -305,13 +298,19 @@ int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx * dctx) msg->syncinfo.ipckeys[5] = ntapi->tt_buffer_crc32( msg->header.msg_id, - &token->keys,sizeof(token->keys)); + dctx,sizeof(*dctx)); return toks_daemon_queue( dctx,hcaller, client.hprocess); } + token = toks_get_driver_tokens(dctx->driver_ctx); + tocap = &token[toks_get_driver_atokens(dctx->driver_ctx)]; + + for (; token->self && (tokenopcode == TOKS_DAEMON_RELEASE) { client.hprocess = msg->ttyinfo.exarg; @@ -324,7 +323,7 @@ int32_t __stdcall toks_daemon_acquire(struct toks_daemon_ctx * dctx) } else { token->keys.key[0] = ntapi->tt_buffer_crc32( msg->header.msg_id, - &pcnt,sizeof(pcnt)); + &dctx->pcnt,sizeof(dctx->pcnt)); token->keys.key[1] = ntapi->tt_buffer_crc32( msg->header.msg_id, diff --git a/src/internal/toksvc_daemon_impl.h b/src/internal/toksvc_daemon_impl.h index b93e1ad..0d5491b 100644 --- a/src/internal/toksvc_daemon_impl.h +++ b/src/internal/toksvc_daemon_impl.h @@ -83,6 +83,8 @@ struct toks_daemon_ctx { intptr_t reqtokpid; intptr_t reqsyspid; + + nt_filetime pcnt; }; int32_t __stdcall toks_daemon_init(struct toks_daemon_ctx *, const nt_guid *);