Commit Graph

140 Commits

Author SHA1 Message Date
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
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
7a3ebe07be Changed the legacy namespace declaration method.
MSVC-14.1 emits an error for the namespace alias because the same-named
symbol is visible from the point of the alias declaration. Instead, define
a new winapi namespace and import the boost::winapi namespace contents
into it.
2017-10-24 22:51:22 +03:00
Andrey Semashev
59cdbedd30 Renamed some leftover macros to have prefix BOOST_WINAPI. 2017-10-19 02:40:01 +03:00
Andrey Semashev
6b67a9c5cf Moved library headers and symbols to the boost level directory and namespace.
Despite that the library now appears at the top level in the filesystem and
namespace, it is still not intended to be used by Boost users - the library
is purposed as an internal tool for Boost needs.

The old headers are still present and define the old namespace as an alias
to the new namespace. Thus backward compatibility is preserved. These headers
will be removed as soon as all dependent libraries are updated.

While at it, also made some nonessential cleanup in headers.
2017-10-19 01:07:51 +03:00
Andrey Semashev
a9abc7668a Fixed incorrect preprocessor directive. 2017-10-08 18:09:45 +03:00
Andrey Semashev
db74f2753a Fixed NTSTATUS_ definition when BOOST_USE_WINDOWS_H is defined. 2017-10-07 21:13:56 +03:00
Andrey Semashev
d5adfec9d1 Formatting and other nonessential changes. 2017-10-07 20:58:28 +03:00
Andrey Semashev
b5bbd3a997 Merge remote-tracking branch 'jeking3/add-bcrypt-support' into develop 2017-10-07 20:38:00 +03:00
Andrey Semashev
d5f9d9d436 Updated partition macro. 2017-10-07 20:21:28 +03:00
Andrey Semashev
8091170850 Ported the rest of the headers to partition macros.
Also, enabled all API partitions by default on Windows SDKs without
support for API families.
2017-10-07 19:54:16 +03:00
James E. King, III
ac43c2c0fd add bcrypt support for RNG
This fixes #47
2017-10-07 12:32:18 -04:00
Andrey Semashev
4e089d4bbb Corrected a typo in the comment. 2017-10-07 14:37:12 +03:00
James E. King, III
33bd73b769 Add support for Windows Store (UWP) development, i.e.
WINAPI_FAMILY=WINAPI_FAMILY_PC_APP

This fixes #53
2017-10-03 23:37:30 -04:00
Andrey Semashev
799be2a866 Removed the special code for Windows CE 6.0.
Reportedly, that code branch was not working an caused linking errors. As
reported in https://svn.boost.org/trac10/ticket/5431, Windows CE SDK still
provides Interlocked function definitions, but with slightly different
signatures. This PR keeps a single code branch for Windows CE that matches
the declarations described in the ticket. Untested.

This change is based on https://github.com/boostorg/winapi/pull/58
by James E. King, III <jking@apache.org>.

Fixes https://svn.boost.org/trac10/ticket/5431.
2017-09-24 02:36:37 +03:00
Andrey Semashev
d687b7c837 Fixed GetSystemTimeAsFileTime emulation for Windows CE.
This change originated from https://github.com/boostorg/winapi/pull/58
by James E. King, III <jking@apache.org>.
2017-09-24 02:36:37 +03:00
Andrey Semashev
f6369f95c3 Added support for specifying NTDDI version.
This change offers more control over the target Windows version. By
defining BOOST_USE_NTDDI_VERSION the user is able to specify the Windows
version down to the particular Service Pack. By default
BOOST_USE_NTDDI_VERSION will be deduced from either NTDDI_VERSION or
BOOST_USE_WINAPI_VERSION (which, in turn can be deduced from other
macros). In the latter case the macro will default to the latest known
Service Pack shipped for the given Windows version.

In addition to more control on the user's side this change also allows to
define APIs that first appeared in a Service Pack as opposed to RTM. This
allowed to fix compilation of RtlCaptureStackBackTrace.

Also updated the workaround for CryptReleaseContext since Windows SDK 10.0
no longer requires it.
2017-09-24 02:36:37 +03:00
Andrey Semashev
fac7ef4518 Deleted the previously deprecated headers.
Fixes https://github.com/boostorg/winapi/issues/54.
2017-09-24 02:36:37 +03:00
Andrey Semashev
1c2e1c1c2b Jobs API is only available since Windows 2000.
This change originated from https://github.com/boostorg/winapi/pull/56
by James E. King, III <jking@apache.org>.

