diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt b/modules/rostests/apitests/ntdll/CMakeLists.txt index 54e954ba069..71f8ec4af7e 100644 --- a/modules/rostests/apitests/ntdll/CMakeLists.txt +++ b/modules/rostests/apitests/ntdll/CMakeLists.txt @@ -39,6 +39,7 @@ add_dependencies(ntdll_crt_test_lib psdk) list(APPEND SOURCE DllLoadNotification.c LdrEnumResources.c + LdrFindResource_U.c LdrLoadDll.c load_notifications.c locale.c diff --git a/modules/rostests/apitests/ntdll/LdrFindResource_U.c b/modules/rostests/apitests/ntdll/LdrFindResource_U.c new file mode 100644 index 00000000000..5a0aa385401 --- /dev/null +++ b/modules/rostests/apitests/ntdll/LdrFindResource_U.c @@ -0,0 +1,30 @@ +/* + * PROJECT: ReactOS API tests + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Test for LdrFindResource_U + * COPYRIGHT: Copyright 2025 Timo Kreuzer + */ + +#include "precomp.h" + +static void Test_CORE_20401(void) +{ + HMODULE hmod = GetModuleHandleW(NULL); + LDR_RESOURCE_INFO info; + IMAGE_RESOURCE_DATA_ENTRY *entry = NULL; + NTSTATUS Status; + + // Use LdrFindResource_U to find a bitmap resource called "NORMAL_FRAMECAPTION_BMP" + // CORE-20401 resulted in wrong comparison of strings containing underscores. + // If the test fails, the resource name comparison is probably broken (again). + info.Type = 2; // RT_BITMAP; + info.Name = (ULONG_PTR)L"NORMAL_FRAMECAPTION_BMP"; + info.Language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); + Status = LdrFindResource_U(hmod, &info, 3, &entry); + ok_ntstatus(Status, STATUS_SUCCESS); +} + +START_TEST(LdrFindResource_U) +{ + Test_CORE_20401(); +} diff --git a/modules/rostests/apitests/ntdll/bmp1.bmp b/modules/rostests/apitests/ntdll/bmp1.bmp new file mode 100644 index 00000000000..43e4ac49d84 Binary files /dev/null and b/modules/rostests/apitests/ntdll/bmp1.bmp differ diff --git a/modules/rostests/apitests/ntdll/testdata.rc b/modules/rostests/apitests/ntdll/testdata.rc index 3937c7302ef..695c8cabee7 100644 --- a/modules/rostests/apitests/ntdll/testdata.rc +++ b/modules/rostests/apitests/ntdll/testdata.rc @@ -1,3 +1,7 @@ 101 10 "load_notifications.dll" 102 10 "empty_dll.dll" + +NORMAL_FRAMECAPTIONMIN BITMAP "bmp1.bmp" +NORMAL_FRAMECAPTIONMIN_BMP BITMAP "bmp1.bmp" +NORMAL_FRAMECAPTION_BMP BITMAP "bmp1.bmp" diff --git a/modules/rostests/apitests/ntdll/testlist.c b/modules/rostests/apitests/ntdll/testlist.c index 6566b6f5538..6584eaf0f9b 100644 --- a/modules/rostests/apitests/ntdll/testlist.c +++ b/modules/rostests/apitests/ntdll/testlist.c @@ -26,6 +26,7 @@ extern void func_wcstombs(void); extern void func_DllLoadNotification(void); extern void func_LdrEnumResources(void); +extern void func_LdrFindResource_U(void); extern void func_LdrLoadDll(void); extern void func_load_notifications(void); extern void func_NtAcceptConnectPort(void); @@ -159,6 +160,7 @@ const struct test winetest_testlist[] = { "DllLoadNotification", func_DllLoadNotification }, { "LdrEnumResources", func_LdrEnumResources }, + { "LdrFindResource_U", func_LdrFindResource_U }, { "LdrLoadDll", func_LdrLoadDll }, { "load_notifications", func_load_notifications }, { "NtAcceptConnectPort", func_NtAcceptConnectPort },