Commit Graph

7886 Commits

Author SHA1 Message Date
LIU Hao
afd6e88a63 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-04 22:55:08 +08:00
Biswapriyo Nath
058bc941cb header: Add interactioncontext.h
Required for 4618e1d256/os/win/winapi.h (L15)

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-04 22:46:47 +08:00
Biswapriyo Nath
9a1c885fe2 crt: Add libinput import library
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-04 22:46:47 +08:00
Jacek Caban
1421c5d451 headers: Update imported headers to Wine version ff2070b79006c.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-11-03 23:28:35 +01:00
LIU Hao
e3a3dc588a headers/fwptypes: Regenerate H from IDL
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-01 22:49:35 +08:00
Biswapriyo Nath
ea5737f563 headers: Add new symbols in fwptypes.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-01 22:48:51 +08:00
Lasse Collin
0d42217123 crt: Avoid best-fit mapping when constructing argv for main()
__getmainargs() parses the command line from the return value of
GetCommandLineA() which uses best-fit mapping when converting the
native wide-char command line to the process code page. This can
create security issues. For example, fullwidth quotation mark (U+FF02)
may get converted to ASCII quotation mark (U+0022), which will break
argument quoting and can result in argument injection, for example,
if malicious filenames are passed as an argument to a program. There
are other security issues with best-fit mapping too.

Call __wgetmainargs() to get wide-argv and convert it to narrow-argv
without best-fit mapping. If conversion isn't lossless, print an
error message and _exit(255) without calling main() at all. While
this might not be ideal with every application, with most applications
a lossy conversion would be a "garbage in, garbage out" situation.
For example, lossy conversion of filenames doesn't make any sense.

Note that if _dowildcard is set, then filenames from wildcard expansion
can prevent the application from running if those filenames contain
characters that cannot be converted losslessly.

Setting the process code page to UTF-8 using an application manifest
would also fix the issue (apart from unpaired surrogates which are
invalid UTF-16 but legal on Windows command line and in filenames).
Setting UTF-8 in a manifest is only supported on Windows 10 version 1903
and later, and switching to UTF-8 could create new issues in some apps.
The method in this commit works on old Windows versions too. Even with
UTF-8, this commit matters because it blocks unpaired surrogates on the
command line.

The best-fit conversion issue affects a large number of applications
that use main() instead of wmain(). It's better to fix the issue at
toolchain level instead of trying to fix every application separately.
Examples of applications where this has already been reported:

  - The report about the issue in curl has more technical details:
    https://hackerone.com/reports/2550951

  - In XZ Utils the issue was already solved by setting UTF-8 code page:
    https://tukaani.org/xz/#_argument_injection_on_windows
    (CVE-2024-47611)

Thanks to Orange Tsai and splitline from DEVCORE Research Team
for discovering this issue.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-30 01:38:42 +08:00
Antonin Décimo
04ec40f5bc winpthreads: also use SetThreadDescription to set thread name
Using SetThreadDescription has the advantage that on recent Visual
Studio / Windows, the thread name is always available regardless of
whether a debugger was attached, is also available in crash dumps, and
to other tools.

Quoting MSDN at Set a thread name in C/C++:
https://learn.microsoft.com/en-us/visualstudio/debugger/tips-for-debugging-threads?view=vs-2022&tabs=csharp#set-a-thread-name-in-cc

> There are two ways to set a thread name. The first is via the
> SetThreadDescription function. The second is by throwing a
> particular exception while the Visual Studio debugger is attached to
> the process. Each approach has benefits and caveats. The use of
> SetThreadDescription is supported starting in Windows 10 version
> 1607 or Windows Server 2016.
>
> It's worth noting that both approaches can be used together, if
> desired, since the mechanisms by which they work are independent of
> each other.

Signed-off-by: Antonin Décimo <antonin@tarides.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-29 22:39:01 +08:00
LIU Hao
c3478beb29 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-29 21:27:30 +08:00
TheShermanTanker
9c534de9d1 headers: Add the _InterlockedCompareExchange8 intrinsic
Signed-off-by: TheShermanTanker <tanksherman27@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-29 21:19:51 +08:00
Biswapriyo Nath
99684a9399 headers: Add new symbols in ipifcons.h
Required for https://webrtc.googlesource.com/src/+/0ce868c60e2405845608b552c43c37d256e6523f%5E%21/#F0

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-27 14:45:21 +08:00
LIU Hao
dc935c0a6a crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-23 21:52:29 +08:00
LIU Hao
7a9b6e1616 crt: Provide a common __mingw_has_sse()
This commit moves `__mingw_has_sse()` to a separate file, and makes its
result cacheable.

