ReactOS 0.4.16-dev-2104-gb84fa49
corecrt_io.h File Reference
#include <corecrt_wio.h>
#include <pshpack8.h>
#include <poppack.h>
Include dependency graph for corecrt_io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _finddata32_t
 
struct  _finddata32i64_t
 
struct  _finddata64i32_t
 
struct  _finddata64_t
 

Macros

#define _finddata_t   _finddata64i32_t
 
#define _finddatai64_t   _finddata64_t
 
#define _A_NORMAL   0x00000000
 
#define _A_RDONLY   0x00000001
 
#define _A_HIDDEN   0x00000002
 
#define _A_SYSTEM   0x00000004
 
#define _A_VOLID   0x00000008
 
#define _A_SUBDIR   0x00000010
 
#define _A_ARCH   0x00000020
 
#define _findfirst64i32   _findfirst
 
#define _findfirst64   _findfirsti64
 
#define _findnext64i32   _findnext
 
#define _findnext64   _findnexti64
 

Functions

_ACRTIMP int __cdecl _access (const char *, int)
 
_ACRTIMP int __cdecl _chmod (const char *, int)
 
_ACRTIMP int __cdecl _chsize (int, __msvcrt_long)
 
_ACRTIMP int __cdecl _chsize_s (int, __int64)
 
_ACRTIMP int __cdecl _close (int)
 
_ACRTIMP int __cdecl _creat (const char *, int)
 
_ACRTIMP int __cdecl _dup (int)
 
_ACRTIMP int __cdecl _dup2 (int, int)
 
_ACRTIMP int __cdecl _eof (int)
 
_ACRTIMP __int64 __cdecl _filelengthi64 (int)
 
_ACRTIMP __msvcrt_long __cdecl _filelength (int)
 
_ACRTIMP int __cdecl _findclose (intptr_t)
 
_ACRTIMP intptr_t __cdecl _findfirst (const char *, struct _finddata_t *)
 
_ACRTIMP intptr_t __cdecl _findfirsti64 (const char *, struct _finddatai64_t *)
 
_ACRTIMP intptr_t __cdecl _findfirst64 (const char *, struct _finddata64_t *)
 
_ACRTIMP int __cdecl _findnext (intptr_t, struct _finddata_t *)
 
_ACRTIMP int __cdecl _findnexti64 (intptr_t, struct _finddatai64_t *)
 
_ACRTIMP int __cdecl _findnext64 (intptr_t, struct _finddata64_t *)
 
_ACRTIMP intptr_t __cdecl _get_osfhandle (int)
 
_ACRTIMP int __cdecl _isatty (int)
 
_ACRTIMP int __cdecl _locking (int, int, __msvcrt_long)
 
_ACRTIMP __msvcrt_long __cdecl _lseek (int, __msvcrt_long, int)
 
_ACRTIMP __int64 __cdecl _lseeki64 (int, __int64, int)
 
_ACRTIMP char *__cdecl _mktemp (char *)
 
_ACRTIMP int __cdecl _mktemp_s (char *, size_t)
 
_ACRTIMP int __cdecl _open (const char *, int,...)
 
_ACRTIMP int __cdecl _open_osfhandle (intptr_t, int)
 
_ACRTIMP int __cdecl _pipe (int *, unsigned int, int)
 
_ACRTIMP int __cdecl _read (int, void *, unsigned int)
 
_ACRTIMP int __cdecl _setmode (int, int)
 
_ACRTIMP int __cdecl _sopen (const char *, int, int,...)
 
_ACRTIMP errno_t __cdecl _sopen_dispatch (const char *, int, int, int, int *, int)
 
_ACRTIMP errno_t __cdecl _sopen_s (int *, const char *, int, int, int)
 
_ACRTIMP __msvcrt_long __cdecl _tell (int)
 
_ACRTIMP __int64 __cdecl _telli64 (int)
 
_ACRTIMP int __cdecl _umask (int)
 
_ACRTIMP int __cdecl _unlink (const char *)
 
_ACRTIMP int __cdecl _write (int, const void *, unsigned int)
 
_ACRTIMP int __cdecl remove (const char *)
 
_ACRTIMP int __cdecl rename (const char *, const char *)
 

Macro Definition Documentation

◆ _A_ARCH

#define _A_ARCH   0x00000020

Definition at line 64 of file corecrt_io.h.

◆ _A_HIDDEN

#define _A_HIDDEN   0x00000002

Definition at line 60 of file corecrt_io.h.

◆ _A_NORMAL

#define _A_NORMAL   0x00000000

Definition at line 58 of file corecrt_io.h.

◆ _A_RDONLY

#define _A_RDONLY   0x00000001

Definition at line 59 of file corecrt_io.h.

◆ _A_SUBDIR

#define _A_SUBDIR   0x00000010

Definition at line 63 of file corecrt_io.h.

◆ _A_SYSTEM

#define _A_SYSTEM   0x00000004

Definition at line 61 of file corecrt_io.h.

◆ _A_VOLID

#define _A_VOLID   0x00000008

Definition at line 62 of file corecrt_io.h.

◆ _finddata_t

This file has no copyright assigned and is placed in the Public Domain. This file is part of the Wine project.

Definition at line 17 of file corecrt_io.h.

◆ _finddatai64_t

#define _finddatai64_t   _finddata64_t

Definition at line 18 of file corecrt_io.h.

◆ _findfirst64

#define _findfirst64   _findfirsti64

Definition at line 86 of file corecrt_io.h.

◆ _findfirst64i32

#define _findfirst64i32   _findfirst

Definition at line 85 of file corecrt_io.h.

◆ _findnext64

#define _findnext64   _findnexti64

Definition at line 88 of file corecrt_io.h.

◆ _findnext64i32

#define _findnext64i32   _findnext

Definition at line 87 of file corecrt_io.h.

Function Documentation

◆ _access()

_ACRTIMP int __cdecl _access ( const char filename,
int  mode 
)

Definition at line 990 of file file.c.

