diff --git a/modules/rostests/winetests/msvcrt/cpp.c b/modules/rostests/winetests/msvcrt/cpp.c index 22f59124e3d..cf5e4c7d60b 100644 --- a/modules/rostests/winetests/msvcrt/cpp.c +++ b/modules/rostests/winetests/msvcrt/cpp.c @@ -16,8 +16,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "precomp.h" +#include "wine/test.h" +#include "winbase.h" +#include "winnt.h" typedef void (*vtable_ptr)(void); diff --git a/modules/rostests/winetests/msvcrt/data.c b/modules/rostests/winetests/msvcrt/data.c index 724eb67c9b1..9aacac7b503 100644 --- a/modules/rostests/winetests/msvcrt/data.c +++ b/modules/rostests/winetests/msvcrt/data.c @@ -18,8 +18,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include "wine/test.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include void __cdecl __getmainargs(int *, char ***, char ***, int, int *); diff --git a/modules/rostests/winetests/msvcrt/dir.c b/modules/rostests/winetests/msvcrt/dir.c index ad96ae70b97..a29d32b9d39 100644 --- a/modules/rostests/winetests/msvcrt/dir.c +++ b/modules/rostests/winetests/msvcrt/dir.c @@ -18,12 +18,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include "wine/test.h" +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include static int (__cdecl *p_makepath_s)(char *, size_t, const char *, const char *, const char *, const char *); static int (__cdecl *p_wmakepath_s)(wchar_t *, size_t, const wchar_t *,const wchar_t *, const wchar_t *, const wchar_t *); +static int (__cdecl *p_searchenv_s)(const char*, const char*, char*, size_t); +static int (__cdecl *p_wsearchenv_s)(const wchar_t*, const wchar_t*, wchar_t*, size_t); static void init(void) { @@ -31,6 +44,8 @@ static void init(void) p_makepath_s = (void *)GetProcAddress(hmod, "_makepath_s"); p_wmakepath_s = (void *)GetProcAddress(hmod, "_wmakepath_s"); + p_searchenv_s = (void *)GetProcAddress(hmod, "_searchenv_s"); + p_wsearchenv_s = (void *)GetProcAddress(hmod, "_wsearchenv_s"); } typedef struct @@ -406,6 +421,195 @@ static void test_splitpath(void) _setmbcp(prev_cp); } +static void test_searchenv(void) +{ + const char *dirs[] = { + "\\search_env_test", + "\\search_env_test\\dir1", + "\\search_env_test\\dir2", + "\\search_env_test\\dir3longer" + }; + + const char *files[] = { + "\\search_env_test\\dir1\\1.dat", + "\\search_env_test\\dir1\\2.dat", + "\\search_env_test\\dir2\\1.dat", + "\\search_env_test\\dir2\\3.dat", + "\\search_env_test\\dir3longer\\3.dat" + }; + + const WCHAR env_w[] = {'T','E','S','T','_','P','A','T','H',0}; + const WCHAR dat1_w[] = {'1','.','d','a','t',0}; + const WCHAR dat3_w[] = {'3','.','d','a','t',0}; + + char env1[4*MAX_PATH], env2[4*MAX_PATH], tmppath[MAX_PATH], path[2*MAX_PATH]; + char result[MAX_PATH], exp[2*MAX_PATH]; + WCHAR result_w[MAX_PATH]; + int i, path_len; + FILE *tmp_file; + + if (getenv("TEST_PATH")) { + skip("TEST_PATH environment variable already set\n"); + return; + } + + path_len = GetTempPathA(MAX_PATH, tmppath); + ok(path_len, "GetTempPath failed\n"); + memcpy(path, tmppath, path_len); + + for(i=0; i=0; i--) { + strcpy(path+path_len, dirs[i]); + ok(!rmdir(path), "rmdir failed (dir = %s)\n", path); + } +} + START_TEST(dir) { init(); @@ -414,4 +618,5 @@ START_TEST(dir) test_makepath(); test_makepath_s(); test_splitpath(); + test_searchenv(); } diff --git a/modules/rostests/winetests/msvcrt/environ.c b/modules/rostests/winetests/msvcrt/environ.c index d74922fbba1..fdfe81f5eec 100644 --- a/modules/rostests/winetests/msvcrt/environ.c +++ b/modules/rostests/winetests/msvcrt/environ.c @@ -18,7 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "wine/test.h" +#include static const char *a_very_long_env_string = "LIBRARY_PATH=" diff --git a/modules/rostests/winetests/msvcrt/file.c b/modules/rostests/winetests/msvcrt/file.c index d27e0d49f7c..136ee1563e6 100644 --- a/modules/rostests/winetests/msvcrt/file.c +++ b/modules/rostests/winetests/msvcrt/file.c @@ -19,13 +19,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - -#include +#include "wine/test.h" +#include +#include +#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #define MSVCRT_FD_BLOCK_SIZE 32 typedef struct { diff --git a/modules/rostests/winetests/msvcrt/headers.c b/modules/rostests/winetests/msvcrt/headers.c index 6a5660f7d80..52d739e1078 100644 --- a/modules/rostests/winetests/msvcrt/headers.c +++ b/modules/rostests/winetests/msvcrt/headers.c @@ -20,7 +20,39 @@ * symbols defined in msvcrt.h (prefixed by MSVCRT_). */ -#include "precomp.h" +#include "dos.h" +#include "math.h" +#include "stdlib.h" +#include "io.h" +#include "errno.h" +#include "fcntl.h" +#include "malloc.h" +#include "limits.h" +#include "mbctype.h" +#include "stdio.h" +#include "wchar.h" +#include "ctype.h" +#include "crtdbg.h" +#include "share.h" +#include "search.h" +#include "wctype.h" +#include "float.h" +#include "stddef.h" +#include "mbstring.h" +#include "sys/locking.h" +#include "sys/utime.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "sys/timeb.h" +#include "direct.h" +#include "conio.h" +#include "process.h" +#include "string.h" +#include "signal.h" +#include "time.h" +#include "locale.h" +#include "setjmp.h" +#include "wine/test.h" #ifdef __WINE_USE_MSVCRT /* Wine-specific msvcrt headers */ diff --git a/modules/rostests/winetests/msvcrt/heap.c b/modules/rostests/winetests/msvcrt/heap.c index e7fa3ecf13d..4a3c7a81700 100644 --- a/modules/rostests/winetests/msvcrt/heap.c +++ b/modules/rostests/winetests/msvcrt/heap.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include #include +#include +#include "wine/test.h" static void (__cdecl *p_aligned_free)(void*) = NULL; static void * (__cdecl *p_aligned_malloc)(size_t,size_t) = NULL; diff --git a/modules/rostests/winetests/msvcrt/locale.c b/modules/rostests/winetests/msvcrt/locale.c index 195b7738ae7..f87a7914d0e 100644 --- a/modules/rostests/winetests/msvcrt/locale.c +++ b/modules/rostests/winetests/msvcrt/locale.c @@ -18,7 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include + +#include "wine/test.h" +#include "winnls.h" static BOOL (__cdecl *p__crtGetStringTypeW)(DWORD, DWORD, const wchar_t*, int, WORD*); static int (__cdecl *pmemcpy_s)(void *, size_t, void*, size_t); diff --git a/modules/rostests/winetests/msvcrt/misc.c b/modules/rostests/winetests/msvcrt/misc.c index d64cfe86ccc..20253342d97 100644 --- a/modules/rostests/winetests/msvcrt/misc.c +++ b/modules/rostests/winetests/msvcrt/misc.c @@ -18,15 +18,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - -#include +#include "wine/test.h" +#include +#include +#include +#include "msvcrt.h" +#include static inline float __port_infinity(void) { static const unsigned __inf_bytes = 0x7f800000; return *(const float *)&__inf_bytes; } +#ifdef __REACTOS__ +#undef INFINITY +#endif #define INFINITY __port_infinity() static inline float __port_nan(void) @@ -34,6 +40,9 @@ static inline float __port_nan(void) static const unsigned __nan_bytes = 0x7fc00000; return *(const float *)&__nan_bytes; } +#ifdef __REACTOS__ +#undef NAN +#endif #define NAN __port_nan() static inline BOOL almost_equal(double d1, double d2) { diff --git a/modules/rostests/winetests/msvcrt/precomp.h b/modules/rostests/winetests/msvcrt/precomp.h index 6cc0b62bc32..63a519d703c 100644 --- a/modules/rostests/winetests/msvcrt/precomp.h +++ b/modules/rostests/winetests/msvcrt/precomp.h @@ -1,9 +1,11 @@ + #ifndef _MSVCRT_WINETEST_PRECOMP_H_ #define _MSVCRT_WINETEST_PRECOMP_H_ #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H + #define _CRT_NON_CONFORMING_SWPRINTFS #include diff --git a/modules/rostests/winetests/msvcrt/printf.c b/modules/rostests/winetests/msvcrt/printf.c index 43b2ec3dda1..64658ce25fb 100644 --- a/modules/rostests/winetests/msvcrt/printf.c +++ b/modules/rostests/winetests/msvcrt/printf.c @@ -23,8 +23,17 @@ /* With Visual Studio >= 2005, swprintf() takes an extra parameter unless * the following macro is defined. */ +#define _CRT_NON_CONFORMING_SWPRINTFS + +#include +#include +#include -#include "precomp.h" +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + +#include "wine/test.h" static inline float __port_infinity(void) { diff --git a/modules/rostests/winetests/msvcrt/scanf.c b/modules/rostests/winetests/msvcrt/scanf.c index d25bee6a003..359b07937ae 100644 --- a/modules/rostests/winetests/msvcrt/scanf.c +++ b/modules/rostests/winetests/msvcrt/scanf.c @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include + +#include "wine/test.h" static void test_sscanf( void ) { diff --git a/modules/rostests/winetests/msvcrt/signal.c b/modules/rostests/winetests/msvcrt/signal.c index 5947889841c..ad6ea6ecf90 100644 --- a/modules/rostests/winetests/msvcrt/signal.c +++ b/modules/rostests/winetests/msvcrt/signal.c @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include "wine/test.h" +#include #include static int test_value = 0; diff --git a/modules/rostests/winetests/msvcrt/string.c b/modules/rostests/winetests/msvcrt/string.c index 4fc34ebfc41..b2703665992 100644 --- a/modules/rostests/winetests/msvcrt/string.c +++ b/modules/rostests/winetests/msvcrt/string.c @@ -18,13 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include "wine/test.h" +#include #include #include +#include +#include #include +#include +#include +#include #include +/* make it use a definition from string.h */ +#undef strncpy +#include "winbase.h" +#include "winnls.h" + static char *buf_to_string(const unsigned char *bin, int len, int nr) { static char buf[2][1024]; diff --git a/modules/rostests/winetests/msvcrt/time.c b/modules/rostests/winetests/msvcrt/time.c index 176ead348e8..a5a2df18bba 100644 --- a/modules/rostests/winetests/msvcrt/time.c +++ b/modules/rostests/winetests/msvcrt/time.c @@ -18,9 +18,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "wine/test.h" +#include "winbase.h" +#include "winnls.h" +#include "time.h" -#include +#include /*setenv*/ +#include /*printf*/ +#include +#include #define _MAX__TIME64_T (((__time64_t)0x00000007 << 32) | 0x93406FFF)