SSE is required for x86-64, and can be enabled for x86-32 by passing `-msse`
to GCC. On ARM and ARM64 it's always absent. A macro is defined if it would
be known to return a constant.

Co-authored-by: Morilli <molli.bender@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-23 21:48:32 +08:00
Jacek Caban
e9a763950a headers: Update imported headers to Wine version 2bca8cb236b7d4.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-23 10:41:54 +02:00
David Grayson
33d403802a headers: Fix intsafe.h.
Fix ULongToChar to return -1 on overflow, like it does in the SDK.

Fix LongLongToUIntPtr and LongLongToULongPtr so they work on 32-bit.

Remove about 150 macros added this year that just redefine an existing function.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-21 11:55:02 +02:00
Biswapriyo Nath
ac299df46a headers: Add new APIs in cfgmgr32.h
Fixes https://github.com/mingw-w64/mingw-w64/issues/61

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-20 19:10:42 +08:00
Jacek Caban
7dc0ed8ef1 headers: Update imported headers to Wine version wine-9.20.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-18 23:17:51 +02:00
Jacek Caban
dc8fadfa25 headers: Regenerate headers with current widl version.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-18 23:16:07 +02:00
Jacek Caban
b6cc4d5cba widl: Import Wine version wine-9.20.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-18 23:16:01 +02:00
Jacek Caban
1675c77e81 headers: Remove invalid arithmetic intsafe.h macros assuming 64-bit pointer size.
We have inline versions that do the right thing in all cases.

Fixes: 0cf06d5cb6
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-18 15:55:26 +02:00
Jacek Caban
39e60c5420 headers: Add missing SIZE_T intsafe.h helpers.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-18 15:54:21 +02:00
Biswapriyo Nath
27a2584b1a headers: Add FOLDERID_LocalStorage in knownfolders.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-18 14:41:32 +08:00
Biswapriyo Nath
c7632281c2 headers: Add IDCompositionTableTransferEffect definition in dcomp.h
Required for 682dc9b944/gfx/webrender_bindings/DCLayerTree.cpp (L2318)

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-17 21:55:59 +08:00
Biswapriyo Nath
d15da6272b headers: Add IDCompositionColorMatrixEffect definition in dcomp.h
Required for 682dc9b944/gfx/webrender_bindings/DCLayerTree.cpp (L2308)

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-17 21:55:59 +08:00
LIU Hao
cdf6b16b80 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-13 19:20:05 +08:00
Biswapriyo Nath
dda4c5537f crt: Add winbrand import library
Fixes https://github.com/mingw-w64/mingw-w64/issues/63

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-13 19:19:00 +08:00
Biswapriyo Nath
189b6fbdfa crt: Add new APIs in cfgmgr32 import library
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-12 23:11:06 +08:00
LIU Hao
50e9503928 headers/winerror: Move TBS_SUCCESS to tbs.h
45629c13ef added this macro in tbs.h, causing
a warning about redefinition:

   mingw-w64-headers/include/tbs.h:63: warning: "TBS_SUCCESS" redefined
      63 | #define TBS_SUCCESS 0

No Windows SDK has this macro in winerror.h, so this macro in winerror.h
should be removed, and the one in tbs.h is preferred.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-12 09:05:05 +08:00
Biswapriyo Nath
45629c13ef headers: Add new symbols in tbs.h
Fixes https://github.com/mingw-w64/mingw-w64/issues/62

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-12 09:01:58 +08:00
Biswapriyo Nath
737142b23d crt: Add new API in tbs import library
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-12 09:00:44 +08:00
Martin Storsjö
797b4a6b51 headers: Expose the wchar ctype _l functions for msvcrt.dll for Vista
The _l suffixed wchar ctype functions, such as _iswalpha_l,
are available in msvcrt.dll, but only since Vista. They're also
available in the properly versioned msvcrt versions since
msvcr80.dll.