991{
992 wchar_t *filenameW = NULL;
993 int ret;
994
995 if (filename && !(filenameW = wstrdupa_utf8(filename))) return -1;
998 return ret;
999}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
int CDECL _waccess(const wchar_t *filename, int mode)
Definition: file.c:1017
static wchar_t * wstrdupa_utf8(const char *str)
Definition: msvcrt.h:440
return ret
Definition: mutex.c:146
GLenum mode
Definition: glext.h:6217
const char * filename
Definition: ioapi.h:137
static const WCHAR filenameW[]
Definition: amstream.c:41

Referenced by _access_s(), _searchenv_s(), access(), HaveSpool(), and MkDirs().

◆ _chmod()

_ACRTIMP int __cdecl _chmod ( const char path,
int  flags 
)

Definition at line 1052 of file file.c.

1053{
1054 wchar_t *pathW = NULL;
1055 int ret;
1056
1057 if (path && !(pathW = wstrdupa_utf8(path))) return -1;
1058 ret = _wchmod(pathW, flags);
1059 free(pathW);
1060 return ret;
1061}
int CDECL _wchmod(const wchar_t *path, int flags)
Definition: file.c:1066
GLbitfield flags
Definition: glext.h:7161

Referenced by chmod(), LoadFirewallPrefs(), OpenBookmarkFile(), OpenTmpBookmarkFile(), OpenTrace(), rw(), SaveHistory(), test_file_write_read(), and test_utf8().

◆ _chsize()

_ACRTIMP int __cdecl _chsize ( int  fd,
__msvcrt_long  size 
)

Definition at line 1663 of file file.c.

1664{
1665 /* _chsize_s returns errno on failure but _chsize should return -1 */
1666 return _chsize_s( fd, size ) == 0 ? 0 : -1;
1667}
int CDECL _chsize_s(int fd, __int64 size)
Definition: file.c:1626
GLsizeiptr size
Definition: glext.h:5919
static int fd
Definition: io.c:51

Referenced by chsize(), ftruncate(), rw(), and test_chsize().

◆ _chsize_s()

_ACRTIMP int __cdecl _chsize_s ( int  fd,
__int64  size 
)

Definition at line 1626 of file file.c.

1627{
1628 ioinfo *info;
1629 __int64 cur, pos;
1630 BOOL ret = FALSE;
1631
1632 TRACE("(fd=%d, size=%#I64x)\n", fd, size);
1633
1634 if (!MSVCRT_CHECK_PMT(size >= 0)) return EINVAL;
1635
1636
1637 info = get_ioinfo(fd);
1638 if (info->handle != INVALID_HANDLE_VALUE)
1639 {
1640 /* save the current file pointer */
1641 cur = _lseeki64(fd, 0, SEEK_CUR);
1642 if (cur >= 0)
1643 {
1645 if (pos >= 0)
1646 {
1647 ret = SetEndOfFile(info->handle);
1649 }
1650
1651 /* restore the file pointer */
1653 }
1654 }
1655
1657 return ret ? 0 : *_errno();
1658}
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1004
int *CDECL _errno(void)
Definition: errno.c:215
__int64 CDECL _lseeki64(int fd, __int64 offset, int whence)
Definition: file.c:1432
static ioinfo * get_ioinfo(int fd)
Definition: file.c:417
static void release_ioinfo(ioinfo *info)
Definition: file.c:514
#define __int64
Definition: corecrt.h:72
#define EINVAL
Definition: errno.h:44
#define SEEK_CUR
Definition: stdio.h:44
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
unsigned int BOOL
Definition: ntddk_ex.h:94
FxCollectionEntry * cur
#define SEEK_SET
Definition: jmemansi.c:26
#define msvcrt_set_errno
Definition: heap.c:50
#define TRACE(s)
Definition: solgame.cpp:4
Definition: file.c:128
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by _chsize().

◆ _close()

_ACRTIMP int __cdecl _close ( int  fd)

Definition at line 1219 of file file.c.

1220{
1222 int ret;
1223
1224 TRACE(":fd (%d) handle (%p)\n", fd, info->handle);
1225
1226 if (fd == MSVCRT_NO_CONSOLE_FD) {
1227 *_errno() = EBADF;
1228 ret = -1;
1229 } else if (!MSVCRT_CHECK_PMT_ERR(info->wxflag & WX_OPEN, EBADF)) {
1230 ret = -1;
1231 } else if (fd == STDOUT_FILENO &&
1234 ret = 0;
1235 } else if (fd == STDERR_FILENO &&
1238 ret = 0;
1239 } else {
1240 ret = CloseHandle(info->handle) ? 0 : -1;
1242 if (ret) {
1243 WARN(":failed-last error (%ld)\n", GetLastError());
1245 }
1246 }
1248 return ret;
1249}
#define WARN(fmt,...)
Definition: precomp.h:61
#define CloseHandle
Definition: compat.h:739
#define WX_OPEN
Definition: file.c:80
static void msvcrt_free_fd(int fd)
Definition: file.c:547
static ioinfo * get_ioinfo_nolock(int fd)
Definition: file.c:394
#define EBADF
Definition: errno.h:32
#define STDOUT_FILENO
Definition: stdio.h:25
#define STDERR_FILENO
Definition: stdio.h:26
#define MSVCRT_NO_CONSOLE_FD
Definition: msvcrt.h:327
#define MSVCRT_CHECK_PMT_ERR(x, err)
Definition: msvcrt.h:377

Referenced by _dup2(), _fclose_nolock(), _pipe(), _Success_(), _tutime(), _utime64(), _wfsopen(), _wpopen(), _wutime64(), anonymous_namespace{stat.cpp}::file_handle_traits::close(), close(), common_popen(), common_popen_nolock(), common_utime(), compat_close(), fclose(), install_from_unix_file(), main(), rd_close_file(), run_open_osfhandle(), rw(), test__creat(), test__popen(), test__sopen_dispatch(), test__sopen_s(), test_chsize(), test_file_write_read(), test_get_osfhandle(), test_lseek(), test_setmode(), and tmpfile().

◆ _creat()

