#include "stdafx.h"
#include "Context.h"
#include <windows.h>
#include <strsafe.h>
#include <process.h>
#define MAX_LOADSTRING 100
DWORD WINAPI thread(PVOID pvParam){
for(int i=0; i<9000000;i++){
1+1+1+1;
}
return 0;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
int x =0;
DWORD ID;
CONTEXT co;
TCHAR buf[100];
HANDLE hThread = (HANDLE)_beginthreadex(NULL,0,(unsigned int (__stdcall *)(void *))thread,(PVOID)&x,0,(unsigned int *)&ID);
GetThreadContext(hThread,&co);
SuspendThread(hThread);
StringCchPrintf(buf,_countof(buf),TEXT("0x%8x"),co.Eip);
MessageBox(NULL,buf,TEXT("爷爷,你要的EIP来了"),MB_OK);
co.ContextFlags = CONTEXT_CONTROL;
co.Eip = 0x10000000;
SetThreadContext(hThread,&co);
GetThreadContext(hThread,&co);
StringCchPrintf(buf,_countof(buf),TEXT("0x%8x"),co.Eip);
MessageBox(NULL,buf,TEXT("爷爷,你要的EIP来了"),MB_OK);
ResumeThread(hThread);
return 0;
}