summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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;