_ACRTIMP int __cdecl _creat ( const char path,
int  pmode 
)

Definition at line 2693 of file file.c.

2694{
2695 int flags = _O_CREAT | _O_TRUNC | _O_RDWR;
2696 return _open(path, flags, pmode);
2697}
#define _O_RDWR
Definition: cabinet.h:39
#define _O_TRUNC
Definition: cabinet.h:47
#define _O_CREAT
Definition: cabinet.h:46
int WINAPIV _open(const char *path, int flags,...)
Definition: file.c:2655

Referenced by creat(), test__creat(), and test_lseek().

◆ _dup()

_ACRTIMP int __cdecl _dup ( int  od)

Definition at line 1317 of file file.c.

1318{
1319 int fd, ret;
1321
1322 if (_dup2(od, fd) == 0)
1323 ret = fd;
1324 else
1325 ret = -1;
1327 return ret;
1328}
int CDECL _dup2(int od, int nd)
Definition: file.c:1258
static ioinfo * get_ioinfo_alloc(int *fd)
Definition: file.c:481

Referenced by _wpopen(), DllMain(), dup(), test_std_stream_buffering(), test_std_stream_open(), and test_stdin().

◆ _dup2()

_ACRTIMP int __cdecl _dup2 ( int  od,
int  nd 
)

Definition at line 1258 of file file.c.

1259{
1260 ioinfo *info_od, *info_nd;
1261 int ret;
1262
1263 TRACE("(od=%d, nd=%d)\n", od, nd);
1264
1265 if (od < nd)
1266 {
1267 info_od = get_ioinfo(od);
1268 info_nd = get_ioinfo_alloc_fd(nd);
1269 }
1270 else
1271 {
1272 info_nd = get_ioinfo_alloc_fd(nd);
1273 info_od = get_ioinfo(od);
1274 }
1275
1276 if (info_nd == &MSVCRT___badioinfo)
1277 {
1278 *_errno() = EBADF;
1279 ret = -1;
1280 }
1281 else if (info_od->wxflag & WX_OPEN)
1282 {
1283 HANDLE handle;
1284
1287 {
1288 int wxflag = info_od->wxflag & ~WX_DONTINHERIT;
1289
1290 if (info_nd->wxflag & WX_OPEN)
1291 _close(nd);
1292
1293 msvcrt_set_fd(info_nd, handle, wxflag);
1294 /* _dup2 returns 0, not nd, on success */
1295 ret = 0;
1296 }
1297 else
1298 {
1299 ret = -1;
1301 }
1302 }
1303 else
1304 {
1305 *_errno() = EBADF;
1306 ret = -1;
1307 }
1308
1309 release_ioinfo(info_od);
1310 release_ioinfo(info_nd);
1311 return ret;
1312}
#define TRUE
Definition: types.h:120
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
static ioinfo * get_ioinfo_alloc_fd(int fd)
Definition: file.c:467
ioinfo MSVCRT___badioinfo
Definition: file.c:148
int CDECL _close(int fd)
Definition: file.c:1219
static void msvcrt_set_fd(ioinfo *fdinfo, HANDLE hand, int flag)
Definition: file.c:576
unsigned char wxflag
Definition: file.c:130
HANDLE handle
Definition: file.c:129
#define DUPLICATE_SAME_ACCESS

Referenced by _dup(), _tWinMain(), DllMain(), dup2(), test_dup2(), test_stat(), test_std_stream_buffering(), test_std_stream_open(), and test_stdin().

◆ _eof()

_ACRTIMP int __cdecl _eof ( int  fd)

Definition at line 1333 of file file.c.

1334{
1336 DWORD curpos,endpos;
1337 LONG hcurpos,hendpos;
1338
1339 TRACE(":fd (%d) handle (%p)\n", fd, info->handle);
1340
1341 if (info->handle == INVALID_HANDLE_VALUE)
1342 {
1344 return -1;
1345 }
1346
1347 if (info->wxflag & WX_ATEOF)
1348 {
1350 return TRUE;
1351 }
1352
1353 /* Otherwise we do it the hard way */
1354 hcurpos = hendpos = 0;
1355 curpos = SetFilePointer(info->handle, 0, &hcurpos, FILE_CURRENT);
1356 endpos = SetFilePointer(info->handle, 0, &hendpos, FILE_END);
1357
1358 if (curpos == endpos && hcurpos == hendpos)
1359 {
1360 /* FIXME: shouldn't WX_ATEOF be set here? */
1362 return TRUE;
1363 }
1364
1365 SetFilePointer(info->handle, curpos, &hcurpos, FILE_BEGIN);
1367 return FALSE;
1368}
#define FILE_BEGIN
Definition: compat.h:761
#define SetFilePointer
Definition: compat.h:743
#define WX_ATEOF
Definition: file.c:81
unsigned long DWORD
Definition: ntddk_ex.h:95
long LONG
Definition: pedump.c:60
#define FILE_END
Definition: winbase.h:116
#define FILE_CURRENT
Definition: winbase.h:115

Referenced by eof().

◆ _filelength()

_ACRTIMP __msvcrt_long __cdecl _filelength ( int  fd)

Definition at line 1887 of file file.c.

1888{
1889 LONG curPos = _lseek(fd, 0, SEEK_CUR);
1890 if (curPos != -1)
1891 {
1892 LONG endPos = _lseek(fd, 0, SEEK_END);
1893 if (endPos != -1)
1894 {
1895 if (endPos != curPos)
1896 _lseek(fd, curPos, SEEK_SET);
1897 return endPos;
1898 }
1899 }
1900 return -1;
1901}
#define SEEK_END
Definition: cabinet.c:29
__msvcrt_long CDECL _lseek(int fd, __msvcrt_long offset, int whence)
Definition: file.c:1479

Referenced by filelength(), File::length(), and test_chsize().

◆ _filelengthi64()

_ACRTIMP __int64 __cdecl _filelengthi64 ( int  fd)

Definition at line 1906 of file file.c.

