Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://waleedassar.blogspot.com
- //http://www.twitter.com/waleedassar
- //A simple trick that can be as anti-attaching trick under Windows 7.
- #include "stdafx.h"
- #include "windows.h"
- #include "stdio.h"
- extern "C"
- {
- IMAGE_NT_HEADERS* __stdcall RtlImageNtHeader(unsigned long ImageBase);
- }
- int main(int argc, char* argv[])
- {
- //----------------------------------------------------------------
- unsigned long IB=(unsigned long)GetModuleHandle(0);
- unsigned long old=0;
- VirtualProtect((void*)IB,0x1000,PAGE_READWRITE,&old);
- IMAGE_NT_HEADERS* pNt=RtlImageNtHeader(IB);
- pNt->OptionalHeader.SizeOfStackReserve=0xFFFFFED7;
- VirtualProtect((void*)IB,0x1000,old,&old);
- //-----------------------------------------------------------------
- int i=0;
- while(8)
- {
- printf("Now try to attach a debugger to me (Win7) %x\r\n",i++);
- Sleep(1000);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement