Commit f377e4be authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Move invalid parameter tests to msvcr90.

parent a2344e72
...@@ -35,6 +35,8 @@ static int *p_sys_nerr; ...@@ -35,6 +35,8 @@ static int *p_sys_nerr;
static int* (__cdecl *p__sys_nerr)(void); static int* (__cdecl *p__sys_nerr)(void);
static char **p_sys_errlist; static char **p_sys_errlist;
static char** (__cdecl *p__sys_errlist)(void); static char** (__cdecl *p__sys_errlist)(void);
static __int64 (__cdecl *p_strtoi64)(const char *, char **, int);
static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int);
int cb_called[4]; int cb_called[4];
...@@ -193,6 +195,37 @@ static void test_error_messages(void) ...@@ -193,6 +195,37 @@ static void test_error_messages(void)
ok(*p_sys_errlist == *(p__sys_errlist()), "p_sys_errlist != p__sys_errlist()\n"); ok(*p_sys_errlist == *(p__sys_errlist()), "p_sys_errlist != p__sys_errlist()\n");
} }
static void test__strtoi64(void)
{
__int64 res;
unsigned __int64 ures;
if(!p_strtoi64 || !p_strtoui64) {
win_skip("_strtoi64 or _strtoui64 not found\n");
return;
}
if(!p_set_invalid_parameter_handler) {
win_skip("_set_invalid_parameter_handler not found\n");
return;
}
errno = 0xdeadbeef;
res = p_strtoi64(NULL, NULL, 10);
ok(res == 0, "res != 0\n");
res = p_strtoi64("123", NULL, 1);
ok(res == 0, "res != 0\n");
res = p_strtoi64("123", NULL, 37);
ok(res == 0, "res != 0\n");
ures = p_strtoui64(NULL, NULL, 10);
ok(ures == 0, "res = %d\n", (int)ures);
ures = p_strtoui64("123", NULL, 1);
ok(ures == 0, "res = %d\n", (int)ures);
ures = p_strtoui64("123", NULL, 37);
ok(ures == 0, "res = %d\n", (int)ures);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
}
/* ########## */ /* ########## */
START_TEST(msvcr90) START_TEST(msvcr90)
...@@ -219,8 +252,11 @@ START_TEST(msvcr90) ...@@ -219,8 +252,11 @@ START_TEST(msvcr90)
p__sys_nerr = (void *) GetProcAddress(hcrt, "__sys_nerr"); p__sys_nerr = (void *) GetProcAddress(hcrt, "__sys_nerr");
p_sys_errlist = (void *) GetProcAddress(hcrt, "_sys_errlist"); p_sys_errlist = (void *) GetProcAddress(hcrt, "_sys_errlist");
p__sys_errlist = (void *) GetProcAddress(hcrt, "__sys_errlist"); p__sys_errlist = (void *) GetProcAddress(hcrt, "__sys_errlist");
p_strtoi64 = (void *) GetProcAddress(hcrt, "_strtoi64");
p_strtoui64 = (void *) GetProcAddress(hcrt, "_strtoui64");
test__initterm_e(); test__initterm_e();
test__encode_pointer(); test__encode_pointer();
test_error_messages(); test_error_messages();
test__strtoi64();
} }
...@@ -56,7 +56,6 @@ static int (__cdecl *p_wcsupr_s)(wchar_t *str, size_t size); ...@@ -56,7 +56,6 @@ static int (__cdecl *p_wcsupr_s)(wchar_t *str, size_t size);
static size_t (__cdecl *p_strnlen)(const char *, size_t); static size_t (__cdecl *p_strnlen)(const char *, size_t);
static __int64 (__cdecl *p_strtoi64)(const char *, char **, int); static __int64 (__cdecl *p_strtoi64)(const char *, char **, int);
static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int); static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int);
static _invalid_parameter_handler *p_invalid_parameter;
static int *p__mb_cur_max; static int *p__mb_cur_max;
static unsigned char *p_mbctype; static unsigned char *p_mbctype;
...@@ -65,17 +64,6 @@ static unsigned char *p_mbctype; ...@@ -65,17 +64,6 @@ static unsigned char *p_mbctype;
HMODULE hMsvcrt; HMODULE hMsvcrt;
void __cdecl test_invalid_parameter_handler(const wchar_t *expression,
const wchar_t *function, const wchar_t *file,
unsigned line, unsigned *res)
{
ok(expression == NULL, "expression is not NULL\n");
ok(function == NULL, "function is not NULL\n");
ok(file == NULL, "file is not NULL\n");
ok(line == 0, "line = %u\n", line);
ok(res == NULL, "res = %p\n", res);
}
static void test_swab( void ) { static void test_swab( void ) {
char original[] = "BADCFEHGJILKNMPORQTSVUXWZY@#"; char original[] = "BADCFEHGJILKNMPORQTSVUXWZY@#";
char expected1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@#"; char expected1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@#";
...@@ -968,23 +956,6 @@ static void test__strtoi64(void) ...@@ -968,23 +956,6 @@ static void test__strtoi64(void)
return; return;
} }
if(p_invalid_parameter) {
errno = 0xdeadbeef;
res = p_strtoi64(NULL, NULL, 10);
ok(res == 0, "res != 0\n");
res = p_strtoi64(no1, NULL, 1);
ok(res == 0, "res != 0\n");
res = p_strtoi64(no1, NULL, 37);
ok(res == 0, "res != 0\n");
ures = p_strtoui64(NULL, NULL, 10);
ok(ures == 0, "res = %d\n", (int)ures);
ures = p_strtoui64(no1, NULL, 1);
ok(ures == 0, "res = %d\n", (int)ures);
ures = p_strtoui64(no1, NULL, 37);
ok(ures == 0, "res = %d\n", (int)ures);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
}
errno = 0xdeadbeef; errno = 0xdeadbeef;
res = p_strtoi64(no1, NULL, 10); res = p_strtoi64(no1, NULL, 10);
ok(res == 31923, "res != 31923\n"); ok(res == 31923, "res != 31923\n");
...@@ -1123,9 +1094,6 @@ START_TEST(string) ...@@ -1123,9 +1094,6 @@ START_TEST(string)
SET(pmemcmp,"memcmp"); SET(pmemcmp,"memcmp");
SET(p_mbctype,"_mbctype"); SET(p_mbctype,"_mbctype");
SET(p__mb_cur_max,"__mb_cur_max"); SET(p__mb_cur_max,"__mb_cur_max");
p_invalid_parameter = (void *)GetProcAddress( hMsvcrt,"_invalid_parameter");
if(p_invalid_parameter)
*p_invalid_parameter = test_invalid_parameter_handler;
pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" ); pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" );
pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" ); pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" ); p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment