mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
always use delay function
This commit is contained in:
parent
47a5f89327
commit
e9168a6871
@ -17,6 +17,7 @@
|
|||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "dllmain.h"
|
#include "dllmain.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "delay_imports.h"
|
||||||
|
|
||||||
|
|
||||||
double g_dbg_frame_time = 0;
|
double g_dbg_frame_time = 0;
|
||||||
@ -89,10 +90,7 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
|
|||||||
HMODULE mod = NULL;
|
HMODULE mod = NULL;
|
||||||
char filename[MAX_PATH] = { 0 };
|
char filename[MAX_PATH] = { 0 };
|
||||||
|
|
||||||
BOOL(WINAPI * getModuleHandleExA)(DWORD, LPCSTR, HMODULE*) =
|
if (delay_GetModuleHandleExA && delay_GetModuleHandleExA(
|
||||||
(void*)real_GetProcAddress(real_LoadLibraryA("Kernel32.dll"), "GetModuleHandleExA");
|
|
||||||
|
|
||||||
if (getModuleHandleExA && getModuleHandleExA(
|
|
||||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||||
exception->ExceptionRecord->ExceptionAddress,
|
exception->ExceptionRecord->ExceptionAddress,
|
||||||
&mod))
|
&mod))
|
||||||
|
35
src/utils.c
35
src/utils.c
@ -264,10 +264,7 @@ FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
|||||||
|
|
||||||
BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
||||||
{
|
{
|
||||||
BOOL (WINAPI *getModuleHandleExA)(DWORD, LPCSTR, HMODULE*) =
|
if (!delay_GetModuleHandleExA)
|
||||||
(void*)real_GetProcAddress(real_LoadLibraryA("Kernel32.dll"), "GetModuleHandleExA");
|
|
||||||
|
|
||||||
if (!getModuleHandleExA)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
void* directDrawCreate = (void*)util_get_iat_proc(GetModuleHandleA(NULL), "ddraw.dll", "DirectDrawCreate");
|
void* directDrawCreate = (void*)util_get_iat_proc(GetModuleHandleA(NULL), "ddraw.dll", "DirectDrawCreate");
|
||||||
@ -281,9 +278,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||||||
HMODULE D3dHook_dll = GetModuleHandleA("D3dHook.dll");
|
HMODULE D3dHook_dll = GetModuleHandleA("D3dHook.dll");
|
||||||
if (D3dHook_dll)
|
if (D3dHook_dll)
|
||||||
{
|
{
|
||||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == D3dHook_dll) ||
|
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == D3dHook_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == D3dHook_dll) ||
|
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == D3dHook_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == D3dHook_dll))
|
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == D3dHook_dll))
|
||||||
{
|
{
|
||||||
MessageBoxA(
|
MessageBoxA(
|
||||||
NULL,
|
NULL,
|
||||||
@ -299,9 +296,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||||||
HMODULE wndmode_dll = GetModuleHandleA("wndmode.dll");
|
HMODULE wndmode_dll = GetModuleHandleA("wndmode.dll");
|
||||||
if (wndmode_dll)
|
if (wndmode_dll)
|
||||||
{
|
{
|
||||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == wndmode_dll) ||
|
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == wndmode_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == wndmode_dll) ||
|
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == wndmode_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == wndmode_dll))
|
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == wndmode_dll))
|
||||||
{
|
{
|
||||||
MessageBoxA(
|
MessageBoxA(
|
||||||
NULL,
|
NULL,
|
||||||
@ -317,9 +314,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||||||
HMODULE windmode_dll = GetModuleHandleA("windmode.dll");
|
HMODULE windmode_dll = GetModuleHandleA("windmode.dll");
|
||||||
if (windmode_dll)
|
if (windmode_dll)
|
||||||
{
|
{
|
||||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == windmode_dll) ||
|
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == windmode_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == windmode_dll) ||
|
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == windmode_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == windmode_dll))
|
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == windmode_dll))
|
||||||
{
|
{
|
||||||
MessageBoxA(
|
MessageBoxA(
|
||||||
NULL,
|
NULL,
|
||||||
@ -335,9 +332,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||||||
HMODULE dxwnd_dll = GetModuleHandleA("dxwnd.dll");
|
HMODULE dxwnd_dll = GetModuleHandleA("dxwnd.dll");
|
||||||
if (dxwnd_dll)
|
if (dxwnd_dll)
|
||||||
{
|
{
|
||||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == dxwnd_dll) ||
|
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == dxwnd_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == dxwnd_dll) ||
|
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == dxwnd_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == dxwnd_dll))
|
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == dxwnd_dll))
|
||||||
{
|
{
|
||||||
MessageBoxA(
|
MessageBoxA(
|
||||||
NULL,
|
NULL,
|
||||||
@ -353,9 +350,9 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address)
|
|||||||
HMODULE age_dll = GetModuleHandleA("age.dll");
|
HMODULE age_dll = GetModuleHandleA("age.dll");
|
||||||
if (age_dll)
|
if (age_dll)
|
||||||
{
|
{
|
||||||
if ((getModuleHandleExA(flags, return_address, &mod) && mod == age_dll) ||
|
if ((delay_GetModuleHandleExA(flags, return_address, &mod) && mod == age_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreate, &mod) && mod == age_dll) ||
|
(delay_GetModuleHandleExA(flags, directDrawCreate, &mod) && mod == age_dll) ||
|
||||||
(getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == age_dll))
|
(delay_GetModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == age_dll))
|
||||||
{
|
{
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
LONG status =
|
LONG status =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user