From f3fc93491a15ac08e0c9986cabd659d32f51bfc7 Mon Sep 17 00:00:00 2001 From: nomdenom Date: Sat, 18 Aug 2018 23:48:11 -0700 Subject: [PATCH] Use WNDPROC type for window procedures (#162) --- Source/diablo.cpp | 12 ++++++------ Source/diablo.h | 4 ++-- Source/init.cpp | 8 ++++---- Source/init.h | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 41e155ea4..c499b0786 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -153,7 +153,7 @@ void __fastcall run_game_loop(int uMsg) bool v5; // zf //int v6; // eax signed int v7; // [esp+8h] [ebp-24h] - LRESULT (__stdcall *saveProc)(HWND, UINT, WPARAM, LPARAM); // [esp+Ch] [ebp-20h] + WNDPROC saveProc; // [esp+Ch] [ebp-20h] struct tagMSG msg; // [esp+10h] [ebp-1Ch] nthread_ignore_mutex(1); @@ -662,16 +662,16 @@ LABEL_10: // 646D00: using guessed type char qtextflag; // 6AA705: using guessed type char stextflag; -LRESULT __stdcall DisableInputWndProc(HWND hWnd, int uMsg, int wParam, int lParam) +LRESULT __stdcall DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { bool v5; // zf - if ( uMsg <= (unsigned int)WM_LBUTTONDOWN ) + if ( uMsg <= WM_LBUTTONDOWN ) { if ( uMsg != WM_LBUTTONDOWN ) { - if ( uMsg >= (unsigned int)WM_KEYFIRST - && (uMsg <= (unsigned int)WM_CHAR + if ( uMsg >= WM_KEYFIRST + && (uMsg <= WM_CHAR || uMsg == WM_SYSKEYDOWN || uMsg == WM_SYSCOMMAND || uMsg == WM_MOUSEFIRST) ) @@ -724,7 +724,7 @@ LABEL_23: } // 525748: using guessed type char sgbMouseDown; -int __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if ( uMsg > WM_LBUTTONDOWN ) { diff --git a/Source/diablo.h b/Source/diablo.h index c8c7f2172..8cf2862f1 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -48,8 +48,8 @@ void __cdecl diablo_init_screen(); HWND __fastcall diablo_find_window(LPCSTR lpClassName); void __fastcall diablo_reload_process(HMODULE hModule); int __cdecl PressEscKey(); -LRESULT __stdcall DisableInputWndProc(HWND hWnd, int uMsg, int wParam, int lParam); -int __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT __stdcall DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); bool __fastcall LeftMouseDown(int a1); bool __cdecl TryIconCurs(); void __cdecl LeftMouseUp(); diff --git a/Source/init.cpp b/Source/init.cpp index 0a5efb738..a84f272e7 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -8,7 +8,7 @@ int window_activated; // weak char diablo_exe_path[260]; void *unused_mpq; char patch_rt_mpq_path[260]; -LRESULT (__stdcall *CurrentProc)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +WNDPROC CurrentProc; void *diabdat_mpq; char diabdat_mpq_path[260]; void *patch_rt_mpq; @@ -515,11 +515,11 @@ LRESULT __stdcall init_redraw_window(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM return result; } -LRESULT (__stdcall *SetWindowProc(void *func))(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +WNDPROC __stdcall SetWindowProc(WNDPROC func) { - LRESULT (__stdcall *result)(HWND, UINT, WPARAM, LPARAM); // eax + WNDPROC result; // eax result = CurrentProc; - CurrentProc = (LRESULT (__stdcall *)(HWND, UINT, WPARAM, LPARAM))func; + CurrentProc = func; return result; } diff --git a/Source/init.h b/Source/init.h index 91d7cb829..1243b1207 100644 --- a/Source/init.h +++ b/Source/init.h @@ -8,7 +8,7 @@ extern int window_activated; // weak extern char diablo_exe_path[260]; extern void *unused_mpq; extern char patch_rt_mpq_path[260]; -extern LRESULT (__stdcall *CurrentProc)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +extern WNDPROC CurrentProc; extern void *diabdat_mpq; extern char diabdat_mpq_path[260]; extern void *patch_rt_mpq; @@ -32,7 +32,7 @@ void __cdecl init_get_file_info(); LRESULT __stdcall init_palette(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void __fastcall init_activate_window(HWND hWnd, bool activated); LRESULT __stdcall init_redraw_window(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT (__stdcall *SetWindowProc(void *func))(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +WNDPROC __stdcall SetWindowProc(WNDPROC func); /* data */ extern int init_inf; // weak