1907{
1908 __int64 curPos = _lseeki64(fd, 0, SEEK_CUR);
1909 if (curPos != -1)
1910 {
1911 __int64 endPos = _lseeki64(fd, 0, SEEK_END);
1912 if (endPos != -1)
1913 {
1914 if (endPos != curPos)
1915 _lseeki64(fd, curPos, SEEK_SET);
1916 return endPos;
1917 }
1918 }
1919 return -1;
1920}

◆ _findclose()

_ACRTIMP int __cdecl _findclose ( intptr_t  hand)

Definition at line 298 of file dir.c.

299{
300 TRACE(":handle %Iu\n",hand);
301 if (!FindClose((HANDLE)hand))
302 {
304 return -1;
305 }
306 return 0;
307}
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by _findfirst32(), _findfirst64(), _findfirst64i32(), main(), and test_utf8().

◆ _findfirst()

_ACRTIMP intptr_t __cdecl _findfirst ( const char fspec,
struct _finddata_t ft 
)

Definition at line 326 of file dir.c.

327{
329 HANDLE hfind;
330
331 hfind = FindFirstFileA(fspec, &find_data);
332 if (hfind == INVALID_HANDLE_VALUE)
333 {
335 return -1;
336 }
338 TRACE(":got handle %p\n",hfind);
339 return (intptr_t)hfind;
340}
static int find_data(const struct Vector *v, const BYTE *pData, int size)
Definition: filtermapper.c:162
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
static void msvcrt_fttofd(const WIN32_FIND_DATAA *fd, struct _finddata_t *ft)
Definition: dir.c:61
int intptr_t
Definition: corecrt.h:176

◆ _findfirst64()

_ACRTIMP intptr_t __cdecl _findfirst64 ( const char fspec,
struct _finddata64_t ft 
)

Definition at line 471 of file dir.c.

472{
473 struct _wfinddata64_t wft;
474 wchar_t *fspecW = NULL;
476
477 if (fspec && !(fspecW = wstrdupa_utf8(fspec))) return -1;
478 ret = _wfindfirst64(fspecW, &wft);
479 free(fspecW);
480 if (ret != -1 && !finddata64_wtoa(&wft, ft))
481 {
483 return -1;
484 }
485 return ret;
486}
static int finddata64_wtoa(const struct _wfinddata64_t *wfd, struct _finddata64_t *fd)
Definition: dir.c:456
int CDECL _findclose(intptr_t hand)
Definition: dir.c:298
#define _wfindfirst64
Definition: corecrt_wio.h:79

◆ _findfirsti64()

_ACRTIMP intptr_t __cdecl _findfirsti64 ( const char fspec,
struct _finddatai64_t ft 
)

Definition at line 419 of file dir.c.

420{
422 HANDLE hfind;
423
424 hfind = FindFirstFileA(fspec, &find_data);
425 if (hfind == INVALID_HANDLE_VALUE)
426 {
428 return -1;
429 }
431 TRACE(":got handle %p\n",hfind);
432 return (intptr_t)hfind;
433}
static void msvcrt_fttofdi64(const WIN32_FIND_DATAA *fd, struct _finddatai64_t *ft)
Definition: dir.c:121

◆ _findnext()

_ACRTIMP int __cdecl _findnext ( intptr_t  hand,
struct _finddata_t ft 
)

Definition at line 578 of file dir.c.

579{
581
582 if (!FindNextFileA((HANDLE)hand, &find_data))
583 {
584 *_errno() = ENOENT;
585 return -1;
586 }
587
589 return 0;
590}
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:336
#define ENOENT
Definition: errno.h:25

◆ _findnext64()

_ACRTIMP int __cdecl _findnext64 ( intptr_t  hand,
struct _finddata64_t ft 
)

Definition at line 684 of file dir.c.

685{
686 struct _wfinddata64_t wft;
687 int ret;
688
689 ret = _wfindnext64(hand, &wft);
690 if (!ret && !finddata64_wtoa(&wft, ft)) ret = -1;
691 return ret;
692}
#define _wfindnext64
Definition: corecrt_wio.h:81

◆ _findnexti64()

_ACRTIMP int __cdecl _findnexti64 ( intptr_t  hand,
struct _finddatai64_t ft 
)

Definition at line 646 of file dir.c.

647{
649
650 if (!FindNextFileA((HANDLE)hand, &find_data))
651 {
652 *_errno() = ENOENT;
653 return -1;
654 }
655
657 return 0;
658}

◆ _get_osfhandle()

◆ _isatty()

_ACRTIMP int __cdecl _isatty ( int  fd)

◆ _locking()

_ACRTIMP int __cdecl _locking ( int  fd,
int  mode,
__msvcrt_long  nbytes 
)

Definition at line 1513 of file file.c.

1514{
1516 BOOL ret;
1517 DWORD cur_locn;
1518
1519 TRACE(":fd (%d) handle (%p)\n", fd, info->handle);
1520 if (info->handle == INVALID_HANDLE_VALUE)
1521 {
1523 return -1;
1524 }
1525
1526 if (mode < 0 || mode > 4)
1527 {
1529 *_errno() = EINVAL;
1530 return -1;
1531 }
1532
1533 TRACE(":fd (%d) by %#lx mode %s\n",
1534 fd, nbytes, (mode == _LK_UNLCK) ? "_LK_UNLCK" :
1535 (mode == _LK_LOCK) ? "_LK_LOCK" :
1536 (mode == _LK_NBLCK) ? "_LK_NBLCK" :
1537 (mode == _LK_RLCK) ? "_LK_RLCK" :
1538 (mode == _LK_NBRLCK) ? "_LK_NBRLCK" :
1539 "UNKNOWN");
1540
1541 if ((cur_locn = SetFilePointer(info->handle, 0L, NULL, FILE_CURRENT)) == INVALID_SET_FILE_POINTER)
1542 {
1544 FIXME("Seek failed\n");
1545 *_errno() = EINVAL; /* FIXME */
1546 return -1;
1547 }
1548 if (mode == _LK_LOCK || mode == _LK_RLCK)
1549 {
1550 int nretry = 10;
1551 ret = 1; /* just to satisfy gcc */
1552 while (nretry--)
1553 {
1554 ret = LockFile(info->handle, cur_locn, 0L, nbytes, 0L);
1555 if (ret) break;
1556 Sleep(1);
1557 }
1558 }
1559 else if (mode == _LK_UNLCK)
1560 ret = UnlockFile(info->handle, cur_locn, 0L, nbytes, 0L);
1561 else
1562 ret = LockFile(info->handle, cur_locn, 0L, nbytes, 0L);
1563 /* FIXME - what about error settings? */
1565 return ret ? 0 : -1;
1566}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
BOOL WINAPI UnlockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToUnlockLow, IN DWORD nNumberOfBytesToUnlockHigh)
Definition: lock.c:142
BOOL WINAPI LockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToLockLow, IN DWORD nNumberOfBytesToLockHigh)
Definition: lock.c:25
#define _LK_LOCK
Definition: locking.h:27
#define _LK_UNLCK
Definition: locking.h:26
#define _LK_RLCK
Definition: locking.h:29
#define _LK_NBRLCK
Definition: locking.h:30
#define _LK_NBLCK
Definition: locking.h:28
#define L(x)
Definition: resources.c:13
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790

