Skip to content

Instantly share code, notes, and snippets.

@kusma
Last active October 29, 2015 16:36
Show Gist options
  • Save kusma/278580 to your computer and use it in GitHub Desktop.
Save kusma/278580 to your computer and use it in GitHub Desktop.
DWORD SetThreadExecutionState(DWORD flags)
{
typedef DWORD (WINAPI *T)(DWORD);
static T SetThreadExecutionState = NULL;
static int first = 1;
if (first) {
first = 0;
SetThreadExecutionState = (T)GetProcAddress(
GetModuleHandle("KERNEL32.DLL"), "SetThreadExecutionState");
}
if (SetThreadExecutionState)
SetThreadExecutionState(flags);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment