Skip to content

Commit 9ab89bd

Browse files
committed
[UCRTBASE_WINETEST] Fix and add to build
1 parent 5c47607 commit 9ab89bd

File tree

6 files changed

+113
-0
lines changed

6 files changed

+113
-0
lines changed

modules/rostests/winetests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ add_subdirectory(spoolss)
115115
add_subdirectory(sti)
116116
add_subdirectory(sxs)
117117
add_subdirectory(twain_32)
118+
add_subdirectory(ucrtbase)
118119
add_subdirectory(urlmon)
119120
add_subdirectory(user32)
120121
add_subdirectory(userenv)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
# Hack until we support globally defining _DEBUG
3+
if(DBG)
4+
#add_compile_definitions(_DEBUG)
5+
endif()
6+
7+
# Generate threaddll.dll
8+
spec2def(threaddll.dll threaddll.spec)
9+
add_library(threaddll SHARED
10+
threaddll.c
11+
threaddll.def
12+
)
13+
set_entrypoint(threaddll DllMain 12)
14+
if(MSVC)
15+
target_link_libraries(threaddll runtmchk)
16+
endif()
17+
add_importlibs(threaddll ucrtbase kernel32)
18+
19+
# Hacks to make it work with MSVC IDE / MSBUILD
20+
if(MSVC_IDE)
21+
if(DBG)
22+
set(THREADDLL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/Debug)
23+
else()
24+
set(THREADDLL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/Release)
25+
endif()
26+
message(STATUS "threaddll.dll output directory: ${THREADDLL_OUTPUT_DIR}")
27+
28+
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /I${THREADDLL_OUTPUT_DIR}")
29+
endif()
30+
31+
# Hack to replace the old CRT include directory with the UCRT include directory
32+
get_property(INCLUDE_DIRS DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
33+
list(REMOVE_ITEM INCLUDE_DIRS "${REACTOS_SOURCE_DIR}/sdk/include/crt")
34+
set_property(DIRECTORY . PROPERTY INCLUDE_DIRECTORIES ${INCLUDE_DIRS})
35+
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/ucrt)
36+
37+
add_definitions(
38+
-DUSE_WINE_TODOS
39+
-D_USE_MATH_DEFINES
40+
-DWINETEST_USE_DBGSTR_LONGLONG
41+
-D_finddata64_t=__finddata64_t
42+
)
43+
44+
list(APPEND SOURCE
45+
cpp.c
46+
environ.c
47+
file.c
48+
misc.c
49+
printf.c
50+
scanf.c
51+
string.c
52+
thread.c
53+
testlist.c
54+
ucrtbase_winetest.rc
55+
)
56+
57+
set_source_files_properties(ucrtbase_winetest.rc OBJECT_DEPENDS threaddll)
58+
59+
add_executable(ucrtbase_winetest ${SOURCE})
60+
if(NOT MSVC)
61+
#set_target_properties(ucrtbase_winetest PROPERTIES LINK_FLAGS "-Wl,--major-os-version,6")
62+
target_compile_options(ucrtbase_winetest PRIVATE -Wno-format)
63+
endif()
64+
set_module_type(ucrtbase_winetest win32cui)
65+
66+
target_link_libraries(ucrtbase_winetest wine oldnames ${PSEH_LIB} chkstk)
67+
if(NOT MSVC)
68+
# Add this manually here, so it can link to ucrtbase.dll and vcstartup
69+
target_link_libraries(ucrtbase_winetest -lgcc)
70+
endif()
71+
72+
add_importlibs(ucrtbase_winetest ucrtbase kernel32 ntdll)
73+
add_dependencies(ucrtbase_winetest threaddll)
74+
add_rostests_file(TARGET ucrtbase_winetest)

modules/rostests/winetests/ucrtbase/file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
#include <winbase.h>
3131
#include <winnls.h>
3232
#include "wine/test.h"
33+
#include <corecrt_io.h>
34+
35+
#define STDIN_FILENO 0
36+
#define STDOUT_FILENO 1
37+
#define STDERR_FILENO 2
3338

3439
static void test_std_stream_buffering(void)
3540
{
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Automatically generated file; DO NOT EDIT!! */
2+
3+
#define STANDALONE
4+
#include <wine/test.h>
5+
6+
extern void func_cpp(void);
7+
extern void func_environ(void);
8+
extern void func_file(void);
9+
extern void func_misc(void);
10+
extern void func_printf(void);
11+
extern void func_scanf(void);
12+
extern void func_string(void);
13+
extern void func_thread(void);
14+
15+
16+
const struct test winetest_testlist[] =
17+
{
18+
{ "cpp", func_cpp },
19+
{ "environ", func_environ },
20+
{ "file", func_file },
21+
{ "misc", func_misc },
22+
{ "printf", func_printf },
23+
{ "scanf", func_scanf },
24+
{ "string", func_string },
25+
{ "thread", func_thread },
26+
27+
{ 0, 0 }
28+
};

modules/rostests/winetests/ucrtbase/thread.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#include "threaddll.h"
2828

29+
typedef void (__cdecl *_beginthread_start_routine_t)(void *);
30+
typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
31+
2932
enum beginthread_method
3033
{
3134
use_beginthread,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
threaddll.dll TESTDLL "threaddll.dll"

0 commit comments

Comments
 (0)