Commit Graph

6467 Commits

Author SHA1 Message Date
Pali Rohár
9b098a6273 headers: configure: Add more msvcrt versions into --with-default-msvcrt list
Import libraries for all these msvcrt versions are already as part of build process.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 23:06:20 +08:00
Pali Rohár
02b97d1d2a headers: inttypes.h: Do not define 64-bit modifiers for msvcrt10.dll builds
Runtime library msvcrt10.dll like crtdll.dll does not provide support for
64-bit printf/scanf modifiers. So do not define them for msvcrt10.dll too.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 22:38:33 +08:00
Pali Rohár
38238df8f5 crt: crtdll_compat: Add missing __cdecl signature for __GetMainArgs()
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 22:38:33 +08:00
LIU Hao
886cea926f crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:06:26 +08:00
Pali Rohár
1482a93949 crt: Build import library for msvcr70.dll and msvcr71.dll
These are CRT runtime libraries for Visual Studio 2002 and 2003. These
libraries need to be installed separately via redistributable packages.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:03 +08:00
Pali Rohár
ef1a79da79 crt: Build import library for msvcrt40.dll
This is CRT runtime library for Visual C++ 4.0 (MSVC 10.00) and 4.1 (10.10).
It is present in every 32-bit x86 Windows as a system library.

msvcrt40.def file was generated from the original redistributable version
of Visual C++ 4.1 library.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:03 +08:00
Pali Rohár
11a2a630ee crt: Build import library for msvcrt20.dll
This is CRT runtime library for Visual C++ 2.0 (MSVC 9.00) and is present
in every 32-bit x86 Windows as a system library.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:03 +08:00
Pali Rohár
ec39127dda crt: Build import library for msvcrt10.dll
This is CRT runtime library for Visual C++ 1.x (MSVC 8.00). It should be
distributed as a part of the application which use it. msvcrt10.def file
was generated from the original redistributable version of this library.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:03 +08:00
Pali Rohár
11595c6e8b crt: Move dummy __setusermatherr() function into misc/dummy__setusermatherr.c file.
It would be used also in followup changes.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:02 +08:00
Pali Rohár
609a2498c1 crt: Move dummy stdio _lock() and _unlock() functions into stdio/mingw_dummy__lock.c file
It would be used also in followup changes.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:02 +08:00
Pali Rohár
424277b638 crt: Move implementation of __initenv and __winitenv to common file misc/__initenv.c
crtdll.dll and ucrt needs same implementation of __initenv and __winitenv
symbols. Deduplicate code and move it into a new misc/__initenv.c file.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-04-03 21:05:02 +08:00
Martin Storsjö
f923f041c3 headers: Implement _set_com_error_handler and _com_raise_error in comdef.h
These could also possibly be made non-inline if we'd be providing
the comsupp library. However, that could break existing code that
calls _com_issue_error (implicitly via _com_ptr_t in comip.h)
and don't currently explicitly link in any comsupp library (which
doesn't exist currently either).

In the corresponding MSVC setups, the comsupp library is linked
in automatically via '#pragma comment(lib, "comsupp.lib")' in
the comdef.h header.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-04-03 00:06:24 +03:00
Martin Storsjö
b501632c9a headers: Add a few more annotation macros to sal.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-30 11:23:19 +03:00
Biswapriyo Nath
b4445ee520 headers: Add wuerror.h
Required for libwdi project

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-28 14:04:27 +08:00
LIU Hao
318986e497 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-27 15:39:45 +08:00
Biswapriyo Nath
bb52167835 crt: Move bthprops to lib-common
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-27 15:39:01 +08:00
Jeremy Drake via Mingw-w64-public
a3f6d363d5 headers: float.h: define _CW_DEFAULT on ARM and ARM64.
Microsoft defines this to the same value on x64, ARM, and ARM64, so do
the same.

This constant is used by Cairo.  See
https://github.com/msys2/MINGW-packages/issues/11053

