From 439a91a7b6a3d7384bc5665f86c97d8a06cf43c2 Mon Sep 17 00:00:00 2001 From: midipix Date: Dec 15 2016 06:48:00 +0000 Subject: __ntapi_tt_get_csr_port_handle_addr_by_logic_x86_64(): code clean-up. --- diff --git a/src/system/ntapi_tt_get_csr_port_handle_addr_by_logic.c b/src/system/ntapi_tt_get_csr_port_handle_addr_by_logic.c index b552004..c1b07ef 100644 --- a/src/system/ntapi_tt_get_csr_port_handle_addr_by_logic.c +++ b/src/system/ntapi_tt_get_csr_port_handle_addr_by_logic.c @@ -150,13 +150,14 @@ void ** __ntapi_tt_get_csr_port_handle_addr_by_logic_x86_64(void) _x86_move_rcx_rel_signature * ptr_move_rcx_rel; int32_t offset; int32_t relative; - int32_t * prelative; /* for type-punned tyrants */ + int32_t * prelative; + int bias; /* calling a function within the same library: assume E8 call and 32-bit relative addressing */ - for (offset = 0; offset < MAX_FN_BYTES_TO_TEST; offset++) { - ptr_test = (unsigned char *)__ntapi->csr_client_call_server - + offset; + for (bias = 0; bias < MAX_FN_BYTES_TO_TEST; bias++) { + ptr_test = (unsigned char *)__ntapi->csr_client_call_server; + ptr_test += bias; if (*ptr_test == 0xE8) { ptr_e8_call = (_x86_e8_call_signature *)ptr_test; @@ -192,6 +193,6 @@ void ** __ntapi_tt_get_csr_port_handle_addr_by_logic_x86_64(void) } /* CsrPortHandle not found */ - return (void **)0; + return 0; } #endif