Forced UNICODE definition
It seems like this will forcefully #define UNICODE and apps that use structures such as MODULEENTRY32 (the ASCII variants) will break.
Is this intentional? Is there a way to use the library without using the UNICODE variants of structures from Windows API? Currently, it breaks my entire code base.
This is my current solution for now, even though it's slightly inconvenient:
// #include <Windows.h> // PHNT says don't include this anymore...
// #include <winternl.h> // Unsure about this, leaving it here for now.
#include <phnt_windows.h>
#include <phnt.h>
#undef UNICODE // Stop PHNT from forcing this...
Your code is likely wrong then. If consistently using the TCHAR bullshit the same code should compile both with and without UNICODE. But tbh I'd recommend just letting go of Win9x already, it has been 20+ years since it was last relevant.
I'm actually not sure what you're using PHNT for even, because as the name suggests it only supports NT, so your Win9x builds will be broken either way.
Saying it's wrong or broken is not helpful. I'm not explicitly using anything like (There are no TCHARs) that and I'm not targeting Win9x, nor are the APIs I'm using are for Win9x (this is all XP NT and on), so I'm unsure what you mean.
The file I linked defines UNICODE no matter what, so it will break Windows API structures when passed to functions if you also do not explicitly define UNICODE. I do not define it myself, so it breaks.
I'm not targeting Win9x, nor are the APIs I'm using are for Win9x (this is all XP NT and on), so I'm unsure what you mean.
The reason UNICODE is a thing is to allow a single codebase be compiled for Win9x and NT, with wide chars for the later. If you’re on NT, you can simply just use the explicit versions of functions and structures (usually ending with an A or W). The only reason anyone would ever want write code that cares about UNICODE is if they were also targeting Win9x. So I assumed your choice to do so had a point, and aren’t just doing it “for fun” (whatever fun may be had by doing so, personally I wouldn’t enjoy it).
Also... Just for reference... I went and looked at the systeminformer code and it also just uses the non explicit variants of functions, which means this only breaks code bases that do not use #define UNICODE. I personally don't mind taking the conversion hit from wide characters, as the underlying data will be the same anyway and I can just do whatever I want with it.
I'm curious if maintainers think this behavior could be changed... if not, then I can close the issue.