2
0
mirror of https://github.com/boostorg/winapi.git synced 2026-01-19 17:02:09 +00:00

189 Commits

Author SHA1 Message Date
Andrey Semashev
39abf0c64c Work around non-standard SRWLOCK and CONDITION_VARIABLE types on MinGW.
PSRWLOCK and PCONDITION_VARIABLE types are defined to PVOID instead of
pointers to forward-declared structs. Define internal typedefs and use
cast_ptr to automatically cast to the type used in Windows SDK.
2025-08-15 05:43:47 +03:00
Andrey Semashev
7e615ee5f9 Unconditionally declare InitializeCriticalSectionEx on legacy MinGW.
InitializeCriticalSectionEx declaration is missing in Windows SDK headers,
so we have to declare it even when BOOST_USE_WINDOWS_H is defined.
2025-08-15 05:43:41 +03:00
Andrey Semashev
bbd9bf6585 Added a workaround for CompareObjectHandles on older MinGW-w64.
CompareObjectHandles declaration is missing in MinGW-w64 headers before 9.0.0,
although library exports seem to be present since 6.0.0.
2025-05-31 12:04:37 +03:00
Andrey Semashev
ea553ab4d2 Fixed leftover Signature type. 2024-08-26 14:15:08 +03:00
Andrey Semashev
9576c5ba88 Explicitly specify the namespace to avoid ADL. 2024-08-26 14:02:06 +03:00
Andrey Semashev
7689026a7a Renamed template parameter to make it clear that a function ptr is required. 2024-08-26 13:59:45 +03:00
Alexander Grund
3ce8d53c33 Allow direct cast of get_proc_address result (#95)
GetProcAddress returns a pointer to some function. It can return
pointers to different functions, so it has to return something that is
suitable to store any pointer to function. Microsoft chose FARPROC,
which is int (WINAPI *)() on 32-bit Windows. The user is supposed to
know the signature of the function he requests and perform a cast
(which is a nop on this platform). The result is a pointer to function
with the required signature, which is bitwise equal to what
GetProcAddress returned. However, gcc >= 8 warns about that.

Add an overload with a template parameter to do the cast inside
the function and suppress the warning there.
2024-08-26 13:57:23 +03:00
Andrey Semashev
85d7889e9b Target Windows 10 by default and the latest Windows if 10 is not supported. 2023-10-08 20:28:42 +03:00
Andrey Semashev
e1b0c543f7 Limit CompareObjectHandles to App and System partitions. 2023-10-08 20:07:35 +03:00
Andrey Semashev
3fa8b0ace1 Updated comment regarding NTSTATUS definition. 2022-02-13 22:33:14 +03:00
Andrey Semashev
b5e614126b Added cast to WORD of the MAKELANGID result.
This should silence -Wconversion warnings with gcc caused by integral
promotion that happend in the MAKELANGID macro implementation.

Also, simplified casts in our custom implementation of MAKELANGID_
function. Use C++ static_casts instead of C-style casts.

Closes https://github.com/boostorg/winapi/pull/88.
2021-10-03 22:19:07 +03:00
Andrey Semashev
97df13ac28 Include _mingw.h on MinGW and MinGW-w64.
This header is already included by Boost.Predef, but since we're
directly using macros defined in it, we better explicitly include
it ourselves and not rely on Boost.Predef implementation details.
2021-04-06 01:08:35 +03:00
Andrey Semashev
74032f8a52 Added a workaround for a different PSECURITY_DESCRIPTOR on MinGW. 2020-06-07 15:20:38 +03:00
Andrey Semashev
b217a5193c Nonessential. 2020-06-03 21:56:57 +03:00
Andrey Semashev
b27674ae0e Extracted GetProcAddress to a separate header.
Also corrected header/footer inclusion in dll.hpp.
2020-05-17 18:13:51 +03:00
Andrey Semashev
04a4248051 Added wait_on_address.hpp implementing WaitOnAddress and friends. 2020-05-16 19:35:39 +03:00
Andrey Semashev
e16aa75582 Extracted wait-related constants to a separate header. 2020-05-16 18:23:18 +03:00
Andrey Semashev
dff942d1f7 Added header and footer headers to disable compiler warnings.
Closes https://github.com/boostorg/winapi/issues/78.
2020-05-02 19:44:01 +03:00
Andrey Semashev
9efa7cbd5c Merge pull request #71 from xentrax/develop
boostorg/winapi/issues/70 Support Windows CE 6.00, 7.00 and WM 6.x
2020-05-02 02:15:26 +03:00
Andrey Semashev
c523cc4b5d Removed winerror.h include.
This include was obsolete, error codes are defined in error_codes.hpp.

Closes https://github.com/boostorg/winapi/issues/81.
2019-12-22 19:45:56 +03:00
Nikita Kniazev
372e68cc5e Add header deprecation warning 2019-11-07 17:09:33 +03:00
Andrey Semashev
65b9c99a67 Add explicit type casts for arguments of Interlocked* intrinsics.
This allows to use any compatible types with INTERLOCKED_* macros, not just
the ones strictly matching the particular implementation of the intrinsics.

In particular, this fixes compilation for Cygwin64, which is an LP64 target,
meaning that long is 64-bit and _Interlocked* intrinsics use a different
integer type for its 32-bit integer arguments.

Additionally, enable use of intrin.h on Cygwin (32-bit).

The test has been updated to explicitly use 32-bit integer arguments.
2019-07-10 14:44:13 +03:00
Andrey Semashev
bb91190323 Disable _Interlocked*Pointer intrinsics on x86 for MSVC-12 and below.
There is a macro conflict for _InterlockedExchangePointer between intrin.h from
MSVC-12 and winnt.h from Windows SDK 8.1, which causes compilation failures.
2019-07-10 01:06:34 +03:00
Andrey Semashev
bfb9932296 Use interlocked intrinsics for pointers more universally on more recent MSVC.
_Interlocked*Pointer intrinsics are defined for all target architectures on
MSVC-12 and later. On MSVC-11 they are also defined for ARM.
2019-05-31 18:24:35 +03:00
Andrey Semashev
52b44afc06 Use _Interlocked*Pointer intrinsics on ARM64 targets.
Fixes https://github.com/boostorg/winapi/issues/76.
Closes https://github.com/boostorg/winapi/pull/77.

Also, use consistent call convention attribute across _Interlocked*
intrinsics when they are declared in the header.
2019-05-31 17:32:57 +03:00
Andrey Semashev
ac2b9e6ad6 Another attempt to silence MinGW gcc 5.3 warnings about unused variables. 2019-01-04 19:00:09 +03:00
Andrey Semashev
f427298368 Revert "Disable gcc warnings about unused variables."
This reverts commit a073e63cd3.

The pragmas didn't help to silence the warnings on MinGW gcc 5.3.
2019-01-04 18:55:09 +03:00
Andrey Semashev
a073e63cd3 Disable gcc warnings about unused variables.
This warning is not supposed to appear for global constants, however gcc 5.3
from MinGW spams this warning, at least for the invalid_handle_value constant.
Therefore we disable this warning for all constants declared in Boost.WinAPI.
2019-01-04 00:33:52 +03:00
Vyacheslav Lanovets
66564382fa boostorg/winapi/issues/70 Windows CE has different CRITICAL_SECTION 2018-10-23 15:47:54 +03:00
Vyacheslav Lanovets
b0f92d5a5d boostorg/winapi/issues/70 compilation fix on Windows CE if boost/winapi headers are included without including windef.h first. Caused by including kfuncs.h which needs some typedefs 2018-10-23 15:46:27 +03:00
Vyacheslav Lanovets
5ea042c348 boostorg/winapi/issues/70 Unify handling compilation for MINGW and for Windows CE 2018-10-23 11:10:35 +03:00
Vyacheslav Lanovets
75bcf12ed7 boostorg/winapi/issues/70 Support Windows CE 6.00, 7.00 and Windows Mobile 6.x compilation without BOOST_USE_WINDOWS_H 2018-10-23 11:10:08 +03:00
Andrey Semashev
cb0f6ed2a5 Removed volatile qualifiers for WinCE older than 6.0. 2018-08-13 20:05:34 +03:00
Andrey Semashev
bf9dfd9f21 Added support for clang-cl, improved support for WinCE and MSVC 8 and 9.
This commit incorporates some of the changes made to
boost/smart_ptr/detail/sp_interlocked.hpp by Peter Dimov, namely:

- Define an internal config macro BOOST_INTERLOCKED_HAS_INTRIN_H when
  the compiler is known to have a useful intrin.h header.
- Use this macro to select the common implementation based on intrin.h.
- Removed MinGW-w64 branch of implementation as it is now covered by
  the common branch based on intrin.h.
- Added detection of clang-cl, a new MSVC pretender. The compiler is
  assumed to have support for intrin.h.
- Added a separate branch for Windows CE >=6, with differently named
  interlocked functions. No way to test this and no idea if this is
  correct.
- For MSVC 8 and 9 don't use intrin.h as it reportedly conflicts
  with <utility>. On these compilers we will declare the intrinsics
  ourselves.
2018-08-13 18:44:29 +03:00
Andrey Semashev
fee1bec7f9 Marked OVERLAPPED member struct with __extension__ to silence gcc warnings. 2018-08-08 20:54:02 +03:00
Andrey Semashev
3f56c2348f Removed the deprecated definitions of calling convention macros.
These macros conflict with the same named macros from Windows SDK and generate
warnings. Downstream libraries were ported to Boost.WinAPI replacement macros.
2018-04-18 07:39:09 +03:00
Andrey Semashev
1b912fa070 Silenced gcc warnings about using long long in C++03. 2018-03-26 21:51:03 +03:00
Andrey Semashev
a9bc4e753e Added an extension markup to silence gcc warnings about nameless struct. 2018-03-23 21:28:48 +03:00
Andrey Semashev
169d0ad34b Added new error codes and made error_codes_abi test auto-generated. 2018-03-17 21:07:11 +03:00
Andrey Semashev
97adb533ae Don't enable bcrypt on MinGW-w64 regardless of the target Windows version. This API is only available since Vista. 2018-03-16 23:00:47 +03:00
Andrey Semashev
d626055575 Updates for compatibility with Cygwin. 2018-03-11 19:40:41 +03:00
Andrey Semashev
9fbba91e44 Fixed compilation. 2018-03-11 03:38:27 +03:00
Andrey Semashev
2f3fa36ba1 Updated API partition checks. 2018-03-11 03:30:54 +03:00
Andrey Semashev
e64e4d646a Added WINAPI and NTAPI macros. Deprecated until downstream libraries update.
These macros may clash with macros defined by Windows SDK and generate warnings.
Downstream libraries need to be ported to Boost.WinAPI replacements and then
these definitions can be removed.
2018-03-11 02:41:06 +03:00
Andrey Semashev
5a8d525e84 Renamed calling conventions macros. 2018-03-11 02:05:57 +03:00
Andrey Semashev
936447c9f7 Updated PROCESS_ALL_ACCESS definition for pre-Vista targets. 2018-03-11 00:33:13 +03:00
Andrey Semashev
b6d038998a Removed the obsolete workaround for MinGW buggy declarations of crypt functions. 2018-03-10 23:44:09 +03:00
Andrey Semashev
fcd61f3b2e Fixed bugs according to tests. 2018-03-10 21:02:48 +03:00
Andrey Semashev
3a249ca7c6 Fixed MSVC-14.1 compilation.
The compiler doesn't consider INVALID_HANDLE_VALUE initializer as a
compile-time constant expression.
2018-03-09 03:11:42 +03:00
Andrey Semashev
c4ebb6d9d0 Improve compatibility with Cygwin 64.
The compiler on Cygwin 64 does not define _WIN64. Instead, the macro is
defined in the private header. Without the macro we fail to detect 64-bit
Windows target and define basic types incorrectly. Include the private
header for now; we may switch to our private macro for this purpose
eventually.

Also avoid using boost/cstdint.hpp to define basic integer types as in
case of Cygwin 64, an LP64 platform, uint64_t and ULONGLONG are different
types.
2018-03-09 02:47:24 +03:00