Signed-off-by: Jeremy Drake <jeremyd2019@users.sourceforge.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-21 11:36:16 +02:00
Biswapriyo Nath
99ba50f359 headers: Add missing waveform flag
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-19 22:22:23 +08:00
Pali Rohár
4ddd923ce9 include/wdm.h: Fix -Wsign-compare warning in RtlExtendedMagicDivide()
x86_64-w64-mingw32-gcc throws following -Wsign-compare warning when
compiling 64-bit NT kernel drivers which include ddk/ntddk.h file:

  ddk/wdm.h: In function ‘RtlExtendedMagicDivide’:
  ddk/wdm.h:9531:32: warning: operand of ?: changes signedness from ‘long long int’ to ‘ULONG64’ {aka ‘long long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
     ret.QuadPart = Pos ? ret64 : -(LONG64)ret64;
                                  ^~~~~~~~~~~~~~
Member ret.QuadPart is of type LONGLONG, so explicitly cast both parts of
ret64 ternary operator to LONG64.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-14 22:21:33 +08:00
Martin Storsjö
b03cbfb950 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-10 23:30:35 +02:00
Jeremy Drake
456b8d78be fwpuclnt: update to Windows 11 exports
and build import library for arm64.

Signed-off-by: Jeremy Drake <jeremyd2019@users.sourceforge.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-10 23:29:45 +02:00
LIU Hao
81b67a7af9 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-10 21:51:35 +08:00
Biswapriyo Nath
8ebbf51d1b headers: Add NTE error codes in winerror.h
Required for libfido2 project

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-10 21:40:52 +08:00
Biswapriyo Nath
148eb6c5b9 crt: Add webauthn import library
Tested with libfido2 project

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-10 21:40:52 +08:00
Biswapriyo Nath
7e105ff1a2 headers: Add webauthn.h file
Tested with libfido2 project

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-10 21:40:51 +08:00
Steve Lhomme
eafa25567d winstorecompat: fix CreateFileW mask for dwSecurityQosFlags
The possible values are

* SECURITY_ANONYMOUS which is 0<<16 aka 0x00000000
* SECURITY_IDENTIFICATION which is 1<<16 aka 0x00010000
* SECURITY_IMPERSONATION which is 2<<16 aka 0x00020000
* SECURITY_DELEGATION which is  which is 3<<16 aka 0x00030000
* SECURITY_CONTEXT_TRACKING which is 0x00040000
* SECURITY_EFFECTIVE_ONLY which is 0x00080000

So the proper mask should be 0x000F0000 instead of 0x000F00000. There's an extra 0.

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-09 09:07:48 +08:00
Pali Rohár
934338e47a headers: inttypes.h: Do not define 64-bit modifiers for crtdll.dll builds
crtdll.dll runtime does not suppport 64-bit printf/scanf modifiers. So when
targeting crtdll.dll runtime and not using MinGW-w64 stdio functions then
do not define any 64-bit modifier in inttypes.h header file.

crtdll.dll does not interpret %I64d modifier and does not read next
argument from variadic function call. So usage of this modifier cause
shifting of all variadic arguments.

This change will cause compile errors for crtdll.dll application which are
going to use PRId64 without __USE_MINGW_ANSI_STDIO. Compile error is better
than random runtime crashes or wrong behavior by corruption of printf/scanf
stack.

gcc automatically predefines macro __CRTDLL__ when compiling for crtdll.dll
runtime, so use it in inttypes.h checks.

crtdll.dll based applications which use 64-bit int stdio support had to use
-D__USE_MINGW_ANSI_STDIO=1 compile flag even prior this change.

Non-crtdll.dll based applications (msvcrt.dll or ucrt; which is the
majority) are not affected by this change.

So there there should not be any issue with this change and it should help
to prevent stdio function overflows for crtdll.dll applications.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Pali Rohár
0880a9e818 headers: _mingw.h: Set __MSVCRT_VERSION__ to 0x00 for crtdll.dll builds
When gcc was compiled with crtdll config then it links binaries with
-lcrtdll instead of -lmsvcrt and predefines macro __CRTDLL__.

So when __MSVCRT_VERSION__ was not manually set and gcc is not going to use
-lmsvcrt then set __MSVCRT_VERSION__ to 0x00 to indicate that msvcrt.dll is
not used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Martin Storsjö
5631becdbe crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Pali Rohár
a40df96467 crt: Add (v)snprintf() support for crtdll.dll builds
MinGW-w64 (v)snprintf() implementation uses windows functions _(v)snprintf()
and _(v)scprintf(). Runtime library crtdll.dll provides only _(v)snprintf(),
so include MinGW-w64 emulation of _(v)scprintf() functions into libcrtdll.a
import library.

As <msvcrt.h> header file and __mingw_get_msvcrt_handle() function depend
on msvcrtl.dll library do not use them in _scprintf.c and _vscprintf.c
source files when building object files for libcrtdll.a import library.

With this change it is possible to use snprintf() function in application
which uses crtdll.dll runtime library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Pali Rohár
75076480da headers: stdio.h: Declare __format__ attribute for _snscanf function
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Pali Rohár
8eb373a744 headers: stdio.h: Declare __format__ attribute for _(v)scprintf functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-07 00:22:15 +02:00
Pali Rohár
1fa291e292 crt: Fix building lc_locale_func.c for libcrtdll_extra.a
Object files in archive libcrtdll_extra.a (which are linked into import
library for crtdll.dll) cannot use msvcrt.h as it tries to load symbols at
runtime from msvcrt.dll using GetProcAddress().

So avoid using msvcrt.h and __mingw_get_msvcrt_handle() in crtdll.dll
runtime and directly use "setlocale_codepage_hack" implementation.

This fixes building of lc_locale_func.c for libcrtdll_extra.a archive.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-05 22:37:35 +02:00
Martin Storsjö
680fb36244 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-05 22:37:35 +02:00
Pali Rohár
187e41c7f2 crt: Add macro __LIBMSVCRT_OS__ for guarding msvcrt.dll
Currently macro __LIBMSVCRT__ is defined when building any libmsvcr*.a
import library. But header file msvcrt.h contains inline function
__mingw_get_msvcrt_handle() which should be used only from import library
for runtime msvcrt.dll (and not for any other runtime msvcr*.dll) as code
from that header file directly uses msvcrt.dll library.

Protect header file msvcrt.h by a new macro __LIBMSVCRT_OS__ and fix error
message as this header file is for libmsvcrt-os.a import library.
libmsvcrt.a is import library for some msvcr*.dll runtime specified at
MinGW-w64 compile time and does not have to be msvcrt.dll.

Archive libmsvcrt_extra.a is linked only to the libmsvcrt-os.a (import
library for msvcrt.dll) by msvcrt-os.mri script, so define this new macro
__LIBMSVCRT_OS__ when building object files for archive libmsvcrt_extra.a.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-05 22:36:15 +02:00
LIU Hao
5ee8fd7d7c include/dxvahd: Regenerate H from IDL
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-02 16:44:36 +08:00
Steve Lhomme
f3f26b6e2b headers: confirm the IDXVAHD_Device/IDXVAHD_VideoProcessor layout
Verified with 4656cf4a75/generation/WinSDK/RecompiledIdlHeaders/um/dxvahd.idl

Also added the GUIDs.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-03-02 16:38:21 +08:00
Steve Lhomme
2c35e8ff0d dcomp.h: add some missing interfaces
* IDCompositionFilterEffect: https://docs.microsoft.com/en-us/windows/win32/api/dcomp/nn-dcomp-idcompositionfiltereffect
* IDCompositionSaturationEffect: https://docs.microsoft.com/en-us/windows/win32/api/dcomp/nn-dcomp-idcompositionsaturationeffect
* IDCompositionGaussianBlurEffect: https://docs.microsoft.com/en-us/windows/win32/api/dcomp/nn-dcomp-idcompositiongaussianblureffect
* IDCompositionDevice3: https://docs.microsoft.com/en-us/windows/win32/api/dcomp/nn-dcomp-idcompositiondevice3

The order of methods can be found from
https://github.com/terrafx/terrafx.interop.windows/tree/main/sources/Interop/Windows/um/dcomp

As for other IDCompositionEffect interfaces, some methods are inverted for MSVC
compilation in C++.

Co-authored-by: Prince Gupta <guptaprince8832@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
(cherry picked from commit c0433aaf17)
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-27 14:04:52 +08:00
Pali Rohár
99c95def1d headers: stdio.h: Add _(v)scprintf optimization
Redirect (v)snprintf() call with n==0 arg directly to _(v)scprintf() call
at compile time. With this change gcc can optimize out __ms_(v)snprintf()
call even when MinGW-w64 runtime was not compiled with LTO.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-23 21:48:25 +08:00
Pali Rohár
e1b6a2ed75 crt: Add missing __cdecl signature to ucrt functions
When assigning function pointer to variable, both function and variable
should have same signature. Fix it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-20 22:10:06 +02:00
LIU Hao
3f295d0014 headers: Regenerate H from IDL
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-18 23:55:37 +08:00
Biswapriyo Nath
1701dd3988 headers: Add default parameter value in vsbackup.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-18 23:55:19 +08:00
Biswapriyo Nath
f9d9405966 headers: Add default parameter value in vswriter.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-18 23:55:14 +08:00
Martin Storsjö
a50a94d8e0 winpthreads: Add a missing (void) in the parameters for pthread_getevent
This avoids warnings if building code including it, with
-Wstrict-prototypes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-18 10:08:13 +02:00
Martin Storsjö
707c3b81f7 crt: Check the return value from MultiByteToWideChar in btowc
If MultiByteToWideChar failed, it could still have overwritten
the output variable.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-17 12:53:46 +02:00
LIU Hao
2f6d8b8061 headers: Regenerate H from IDL
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-13 21:02:23 +08:00
LIU Hao
db214cfb1c headers: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-13 20:59:52 +08:00
Biswapriyo Nath
50bb4d4f79 headers: Add mfmediacapture.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-13 20:51:33 +08:00
Biswapriyo Nath
5a699fa655 headers: Add mfd3d12.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-13 20:51:33 +08:00
Biswapriyo Nath
40b39f77ce headers: Add mfcaptureengine.idl
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-02-13 20:51:33 +08:00