Commit Graph

7792 Commits

Author SHA1 Message Date
Jacek Caban
a5150c011f widl: Update to current Wine version.
Includes adjustments to relocable patch to use upstream relocable install support.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-09-17 00:43:21 +02:00
Pali Rohár
a4679991ed headers: Fix wspiapi.h warning: cast between incompatible function types
When casting from function pointer which takes some parameters and returns
void to function pointer which returns non-void and may take some
parameters, then gcc throws following warning:

  warning: wspiapi.h:50:20: warning: cast between incompatible function types from ‘void (__attribute__((stdcall)) *)(struct addrinfo *)’ to ‘int (__attribute__((stdcall)) *)()’ [-Wcast-function-type]

Avoid this warning by first casting to (void(*)(void)) pointer and then to
final (FARPROC) function pointer. Casting from and to (void(*)(void)) gcc
and clang does not throw incompatible cast warnings.

See: https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-17 00:11:51 +03:00
Martin Storsjö
a328601030 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-14 23:32:48 +03:00
Pali Rohár
bf26669a86 crt: Define and use __p_ functions for _osver, _winmajor, _winminor and _winver
_osver, _winmajor, _winminor and _winver global variables are available
since the first crtdll.dll library up to the msvcr80.dll (both i386 and
x64), including OS system version of msvcrt.dll. ARM versions of msvcrt.dll
is missing _winver variable (but others are present). __p_ functions which
return pointers to these variables are missing just in crtdll.dll,
msvcrt10.dll and non-i386 versions of msvcrt.dll.

Provide missing __p_ functions for libraries which provides global
variables and defines _osver, _winmajor, _winminor and _winver via
__p_ functions in header files.

This aligns definitions of these version macros with msvc (which also
defines them via __p_ functions) and also with other definitions in
mingw-w64 header files (which also use __p_ functions instead of global
__MINGW_IMP_SYMBOL).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-14 23:32:10 +03:00
Martin Storsjö
79197aa4bc crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-14 23:26:18 +03:00
Pali Rohár
df662961ab crt: Include __p__iob() symbol into x64 and ARM versions of msvcrt.dll
In file msvcrt.def.in is mentioned that symbol __p__iob is provided by
mingw-w64 emulation. But it is not yet. Functions __p__iob() and
__iob_func() returns same pointer to first member of _iob[] array, so
define __p__iob symbol for non-i386 builds as alias to __iob_func symbol.
Symbol __iob_func is present in all non-i386 versions of msvcrt.dll
library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-14 23:25:11 +03:00
Pali Rohár
afea8d03f4 crt: Include __p___mb_cur_max, __p__pctype and __p__pwctype symbols into x64 and ARM versions of msvcrt.dll
In file msvcrt.def.in is mentioned that symbols __p___mb_cur_max,
__p__pctype and __p__pwctype are provided by mingw-w64 emulation, but
source files which provide them are missing in Makefile.am sections for
building msvcrt.dll import libraries. Fix this problem.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-14 23:25:11 +03:00
Pali Rohár
d60139ca1a headers: Avoid false-positive -Wconversion warnings in isnan() macro
Test case:

  #include <math.h>
  int isnan_wrapper(double value) { return isnan(value); }

Output:

  $ g++ -Wconversion -c snippet.cpp
  warning: conversion to 'float' from 'double' may alter its value
  warning: conversion to 'int' from 'double' may alter its value

First warning is caused by the fact in C++ mode __mingw_choose_expr is
using ternary operator and warning is triggered also by the case which is
not executed.

Second warning is caused by the fact that type of expression
(__builtin_trap(),x) for isnan(x) is double, but return value of
isnan_wrapper() is int. But this expression never returns.

Fix the first problem to use explicit cast for __isnan* calls which
correspondents to matched __mingw_types_compatible_p types.

And fix second problem by changing expression to something which has type
of int.

