main.cpp
来自「packet DSCP tagger , can tag packets in 」· C++ 代码 · 共 61 行
CPP
61 行
#include <windows.h>#include <stdlib.h>#include <stdio.h>void ErrorExit(const char *lpszFunction){ char szBuf[80]; LPVOID lpMsgBuf; DWORD dw = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &lpMsgBuf, 0, NULL ); fprintf(stderr, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf); LocalFree(lpMsgBuf); ExitProcess(dw);}int main(int argc, char **argv){ HOOKPROC hkprc; static HINSTANCE hinstDLL; static HHOOK hhook; char buff; hinstDLL = LoadLibraryA("tslib12.dll"); if (hinstDLL == NULL) { ErrorExit("LoadLibrary"); } hkprc = (HOOKPROC)GetProcAddress(hinstDLL, "_CallWndProc@12"); if (hkprc == NULL) { fprintf(stderr, "Failed to get procaddress\n"); return 2; } hhook = SetWindowsHookEx(WH_GETMESSAGE,hkprc,hinstDLL,0); if (hhook == NULL) { fprintf(stderr, "Failed to insert hook\n"); return 3; } printf("Hook installed. Press any key to abort, abort, abort!\n"); fread(&buff, 1, 1, stdin); printf("Uninstalling...\n"); if (! UnhookWindowsHookEx(hhook)) { fprintf(stderr, "Failed to remove hook. This is kinda critical.\n"); return 4; } return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?