[REACTOS] Use the RT_* resource type defines where possible (#6023)

And use the self-documenting `MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)`
instead of `0` for the `LDR_RESOURCE_INFO::Language` structure member.
This commit is contained in:
Hermès Bélusca-Maïto 2025-04-08 20:05:51 +02:00
parent 111c8cc62a
commit 1b564c1ba8
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
6 changed files with 21 additions and 18 deletions

View file

@ -14,7 +14,6 @@
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#define NTOS_MODE_USER
#include <ndk/cmfuncs.h>

View file

@ -22,26 +22,27 @@
/* FUNCTIONS ****************************************************************/
#define MAKEINTRESOURCE(i) ((ULONG_PTR)(USHORT)(i))
#define RT_VERSION MAKEINTRESOURCE(16) // See psdk/winuser.h
#define VS_VERSION_INFO 1 // See psdk/verrsrc.h
#define VS_FILE_INFO RT_VERSION
NTSTATUS
NtGetVersionResource(
IN PVOID BaseAddress,
OUT PVOID* Resource,
OUT PULONG ResourceSize OPTIONAL)
{
// #define RT_VERSION MAKEINTRESOURCE(16) // See winuser.h
#define VS_VERSION_INFO 1 // See psdk/verrsrc.h
#define VS_FILE_INFO RT_VERSION
NTSTATUS Status;
LDR_RESOURCE_INFO ResourceInfo;
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
PVOID Data = NULL;
ULONG Size = 0;
/* Try to find the resource */
ResourceInfo.Type = 16; // RT_VERSION;
ResourceInfo.Name = VS_VERSION_INFO; // MAKEINTRESOURCEW(VS_VERSION_INFO);
ResourceInfo.Language = 0; // Don't care about the language
/* Try to find the resource (language-neutral) */
ResourceInfo.Type = RT_VERSION;
ResourceInfo.Name = VS_VERSION_INFO;
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
Status = LdrFindResource_U(BaseAddress,
&ResourceInfo,