Bug: https://sourceforge.net/p/mingw-w64/bugs/481/
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-14 20:08:38 +08:00
Biswapriyo Nath
39e229d50e headers: Add new symbols in minwinbase.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-13 15:50:48 +08:00
LIU Hao
26595c6e7c headers: Don't include SSE intrinsic headers for windres
Windres makes no use of SSE intrinsics, but produces warnings:

   C:/MSYS64/mingw32/lib/gcc/i686-w64-mingw32/14.2.1/include/xmmintrin.h:126: digit exceeds base
    126 |  return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f };

Reference: https://gitlab.gnome.org/GNOME/gimp/-/issues/11655
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-13 08:57:20 +08:00
Biswapriyo Nath
e38459032f headers: Add new _Ret macros in sal.h
Required for https://sourceforge.net/p/mingw-w64/mailman/message/58813005/

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-11 22:34:41 +08:00
Biswapriyo Nath
474e2744ae headers: Add new macros in specstrings.h
Required for https://sourceforge.net/p/mingw-w64/mailman/message/58813005/

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-11 22:34:40 +08:00
Pali Rohár
37a5ac28da crt: Fix atexit() function for every import library
mingw-w64 startup code already provides its own atexit() functions.
Implementation for DLL and EXE builds differs because version for DLL
builds has to be called at the time when unloading DLL library whereas
version for EXE builds is called at process termination. DLL version of
atexit() stores atexit's function pointers into own table which is called
from DLL unload hook. EXE version just calls CRT's _onexit() function.

Some msvcrt def files provide atexit function symbol without DATA keyword,
which is than exported from msvcrt import library. And so it conflicts with
the atexit symbol from startup file and makes atexit function unusable.

UCRT libraries do not have this problem because they provide atexit
function under different name _crt_atexit.

Fix msvcrt symbol conflicts by renaming atexit function to _crt_atexit in
every CRT def file. This will ensure compatibility with UCRT and also that
applications would call atexit function from mingw-w64 startup file and not
from CRT import library.

Also change atexit implementation in exe startup file to directly call
_crt_atexit() function instead of _onexit(). This will simplify usage as
UCRT does not have _onexit() function (mingw-w64 provides only _onexit
wrapper around _crt_atexit) and msvcrt's atexit() function (renamed to
_crt_atexit() in def file) is doing same thing as msvcrt _onexit().

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-09-11 00:13:30 +02:00
Le Philousophe
251fc7e1c3 winpthreads: Fix constructor priority to make it run first
Here is a patch which fixes bugs #988 and #992 following the commit
7b3379.

This commit introduced a new function winpthreads_init in charge of
setting up the _pthread_get_system_time_best_as_file_time and _pthread_get_tick_count_64
pointers using a runtime detection.

This function is defined with the constructor attribute. The problem is
that every static object making use of a constructor is also tagged with
this constructor attribute and the call ordering is unspecified.

For example, when linking code making use of C++11 chrono objects the
libstdc++ code is called before winpthreads_init but makes of the
clock_gettime function which causes a crash.

A minimal reproduction code can be found here in bug #992.

This bug can be fixed by setting a priority of 0 to the
winpthreads_constructor. It is then called before the static
constructors.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-10 10:02:04 +08:00
Daniel Verkamp
648f257038 dwmapi.h: Use DWMAPI in function declarations
DWMAPI was already defined by dwmapi.h, but it was not actually used
when declaring the functions in that header, so they were missing
DECLSPEC_IMPORT.

