Skip to content

Commit 02af7e7

Browse files
committed
[CRT_APITEST] Fix tests for wctomb
- Dynamically load function from the appropriate DLL - Remove from ntdll_apitest (these are not exported by ntdll)
1 parent 5272cc2 commit 02af7e7

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

modules/rostests/apitests/crt/wctomb.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
#define todo_static todo_if(1)
1919
#else
2020
#define todo_static
21+
typedef int (__cdecl *PFN_wctomb)(char *mbchar, wchar_t wchar);
22+
static PFN_wctomb p_wctomb;
23+
24+
static BOOL Init(void)
25+
{
26+
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
27+
p_wctomb = (PFN_wctomb)GetProcAddress(hdll, "wctomb");
28+
ok(p_wctomb != NULL, "Failed to load wctomb from %s\n", TEST_DLL_NAME);
29+
return (p_wctomb != NULL);
30+
}
31+
#define wctomb p_wctomb
2132
#endif
2233

2334
START_TEST(wctomb)
@@ -28,6 +39,14 @@ START_TEST(wctomb)
2839
unsigned int codepage = ___lc_codepage_func();
2940
wchar_t wchSrc[2] = {L'R', 0414}; // 0414 corresponds to a Russian character in Windows-1251
3041

42+
#ifndef TEST_STATIC_CRT
43+
if (!Init())
44+
{
45+
skip("Skipping tests, because wctomb is not available\n");
46+
return;
47+
}
48+
#endif
49+
3150
chDest = AllocateGuarded(sizeof(*chDest));
3251
if (!chDest)
3352
{

modules/rostests/apitests/ntdll/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ list(APPEND SOURCE_CRT_TESTS
1414
../crt/_vsnprintf.c
1515
../crt/_vsnwprintf.c
1616
../crt/mbstowcs.c
17-
../crt/mbtowc.c
1817
../crt/setjmp.c
1918
../crt/sprintf.c
2019
../crt/strcpy.c
2120
../crt/strlen.c
2221
../crt/strtoul.c
2322
../crt/wcstombs.c
2423
../crt/wcstoul.c
25-
../crt/wctomb.c
2624
)
2725

2826
add_library(ntdll_crt_test_lib ${SOURCE_CRT_TESTS})

modules/rostests/apitests/ntdll/testlist.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ extern void func__vscwprintf(void);
88
extern void func__vsnprintf(void);
99
extern void func__vsnwprintf(void);
1010
extern void func_mbstowcs(void);
11-
extern void func_mbtowc(void);
1211
extern void func_setjmp(void);
1312
extern void func_sprintf(void);
1413
extern void func_strcpy(void);
1514
extern void func_strlen(void);
1615
extern void func_strtoul(void);
1716
extern void func_wcstoul(void);
18-
extern void func_wctomb(void);
1917
extern void func_wcstombs(void);
2018

2119
extern void func_DllLoadNotification(void);
@@ -135,14 +133,12 @@ const struct test winetest_testlist[] =
135133
{ "_vsnprintf", func__vsnprintf },
136134
{ "_vsnwprintf", func__vsnwprintf },
137135
{ "mbstowcs", func_mbstowcs },
138-
{ "mbtowc", func_mbtowc },
139136
{ "setjmp", func_setjmp },
140137
{ "sprintf", func_sprintf },
141138
{ "strcpy", func_strcpy },
142139
{ "strlen", func_strlen },
143140
{ "strtoul", func_strtoul },
144141
{ "wcstoul", func_wcstoul },
145-
{ "wctomb", func_wctomb },
146142
{ "wcstombs", func_wcstombs },
147143

148144
{ "DllLoadNotification", func_DllLoadNotification },

0 commit comments

Comments
 (0)