Commit 1f8636c5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msvcrt/tests: Enable compilation with -D__WINESRC__.

parent 2fa9b7eb
...@@ -2,7 +2,6 @@ TESTDLL = msvcrt.dll ...@@ -2,7 +2,6 @@ TESTDLL = msvcrt.dll
APPMODE = -mno-cygwin APPMODE = -mno-cygwin
MODCFLAGS = @BUILTINFLAG@ MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(top_srcdir)/include/msvcrt -I$(srcdir)/.. EXTRAINCL = -I$(top_srcdir)/include/msvcrt -I$(srcdir)/..
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
cpp.c \ cpp.c \
......
...@@ -76,7 +76,7 @@ static void test_initterm(void) ...@@ -76,7 +76,7 @@ static void test_initterm(void)
static void test_initvar( HMODULE hmsvcrt ) static void test_initvar( HMODULE hmsvcrt )
{ {
OSVERSIONINFO osvi = { sizeof(OSVERSIONINFO) }; OSVERSIONINFOA osvi = { sizeof(OSVERSIONINFOA) };
int *pp_winver = (int*)GetProcAddress(hmsvcrt, "_winver"); int *pp_winver = (int*)GetProcAddress(hmsvcrt, "_winver");
int *pp_winmajor = (int*)GetProcAddress(hmsvcrt, "_winmajor"); int *pp_winmajor = (int*)GetProcAddress(hmsvcrt, "_winmajor");
int *pp_winminor = (int*)GetProcAddress(hmsvcrt, "_winminor"); int *pp_winminor = (int*)GetProcAddress(hmsvcrt, "_winminor");
...@@ -91,7 +91,7 @@ static void test_initvar( HMODULE hmsvcrt ) ...@@ -91,7 +91,7 @@ static void test_initvar( HMODULE hmsvcrt )
winver = *pp_winver; winver = *pp_winver;
winminor = *pp_winminor; winminor = *pp_winminor;
winmajor = *pp_winmajor; winmajor = *pp_winmajor;
GetVersionEx( &osvi); GetVersionExA( &osvi);
ok( winminor == osvi.dwMinorVersion, "Wrong value for _winminor %02x expected %02x\n", ok( winminor == osvi.dwMinorVersion, "Wrong value for _winminor %02x expected %02x\n",
winminor, osvi.dwMinorVersion); winminor, osvi.dwMinorVersion);
ok( winmajor == osvi.dwMajorVersion, "Wrong value for _winmajor %02x expected %02x\n", ok( winmajor == osvi.dwMajorVersion, "Wrong value for _winmajor %02x expected %02x\n",
...@@ -196,7 +196,7 @@ static void test___getmainargs_parent(char *name) ...@@ -196,7 +196,7 @@ static void test___getmainargs_parent(char *name)
{ {
char cmdline[3*MAX_PATH]; char cmdline[3*MAX_PATH];
char tmppath[MAX_PATH], filepath[MAX_PATH]; char tmppath[MAX_PATH], filepath[MAX_PATH];
STARTUPINFO startup; STARTUPINFOA startup;
PROCESS_INFORMATION proc; PROCESS_INFORMATION proc;
FILE *f; FILE *f;
int ret; int ret;
......
...@@ -345,28 +345,28 @@ static void test_fullpath(void) ...@@ -345,28 +345,28 @@ static void test_fullpath(void)
BOOL rc,free1,free2; BOOL rc,free1,free2;
free1=free2=TRUE; free1=free2=TRUE;
GetCurrentDirectory(MAX_PATH, prevpath); GetCurrentDirectoryA(MAX_PATH, prevpath);
GetTempPath(MAX_PATH,tmppath); GetTempPathA(MAX_PATH,tmppath);
strcpy(level1,tmppath); strcpy(level1,tmppath);
strcat(level1,"msvcrt-test\\"); strcat(level1,"msvcrt-test\\");
rc = CreateDirectory(level1,NULL); rc = CreateDirectoryA(level1,NULL);
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS) if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
free1=FALSE; free1=FALSE;
strcpy(level2,level1); strcpy(level2,level1);
strcat(level2,"nextlevel\\"); strcat(level2,"nextlevel\\");
rc = CreateDirectory(level2,NULL); rc = CreateDirectoryA(level2,NULL);
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS) if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
free2=FALSE; free2=FALSE;
SetCurrentDirectory(level2); SetCurrentDirectoryA(level2);
ok(_fullpath(full,"test", MAX_PATH)!=NULL,"_fullpath failed\n"); ok(_fullpath(full,"test", MAX_PATH)!=NULL,"_fullpath failed\n");
strcpy(teststring,level2); strcpy(teststring,level2);
strcat(teststring,"test"); strcat(teststring,"test");
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full); ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
ok(_fullpath(full,"\\test", MAX_PATH)!=NULL,"_fullpath failed\n"); ok(_fullpath(full,"\\test", MAX_PATH)!=NULL,"_fullpath failed\n");
strncpy(teststring,level2,3); memcpy(teststring,level2,3);
teststring[3]=0; teststring[3]=0;
strcat(teststring,"test"); strcat(teststring,"test");
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full); ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
...@@ -383,11 +383,11 @@ static void test_fullpath(void) ...@@ -383,11 +383,11 @@ static void test_fullpath(void)
ok(strcmp(freeme,teststring)==0,"Invalid Path returned %s\n",freeme); ok(strcmp(freeme,teststring)==0,"Invalid Path returned %s\n",freeme);
free(freeme); free(freeme);
SetCurrentDirectory(prevpath); SetCurrentDirectoryA(prevpath);
if (free2) if (free2)
RemoveDirectory(level2); RemoveDirectoryA(level2);
if (free1) if (free1)
RemoveDirectory(level1); RemoveDirectoryA(level1);
} }
START_TEST(dir) START_TEST(dir)
......
...@@ -446,11 +446,11 @@ static void test_filemodeT(void) ...@@ -446,11 +446,11 @@ static void test_filemodeT(void)
FILE* f; FILE* f;
size_t bytesWritten; size_t bytesWritten;
size_t bytesRead; size_t bytesRead;
WIN32_FIND_DATA findData; WIN32_FIND_DATAA findData;
HANDLE h; HANDLE h;
GetTempPath (MAX_PATH, temppath); GetTempPathA(MAX_PATH, temppath);
GetTempFileName (temppath, "", 0, tempfile); GetTempFileNameA(temppath, "", 0, tempfile);
f = fopen(tempfile, "w+bDT"); f = fopen(tempfile, "w+bDT");
bytesWritten = fwrite(DATA, 1, sizeof(DATA), f); bytesWritten = fwrite(DATA, 1, sizeof(DATA), f);
...@@ -461,7 +461,7 @@ static void test_filemodeT(void) ...@@ -461,7 +461,7 @@ static void test_filemodeT(void)
ok (bytesRead == bytesWritten && bytesRead == sizeof(DATA), ok (bytesRead == bytesWritten && bytesRead == sizeof(DATA),
"fopen file mode 'T' wrongly interpreted as 't'\n" ); "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" ); ok (h == INVALID_HANDLE_VALUE, "file wasn't deleted when closed.\n" );
...@@ -711,7 +711,7 @@ static void test_fgetwc( void ) ...@@ -711,7 +711,7 @@ static void test_fgetwc( void )
ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l); ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l);
fgetws(wtextW,LLEN,tempfh); fgetws(wtextW,LLEN,tempfh);
l=ftell(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); mytextW = AtoW (mytext);
aptr = mytextW; aptr = mytextW;
wptr = wtextW; wptr = wtextW;
...@@ -810,8 +810,8 @@ static void test_fgetwc_locale(const char* text, const char* locale, int codepag ...@@ -810,8 +810,8 @@ static void test_fgetwc_locale(const char* text, const char* locale, int codepag
return; return;
} }
GetTempPath(MAX_PATH, temppath); GetTempPathA(MAX_PATH, temppath);
GetTempFileName(temppath, "", 0, tempfile); GetTempFileNameA(temppath, "", 0, tempfile);
tempfh = fopen(tempfile, "wb"); tempfh = fopen(tempfile, "wb");
ok(tempfh != NULL, "can't open tempfile\n"); ok(tempfh != NULL, "can't open tempfile\n");
...@@ -874,8 +874,8 @@ static void test_fgetwc_unicode(void) ...@@ -874,8 +874,8 @@ static void test_fgetwc_unicode(void)
int ret, i; int ret, i;
wint_t ch; wint_t ch;
GetTempPath(MAX_PATH, temppath); GetTempPathA(MAX_PATH, temppath);
GetTempFileName(temppath, "", 0, tempfile); GetTempFileNameA(temppath, "", 0, tempfile);
if (!p_fopen_s) if (!p_fopen_s)
{ {
...@@ -930,8 +930,8 @@ static void test_fputwc(void) ...@@ -930,8 +930,8 @@ static void test_fputwc(void)
char buf[1024]; char buf[1024];
int ret; int ret;
GetTempPath (MAX_PATH, temppath); GetTempPathA(MAX_PATH, temppath);
GetTempFileName (temppath, "", 0, tempfile); GetTempFileNameA(temppath, "", 0, tempfile);
f = fopen(tempfile, "w"); f = fopen(tempfile, "w");
ret = fputwc('a', f); ret = fputwc('a', f);
...@@ -1323,7 +1323,7 @@ static void test_file_inherit_child_no(const char* fd_s) ...@@ -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)); "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]; static BYTE block[1024];
BYTE *wxflag_ptr; BYTE *wxflag_ptr;
...@@ -1353,7 +1353,7 @@ static const char *read_file( HANDLE file ) ...@@ -1353,7 +1353,7 @@ static const char *read_file( HANDLE file )
return buffer; 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 *descr )
{ {
const char *data; const char *data;
...@@ -1393,7 +1393,7 @@ static void test_stdout_handle( STARTUPINFO *startup, char *cmdline, HANDLE hstd ...@@ -1393,7 +1393,7 @@ static void test_stdout_handle( STARTUPINFO *startup, char *cmdline, HANDLE hstd
} }
CloseHandle( hErrorFile ); CloseHandle( hErrorFile );
DeleteFile( "fdopen.err" ); DeleteFileA( "fdopen.err" );
} }
static void test_file_inherit( const char* selfname ) static void test_file_inherit( const char* selfname )
...@@ -1402,7 +1402,7 @@ 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]; const char* arg_v[5];
char buffer[16]; char buffer[16];
char cmdline[MAX_PATH]; char cmdline[MAX_PATH];
STARTUPINFO startup; STARTUPINFOA startup;
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
HANDLE handles[3]; HANDLE handles[3];
...@@ -1440,7 +1440,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1440,7 +1440,7 @@ static void test_file_inherit( const char* selfname )
sprintf(cmdline, "%s file inherit 1", selfname); sprintf(cmdline, "%s file inherit 1", selfname);
/* init an empty Reserved2, which should not be recognized as inherit-block */ /* init an empty Reserved2, which should not be recognized as inherit-block */
ZeroMemory(&startup, sizeof(STARTUPINFO)); ZeroMemory(&startup, sizeof(startup));
startup.cb = sizeof(startup); startup.cb = sizeof(startup);
create_io_inherit_block( &startup, 0, NULL ); create_io_inherit_block( &startup, 0, NULL );
test_stdout_handle( &startup, cmdline, 0, FALSE, "empty block" ); test_stdout_handle( &startup, cmdline, 0, FALSE, "empty block" );
...@@ -1453,7 +1453,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1453,7 +1453,7 @@ static void test_file_inherit( const char* selfname )
create_io_inherit_block( &startup, 3, handles ); create_io_inherit_block( &startup, 3, handles );
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "valid block" ); test_stdout_handle( &startup, cmdline, handles[1], TRUE, "valid block" );
CloseHandle( handles[1] ); CloseHandle( handles[1] );
DeleteFile("fdopen.tst"); DeleteFileA("fdopen.tst");
/* test inherit block starting with unsigned zero */ /* test inherit block starting with unsigned zero */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE, handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
...@@ -1462,7 +1462,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1462,7 +1462,7 @@ static void test_file_inherit( const char* selfname )
*(unsigned int *)startup.lpReserved2 = 0; *(unsigned int *)startup.lpReserved2 = 0;
test_stdout_handle( &startup, cmdline, handles[1], FALSE, "zero count block" ); test_stdout_handle( &startup, cmdline, handles[1], FALSE, "zero count block" );
CloseHandle( handles[1] ); CloseHandle( handles[1] );
DeleteFile("fdopen.tst"); DeleteFileA("fdopen.tst");
/* test inherit block with smaller size */ /* test inherit block with smaller size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE, handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
...@@ -1471,7 +1471,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1471,7 +1471,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 -= 3; startup.cbReserved2 -= 3;
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "small size block" ); test_stdout_handle( &startup, cmdline, handles[1], TRUE, "small size block" );
CloseHandle( handles[1] ); CloseHandle( handles[1] );
DeleteFile("fdopen.tst"); DeleteFileA("fdopen.tst");
/* test inherit block with even smaller size */ /* test inherit block with even smaller size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE, handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
...@@ -1480,7 +1480,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1480,7 +1480,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 = sizeof(unsigned int) + sizeof(HANDLE) + sizeof(char); startup.cbReserved2 = sizeof(unsigned int) + sizeof(HANDLE) + sizeof(char);
test_stdout_handle( &startup, cmdline, handles[1], FALSE, "smaller size block" ); test_stdout_handle( &startup, cmdline, handles[1], FALSE, "smaller size block" );
CloseHandle( handles[1] ); CloseHandle( handles[1] );
DeleteFile("fdopen.tst"); DeleteFileA("fdopen.tst");
/* test inherit block with larger size */ /* test inherit block with larger size */
handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE, handles[1] = CreateFileA( "fdopen.tst", GENERIC_READ|GENERIC_WRITE,
...@@ -1489,7 +1489,7 @@ static void test_file_inherit( const char* selfname ) ...@@ -1489,7 +1489,7 @@ static void test_file_inherit( const char* selfname )
startup.cbReserved2 += 7; startup.cbReserved2 += 7;
test_stdout_handle( &startup, cmdline, handles[1], TRUE, "large size block" ); test_stdout_handle( &startup, cmdline, handles[1], TRUE, "large size block" );
CloseHandle( handles[1] ); CloseHandle( handles[1] );
DeleteFile("fdopen.tst"); DeleteFileA("fdopen.tst");
} }
static void test_tmpnam( void ) static void test_tmpnam( void )
......
...@@ -233,7 +233,7 @@ static void test_aligned_offset_realloc(unsigned int size1, unsigned int size2, ...@@ -233,7 +233,7 @@ static void test_aligned_offset_realloc(unsigned int size1, unsigned int size2,
static void test_aligned(void) static void test_aligned(void)
{ {
HMODULE msvcrt = GetModuleHandle("msvcrt.dll"); HMODULE msvcrt = GetModuleHandleA("msvcrt.dll");
if (msvcrt == NULL) if (msvcrt == NULL)
return; return;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
*/ */
#include "wine/test.h" #include "wine/test.h"
#include "winbase.h"
#include "winnls.h"
#include <string.h> #include <string.h>
#include <mbstring.h> #include <mbstring.h>
#include <wchar.h> #include <wchar.h>
...@@ -32,6 +30,11 @@ ...@@ -32,6 +30,11 @@
#include <limits.h> #include <limits.h>
#include <math.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_to_string(const unsigned char *bin, int len, int nr)
{ {
static char buf[2][1024]; static char buf[2][1024];
......
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