计划写一个取词软件,看完hook,远程注入后发现用VC++连个GDI画图都不会,学起来有点晕,干脆用win32汇编的程序改吧
#include <windowsx.h>#include <stdio.h>#include <stdlib.h>#include <tchar.h>#include <StrSafe.h> #include "CmnHdr.h"LRESULT CALLBACK WndPRoc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ RECT Rect; PAINTSTRUCT ps; HDC hdc; TCHAR Text[100]; switch (message) { case WM_CLOSE: DestroyWindow(hWnd); PostQuitMessage(NULL); case WM_PAINT: StringCchPrintf(Text, _countof(Text), TEXT("Hello World")); hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); DrawText(hdc, Text, -1, &Rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint(hWnd, &ps); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0;}VOID MyCreateWindow(HINSTANCE hInstanceExe) { MSG msg; WNDCLASSEX wcex; HWND hWinMain; TCHAR ClassName[100]; TCHAR ClassCaption[100]; StringCchPrintf(ClassName, _countof(ClassName), TEXT("MyClassName")); StringCchPrintf(ClassCaption, _countof(ClassCaption), TEXT("MyClassCaption")); wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstanceExe; wcex.hIcon = LoadIcon(0, IDC_ARROW); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = 0; wcex.lpszClassName = ClassName; wcex.hIconSm = LoadIcon(wcex.hInstance, 0); RegisterClassEx(&wcex); hWinMain = CreateWindowEx(WS_EX_CLIENTEDGE,ClassName,ClassCaption, WS_OVERLAPPEDWINDOW, 100,100,600,400, NULL,NULL,hInstanceExe,NULL ); ShowWindow(hWinMain, SW_SHOWNORMAL); UpdateWindow(hWinMain); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); }}int WINAPI _tWinMain (HINSTANCE hInstanceExe, HINSTANCE, PTSTR pszCmdLine, int) { MyCreateWindow(hInstanceExe); return (0);}新闻热点
疑难解答