Support for showing if app is 32bit vs 64bit, and support for doing message hooks on both

Added support for message hook viewer to hook both 32 and 64 bit
applications.
Fixed filtering on the msg hook viewer
Added custom filtering on msg hook viewer
Added Process Id targetting on msg hook viewer
Added SetMsgHook.exe command line app as an alternative way of starting
msg hook viewer.
This commit is contained in:
Edward Jakubowski
2014-06-03 06:28:14 -04:00
parent 05748b4582
commit d100d23259
41 changed files with 1232 additions and 72 deletions

View File

@@ -11,11 +11,14 @@
// Windows Header Files:
#include <stdio.h>
#include <windows.h>
#include <process.h>
#include <tchar.h>
#include <Psapi.h>
#include <stdlib.h>
#include <tlhelp32.h> //CreateToolhelp32Snapshot
#pragma comment( lib, "psapi.lib" )
//#pragma comment( lib, "kernel32.lib" )
// TODO: reference additional headers your program requires here
@@ -37,14 +40,23 @@ typedef struct
//HHOOK g_hHook;
HWND g_hWnd;
HANDLE g_hInstance;
HOOKPROC g_CwpHookProc;
}GLOBALDATA;
#ifndef GLOBAL_VARS_H // header guards
#define GLOBAL_VARS_H
extern "C" __declspec(dllexport) void CreateMsgHookWindow(LPTSTR lpCmdLine);
extern "C" __declspec(dllexport) BOOL SetCustomMsgHookDll(const TCHAR * hookDll, const char * hookDllProcName);
extern "C" __declspec(dllexport) BOOL SetMsgHook(HWND callerHWnd, DWORD threadId);
extern "C" __declspec(dllexport) HHOOK GetCurrentHookHandle();
extern "C" __declspec(dllexport) void SetGlobalDLLInstance(HANDLE dllInstance);
extern "C" __declspec(dllexport) BOOL RemoveHook();
extern "C" __declspec(dllexport) BOOL IsCurrentProcess64Bit();
extern "C" __declspec(dllexport) BOOL IsProcess64Bit(DWORD procId);
extern "C" __declspec(dllexport) DWORD GetProcessMainThreadId(DWORD procId);
//void ExtractResource(const WORD nID, LPCTSTR szFilename);
//Global variables , remember not to initialize here
extern HANDLE hMappedFile;
@@ -53,6 +65,10 @@ extern bool bStartingProcess;
#define MAX_TEST_SIZE 100
extern TCHAR targetHwndStr[MAX_TEST_SIZE];
extern TCHAR targetProcessId[MAX_TEST_SIZE];
extern TCHAR targetClassname[MAX_TEST_SIZE];
extern TCHAR dll32bitName[500];
extern TCHAR dll64bitName[500];
extern char dllProcName[500];
#endif