Referenced by locking().

◆ _lseek()

_ACRTIMP __msvcrt_long __cdecl _lseek ( int  fd,
__msvcrt_long  offset,
int  whence 
)

Definition at line 1479 of file file.c.

1480{
1481 return _lseeki64(fd, offset, whence);
1482}
GLintptr offset
Definition: glext.h:5920

Referenced by _filelength(), _tell(), _write(), lseek(), rd_lseek_file(), rw(), test__creat(), test_chsize(), test_fflush(), test_file_write_read(), and test_lseek().

◆ _lseeki64()

_ACRTIMP __int64 __cdecl _lseeki64 ( int  fd,
__int64  offset,
int  whence 
)

Definition at line 1432 of file file.c.

1433{
1435 LARGE_INTEGER ofs;
1436
1437 TRACE(":fd (%d) handle (%p)\n", fd, info->handle);
1438
1439 if (info->handle == INVALID_HANDLE_VALUE)
1440 {
1441 *_errno() = EBADF;
1443 return -1;
1444 }
1445
1446 if (whence < 0 || whence > 2)
1447 {
1449 *_errno() = EINVAL;
1450 return -1;
1451 }
1452
1453 TRACE(":fd (%d) to %#I64x pos %s\n",
1454 fd, offset, (whence == SEEK_SET) ? "SEEK_SET" :
1455 (whence == SEEK_CUR) ? "SEEK_CUR" :
1456 (whence == SEEK_END) ? "SEEK_END" : "UNKNOWN");
1457
1458 /* The MoleBox protection scheme expects msvcrt to use SetFilePointer only,
1459 * so a LARGE_INTEGER offset cannot be passed directly via SetFilePointerEx. */
1460 ofs.QuadPart = offset;
1461 if ((ofs.u.LowPart = SetFilePointer(info->handle, ofs.u.LowPart, &ofs.u.HighPart, whence)) != INVALID_SET_FILE_POINTER ||
1463 {
1464 info->wxflag &= ~WX_ATEOF;
1465 /* FIXME: What if we seek _to_ EOF - is EOF set? */
1466
1468 return ofs.QuadPart;
1469 }
1471 TRACE(":error-last error (%ld)\n", GetLastError());
1473 return -1;
1474}
#define ERROR_SUCCESS
Definition: deptool.c:10
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2493 u

Referenced by _chsize_s(), _filelengthi64(), _fseeki64(), _fseeki64_nolock(), _ftelli64(), _ftelli64_nolock(), _lseek(), _telli64(), fsetpos(), and write_buffer_nolock().

◆ _mktemp()

_ACRTIMP char *__cdecl _mktemp ( char pattern)

Definition at line 2176 of file file.c.

2177{
2178 wchar_t *pathW, *p;
2179 int numX = 0;
2180 char *retVal = pattern;
2181 int id;
2182 char letter = 'a';
2183
2184 if(!pattern)
2185 return NULL;
2186
2187 while(*pattern)
2188 numX = (*pattern++ == 'X')? numX + 1 : 0;
2189 if (numX < 6)
2190 return NULL;
2191 pattern--;
2192 id = GetCurrentProcessId();
2193 numX = 6;
2194 while(numX--)
2195 {
2196 int tempNum = id / 10;
2197 *pattern-- = id - (tempNum * 10) + '0';
2198 id = tempNum;
2199 }
2200 pattern++;
2201 if (!(pathW = wstrdupa_utf8(retVal)))
2202 return NULL;
2203 p = pathW + wcslen(pathW) - 6;
2204 do
2205 {
2206 *p = letter++;
2208 {
2209 *pattern = *p;
2210 free(pathW);
2211 return retVal;
2212 }
2213 } while(letter <= 'z');
2214 free(pathW);
2215 return NULL;
2216}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
GLubyte * pattern
Definition: glext.h:7787
GLfloat GLfloat p
Definition: glext.h:8902
GLuint id
Definition: glext.h:5910
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158

Referenced by mktemp(), test_mktemp(), and test_utf8().

◆ _mktemp_s()

_ACRTIMP int __cdecl _mktemp_s ( char pattern,
size_t  size 
)

Definition at line 2130 of file file.c.

2131{
2132 DWORD len, wlen, xno, id;
2133 wchar_t *pathW;
2134
2136 return EINVAL;
2137
2138 for(len=0; len<size; len++)
2139 if(!pattern[len])
2140 break;
2141 if(!MSVCRT_CHECK_PMT(len!=size && len>=6)) {
2142 if(size)
2143 pattern[0] = 0;
2144 return EINVAL;
2145 }
2146
2147 for(xno=1; xno<=6; xno++)
2148 if(!MSVCRT_CHECK_PMT(pattern[len-xno] == 'X'))
2149 return EINVAL;
2150
2151 id = GetCurrentProcessId();
2152 for(xno=1; xno<6; xno++) {
2153 pattern[len-xno] = id%10 + '0';
2154 id /= 10;
2155 }
2156
2157 if(!(pathW = wstrdupa_utf8(pattern))) return *_errno();
2158 wlen = wcslen(pathW);
2159 for(pathW[wlen-6]='a'; pathW[wlen-6]<='z'; pathW[wlen-6]++) {
2161 pattern[len-6] = pathW[wlen-6];
2162 free(pathW);
2163 return 0;
2164 }
2165 }
2166 free(pathW);
2167
2168 pattern[0] = 0;
2169 *_errno() = EEXIST;
2170 return EEXIST;
2171}
#define EEXIST
Definition: errno.h:39
GLenum GLsizei len
Definition: glext.h:6722

