Commit Graph

461 Commits

Author SHA1 Message Date
Piotr Caban 855668221d msvcrt: Reset buffer in fflush on error.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 17:16:26 +02:00
Daniel Lehman 44b49f1a40 msvcrt: Set errno in _lseeki64.
Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-31 00:33:46 +01:00
Piotr Caban 3577f06f71 msvcrt: Fix _putws implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47615
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-30 18:18:22 +02:00
Jacek Caban 873a90e6f3 msvcrt: Avoid conflict with mingw __iob_func declaration.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-09 18:11:16 +02:00
Jacek Caban a0c424b111 msvcrt: Use __iob_func instead of __p__iob in __acrt_iob_func implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-09 01:58:36 +02:00
Alexandre Julliard b5408ff58c msvcrt: Don't set invalid std handles with kernel32.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-09 14:07:10 +02:00
Alexandre Julliard 62fd803e52 msvcrt: Only add __acrt_iob_func() to the import library of msvcrt itself.
This partially reverts ca50117418.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-29 11:41:39 +01:00
Alexandre Julliard ca50117418 msvcrt: Export the __acrt_iob_func function from the import library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 20:24:01 +01:00
Piotr Caban 3f675c1a9d msvcrt: Use internal toupper implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:50:32 +01:00
Piotr Caban 834134f284 msvcrt: Use internal tolower implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:50:30 +01:00
Piotr Caban 513eb41f9a msvcrt: Correctly set _stat64.st_dev fields in _wstat64.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-18 10:12:07 +01:00
Alexandre Julliard dd016c031a msvcrt: Add some more MSVCRT prefixes to avoid conflicts with recent Mingw.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-14 18:24:46 +01:00
Alexandre Julliard 32bac73463 msvcrt: Export onexit functions for compatibility with Mingw.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-14 18:24:46 +01:00
Michael Stefaniuc af4821ca81 msvcrt: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-15 21:01:09 +02:00
Piotr Caban 6b268e77bb msvcr80: Add gets_s implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45393
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-16 21:28:45 +02:00
Piotr Caban c5cb5e24a3 ucrtbase: Don't fail if path ends with '\' character in stat functions family.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45292
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-13 17:20:44 +02:00
James Woodcock 91c72ce7de msvcrt: Gets() should handle EOF on stdin gracefully.
Signed-off-by: James Woodcock <james_woodcock@yahoo.co.uk>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-07 08:47:44 -06:00
Piotr Caban a44794af67 msvcrt: Fix misleading indentation in gets.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-01 19:25:57 +01:00
Alex Henrie b489c6e9b1 msvcrt: Don't include MSVC 8.0+ file functions in SOs for older DLLs.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-05 18:51:27 +01:00
Piotr Caban 96584d858a msvcrt: Don't report error in fclose on already closed stream.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 20:44:33 +01:00
Piotr Caban 1899eadf3e msvcrt: Change how fread splits reading into chunks.
It affects fd stream position and buffer content on unsuccessul reads.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 20:44:33 +01:00
Piotr Caban 67926ec8c3 msvcrt: Set errno when close() is called on already closed fd.
Based on a patch by Olly Betts.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-28 20:39:29 +01:00
Piotr Caban 7aa4b6d170 msvcrt: Fix write() behaviour on "no console" file descriptors.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-15 10:50:22 +01:00
Piotr Caban 9b2397d5c8 msvcrt: Fix read() behaviour on "no console" file descriptors.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-15 10:50:20 +01:00
Piotr Caban 677301a29c msvcrt: Fix close() behaviour on "no console" file descriptors.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-15 10:50:18 +01:00
Piotr Caban 31bf13e92b msvcrt: Fix IO initialization when invalid handles are passed.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-15 10:50:10 +01:00
Alexandre Julliard 7726157e19 msvcrt: Use WINAPIV calling convention for variadic functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-02 10:20:02 +01:00
Gijs Vermeulen 7f9c2dabc3 msvcrt: Add vf[w]printf_p & vf[w]printf_p_l.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-16 15:26:32 +02:00
Gijs Vermeulen 1ae09d5fb2 msvcrt: Add vf[w]printf_s_l.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-10 18:28:21 +02:00
Gijs Vermeulen 344a41a6ca msvcrt: Introduce vfprint & vfwprintf helper functions.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-09 15:24:40 +02:00
Alistair Leslie-Hughes fae0570a88 msvcrt: Implement clearerr_s.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-26 11:19:36 +02:00
Gijs Vermeulen 4a75c37b41 msvcrt: Add _vfprintf_l.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-19 14:28:29 +02:00
Alex Henrie efaeb5cf8a ucrtbase: Add __stdio_common_vfwprintf_s.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-07 14:23:57 +02:00
Alex Henrie a116f4a7ab ucrtbase: Add __stdio_common_vfprintf_s.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-07 14:23:48 +02:00
Alex Henrie 5074bb9a4b msvcrt: Note that __stdio_common functions are for ucrtbase.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-07 14:23:38 +02:00
Marcus Meissner d3d43ffded msvcrt: Free the temporary filename (Coverity).
Signed-off-by: Marcus Meissner <marcus@jet.franken.de>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-20 10:39:09 +02:00
Piotr Caban e4c9a2ec81 msvcrt: Use temp directory when creating file in tmpfile.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-05 19:50:04 +02:00
Lauri Kenttä 9924f009ce msvcrt: Fix _creat and _wcreat.
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-07 22:05:30 +01:00
Lauri Kenttä 2775931536 msvcrt: Check pmode in _wsopen_dispatch.
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-06 23:08:40 +01:00
Nikolay Sivov cc77571898 ucrtbase: Added _sopen_dispatch/_wsopen_dispatch.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-31 15:40:25 +01:00
Michael Stefaniuc dbafbcccfc msvcrt: Remove redundant NULL checks before free().
Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-08 20:13:38 +09:00
Erich E. Hoover 6afda19f48 msvcrt: Add support for _fstat32i64.
Signed-off-by: Erich E. Hoover <erich.e.hoover@wine-staging.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-06-24 18:51:22 +09:00
Nikolay Sivov 21fd1d3729 msvcrt: Fix calloc() prototype.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-04-26 14:48:47 +09:00
Daniel Lehman 2f783c6828 ucrtbase: Add __stdio_common_vfwprintf.
Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-04-13 23:01:06 +09:00
Piotr Caban 781b069ed8 msvcrt: Don't close HANDLE if stdout or stderr is sharing it.
Based on Qian Hong patch.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-20 12:09:19 +09:00
Piotr Caban 77feb6938d msvcrt: Add _wtmpnam_s implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-12-22 18:23:43 +01:00
Piotr Caban 9b6c93f6f2 msvcrt: Add tmpnam_s implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-12-22 18:23:36 +01:00
Martin Storsjo 8cc5b07e9d ucrtbase: Implement _get_stream_buffer_pointers.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-05 21:20:47 +09:00
Martin Storsjo b9d0f5d562 ucrtbase: Implement the new printf corner case behaviour.
Check the option flags whether the new or old legacy behaviours are
wanted.

For _MSVCR_VER < 140, don't check the option flags but hardcode them to
TRUE. (This avoids having to manually add all three flags into every
caller of pf_printf.) Mask out any other flags, to avoid other
out-of-range flags to be interpreted as the other flags (positional
params, invoke invalid param handler).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-04 19:19:12 +09:00
Martin Storsjo 1c8412d9e5 msvcrt: Refactor pf_printf to take options as flags instead of as BOOL parameter.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-04 19:18:56 +09:00
Martin Storsjo 255a7fe067 ucrtbase: Implement some printf functions.
Not all functions are implemented (yet not all variants are
implemented in the normal msvcrt either).

The new functions are more generalized and are C99 compliant.
They take an options parameter that e.g. for the snprintf
family of functions indicate whether the truncation and return
value should be handled as before or in the standards compliant
way.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-28 22:31:24 +09:00
Carlo Bramini 21a14e9612 msvcrt: SEEK_* macros from GLIBC should be replaced with safer MSVCRT_SEEK_* macros. 2015-08-19 08:39:02 +09:00
Carlo Bramini 13f34481b2 msvcrt: Use MSVCRT_xxx macros instead of the same ones from GLIBC. 2015-08-17 14:51:50 +09:00
Carlo Bramini 9b495caacf msvcrt: Call SetFilePointer() with correct parameters. 2015-08-17 14:51:46 +09:00
Iván Matellanes ea2798f1ce msvcrt: _setmode should check if file descriptor is valid. 2015-08-05 23:45:50 +09:00
Piotr Caban 2294d3ba45 msvcrt: Don't call DeleteCriticalSection on static critical section. 2015-07-16 21:21:07 +09:00
Piotr Caban eb9e00857a msvcrt: Write directly to the console in _putwch. 2015-06-15 14:49:04 +09:00
Piotr Caban 725e4733cf msvcrt: Remove no longer needed global lock from functions using fd critical sections. 2015-06-11 14:40:32 +09:00
Piotr Caban 6ed69c107f msvcrt: Avoid using global critical section while allocating new file descriptors. 2015-06-11 14:40:30 +09:00
Piotr Caban e7fc237088 msvcrt: Don't use MSVCRT_fdend in msvcrt_create_io_inherit_block. 2015-06-11 14:40:14 +09:00
Piotr Caban 417b605687 msvcrt: Fix possible deadlock in dup2 function. 2015-06-11 14:40:01 +09:00
Piotr Caban ba757eaec7 msvcrt: Use fd critical section in _write. 2015-06-04 19:02:31 +09:00
Piotr Caban eec7a565be msvcrt: Don't lock __badioinfo. 2015-06-04 19:02:29 +09:00
Piotr Caban f00b7f4058 msvcrt: Use fd critical section in _setmode. 2015-06-04 19:02:26 +09:00
Piotr Caban bd6eaf918c msvcrt: Get rid of msvcrt_is_valid_fd helper. 2015-06-03 22:52:04 +09:00
Piotr Caban 9ce2a8a60c msvcrt: Use fd critical section in msvcrt_create_io_inherit_block. 2015-06-03 22:52:02 +09:00
Piotr Caban 86baccc9ae msvcrt: Get rid of msvcrt_fdtoh helper. 2015-06-03 22:52:00 +09:00
Piotr Caban 9278190d46 msvcrt: Use fd critical section in _futime64. 2015-06-03 22:51:57 +09:00
Piotr Caban 16285f5700 msvcrt: Use fd critical section in read. 2015-06-03 22:51:55 +09:00
Piotr Caban b052afd4af msvcrt: Use fd critical section in msvcrt_free_fd. 2015-06-03 22:51:53 +09:00
Piotr Caban c7b0fb5154 msvcrt: Use fd critical section in dup2. 2015-06-03 22:51:50 +09:00
Piotr Caban 760b78813d msvcrt: Don't ignore pmode attribute in _wsopen_s. 2015-04-17 14:53:53 +09:00
Michael Stefaniuc 278b70bdd0 msvcrt: Clarify comparison of the diff of two unsigneds with 0 (PVS-Studio). 2015-03-06 20:32:02 +09:00
Piotr Caban 90b68f9964 msvcrt: Reset write direction after flush on read/write stream. 2015-01-26 11:22:58 +01:00
Piotr Caban 7880525f44 msvcrt: Handle read buffer flushing in msvcrt_flush_buffer helper. 2015-01-26 11:22:54 +01:00
Piotr Caban ba0d1586ff msvcrt: Drop read buffer in _flsbuf. 2015-01-21 18:08:11 +01:00
Piotr Caban 6c2d4f1092 msvcrt: Use fd critical section in _fstat64. 2014-12-05 20:48:02 +01:00
Piotr Caban f2f45d5fe6 msvcrt: Use fd critical section in _chsize_s. 2014-12-05 20:48:01 +01:00
Piotr Caban fa6de59770 msvcrt: Use fd critical section in _lseeki64. 2014-12-05 20:47:59 +01:00
Piotr Caban ffdd16cc0d msvcrt: Use fd critical section in _locking. 2014-12-05 20:47:57 +01:00
Piotr Caban 9a4cfbc3ed msvcrt: Use fd critical section in _eof. 2014-12-05 20:47:55 +01:00
Iván Matellanes 17fcef507f msvcrt: Call the _nolock variant when the file is already locked. 2014-12-01 11:11:16 +01:00
Piotr Caban afc6962a24 msvcrt: Use fd critical section in _close. 2014-11-11 23:55:52 +09:00
Piotr Caban 4508e665c0 msvcrt: Use fd critical section in _commit. 2014-11-11 23:55:49 +09:00
Piotr Caban 1d791f5db2 msvcrt: Rename msvcrt_get_ioinfo function. 2014-11-11 23:55:43 +09:00
Piotr Caban 0c4cb6ce5d msvcrt: Initialize file descriptor critical section. 2014-11-11 23:55:34 +09:00
Iván Matellanes bcbd83d154 msvcrt: Added _fread_nolock_s implementation. 2014-11-10 19:25:15 +09:00
Iván Matellanes 4f807d9ae9 msvcrt: Added _ungetwc_nolock implementation. 2014-11-05 13:15:44 +09:00
Iván Matellanes 6f24dd9677 msvcrt: Added _ungetc_nolock implementation. 2014-11-05 13:15:20 +09:00
Iván Matellanes b536ff62ef msvcrt: Added _fputwc_nolock implementation. 2014-11-05 13:14:35 +09:00
Iván Matellanes 975a95a25b msvcrt: Added _fputc_nolock implementation. 2014-11-05 13:14:03 +09:00
Iván Matellanes 89d91168a0 msvcrt: Use correct type for fread and fwrite return values. 2014-11-04 13:31:33 +09:00
Iván Matellanes 20e0a6f20d msvcrt: Avoid locking the file in _fclose_nolock. 2014-11-04 13:31:29 +09:00
Iván Matellanes 156684ba91 msvcrt: Added _fgetwc_nolock implementation. 2014-10-31 15:35:36 +09:00
Iván Matellanes 878b4a9280 msvcrt: Added _fgetc_nolock implementation. 2014-10-31 15:35:24 +09:00
Iván Matellanes f896cd3dc9 msvcrt: _filbuf should not lock any file. 2014-10-31 15:35:19 +09:00
Iván Matellanes 4bb80afedc msvcrt: Added _fflush_nolock implementation.
Thanks to Piotr Caban for the test.
2014-10-27 19:03:57 +09:00
Iván Matellanes c53e0384a5 msvcrt: Added _fseek_nolock implementation. 2014-10-16 13:02:24 +09:00
Iván Matellanes 5077d8c137 msvcrt: Added _fseeki64_nolock implementation. 2014-10-16 13:02:16 +09:00
Iván Matellanes 50574ccffa msvcrt: Added _ftell_nolock implementation. 2014-10-16 13:02:08 +09:00