Fixes https://github.com/boostorg/winapi/issues/50.
2017-09-24 02:36:37 +03:00
Andrey Semashev
e9a3073f22 Use BOOST_FORCEINLINE for function wrappers. 2017-09-24 02:36:37 +03:00
Andrey Semashev
4956f78177 Added availability conditions of some of the constants.
This change originated from https://github.com/boostorg/winapi/pull/56
by James E. King, III <jking@apache.org>.
2017-09-24 02:36:37 +03:00
Andrey Semashev
516452e210 Fixed CompareObjectHandles not being defined extern C.
This change originated from https://github.com/boostorg/winapi/pull/56
by James E. King, III <jking@apache.org>.

Fixes https://github.com/boostorg/winapi/issues/52.
2017-09-24 02:36:06 +03:00
Andrey Semashev
ed10dcd02c Default to the latest Service Pack of the selected Windows version. 2017-09-24 02:24:20 +03:00
Andrey Semashev
7da1309feb Use NTDDI_VERSION to enable RtlCaptureStackBackTrace only since WinXP SP1.
This change was made in response to https://github.com/boostorg/winapi/pull/56
by James E. King, III <jking@apache.org>.

Relates to https://github.com/boostorg/winapi/issues/50.
2017-09-24 02:21:47 +03:00
Andrey Semashev
8c5e9211bd Added WaitForMultipleObjectsEx and WaitForMultipleObjectsEx.
The new functions are needed for Boost.Thread.
2017-08-31 13:51:59 +03:00
Andrey Semashev
3785dcf5ce Revert "Revert "Use BOOST_MAY_ALIAS from Boost.Config.""
This reverts commit 54c4cfc30f.
2017-08-26 15:13:39 +03:00
Andrey Semashev
54c4cfc30f Revert "Use BOOST_MAY_ALIAS from Boost.Config."
This reverts commit 747442645d.

This is temporary until BOOST_MAY_ALIAS in Boost.Config is merged to master.
2017-07-30 15:42:54 +03:00
Andrey Semashev
747442645d Use BOOST_MAY_ALIAS from Boost.Config. 2017-07-29 17:01:30 +03:00
Andrey Semashev
6a30df890f Added FILE_FLAG constants. 2017-07-06 17:36:01 +03:00
Andrey Semashev
394b67982a Fixed compatibility with MSVC 8 when using windows.h. 2017-06-25 13:26:10 +03:00
Andrey Semashev
af39db6544 Added RtlCaptureStackBackTrace. 2017-06-24 17:37:32 +03:00
Andrey Semashev
9a315f48e3 Fixed compatibility with MinGW. 2017-06-24 17:32:55 +03:00
Vinnie Falco
1ab3751d57 Add debugapi.hpp 2017-05-23 10:10:00 -07:00
Andrey Semashev
c3e8180be5 Trim trailing spaces. 2017-02-17 13:42:33 +03:00
Andrey Semashev
b017fd8866 Added wrappers for CryptEnumProviders* to work aroung MinGW bugs. 2017-01-17 00:39:17 +03:00
Andrey Semashev
d1ce3b2d3f Added a workaround for CryptReleaseContext in Windows 2000
CryptReleaseContext is declared differently in MS Windows SDK 6.0A and
later when targeting Windows versions older than XP. This is not the case
in MinGW and MinGW-w64 and MSVC shipped with their own Windows SDK.

Also added BOOST_WINAPI_DEFINE_VERSION_MACROS config macro which allows
Boost.WinAPI to define Windows SDK version macros even when it is not
configured to include windows.h. This can help to ensure that the user
targets the same Windows version as Boost.
2017-01-17 00:29:18 +03:00
Andrey Semashev
f2f956c593 Only enable IsProcessInJob from Windows XP on up. 2017-01-17 00:28:45 +03:00
Andrey Semashev
e46a1b7710 Disabled an MSVC warning about a nameless struct/union. 2016-11-06 21:38:09 +03:00
Andrey Semashev
6dfe926d03 Nonessential. 2016-10-08 19:04:05 +03:00
Andrey Semashev
711a6bbd45 Added GetFileInformationByHandle function. 2016-10-08 19:00:24 +03:00
Ion Gaztañaga
5272ee7ac3 Pragma message is only available for GCC > 4.3 2016-08-09 00:11:10 +02:00
Andrey Semashev
8a1c94ae26 Removed WAIT_TIMEOUT_ as it duplicates the constant in wait.hpp. 2016-07-18 02:55:35 +03:00
Andrey Semashev
b1f1e5d6fd Added a header with Windows error codes. 2016-07-16 22:02:15 +03:00
Andrey Semashev
b31a496273 Added OpenProcess function and access rights constants. 2016-07-16 21:00:41 +03:00
Andrey Semashev
0fe7a608d4 Added job management APIs. 2016-07-16 20:43:52 +03:00
Andrey Semashev
c4329b8574 Fixed formatting, added comments, removed unused include. 2016-07-16 20:25:14 +03:00