Skip to content

Instantly share code, notes, and snippets.

@spnow
Forked from evernick/ZwSetInformationThread.cpp
Created August 1, 2017 23:12
Show Gist options
  • Save spnow/820a7b84f0207130d307ef6cb7564acb to your computer and use it in GitHub Desktop.
Save spnow/820a7b84f0207130d307ef6cb7564acb 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