[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 <windef.h>
#include <winbase.h> #include <winbase.h>
#include <winreg.h> #include <winreg.h>
#include <winuser.h>
#define NTOS_MODE_USER #define NTOS_MODE_USER
#include <ndk/cmfuncs.h> #include <ndk/cmfuncs.h>

View file

@ -22,26 +22,27 @@
/* FUNCTIONS ****************************************************************/ /* 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 NTSTATUS
NtGetVersionResource( NtGetVersionResource(
IN PVOID BaseAddress, IN PVOID BaseAddress,
OUT PVOID* Resource, OUT PVOID* Resource,
OUT PULONG ResourceSize OPTIONAL) 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; NTSTATUS Status;
LDR_RESOURCE_INFO ResourceInfo; LDR_RESOURCE_INFO ResourceInfo;
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry; PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
PVOID Data = NULL; PVOID Data = NULL;
ULONG Size = 0; ULONG Size = 0;
/* Try to find the resource */ /* Try to find the resource (language-neutral) */
ResourceInfo.Type = 16; // RT_VERSION; ResourceInfo.Type = RT_VERSION;
ResourceInfo.Name = VS_VERSION_INFO; // MAKEINTRESOURCEW(VS_VERSION_INFO); ResourceInfo.Name = VS_VERSION_INFO;
ResourceInfo.Language = 0; // Don't care about the language ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
Status = LdrFindResource_U(BaseAddress, Status = LdrFindResource_U(BaseAddress,
&ResourceInfo, &ResourceInfo,

View file

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

View file

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

View file

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

View file

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