[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,

View file

@ -156,7 +156,7 @@ BasepProbeForDllManifest(IN PVOID DllHandle,
/* Check whether the image has manifest resource associated with it */
Info.Type = (ULONG_PTR)RT_MANIFEST;
Info.Name = (ULONG_PTR)ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
Info.Language = 0;
Info.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
if (!(Status = LdrFindResource_U(DllHandle, &Info, 3, &Entry)))
{
/* Create the activation context */

View file

@ -38,7 +38,7 @@ KsLoadResource(
/* set up resource info */
ResourceInfo.Type = ResourceType;
ResourceInfo.Name = ResourceName;
ResourceInfo.Language = 0;
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
_SEH2_TRY
{

View file

@ -91,6 +91,8 @@ static ULONG InbvTerminalBkgdColor = 40;
/* FUNCTIONS *****************************************************************/
#define RT_BITMAP MAKEINTRESOURCE(2)
CODE_SEG("INIT")
static
PVOID
@ -131,9 +133,10 @@ FindBitmapResource(
if (NextEntry != ListHead)
{
/* Try to find the resource */
ResourceInfo.Type = 2; // RT_BITMAP;
ResourceInfo.Type = RT_BITMAP;
ResourceInfo.Name = ResourceId;
ResourceInfo.Language = 0;
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
Status = LdrFindResource_U(LdrEntry->DllBase,
&ResourceInfo,
RESOURCE_DATA_LEVEL,

View file

@ -310,12 +310,12 @@ KiInitializeBugCheck(VOID)
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
/* Cache the Bugcheck Message Strings. Prepare the Lookup Data */
ResourceInfo.Type = 11;
/* Cache the bugcheck message strings. Prepare the lookup data. */
ResourceInfo.Type = RT_MESSAGETABLE;
ResourceInfo.Name = 1;
ResourceInfo.Language = 9;
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
/* Do the lookup. */
/* Do the lookup */
Status = LdrFindResource_U(LdrEntry->DllBase,
&ResourceInfo,
RESOURCE_DATA_LEVEL,
@ -449,7 +449,7 @@ KiDoBugCheckCallbacks(VOID)
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the reord */
/* Get the record */
CurrentRecord = CONTAINING_RECORD(NextEntry,
KBUGCHECK_CALLBACK_RECORD,
Entry);