Skip to content

Instantly share code, notes, and snippets.

Avatar

Hydranix hydranix

  • San Francisco Bay Area, California
View GitHub Profile
@hydranix
hydranix / gist:b8af0c197a1cc11429da600c33c15418
Created Apr 16, 2017
[Undocumented WinAPI] Timer Resolution
View gist:b8af0c197a1cc11429da600c33c15418
// From Oskar Dahlberg's post at:
// http://stackoverflow.com/a/31411628/4725495
#include <Windows.h>
static NTSTATUS(__stdcall *NtDelayExecution)(BOOL Alertable, PLARGE_INTEGER DelayInterval) = (NTSTATUS(__stdcall*)(BOOL, PLARGE_INTEGER)) GetProcAddress(GetModuleHandle("ntdll.dll"), "NtDelayExecution");
static NTSTATUS(__stdcall *ZwSetTimerResolution)(IN ULONG RequestedResolution, IN BOOLEAN Set, OUT PULONG ActualResolution) = (NTSTATUS(__stdcall*)(ULONG, BOOLEAN, PULONG)) GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwSetTimerResolution");
You can’t perform that action at this time.