#include <windows.h>
#include <iostream>
#include <stdio.h>
using namespace std;
#define BUFFER_SIZE 4096
void *MemAddr = NULL;
int _tmain(int argc, _TCHAR* argv[])
{
copyself();
getchar();
return 0;
}
void copyself( )
{
MemAddr = VirtualAlloc(NULL, BUFFER_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
memcpy(MemAddr, (void *)_tmain, BUFFER_SIZE);
}