Referenced by test_utf8().

◆ _open()

_ACRTIMP int __cdecl _open ( const char path,
int  flags,
  ... 
)

Definition at line 2655 of file file.c.

2656{
2657 va_list ap;
2658
2659 if (flags & _O_CREAT)
2660 {
2661 int pmode;
2662 va_start(ap, flags);
2663 pmode = va_arg(ap, int);
2664 va_end(ap);
2665 return _sopen( path, flags, _SH_DENYNO, pmode );
2666 }
2667 else
2668 return _sopen( path, flags, _SH_DENYNO);
2669}
int WINAPIV _sopen(const char *path, int oflags, int shflags,...)
Definition: file.c:2633
#define _SH_DENYNO
Definition: share.h:40
#define va_end(v)
Definition: stdarg.h:28
#define va_arg(v, l)
Definition: stdarg.h:27
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ _open_osfhandle()

_ACRTIMP int __cdecl _open_osfhandle ( intptr_t  handle,
int  oflags 
)

Definition at line 2711 of file file.c.

2712{
2713 DWORD flags;
2714 int fd;
2715
2716 /* _O_RDONLY (0) always matches, so set the read flag
2717 * MFC's CStdioFile clears O_RDONLY (0)! if it wants to write to the
2718 * file, so set the write flag. It also only sets _O_TEXT if it wants
2719 * text - it never sets _O_BINARY.
2720 */
2721 /* don't let split_oflags() decide the mode if no mode is passed */
2722 if (!(oflags & (_O_BINARY | _O_TEXT)))
2723 oflags |= _O_BINARY;
2724
2727 {
2729 return -1;
2730 }
2731
2732 if (flags == FILE_TYPE_CHAR)
2733 flags = WX_TTY;
2734 else if (flags == FILE_TYPE_PIPE)
2735 flags = WX_PIPE;
2736 else
2737 flags = 0;
2738 flags |= split_oflags(oflags);
2739
2741 TRACE(":handle (%Iu) fd (%d) flags %#lx\n", handle, fd, flags);
2742 return fd;
2743}
#define NO_ERROR
Definition: dderror.h:5
#define _O_BINARY
Definition: cabinet.h:51
#define _O_TEXT
Definition: cabinet.h:50
DWORD WINAPI GetFileType(HANDLE hFile)
Definition: fileinfo.c:269
static unsigned split_oflags(unsigned oflags)
Definition: file.c:2293
static int msvcrt_alloc_fd(HANDLE hand, int flag)
Definition: file.c:598
#define WX_PIPE
Definition: file.c:83
#define FILE_TYPE_UNKNOWN
Definition: winbase.h:282
#define FILE_TYPE_CHAR
Definition: winbase.h:284
#define FILE_TYPE_PIPE
Definition: winbase.h:285

Referenced by _tWinMain(), ConStreamSetOSHandle(), run_open_osfhandle(), test__open_osfhandle(), and test_close().

◆ _pipe()

_ACRTIMP int __cdecl _pipe ( int pfds,
unsigned int  psize,
int  textmode 
)

Definition at line 2323 of file file.c.

2324{
2325 int ret = -1;
2327 HANDLE readHandle, writeHandle;
2328
2329 if (!pfds)
2330 {
2331 *_errno() = EINVAL;
2332 return -1;
2333 }
2334
2335 sa.nLength = sizeof(SECURITY_ATTRIBUTES);
2336 sa.bInheritHandle = !(textmode & _O_NOINHERIT);
2337 sa.lpSecurityDescriptor = NULL;
2338 if (CreatePipe(&readHandle, &writeHandle, &sa, psize))
2339 {
2340 unsigned int wxflags = split_oflags(textmode);
2341 int fd;
2342
2343 fd = msvcrt_alloc_fd(readHandle, wxflags|WX_PIPE);
2344 if (fd != -1)
2345 {
2346 pfds[0] = fd;
2347 fd = msvcrt_alloc_fd(writeHandle, wxflags|WX_PIPE);
2348 if (fd != -1)
2349 {
2350 pfds[1] = fd;
2351 ret = 0;
2352 }
2353 else
2354 {
2355 _close(pfds[0]);
2356 CloseHandle(writeHandle);
2357 *_errno() = EMFILE;
2358 }
2359 }
2360 else
2361 {
2362 CloseHandle(readHandle);
2363 CloseHandle(writeHandle);
2364 *_errno() = EMFILE;
2365 }
2366 }
2367 else
2369
2370 return ret;
2371}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define _O_NOINHERIT
Definition: cabinet.h:45
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
textmode
Definition: file.c:95
#define EMFILE
Definition: errno.h:46
BOOL WINAPI CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
Definition: npipe.c:117
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569

Referenced by _wpopen(), common_popen(), fork_helper(), test_file_inherit(), test_pipes(), and test_stat().

◆ _read()

_ACRTIMP int __cdecl _read ( int  fd,
void buf,
unsigned int  count 
)

Definition at line 3127 of file file.c.

