Skip to content

Commit 89e4b6b

Browse files
committed
[NTDLL_APITEST] Add a test for LdrFindResource_U / CORE-20401
See CORE-20401, CORE-20408
1 parent 454f25c commit 89e4b6b

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

modules/rostests/apitests/ntdll/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ add_dependencies(ntdll_crt_test_lib psdk)
3939
list(APPEND SOURCE
4040
DllLoadNotification.c
4141
LdrEnumResources.c
42+
LdrFindResource_U.c
4243
LdrLoadDll.c
4344
load_notifications.c
4445
locale.c
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* PROJECT: ReactOS API tests
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Test for LdrFindResource_U
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include "precomp.h"
9+
10+
static void Test_CORE_20401(void)
11+
{
12+
HMODULE hmod = GetModuleHandleW(NULL);
13+
LDR_RESOURCE_INFO info;
14+
IMAGE_RESOURCE_DATA_ENTRY *entry = NULL;
15+
NTSTATUS Status;
16+
17+
// Use LdrFindResource_U to find a bitmap resource called "NORMAL_FRAMECAPTION_BMP"
18+
// CORE-20401 resulted in wrong comparison of strings containing underscores.
19+
// If the test fails, the resource name comparison is probably broken (again).
20+
info.Type = 2; // RT_BITMAP;
21+
info.Name = (ULONG_PTR)L"NORMAL_FRAMECAPTION_BMP";
22+
info.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
23+
Status = LdrFindResource_U(hmod, &info, 3, &entry);
24+
ok_ntstatus(Status, STATUS_SUCCESS);
25+
}
26+
27+
START_TEST(LdrFindResource_U)
28+
{
29+
Test_CORE_20401();
30+
}
66 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11

22
101 10 "load_notifications.dll"
33
102 10 "empty_dll.dll"
4+
5+
NORMAL_FRAMECAPTIONMIN BITMAP "bmp1.bmp"
6+
NORMAL_FRAMECAPTIONMIN_BMP BITMAP "bmp1.bmp"
7+
NORMAL_FRAMECAPTION_BMP BITMAP "bmp1.bmp"

modules/rostests/apitests/ntdll/testlist.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern void func_wcstombs(void);
2626

2727
extern void func_DllLoadNotification(void);
2828
extern void func_LdrEnumResources(void);
29+
extern void func_LdrFindResource_U(void);
2930
extern void func_LdrLoadDll(void);
3031
extern void func_load_notifications(void);
3132
extern void func_NtAcceptConnectPort(void);
@@ -159,6 +160,7 @@ const struct test winetest_testlist[] =
159160

160161
{ "DllLoadNotification", func_DllLoadNotification },
161162
{ "LdrEnumResources", func_LdrEnumResources },
163+
{ "LdrFindResource_U", func_LdrFindResource_U },
162164
{ "LdrLoadDll", func_LdrLoadDll },
163165
{ "load_notifications", func_load_notifications },
164166
{ "NtAcceptConnectPort", func_NtAcceptConnectPort },

0 commit comments

Comments
 (0)