Author: akhaldi
Date: Mon Nov 23 17:47:51 2015
New Revision: 70071
URL:
http://svn.reactos.org/svn/reactos?rev=70071&view=rev
Log:
[MSVCRT_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
Modified:
trunk/rostests/winetests/msvcrt/data.c
trunk/rostests/winetests/msvcrt/file.c
trunk/rostests/winetests/msvcrt/locale.c
trunk/rostests/winetests/msvcrt/printf.c
trunk/rostests/winetests/msvcrt/string.c
trunk/rostests/winetests/msvcrt/time.c
Modified: trunk/rostests/winetests/msvcrt/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/data.c?r…
==============================================================================
--- trunk/rostests/winetests/msvcrt/data.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/data.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -111,7 +111,7 @@
"Wrong value for _osver %04x expected %04x\n",
osver, osvi.dwBuildNumber);
ok(osplatform == osvi.dwPlatformId,
- "Wrong value for _osplatform %x exprected %x\n",
+ "Wrong value for _osplatform %x expected %x\n",
osplatform, osvi.dwPlatformId);
}
@@ -152,7 +152,7 @@
new_argc = *p___p___argc();
new_argv = *p___p___argv();
ok(new_argc == 4, "*__p___argc() = %d\n", new_argc);
- ok(new_argv == argv, "*__p___argv() = %p, epxected %p\n", new_argv,
argv);
+ ok(new_argv == argv, "*__p___argv() = %p, expected %p\n", new_argv,
argv);
}else {
win_skip("__p___argc or __p___argv is not available\n");
}
@@ -179,7 +179,7 @@
new_argc = *p___p___argc();
new_argv = *p___p___argv();
ok(new_argc == argc, "*__p___argc() = %d, expected %d\n", new_argc,
argc);
- ok(new_argv == argv, "*__p___argv() = %p, epxected %p\n", new_argv,
argv);
+ ok(new_argv == argv, "*__p___argv() = %p, expected %p\n", new_argv,
argv);
}
sprintf(filepath, "%swine_test/b", tmppath);
Modified: trunk/rostests/winetests/msvcrt/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/file.c?r…
==============================================================================
--- trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -1350,6 +1350,55 @@
"Wrong write result in child process on %d (%s)\n", fd,
strerror(errno));
}
+static void test_file_refcount_child(void)
+{
+ static const char buffer1[] = "test1";
+ static const char buffer2[] = "test2";
+ static const char buffer3[] = "test3";
+ static const char buffer4[] = "test4";
+ HANDLE f0, f1, f2, h0, h1, h2;
+ DWORD written, flags, ret;
+
+ f0 = (HANDLE)_get_osfhandle(STDIN_FILENO);
+ f1 = (HANDLE)_get_osfhandle(STDOUT_FILENO);
+ f2 = (HANDLE)_get_osfhandle(STDERR_FILENO);
+ ok(f0 == f1, "expected same handles, got %p, %p\n", f0, f1);
+ ok(f1 == f2, "expected same handles, got %p, %p\n", f1, f2);
+
+ h0 = GetStdHandle(STD_INPUT_HANDLE);
+ h1 = GetStdHandle(STD_OUTPUT_HANDLE);
+ h2 = GetStdHandle(STD_ERROR_HANDLE);
+ ok(h0 == h1, "expected same handles, got %p, %p\n", h0, h1);
+ ok(h1 == h2, "expected same handles, got %p, %p\n", h1, h2);
+ ok(f0 == h0, "expected same handles, got %p, %p\n", f0, h0);
+
+ ret = GetHandleInformation(h1, &flags);
+ ok(ret, "GetHandleInformation failed\n");
+ ret = WriteFile(h1, buffer1, strlen(buffer1), &written, 0);
+ ok(ret, "WriteFile failed\n");
+
+ ret = fclose(stdout);
+ ok(ret == 0, "fclose failed\n");
+ ret = GetHandleInformation(h1, &flags);
+ ok(ret, "GetHandleInformation failed\n");
+ ret = WriteFile(h1, buffer2, strlen(buffer2), &written, 0);
+ ok(ret, "WriteFile failed\n");
+
+ ret = fclose(stdout);
+ ok(ret != 0, "fclose should fail\n");
+ ret = GetHandleInformation(h1, &flags);
+ ok(ret, "GetHandleInformation failed\n");
+ ret = WriteFile(h1, buffer3, strlen(buffer3), &written, 0);
+ ok(ret, "WriteFile failed\n");
+
+ ret = fclose(stderr);
+ ok(ret == 0, "fclose failed\n");
+ ret = GetHandleInformation(h1, &flags);
+ ok(!ret, "GetHandleInformation should fail\n");
+ ret = WriteFile(h1, buffer4, strlen(buffer4), &written, 0);
+ ok(!ret, "WriteFile should fail\n");
+}
+
static void create_io_inherit_block( STARTUPINFOA *startup, unsigned int count, const
HANDLE *handles )
{
static BYTE block[1024];
@@ -1421,6 +1470,36 @@
CloseHandle( hErrorFile );
DeleteFileA( "fdopen.err" );
+}
+
+static void test_file_refcount( STARTUPINFOA *startup, char *cmdline, const char *descr
)
+{
+ const char *data;
+ HANDLE hMixFile;
+ SECURITY_ATTRIBUTES sa;
+ PROCESS_INFORMATION proc;
+
+ /* make file handle inheritable */
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+
+ hMixFile = CreateFileA( "fdopen.mix", GENERIC_READ|GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, CREATE_ALWAYS,
0, NULL );
+ startup->dwFlags = STARTF_USESTDHANDLES;
+ startup->hStdInput = hMixFile;
+ startup->hStdOutput = hMixFile;
+ startup->hStdError = hMixFile;
+
+ CreateProcessA( NULL, cmdline, NULL, NULL, TRUE,
+ CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, NULL, NULL,
startup, &proc );
+ winetest_wait_child_process( proc.hProcess );
+
+ data = read_file( hMixFile );
+ ok( !strcmp( data, "test1test2test3" ), "%s: Wrong error data
(%s)\n", descr, data );
+
+ CloseHandle( hMixFile );
+ DeleteFileA( "fdopen.mix" );
}
static void test_file_inherit( const char* selfname )
@@ -1516,6 +1595,12 @@
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "large size
block" );
CloseHandle( handles[1] );
DeleteFileA("fdopen.tst");
+
+ /* test refcount of handles */
+ create_io_inherit_block( &startup, 0, NULL );
+ sprintf(cmdline, "%s file refcount", selfname);
+ test_file_refcount( &startup, cmdline, "file refcount" );
+ DeleteFileA("fdopen.tst");
}
static void test_tmpnam( void )
@@ -1789,6 +1874,16 @@
return;
}
+ errno = 0xdeadbeef;
+ ret = _setmode(-2, 0);
+ ok(ret == -1, "_setmode returned %x, expected -1\n", ret);
+ ok(errno == EINVAL, "errno = %d\n", errno);
+
+ errno = 0xdeadbeef;
+ ret = _setmode(-2, _O_TEXT);
+ ok(ret == -1, "_setmode returned %x, expected -1\n", ret);
+ ok(errno == EBADF, "errno = %d\n", errno);
+
fd = _open(name, _O_CREAT|_O_WRONLY, _S_IWRITE);
ok(fd != -1, "failed to open file\n");
@@ -1850,6 +1945,11 @@
_close(fd);
_unlink(fname);
+
+ errno = 0xdeadbeef;
+ handle = (HANDLE)_get_osfhandle(fd);
+ ok(handle == INVALID_HANDLE_VALUE, "_get_osfhandle returned %p\n",
handle);
+ ok(errno == EBADF, "errno = %d\n", errno);
}
static void test_setmaxstdio(void)
@@ -2330,6 +2430,8 @@
test_file_inherit_child_no(arg_v[3]);
else if (strcmp(arg_v[2], "pipes") == 0)
test_pipes_child(arg_c, arg_v);
+ else if (strcmp(arg_v[2], "refcount") == 0)
+ test_file_refcount_child();
else
ok(0, "invalid argument '%s'\n", arg_v[2]);
return;
Modified: trunk/rostests/winetests/msvcrt/locale.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/locale.c…
==============================================================================
--- trunk/rostests/winetests/msvcrt/locale.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/locale.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -676,9 +676,9 @@
* Unicode strings are only initialized on Windows 7
*/
if(sizeof(void*) == 8)
- ok(size==0x2c0 || broken(size==0x170), "strucure size: %x\n", size);
+ ok(size==0x2c0 || broken(size==0x170), "structure size: %x\n", size);
else
- ok(size==0x164 || broken(size==0xb8), "strucure size: %x\n", size);
+ ok(size==0x164 || broken(size==0xb8), "structure size: %x\n", size);
ok(!strcmp(ret->str[0], "Sun"), "ret->str[0] = %s\n",
ret->str[0]);
ok(!strcmp(ret->str[1], "Mon"), "ret->str[1] = %s\n",
ret->str[1]);
Modified: trunk/rostests/winetests/msvcrt/printf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/printf.c…
==============================================================================
--- trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -321,6 +321,11 @@
ok(!strcmp(buffer,"D"),"I64D failed: %s\n",buffer);
ok( r==1, "return count wrong\n");
+ format = "%zx";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer, "zx"), "Problem with \"z\"
interpretation\n");
+ ok( r==2, "return count wrong\n");
+
format = "% d";
r = sprintf(buffer,format,1);
ok(!strcmp(buffer, " 1"),"Problem with sign place-holder:
'%s'\n",buffer);
@@ -413,10 +418,20 @@
ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted
incorrectly \"%s\"\n",buffer);
ok( r==16, "return count wrong\n");
+ format = "%Np";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted
incorrectly \"%s\"\n",buffer);
+ ok( r==16, "return count wrong\n");
+
format = "%#-020p";
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X0000000000000039 "),"Pointer formatted
incorrectly\n");
ok( r==20, "return count wrong\n");
+
+ format = "%Ix %d";
+ r = sprintf(buffer,format,(size_t)0x12345678123456,1);
+ ok(!strcmp(buffer,"12345678123456 1"),"buffer =
%s\n",buffer);
+ ok( r==16, "return count wrong\n");
}
else
{
@@ -435,10 +450,20 @@
ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
ok( r==8, "return count wrong\n");
+ format = "%Np";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
+
format = "%#-012p";
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted
incorrectly\n");
ok( r==12, "return count wrong\n");
+
+ format = "%Ix %d";
+ r = sprintf(buffer,format,0x123456,1);
+ ok(!strcmp(buffer,"123456 1"),"buffer = %s\n",buffer);
+ ok( r==8, "return count wrong\n");
}
format = "%04s";
@@ -666,6 +691,11 @@
ok( r==1, "return count wrong\n");
format = "%F";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
+ format = "%N";
r = sprintf(buffer, format,-1);
ok(!strcmp(buffer,""), "failed\n");
ok( r==0, "return count wrong\n");
@@ -787,7 +817,7 @@
fmt, expect, n);
ok (!memcmp (fmt, buffer, valid),
"\"%s\": rendered \"%.*s\"\n", fmt, valid,
buffer);
- };
+ }
}
static void test_fprintf(void)
Modified: trunk/rostests/winetests/msvcrt/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/string.c…
==============================================================================
--- trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -58,6 +58,7 @@
static int* (__cdecl *pmemcmp)(void *, const void *, size_t n);
static int (__cdecl *pstrcpy_s)(char *dst, size_t len, const char *src);
static int (__cdecl *pstrcat_s)(char *dst, size_t len, const char *src);
+static int (__cdecl *p_mbscat_s)(unsigned char *dst, size_t size, const unsigned char
*src);
static int (__cdecl *p_mbsnbcat_s)(unsigned char *dst, size_t size, const unsigned char
*src, size_t count);
static int (__cdecl *p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char
* src, size_t count);
static int (__cdecl *p__mbscpy_s)(unsigned char*, size_t, const unsigned char*);
@@ -732,6 +733,86 @@
ok(ret == EINVAL, "strcat_s: Writing to a NULL string returned %d, expected
EINVAL\n", ret);
}
+static void test__mbscat_s(void)
+{
+ unsigned char dst[8], src[4];
+ int err;
+ int prev_cp = _getmbcp();
+
+ if(!p_mbscat_s)
+ {
+ win_skip("_mbscat_s not found\n");
+ return;
+ }
+
+
+ src[0] = dst[0] = 0;
+ err = p_mbscat_s(NULL, sizeof(dst), src);
+ ok(err == EINVAL, "_mbscat_s returned %d\n", err);
+
+ err = p_mbscat_s(dst, sizeof(dst), NULL);
+ ok(err == EINVAL, "_mbscat_s returned %d\n", err);
+
+ dst[0] = 'a';
+ err = p_mbscat_s(dst, 1, src);
+ ok(err == EINVAL, "_mbscat_s returned %d\n", err);
+
+ memset(dst, 'a', sizeof(dst));
+ dst[6] = 0;
+ src[0] = 'b';
+ src[1] = 0;
+
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == 0, "_mbscat_s returned %d\n", err);
+ ok(!memcmp(dst, "aaaaaab", 8), "dst = %s\n", dst);
+
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == ERANGE, "_mbscat_s returned %d\n", err);
+ ok(!dst[0], "dst[0] = %c\n", dst[0]);
+ ok(dst[1] == 'a', "dst[1] = %c\n", dst[1]);
+
+ _setmbcp(932);
+ /* test invalid str in dst */
+ dst[0] = 0x81;
+ dst[1] = 0x81;
+ dst[2] = 0x52;
+ dst[3] = 0;
+ src[0] = 'a';
+ src[1] = 0;
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == 0, "_mbscat_s returned %d\n", err);
+
+ /* test invalid str in src */
+ dst[0] = 0;
+ src[0] = 0x81;
+ src[1] = 0x81;
+ src[2] = 0x52;
+ src[3] = 0;
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == 0, "_mbscat_s returned %d\n", err);
+
+ /* test dst with leading byte on the end of buffer */
+ dst[0] = 'a';
+ dst[1] = 0x81;
+ dst[2] = 0;
+ src[0] = 'R';
+ src[1] = 0;
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == EILSEQ, "_mbscat_s returned %d\n", err);
+ ok(!memcmp(dst, "aR", 3), "dst = %s\n", dst);
+
+ /* test src with leading byte on the end of buffer */
+ dst[0] = 'a';
+ dst[1] = 0;
+ src[0] = 'b';
+ src[1] = 0x81;
+ src[2] = 0;
+ err = p_mbscat_s(dst, sizeof(dst), src);
+ ok(err == EILSEQ, "_mbscat_s returned %d\n", err);
+ ok(!memcmp(dst, "ab", 3), "dst = %s\n", dst);
+ _setmbcp(prev_cp);
+}
+
static void test__mbsnbcpy_s(void)
{
unsigned char dest[8];
@@ -1027,7 +1108,7 @@
/* Test NULL input string and valid size. */
errno = EBADF;
- ret = p_wcslwr_s(NULL, sizeof(buffer)/sizeof(wchar_t));
+ ret = p_wcslwr_s(NULL, sizeof(buffer)/sizeof(buffer[0]));
ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
ok(errno == EINVAL, "expected errno EINVAL, got %d\n", errno);
@@ -1403,6 +1484,8 @@
static void test_strtol(void)
{
+ static char neg[] = "-0x";
+
char* e;
LONG l;
ULONG ul;
@@ -1459,6 +1542,12 @@
ul = strtoul("-4294967296", NULL, 0);
ok(ul == 1, "wrong value %u\n", ul);
ok(errno == ERANGE, "wrong errno %d\n", errno);
+
+ errno = 0;
+ l = strtol(neg, &e, 0);
+ ok(l == 0, "wrong value %d\n", l);
+ ok(errno == 0, "wrong errno %d\n", errno);
+ ok(e == neg, "e = %p, neg = %p\n", e, neg);
}
static void test_strnlen(void)
@@ -1639,6 +1728,7 @@
const char double3[] = "INF";
const char double4[] = ".21e12";
const char double5[] = "214353e-3";
+ const char double6[] = "NAN";
const char overflow[] = "1d9999999999999999999";
const char white_chars[] = " d10";
@@ -1664,6 +1754,10 @@
d = strtod(double5, &end);
ok(almost_equal(d, 214.353), "d = %lf\n", d);
ok(end == double5+9, "incorrect end (%d)\n", (int)(end-double5));
+
+ d = strtod(double6, &end);
+ ok(almost_equal(d, 0), "d = %lf\n", d);
+ ok(end == double6, "incorrect end (%d)\n", (int)(end-double6));
d = strtod("12.1d2", NULL);
ok(almost_equal(d, 12.1e2), "d = %lf\n", d);
@@ -1678,7 +1772,7 @@
{
errno = EBADF;
d = strtod(NULL, NULL);
- ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
ok(errno == EINVAL, "errno = %x\n", errno);
errno = EBADF;
@@ -2514,6 +2608,7 @@
static void test_tolower(void)
{
+ WCHAR chw, lower;
char ch, lch;
int ret, len;
@@ -2544,7 +2639,10 @@
ch = 0xF4;
errno = 0xdeadbeef;
ret = p_tolower(ch);
- len = LCMapStringA(0, LCMAP_LOWERCASE, &ch, 1, &lch, 1);
+ if(!MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, &ch, 1, &chw, 1) ||
+ LCMapStringW(CP_ACP, LCMAP_LOWERCASE, &chw, 1, &lower, 1) != 1 ||
+ (len = WideCharToMultiByte(CP_ACP, 0, &lower, 1, &lch, 1, NULL,
NULL)) != 1)
+ len = 0;
if(len)
ok(ret==(unsigned char)lch || broken(ret==ch)/*WinXP-*/, "ret = %x\n",
ret);
else
@@ -2555,7 +2653,10 @@
ch = 0xD0;
errno = 0xdeadbeef;
ret = p_tolower(ch);
- len = LCMapStringA(0, LCMAP_LOWERCASE, &ch, 1, &lch, 1);
+ if(!MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, &ch, 1, &chw, 1) ||
+ LCMapStringW(CP_ACP, LCMAP_LOWERCASE, &chw, 1, &lower, 1) != 1 ||
+ (len = WideCharToMultiByte(CP_ACP, 0, &lower, 1, &lch, 1, NULL,
NULL)) != 1)
+ len = 0;
if(len)
ok(ret==(unsigned char)lch || broken(ret==ch)/*WinXP-*/, "ret = %x\n",
ret);
else
@@ -2976,6 +3077,7 @@
SET(p__mb_cur_max,"__mb_cur_max");
pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" );
pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
+ p_mbscat_s = (void*)GetProcAddress( hMsvcrt, "_mbscat_s" );
p_mbsnbcat_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcat_s" );
p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
p__mbscpy_s = (void *)GetProcAddress( hMsvcrt,"_mbscpy_s" );
@@ -3029,6 +3131,7 @@
test_memcpy_s();
test_memmove_s();
test_strcat_s();
+ test__mbscat_s();
test__mbsnbcpy_s();
test__mbscpy_s();
test_mbcjisjms();
Modified: trunk/rostests/winetests/msvcrt/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/time.c?r…
==============================================================================
--- trunk/rostests/winetests/msvcrt/time.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/time.c [iso-8859-1] Mon Nov 23 17:47:51 2015
@@ -763,12 +763,12 @@
gmt = 0;
gmt_tm = p_gmtime(&gmt);
ret = p_asctime(gmt_tm);
- ok(!strcmp(ret, "Thu Jan 01 00:00:00 1970\n"), "asctime retunred
%s\n", ret);
+ ok(!strcmp(ret, "Thu Jan 01 00:00:00 1970\n"), "asctime returned
%s\n", ret);
gmt = 312433121;
gmt_tm = p_gmtime(&gmt);
ret = p_asctime(gmt_tm);
- ok(!strcmp(ret, "Mon Nov 26 02:58:41 1979\n"), "asctime retunred
%s\n", ret);
+ ok(!strcmp(ret, "Mon Nov 26 02:58:41 1979\n"), "asctime returned
%s\n", ret);
/* Week day is only checked if it's in 0..6 range */
gmt_tm->tm_wday = 3;