3128{
3129 ioinfo *info;
3130 int num_read;
3131
3132 if(fd == MSVCRT_NO_CONSOLE_FD) {
3133 *_errno() = EBADF;
3134 return -1;
3135 }
3136
3137 info = get_ioinfo(fd);
3138 num_read = read_i(fd, info, buf, count);
3140 return num_read;
3141}
static int read_i(int fd, ioinfo *fdinfo, void *buf, unsigned int count)
Definition: file.c:2964
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by _filbuf(), _fread_nolock(), common_refill_and_read_nolock(), fread(), rd_read_file(), read(), read_pipe_thread(), rw(), test__creat(), and test_file_write_read().

◆ _setmode()

_ACRTIMP int __cdecl _setmode ( int  fd,
int  mode 
)

Definition at line 3146 of file file.c.

3147{
3149 int ret = info->wxflag & WX_TEXT ? _O_TEXT : _O_BINARY;
3150
3152 ret = _O_WTEXT;
3153
3155 && mode!=_O_U16TEXT && mode!=_O_U8TEXT) {
3156 *_errno() = EINVAL;
3158 return -1;
3159 }
3160
3161 if(info == &MSVCRT___badioinfo) {
3162 *_errno() = EBADF;
3163 return EOF;
3164 }
3165
3166 if(mode == _O_BINARY) {
3167 info->wxflag &= ~WX_TEXT;
3170 return ret;
3171 }
3172
3173 info->wxflag |= WX_TEXT;
3174 if(mode == _O_TEXT)
3176 else if(mode == _O_U8TEXT)
3178 else
3180
3182 return ret;
3183}
static void ioinfo_set_textmode(ioinfo *info, enum textmode mode)
Definition: file.c:220
static enum textmode ioinfo_get_textmode(ioinfo *info)
Definition: file.c:211
@ TEXTMODE_ANSI
Definition: file.c:96
@ TEXTMODE_UTF16LE
Definition: file.c:98
@ TEXTMODE_UTF8
Definition: file.c:97
#define WX_TEXT
Definition: file.c:87
#define _O_WTEXT
Definition: fcntl.h:30
#define _O_U8TEXT
Definition: fcntl.h:32
#define _O_U16TEXT
Definition: fcntl.h:31
#define EOF
Definition: stdio.h:33

◆ _sopen()

_ACRTIMP int __cdecl _sopen ( const char path,
int  oflags,
int  shflags,
  ... 
)

Definition at line 2633 of file file.c.

2634{
2635 int pmode;
2636 int fd;
2637
2638 if (oflags & _O_CREAT)
2639 {
2640 va_list ap;
2641
2642 va_start(ap, shflags);
2643 pmode = va_arg(ap, int);
2644 va_end(ap);
2645 }
2646 else
2647 pmode = 0;
2648
2649 return _sopen_dispatch(path, oflags, shflags, pmode, &fd, 0) ? -1 : fd;
2650}
int CDECL _sopen_dispatch(const char *path, int oflags, int shflags, int pmode, int *fd, int secure)
Definition: file.c:2606

◆ _sopen_dispatch()

_ACRTIMP errno_t __cdecl _sopen_dispatch ( const char path,
int  oflags,
int  shflags,
int  pmode,
int fd,
int  secure 
)

Definition at line 2606 of file file.c.

2608{
2609 wchar_t *pathW = NULL;
2610 int ret;
2611
2612 if (!MSVCRT_CHECK_PMT(fd != NULL))
2613 return EINVAL;
2614 *fd = -1;
2615 if (path && !(pathW = wstrdupa_utf8(path))) return *_errno();
2616
2617 ret = _wsopen_dispatch(pathW, oflags, shflags, pmode, fd, secure);
2618 free(pathW);
2619 return ret;
2620}
int CDECL _wsopen_dispatch(const wchar_t *path, int oflags, int shflags, int pmode, int *fd, int secure)
Definition: file.c:2397
static int secure
Definition: server.c:157

Referenced by _sopen(), _sopen_s(), and test__sopen_dispatch().

◆ _sopen_s()

_ACRTIMP errno_t __cdecl _sopen_s ( int fd,
const char path,
int  oflags,
int  shflags,
int  pmode 
)

Definition at line 2625 of file file.c.

2626{
2627 return _sopen_dispatch(path, oflags, shflags, pmode, fd, 1);
2628}

Referenced by _sopen(), _Success_(), and test__sopen_s().

◆ _tell()

Definition at line 3425 of file file.c.

3426{
3427 return _lseek(fd, 0, SEEK_CUR);
3428}

Referenced by tell(), and test__creat().

◆ _telli64()

_ACRTIMP __int64 __cdecl _telli64 ( int  fd)

Definition at line 3433 of file file.c.

3434{
3435 return _lseeki64(fd, 0, SEEK_CUR);
3436}

Referenced by _ftelli64(), _ftelli64_nolock(), and test_std_stream_buffering().

◆ _umask()

_ACRTIMP int __cdecl _umask ( int  umask)

Definition at line 3486 of file file.c.

3487{
3488 int old_umask = MSVCRT_umask;
3489 TRACE("(%d)\n",umask);
3491 return old_umask;
3492}
static int MSVCRT_umask
Definition: file.c:282
static int umask(int fd)
Definition: io.h:31

◆ _unlink()

_ACRTIMP int __cdecl _unlink ( const char path)

Definition at line 1085 of file file.c.

1086{
1087 wchar_t *pathW = NULL;
1088 int ret;
1089
1090 if (path && !(pathW = wstrdupa_utf8(path))) return -1;
1091 ret = _wunlink(pathW);
1092 free(pathW);
1093 return ret;
1094}
int CDECL _wunlink(const wchar_t *path)
Definition: file.c:1099

◆ _write()

_ACRTIMP int __cdecl _write ( int  fd,
const void buf,
unsigned int  count 
)

Definition at line 3561 of file file.c.