This fixes building libc++ for msvcrt.dll, after the recent
changes in f1df976e39.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-12 00:55:33 +03:00
Martin Storsjö
544f756363 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
Pali Rohár
766949b899 crt: Rename file ucrt_compat.c to ucrt_tzset.c
Now this file contains only tzset() and _tzset() functions and
tzname/timezone/daylight global variables.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
Pali Rohár
7cdac1f6d6 crt: Remove -Winline from ucrt_compat.c
In ucrt_compat.c there is no included or used inline function anymore.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
Pali Rohár
bb938a7a4b crt: Split UCRT _amsg_exit() into separate file
Also add missing __MINGW_ATTRIB_NORETURN attribute into header file
internal.h where is function _amsg_exit() declared.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
Pali Rohár
51f5fd310f crt: Split UCRT __ms_fwprintf() into separate file
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
Pali Rohár
200b20f657 crt: Use common mingw-w64 implementation of _get_output_format() also for UCRT builds
Pre-msvcr80.dll builds, including msvcrt.dll builds use _get_output_format()
implementation from mingw-w64 output_format.c source file. Use it also for
UCRT builds instead of current stub in ucrt_compat.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-11 11:13:26 +03:00
LIU Hao
f1df976e39 headers/{ctype,wchar}: Only declare _*_l for MSVCRT >= 0x800 and UCRT
These functions and macros were added in MSVCR80.DLL and were not available
in MSVCRT.DLL from Windows XP.

This closes https://github.com/mingw-w64/mingw-w64/issues/60.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-10 21:44:55 +08:00
Pali Rohár
01b3e6261b headers: Fix compile warning: D2DERR_* redefined
For more D2DERR_* macros defined in d2derr.h, warnings is:

  In file included from mingw-w64-headers/include/d2d1.h:20,
                   from mingw-w64-headers/include/d2d1_1.h:10,
                   from libsrc/uuid.c:29:
  mingw-w64-headers/include/d2derr.h:16: warning: "D2DERR_BAD_NUMBER" redefined
   #define D2DERR_BAD_NUMBER 0x88990011

  In file included from mingw-w64-headers/include/winbase.h:2816,
                   from mingw-w64-headers/include/windows.h:70,
                   from mingw-w64-headers/include/rpc.h:16,
                   from mingw-w64-headers/include/credentialprovider.h:7,
                   from libsrc/uuid.c:17:
  mingw-w64-headers/include/winerror.h:4713: note: this is the location of the previous definition
   #define D2DERR_BAD_NUMBER                            _HRESULT_TYPEDEF_(0x88990011)

Add guards in winerror.h and d2derr.h to not define same macros multiple times.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-10 09:12:36 +08:00
Pali Rohár
3e3fc0eaf4 crt: Remove _ftime_s symbol alias from msvcrt.def.in
Header file sys/timeb_s.h defines _ftime_s only as a macro which expands
either to _ftime32_s or _ftime64_s based on _USE_32BIT_TIME_T setting.
MS VC++ 2005+ header files also defines only _ftime_s as a macro and do not
provide any _ftime_s function declaration or symbol alias in import library.

_ftime_s symbol alias is currently defined only in mingw-w64 msvcrt.def.in
file, not in any other .def file, neither in UCRT ones.

So _ftime_s symbol alias is not needed in msvcrt.def.in file, remove it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-09 23:46:15 +03:00
Jacek Caban
6cd6fee9c0 headers: Update imported headers to Wine version 5b06663a59d5.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-09 16:42:14 +02:00
Biswapriyo Nath
893f14bb28 crt: Add new ioring apis
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-09 22:36:19 +08:00
Biswapriyo Nath
d56dc481cf headers: Add new ioring symbols and apis
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-09 22:36:19 +08:00
Jacek Caban
77eaa959e2 headers: Update imported headers to Wine version 312d442200e6403.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-10-08 18:24:36 +02:00
Biswapriyo Nath
8700091928 headers: Add more Set member template in HString class
This fixes the following compiler error with gecko.

mozilla-unified/widget/windows/ToastNotification.cpp:832:14: error: no matching member function for call to 'Set'
  832 |   hr = aumid.Set(mAumid.ref().get());
      |        ~~~~~~^~~
corewrappers.h:58:25: note: candidate function not viable: no known conversion from
'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') to 'const HSTRING' (aka 'HSTRING__ *const') for 1st argument
corewrappers.h:53:25: note: candidate function not viable: requires 2 arguments, but 1 was provided

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-08 11:33:39 +08:00
Biswapriyo Nath
6f8b78ccf6 headers: Add HString class in corewrappers.h
Required for 0ac09833d9/intl/locale/windows/OSPreferences_win.cpp (L47)

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-06 21:15:08 +08:00
Nikolay Sivov
8f7b5ce363 include: Fix ID2D1Geometry methods macros.
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-04 15:03:08 +08:00
LIU Hao
aa7bbd5e2d crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-04 12:07:11 +08:00
Biswapriyo Nath
f34de05bc4 crt: Add new APIs in wscapi import library
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-04 12:06:09 +08:00
Biswapriyo Nath
30824af933 headers: Add wscapi.h
Required for f0b3dafb55/xpcom/base/nsSystemInfo.cpp (L34)

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-03 22:17:38 +08:00