This patch replaces HRESULT WINAPI with DWMAPI, and WINBOOL WINAPI with
DWMAPI_(WINBOOL) for the DwmDefWindowProc function that does not return
HRESULT.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-06 22:09:25 +08:00
Daniel Verkamp
4c2ff89b54 dwmapi.h: Add explicit DwmFlush void param
The DwmFlush() function takes zero parameters, not an undefined number
of parameters.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-06 22:09:25 +08:00
Biswapriyo Nath
e33940a2ad headers: Add new symbols in wingdi.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-06 22:09:23 +08:00
Martin Storsjö
5c63f0a966 headers: Enable _CRT_INTERNAL_PRINTF_STANDARD_ROUNDING by default
This is supported by UCRT 10.0.19041.0 and newer. Older versions
ignore the unknown flag silently.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-06 13:49:07 +03:00
Martin Storsjö
ff3f23c078 crt: Use _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS in narrow printfs
Currently, _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS only affects the
format for wide strings, but include it everywhere for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-06 13:49:07 +03:00
Martin Storsjö
b3c0901564 headers: Add missing cases of _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS for narrow printfs
Currently, _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS only affects the
format for wide strings, but include it everywhere for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-06 13:49:07 +03:00
Martin Storsjö
f7bfb9a505 headers: Add a missed case of _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS in _vscwprintf
Our _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS define contains
_CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS, which affects how
wide strings are formatted - so this should have a functional
effect, fixing an earlier inconsistency with this function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-06 13:49:07 +03:00
Martin Storsjö
5f8ddf1c43 headers: Add the new define _CRT_INTERNAL_PRINTF_STANDARD_ROUNDING
This was added in UCRT 10.0.19041.0.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-06 13:49:07 +03:00
Biswapriyo Nath
47df1ba34c headers: Add enum operators in d2d1.h
This fixes compiler error as following.

JUCE/modules/juce_graphics/native/juce_Direct2DResources_windows.cpp:56:81:
error: assigning to 'D2D1_PRESENT_OPTIONS' from incompatible type 'unsigned int'
56 |         hwndRenderTargetProps.presentOptions = D2D1_PRESENT_OPTIONS_IMMEDIATELY | D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS;
   |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-05 23:03:11 +08:00
Jacek Caban
b4eadf324c headers: Import webservices.h and weakreference.idl from Wine.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-09-04 15:04:48 +02:00
Jacek Caban
88991b6e55 headers: Update imported headers to current Wine version.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-09-04 15:04:48 +02:00
LIU Hao
b3be4c155a Revert "headers: use inline version of RtlSecureZeroMemory for UCRT builds"
This reverts commit 2a7e9255df.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/58812487/
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-04 11:40:10 +08:00
Pali Rohár
6a33003ead crt: Fix return value of IMAGE_TLS_CALLBACK functions and remove explicit pointer casting
Fixes compile warnings:

    crt/tlssup.c:104:53: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = (const PIMAGE_TLS_CALLBACK) __dyn_tls_init;
                                                         ^
    crt/tlssup.c:105:52: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     _CRTALLOC(".CRT$XLC") PIMAGE_TLS_CALLBACK __xl_c = (PIMAGE_TLS_CALLBACK) __dyn_tls_init;
                                                        ^
    crt/tlssup.c:171:52: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     _CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_tls_dtor;
                                                        ^

TLS callback function must return void, not BOOL.

`__dyn_tls_init` and `__dyn_tls_dtor` have external linkage in Microsoft UCRT.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-04 11:33:33 +08:00
Pali Rohár
1b554dec06 doc: ucrt-vs-msvcrt.txt: Update information about CRT options and links how to obtain UCRT
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-02 23:17:51 +03:00
LIU Hao
83429508ff crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-02 23:00:24 +08:00
Biswapriyo Nath
fd33149ac4 crt: Add new functions in wintrust import library
Required for https://sourceforge.net/p/mingw-w64/bugs/993/

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-02 22:59:54 +08:00
Biswapriyo Nath
b1ee648aa5 crt: Move wintrust to lib-common
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-02 22:59:54 +08:00
Isuru Fernando
c6bf4bdf65 winpthreads: Include pthread_compat.h in sched.h
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-27 09:53:18 +08:00
Biswapriyo Nath
4cf86b8792 crt/libsrc: Enable scrnsave code
Required for https://sourceforge.net/p/mingw-w64/mailman/message/58809472/

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-26 10:14:43 +08:00
Martin Storsjö
b2bac2bb07 crt: Avoid using powf in UCRT on i386, temporarily
This reverts parts of 52c98b1273.

