Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <windows.h>
#include <ntstatus.h>
#include <winternl.h>
#include <stdio.h>
typedef struct __attribute__((packed))
{
ULONG ExtendedInfoClass;
ULONG ExtendedInfoClassResponse;
} MITIGATION_POLICY, *PMITIGATION_POLICY;
INT WINAPI WinMain( HINSTANCE a, HINSTANCE b, LPSTR c, INT d )
{
MITIGATION_POLICY Policy = { 0 };
NTSTATUS Status = STATUS_SUCCESS;
Policy.ExtendedInfoClass = ProcessControlFlowGuardPolicy;
Policy.ExtendedInfoClassResponse = 0;
Status = NtQueryInformationProcess(
GetCurrentProcess( ),
ProcessCookie | ProcessUserModeIOPL,
&Policy,
sizeof( Policy ),
NULL
);
if ( NT_SUCCESS( Status ) ) {
if ( Policy.ExtendedInfoClassResponse ) {
printf("[ ] Control Flow Guard Policy Enabled\n");
} else {
printf("[ ] Control Flow Guard Policy Disabled\n");
};
};
return 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment