Commit Graph

2985 Commits

Author SHA1 Message Date
Alexandre Julliard 3ebc80f148 msvcrt: Don't forward itoa() functions to ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:19:33 +01:00
Alexandre Julliard 68559674e7 msvcrt: Don't forward string functions to ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:19:33 +01:00
Thomas Faber be0684dad5 msvcrt/tests: Show that spawn does not require locking of fds.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:52 +01:00
Doug Lyons 5a514d3f45 msvcrt: Do not acquire fd lock in msvcrt_create_io_inherit_block.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51647
Signed-off-by: Doug Lyons <douglyons@douglyons.com>
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:52 +01:00
Martin Storsjö 6a072b98c1 msvcrt: Don't set frame to 0 in arm and arm64 setjmp.
This matches what was done for x86_64 in
882980c17a.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Arkadiusz Hiler 04bb9112d2 msvcrt: Increase module's reference count before returning from _beginthread[ex]().
Increasing DLL's reference count from the trampoline function makes it
prone to race conditions. The thread can start executing after we have
already returned from _beginthread[ex]() and the DLL might have been
freed.

Fixes rare crash on launch with Baldur's Gate 3.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 20:40:09 +01:00
Andrew Eikum 0c6bab9339 msvcrt: Better handle multiple width specifiers.
Includes feedback from David Gow <david@davidgow.net> and Piotr Caban.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 17:33:56 +01:00
Piotr Caban 00824a94f0 msvcrt: Don't use GetDaylightFlag function in _ftime64.
The function is not available on current Windows releases.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51959
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-01 20:45:32 +01:00
Rémi Bernon 7c046c7afd msvcrt: Write memory forward in memset.
Instead of going backward, which breaks the Linux kernel transparent
huge pages allocation assumptions.

This can be reproduced by calling memset on large, newly allocated,
memory regions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 21:16:29 +02:00
Piotr Caban e38f3761f8 msvcrt: Rewrite _popen function.
Old implementation was not thread safe, incorrectly copied file
descriptors to child process and was leaking parent pipe fd to child
process.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51719
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 18:53:19 +02:00
Piotr Caban 1420d28cd6 msvcrt: Fix clearing NOINHERIT flag in _dup2.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 18:53:10 +02:00
Alexandre Julliard d8ed47ec21 msvcrt: Use the standard va_list instead of __ms_va_list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 11:12:09 +02:00
Eric Pouech 74a42c5401 msvcrt: Support I width modifier in *scanf* family.
Despite what msdn states, I and I32 are supported width modifiers.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 20:11:28 +02:00
Piotr Caban 21da1f2f11 ucrtbase: Avoid bool optimization in __std_exception_copy.
Otherwise GCC changes do_free = 1 assignment to *dst = *src which breaks
ucrtbase/cpp tests.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:02:25 +02:00
Piotr Caban 7a98557352 ucrtbase: Change _isblank_l return value for '\t'.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:02:03 +02:00
Alexandre Julliard 2a92c58e11 include: Use the standard va_list instead of __ms_va_list when building with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-15 18:28:01 +02:00
Alexandre Julliard da8176df61 msvcrt: Move _fdclass/_dclass to avoid forward references.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-15 18:28:00 +02:00
Alexandre Julliard 84bfdccf6d include: Add prototypes for the byteswap functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 18:41:02 +02:00
Ted Lyngmo 51b9f4cd2b ucrtbase: Add support for x mode in fopen.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51846
Signed-off-by: Ted Lyngmo <ted@lyncon.se>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 19:43:01 +02:00
Piotr Caban bb637469e1 msvcrt: Don't crash on NULL in fclose.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 19:42:26 +02:00
Alexandre Julliard 97479d3d32 ntdll: Move some exception definitions to winternl.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Piotr Caban 5d5f11c002 msvcrt: Support z length modifier in scanf.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:43:12 +02:00
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Piotr Caban 2c01333d03 msvcrt: Use unaligned data types in memset.
This fixes a regression in memset on ARM described by Martin:
ARM can do 64 bit writes with the STRD instruction, but that
instruction requires a 32 bit aligned address - while these stores
are unaligned.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Nikolay Sivov 0eaa43f6af msvcrt: Use free() on msvcrt_wstrdupa() results (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 19:34:23 +02:00
Rémi Bernon 7b17d70815 msvcrt: Improve memset performance using overlapping stores.
For n larger than 16 we store 16 bytes on each end of the buffer,
eventually overlapping, and then 16 additional bytes for n > 32.

Then we can find a 32-byte aligned range overlapping the remaining part
of the destination buffer, which is filled 32 bytes at a time in a loop.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:37:32 +02:00
Francois Gouget a6b1e97eb6 msvcrt: Remove CDECL on static functions where not needed.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 14:52:51 +02:00
Piotr Caban c306c527e7 msvcrt: Fix _CxxThrowException prototype.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Michael Stefaniuc 2d9e89a80f msvcrt/tests: Remove redundant NULL check before free().
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:08 +02:00
Piotr Caban 5e3f959aed msvcrt: Simplify throw_exception helper.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:03:33 +02:00
Piotr Caban 1c9a30f217 msvcrt: Move improper_scheduler_detach to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:03:28 +02:00
Piotr Caban 9694fc11fe msvcrt: Move improper_scheduler_attach to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:01:00 +02:00
Piotr Caban c9189a411b msvcrt: Move invalid_scheduler_policy_thread_specification to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:57 +02:00
Piotr Caban a7bbdea089 msvcrt: Move invalid_scheduler_policy_value to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:53 +02:00
Piotr Caban 635f59f276 msvcrt: Move invalid_scheduler_policy_key to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:49 +02:00
Piotr Caban a8decf5c15 msvcrt: Move scheduler_resource_allocation_error to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:45 +02:00
Piotr Caban ef81cfb5fb msvcrt: Move improper_lock implementation to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:41 +02:00
Piotr Caban f6f8b30c47 msvcrt: Introduce macro for creating exception class.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:34 +02:00
Piotr Caban f1fa214b9f msvcrt: Rename exception::what() implementation to exception_what.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-20 19:00:27 +02:00
Piotr Caban ce5c989171 msvcrt: Move _Trace_ppl_function to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:44:11 +02:00
Piotr Caban 69e2467aa7 msvcrt: Move _Trace_agents function to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:44:03 +02:00
Piotr Caban 3192bb9764 msvcrt: Move lock Concurrency functions to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:43:59 +02:00
Piotr Caban eff57ac9c6 msvcrt: Rename scheduler.c file to concurrency.c.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:43:50 +02:00
Piotr Caban 6c4cddc4f6 msvcrt: Add macro that defines type_info vtable.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:43:44 +02:00
Piotr Caban bc05707364 msvcrt: Allow specifying destructor in DEFINE_CXX_DATA macro.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:43:34 +02:00
Piotr Caban b24ee3b534 msvcrt: Use new() for allocations returning BadAlloc exception.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:43:28 +02:00
Luke Deller 6553a66ba1 msvcrt/tests: Add test for fopen/_open access hints.
Signed-off-by: Luke Deller <luke@deller.id.au>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 18:42:20 +02:00
Luke Deller 1ca67c8ba2 msvcrt: Translate file open access pattern hints.
Translate access pattern hints supplied to fopen / _open into the
corresponding attributes for the lower level CreateFileW call.

Signed-off-by: Luke Deller <luke@deller.id.au>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 17:53:55 +02:00
Piotr Caban 62d2693701 msvcrt: Fix x87 FPU status register assignment detection.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51568
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51579
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:38:33 +02:00
Piotr Caban a440e8aa8e msvcrt: Implement _fpreset on arm and aarch64.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-04 21:48:28 +02:00