[코드인젝션]기본 뼈대
#include <windows.h>
/* The 'main' function of Win32 GUI programs: this is where execution starts */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
int is_ok = MessageBox(NULL, "Fukkking", "hack", MB_YESNO);
if (is_ok == IDYES){
MessageBox(NULL, "hacked!", "hack!", MB_ICONINFORMATION);
HWND window = FindWindow(NULL, "Shadow Defender");
if(window == NULL){
MessageBox(NULL, "there is no title", "fail", MB_ICONWARNING);
} else {
DWORD pid;
GetWindowThreadProcessId(window,&pid);
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
char buff[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
SIZE_T len = 0;
BOOL result = WriteProcessMemory(p,(LPVOID)0x411CD2, buff, 6, &len);
if(result == FALSE){
MessageBox(NULL, "fail", "FUCK", MB_ICONWARNING);
}
}
}
return 0;
}