3562{
3564 HANDLE hand = info->handle;
3565 DWORD num_written, i;
3566 BOOL console = FALSE;
3567
3569 {
3570 *_errno() = EBADF;
3572 return -1;
3573 }
3574
3576 {
3577 *_errno() = EINVAL;
3579 return -1;
3580 }
3581
3582 /* If appending, go to EOF */
3583 if (info->wxflag & WX_APPEND)
3584 _lseek(fd, 0, FILE_END);
3585
3586 if (!(info->wxflag & WX_TEXT))
3587 {
3588 if (!WriteFile(hand, buf, count, &num_written, NULL)
3589 || num_written != count)
3590 {
3591 TRACE("WriteFile (fd %d, hand %p) failed-last error (%ld)\n", fd,
3592 hand, GetLastError());
3595 *_errno() = EBADF;
3596 num_written = -1;
3597 }
3598
3600 return num_written;
3601 }
3602
3603 if (_isatty(fd)) console = VerifyConsoleIoHandle(hand);
3604 for (i = 0; i < count;)
3605 {
3606 const char *s = buf;
3607 char lfbuf[2048];
3608 DWORD j = 0;
3609
3610 if (ioinfo_get_textmode(info) == TEXTMODE_ANSI && console)
3611 {
3612 char conv[sizeof(lfbuf)];
3613 size_t len = 0;
3614
3615#if _MSVCR_VER >= 80
3616 if (info->dbcsBufferUsed)
3617 {
3618 conv[j++] = info->dbcsBuffer[0];
3619 info->dbcsBufferUsed = FALSE;
3620 conv[j++] = s[i++];
3621 len++;
3622 }
3623#endif
3624
3625 for (; i < count && j < sizeof(conv)-1 &&
3626 len < (sizeof(lfbuf) - 1) / sizeof(WCHAR); i++, j++, len++)
3627 {
3628 if (isleadbyte((unsigned char)s[i]))
3629 {
3630 conv[j++] = s[i++];
3631
3632 if (i == count)
3633 {
3634#if _MSVCR_VER >= 80
3635 info->dbcsBuffer[0] = conv[j-1];
3636 info->dbcsBufferUsed = TRUE;
3637 break;
3638#else
3639 *_errno() = EINVAL;
3641 return -1;
3642#endif
3643 }
3644 }
3645 else if (s[i] == '\n')
3646 {
3647 conv[j++] = '\r';
3648 len++;
3649 }
3650 conv[j] = s[i];
3651 }
3652
3653 len = mbstowcs((WCHAR*)lfbuf, conv, len);
3654 if (len == -1)
3655 {
3658 return -1;
3659 }
3660 j = len * 2;
3661 }
3663 {
3664 for (j = 0; i < count && j < sizeof(lfbuf)-1; i++, j++)
3665 {
3666 if (s[i] == '\n')
3667 lfbuf[j++] = '\r';
3668 lfbuf[j] = s[i];
3669 }
3670 }
3671 else if (ioinfo_get_textmode(info) == TEXTMODE_UTF16LE || console)
3672 {
3673 for (j = 0; i < count && j < sizeof(lfbuf)-3; i++, j++)
3674 {
3675 if (s[i] == '\n' && !s[i+1])
3676 {
3677 lfbuf[j++] = '\r';
3678 lfbuf[j++] = 0;
3679 }
3680 lfbuf[j++] = s[i++];
3681 lfbuf[j] = s[i];
3682 }
3683 }
3684 else
3685 {
3686 char conv[sizeof(lfbuf)/4];
3687
3688 for (j = 0; i < count && j < sizeof(conv)-3; i++, j++)
3689 {
3690 if (s[i] == '\n' && !s[i+1])
3691 {
3692 conv[j++] = '\r';
3693 conv[j++] = 0;
3694 }
3695 conv[j++] = s[i++];
3696 conv[j] = s[i];
3697 }
3698
3699 j = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)conv, j/2, lfbuf, sizeof(lfbuf), NULL, NULL);
3700 if (!j)
3701 {
3704 return -1;
3705 }
3706 }
3707
3708 if (console)
3709 {
3710 j = j/2;
3711 if (!WriteConsoleW(hand, lfbuf, j, &num_written, NULL))
3712 num_written = -1;
3713 }
3714 else if (!WriteFile(hand, lfbuf, j, &num_written, NULL))
3715 {
3716 num_written = -1;
3717 }
3718
3719 if (num_written != j)
3720 {
3721 TRACE("WriteFile/WriteConsoleW (fd %d, hand %p) failed-last error (%ld)\n", fd,
3722 hand, GetLastError());
3725 *_errno() = EBADF;
3727 return -1;
3728 }
3729 }
3730
3732 return count;
3733}
#define WideCharToMultiByte
Definition: compat.h:111
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1112
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
int CDECL _isatty(int fd)
Definition: file.c:858
#define WX_APPEND
Definition: file.c:85
GLdouble s
Definition: gl.h:2039
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
Definition: glfuncs.h:248
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
Definition: glfuncs.h:250
#define isleadbyte(_c)
Definition: wchar.h:598
#define CP_UTF8
Definition: nls.h:20
mbstowcs
Definition: stdlib.h:925
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _flsbuf(), _fwrite_nolock(), _putw(), configure_text_mode(), fwrite(), msvcrt_flush_buffer(), perror(), rd_write_file(), rw(), test__creat(), test_chsize(), test_file_inherit(), test_file_write_read(), test_lseek(), and write().

◆ remove()

_ACRTIMP int __cdecl remove ( const char path)

Definition at line 4957 of file file.c.

4958{
4959 return _unlink(path);
4960}
int CDECL _unlink(const char *path)
Definition: file.c:1085

◆ rename()

_ACRTIMP int __cdecl rename ( const char oldpath,
const char newpath 
)

Definition at line 4973 of file file.c.

4974{
4975 wchar_t *oldpathW = NULL, *newpathW = NULL;
4976 int ret;
4977
4978 if (oldpath && !(oldpathW = wstrdupa_utf8(oldpath))) return -1;
4979 if (newpath && !(newpathW = wstrdupa_utf8(newpath)))
4980 {
4981 free(oldpathW);
4982 return -1;
4983 }
4984 ret = _wrename(oldpathW, newpathW);
4985 free(oldpathW);
4986 free(newpathW);
4987 return ret;
4988}
int CDECL _wrename(const wchar_t *oldpath, const wchar_t *newpath)
Definition: file.c:4993