33#include <corecrt_io.h>
36#define STDOUT_FILENO 1
37#define STDERR_FILENO 2
46 ok(dup_fd != -1,
"_dup failed\n");
59 ok(
ret == 4,
"fprintf(stdout) returned %d\n",
ret);
60 ok(!
pos,
"expected stdout to be buffered\n");
63 ok(dup_fd != -1,
"_dup failed\n");
69 ok(
ret == 4,
"fprintf(stderr) returned %d\n",
ret);
72 trace(
"stderr is buffered\n");
74 ok(
pos == 4,
"expected stderr to be unbuffered (%d)\n",
pos);
81 ok(dup_fd != -1,
"_dup failed\n");
88 ok(
ret == 1,
"fscanf returned %d\n",
ret);
89 ok(
ch ==
't',
"ch = 0x%x\n", (
unsigned char)
ch);
97 ok(
DeleteFileA(
"std_stream_test.tmp"),
"DeleteFile failed\n");
119 char *tempf, *
ptr, **file_ptr, **file_base;
120 int cnt,
r, *file_cnt;
123 fp.f =
fopen(tempf,
"wb");
124 ok(fp.f !=
NULL,
"fopen failed with error: %d\n",
errno);
126 ok(!(fp.iobuf->_flag & 0x440),
"fp.iobuf->_flag = %x\n", fp.iobuf->_flag);
128 ok(
r == 4,
"fprintf returned %d\n",
r);
129 ok(fp.iobuf->_flag & 0x40,
"fp.iobuf->_flag = %x\n", fp.iobuf->_flag);
130 ok(fp.iobuf->_cnt + 4 == fp.iobuf->_bufsiz,
"_cnt = %d, _bufsiz = %d\n",
131 fp.iobuf->_cnt, fp.iobuf->_bufsiz);
133 ptr = fp.iobuf->_ptr;
134 cnt = fp.iobuf->_cnt;
136 ok(
r == 5,
"fprintf returned %d\n",
r);
137 ok(
ptr + 5 == fp.iobuf->_ptr,
"fp.iobuf->_ptr = %p, expected %p\n", fp.iobuf->_ptr,
ptr + 5);
138 ok(
cnt - 5 == fp.iobuf->_cnt,
"fp.iobuf->_cnt = %d, expected %d\n", fp.iobuf->_cnt,
cnt - 5);
139 ok(fp.iobuf->_ptr + fp.iobuf->_cnt == fp.iobuf->_base + fp.iobuf->_bufsiz,
140 "_ptr = %p, _cnt = %d, _base = %p, _bufsiz = %d\n",
141 fp.iobuf->_ptr, fp.iobuf->_cnt, fp.iobuf->_base, fp.iobuf->_bufsiz);
144 ok(file_base == &fp.iobuf->_base,
"_base = %p, expected %p\n", file_base, &fp.iobuf->_base);
145 ok(file_ptr == &fp.iobuf->_ptr,
"_ptr = %p, expected %p\n", file_ptr, &fp.iobuf->_ptr);
146 ok(file_cnt == &fp.iobuf->_cnt,
"_cnt = %p, expected %p\n", file_cnt, &fp.iobuf->_cnt);
149 ok(!
r,
"setvbuf returned %d\n",
r);
150 ok(fp.iobuf->_flag & 0x400,
"fp.iobuf->_flag = %x\n", fp.iobuf->_flag);
165 ok(
fd != -1,
"_dup failed\n");
186 static const struct {
190 {
"German.utf8",
"t\xc3\xa4\xc3\x8f\xc3\xb6\xc3\x9f.txt" },
191 {
"Polish.utf8",
"t\xc4\x99\xc5\x9b\xc4\x87.txt" },
192 {
"Turkish.utf8",
"t\xc3\x87\xc4\x9e\xc4\xb1\xc4\xb0\xc5\x9e.txt" },
193 {
"Arabic.utf8",
"t\xd8\xaa\xda\x86.txt" },
194 {
"Japanese.utf8",
"t\xe3\x82\xaf\xe3\x83\xa4.txt" },
195 {
"Chinese.utf8",
"t\xe4\xb8\x82\xe9\xbd\xab.txt" },
196 {
"Japanese",
"t\xb8\xd5.txt" },
211 ok(!!
f,
"failed to create %s with locale %s\n",
216 ok(!!
f,
"failed to open %s with locale %s\n",
228 const char file[] =
"file\xc4\x99\xc5\x9b\xc4\x87.a";
229 const char dir[] =
"dir\xc4\x99\xc5\x9b\xc4\x87";
231 const WCHAR dirW[] =
L"dir\x0119\x015b\x0107";
233 char file2[32],
buf[256], *
p, *
q, *
env[2];
238 WCHAR bufW[256], *pW;
252 skip(
"can't create test environment\n");
261 ok(
p ==
buf,
"_getcwd returned %p, errno %d\n",
p,
errno);
267 ok(
p ==
buf,
"_getdcwd returned %p, errno %d\n",
p,
errno);
273 ok(
p ==
buf,
"_fulpath returned %p, errno %d\n",
p,
errno);
279 ok(!!
f,
"fopen returned %d, error %d\n",
ret,
errno);
294 ok(
p == file2,
"_mktemp returned %p, file2 %p, errno %d\n",
p, file2,
errno);
298 ok(!!
f,
"fopen returned %d, error %d\n",
ret,
errno);
304 ok(
p ==
buf,
"_mktemp returned %p, buf %p, errno %d\n",
p,
buf,
errno);
316 fdata32.
name[0] =
'x';
318 ok(hfind != -1,
"_findfirst32 returned %Id, errno %d\n", hfind,
errno);
321 fdata32.
name[0] =
'x';
331 fdata64.
name[0] =
'x';
333 ok(hfind != -1,
"_findfirst64 returned %Id, errno %d\n", hfind,
errno);
336 fdata64.
name[0] =
'x';
345 fdata64i32.
name[0] =
'x';
347 ok(hfind != -1,
"_findfirst64i32 returned %Id, errno %d\n", hfind,
errno);
350 fdata64i32.
name[0] =
'x';
352 ok(!
ret,
"_findnext64i32 returned %d, errno %d\n",
ret,
errno);
376 ok(!!
p,
"_tempnam returned NULL, error %d\n",
errno);
397 ok(!pW,
"environment variable name was converted\n");
418 wcscpy(bufW,
L"__wine_env_test=");
434 ok(hproc != -1,
"_spawnl returned %Id, errno %d\n", hproc,
errno);
443 static const WCHAR nameW[] =
L"file\x0119\x015b\x0107.a";
466 if(arg_c == 4 && !
strcmp(arg_v[2],
"utf8"))
static const WCHAR nameW[]
static LPCWSTR LPCWSTR LPCWSTR env
#define GetEnvironmentVariableW(x, y, z)
#define GetProcAddress(x, y)
#define MultiByteToWideChar
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
BOOL WINAPI DECLSPEC_HOTPATCH DeleteFileA(LPCSTR path)
LPWSTR WINAPI GetCommandLineW(void)
char *CDECL _getdcwd(int drive, char *buf, int size)
char *CDECL _getcwd(char *buf, int size)
void CDECL _searchenv(const char *file, const char *env, char *buf)
int CDECL _wrmdir(const wchar_t *dir)
char *CDECL _fullpath(char *abs_path, const char *rel_path, size_t size)
int CDECL _getdrive(void)
int CDECL _chdir(const char *newdir)
int CDECL _mkdir(const char *newdir)
intptr_t CDECL _findfirst32(const char *fspec, struct _finddata32_t *ft)
int CDECL _findnext32(intptr_t hand, struct _finddata32_t *ft)
int CDECL _findclose(intptr_t hand)
int CDECL _putenv(const char *str)
wchar_t *CDECL _wgetenv(const wchar_t *name)
int CDECL _wputenv(const wchar_t *str)
char *CDECL getenv(const char *name)
FILE *CDECL _wfsopen(const wchar_t *path, const wchar_t *mode, int share)
int CDECL _dup2(int od, int nd)
char *CDECL _tempnam(const char *dir, const char *prefix)
int CDECL fclose(FILE *file)
int CDECL _chmod(const char *path, int flags)
FILE *CDECL _fsopen(const char *path, const char *mode, int share)
int WINAPIV fprintf(FILE *file, const char *format,...)
FILE *CDECL freopen(const char *path, const char *mode, FILE *file)
int CDECL _wunlink(const wchar_t *path)
int CDECL _mktemp_s(char *pattern, size_t size)
FILE *CDECL fopen(const char *path, const char *mode)
__int64 CDECL _telli64(int fd)
int CDECL fflush(FILE *file)
int CDECL _fileno(FILE *file)
char *CDECL _mktemp(char *pattern)
int CDECL setvbuf(FILE *file, char *buf, int mode, size_t size)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP unsigned int __cdecl ___lc_codepage_func(void)
_ACRTIMP intptr_t __cdecl _spawnle(int, const char *, const char *,...)
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl fscanf(FILE *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP char *__cdecl strrchr(const char *, int)
static const WCHAR fileW[]
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLint GLboolean GLint GLenum access
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define MB_ERR_INVALID_CHARS
static struct test_info tests[]
static void test_std_stream_buffering(void)
static void test_std_stream_open(void)
static void test_fopen(void)
static void test_utf8_argument(void)
static void test_utf8(const char *argv0)
int CDECL _get_stream_buffer_pointers(FILE *, char ***, char ***, int **)
static void test_iobuf_layout(void)
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
static char argv0[MAX_PATH]
DWORD WINAPI GetLastError(void)
BOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)