summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-08-25 22:27:04 -0400
committermidipix <writeonce@midipix.org>2015-09-26 11:19:26 -0400
commitc0bd29170fa3a71a9856e0a2cd75f4ad0b3854c2 (patch)
tree06f0b86fd5ebb70aeb1acc62f1605a6ca2012d2c
parent44c078a60d01e02ac5834212ad31276e909ea344 (diff)
downloadntapi-c0bd29170fa3a71a9856e0a2cd75f4ad0b3854c2.tar.bz2
ntapi-c0bd29170fa3a71a9856e0a2cd75f4ad0b3854c2.tar.xz
__ntapi_tt_sync_block_unlock(): construct the 64-bit comparison value by way of a union.
-rw-r--r--src/sync/ntapi_tt_sync_block.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/sync/ntapi_tt_sync_block.c b/src/sync/ntapi_tt_sync_block.c
index e52dd77..b28d56e 100644
--- a/src/sync/ntapi_tt_sync_block.c
+++ b/src/sync/ntapi_tt_sync_block.c
@@ -219,17 +219,20 @@ int32_t __stdcall __ntapi_tt_sync_block_server_lock(
int32_t __stdcall __ntapi_tt_sync_block_unlock(
__in nt_sync_block * sync_block)
{
- int64_t cmp;
+ union {
+ int64_t i64;
+ nt_large_integer nti64;
+ } cmp;
if (sync_block->invalid)
return NT_STATUS_INVALID_HANDLE;
- cmp = (int64_t)(pe_get_current_process_id()) << 32;
- cmp += pe_get_current_thread_id();
+ cmp.nti64.ihigh = pe_get_current_process_id();
+ cmp.nti64.ulow = pe_get_current_thread_id();
- if (cmp != at_locked_cas_64(
+ if (cmp.i64 != at_locked_cas_64(
(int64_t *)&sync_block->tid,
- cmp,0))
+ cmp.i64,0))
return NT_STATUS_RESOURCE_NOT_OWNED;
return NT_STATUS_SUCCESS;