Skip to content

Instantly share code, notes, and snippets.

@evernick
Created June 18, 2015 08:33
Show Gist options
  • Save evernick/3a7b3f82e0de54ca1064 to your computer and use it in GitHub Desktop.
Save evernick/3a7b3f82e0de54ca1064 to your computer and use it in GitHub Desktop.
#include<windows.h>
#include<stdio.h>
typedef DWORD (WINAPI *PFZWSETINFORMATIONTHREAD) (
HANDLE ThreadHandle,
DWORD ThreadInformationClass, // Original : _THREAD_INFORMATION_CLASS
PVOID ThreadInformation,
ULONG ThreadInformationLength
);
void anti_debug()
{
PFZWSETINFORMATIONTHREAD pfZwSetInformationThread;
HMODULE h_ntdll = GetModuleHandle("ntdll.dll");
pfZwSetInformationThread = (PFZWSETINFORMATIONTHREAD)GetProcAddress(h_ntdll, "ZwSetInformationThread");
pfZwSetInformationThread(GetCurrentThread(), 0x11, 0, 0); // 0x11 : ThreadHideFromDebugger
printf("Debugger Dettached\n");
}
int main(int argc, char **argv)
{
anti_debug();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment