I had a problem with using winternl.h
, I was using some of the datatypes out of there and have sucessfully compiled it for x64 without any problems. However I made some changes and now for some reason its failing to compile, through debugging I've found that the reason seems to be down to _WIN32_WINNT
not being defined at all which causes winternl.h
to not define any types. It was specifically this that was causing the problem with the PEB
struct
EXTERN_C PEB* NTAPI RtlGetCurrentPeb(VOID);
Now the only thing I've seemingly changed is removing precompiled headers and creating a new class. Neither of which had the define for _WIN32_WINNT
. I've created a brand new project copied the class that imported winternl.h
over and compiled it fine. Everything is the same, imports, includes and libs etc. I can't get my head around what I did to cause this to not be defined. I've spent ages going over the two projects and cant find a cause for the problem.
I can upload the code to pastebin if need be however as both classes are the same in each project I shouldnt think this should make a difference. I guess I must of messed with something in the projects settings but I can't figure out what that may be
_WIN32_WINNT
comes from the include file <windows.h>
, so in order to fix the error you are seeing:
In the file throwing the error, change this:
#include <winternl.h>
// ...
to this:
#include <windows.h>
#include <winternl.h>
// ...