While powf indeed is available in UCRT on i386 too, it's missing
in Wine's i386 ucrtbase.dll (as of Wine 9.15). This probably stems
from the same mistake originally. (Most of the float math functions,
suffixed with -f, are unavailable in the i386 UCRT, but powf is
available.)

This was fixed in upstream Wine in commit
5393ba55464f3346bad7b98e11733348f2b64c6f, which will be part of
the upcoming Wine 9.16.

Thus, to allow built executables to run on current Wine versions,
avoid linking against this function, as a temporary workaround.

After a grace period, to let fixed versions of Wine become more
widely available, we can revert this, to link against powf
on i386 too.

At that point, we can stop including math/powf.c in src_ucrtbase32
in Makefile.am too.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-23 10:42:40 +03:00
Pali Rohár
121331cffd crt: Deduplicate symbols from ucrtbase.def.in and ucrtbased.def.in files into ucrtbase-common.def.in
List of symbols in ucrtbase.def.in and ucrtbased.def.in are very similar.
So move them into one common file ucrtbase-common.def.in and based on
DEF_DEBUG definition choose if the symbol list is for debug ucrtbased.dll
or release ucrtbase.dll library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:45:04 +03:00
Martin Storsjö
536d7e5d6c crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:19:20 +03:00
Pali Rohár
2c4efc3374 crt: Add import library for ucrtbased.dll
ucrtbased.dll is debug version of the ucrtbase.dll and provides additional
debugging functions.

Specify symbols for all 4 platforms: x86, x64, arm32, arm64.

All symbols in ucrtbase.dll are available also in ucrtbased.dll with one
exception for ARM64 version of ucrtbased.dll. It does not provide
__unDName, __unDNameEx and _is_exception_typeof symbols which are available
in non-debug version ucrtbase.dll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
e0114c0cc1 crt: ucrtbase.def.in: Include symbols added after Windows 10 Anniversary Update
List of symbols should be now up-to-date with ucrtbase.dll version 10.0.26100.1.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
d0887fa24e crt: ucrtbase.def.in: Document which symbols were added in later ucrtbase.dll versions
This change just split symbols into two sections, it does not add or delete
any symbol.

It looks like that all newer versions of ucrtbase.dll do not change set of
symbols, they do not add any new or remove any existing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
c1533322d1 crt: ucrtbase.def.in: Remove comment about DATA for _mbcasemap
_mbcasemap is global variable, not function. So it has to be marked with
DATA, not just manually.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
ff3837006e crt: Update comment about UCRT _HUGE in crt-aliases.def.in
Since commit 527522b8b0 _HUGE variable is provided by math/_huge.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
c323fc1fac crt: Move two UCRT aliases from ucrtbase.def.in to crt-aliases.def.in
In file crt-aliases.def.in are defined all UCRT symbol aliases except two.
Move those two remaning.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
d60d431d26 crt: ucrtbase.def.in: Fix ARM64 symbols
__intrinsic_setjmp and _set_FMA3_enable are not available, but _local_unwind is.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
78969c62a9 crt: ucrtbase.def.in: Add missing ARM32 symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
52c98b1273 crt: ucrtbase.def.in: Fix symbols not available on I386 and X64
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
96f33f701b crt: UCRT __dcrt_initial_narrow_environment is global variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Biswapriyo Nath
7a6c241e46 include: Add new DebugSystemObjects4 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
fc03403f74 include: Add new DebugRegisters2 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
91d3c26477 include: Add new DebugDataSpaces4 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
4a2cbfaca0 include: Add new DebugPlmClient interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00