47#include "wine/unicode.h"
59#define _IOCOMMIT 0x4000
94#define WX_READEOF 0x04
97#define WX_DONTINHERIT 0x10
105#define EF_CRIT_INIT 0x04
106#define EF_UNK_UNICODE 0x08
112#define MSVCRT_MAX_FILES 2048
113#define MSVCRT_FD_BLOCK_SIZE 32
115#define MSVCRT_INTERNAL_BUFSIZ 4096
152 0, 0, { (
DWORD_PTR)(__FILE__
": MSVCRT_file_cs") }
155#define LOCK_FILES() do { EnterCriticalSection(&MSVCRT_file_cs); } while (0)
156#define UNLOCK_FILES() do { LeaveCriticalSection(&MSVCRT_file_cs); } while (0)
205 WARN(
":out of memory!\n");
258 WARN(
":files exhausted!\n");
283 ERR(
"out of memory\n");
348 TRACE(
":handle (%p) allocating fd (%d)\n", hand,
fd);
371 if (
file->_flag == 0)
384 TRACE(
":fd (%d) allocating FILE*\n",
fd);
387 WARN(
":invalid fd %d\n",
fd);
395 file->_flag = stream_flags;
430 wxflag_ptr = (
char*)*
block +
sizeof(
unsigned);
431 handle_ptr = (
HANDLE*)(wxflag_ptr + last_fd);
433 *(
unsigned*)*
block = last_fd;
434 for (
fd = 0;
fd < last_fd;
fd++)
440 *wxflag_ptr = fdinfo->
wxflag;
441 *handle_ptr = fdinfo->
handle;
448 wxflag_ptr++; handle_ptr++;
485 wxflag_ptr++; handle_ptr++;
524 for (
i = 0;
i < 3;
i++)
546 file->_flag &= ~_IOWRT;
583 file->_base = (
char*)(&
file->_charbuf);
615 file->_flag &= ~_USERBUF;
634 *
p = (
num & 31) +
'0';
636 *
p += (
'a' -
'0' - 10);
659 *
p = (
num & 31) +
'0';
661 *
p += (
'a' -
'0' - 10);
672 wchar_t *wstr =
malloc(
len*
sizeof (
wchar_t));
869 int i, num_flushed = 0;
886 TRACE(
":flushed (%d) handles\n",num_flushed);
969 ioinfo *info_od, *info_nd;
972 TRACE(
"(od=%d, nd=%d)\n", od, nd);
996 int wxflag = info_od->
wxflag & ~WX_DONTINHERIT;
1044 DWORD curpos,endpos;
1045 LONG hcurpos,hendpos;
1047 TRACE(
":fd (%d) handle (%p)\n",
fd,
info->handle);
1062 hcurpos = hendpos = 0;
1066 if (curpos == endpos && hcurpos == hendpos)
1083 int num_closed = 0,
i;
1095 TRACE(
":closed (%d) handles\n",num_closed);
1143 TRACE(
":fd (%d) handle (%p)\n",
fd,
info->handle);
1151 if (whence < 0 || whence > 2)
1158 TRACE(
":fd (%d) to %s pos %s\n",
1162 (whence==
SEEK_END)?
"SEEK_END":
"UNKNOWN");
1226 TRACE(
":fd (%d) handle (%p)\n",
fd,
info->handle);
1233 if (mode < 0 || mode > 4)
1240 TRACE(
":fd (%d) by 0x%08x mode %s\n",
1251 FIXME (
"Seek failed\n");
1272 return ret ? 0 : -1;
1300 file->_flag &= ~_IOEOF;
1419 *open_flags &= ~_O_TEXT;
1423 *open_flags &= ~_O_BINARY;
1435 *stream_flags &= ~_IOCOMMIT;
1447 FIXME(
"ignoring cache optimization flag: %c\n",
mode[-1]);
1450 ERR(
"incorrect mode flag: %c\n",
mode[-1]);
1456 static const WCHAR ccs[] = {
'c',
'c',
's'};
1457 static const WCHAR utf8[] = {
'u',
't',
'f',
'-',
'8'};
1458 static const WCHAR utf16le[] = {
'u',
't',
'f',
'-',
'1',
'6',
'l',
'e'};
1459 static const WCHAR unicode[] = {
'u',
'n',
'i',
'c',
'o',
'd',
'e'};
1465 mode +=
sizeof(ccs)/
sizeof(ccs[0]);
1475 mode +=
sizeof(utf8)/
sizeof(utf8[0]);
1477 else if(!
strncmpiW(utf16le,
mode,
sizeof(utf16le)/
sizeof(utf16le[0])))
1480 mode +=
sizeof(utf16le)/
sizeof(utf16le[0]);
1482 else if(!
strncmpiW(unicode,
mode,
sizeof(unicode)/
sizeof(unicode[0])))
1485 mode +=
sizeof(unicode)/
sizeof(unicode[0]);
1507 wchar_t *modeW =
NULL;
1522 int open_flags, stream_flags;
1552 if (endPos != curPos)
1571 if (endPos != curPos)
1594 TRACE(
":fd (%d) handle (%p)\n",
fd,hand);
1615 numX = (*
pattern++ ==
'X')? numX + 1 : 0;
1623 int tempNum =
id / 10;
1624 *
pattern-- =
id - (tempNum * 10) +
'0';
1633 }
while(letter <=
'z');
1645 wchar_t letter =
'a';
1648 numX = (*
pattern++ ==
'X')? numX + 1 : 0;
1656 int tempNum =
id / 10;
1657 *
pattern-- =
id - (tempNum * 10) +
'0';
1667 }
while(letter !=
'|');
1686 if ((unsupp = oflags & ~(
1694 ERR(
":unsupported oflags 0x%04x\n",unsupp);
1706 HANDLE readHandle, writeHandle;
1716 sa.lpSecurityDescriptor =
NULL;
1786 TRACE(
"fd*: %p :file (%s) oflags: 0x%04x shflags: 0x%04x pmode: 0x%04x\n",
1803 FIXME(
": pmode 0x%04x ignored\n", pmode);
1805 WARN(
": pmode 0x%04x ignored\n", pmode);
1837 ERR(
"Unhandled shflags 0x%x\n", shflags );
1850 sa.lpSecurityDescriptor =
NULL;
1883 DWORD written = 0, tmp;
1889 WARN(
"error writing BOM\n");
1897 DWORD written = 0, tmp;
1904 WARN(
"error writing BOM\n");
1932 TRACE(
":fd (%d) handle (%p)\n", *
fd, hand);
2096 int num_removed = 0,
i;
2103 if (
file->_tmpfname)
2112 TRACE(
":removed (%d) temp files\n",num_removed);
2118 if((ch&0xf8) == 0xf0)
2120 else if((ch&0xf0) == 0xe0)
2122 else if((ch&0xe0) == 0xc0)
2133 char min_buf[4], *readbuf, lookahead;
2134 DWORD readbuf_size,
pos=0, num_read=1, char_len,
i,
j;
2140 if(readbuf_size<=4 || !(readbuf =
malloc(readbuf_size))) {
2172 }
else if(!num_read) {
2185 if(readbuf[0] ==
'\n')
2188 fdinfo->
wxflag &= ~WX_READNL;
2190 if(readbuf[0] == 0x1a) {
2195 if(readbuf[0] ==
'\r') {
2196 if(!
ReadFile(hand, &lookahead, 1, &num_read,
NULL) || num_read!=1)
2198 else if(lookahead ==
'\n')
2223 if (readbuf != min_buf)
free(readbuf);
2227 if (readbuf != min_buf)
free(readbuf);
2230 }
else if(!
pos && !num_read) {
2232 if (readbuf != min_buf)
free(readbuf);
2237 if(readbuf[0] ==
'\n')
2240 fdinfo->
wxflag &= ~WX_READNL;
2244 if((readbuf[
i]&0xc0) != 0x80)
2247 if(char_len+
i <=
pos)
2263 if(readbuf[
i] == 0x1a) {
2269 if(readbuf[
i] ==
'\r' &&
i+1==
pos) {
2271 readbuf[
j++] =
'\r';
2272 }
else if(lookahead ==
'\n' &&
j==0) {
2273 readbuf[
j++] =
'\n';
2275 if(lookahead !=
'\n')
2276 readbuf[
j++] =
'\r';
2283 }
else if(readbuf[
i]!=
'\r' || readbuf[
i+1]!=
'\n') {
2284 readbuf[
j++] = readbuf[
i];
2291 if (readbuf != min_buf)
free(readbuf);
2295 if (readbuf != min_buf)
free(readbuf);
2308 DWORD num_read, utf16;
2309 char *bufstart =
buf;
2315 TRACE(
"already at EOF, returning 0\n");
2351 num_read += 1+utf16;
2356 if(utf16 && (num_read&1))
2360 ERR(
"got odd number of bytes in UTF16 mode\n");
2364 if (
count != 0 && num_read == 0)
2373 if (bufstart[0]==
'\n' && (!utf16 || bufstart[1]==0))
2376 fdinfo->
wxflag &= ~WX_READNL;
2378 for (
i=0,
j=0;
i<num_read;
i+=1+utf16)
2381 if (bufstart[
i]==0x1a && (!utf16 || bufstart[
i+1]==0))
2389 if (bufstart[
i]==
'\r' && (!utf16 || bufstart[
i+1]==0) &&
i+1+utf16==num_read)
2394 lookahead[1] =
'\n';
2397 if(lookahead[0]==
'\n' && (!utf16 || lookahead[1]==0) &&
j==0)
2399 bufstart[
j++] =
'\n';
2400 if(utf16) bufstart[
j++] = 0;
2404 if(lookahead[0]!=
'\n' || (utf16 && lookahead[1]!=0))
2406 bufstart[
j++] =
'\r';
2407 if(utf16) bufstart[
j++] = 0;
2412 if (lookahead[0]==
'\n' && (!utf16 || !lookahead[1]))
2414 bufstart[
j++] =
'\n';
2415 if (utf16) bufstart[
j++] = 0;
2429 bufstart[
j++] =
'\r';
2430 if(utf16) bufstart[
j++] = 0;
2433 else if((bufstart[
i]!=
'\r' || (utf16 && bufstart[
i+1]!=0))
2434 || (bufstart[
i+1+utf16]!=
'\n' || (utf16 && bufstart[
i+3]!=0)))
2436 bufstart[
j++] = bufstart[
i];
2437 if(utf16) bufstart[
j++] = bufstart[
i+1];
2447 TRACE(
":end-of-pipe\n");
2497 info->wxflag &= ~WX_TEXT;
2538 const char *tmp_dir =
getenv(
"TMP");
2540 if (tmp_dir)
dir = tmp_dir;
2542 TRACE(
"dir (%s) prefix (%s)\n",
dir,prefix);
2545 TRACE(
"got name (%s)\n",tmpbuf);
2617 && (num_written ==
count))
2622 TRACE(
"WriteFile (fd %d, hand %p) failed-last error (%d)\n",
fd,
2628 unsigned int i,
j, nr_lf,
size;
2631 const char *
s =
buf, *buf_start =
buf;
2653 FIXME(
"Malloc failed\n");
2668 if (
s[
i]==
'\n' &&
s[
i+1]==0)
2677 if (
s[
i]==
'\n' &&
s[
i+1]==0)
2688 FIXME(
"Malloc failed\n");
2705 if (
s[
i]==
'\n' &&
s[
i+1]==0)
2716 size = conv_len+nr_lf;
2721 if (
s[
i]==
'\n' &&
s[
i+1]==0)
2735 FIXME(
"Malloc failed\n");
2747 if (num_written !=
size)
2749 TRACE(
"WriteFile (fd %d, hand %p) failed-last error (%d), num_written %d\n",
2752 return s - buf_start;
2770 if (
len ==
sizeof(
val)) {
2879 c = *(
unsigned char *)
file->_base;
2896 i = (
unsigned char *)
file->_ptr++;
2919 char * buf_start =
s;
2921 TRACE(
":file(%p) fd (%d) str (%p) len (%d)\n",
2931 if ((
cc ==
EOF) && (
s == buf_start))
2933 TRACE(
":nothing read\n");
3004 for (
j=0;
j<
sizeof(
int);
j++) {
3048 wchar_t * buf_start =
s;
3050 TRACE(
":file(%p) fd (%d) str (%p) len (%d)\n",
3060 if ((
cc ==
WEOF) && (
s == buf_start))
3062 TRACE(
":nothing read\n");
3079 size_t wrcnt=
size * nmemb;
3088 if(
file->_cnt < 0) {
3089 WARN(
"negative file->_cnt value in %p\n",
file);
3095 int pcnt=(
file->_cnt>wrcnt)? wrcnt:
file->_cnt;
3101 ptr = (
const char*)
ptr + pcnt;
3113 bufsiz =
file->_bufsiz;
3115 pcnt = (wrcnt / bufsiz) * bufsiz;
3126 ptr = (
const char*)
ptr + pcnt;
3132 ptr = (
const char*)
ptr + 1;
3137 return written /
size;
3190 int open_flags, stream_flags,
fd;
3224 wchar_t *pathW =
NULL, *modeW =
NULL;
3283 const wchar_t *
mode)
3342 size_t rcnt=
size * nmemb;
3353 int pcnt= (rcnt>
file->_cnt)?
file->_cnt:rcnt;
3378 i = (
file->_cnt<rcnt) ?
file->_cnt : rcnt;
3380 if (
i > 0 && i < file->_cnt) {
3382 file->_flag &= ~_IOEOF;
3391 }
else if (rcnt <
BUFSIZ) {
3423 int open_flags, stream_flags,
fd;
3461 wchar_t *pathW =
NULL, *modeW =
NULL;
3527 }
else if(!
file->_cnt) {
3534 if(
file->_ptr[
i] ==
'\n')
3648 char * buf_start =
buf;
3657 TRACE(
"got '%s'\n", buf_start);
3732 static const wchar_t nl =
'\n';
3778 TRACE(
":from %s to %s\n",oldpath,newpath);
3859 if(!
data->tmpnam_buffer)
3862 s =
data->tmpnam_buffer;
3884 static const wchar_t format[] = {
'\\',
's',
'%',
's',
'.',0};
3891 if(!
data->wtmpnam_buffer)
3894 s =
data->wtmpnam_buffer;
3959 if(*
file->_ptr !=
c) {
3992 unsigned char * pp = (
unsigned char *)&mwc;
3995 for(
i=
sizeof(
wchar_t)-1;
i>=0;
i--) {
4038 TRACE(
"%d\n", newmax);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
static struct sockaddr_in sa
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define _setmode(fd, mode)
#define INVALID_SET_FILE_POINTER
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
static __inline const char * debugstr_an(const char *s, int n)
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
#define GetCurrentProcess()
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
BOOL WINAPI DECLSPEC_HOTPATCH SetStdHandle(DWORD nStdHandle, HANDLE hHandle)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
DWORD WINAPI GetFileType(HANDLE hFile)
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI UnlockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToUnlockLow, IN DWORD nNumberOfBytesToUnlockHigh)
BOOL WINAPI LockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToLockLow, IN DWORD nNumberOfBytesToLockHigh)
BOOL WINAPI MoveFileExA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
VOID WINAPI GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
#define MOVEFILE_COPY_ALLOWED
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLint GLboolean GLint GLenum access
GLfloat GLfloat GLfloat GLfloat h
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 flag
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
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 GLint GLint j
_Check_return_opt_ _CRTIMP int __cdecl fsetpos(_Inout_ FILE *_File, _In_ const fpos_t *_Pos)
_CRTIMP char *__cdecl tmpnam(_Pre_maybenull_ _Post_z_ char *_Buffer)
_Check_return_opt_ _CRTIMP int __cdecl fgetc(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl _filbuf(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl _getw(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP wint_t __cdecl fputwc(_In_ wchar_t _Ch, _Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl getc(_Inout_ FILE *_File)
__MINGW_EXTENSION typedef long long fpos_t
_CRTIMP void __cdecl rewind(_Inout_ FILE *_File)
_Check_return_ _CRTIMP char *__cdecl _tempnam(_In_opt_z_ const char *_DirName, _In_opt_z_ const char *_FilePrefix)
_Check_return_opt_ _CRTIMP int __cdecl fgetpos(_Inout_ FILE *_File, _Out_ fpos_t *_Pos)
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl _fcloseall(void)
_Check_return_ _CRTIMP int __cdecl feof(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP_ALT int __cdecl ungetc(_In_ int _Ch, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl _flushall(void)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl _setmaxstdio(_In_ int _Max)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
_CRTIMP void __cdecl setbuf(_Inout_ FILE *_File, _Inout_updates_opt_(BUFSIZ) _Post_readable_size_(0) char *_Buffer)
_Check_return_opt_ _CRTIMP wint_t __cdecl fgetwc(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
_Check_return_opt_ _CRTIMP int __cdecl fputws(_In_z_ const wchar_t *_Str, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl setvbuf(_Inout_ FILE *_File, _Inout_updates_opt_z_(_Size) char *_Buf, _In_ int _Mode, _In_ size_t _Size)
_CRTIMP unsigned long *__cdecl __doserrno(void)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define InterlockedCompareExchangePointer
static const int digits[]
#define memcpy(s1, s2, n)
#define ERROR_ALREADY_EXISTS
#define TRUNCATE_EXISTING
#define FILE_FLAG_DELETE_ON_CLOSE
#define ERROR_FILE_NOT_FOUND
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define MSVCRT_INVALID_PMT(x)
#define MSVCRT_CHECK_PMT(x)
#define sprintf(buf, format,...)
static ioinfo ** __pioinfo
#define MSVCRT_FD_BLOCK_SIZE
static void create_io_inherit_block(STARTUPINFOA *startup, unsigned int count, const HANDLE *handles)
thread_data_t * msvcrt_get_thread_data(void)
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
static unsigned(__cdecl *hash_bstr)(bstr_t s)
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
BOOL WINAPI CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
#define FILE_ATTRIBUTE_READONLY
#define FILE_SHARE_DELETE
_Must_inspect_result_ _Out_ LPSIZE psize
#define strncmpiW(s1, s2, n)
#define strncmpW(s1, s2, n)
void _dosmaperr(unsigned long oserrcode)
void _invalid_parameter(const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved)
_CRTIMP int *__cdecl _errno(void)
errno_t __cdecl _set_errno(_In_ int _Value)
_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle)
_Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle)
_Check_return_opt_ _CRTIMP long __cdecl _lseek(_In_ int _FileHandle, _In_ long _Offset, _In_ int _Origin)
_Check_return_ _CRTIMP long __cdecl _filelength(_In_ int _FileHandle)
_Check_return_ _CRTIMP int __cdecl _chmod(_In_z_ const char *_Filename, _In_ int _Mode)
_CRTIMP int __cdecl _sopen(const char *_Filename, int _OpenFlag, int _ShareFlag,...)
_CRTIMP int __cdecl _write(_In_ int _FileHandle, _In_reads_bytes_(_MaxCharCount) const void *_Buf, _In_ unsigned int _MaxCharCount)
_Check_return_ _CRTIMP int __cdecl _pipe(_Inout_updates_(2) int *_PtHandles, _In_ unsigned int _PipeSize, _In_ int _TextMode)
_Check_return_ _CRTIMP long __cdecl _tell(_In_ int _FileHandle)
_Check_return_ _CRTIMP char *__cdecl _mktemp(_Inout_z_ char *_TemplateName)
_Check_return_ _CRTIMP int __cdecl _creat(_In_z_ const char *_Filename, _In_ int _PermissionMode)
_Check_return_ _CRTIMP int __cdecl _read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
_Check_return_ _CRTIMP int __cdecl _dup2(_In_ int _FileHandleSrc, _In_ int _FileHandleDst)
_Check_return_ _CRTIMP int __cdecl _unlink(_In_z_ const char *_Filename)
_CRTIMP int __cdecl _open(const char *_Filename, int _OpenFlag,...)
_CRTIMP int __cdecl umask(_In_ int _Mode)
_Check_return_ _CRTIMP int __cdecl _chsize(_In_ int _FileHandle, _In_ long _Size)
_Check_return_ _CRTIMP int __cdecl _dup(_In_ int _FileHandle)
_CRTIMP int __cdecl _open_osfhandle(_In_ intptr_t _OSFileHandle, _In_ int _Flags)
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
void _unlock(int locknum)
FILE *CDECL _wfsopen(const wchar_t *path, const wchar_t *mode, int share)
static FILE * msvcrt_alloc_fp(void)
wchar_t * msvcrt_wstrdupa(const char *str)
void CDECL clearerr(FILE *file)
wchar_t *CDECL _getws(wchar_t *buf)
int CDECL _fgetchar(void)
ioinfo * get_ioinfo(int fd)
wint_t CDECL ungetwc(wint_t wc, FILE *file)
static void remove_std_buffer(FILE *file)
static ioinfo * get_ioinfo_alloc_fd(int fd)
static int read_utf8(ioinfo *fdinfo, wchar_t *buf, unsigned int count)
void release_ioinfo(ioinfo *info)
int CDECL puts(const char *s)
FILE *CDECL _wfreopen(const wchar_t *path, const wchar_t *mode, FILE *file)
BOOL msvcrt_alloc_buffer(FILE *file)
void msvcrt_init_io(void)
static file_crit * MSVCRT_fstream[MSVCRT_MAX_FILES/MSVCRT_FD_BLOCK_SIZE]
int CDECL putc(int c, FILE *file)
static CRITICAL_SECTION MSVCRT_file_cs
static CRITICAL_SECTION_DEBUG MSVCRT_file_cs_debug
int CDECL _access_s(const char *filename, int mode)
int CDECL _wchmod(const wchar_t *path, int flags)
static int msvcrt_get_flags(const wchar_t *mode, int *open_flags, int *stream_flags)
FILE *CDECL _fsopen(const char *path, const char *mode, int share)
void CDECL _lock_file(FILE *file)
wchar_t *CDECL _wtmpnam(wchar_t *s)
__int64 CDECL _ftelli64(FILE *file)
int CDECL _wsopen_s(int *fd, const wchar_t *path, int oflags, int shflags, int pmode)
int CDECL _sopen_s(int *fd, const char *path, int oflags, int shflags, int pmode)
static void msvcrt_set_fd(ioinfo *fdinfo, HANDLE hand, int flag)
int CDECL _commit(int fd)
static void init_ioinfo_cs(ioinfo *info)
wint_t CDECL getwchar(void)
static int MSVCRT_max_streams
static int check_bom(HANDLE h, int oflags, BOOL seek)
FILE *CDECL freopen(const char *path, const char *mode, FILE *file)
static int msvcrt_flush_buffer(FILE *file)
int CDECL _putw(int val, FILE *file)
__int64 CDECL _lseeki64(int fd, __int64 offset, int whence)
char *CDECL gets(char *buf)
wchar_t *CDECL _wtempnam(const wchar_t *dir, const wchar_t *prefix)
wint_t CDECL _fputwchar(wint_t wc)
int CDECL _umask(int umask)
int CDECL _fputchar(int c)
int * __p___mb_cur_max(void)
int CDECL _wunlink(const wchar_t *path)
int CDECL _wrename(const wchar_t *oldpath, const wchar_t *newpath)
static void msvcrt_free_fd(int fd)
int CDECL _locking(int fd, int mode, LONG nbytes)
FILE *CDECL _fdopen(int fd, const char *mode)
int CDECL rename(const char *oldpath, const char *newpath)
int CDECL _waccess_s(const wchar_t *filename, int mode)
void msvcrt_free_io(void)
int CDECL _waccess(const wchar_t *filename, int mode)
int CDECL _chsize_s(int fd, __int64 size)
FILE *CDECL _wfopen(const wchar_t *path, const wchar_t *mode)
int CDECL _getmaxstdio(void)
static int read_i(int fd, ioinfo *fdinfo, void *buf, unsigned int count)
static ioinfo * get_ioinfo_nolock(int fd)
int CDECL _wopen(const wchar_t *path, int flags,...)
__int64 CDECL _telli64(int fd)
int CDECL _access(const char *filename, int mode)
FILE *CDECL __iob_func(void)
static int msvcrt_flush_all_buffers(int mask)
void CDECL _unlock_file(FILE *file)
static FILE * msvcrt_get_file(int i)
int CDECL _wremove(const wchar_t *path)
static BOOL add_std_buffer(FILE *file)
__int64 CDECL _filelengthi64(int fd)
wchar_t *CDECL _wmktemp(wchar_t *pattern)
int CDECL _wcreat(const wchar_t *path, int flags)
static int get_utf8_char_len(char ch)
static int msvcrt_int_to_base32(int num, char *str)
#define MSVCRT_INTERNAL_BUFSIZ
int CDECL _fseeki64(FILE *file, __int64 offset, int whence)
wint_t CDECL _fgetwchar(void)
static int msvcrt_init_fp(FILE *file, int fd, unsigned stream_flags)
static int msvcrt_int_to_base32_w(int num, wchar_t *str)
int CDECL _isatty(int fd)
FILE *CDECL _wfdopen(int fd, const wchar_t *mode)
int CDECL fopen_s(FILE **pFile, const char *filename, const char *mode)
int CDECL _putws(const wchar_t *s)
unsigned split_oflags(unsigned oflags)
static ioinfo * get_ioinfo_alloc(int *fd)
static BOOL alloc_pioinfo_block(int fd)
int CDECL _wsopen(const wchar_t *path, int oflags, int shflags,...)
int CDECL _wfopen_s(FILE **pFile, const wchar_t *filename, const wchar_t *mode)
int msvcrt_alloc_fd(HANDLE hand, int flag)
static int MSVCRT_stream_idx
int seek(void *fd, ulong off, int mode)
LIST_ENTRY ProcessLocksList
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
struct _LARGE_INTEGER::@2307 u
#define INVALID_FILE_ATTRIBUTES
#define STD_OUTPUT_HANDLE
DWORD WINAPI GetLastError(void)
BOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define FILE_TYPE_UNKNOWN
DWORD WINAPI GetCurrentProcessId(void)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
#define ERROR_BROKEN_PIPE
void int int ULONGLONG int va_list * ap
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)
#define DUPLICATE_SAME_ACCESS
static unsigned int block