Skip to content

Commit 1b564c1

Browse files
committed
[REACTOS] Use the RT_* resource type defines where possible (reactos#6023)
And use the self-documenting `MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)` instead of `0` for the `LDR_RESOURCE_INFO::Language` structure member.
1 parent 111c8cc commit 1b564c1

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

base/setup/lib/precomp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <windef.h>
1515
#include <winbase.h>
1616
#include <winreg.h>
17-
#include <winuser.h>
1817

1918
#define NTOS_MODE_USER
2019
#include <ndk/cmfuncs.h>

base/setup/lib/utils/ntverrsrc.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,27 @@
2222

2323
/* FUNCTIONS ****************************************************************/
2424

25+
#define MAKEINTRESOURCE(i) ((ULONG_PTR)(USHORT)(i))
26+
#define RT_VERSION MAKEINTRESOURCE(16) // See psdk/winuser.h
27+
#define VS_VERSION_INFO 1 // See psdk/verrsrc.h
28+
#define VS_FILE_INFO RT_VERSION
29+
2530
NTSTATUS
2631
NtGetVersionResource(
2732
IN PVOID BaseAddress,
2833
OUT PVOID* Resource,
2934
OUT PULONG ResourceSize OPTIONAL)
3035
{
31-
// #define RT_VERSION MAKEINTRESOURCE(16) // See winuser.h
32-
#define VS_VERSION_INFO 1 // See psdk/verrsrc.h
33-
#define VS_FILE_INFO RT_VERSION
34-
3536
NTSTATUS Status;
3637
LDR_RESOURCE_INFO ResourceInfo;
3738
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
3839
PVOID Data = NULL;
3940
ULONG Size = 0;
4041

41-
/* Try to find the resource */
42-
ResourceInfo.Type = 16; // RT_VERSION;
43-
ResourceInfo.Name = VS_VERSION_INFO; // MAKEINTRESOURCEW(VS_VERSION_INFO);
44-
ResourceInfo.Language = 0; // Don't care about the language
42+
/* Try to find the resource (language-neutral) */
43+
ResourceInfo.Type = RT_VERSION;
44+
ResourceInfo.Name = VS_VERSION_INFO;
45+
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
4546

4647
Status = LdrFindResource_U(BaseAddress,
4748
&ResourceInfo,

dll/win32/kernel32/client/actctx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ BasepProbeForDllManifest(IN PVOID DllHandle,
156156
/* Check whether the image has manifest resource associated with it */
157157
Info.Type = (ULONG_PTR)RT_MANIFEST;
158158
Info.Name = (ULONG_PTR)ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
159-
Info.Language = 0;
159+
Info.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
160160
if (!(Status = LdrFindResource_U(DllHandle, &Info, 3, &Entry)))
161161
{
162162
/* Create the activation context */

drivers/ksfilter/ks/image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ KsLoadResource(
3838
/* set up resource info */
3939
ResourceInfo.Type = ResourceType;
4040
ResourceInfo.Name = ResourceName;
41-
ResourceInfo.Language = 0;
41+
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
4242

4343
_SEH2_TRY
4444
{

ntoskrnl/inbv/inbv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static ULONG InbvTerminalBkgdColor = 40;
9191

9292
/* FUNCTIONS *****************************************************************/
9393

94+
#define RT_BITMAP MAKEINTRESOURCE(2)
95+
9496
CODE_SEG("INIT")
9597
static
9698
PVOID
@@ -131,9 +133,10 @@ FindBitmapResource(
131133
if (NextEntry != ListHead)
132134
{
133135
/* Try to find the resource */
134-
ResourceInfo.Type = 2; // RT_BITMAP;
136+
ResourceInfo.Type = RT_BITMAP;
135137
ResourceInfo.Name = ResourceId;
136-
ResourceInfo.Language = 0;
138+
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
139+
137140
Status = LdrFindResource_U(LdrEntry->DllBase,
138141
&ResourceInfo,
139142
RESOURCE_DATA_LEVEL,

ntoskrnl/ke/bug.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ KiInitializeBugCheck(VOID)
310310
LDR_DATA_TABLE_ENTRY,
311311
InLoadOrderLinks);
312312

313-
/* Cache the Bugcheck Message Strings. Prepare the Lookup Data */
314-
ResourceInfo.Type = 11;
313+
/* Cache the bugcheck message strings. Prepare the lookup data. */
314+
ResourceInfo.Type = RT_MESSAGETABLE;
315315
ResourceInfo.Name = 1;
316-
ResourceInfo.Language = 9;
316+
ResourceInfo.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
317317

318-
/* Do the lookup. */
318+
/* Do the lookup */
319319
Status = LdrFindResource_U(LdrEntry->DllBase,
320320
&ResourceInfo,
321321
RESOURCE_DATA_LEVEL,
@@ -449,7 +449,7 @@ KiDoBugCheckCallbacks(VOID)
449449
NextEntry = ListHead->Flink;
450450
while (NextEntry != ListHead)
451451
{
452-
/* Get the reord */
452+
/* Get the record */
453453
CurrentRecord = CONTAINING_RECORD(NextEntry,
454454
KBUGCHECK_CALLBACK_RECORD,
455455
Entry);

0 commit comments

Comments
 (0)