msvcrt/tests: Enable compilation with -D__WINESRC__.

This commit is contained in:
Nikolay Sivov 2013-11-05 08:30:56 +04:00 committed by Alexandre Julliard
parent 2fa9b7ebb5
commit 1f8636c5af
6 changed files with 39 additions and 37 deletions

View File

@ -2,7 +2,6 @@ TESTDLL = msvcrt.dll
APPMODE = -mno-cygwin
MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(top_srcdir)/include/msvcrt -I$(srcdir)/..
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \
cpp.c \

View File

@ -76,7 +76,7 @@ static void test_initterm(void)
static void test_initvar( HMODULE hmsvcrt )
{
OSVERSIONINFO osvi = { sizeof(OSVERSIONINFO) };
OSVERSIONINFOA osvi = { sizeof(OSVERSIONINFOA) };
int *pp_winver = (int*)GetProcAddress(hmsvcrt, "_winver");
int *pp_winmajor = (int*)GetProcAddress(hmsvcrt, "_winmajor");
int *pp_winminor = (int*)GetProcAddress(hmsvcrt, "_winminor");
@ -91,7 +91,7 @@ static void test_initvar( HMODULE hmsvcrt )
winver = *pp_winver;
winminor = *pp_winminor;
winmajor = *pp_winmajor;
GetVersionEx( &osvi);
GetVersionExA( &osvi);
ok( winminor == osvi.dwMinorVersion, "Wrong value for _winminor %02x expected %02x\n",
winminor, osvi.dwMinorVersion);
ok( winmajor == osvi.dwMajorVersion, "Wrong value for _winmajor %02x expected %02x\n",
@ -196,7 +196,7 @@ static void test___getmainargs_parent(char *name)
{
char cmdline[3*MAX_PATH];
char tmppath[MAX_PATH], filepath[MAX_PATH];
STARTUPINFO startup;
STARTUPINFOA startup;
PROCESS_INFORMATION proc;
FILE *f;
int ret;

View File

@ -345,28 +345,28 @@ static void test_fullpath(void)
BOOL rc,free1,free2;
free1=free2=TRUE;
GetCurrentDirectory(MAX_PATH, prevpath);
GetTempPath(MAX_PATH,tmppath);
GetCurrentDirectoryA(MAX_PATH, prevpath);
GetTempPathA(MAX_PATH,tmppath);
strcpy(level1,tmppath);
strcat(level1,"msvcrt-test\\");
rc = CreateDirectory(level1,NULL);
rc = CreateDirectoryA(level1,NULL);
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
free1=FALSE;
strcpy(level2,level1);
strcat(level2,"nextlevel\\");
rc = CreateDirectory(level2,NULL);
rc = CreateDirectoryA(level2,NULL);
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
free2=FALSE;
SetCurrentDirectory(level2);
SetCurrentDirectoryA(level2);
ok(_fullpath(full,"test", MAX_PATH)!=NULL,"_fullpath failed\n");
strcpy(teststring,level2);
strcat(teststring,"test");
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
ok(_fullpath(full,"\\test", MAX_PATH)!=NULL,"_fullpath failed\n");
strncpy(teststring,level2,3);
memcpy(teststring,level2,3);
teststring[3]=0;
strcat(teststring,"test");
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
@ -383,11 +383,11 @@ static void test_fullpath(void)
ok(strcmp(freeme,teststring)==0,"Invalid Path returned %s\n",freeme);
free(freeme);
SetCurrentDirectory(prevpath);
SetCurrentDirectoryA(prevpath);
if (free2)
RemoveDirectory(level2);
RemoveDirectoryA(level2);
if (free1)
RemoveDirectory(level1);
RemoveDirectoryA(level1);
}
START_TEST(dir)

View File

@ -446,11 +446,11 @@ static void test_filemodeT(void)
FILE* f;
size_t bytesWritten;
size_t bytesRead;
WIN32_FIND_DATA findData;
WIN32_FIND_DATAA findData;
HANDLE h;
GetTempPath (MAX_PATH, temppath);
GetTempFileName (temppath, "", 0, tempfile);
GetTempPathA(MAX_PATH, temppath);
GetTempFileNameA(temppath, "", 0, tempfile);
f = fopen(tempfile, "w+bDT");
bytesWritten = fwrite(DATA, 1, sizeof(DATA), f);
@ -461,7 +461,7 @@ static void test_filemodeT(void)
ok (bytesRead == bytesWritten && bytesRead == sizeof(DATA),
"fopen file mode 'T' wrongly interpreted as 't'\n" );
h = FindFirstFile(tempfile, &findData);
h = FindFirstFileA(tempfile, &findData);
ok (h == INVALID_HANDLE_VALUE, "file wasn't deleted when closed.\n" );
@ -711,7 +711,7 @@ static void test_fgetwc( void )
ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l);
fgetws(wtextW,LLEN,tempfh);
l=ftell(tempfh);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %d\n", BUFSIZ-2+lstrlen(mytext), l);
ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %d\n", BUFSIZ-2+lstrlenA(mytext), l);
mytextW = AtoW (mytext);
aptr = mytextW;
wptr = wtextW;
@ -810,8 +810,8 @@ static void test_fgetwc_locale(const char* text, const char* locale, int codepag
return;
}
GetTempPath(MAX_PATH, temppath);
GetTempFileName(temppath, "", 0, tempfile);
GetTempPathA(MAX_PATH, temppath);
GetTempFileNameA(temppath, "", 0, tempfile);
tempfh = fopen(tempfile, "wb");
ok(tempfh != NULL, "can't open tempfile\n");
@ -874,8 +874,8 @@ static void test_fgetwc_unicode(void)
int ret, i;
wint_t ch;
GetTempPath(MAX_PATH, temppath);
GetTempFileName(temppath, "", 0, tempfile);
GetTempPathA(MAX_PATH, temppath);
GetTempFileNameA(temppath, "", 0, tempfile);
if (!p_fopen_s)
{
@ -930,8 +930,8 @@ static void test_fputwc(void)
char buf[1024];
int ret;
GetTempPath (MAX_PATH, temppath);
GetTempFileName (temppath, "", 0, tempfile);
GetTempPathA(MAX_PATH, temppath);
GetTempFileNameA(temppath, "", 0, tempfile);
f = fopen(tempfile, "w");
ret = fputwc('a', f);
@ -1323,7 +1323,7 @@ static void test_file_inherit_child_no(const char* fd_s)
"Wrong write result in child process on %d (%s)\n", fd, strerror(errno));
}
static void create_io_inherit_block( STARTUPINFO *startup, unsigned int count, const HANDLE *handles )
static void create_io_inherit_block( STARTUPINFOA *startup, unsigned int count, const HANDLE *handles )
{
static BYTE block[1024];
BYTE *wxflag_ptr;
@ -1353,7 +1353,7 @@ static const char *read_file( HANDLE file )
return buffer;
}
static void test_stdout_handle( STARTUPINFO *startup, char *cmdline, HANDLE hstdout, BOOL expect_stdout,
static void test_stdout_handle( STARTUPINFOA *startup, char *cmdline, HANDLE hstdout, BOOL expect_stdout,
const char *descr )
{
const char *data;
@ -1393,7 +1393,7 @@ static void test_stdout_handle( STARTUPINFO *startup, char *cmdline, HANDLE hstd
}
CloseHandle( hErrorFile );
DeleteFile( "fdopen.err" );
DeleteFileA( "fdopen.err" );
}
static void test_file_inherit( const char* selfname )
@ -1402,7 +1402,7 @@ static void test_file_inherit( const char* selfname )
const char* arg_v[5];
char buffer[16];
char cmdline[MAX_PATH];
STARTUPINFO startup;
STARTUPINFOA startup;
SECURITY_ATTRIBUTES sa;
HANDLE handles[3];
@ -1440,7 +1440,7 @@ static void test_file_inherit( const char* selfname )
sprintf(cmdline, "%s file inherit 1", selfname);
/* init an empty Reserved2, which should not be recognized as inherit-block */
ZeroMemory(&startup, sizeof(STARTUPINFO));
ZeroMemory(&startup, sizeof(startup));
startup.cb = sizeof(startup);
create_io_inherit_block( &startup, 0, NULL );
test_stdout_handle( &startup, cmdline, 0, FALSE, "empty block" );
@ -1453,7 +1453,7 @@ static void test_file_inherit( const char* selfname )
create_io_inherit_block( &startup, 3, handles );
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "valid block" );
CloseHandle( handles[1] );
DeleteFile("fdopen.tst");
DeleteFileA("fdopen.tst");
/* test inherit block starting with unsigned zero */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
@ -1462,7 +1462,7 @@ static void test_file_inherit( const char* selfname )
*(unsigned int *)startup.lpReserved2 = 0;
test_stdout_handle( &startup, cmdline, handles[1], FALSE, "zero count block" );
CloseHandle( handles[1] );
DeleteFile("fdopen.tst");
DeleteFileA("fdopen.tst");
/* test inherit block with smaller size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
@ -1471,7 +1471,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 -= 3;
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "small size block" );
CloseHandle( handles[1] );
DeleteFile("fdopen.tst");
DeleteFileA("fdopen.tst");
/* test inherit block with even smaller size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
@ -1480,7 +1480,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 = sizeof(unsigned int) + sizeof(HANDLE) + sizeof(char);
test_stdout_handle( &startup, cmdline, handles[1], FALSE, "smaller size block" );
CloseHandle( handles[1] );
DeleteFile("fdopen.tst");
DeleteFileA("fdopen.tst");
/* test inherit block with larger size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
@ -1489,7 +1489,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 += 7;
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "large size block" );
CloseHandle( handles[1] );
DeleteFile("fdopen.tst");
DeleteFileA("fdopen.tst");
}
static void test_tmpnam( void )

View File

@ -233,7 +233,7 @@ static void test_aligned_offset_realloc(unsigned int size1, unsigned int size2,
static void test_aligned(void)
{
HMODULE msvcrt = GetModuleHandle("msvcrt.dll");
HMODULE msvcrt = GetModuleHandleA("msvcrt.dll");
if (msvcrt == NULL)
return;

View File

@ -19,8 +19,6 @@
*/
#include "wine/test.h"
#include "winbase.h"
#include "winnls.h"
#include <string.h>
#include <mbstring.h>
#include <wchar.h>
@ -32,6 +30,11 @@
#include <limits.h>
#include <math.h>
/* 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];