From 3c3c4841312262c73c5d973d590f541f8445962d Mon Sep 17 00:00:00 2001 From: YuutaW <17158086+Trumeet@users.noreply.github.com> Date: Mon, 1 Jul 2019 14:43:07 -0700 Subject: feat: add support for Windows 7 Aero API Breaking changes: To test on the Windows 7 x86 virtual machine, the build had been changed from mingwX64 to mingwX86. Therefore the binary path will be changed, INT_PTR will represent Int and some Gradle tasks disappeared and changed. Due to the change of INT_PTR and some unknown reasons, the dialog cannot be shown so I removed the dialog mode. Signed-off-by: Trumeet <17158086+Trumeet@users.noreply.github.com> --- .travis.yml | 2 +- build.gradle | 17 +- src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt | 73 +- src/mingwMain/kotlin/moe/yuuta/aero/WinApi.kt | 43 +- src/mingwMain/kotlin/moe/yuuta/aero/WinCompat.kt | 9 + src/nativeInterop/cinterop/aero.h | 62 - src/nativeInterop/cinterop/aero/aero.h | 62 + src/nativeInterop/cinterop/versionhelper.def | 4 + src/nativeInterop/cinterop/versionhelper/no_sal2.h | 1042 +++++++++++++++++ .../cinterop/versionhelper/specstrings.h | 714 ++++++++++++ .../cinterop/versionhelper/specstrings_strict.h | 1186 ++++++++++++++++++++ .../cinterop/versionhelper/specstrings_undef.h | 455 ++++++++ .../cinterop/versionhelper/versionhelper.h | 154 +++ .../cinterop/versionhelper/winapifamily.h | 234 ++++ .../cinterop/versionhelper/winpackagefamily.h | 72 ++ 15 files changed, 3995 insertions(+), 134 deletions(-) delete mode 100644 src/nativeInterop/cinterop/aero.h create mode 100644 src/nativeInterop/cinterop/aero/aero.h create mode 100644 src/nativeInterop/cinterop/versionhelper.def create mode 100644 src/nativeInterop/cinterop/versionhelper/no_sal2.h create mode 100644 src/nativeInterop/cinterop/versionhelper/specstrings.h create mode 100644 src/nativeInterop/cinterop/versionhelper/specstrings_strict.h create mode 100644 src/nativeInterop/cinterop/versionhelper/specstrings_undef.h create mode 100644 src/nativeInterop/cinterop/versionhelper/versionhelper.h create mode 100644 src/nativeInterop/cinterop/versionhelper/winapifamily.h create mode 100644 src/nativeInterop/cinterop/versionhelper/winpackagefamily.h diff --git a/.travis.yml b/.travis.yml index 6753b7f..c721757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_deploy: # TODO: Add this part to the Gradle - export VERSION=$(git rev-list --count HEAD) - git tag $VERSION - - mv "build/bin/mingwX64/releaseExecutable/Aero.exe" "./Aero-$VERSION.exe" + - mv "build/bin/mingwX86/releaseExecutable/Aero.exe" "./Aero-$VERSION.exe" deploy: name: ${VERSION} prerelease: true diff --git a/build.gradle b/build.gradle index 6317036..b27f519 100644 --- a/build.gradle +++ b/build.gradle @@ -7,23 +7,28 @@ repositories { } kotlin { - mingwX64() + mingwX86() sourceSets { - mingwX64Main { - mingwX64Main.kotlin.srcDirs += file("src/mingwMain/kotlin") + mingwX86Main { + mingwX86Main.kotlin.srcDirs += file("src/mingwMain/kotlin") } } - mingwX64 { + mingwX86 { binaries { executable { entryPoint 'moe.yuuta.aero.main' - linkerOpts "-Wl,--subsystem,windows" + linkerOpts "-Wl,--subsystem,windows,-ldwmapi" } } compilations.main.cinterops { aero { includeDirs { - allHeaders 'src/nativeInterop/cinterop' + allHeaders 'src/nativeInterop/cinterop/aero' + } + } + versionhelper { + includeDirs { + allHeaders 'src/nativeInterop/cinterop/versionhelper' } } } diff --git a/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt b/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt index 44c184e..e9f47b4 100644 --- a/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt +++ b/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt @@ -29,38 +29,23 @@ fun main() { null ) - val forceDialogEnv = WinApi.getenv("AERO_DEMO_FORCE_DIALOG") + if (hwnd == null) { + MessageBoxA(null, + "The system returns an empty dialog (${GetLastError()})", + "Aero", + (MB_OK or MB_ICONERROR).convert()) + return + } - if (hwnd == null || (forceDialogEnv == "true")) { - if (hwnd == null) { - MessageBoxA(null, - "The system returns an empty dialog (${GetLastError()})", - "Aero", - (MB_OK or MB_ICONERROR).convert()) - } - memScoped { - // Fallback - val dlgImpl = cValue { - style = (WS_OVERLAPPEDWINDOW or - DS_CENTER or - DS_MODALFRAME).convert() - dwExtendedStyle = 0.convert() - cdit = 0.convert() - x = 0 - y = 0 - cx = 400 - cy = 200 - } - return@memScoped DialogBoxIndirectParamW(WinCompat.hInstance, - dlgImpl.ptr, - null, - staticCFunction(::dlgProc), - 0) - } - } else { - ShowWindow(hwnd, WinCompat.nCmdShow) - WinApi.msgLoop() + val result = DwmEnableComposition(DWM_EC_ENABLECOMPOSITION) and 0xFFFF + if (result != 0) { + MessageBoxA(hwnd, + "DwmEnableComposition() fail (0x${result.toString(16)})", + "Aero", + (MB_OK or MB_ICONERROR).convert()) } + ShowWindow(hwnd, WinCompat.nCmdShow) + WinApi.msgLoop() } fun windowProc(hwnd: HWND?, @@ -69,13 +54,17 @@ fun windowProc(hwnd: HWND?, lParam: LPARAM): LRESULT { return when (uMsg.convert()) { WM_CREATE -> { - WinApi.setAero(hwnd) + WinApi.setAero10(hwnd) 1 } WM_DESTROY -> { PostQuitMessage(0) 1 } + WM_ACTIVATE -> { + WinApi.setAero7(hwnd) + 1 + } WM_PAINT -> { val ps = nativeHeap.alloc() val hdc = BeginPaint(hwnd, ps.ptr) @@ -90,26 +79,4 @@ fun windowProc(hwnd: HWND?, DefWindowProcA(hwnd, uMsg, wParam, lParam) } } -} - -fun dlgProc(hDlg: HWND?, - message: UINT, - wParam: WPARAM, - lParam: LPARAM): INT_PTR { - when (message.convert()) { - WM_INITDIALOG -> { - WinApi.setAero(hDlg) - return true.toByte().toLong() - } - WM_COMMAND -> { - EndDialog(hDlg, wParam.convert()) - return true.toByte().toLong() - } - WM_CTLCOLORDLG -> { - return GetStockObject(BLACK_BRUSH).rawValue.toLong() - } - else -> { - return false.toByte().toLong() - } - } } \ No newline at end of file diff --git a/src/mingwMain/kotlin/moe/yuuta/aero/WinApi.kt b/src/mingwMain/kotlin/moe/yuuta/aero/WinApi.kt index 381f002..75453ef 100644 --- a/src/mingwMain/kotlin/moe/yuuta/aero/WinApi.kt +++ b/src/mingwMain/kotlin/moe/yuuta/aero/WinApi.kt @@ -5,19 +5,10 @@ import aero.WINDOWCOMPOSITIONATTRIBDATA import aero.pfnSetWindowCompositionAttribute import kotlinx.cinterop.* import platform.windows.* +import versionhelper.IsWindows10OrGreater +import versionhelper.IsWindowsVistaOrGreater object WinApi { - fun getenv(name: String): String = memScoped { - val buffer = nativeHeap.allocArray(MAX_PATH) - GetEnvironmentVariableA(name, - buffer, - MAX_PATH - ) - val env = buffer.toKString() - nativeHeap.free(buffer) - return@memScoped env - } - fun msgLoop() { memScoped { val msg = nativeHeap.alloc() @@ -33,7 +24,7 @@ object WinApi { } } - fun setAero(hwnd: HWND?) { + private fun _setAero10(hwnd: HWND?) { val hUser = GetModuleHandleW("user32.dll") ?: return val setWindowCompositionAttribute = GetProcAddress(hUser, "SetWindowCompositionAttribute") @@ -53,4 +44,32 @@ object WinApi { setWindowCompositionAttribute(hwnd, data.ptr) } } + + fun setAero10(hwnd: HWND?) { + if (IsWindows10OrGreater() == 1) { + _setAero10(hwnd) + } + } + + private fun _setAero7(hwnd: HWND?): Int { + val margins = cValue { + cxLeftWidth = -1 + } + return memScoped { + return@memScoped DwmExtendFrameIntoClientArea(hwnd, margins.ptr) + } + } + + fun setAero7(hwnd: HWND?) { + if (IsWindowsVistaOrGreater() == 1 && + WinCompat.DwmIsCompositionEnabled()) { + val result = _setAero7(hwnd) + if (result != 0) { + MessageBoxA(hwnd, + "Cannot extend the aero glass (0x${result.toString(16)})", + "Aero", + (MB_OK or MB_ICONERROR).convert()) + } + } + } } \ No newline at end of file diff --git a/src/mingwMain/kotlin/moe/yuuta/aero/WinCompat.kt b/src/mingwMain/kotlin/moe/yuuta/aero/WinCompat.kt index 29c78fb..029e9a2 100644 --- a/src/mingwMain/kotlin/moe/yuuta/aero/WinCompat.kt +++ b/src/mingwMain/kotlin/moe/yuuta/aero/WinCompat.kt @@ -3,6 +3,7 @@ package moe.yuuta.aero import kotlinx.cinterop.* import platform.windows.GetModuleHandleA import platform.windows.GetStartupInfoA +import platform.windows.WINBOOLVar import platform.windows._STARTUPINFOA object WinCompat { @@ -16,4 +17,12 @@ object WinCompat { } val hInstance get() = GetModuleHandleA(null) + + fun DwmIsCompositionEnabled(): Boolean { + val enable = nativeHeap.alloc() + platform.windows.DwmIsCompositionEnabled(enable.ptr) + val result = enable.value + nativeHeap.free(enable) + return result > 0 + } } \ No newline at end of file diff --git a/src/nativeInterop/cinterop/aero.h b/src/nativeInterop/cinterop/aero.h deleted file mode 100644 index 639d6c3..0000000 --- a/src/nativeInterop/cinterop/aero.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -#include -typedef enum _WINDOWCOMPOSITIONATTRIB -{ - WCA_UNDEFINED = 0, - WCA_NCRENDERING_ENABLED = 1, - WCA_NCRENDERING_POLICY = 2, - WCA_TRANSITIONS_FORCEDISABLED = 3, - WCA_ALLOW_NCPAINT = 4, - WCA_CAPTION_BUTTON_BOUNDS = 5, - WCA_NONCLIENT_RTL_LAYOUT = 6, - WCA_FORCE_ICONIC_REPRESENTATION = 7, - WCA_EXTENDED_FRAME_BOUNDS = 8, - WCA_HAS_ICONIC_BITMAP = 9, - WCA_THEME_ATTRIBUTES = 10, - WCA_NCRENDERING_EXILED = 11, - WCA_NCADORNMENTINFO = 12, - WCA_EXCLUDED_FROM_LIVEPREVIEW = 13, - WCA_VIDEO_OVERLAY_ACTIVE = 14, - WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15, - WCA_DISALLOW_PEEK = 16, - WCA_CLOAK = 17, - WCA_CLOAKED = 18, - WCA_ACCENT_POLICY = 19, - WCA_FREEZE_REPRESENTATION = 20, - WCA_EVER_UNCLOAKED = 21, - WCA_VISUAL_OWNER = 22, - WCA_HOLOGRAPHIC = 23, - WCA_EXCLUDED_FROM_DDA = 24, - WCA_PASSIVEUPDATEMODE = 25, - WCA_LAST = 26 -} WINDOWCOMPOSITIONATTRIB; - -typedef struct _WINDOWCOMPOSITIONATTRIBDATA -{ - WINDOWCOMPOSITIONATTRIB Attrib; - PVOID pvData; - SIZE_T cbData; -} WINDOWCOMPOSITIONATTRIBDATA; - -typedef enum _ACCENT_STATE -{ - ACCENT_DISABLED = 0, - ACCENT_ENABLE_GRADIENT = 1, - ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, - ACCENT_ENABLE_BLURBEHIND = 3, - ACCENT_ENABLE_ACRYLICBLURBEHIND = 4, // RS4 1803 - ACCENT_ENABLE_HOSTBACKDROP = 5, // RS5 1809 - ACCENT_INVALID_STATE = 6 -} ACCENT_STATE; - -typedef struct _ACCENT_POLICY -{ - ACCENT_STATE AccentState; - DWORD AccentFlags; - DWORD GradientColor; - DWORD AnimationId; -} ACCENT_POLICY; - -typedef BOOL (WINAPI *pfnGetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONATTRIBDATA*); - -typedef BOOL (WINAPI *pfnSetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONATTRIBDATA*); \ No newline at end of file diff --git a/src/nativeInterop/cinterop/aero/aero.h b/src/nativeInterop/cinterop/aero/aero.h new file mode 100644 index 0000000..639d6c3 --- /dev/null +++ b/src/nativeInterop/cinterop/aero/aero.h @@ -0,0 +1,62 @@ +#pragma once +#include +typedef enum _WINDOWCOMPOSITIONATTRIB +{ + WCA_UNDEFINED = 0, + WCA_NCRENDERING_ENABLED = 1, + WCA_NCRENDERING_POLICY = 2, + WCA_TRANSITIONS_FORCEDISABLED = 3, + WCA_ALLOW_NCPAINT = 4, + WCA_CAPTION_BUTTON_BOUNDS = 5, + WCA_NONCLIENT_RTL_LAYOUT = 6, + WCA_FORCE_ICONIC_REPRESENTATION = 7, + WCA_EXTENDED_FRAME_BOUNDS = 8, + WCA_HAS_ICONIC_BITMAP = 9, + WCA_THEME_ATTRIBUTES = 10, + WCA_NCRENDERING_EXILED = 11, + WCA_NCADORNMENTINFO = 12, + WCA_EXCLUDED_FROM_LIVEPREVIEW = 13, + WCA_VIDEO_OVERLAY_ACTIVE = 14, + WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15, + WCA_DISALLOW_PEEK = 16, + WCA_CLOAK = 17, + WCA_CLOAKED = 18, + WCA_ACCENT_POLICY = 19, + WCA_FREEZE_REPRESENTATION = 20, + WCA_EVER_UNCLOAKED = 21, + WCA_VISUAL_OWNER = 22, + WCA_HOLOGRAPHIC = 23, + WCA_EXCLUDED_FROM_DDA = 24, + WCA_PASSIVEUPDATEMODE = 25, + WCA_LAST = 26 +} WINDOWCOMPOSITIONATTRIB; + +typedef struct _WINDOWCOMPOSITIONATTRIBDATA +{ + WINDOWCOMPOSITIONATTRIB Attrib; + PVOID pvData; + SIZE_T cbData; +} WINDOWCOMPOSITIONATTRIBDATA; + +typedef enum _ACCENT_STATE +{ + ACCENT_DISABLED = 0, + ACCENT_ENABLE_GRADIENT = 1, + ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, + ACCENT_ENABLE_BLURBEHIND = 3, + ACCENT_ENABLE_ACRYLICBLURBEHIND = 4, // RS4 1803 + ACCENT_ENABLE_HOSTBACKDROP = 5, // RS5 1809 + ACCENT_INVALID_STATE = 6 +} ACCENT_STATE; + +typedef struct _ACCENT_POLICY +{ + ACCENT_STATE AccentState; + DWORD AccentFlags; + DWORD GradientColor; + DWORD AnimationId; +} ACCENT_POLICY; + +typedef BOOL (WINAPI *pfnGetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONATTRIBDATA*); + +typedef BOOL (WINAPI *pfnSetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONATTRIBDATA*); \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper.def b/src/nativeInterop/cinterop/versionhelper.def new file mode 100644 index 0000000..0fba0a7 --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper.def @@ -0,0 +1,4 @@ +headers = versionhelper.h +headerFilter = versionhelper.h +package = versionhelper +linkerOpts = -lkernel32 \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper/no_sal2.h b/src/nativeInterop/cinterop/versionhelper/no_sal2.h new file mode 100644 index 0000000..592648d --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/no_sal2.h @@ -0,0 +1,1042 @@ + +/*** +* no_sal2.h - renders the SAL annotations for documenting APIs harmless. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +*Purpose: +* sal.h provides a set of SAL2 annotations to describe how a function uses its +* parameters - the assumptions it makes about them, and the guarantees it makes +* upon finishing. This file redefines all those annotation macros to be harmless. +* It is designed for use in down-level build environments where the tooling may +* be unhappy with the standard SAL2 macro definitions. +* +* [Public] +* +****/ + +#ifndef _NO_SAL_2_H_ +#define _NO_SAL_2_H_ + +#ifdef _When_ +#undef _When_ +#endif +#define _When_(c,a) +#ifdef _At_ +#undef _At_ +#endif +#define _At_(t,a) +#ifdef _At_buffer_ +#undef _At_buffer_ +#endif +#define _At_buffer_(t,i,c,a) +#ifdef _Group_ +#undef _Group_ +#endif +#define _Group_(a) +#ifdef _Pre_ +#undef _Pre_ +#endif +#define _Pre_ +#ifdef _Post_ +#undef _Post_ +#endif +#define _Post_ +#ifdef _Deref_ +#undef _Deref_ +#endif +#define _Deref_ +#ifdef _Null_ +#undef _Null_ +#endif +#define _Null_ +#ifdef _Notnull_ +#undef _Notnull_ +#endif +#define _Notnull_ +#ifdef _Maybenull_ +#undef _Maybenull_ +#endif +#define _Maybenull_ +#ifdef _Const_ +#undef _Const_ +#endif +#define _Const_ +#ifdef _Check_return_ +#undef _Check_return_ +#endif +#define _Check_return_ +#ifdef _Must_inspect_result_ +#undef _Must_inspect_result_ +#endif +#define _Must_inspect_result_ +#ifdef _Pre_satisfies_ +#undef _Pre_satisfies_ +#endif +#define _Pre_satisfies_(e) +#ifdef _Post_satisfies_ +#undef _Post_satisfies_ +#endif +#define _Post_satisfies_(e) +#ifdef _Writable_elements_ +#undef _Writable_elements_ +#endif +#define _Writable_elements_(s) +#ifdef _Writable_bytes_ +#undef _Writable_bytes_ +#endif +#define _Writable_bytes_(s) +#ifdef _Readable_elements_ +#undef _Readable_elements_ +#endif +#define _Readable_elements_(s) +#ifdef _Readable_bytes_ +#undef _Readable_bytes_ +#endif +#define _Readable_bytes_(s) +#ifdef _Null_terminated_ +#undef _Null_terminated_ +#endif +#define _Null_terminated_ +#ifdef _NullNull_terminated_ +#undef _NullNull_terminated_ +#endif +#define _NullNull_terminated_ +#ifdef _Valid_ +#undef _Valid_ +#endif +#define _Valid_ +#ifdef _Notvalid_ +#undef _Notvalid_ +#endif +#define _Notvalid_ +#ifdef _Success_ +#undef _Success_ +#endif +#define _Success_(c) +#ifdef _Return_type_success_ +#undef _Return_type_success_ +#endif +#define _Return_type_success_(c) +#ifdef _On_failure_ +#undef _On_failure_ +#endif +#define _On_failure_(a) +#ifdef _Always_ +#undef _Always_ +#endif +#define _Always_(a) +#ifdef _Use_decl_annotations_ +#undef _Use_decl_annotations_ +#endif +#define _Use_decl_annotations_ +#ifdef _Pre_defensive_ +#undef _Pre_defensive_ +#endif +#define _Pre_defensive_ +#ifdef _Post_defensive_ +#undef _Post_defensive_ +#endif +#define _Post_defensive_ +#ifdef _Pre_unknown_ +#undef _Pre_unknown_ +#endif +#define _Pre_unknown_ +#ifdef _Acquires_lock_ +#undef _Acquires_lock_ +#endif +#define _Acquires_lock_(e) +#ifdef _Releases_lock_ +#undef _Releases_lock_ +#endif +#define _Releases_lock_(e) +#ifdef _Requires_lock_held_ +#undef _Requires_lock_held_ +#endif +#define _Requires_lock_held_(e) +#ifdef _Requires_lock_not_held_ +#undef _Requires_lock_not_held_ +#endif +#define _Requires_lock_not_held_(e) +#ifdef _Requires_no_locks_held_ +#undef _Requires_no_locks_held_ +#endif +#define _Requires_no_locks_held_ +#ifdef _Guarded_by_ +#undef _Guarded_by_ +#endif +#define _Guarded_by_(e) +#ifdef _Write_guarded_by_ +#undef _Write_guarded_by_ +#endif +#define _Write_guarded_by_(e) +#ifdef _Interlocked_ +#undef _Interlocked_ +#endif +#define _Interlocked_ +#ifdef _Post_same_lock_ +#undef _Post_same_lock_ +#endif +#define _Post_same_lock_(e1,e2) +#ifdef _Benign_race_begin_ +#undef _Benign_race_begin_ +#endif +#define _Benign_race_begin_ +#ifdef _Benign_race_end_ +#undef _Benign_race_end_ +#endif +#define _Benign_race_end_ +#ifdef _No_competing_thread_ +#undef _No_competing_thread_ +#endif +#define _No_competing_thread_ +#ifdef _No_competing_thread_begin_ +#undef _No_competing_thread_begin_ +#endif +#define _No_competing_thread_begin_ +#ifdef _No_competing_thread_end_ +#undef _No_competing_thread_end_ +#endif +#define _No_competing_thread_end_ +#ifdef _Acquires_shared_lock_ +#undef _Acquires_shared_lock_ +#endif +#define _Acquires_shared_lock_(e) +#ifdef _Releases_shared_lock_ +#undef _Releases_shared_lock_ +#endif +#define _Releases_shared_lock_(e) +#ifdef _Requires_shared_lock_held_ +#undef _Requires_shared_lock_held_ +#endif +#define _Requires_shared_lock_held_(e) +#ifdef _Acquires_exclusive_lock_ +#undef _Acquires_exclusive_lock_ +#endif +#define _Acquires_exclusive_lock_(e) +#ifdef _Releases_exclusive_lock_ +#undef _Releases_exclusive_lock_ +#endif +#define _Releases_exclusive_lock_(e) +#ifdef _Requires_exclusive_lock_held_ +#undef _Requires_exclusive_lock_held_ +#endif +#define _Requires_exclusive_lock_held_(e) +#ifdef _Has_lock_kind_ +#undef _Has_lock_kind_ +#endif +#define _Has_lock_kind_(n) +#ifdef _Create_lock_level_ +#undef _Create_lock_level_ +#endif +#define _Create_lock_level_(n) +#ifdef _Has_lock_level_ +#undef _Has_lock_level_ +#endif +#define _Has_lock_level_(n) +#ifdef _Lock_level_order_ +#undef _Lock_level_order_ +#endif +#define _Lock_level_order_(n1,n2) +#ifdef _Analysis_assume_lock_acquired_ +#undef _Analysis_assume_lock_acquired_ +#endif +#define _Analysis_assume_lock_acquired_(e) +#ifdef _Analysis_assume_lock_released_ +#undef _Analysis_assume_lock_released_ +#endif +#define _Analysis_assume_lock_released_(e) +#ifdef _Analysis_assume_lock_held_ +#undef _Analysis_assume_lock_held_ +#endif +#define _Analysis_assume_lock_held_(e) +#ifdef _Analysis_assume_lock_not_held_ +#undef _Analysis_assume_lock_not_held_ +#endif +#define _Analysis_assume_lock_not_held_(e) +#ifdef _Analysis_assume_same_lock_ +#undef _Analysis_assume_same_lock_ +#endif +#define _Analysis_assume_same_lock_(e) +#ifdef _In_ +#undef _In_ +#endif +#define _In_ +#ifdef _Out_ +#undef _Out_ +#endif +#define _Out_ +#ifdef _Inout_ +#undef _Inout_ +#endif +#define _Inout_ +#ifdef _In_z_ +#undef _In_z_ +#endif +#define _In_z_ +#ifdef _Inout_z_ +#undef _Inout_z_ +#endif +#define _Inout_z_ +#ifdef _In_reads_ +#undef _In_reads_ +#endif +#define _In_reads_(s) +#ifdef _In_reads_bytes_ +#undef _In_reads_bytes_ +#endif +#define _In_reads_bytes_(s) +#ifdef _In_reads_z_ +#undef _In_reads_z_ +#endif +#define _In_reads_z_(s) +#ifdef _In_reads_or_z_ +#undef _In_reads_or_z_ +#endif +#define _In_reads_or_z_(s) +#ifdef _Out_writes_ +#undef _Out_writes_ +#endif +#define _Out_writes_(s) +#ifdef _Out_writes_bytes_ +#undef _Out_writes_bytes_ +#endif +#define _Out_writes_bytes_(s) +#ifdef _Out_writes_z_ +#undef _Out_writes_z_ +#endif +#define _Out_writes_z_(s) +#ifdef _Inout_updates_ +#undef _Inout_updates_ +#endif +#define _Inout_updates_(s) +#ifdef _Inout_updates_bytes_ +#undef _Inout_updates_bytes_ +#endif +#define _Inout_updates_bytes_(s) +#ifdef _Inout_updates_z_ +#undef _Inout_updates_z_ +#endif +#define _Inout_updates_z_(s) +#ifdef _Out_writes_to_ +#undef _Out_writes_to_ +#endif +#define _Out_writes_to_(s,c) +#ifdef _Out_writes_bytes_to_ +#undef _Out_writes_bytes_to_ +#endif +#define _Out_writes_bytes_to_(s,c) +#ifdef _Out_writes_all_ +#undef _Out_writes_all_ +#endif +#define _Out_writes_all_(s) +#ifdef _Out_writes_bytes_all_ +#undef _Out_writes_bytes_all_ +#endif +#define _Out_writes_bytes_all_(s) +#ifdef _Inout_updates_to_ +#undef _Inout_updates_to_ +#endif +#define _Inout_updates_to_(s,c) +#ifdef _Inout_updates_bytes_to_ +#undef _Inout_updates_bytes_to_ +#endif +#define _Inout_updates_bytes_to_(s,c) +#ifdef _Inout_updates_all_ +#undef _Inout_updates_all_ +#endif +#define _Inout_updates_all_(s) +#ifdef _Inout_updates_bytes_all_ +#undef _Inout_updates_bytes_all_ +#endif +#define _Inout_updates_bytes_all_(s) +#ifdef _In_reads_to_ptr_ +#undef _In_reads_to_ptr_ +#endif +#define _In_reads_to_ptr_(p) +#ifdef _In_reads_to_ptr_z_ +#undef _In_reads_to_ptr_z_ +#endif +#define _In_reads_to_ptr_z_(p) +#ifdef _Out_writes_to_ptr_ +#undef _Out_writes_to_ptr_ +#endif +#define _Out_writes_to_ptr_(p) +#ifdef _Out_writes_to_ptr_z_ +#undef _Out_writes_to_ptr_z_ +#endif +#define _Out_writes_to_ptr_z_(p) +#ifdef _In_opt_ +#undef _In_opt_ +#endif +#define _In_opt_ +#ifdef _Out_opt_ +#undef _Out_opt_ +#endif +#define _Out_opt_ +#ifdef _Inout_opt_ +#undef _Inout_opt_ +#endif +#define _Inout_opt_ +#ifdef _In_opt_z_ +#undef _In_opt_z_ +#endif +#define _In_opt_z_ +#ifdef _Inout_opt_z_ +#undef _Inout_opt_z_ +#endif +#define _Inout_opt_z_ +#ifdef _In_reads_opt_ +#undef _In_reads_opt_ +#endif +#define _In_reads_opt_(s) +#ifdef _In_reads_opt_z_ +#undef _In_reads_opt_z_ +#endif +#define _In_reads_opt_z_(s) +#ifdef _In_reads_bytes_opt_ +#undef _In_reads_bytes_opt_ +#endif +#define _In_reads_bytes_opt_(s) +#ifdef _Out_writes_opt_ +#undef _Out_writes_opt_ +#endif +#define _Out_writes_opt_(s) +#ifdef _Out_writes_bytes_opt_ +#undef _Out_writes_bytes_opt_ +#endif +#define _Out_writes_bytes_opt_(s) +#ifdef _Out_writes_opt_z_ +#undef _Out_writes_opt_z_ +#endif +#define _Out_writes_opt_z_(s) +#ifdef _Inout_updates_opt_ +#undef _Inout_updates_opt_ +#endif +#define _Inout_updates_opt_(s) +#ifdef _Inout_updates_bytes_opt_ +#undef _Inout_updates_bytes_opt_ +#endif +#define _Inout_updates_bytes_opt_(s) +#ifdef _Inout_updates_opt_z_ +#undef _Inout_updates_opt_z_ +#endif +#define _Inout_updates_opt_z_(s) +#ifdef _Out_writes_to_opt_ +#undef _Out_writes_to_opt_ +#endif +#define _Out_writes_to_opt_(s,c) +#ifdef _Out_writes_bytes_to_opt_ +#undef _Out_writes_bytes_to_opt_ +#endif +#define _Out_writes_bytes_to_opt_(s,c) +#ifdef _Out_writes_all_opt_ +#undef _Out_writes_all_opt_ +#endif +#define _Out_writes_all_opt_(s) +#ifdef _Out_writes_bytes_all_opt_ +#undef _Out_writes_bytes_all_opt_ +#endif +#define _Out_writes_bytes_all_opt_(s) +#ifdef _Inout_updates_to_opt_ +#undef _Inout_updates_to_opt_ +#endif +#define _Inout_updates_to_opt_(s,c) +#ifdef _Inout_updates_bytes_to_opt_ +#undef _Inout_updates_bytes_to_opt_ +#endif +#define _Inout_updates_bytes_to_opt_(s,c) +#ifdef _Inout_updates_all_opt_ +#undef _Inout_updates_all_opt_ +#endif +#define _Inout_updates_all_opt_(s) +#ifdef _Inout_updates_bytes_all_opt_ +#undef _Inout_updates_bytes_all_opt_ +#endif +#define _Inout_updates_bytes_all_opt_(s) +#ifdef _In_reads_to_ptr_opt_ +#undef _In_reads_to_ptr_opt_ +#endif +#define _In_reads_to_ptr_opt_(p) +#ifdef _In_reads_to_ptr_opt_z_ +#undef _In_reads_to_ptr_opt_z_ +#endif +#define _In_reads_to_ptr_opt_z_(p) +#ifdef _Out_writes_to_ptr_opt_ +#undef _Out_writes_to_ptr_opt_ +#endif +#define _Out_writes_to_ptr_opt_(p) +#ifdef _Out_writes_to_ptr_opt_z_ +#undef _Out_writes_to_ptr_opt_z_ +#endif +#define _Out_writes_to_ptr_opt_z_(p) +#ifdef _Outptr_ +#undef _Outptr_ +#endif +#define _Outptr_ +#ifdef _Outptr_opt_ +#undef _Outptr_opt_ +#endif +#define _Outptr_opt_ +#ifdef _Outptr_result_maybenull_ +#undef _Outptr_result_maybenull_ +#endif +#define _Outptr_result_maybenull_ +#ifdef _Outptr_opt_result_maybenull_ +#undef _Outptr_opt_result_maybenull_ +#endif +#define _Outptr_opt_result_maybenull_ +#ifdef _Outptr_result_z_ +#undef _Outptr_result_z_ +#endif +#define _Outptr_result_z_ +#ifdef _Outptr_opt_result_z_ +#undef _Outptr_opt_result_z_ +#endif +#define _Outptr_opt_result_z_ +#ifdef _Outptr_result_maybenull_z_ +#undef _Outptr_result_maybenull_z_ +#endif +#define _Outptr_result_maybenull_z_ +#ifdef _Outptr_opt_result_maybenull_z_ +#undef _Outptr_opt_result_maybenull_z_ +#endif +#define _Outptr_opt_result_maybenull_z_ +#ifdef _COM_Outptr_ +#undef _COM_Outptr_ +#endif +#define _COM_Outptr_ +#ifdef _COM_Outptr_opt_ +#undef _COM_Outptr_opt_ +#endif +#define _COM_Outptr_opt_ +#ifdef _COM_Outptr_result_maybenull_ +#undef _COM_Outptr_result_maybenull_ +#endif +#define _COM_Outptr_result_maybenull_ +#ifdef _COM_Outptr_opt_result_maybenull_ +#undef _COM_Outptr_opt_result_maybenull_ +#endif +#define _COM_Outptr_opt_result_maybenull_ +#ifdef _Outptr_result_buffer_ +#undef _Outptr_result_buffer_ +#endif +#define _Outptr_result_buffer_(s) +#ifdef _Outptr_result_buffer_maybenull_ +#undef _Outptr_result_buffer_maybenull_ +#endif +#define _Outptr_result_buffer_maybenull_(s) +#ifdef _Outptr_result_bytebuffer_ +#undef _Outptr_result_bytebuffer_ +#endif +#define _Outptr_result_bytebuffer_(s) +#ifdef _Outptr_result_bytebuffer_maybenull_ +#undef _Outptr_result_bytebuffer_maybenull_ +#endif +#define _Outptr_result_bytebuffer_maybenull_(s) +#ifdef _Outptr_opt_result_buffer_ +#undef _Outptr_opt_result_buffer_ +#endif +#define _Outptr_opt_result_buffer_(s) +#ifdef _Outptr_opt_result_buffer_maybenull_ +#undef _Outptr_opt_result_buffer_maybenull_ +#endif +#define _Outptr_opt_result_buffer_maybenull_(s) +#ifdef _Outptr_opt_result_bytebuffer_ +#undef _Outptr_opt_result_bytebuffer_ +#endif +#define _Outptr_opt_result_bytebuffer_(s) +#ifdef _Outptr_opt_result_bytebuffer_maybenull_ +#undef _Outptr_opt_result_bytebuffer_maybenull_ +#endif +#define _Outptr_opt_result_bytebuffer_maybenull_(s) +#ifdef _Outptr_result_buffer_to_ +#undef _Outptr_result_buffer_to_ +#endif +#define _Outptr_result_buffer_to_(s,c) +#ifdef _Outptr_result_bytebuffer_to_ +#undef _Outptr_result_bytebuffer_to_ +#endif +#define _Outptr_result_bytebuffer_to_(s,c) +#ifdef _Outptr_opt_result_buffer_to_ +#undef _Outptr_opt_result_buffer_to_ +#endif +#define _Outptr_opt_result_buffer_to_(s,c) +#ifdef _Outptr_opt_result_bytebuffer_to_ +#undef _Outptr_opt_result_bytebuffer_to_ +#endif +#define _Outptr_opt_result_bytebuffer_to_(s,c) +#ifdef _Ret_ +#undef _Ret_ +#endif +#define _Ret_ +#ifdef _Ret_valid_ +#undef _Ret_valid_ +#endif +#define _Ret_valid_ +#ifdef _Ret_z_ +#undef _Ret_z_ +#endif +#define _Ret_z_ +#ifdef _Ret_writes_ +#undef _Ret_writes_ +#endif +#define _Ret_writes_(s) +#ifdef _Ret_writes_bytes_ +#undef _Ret_writes_bytes_ +#endif +#define _Ret_writes_bytes_(s) +#ifdef _Ret_writes_z_ +#undef _Ret_writes_z_ +#endif +#define _Ret_writes_z_(s) +#ifdef _Ret_writes_to_ +#undef _Ret_writes_to_ +#endif +#define _Ret_writes_to_(s,c) +#ifdef _Ret_writes_bytes_to_ +#undef _Ret_writes_bytes_to_ +#endif +#define _Ret_writes_bytes_to_(s,c) +#ifdef _Ret_writes_to_ptr_ +#undef _Ret_writes_to_ptr_ +#endif +#define _Ret_writes_to_ptr_(p) +#ifdef _Ret_writes_to_ptr_z_ +#undef _Ret_writes_to_ptr_z_ +#endif +#define _Ret_writes_to_ptr_z_(p) +#ifdef _Ret_writes_maybenull_ +#undef _Ret_writes_maybenull_ +#endif +#define _Ret_writes_maybenull_(s) +#ifdef _Ret_writes_bytes_maybenull_ +#undef _Ret_writes_bytes_maybenull_ +#endif +#define _Ret_writes_bytes_maybenull_(s) +#ifdef _Ret_writes_to_maybenull_ +#undef _Ret_writes_to_maybenull_ +#endif +#define _Ret_writes_to_maybenull_(s,c) +#ifdef _Ret_writes_bytes_to_maybenull_ +#undef _Ret_writes_bytes_to_maybenull_ +#endif +#define _Ret_writes_bytes_to_maybenull_(s,c) +#ifdef _Ret_writes_maybenull_z_ +#undef _Ret_writes_maybenull_z_ +#endif +#define _Ret_writes_maybenull_z_(s) +#ifdef _Ret_null_ +#undef _Ret_null_ +#endif +#define _Ret_null_ +#ifdef _Ret_notnull_ +#undef _Ret_notnull_ +#endif +#define _Ret_notnull_ +#ifdef _Ret_maybenull_ +#undef _Ret_maybenull_ +#endif +#define _Ret_maybenull_ +#ifdef _Ret_maybenull_z_ +#undef _Ret_maybenull_z_ +#endif +#define _Ret_maybenull_z_ +#ifdef _Field_size_ +#undef _Field_size_ +#endif +#define _Field_size_(s) +#ifdef _Field_size_opt_ +#undef _Field_size_opt_ +#endif +#define _Field_size_opt_(s) +#ifdef _Field_size_bytes_ +#undef _Field_size_bytes_ +#endif +#define _Field_size_bytes_(s) +#ifdef _Field_size_bytes_opt_ +#undef _Field_size_bytes_opt_ +#endif +#define _Field_size_bytes_opt_(s) +#ifdef _Field_size_part_ +#undef _Field_size_part_ +#endif +#define _Field_size_part_(s,c) +#ifdef _Field_size_part_opt_ +#undef _Field_size_part_opt_ +#endif +#define _Field_size_part_opt_(s,c) +#ifdef _Field_size_bytes_part_ +#undef _Field_size_bytes_part_ +#endif +#define _Field_size_bytes_part_(s,c) +#ifdef _Field_size_bytes_part_opt_ +#undef _Field_size_bytes_part_opt_ +#endif +#define _Field_size_bytes_part_opt_(s,c) +#ifdef _Field_size_full_ +#undef _Field_size_full_ +#endif +#define _Field_size_full_(s) +#ifdef _Field_size_full_opt_ +#undef _Field_size_full_opt_ +#endif +#define _Field_size_full_opt_(s) +#ifdef _Field_size_bytes_full_ +#undef _Field_size_bytes_full_ +#endif +#define _Field_size_bytes_full_(s) +#ifdef _Field_size_bytes_full_opt_ +#undef _Field_size_bytes_full_opt_ +#endif +#define _Field_size_bytes_full_opt_(s) +#ifdef _Printf_format_string_ +#undef _Printf_format_string_ +#endif +#define _Printf_format_string_ +#ifdef _Scanf_format_string_ +#undef _Scanf_format_string_ +#endif +#define _Scanf_format_string_ +#ifdef _Scanf_s_format_string_ +#undef _Scanf_s_format_string_ +#endif +#define _Scanf_s_format_string_ +#ifdef _Printf_format_string_params_ +#undef _Printf_format_string_params_ +#endif +#define _Printf_format_string_params_(x) +#ifdef _Scanf_format_string_params_ +#undef _Scanf_format_string_params_ +#endif +#define _Scanf_format_string_params_(x) +#ifdef _Scanf_s_format_string_params_ +#undef _Scanf_s_format_string_params_ +#endif +#define _Scanf_s_format_string_params_(x) +#ifdef _In_range_ +#undef _In_range_ +#endif +#define _In_range_(l,h) +#ifdef _Out_range_ +#undef _Out_range_ +#endif +#define _Out_range_(l,h) +#ifdef _Ret_range_ +#undef _Ret_range_ +#endif +#define _Ret_range_(l,h) +#ifdef _Deref_in_range_ +#undef _Deref_in_range_ +#endif +#define _Deref_in_range_(l,h) +#ifdef _Deref_out_range_ +#undef _Deref_out_range_ +#endif +#define _Deref_out_range_(l,h) +#ifdef _Deref_inout_range_ +#undef _Deref_inout_range_ +#endif +#define _Deref_inout_range_(l,h) +#ifdef _Field_range_ +#undef _Field_range_ +#endif +#define _Field_range_(l,h) +#ifdef _Pre_equal_to_ +#undef _Pre_equal_to_ +#endif +#define _Pre_equal_to_(e) +#ifdef _Post_equal_to_ +#undef _Post_equal_to_ +#endif +#define _Post_equal_to_(e) +#ifdef _Struct_size_bytes_ +#undef _Struct_size_bytes_ +#endif +#define _Struct_size_bytes_(s) +#ifdef _Analysis_assume_ +#undef _Analysis_assume_ +#endif +#define _Analysis_assume_ +#ifdef _Analysis_assume_nullterminated_ +#undef _Analysis_assume_nullterminated_ +#endif +#define _Analysis_assume_nullterminated_(s) +#ifdef _Analysis_mode_ +#undef _Analysis_mode_ +#endif +#define _Analysis_mode_(m) +#ifdef _Analysis_noreturn_ +#undef _Analysis_noreturn_ +#endif +#define _Analysis_noreturn_ +#ifdef _Raises_SEH_exception_ +#undef _Raises_SEH_exception_ +#endif +#define _Raises_SEH_exception_ +#ifdef _Maybe_raises_SEH_exception_ +#undef _Maybe_raises_SEH_exception_ +#endif +#define _Maybe_raises_SEH_exception_ +#ifdef _Function_class_ +#undef _Function_class_ +#endif +#define _Function_class_(n) +#ifdef _Literal_ +#undef _Literal_ +#endif +#define _Literal_ +#ifdef _Notliteral_ +#undef _Notliteral_ +#endif +#define _Notliteral_ +#ifdef _Enum_is_bitflag_ +#undef _Enum_is_bitflag_ +#endif +#define _Enum_is_bitflag_ +#ifdef _Strict_type_match_ +#undef _Strict_type_match_ +#endif +#define _Strict_type_match_ +#ifdef _Points_to_data_ +#undef _Points_to_data_ +#endif +#define _Points_to_data_ +#ifdef _Interlocked_operand_ +#undef _Interlocked_operand_ +#endif +#define _Interlocked_operand_ +#ifdef _IRQL_raises_ +#undef _IRQL_raises_ +#endif +#define _IRQL_raises_(i) +#ifdef _IRQL_requires_ +#undef _IRQL_requires_ +#endif +#define _IRQL_requires_(i) +#ifdef _IRQL_requires_max_ +#undef _IRQL_requires_max_ +#endif +#define _IRQL_requires_max_(i) +#ifdef _IRQL_requires_min_ +#undef _IRQL_requires_min_ +#endif +#define _IRQL_requires_min_(i) +#ifdef _IRQL_saves_ +#undef _IRQL_saves_ +#endif +#define _IRQL_saves_ +#ifdef _IRQL_saves_global_ +#undef _IRQL_saves_global_ +#endif +#define _IRQL_saves_global_(k,s) +#ifdef _IRQL_restores_ +#undef _IRQL_restores_ +#endif +#define _IRQL_restores_ +#ifdef _IRQL_restores_global_ +#undef _IRQL_restores_global_ +#endif +#define _IRQL_restores_global_(k,s) +#ifdef _IRQL_always_function_min_ +#undef _IRQL_always_function_min_ +#endif +#define _IRQL_always_function_min_(i) +#ifdef _IRQL_always_function_max_ +#undef _IRQL_always_function_max_ +#endif +#define _IRQL_always_function_max_(i) +#ifdef _IRQL_requires_same_ +#undef _IRQL_requires_same_ +#endif +#define _IRQL_requires_same_ +#ifdef _IRQL_uses_cancel_ +#undef _IRQL_uses_cancel_ +#endif +#define _IRQL_uses_cancel_ +#ifdef _IRQL_is_cancel_ +#undef _IRQL_is_cancel_ +#endif +#define _IRQL_is_cancel_ +#ifdef _Kernel_float_saved_ +#undef _Kernel_float_saved_ +#endif +#define _Kernel_float_saved_ +#ifdef _Kernel_float_restored_ +#undef _Kernel_float_restored_ +#endif +#define _Kernel_float_restored_ +#ifdef _Kernel_float_used_ +#undef _Kernel_float_used_ +#endif +#define _Kernel_float_used_ +#ifdef _Kernel_acquires_resource_ +#undef _Kernel_acquires_resource_ +#endif +#define _Kernel_acquires_resource_(k) +#ifdef _Kernel_releases_resource_ +#undef _Kernel_releases_resource_ +#endif +#define _Kernel_releases_resource_(k) +#ifdef _Kernel_requires_resource_held_ +#undef _Kernel_requires_resource_held_ +#endif +#define _Kernel_requires_resource_held_(k) +#ifdef _Kernel_requires_resource_not_held_ +#undef _Kernel_requires_resource_not_held_ +#endif +#define _Kernel_requires_resource_not_held_(k) +#ifdef _Kernel_clear_do_init_ +#undef _Kernel_clear_do_init_ +#endif +#define _Kernel_clear_do_init_(yn) +#ifdef _Kernel_IoGetDmaAdapter_ +#undef _Kernel_IoGetDmaAdapter_ +#endif +#define _Kernel_IoGetDmaAdapter_ +#ifdef _Outref_ +#undef _Outref_ +#endif +#define _Outref_ +#ifdef _Outref_result_maybenull_ +#undef _Outref_result_maybenull_ +#endif +#define _Outref_result_maybenull_ +#ifdef _Outref_result_buffer_ +#undef _Outref_result_buffer_ +#endif +#define _Outref_result_buffer_(s) +#ifdef _Outref_result_bytebuffer_ +#undef _Outref_result_bytebuffer_ +#endif +#define _Outref_result_bytebuffer_(s) +#ifdef _Outref_result_buffer_to_ +#undef _Outref_result_buffer_to_ +#endif +#define _Outref_result_buffer_to_(s,c) +#ifdef _Outref_result_bytebuffer_to_ +#undef _Outref_result_bytebuffer_to_ +#endif +#define _Outref_result_bytebuffer_to_(s,c) +#ifdef _Outref_result_buffer_all_ +#undef _Outref_result_buffer_all_ +#endif +#define _Outref_result_buffer_all_(s) +#ifdef _Outref_result_bytebuffer_all_ +#undef _Outref_result_bytebuffer_all_ +#endif +#define _Outref_result_bytebuffer_all_(s) +#ifdef _Outref_result_buffer_maybenull_ +#undef _Outref_result_buffer_maybenull_ +#endif +#define _Outref_result_buffer_maybenull_(s) +#ifdef _Outref_result_bytebuffer_maybenull_ +#undef _Outref_result_bytebuffer_maybenull_ +#endif +#define _Outref_result_bytebuffer_maybenull_(s) +#ifdef _Outref_result_buffer_to_maybenull_ +#undef _Outref_result_buffer_to_maybenull_ +#endif +#define _Outref_result_buffer_to_maybenull_(s,c) +#ifdef _Outref_result_bytebuffer_to_maybenull_ +#undef _Outref_result_bytebuffer_to_maybenull_ +#endif +#define _Outref_result_bytebuffer_to_maybenull_(s,c) +#ifdef _Outref_result_buffer_all_maybenull_ +#undef _Outref_result_buffer_all_maybenull_ +#endif +#define _Outref_result_buffer_all_maybenull_(s) +#ifdef _Outref_result_bytebuffer_all_maybenull_ +#undef _Outref_result_bytebuffer_all_maybenull_ +#endif +#define _Outref_result_bytebuffer_all_maybenull_(s) +#ifdef _In_defensive_ +#undef _In_defensive_ +#endif +#define _In_defensive_(a) +#ifdef _Out_defensive_ +#undef _Out_defensive_ +#endif +#define _Out_defensive_(a) +#ifdef _Inout_defensive_ +#undef _Inout_defensive_ +#endif +#define _Inout_defensive_(a) +#ifdef _Outptr_result_nullonfailure_ +#undef _Outptr_result_nullonfailure_ +#endif +#define _Outptr_result_nullonfailure_ +#ifdef _Outptr_opt_result_nullonfailure_ +#undef _Outptr_opt_result_nullonfailure_ +#endif +#define _Outptr_opt_result_nullonfailure_ +#ifdef _Outref_result_nullonfailure_ +#undef _Outref_result_nullonfailure_ +#endif +#define _Outref_result_nullonfailure_ +#ifdef _Result_nullonfailure_ +#undef _Result_nullonfailure_ +#endif +#define _Result_nullonfailure_ +#ifdef _Result_zeroonfailure_ +#undef _Result_zeroonfailure_ +#endif +#define _Result_zeroonfailure_ +#ifdef _Acquires_nonreentrant_lock_ +#undef _Acquires_nonreentrant_lock_ +#endif +#define _Acquires_nonreentrant_lock_(e) +#ifdef _Releases_nonreentrant_lock_ +#undef _Releases_nonreentrant_lock_ +#endif +#define _Releases_nonreentrant_lock_(e) +#ifdef _Function_ignore_lock_checking_ +#undef _Function_ignore_lock_checking_ +#endif +#define _Function_ignore_lock_checking_(e) +#ifdef _Analysis_suppress_lock_checking_ +#undef _Analysis_suppress_lock_checking_ +#endif +#define _Analysis_suppress_lock_checking_(e) +#undef _Reserved_ +#define _Reserved_ _Pre_equal_to_(0) _Pre_ _Null_ +#undef _Pre_z_ +#define _Pre_z_ _Pre_ _Null_terminated_ +#undef _Post_z_ +#define _Post_z_ _Post_ _Null_terminated_ +#undef _Prepost_z_ +#define _Prepost_z_ _Pre_z_ _Post_z_ +#undef _Pre_null_ +#define _Pre_null_ _Pre_ _Null_ +#undef _Pre_maybenull_ +#define _Pre_maybenull_ _Pre_ _Maybenull_ +#undef _Pre_notnull_ +#define _Pre_notnull_ _Pre_ _Notnull_ +#undef _Pre_valid_ +#define _Pre_valid_ _Pre_notnull_ _Pre_ _Valid_ +#undef _Pre_opt_valid_ +#define _Pre_opt_valid_ _Pre_maybenull_ _Pre_ _Valid_ +#undef _Post_valid_ +#define _Post_valid_ _Post_ _Valid_ +#undef _Post_invalid_ +#define _Post_invalid_ _Post_ _Deref_ _Notvalid_ +#undef _Post_ptr_invalid_ +#define _Post_ptr_invalid_ _Post_ _Notvalid_ +#undef _Pre_readable_size_ +#define _Pre_readable_size_(s) _Pre_ _Readable_elements_(s) _Pre_ _Valid_ +#undef _Pre_writable_size_ +#define _Pre_writable_size_(s) _Pre_ _Writable_elements_(s) +#undef _Pre_readable_byte_size_ +#define _Pre_readable_byte_size_(s) _Pre_ _Readable_bytes_(s) _Pre_ _Valid_ +#undef _Pre_writable_byte_size_ +#define _Pre_writable_byte_size_(s) _Pre_ _Writable_bytes_(s) +#undef _Post_readable_size_ +#define _Post_readable_size_(s) _Post_ _Readable_elements_(s) _Post_ _Valid_ +#undef _Post_writable_size_ +#define _Post_writable_size_(s) _Post_ _Writable_elements_(s) +#undef _Post_readable_byte_size_ +#define _Post_readable_byte_size_(s) _Post_ _Readable_bytes_(s) _Post_ _Valid_ +#undef _Post_writable_byte_size_ +#define _Post_writable_byte_size_(s) _Post_ _Writable_bytes_(s) + +#endif /* _NO_SAL_2_H_ */ \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper/specstrings.h b/src/nativeInterop/cinterop/versionhelper/specstrings.h new file mode 100644 index 0000000..36b7a93 --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/specstrings.h @@ -0,0 +1,714 @@ +#ifndef SPECSTRINGS_H // [ +#define SPECSTRINGS_H + +/*** +*specstrings.h - support for markers for documenting the semantics of APIs +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* [Public] +****/ + +/************************************************************************* +* See specstrings_strict.h for documentation of all user visible macros. +*************************************************************************/ + +#if _MSC_VER +#pragma once +#endif + +#if _MSC_VER >= 1200 +#pragma warning(push) +#pragma warning(disable:4668) // #if not_defined treated as #if 0 +#endif + +#if !defined(_SAL_VERSION_SAL2) // [ + + #if defined(__BUILDMACHINE__) || defined(_USE_SAL2_ONLY) + #define _SAL_VERSION_SAL2(_A) SAL_2_Clean_Violation_using ## _A + #else + #define _SAL_VERSION_SAL2(_A) + #endif + + #ifdef _USE_SAL2_ONLY + #define _SAL2_STRICT + #define _SAL_VERSION_CHECK(_A) _SAL_VERSION_SAL2(_A) + #else + #define _SAL_VERSION_CHECK(_A) + #endif + + #ifndef SAL_VERSION_CHECK + #define SAL_VERSION_CHECK(_A) _SAL_VERSION_CHECK(_A) + #define SAL_VERSION_SAL2(_A) _SAL_VERSION_SAL2(_A) + #endif + +#endif // ] + +/* Begin compatibility fixes required for Win8/VS2012 RTM sal.h */ +#ifndef _SAL_L_Source_ + +// Some annotations aren't officially SAL2 yet. +#if _USE_ATTRIBUTES_FOR_SAL /*IFSTRIP=IGN*/ +#define _SAL_L_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _Group_(annotes _SAL_nop_impl_) +#else +#define _SAL_L_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _GrouP_(annotes _SAL_nop_impl_) +#endif + +#endif + +/* End compatibility fixes required for Win8/VS2012 RTM sal.h */ + +#include + +/* This version symbol is deprecated in favor of __SAL_H_VER */ +#ifndef __SAL_H_FULL_VER +#define __SAL_H_FULL_VER 140050727 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* version specific fixes to bring sal.h upto date */ +#if __SAL_H_FULL_VER <= 140050727 // [ + +#if !defined(__midl) && defined(_PREFAST_) && _MSC_VER >= 1000 // [ + +/* Missing from RTM sal.h */ +#define __inner_bound _SAL_L_Source_(__inner_bound, (), _SA_annotes0(SAL_bound)) +#define __inner_range(lb,ub) _SAL_L_Source_(__inner_range, (lb,ub), _SA_annotes2(SAL_range,lb,ub)) +#define __inner_assume_bound_dec __inline __nothrow void __AssumeBoundInt(_Post_ __inner_bound int i) {i;} +#define __inner_assume_bound(i) __AssumeBoundInt(i); +#define __inner_allocator _SAL_L_Source_(__inner_allocater, (), _SA_annotes0(SAL_allocator)) + +#define __static_context(ctx, annotes) \ + _SAL_L_Source_(__static_context, (ctx, annotes), _SA_annotes1(SAL_context,ctx) _Group_(__nop_impl(annotes))) + +#define __failure(x) __static_context(SAL_return_convention, \ + _SAL_L_Source_(__failure, (x), _SA_annotes1(SAL_failure,x))) + +__ANNOTATION(SAL_valueUndefined()); +#define __valueUndefined _SAL_L_Source_(__valueUndefined, (), _SA_annotes0(SAL_valueUndefined)) + +enum __SAL_failureKind{__failureUnspecified = 0, __failureUndefined = 1}; + +__ANNOTATION(SAL_failureDefault(enum __SAL_failureKind)); +#define __failureDefault(kind) _SAL_L_Source_(__failureDefault, (kind), __static_context(SAL_return_convention, \ + _SA_annotes1(SAL_failureDefault,kind))) + +#else // ][ + +#define __inner_bound +#define __inner_range(lb,ub) +#define __inner_assume_bound_dec +#define __inner_assume_bound(i) +#define __inner_allocator + +#define __static_context(ctx, annotes) +#define __failure(x) +#define __valueUndefined +#define __failureDefault(x) + +#endif // ] + +#define __xcount(size) _SAL1_Source_(__xcount, (size), __notnull __inexpressible_writableTo(size)) +#define __in_xcount(size) _SAL1_Source_(__in_xcount, (size), __in _Pre_ __inexpressible_readableTo(size)) +#define __out_xcount(size) _SAL1_Source_(__out_xcount, (size), __xcount(size) _Post_ __valid __refparam) +#define __out_xcount_part(size,length) _SAL1_Source_(__out_xcount_part_, (size,length), __out_xcount(size) _Post_ __inexpressible_readableTo(length)) +#define __out_xcount_full(size) _SAL1_Source_(__out_xcount_full, (size), __out_xcount_part(size,size)) +#define __inout_xcount(size) _SAL1_Source_(__inout_xcount, (size), __out_xcount(size) _Pre_ __valid) +#define __inout_xcount_part(size,length) _SAL1_Source_(__inout_xcount_part, (size,length), __out_xcount_part(size,length) _Pre_ __valid _Pre_ __inexpressible_readableTo(length)) +#define __inout_xcount_full(size) _SAL1_Source_(__inout_xcount_full, (size), __inout_xcount_part(size,size)) +#define __xcount_opt(size) _SAL1_Source_(__xcount_opt, (size), __xcount(size) __exceptthat __maybenull) +#define __in_xcount_opt(size) _SAL1_Source_(__in_xcount_opt, (size), __in_xcount(size) __exceptthat __maybenull) +#define __out_xcount_opt(size) _SAL1_Source_(__out_xcount_opt, (size), __out_xcount(size) __exceptthat __maybenull) +#define __out_xcount_part_opt(size,length) _SAL1_Source_(__out_xcount_part_opt, (size,length), __out_xcount_part(size,length) __exceptthat __maybenull) +#define __out_xcount_full_opt(size) _SAL1_Source_(__out_xcount_full_opt, (size), __out_xcount_full(size) __exceptthat __maybenull) +#define __inout_xcount_opt(size) _SAL1_Source_(__inout_xcount_opt, (size), __inout_xcount(size) __exceptthat __maybenull) +#define __inout_xcount_part_opt(size,length) _SAL1_Source_(__inout_xcount_part_opt, (size, length), __inout_xcount_part(size,length) __exceptthat __maybenull) +#define __inout_xcount_full_opt(size) _SAL1_Source_(__inout_xcount_full_opt, (size), __inout_xcount_full(size) __exceptthat __maybenull) +#define __deref_xcount(size) _SAL1_Source_(__deref_xcount, (size), __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)) +#define __deref_in _SAL1_Source_(__deref_in, (), __in _Pre_ __deref __deref __readonly) +#define __deref_in_ecount(size) _SAL1_Source_(__deref_in_ecount, (size), __deref_in _Pre_ __deref __elem_readableTo(size)) +#define __deref_in_bcount(size) _SAL1_Source_(__deref_in_bcount, (size), __deref_in _Pre_ __deref __byte_readableTo(size)) +#define __deref_in_xcount(size) _SAL1_Source_(__deref_in_xcount, (size), __deref_in _Pre_ __deref __inexpressible_readableTo(size)) +#define __deref_out_xcount(size) _SAL1_Source_(__deref_out_xcount, (size), __deref_xcount(size) _Post_ __deref __valid __refparam) +#define __deref_out_xcount_part(size,length) _SAL1_Source_(__deref_out_xcount_part, (size,length), __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length)) +#define __deref_out_xcount_full(size) _SAL1_Source_(__deref_out_xcount_full, (size), __deref_out_xcount_part(size,size)) +#define __deref_out_xcount(size) _SAL1_Source_(__deref_out_xcount, (size), __deref_xcount(size) _Post_ __deref __valid __refparam) +#define __inout_xcount_opt(size) _SAL1_Source_(__inout_xcount_opt, (size), __inout_xcount(size) __exceptthat __maybenull) +#define __deref_xcount(size) _SAL1_Source_(__deref_xcount, (size), __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)) +#define __deref_in _SAL1_Source_(__deref_in, (), __in _Pre_ __deref __deref __readonly) +#define __deref_in_ecount(size) _SAL1_Source_(__deref_in_ecount, (size), __deref_in _Pre_ __deref __elem_readableTo(size)) +#define __deref_in_bcount(size) _SAL1_Source_(__deref_in_bcount, (size), __deref_in _Pre_ __deref __byte_readableTo(size)) +#define __deref_in_xcount(size) _SAL1_Source_(__deref_in_xcount, (size), __deref_in _Pre_ __deref __inexpressible_readableTo(size)) +#define __deref_out_xcount(size) _SAL1_Source_(__deref_out_xcount, (size), __deref_xcount(size) _Post_ __deref __valid __refparam) +#define __deref_out_xcount_part(size,length) _SAL1_Source_(__deref_out_xcount_part, (size,length), __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length)) +#define __deref_out_xcount_full(size) _SAL1_Source_(__deref_out_xcount_full, (size), __deref_out_xcount_part(size,size)) +#define __deref_out_xcount(size) _SAL1_Source_(__deref_out_xcount, (size), __deref_xcount(size) _Post_ __deref __valid __refparam) +#define __deref_inout_xcount(size) _SAL1_Source_(__deref_inout_xcount, (size), __deref_inout _Pre_ __deref __inexpressible_writableTo(size) _Post_ __deref __inexpressible_writableTo(size)) +#define __deref_inout_xcount_part(size,length) _SAL1_Source_(__deref_inout_xcount_part, (size,length), __deref_inout_xcount(size) _Pre_ __deref __inexpressible_readableTo(length) _Post_ __deref __inexpressible_readableTo(length)) +#define __deref_inout_xcount_full(size) _SAL1_Source_(__deref_inout_xcount_full, (size), __deref_inout_xcount_part(size,size)) +#define __deref_xcount_opt(size) _SAL1_Source_(__deref_xcount_opt, (size), __deref_xcount(size) _Post_ __deref __exceptthat __maybenull) +#define __deref_in_opt _SAL1_Source_(__deref_in_opt, (), __deref_in _Pre_ __deref __exceptthat __maybenull) +#define __deref_in_opt_out _SAL1_Source_(__deref_in_opt_out, (), __deref_inout _Pre_ __deref __exceptthat __maybenull _Post_ __deref __notnull) +#define __deref_in_ecount_opt(size) _SAL1_Source_(__deref_in_ecount_opt, (size), __deref_in_ecount(size) _Pre_ __deref __exceptthat __maybenull) +#define __deref_in_bcount_opt(size) _SAL1_Source_(__deref_in_bcount_opt_, (size), __deref_in_bcount(size) _Pre_ __deref __exceptthat __maybenull) +#define __deref_in_xcount_opt(size) _SAL1_Source_(__deref_in_xcount_opt, (size), __deref_in_xcount(size) _Pre_ __deref __exceptthat __maybenull) +#define __deref_out_xcount_opt(size) _SAL1_Source_(__deref_out_xcount_opt, (size), __deref_out_xcount(size) _Post_ __deref __exceptthat __maybenull) +#define __deref_out_xcount_part_opt(size,length) _SAL1_Source_(__deref_out_xcount_part_opt, (size,length), __deref_out_xcount_part(size,length) _Post_ __deref __exceptthat __maybenull) +#define __deref_out_xcount_full_opt(size) _SAL1_Source_(__deref_out_xcount_full_opt, (size), __deref_out_xcount_full(size) _Post_ __deref __exceptthat __maybenull) +#define __deref_inout_xcount_opt(size) _SAL1_Source_(__deref_inout_xcount_opt, (size), __deref_inout_xcount(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull) +#define __deref_inout_xcount_part_opt(size,length) _SAL1_Source_(__deref_inout_xcount_part_opt, (size,length), __deref_inout_xcount_part(size,length) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull) +#define __deref_inout_xcount_full_opt(size) _SAL1_Source_(__deref_inout_xcount_full_opt, (size), __deref_inout_xcount_full(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull) +#define __deref_opt_xcount(size) _SAL1_Source_(__deref_opt_xcount, (size), __deref_xcount(size) __exceptthat __maybenull) +#define __deref_opt_in _SAL1_Source_(__deref_opt_in, (), __deref_in __exceptthat __maybenull) +#define __deref_opt_in_ecount(size) _SAL1_Source_(__deref_opt_in_ecount, (size), __deref_in_ecount(size) __exceptthat __maybenull) +#define __deref_opt_in_bcount(size) _SAL1_Source_(__deref_opt_in_bcount, (size), __deref_in_bcount(size) __exceptthat __maybenull) +#define __deref_opt_in_xcount(size) _SAL1_Source_(__deref_opt_in_xcount, (size), __deref_in_xcount(size) __exceptthat __maybenull) +#define __deref_opt_out_xcount(size) _SAL1_Source_(__deref_opt_out_xcount, (size), __deref_out_xcount(size) __exceptthat __maybenull) +#define __deref_opt_out_xcount_part(size,length) _SAL1_Source_(__deref_opt_out_xcount_part, (size,length), __deref_out_xcount_part(size,length) __exceptthat __maybenull) +#define __deref_opt_out_xcount_full(size) _SAL1_Source_(__deref_opt_out_xcount_full, (size), __deref_out_xcount_full(size) __exceptthat __maybenull) +#define __deref_opt_inout_xcount(size) _SAL1_Source_(__deref_opt_inout_xcount, (size), __deref_inout_xcount(size) __exceptthat __maybenull) +#define __deref_opt_inout_xcount_part(size,length) _SAL1_Source_(__deref_opt_inout_xcount_part, (size,length), __deref_inout_xcount_part(size,length) __exceptthat __maybenull) +#define __deref_opt_inout_xcount_full(size) _SAL1_Source_(__deref_opt_inout_xcount_full, (size), __deref_inout_xcount_full(size) __exceptthat __maybenull) +#define __deref_opt_xcount_opt(size) _SAL1_Source_(__deref_opt_xcount_opt, (size), __deref_xcount_opt(size) __exceptthat __maybenull) +#define __deref_opt_in_opt _SAL1_Source_(__deref_opt_in_opt, (), __deref_in_opt __exceptthat __maybenull) +#define __deref_opt_in_ecount_opt(size) _SAL1_Source_(__deref_opt_in_ecount_opt, (size), __deref_in_ecount_opt(size) __exceptthat __maybenull) +#define __deref_opt_in_bcount_opt(size) _SAL1_Source_(__deref_opt_in_bcount_opt, (size), __deref_in_bcount_opt(size) __exceptthat __maybenull) +#define __deref_opt_in_xcount_opt(size) _SAL1_Source_(__deref_opt_in_xcount_opt, (size), __deref_in_xcount_opt(size) __exceptthat __maybenull) +#define __deref_opt_out_xcount_opt(size) _SAL1_Source_(__deref_opt_out_xcount_opt, (size), __deref_out_xcount_opt(size) __exceptthat __maybenull) +#define __deref_opt_out_xcount_part_opt(size,length) _SAL1_Source_(__deref_opt_out_xcount_part_opt, (size,length), __deref_out_xcount_part_opt(size,length) __exceptthat __maybenull) +#define __deref_opt_out_xcount_full_opt(size) _SAL1_Source_(__deref_opt_out_scount_full_opt, (size), __deref_out_xcount_full_opt(size) __exceptthat __maybenull) +#define __deref_opt_inout_xcount_opt(size) _SAL1_Source_(__deref_opt_inout_xcount_opt, (size), __deref_inout_xcount_opt(size) __exceptthat __maybenull) +#define __deref_opt_inout_xcount_part_opt(size,length) _SAL1_Source_(__deref_inout_xcount_part_opt(size, (size,length), length) __exceptthat __maybenull) +#define __deref_opt_inout_xcount_full_opt(size) _SAL1_Source_(__deref_opt_inout_scount_full_opt, (size), __deref_inout_xcount_full_opt(size) __exceptthat __maybenull) + +#define __deref_in_ecount_iterator(size, incr) _SAL1_Source_(__deref_in_ecount_iterator, (size,incr), __inout _Pre_ __deref __elem_readableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)) +#define __deref_out_ecount_iterator(size, incr) _SAL1_Source_(__deref_out_ecount_iterator, (size,incr), __inout _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)) +#define __deref_inout_ecount_iterator(size, incr) _SAL1_Source_(__deref_inout_ecount_iterator, (size,incr), __inout _Pre_ __deref __elem_readableTo(size) _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)) + +#define __post_bcount(size) _SAL1_Source_(__post_bcount, (size), _Post_ __byte_writableTo(size)) +#define __post_ecount(size) _SAL1_Source_(__post_ecount, (size), _Post_ __elem_writableTo(size)) + +#define __deref_realloc_bcount(insize, outsize) _SAL1_Source_(__deref_realloc_bcount, (insize,outsize), __inout _Pre_ __deref __byte_readableTo(insize) _Post_ __deref __byte_writableTo(outsize)) + +/* __in_ecount_or_z(c) specifies semantics like strncmp, where a string + * parameter is either null terminated, or valid up to c elements. + */ +#define __in_ecount_or_z(c) _SAL1_Source_(__in_ecount_or_z, (c), _When_(_String_length_(_Curr_) < (c), __in_z) \ + _When_(_String_length_(_Curr_) >= (c), __in_ecount(c))) + + +/* Provide default definition to be overridden when needed */ +#define __post_nullnullterminated + +/* Must protect redfinitions of macros to workaround rc.exe issues. */ +#ifndef RC_INVOKED // [ + +#undef __nullnullterminated +#define __nullnullterminated _SAL1_Source_(__nullnullterminated, (), __inexpressible_readableTo("string terminated by two nulls") __nullterminated) + +#undef __post_nullnullterminated +#define __post_nullnullterminated _SAL1_Source_(__post_nullnullterminated, (), _Post_ __inexpressible_readableTo("string terminated by two nulls") _Post_ __nullterminated) + +#endif // ] +#endif //__SAL_H_FULL_VER <= 140050727 // ] + +/************************************************************************ + New extensions to sal.h follow here. +*************************************************************************/ + +#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) // [ + +#define __file_parser(typ) _SAL_L_Source_(__file_parser, (typ), _SA_annotes2(SAL_file_parser,"function",typ)) +#define __file_parser_class(typ) _SAL_L_Source_(__file_parser_class, (typ), _SA_annotes2(SAL_file_parser,"class",typ)) +#define __file_parser_library(typ) extern int _SAL_L_Source_(__file_parser_library, (typ), _SA_annotes2(SAL_file_parser, "library", typ)) __iSALFileParserLibrary##typ; +#define __source_code_content(typ) extern int _SAL_L_Source_(__source_code_content, (typ), _SA_annotes1(SAL_source_code_content, typ)) __iSAL_Source_Code_Content##typ; +#define __class_code_content(typ) _SAL_L_Source_(__class_code_content, (typ), _SA_annotes1(SAL_class_code_content, typ)) +#define __analysis_assert(e) __assume(e) +#define __analysis_hint(hint) _SAL_L_Source_(__analysis_hint, (hint), _SA_annotes1(SAL_analysisHint, hint)) +// For "breakpoint": doesn't return as far as analysis is concerned. +#define __analysis_noreturn __declspec(noreturn) +/* Internal defintions */ +#define __inner_data_source(src_raw) _SAL_L_Source_(__inner_data_source, (src_raw), _SA_annotes1(SAL_untrusted_data_source,src_raw)) +#define __inner_this_data_source(src_raw) _SAL_L_Source_(__inner_this_data_source, (src_raw), _SA_annotes1(SAL_untrusted_data_source_this,src_raw)) +#define __inner_out_validated(typ_raw) _SAL_L_Source_(__inner_out_validated, (typ_raw), _Post_ _SA_annotes1(SAL_validated,typ_raw)) +#define __inner_this_out_validated(typ_raw) _SAL_L_Source_(__inner_this_out_validated, (typ_raw), _SA_annotes1(SAL_validated_this,typ_raw)) +#define __inner_assume_validated_dec __inline __nothrow void __AssumeValidated(__inner_out_validated("BY_DESIGN") const void *p) {p;} +#define __inner_assume_validated(p) __AssumeValidated(p) +#define __inner_transfer(formal) _SAL_L_Source_(__inner_transfer, (formal), _SA_annotes1(SAL_transfer_adt_property_from,formal)) +#define __inner_encoded _SAL_L_Source_(__inner_encoded, (), _SA_annotes0(SAL_encoded)) + +#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR) // [ +#define __inner_adt_prop(adt,prop) _SAL_L_Source_(__inner_adt_prop, (adt,prop), _SA_annotes2(SAL_adt, adt,prop)) +#define __inner_adt_add_prop(adt,prop) _SAL_L_Source_(__inner_adt_add_prop, (adt,prop), _SA_annotes2(SAL_add_adt_property,adt,prop)) +#define __inner_adt_remove_prop(adt,prop) _SAL_L_Source_(__inner_adt_remove_prop, (adt,prop), _SA_annotes2(SAL_remove_adt_property,adt,prop)) +#define __inner_adt_transfer_prop(arg) _SAL_L_Source_(__inner_adt_trasnfer_prop, (arg), _SA_annotes1(SAL_transfer_adt_property_from,arg)) +#define __inner_adt_type_props(typ) _SAL_L_Source_(__inner_adt_type_props, (typ), _SA_annotes1(SAL_post_type,typ)) +#define __inner_volatile _SAL_L_Source_(__inner_volatile, (), _SA_annotes0(SAL_volatile)) +#define __inner_nonvolatile _SAL_L_Source_(__inner_nonvolatile, (), _SA_annotes0(SAL_nonvolatile)) +#define __inner_possibly_notnullterminated _SAL_L_Source_(__inner_possibly_notnulltermiated, (), _SA_annotes1(SAL_nullTerminated,__maybe)) +#endif // ] + +/////////////////////////////////////////////////////////////////////////////// +// +// Low Level Memory Correctness annotations +// +// These are the implementation details for the Memory Correctness annotations +// that support checking of kernel/user memory handling within kernel mode code. +// +/////////////////////////////////////////////////////////////////////////////// + +// +// The enum that defines the types of memory context that exist in the system. +// +enum _SAL_ExecutionContext { SAL_KernelMode, SAL_UserMode }; + +// +// temporary hack: Globals that stand in for the globally available SAL-pseudo-variables +// _Current_execution_context_ and _Previous_execution_context_. NMM will need to be modified +// to offer these. +// +enum _SAL_ExecutionContext _Previous_execution_context_; +enum _SAL_ExecutionContext _Current_execution_context_; + +// +// Annotation elements that support the memory origin concept. +// The "When" variant is a hack for now until NMM can parse _Previous_execution_context_ +// and _Current_execution_context_ +// +__ANNOTATION(SAL_MemoryOrigin(__In_impl_ enum _SAL_ExecutionContext);) +__ANNOTATION(SAL_MemoryOriginWhen(__In_impl_ enum _SAL_ExecutionContext, __In_impl_ enum _SAL_ExecutionContext);) + +#define _Memory_origin_(context) _SAL2_Source_(_Memory_origin_, (context), _SA_annotes1(SAL_MemoryOrigin, context)) +#define _Memory_origin_when_(previousContext, context) _SAL2_Source_(_Memory_origin_when_, (previousContext, context), _SA_annotes2(SAL_MemoryOriginWhen, previousContext, context)) + + +// +// Annotation elements that support the memory accessibility concept. +// The "When" variant is a hack for new until NMM can parse _Previous_execution_context_ +// and _Current_execution_context_ +// +__ANNOTATION(SAL_AccessibleTo(__In_impl_ enum _SAL_ExecutionContext, __In_impl_ __int64 count);) +__ANNOTATION(SAL_AccessibleToWhen(__In_impl_ enum _SAL_ExecutionContext, __In_impl_ enum _SAL_ExecutionContext, __In_impl_ __int64 count);) + +#define _Accessible_bytes_(context, expr) _SAL2_Source_(_Accessible_bytes_, (context, expr), _SA_annotes2(SAL_AccessibleTo, context, expr)) +#define _Accessible_bytes_when_(previousContext, context, expr) _SAL2_Source_(_Accessible_bytes_when_, (context, previousContext, expr), _SA_annotes3(SAL_AccessibleToWhen, context, previousContext, expr)) +#define _Pre_accessible_bytes_(context, expr) _Pre_ _Accessible_bytes_(context, expr) +#define _Pre_accessible_bytes_when_(context, previousContext, expr) _Pre_ _Accessible_bytes_when_(context, previousContext, expr) + + +/////////////////////////////////////////////////////////////////////////////// +// +// High Level Memory Correctness annotations +// +// These annotations form the expected interface for users to the Memory Correctness +// annotations that support checking of kernel/user memory handling within +// kernel mode code. +// +/////////////////////////////////////////////////////////////////////////////// +#define _User_ _Memory_origin_when_(SAL_UserMode, SAL_UserMode) _Pre_accessible_bytes_when_(SAL_UserMode, SAL_KernelMode, 0) +#define _User_on_(expr) _When_((expr) != SAL_KernelMode, _User_always_) +#define _User_always_ _Memory_origin_(SAL_UserMode) _Pre_accessible_bytes_(SAL_KernelMode, 0) +#define _User_always_and_needs_probe_on_(mode) _User_always_ _Pre_accessible_bytes_when_(SAL_UserMode, SAL_KernelMode, 0) _Pre_satisfies_(mode == _Previous_execution_context_) +#define _Kernel_entry_ _SAL2_Source_(_Kernel_entry_, (), __inner_control_entrypoint(UserToKernel)) +#define _Kernel_entry_always_ _SAL2_Source_(_Kernel_entry_, (), __inner_control_entrypoint(UserToKernel)) _Pre_satisfies_(_Previous_execution_context_ == SAL_UserMode) + + +#else // ][ + +#define __file_parser(typ) +#define __file_parser_class(typ) +#define __file_parser_library(typ) +#define __source_code_content(typ) +#define __class_code_content(typ) +#define __analysis_assert(e) +#define __analysis_hint(hint) +#define __analysis_noreturn +/* Internal defintions */ +#define __inner_data_source(src_raw) +#define __inner_this_data_source(src_raw) +#define __inner_out_validated(typ_raw) +#define __inner_this_out_validated(typ_raw) +#define __inner_assume_validated_dec +#define __inner_assume_validated(p) +#define __inner_transfer(formal) +#define __inner_encoded +#define __inner_adt_prop(adt,prop) +#define __inner_adt_add_prop(adt,prop) +#define __inner_adt_remove_prop(adt,prop) +#define __inner_adt_transfer_prop(arg) +#define __inner_adt_type_props(typ) +#define __inner_volatile +#define __inner_nonvolatile +#define __inner_possibly_notnullterminated + +/////////////////////////////////////////////////////////////////////////////// +// +// Low Level Memory Correctness annotations +// +// These are the implementation details for the Memory Correctness annotations +// that support checking of kernel/user memory handling within kernel mode code. +// +/////////////////////////////////////////////////////////////////////////////// +#define _Memory_origin_(context) +#define _Memory_origin_when_(previousContext, context) +#define _Accessible_bytes_(context, expr) +#define _Accessible_bytes_when_(previousContext, context, expr) +#define _Pre_accessible_bytes_(context, expr) +#define _Pre_accessible_bytes_when_(context, previousContext, expr) + + +/////////////////////////////////////////////////////////////////////////////// +// +// High Level Memory Correctness annotations +// +// These annotations form the expected interface for users to the Memory Correctness +// annotations that support checking of kernel/user memory handling within +// kernel mode code. +// +/////////////////////////////////////////////////////////////////////////////// +#define _User_ +#define _User_on_(expr) +#define _User_always_ +#define _User_always_and_needs_probe_on_(mode) +#define _Kernel_entry_ +#define _Kernel_entry_always_ + +#endif // ] // #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) + +#define __field_ecount(size) _SAL1_Source_(__field_ecount, (size), __notnull __elem_writableTo(size)) +#define __field_bcount(size) _SAL1_Source_(__field_bcount, (size), __notnull __byte_writableTo(size)) +#define __field_xcount(size) _SAL1_Source_(__field_xcount, (size), __notnull __inexpressible_writableTo(size)) + +#define __field_ecount_opt(size) _SAL1_Source_(__field_ecount_opt, (size), __maybenull __elem_writableTo(size)) +#define __field_bcount_opt(size) _SAL1_Source_(__field_bcount_opt, (size), __maybenull __byte_writableTo(size)) +#define __field_xcount_opt(size) _SAL1_Source_(__field_xcount_opt, (size), __maybenull __inexpressible_writableTo(size)) + +#define __field_ecount_part(size,init) _SAL1_Source_(__field_ecount_part, (size,init), __notnull __elem_writableTo(size) __elem_readableTo(init)) +#define __field_bcount_part(size,init) _SAL1_Source_(__field_bcount_part, (size,init), __notnull __byte_writableTo(size) __byte_readableTo(init)) +#define __field_xcount_part(size,init) _SAL1_Source_(__field_xcount_part, (size,init), __notnull __inexpressible_writableTo(size) __inexpressible_readableTo(init)) + +#define __field_ecount_part_opt(size,init) _SAL1_Source_(__field_ecount_part_opt, (size,init), __maybenull __elem_writableTo(size) __elem_readableTo(init)) +#define __field_bcount_part_opt(size,init) _SAL1_Source_(__field_bcount_part_opt, (size,init), __maybenull __byte_writableTo(size) __byte_readableTo(init)) +#define __field_xcount_part_opt(size,init) _SAL1_Source_(__field_xcount_part_opt, (size,init), __maybenull __inexpressible_writableTo(size) __inexpressible_readableTo(init)) + +#define __field_ecount_full(size) _SAL1_Source_(__field_ecount_full, (size), __field_ecount_part(size,size)) +#define __field_bcount_full(size) _SAL1_Source_(__field_bcount_full, (size), __field_bcount_part(size,size)) +#define __field_xcount_full(size) _SAL1_Source_(__field_xcount_full, (size), __field_xcount_part(size,size)) + +#define __field_ecount_full_opt(size) _SAL1_Source_(__field_ecount_full_opt, (size), __field_ecount_part_opt(size,size)) +#define __field_bcount_full_opt(size) _SAL1_Source_(__field_bcount_full_opt, (size), __field_bcount_part_opt(size,size)) +#define __field_xcount_full_opt(size) _SAL1_Source_(__field_xcount_full_opt, (size), __field_xcount_part_opt(size,size)) + +#define __field_nullterminated _SAL1_Source_(__field_nullterminated, (), __nullterminated) + +#define __struct_bcount(size) _SAL1_Source_(__struct_bcount, (size), __byte_writableTo(size)) +#define __struct_xcount(size) _SAL1_Source_(__struct_xcount, (size), __inexpressible_writableTo(size)) + +#define __out_awcount(expr,size) _SAL1_Source_(__out_awcount, (expr,size), _Pre_ __notnull \ + __byte_writableTo((expr) ? (size) : (size) * 2) \ + _Post_ __valid __refparam) +#define __in_awcount(expr,size) _SAL1_Source_(__in_awcount, (expr,size), _Pre_ __valid \ + _Pre_ _Notref_ __deref __readonly \ + __byte_readableTo((expr) ? (size) : (size) * 2)) +#define __post_invalid _SAL1_Source_(__post_invalid, (), _Post_ __notvalid) +/* integer related macros */ +#define __allocator _SAL_L_Source_(__allocator, (), __inner_allocator) +#define __deallocate(kind) _SAL_L_Source_(__deallocate, (kind), _Pre_ __notnull __post_invalid) +#define __deallocate_opt(kind) _SAL_L_Source_(__deallocate_opt, (kind), _Pre_ __maybenull __post_invalid) +#define __bound _SAL_L_Source_(__bound, (), __inner_bound) +#define __range(lb,ub) _SAL_L_Source_(__range, (lb,ub), __inner_range(lb,ub)) +#define __in_bound _SAL_L_Source_(__in_bound, (), _Pre_ __inner_bound) +#define __out_bound _SAL_L_Source_(__out_bound, (), _Post_ __inner_bound) +#define __deref_out_bound _SAL_L_Source_(__deref_out_bound, (), _Post_ __deref __inner_bound) +#define __in_range(lb,ub) _SAL_L_Source_(__in_range, (lb,ub), _Pre_ __inner_range(lb,ub)) +#define __out_range(lb,ub) _SAL_L_Source_(__out_range, (lb,ub), _Post_ __inner_range(lb,ub)) +#define __deref_in_range(lb,ub) _SAL_L_Source_(__deref_in_range, (lb,ub), _Pre_ __deref __inner_range(lb,ub)) +#define __deref_out_range(lb,ub) _SAL_L_Source_(__deref_out_range, (lb,ub), _Post_ __deref __inner_range(lb,ub)) +#define __deref_inout_range(lb,ub) _SAL_L_Source_(__deref_inout_range, (lb,ub), __deref_in_range(lb,ub) __deref_out_range(lb,ub)) +#define __field_range(lb,ub) _SAL_L_Source_(__field_range, (lb,ub), __range(lb,ub)) +#define __field_data_source(src_sym) _SAL_L_Source_(__field_data_source, (lb,ub), __inner_data_source(#src_sym)) + +#define __range_max(a,b) _SAL_L_Source_(__range_max, (a,b), __range(==, a > b ? a : b)) +#define __range_min(a,b) _SAL_L_Source_(__range_min, (a,b), __range(==, a < b ? a : b)) + + +/* Penetration review macros */ +#define __in_data_source(src_sym) _SAL_L_Source_(__in_data_source, (src_sym), _Pre_ __inner_data_source(#src_sym)) +#define __out_data_source(src_sym) _SAL_L_Source_(__out_data_source, (src_sym), _Post_ __inner_data_source(#src_sym)) +#define __out_validated(typ_sym) _SAL_L_Source_(__out_validated, (src_sym), __inner_out_validated(#typ_sym)) +#define __this_out_data_source(src_sym) _SAL_L_Source_(__this_out_data_source, (src_sym), __inner_this_data_source(#src_sym)) +#define __this_out_validated(typ_sym) _SAL_L_Source_(__this_out_validated, (src_sym), __inner_this_out_validated(#typ_sym)) +#define __transfer(formal) _SAL_L_Source_(__transfer, (src_sym), _Post_ __inner_transfer(formal)) +#define __rpc_entry _SAL_L_Source_(__rpc_entry, (formal), __inner_control_entrypoint(RPC)) +#define __kernel_entry _SAL_L_Source_(__kernel_entry, (), __inner_control_entrypoint(UserToKernel)) +#define __gdi_entry _SAL_L_Source_(__gdi_entry, (), __inner_control_entrypoint(GDI)) +#define __encoded_pointer _SAL_L_Source_(__encoded_pointer, (), __inner_encoded) +#define __encoded_array _SAL_L_Source_(__encoded_array, (), __inner_encoded) +#define __field_encoded_pointer _SAL_L_Source_(__field_encoded_pointer, (), __inner_encoded) +#define __field_encoded_array _SAL_L_Source_(__field_encoded_array, (), __inner_encoded) +#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR) // [ +#define __type_has_adt_prop(adt,prop) _SAL_L_Source_(__type_has_adt_prop, (adt,prop), __inner_adt_prop(adt,prop)) +#define __out_has_adt_prop(adt,prop) _SAL_L_Source_(__out_has_adt_prop, (adt,prop), _Post_ __inner_adt_add_prop(adt,prop)) +#define __out_not_has_adt_prop(adt,prop) _SAL_L_Source_(__out_not_has_adt_prop, (adt,prop), _Post_ __inner_adt_remove_prop(adt,prop)) +#define __out_transfer_adt_prop(arg) _SAL_L_Source_(__out_transfer_adt_prop, (arg), _Post_ __inner_adt_transfer_prop(arg)) +#define __out_has_type_adt_props(typ) _SAL_L_Source_(__out_has_type_adt_props, (typ), _Post_ __inner_adt_type_props(typ)) + +/* useful PFD related macros */ +#define __possibly_notnullterminated _SAL_L_Source_(__possibly_notnullterminated, (), __inner_possibly_notnullterminated) + +/* Windows Internal */ +#define __volatile _SAL_L_Source_(__volatile, (), __inner_volatile) +#define __nonvolatile _SAL_L_Source_(__nonvolatile, (), __inner_nonvolatile) +#else +#define __out_has_type_adt_props(typ) /* nothing */ +#endif +#define __deref_volatile _SAL_L_Source_(__deref_volatile, (), __deref __volatile) +#define __deref_nonvolatile _SAL_L_Source_(__deref_nonvolatile, (), __deref __nonvolatile) + +/* declare stub functions for macros */ +__inner_assume_validated_dec +__inner_assume_bound_dec +#define __analysis_assume_nullterminated(x) _Analysis_assume_nullterminated_(x) +#define __assume_validated(p) __inner_assume_validated(p) +#define __assume_bound(i) __inner_assume_bound(i) + + +/************************************************************************** +* SAL 2 extensions for Windows-specific APIs. +***************************************************************************/ + +// Annotation for parameters that are not used in any way by the function. +// Unlike _Reserved_, an _Unreferenced_parameter_ pointer need not be NULL. +#ifndef _Unreferenced_parameter_ +#define _Unreferenced_parameter_ _SAL2_Source_(_Unreferenced_parameter_, (), _Const_) +#endif + +// Pointer parameters that are freed by the function, and thus the pointed-to +// memory should not be used after return. +#ifndef _Frees_ptr_ +#define _Frees_ptr_ _SAL_L_Source_(_Frees_ptr_, (), _Pre_notnull_ _Post_ptr_invalid_ __drv_freesMem(Mem)) +#endif +#ifndef _Frees_ptr_opt_ +#define _Frees_ptr_opt_ _SAL_L_Source_(_Frees_ptr_opt_, (), _Pre_maybenull_ _Post_ptr_invalid_ __drv_freesMem(Mem)) +#endif + + +// Functions which behave like realloc in that they may succeed by +// freeing one block of memory and allocating another, or may fail, in +// which case the original block is still valid, or may be used to +// free memory directly by requesting that the new block is of size +// zero. We do not say here whether the before may be null, we leave +// that to the annotation on the argument +#define _Reallocation_function_(after, before, size) \ + _Success_((after) != NULL || (size) == 0) \ + _At_((after), _Post_maybenull_ _Post_writable_byte_size_(size) \ + _When_(((before) == NULL || (size) > 0), _Must_inspect_result_)) \ + _At_((before), _Post_ptr_invalid_ __drv_freesMem(Mem)) + +#define _Ret_reallocated_bytes_(before, size) \ + _Reallocation_function_(_Curr_, before, size) + + +// NLS APIs allow strings to be specified either by an element count or +// null termination. Unlike _In_reads_or_z_, this is not whichever comes +// first, but based on whether the size is negative or not. +#define _In_NLS_string_(size) _SAL_L_Source_(_In_NLS_string_, (size), _When_((size) < 0, _In_z_) \ + _When_((size) >= 0, _In_reads_(size))) + + +// Minifilter CompletionContext parameters on the pre-operation callback +// default to NULL. For return type FLT_PREOP_SUCCESS_WITH_CALLBACK or +// FLT_PREOP_SYNCHRONIZE, it may be set to NULL or a valid pointer. For all +// other returns, it must be NULL. +#define _Flt_CompletionContext_Outptr_ \ + _SAL_L_Source_(_Flt_CompletionContext_Outptr_, (), _Outptr_result_maybenull_ _Pre_valid_ \ + _At_(*_Curr_, _Pre_null_ \ + _When_(return != FLT_PREOP_SUCCESS_WITH_CALLBACK && return != FLT_PREOP_SYNCHRONIZE, _Post_null_))) + +// Minifilter ConnectionCookie parameters on the port connect notify callback +// default to NULL. On successful return, it may be set to NULL or non-NULL, +// but it must be NULL on failure. +#define _Flt_ConnectionCookie_Outptr_ \ + _SAL_L_Source_(_Flt_ConnectionCookie_Outptr_, (), _Outptr_result_maybenull_ _Pre_valid_ \ + _At_(*_Curr_, _Pre_null_ _On_failure_(_Post_null_))) + + +// +// A common pattern is to pass an "_Inout_ PCHAR* ppBuf" of size "_Inout_ DWORD* pSize" +// to a function that writes to **pBuf, incrementing *ppBuf to point to one +// past the last written byte. Thus the length of the write is +// (*ppBuf - Old(*ppBuf)). The size of the remaining unwritten capacity +// is written to *pSize. +// +// This pattern is frequently used when progressively filling a +// large buffer in chunks +// (e.g. when reading from a network interface in a driver). +// +// It is expected that these supplementary annotations would be used inside an +// _At_, like so: +// +// _At_(*ppBuf, _Writes_and_advances_ptr_(*pBufSize)) +// HRESULT WriteChunkOfData(_Inout_ PCHAR* ppBuf, _Inout_ DWORD* pBufSize); +// +#ifndef _Writes_and_advances_ptr_ // [ +#define _Writes_and_advances_ptr_(size) \ + _SAL2_Source_(_Writes_and_advances_ptr_, (size), _At_((void*)_Curr_, _Inout_) \ + _At_(_Curr_, \ + _Pre_writable_size_(size) \ + _Post_writable_size_(size) \ + _Post_satisfies_(_Curr_ - _Old_(_Curr_) == _Old_(size) - size)) \ + _At_(_Old_(_Curr_), \ + _Post_readable_size_(_Old_(size) - size))) +#endif // ] + +#ifndef _Writes_bytes_and_advances_ptr_ // [ +#define _Writes_bytes_and_advances_ptr_(size) \ + _SAL2_Source_(_Writes_bytes_and_advances_ptr, (size), _At_((void*)_Curr_, _Inout_) \ + _At_(_Curr_, \ + _Pre_writable_byte_size_(size) \ + _Post_writable_byte_size_(size) \ + _Post_satisfies_(((char*)_Curr_) - ((char*)_Old_(_Curr_)) == _Old_(size) - size)) \ + _At_(_Old_(_Curr_), \ + _Post_readable_byte_size_(_Old_(size) - size))) +#endif // ] + +// +// Gets the current error code (as returned by GetLastError()), and stores +// in _Curr_ as a postcondition. This is currently approximated by assuming +// that GetLastError() always returns a failed error code. This is not a +// completely accurate approximation, but reasonable. +// +#define _Post_equals_last_error_ _SAL2_Source_(_Post_equals_last_error_, (), _Post_satisfies_(_Curr_ != 0)) + +// +// Indicates the function simply translates the given Win32 error code into an HRESULT +// with broadly the same semantics as HRESULT_FROM_WIN32(). +// +// This convenience macro allows analyzers to understand the many bespoke error-translation +// functions as simple translators that can be treated as equivalent to HRESULT_FROM_WIN32(). +// This results in fewer false positives and unnecessary path explorations. This is because +// for analysis, the specific translations rarely matter, it is more important to know the +// that function cannot fail and the conditions under which it will return an error-range +// HRESULT and when a success-range HRESULT. +// +#ifndef _Translates_Win32_to_HRESULT_ // [ + +#define _Translates_Win32_to_HRESULT_(errorCode) \ + _SAL2_Source_(_Translates_Win32_to_HRESULT_, (errorCode), \ + _Always_( \ + _When_((HRESULT)errorCode <= 0, \ + _At_(_Curr_, _Post_equal_to_((HRESULT)errorCode))) \ + _When_((HRESULT)errorCode > 0, \ + _At_(_Curr_, _Post_equal_to_((HRESULT)((errorCode & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)))))) + +#endif // ] + +// +// Indicates the function just directly translates the given NTSTATUS error code into an HRESULT. +// +// This convenience macro allows analyzers to understand the many bespoke error-translation +// functions as simple translators that can be treated as equivalent to HRESULT_FROM_NT(). +// This results in fewer false positives and unnecessary path explorations. This is because +// for analysis, the specific translations rarely matter. +// +#ifndef _Translates_NTSTATUS_to_HRESULT_ // [ + +#define _Translates_NTSTATUS_to_HRESULT_(status) \ + _SAL2_Source_(_Translates_NTSTATUS_to_HRESULT_, (status), \ + _Always_( \ + _Post_equal_to_((HRESULT)(status | FACILITY_NT_BIT)))) + +#endif // ] + +// +// Indicates the funtion just translates the result of GetLastError() into an HRESULT. +// +// This convenience macro allows analyzers to understand the many bespoke GetLastError-translation +// functions as simple translators that will always return a failure-value HRESULT (these functions +// are almost never meant to be called when GetLastError() could return 0). +// This results in fewer false positives and unnecessary path explorations. This is because +// for analysis, the specific translations rarely matter. +// +#ifndef _Translates_last_error_to_HRESULT_ // [ + +#define _Translates_last_error_to_HRESULT_ \ + _SAL2_Source_(_Translates_last_error_to_HRESULT_, (), \ + _Always_( \ + _Post_satisfies_(_Curr_ < 0))) + +#endif // ] + +#ifdef __cplusplus +} +#endif + +#ifdef _PREFIX_ // [ +/************************************************************************** +* Defintion of __pfx_assume and __pfx_assert. Thse should be the only +* defintions of these functions. +***************************************************************************/ +#if __cplusplus // [ +extern "C" void __pfx_assert(bool, const char *); +extern "C" void __pfx_assume(bool, const char *); +#else // ][ +void __pfx_assert(int, const char *); +void __pfx_assume(int, const char *); +#endif // ] +/************************************************************************** +* Redefintion of __analysis_assume and __analysis_assert for PREFIX build +**************************************************************************/ +#undef __analysis_assume +#undef __analysis_assert +#define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e)); +#define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e)); +#endif /* ifdef _PREFIX_ */ // ] + +/************************************************************************** +* This include should always be the last thing in this file. +* Must avoid redfinitions of macros to workaround rc.exe issues. +***************************************************************************/ +#if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) +#include +#endif /* if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) */ + +/* + If no SAL 2 appears to have been defined (_Outptr_ is a representative choice) + then we must be operating in a downlevel build environment (such as VS10). + We also test against the compiler version to identify a downlevel environment, + as VS11 is the minimum required for SAL 2 support. + + If we are operating in a downlevel build environment (such as VS10) + we need to undefine the following symbols before including driverspecs.h + or we will end up referencing SAL 2 implementation symbols and cause + build failures. +*/ +#if (!defined(_Outptr_) || _MSC_FULL_VER <= 160000000) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) /*IFSTRIP=IGN*/ // [ +#undef __ANNOTATION +#define __ANNOTATION(fun) /* fun */ +#undef __PRIMOP +#define __PRIMOP(type, fun) +#endif /* !defined(_Outptr_) || _MSC_VER <= 1600 */ // ] + +#include + +/* + If no SAL 2 appears to have been defined (_Outptr_ is a representative choice) + then we must be operating in a downlevel build environment (such as VS10). + We also test against the compiler version to identify a downlevel environment, + as VS11 is the minimum required for SAL 2 support. + + If we are in a downlevel environment, we can go ahead and include no_sal2.h + to make all of SAL 2 no-ops to ensure no build failures. +*/ +#if (!defined(_Outptr_) || _MSC_FULL_VER <= 160000000) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) && !( defined( _SDV_ ) ) /*IFSTRIP=IGN*/ // [ +#include +#endif /* !defined(_Outptr_) || _MSC_VER <= 1600 */ // ] + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + +#endif /* #ifndef SPECSTRINGS_H */ // ] \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper/specstrings_strict.h b/src/nativeInterop/cinterop/versionhelper/specstrings_strict.h new file mode 100644 index 0000000..1f0e1b7 --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/specstrings_strict.h @@ -0,0 +1,1186 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +/************************************************************************* +* This file documents all the macros approved for use in windows source +* code. It includes some experimental macros which should only be used by +* experts. +* +* DO NOT include this file directly. This file is include after +* specstrings.h. So we can undefine every possible old definition including +* private internal macros people should not be using, as well as macros from +* sal.h. Macros are redefined here in a way to cause syntax errors when used +* incorrectly during a normal build when specstrings.h is included and +* __SPECSTRINGS_STRICT_LEVEL is defined. +* +* There are several levels of strictness, each level includes the behavior of +* all previous levels. +* +* 0 - Disable strict checking +* 1 - Break on unapproved macros and misuse of statement +* macros such as __fallthrough (default) +* 2 - Deprecated some old macros that should not be used +* 3 - Use VS 2005 Source Annotation to make sure every macro +* is used in the right context. For example placing __in on a return +* parameter will result in an error. +************************************************************************/ +#ifndef __SPECSTRINGS_STRICT_LEVEL +#define __SPECSTRINGS_STRICT_LEVEL 1 +#endif +/************************************************************************ +* Introduction +* +* specstrings.h provides a set of annotations to describe how a function uses +* its parameters - the assumptions it makes about them, and the guarantees it +* makes upon finishing. +* +* Annotations must be placed before a function parameter's type or its return +* type. There are two basic classes of common annotations buffer annotations +* and advanced annotations. Buffer annotations describe how functions use +* their pointer parameters, and advanced annotations either describe +* complex/unusual buffer behavior, or provide additional information about a +* parameter that is not otherwise expressible. +* +* Buffer Annotations +* +* The most important annotations in SpecStrings.h provide a consistent way to +* annotate buffer parameters or return values for a function. Each of these +* annotations describes a single buffer (which could be a string, a +* fixed-length or variable-length array, or just a pointer) that the function +* interacts with: where it is, how large it is, how much is initialized, and +* what the function does with it. +* +* The appropriate macro for a given buffer can be constructed using the table +* below. Just pick the appropriate values from each category, and combine +* them together with a leading underscore. Some combinations of values do not +* make sense as buffer annotations. Only meaningful annotations can be added +* to your code; for a list of these, see the buffer annotation definitions +* section. +* +* Only a single buffer annotation should be used for each parameter. +* +* |------------|------------|---------|--------|----------|---------------| +* | Level | Usage | Size | Output | Optional | Parameters | +* |------------|------------|---------|--------|----------|---------------| +* | <> | <> | <> | <> | <> | <> | +* | _deref | _in | _ecount | _full | _opt | (size) | +* | _deref_opt | _out | _bcount | _part | | (size,length) | +* | | _inout | | | | | +* | | | | | | | +* |------------|------------|---------|--------|----------|---------------| +* +* Note: "<>" represents the empty string. +* +* Level: Describes the buffer pointer's level of indirection from the +* parameter or return value 'p'. +* +* <> : p is the buffer pointer. +* _deref : *p is the buffer pointer. p must not be NULL. +* _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the +* rest of the annotation is ignored. +* +* Usage: Describes how the function uses the buffer. +* +* <> : The buffer is not accessed. If used on the return value or with +* _deref, the function will provide the buffer, and it will be uninitialized +* at exit. Otherwise, the caller must provide the buffer. This should only +* be used for alloc and free functions. +* +* _in : The function will only read from the buffer. The caller must provide +* the buffer and initialize it. +* +* _out : The function will only write to the buffer. If used on the return +* value or with _deref, the function will provide the buffer and initialize +* it. Otherwise, the caller must provide the buffer, and the function will +* initialize it. +* +* _inout : The function may freely read from and write to the buffer. The +* caller must provide the buffer and initialize it. If used with _deref, the +* buffer may be reallocated by the function. +* +* Size: Describes the total size of the buffer. This may be less than the +* space actually allocated for the buffer, in which case it describes the +* accessible amount. +* +* <> : No buffer size is given. If the type specifies the buffer size (such +* as with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is +* one element long. Must be used with _in, _out, or _inout. +* +* _ecount : The buffer size is an explicit element count. +* +* _bcount : The buffer size is an explicit byte count. +* +* Output: Describes how much of the buffer will be initialized by the +* function. For _inout buffers, this also describes how much is initialized +* at entry. Omit this category for _in buffers; they must be fully +* initialized by the caller. +* +* <> : The type specifies how much is initialized. For instance, a function +* initializing an LPWSTR must NULL-terminate the string. +* +* _full : The function initializes the entire buffer. +* +* _part : The function initializes part of the buffer, and explicitly +* indicates how much. +* +* Optional: Describes if the buffer itself is optional. +* +* <> : The pointer to the buffer must not be NULL. +* +* _opt : The pointer to the buffer might be NULL. It will be checked before +* being dereferenced. +* +* Parameters: Gives explicit counts for the size and length of the buffer. +* +* <> : There is no explicit count. Use when neither _ecount nor _bcount is +* used. +* +* (size) : Only the buffer's total size is given. Use with _ecount or _bcount +* but not _part. +* +* (size,length) : The buffer's total size and initialized length are +* given. Use with _ecount_part and _bcount_part. +* +* ---------------------------------------------------------------------------- +* Buffer Annotation Examples +* +* LWSTDAPI_(BOOL) StrToIntExA( +* LPCSTR pszString, // No annotation required, const implies __in. +* DWORD dwFlags, +* __out int *piRet // A pointer whose dereference will be filled in. +* ); +* +* void MyPaintingFunction( +* __in HWND hwndControl, // An initialized read-only parameter. +* __in_opt HDC hdcOptional, // An initialized read-only parameter that +* // might be NULL. +* __inout IPropertyStore *ppsStore // An initialized parameter that +* // may be freely used and modified. +* ); +* +* LWSTDAPI_(BOOL) PathCompactPathExA( +* __out_ecount(cchMax) LPSTR pszOut, // A string buffer with cch elements +* // that will be '\0' terminated +* // on exit. +* LPCSTR pszSrc, // No annotation required, +* // const implies __in. +* UINT cchMax, +* DWORD dwFlags +* ); +* +* HRESULT SHLocalAllocBytes( +* size_t cb, +* __deref_bcount(cb) T **ppv // A pointer whose dereference will be set +* // to an uninitialized buffer with cb bytes. +* ); +* +* __inout_bcount_full(cb) : A buffer with cb elements that is fully +* initialized at entry and exit, and may be written to by this function. +* +* __out_ecount_part(count, *countOut) : A buffer with count elements that +* will be partially initialized by this function. The function indicates how +* much it initialized by setting *countOut. +* +************************************************************************/ + +#if (_MSC_VER >= 1400) && !defined(__midl) && !defined(_PREFAST_) && (__SPECSTRINGS_STRICT_LEVEL > 0) +#pragma once +#include +#define __ecount(size) _SAL_VERSION_CHECK(__ecount) +#define __bcount(size) _SAL_VERSION_CHECK(__bcount) +#define __xcount(size) _SAL_VERSION_CHECK(__xcount) +#define __in _SAL_VERSION_CHECK(__in) +#define __in_ecount(size) _SAL_VERSION_CHECK(__in_ecount) +#define __in_bcount(size) _SAL_VERSION_CHECK(__in_bcount) +#define __in_xcount(size) _SAL_VERSION_CHECK(__in_xcount) +#define __in_z _SAL_VERSION_CHECK(__in_z) +#define __in_ecount_z(size) _SAL_VERSION_CHECK(__in_ecount_z) +#define __in_bcount_z(size) _SAL_VERSION_CHECK(__in_bcount_z) +#define __out _SAL_VERSION_CHECK(__out) +#define __out_ecount(size) _SAL_VERSION_CHECK(__out_ecount) +#define __out_bcount(size) _SAL_VERSION_CHECK(__out_bcount) +#define __out_xcount(size) _SAL_VERSION_CHECK(__out_xcount) +#define __out_ecount_part(size,len) _SAL_VERSION_CHECK(__out_ecount_part) +#define __out_bcount_part(size,len) _SAL_VERSION_CHECK(__out_bcount_part) +#define __out_xcount_part(size,len) _SAL_VERSION_CHECK(__out_xcount_part) +#define __out_ecount_full(size) _SAL_VERSION_CHECK(__out_ecount_full) +#define __out_bcount_full(size) _SAL_VERSION_CHECK(__out_bcount_full) +#define __out_xcount_full(size) _SAL_VERSION_CHECK(__out_xcount_full) +#define __out_z _SAL_VERSION_CHECK(__out_z) +#define __out_ecount_z(size) _SAL_VERSION_CHECK(__out_ecount_z) +#define __out_bcount_z(size) _SAL_VERSION_CHECK(__out_bcount_z) +#define __inout _SAL_VERSION_CHECK(__inout) +#define __inout_ecount(size) _SAL_VERSION_CHECK(__inout_ecount) +#define __inout_bcount(size) _SAL_VERSION_CHECK(__inout_bcount) +#define __inout_xcount(size) _SAL_VERSION_CHECK(__inout_xcount) +#define __inout_ecount_part(size,len) _SAL_VERSION_CHECK(__inout_ecount_part) +#define __inout_bcount_part(size,len) _SAL_VERSION_CHECK(__inout_bcount_part) +#define __inout_xcount_part(size,len) _SAL_VERSION_CHECK(__inout_xcount_part) +#define __inout_ecount_full(size) _SAL_VERSION_CHECK(__inout_ecount_full) +#define __inout_bcount_full(size) _SAL_VERSION_CHECK(__inout_bcount_full) +#define __inout_xcount_full(size) _SAL_VERSION_CHECK(__inout_xcount_full) +#define __inout_z __allowed(on_parameter) +#define __inout_ecount_z(size) __allowed(on_parameter) +#define __inout_bcount_z(size) __allowed(on_parameter) +#define __ecount_opt(size) __allowed(on_parameter) +#define __bcount_opt(size) __allowed(on_parameter) +#define __xcount_opt(size) __allowed(on_parameter) +#define __in_opt _SAL_VERSION_CHECK(__in_opt) +#define __in_ecount_opt(size) _SAL_VERSION_CHECK(__in_ecount_opt) +#define __in_bcount_opt(size) _SAL_VERSION_CHECK(__in_bcount_opt) +#define __in_z_opt __allowed(on_parameter) +#define __in_ecount_z_opt(size) __allowed(on_parameter) +#define __in_bcount_z_opt(size) __allowed(on_parameter) +#define __in_xcount_opt(size) __allowed(on_parameter) +#define __out_opt _SAL_VERSION_CHECK(__out_opt) +#define __out_ecount_opt(size) _SAL_VERSION_CHECK(__out_ecount_opt) +#define __out_bcount_opt(size) _SAL_VERSION_CHECK(__out_bcount_opt) +#define __out_xcount_opt(size) __allowed(on_parameter) +#define __out_ecount_part_opt(size,len) __allowed(on_parameter) +#define __out_bcount_part_opt(size,len) __allowed(on_parameter) +#define __out_xcount_part_opt(size,len) __allowed(on_parameter) +#define __out_ecount_full_opt(size) __allowed(on_parameter) +#define __out_bcount_full_opt(size) __allowed(on_parameter) +#define __out_xcount_full_opt(size) __allowed(on_parameter) +#define __out_ecount_z_opt(size) __allowed(on_parameter) +#define __out_bcount_z_opt(size) __allowed(on_parameter) +#define __inout_opt _SAL_VERSION_CHECK(__inout_opt) +#define __inout_ecount_opt(size) _SAL_VERSION_CHECK(__inout_ecount_opt) +#define __inout_bcount_opt(size) _SAL_VERSION_CHECK(__inout_bcount_opt) +#define __inout_xcount_opt(size) _SAL_VERSION_CHECK(__inout_xcount_opt) +#define __inout_ecount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_ecount_part_opt) +#define __inout_bcount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_bcount_part_opt) +#define __inout_xcount_part_opt(size,len) _SAL_VERSION_CHECK(__inout_xcount_part_opt) +#define __inout_ecount_full_opt(size) _SAL_VERSION_CHECK(__inout_ecount_full_opt) +#define __inout_bcount_full_opt(size) _SAL_VERSION_CHECK(__inout_bcount_full_opt) +#define __inout_xcount_full_opt(size) _SAL_VERSION_CHECK(__inout_xcount_full_opt) +#define __inout_z_opt __allowed(on_parameter) +#define __inout_ecount_z_opt(size) __allowed(on_parameter) +#define __inout_ecount_z_opt(size) __allowed(on_parameter) +#define __inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_ecount(size) __allowed(on_parameter) +#define __deref_bcount(size) __allowed(on_parameter) +#define __deref_xcount(size) __allowed(on_parameter) +#define __deref_in _SAL_VERSION_CHECK(__deref_in) +#define __deref_in_ecount(size) _SAL_VERSION_CHECK(__deref_in_ecount) +#define __deref_in_bcount(size) _SAL_VERSION_CHECK(__deref_in_bcount) +#define __deref_in_xcount(size) _SAL_VERSION_CHECK(__deref_in_xcount) +#define __deref_out _SAL_VERSION_CHECK(__deref_out) +#define __deref_out_ecount(size) _SAL_VERSION_CHECK(__deref_out_ecount) +#define __deref_out_bcount(size) _SAL_VERSION_CHECK(__deref_out_bcount) +#define __deref_out_xcount(size) _SAL_VERSION_CHECK(__deref_out_xcount) +#define __deref_out_ecount_part(size,len) _SAL_VERSION_CHECK(__deref_out_ecount_part) +#define __deref_out_bcount_part(size,len) _SAL_VERSION_CHECK(__deref_out_bcount_part) +#define __deref_out_xcount_part(size,len) _SAL_VERSION_CHECK(__deref_out_xcount_part) +#define __deref_out_ecount_full(size) _SAL_VERSION_CHECK(__deref_out_ecount_full) +#define __deref_out_bcount_full(size) _SAL_VERSION_CHECK(__deref_out_bcount_full) +#define __deref_out_xcount_full(size) _SAL_VERSION_CHECK(__deref_out_xcount_full) +#define __deref_out_z __allowed(on_parameter) +#define __deref_out_ecount_z(size) __allowed(on_parameter) +#define __deref_out_bcount_z(size) __allowed(on_parameter) +#define __deref_inout _SAL_VERSION_CHECK(__deref_inout) +#define __deref_inout_ecount(size) _SAL_VERSION_CHECK(__deref_inout_ecount) +#define __deref_inout_bcount(size) _SAL_VERSION_CHECK(__deref_inout_bcount) +#define __deref_inout_xcount(size) _SAL_VERSION_CHECK(__deref_inout_xcount) +#define __deref_inout_ecount_part(size,len) __allowed(on_parameter) +#define __deref_inout_bcount_part(size,len) __allowed(on_parameter) +#define __deref_inout_xcount_part(size,len) __allowed(on_parameter) +#define __deref_inout_ecount_full(size) __allowed(on_parameter) +#define __deref_inout_bcount_full(size) __allowed(on_parameter) +#define __deref_inout_xcount_full(size) __allowed(on_parameter) +#define __deref_inout_z __allowed(on_parameter) +#define __deref_inout_ecount_z(size) __allowed(on_parameter) +#define __deref_inout_bcount_z(size) __allowed(on_parameter) +#define __deref_ecount_opt(size) __allowed(on_parameter) +#define __deref_bcount_opt(size) __allowed(on_parameter) +#define __deref_xcount_opt(size) __allowed(on_parameter) +#define __deref_in_opt __allowed(on_parameter) +#define __deref_in_opt_out __allowed(on_parameter) +#define __deref_in_ecount_opt(size) __allowed(on_parameter) +#define __deref_in_bcount_opt(size) __allowed(on_parameter) +#define __deref_in_xcount_opt(size) __allowed(on_parameter) +#define __deref_out_opt _SAL_VERSION_CHECK(__deref_out_opt) +#define __deref_out_ecount_opt(size) _SAL_VERSION_CHECK(__deref_out_ecount_opt) +#define __deref_out_bcount_opt(size) _SAL_VERSION_CHECK(__deref_out_bcount_opt) +#define __deref_out_xcount_opt(size) _SAL_VERSION_CHECK(__deref_out_xcount_opt) +#define __deref_out_ecount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_ecount_part_opt) +#define __deref_out_bcount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_bcount_part_opt) +#define __deref_out_xcount_part_opt(size,len) _SAL_VERSION_CHECK(__deref_out_xcount_part_opt) +#define __deref_out_ecount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_ecount_full_opt) +#define __deref_out_bcount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_bcount_full_opt) +#define __deref_out_xcount_full_opt(size) _SAL_VERSION_CHECK(__deref_out_xcount_full_opt) +#define __deref_out_z_opt __allowed(on_parameter) +#define __deref_out_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_out_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_inout_opt __allowed(on_parameter) +#define __deref_inout_ecount_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_opt(size) __allowed(on_parameter) +#define __deref_inout_xcount_opt(size) __allowed(on_parameter) +#define __deref_inout_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_inout_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_inout_z_opt __allowed(on_parameter) +#define __deref_inout_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_ecount(size) __allowed(on_parameter) +#define __deref_opt_bcount(size) __allowed(on_parameter) +#define __deref_opt_xcount(size) __allowed(on_parameter) +#define __deref_opt_in __allowed(on_parameter) +#define __deref_opt_in_ecount(size) __allowed(on_parameter) +#define __deref_opt_in_bcount(size) __allowed(on_parameter) +#define __deref_opt_in_xcount(size) __allowed(on_parameter) +#define __deref_opt_out _SAL_VERSION_CHECK(__deref_opt_out) +#define __deref_opt_out_ecount(size) _SAL_VERSION_CHECK(__deref_opt_out_ecount) +#define __deref_opt_out_bcount(size) _SAL_VERSION_CHECK(__deref_opt_out_bcount) +#define __deref_opt_out_xcount(size) _SAL_VERSION_CHECK(__deref_opt_out_xcount) +#define __deref_opt_out_ecount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_bcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_xcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_out_ecount_full(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_full(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout __allowed(on_parameter) +#define __deref_opt_inout_ecount(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount(size) __allowed(on_parameter) +#define __deref_opt_inout_ecount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_bcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_xcount_part(size,len) __allowed(on_parameter) +#define __deref_opt_inout_ecount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_full(size) __allowed(on_parameter) +#define __deref_opt_inout_z __allowed(on_parameter) +#define __deref_opt_inout_ecount_z(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_z(size) __allowed(on_parameter) +#define __deref_opt_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_opt __allowed(on_parameter) +#define __deref_opt_in_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_in_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_opt __allowed(on_parameter) +#define __deref_opt_out_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_out_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_out_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_out_z_opt __allowed(on_parameter) +#define __deref_opt_out_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_out_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_opt __allowed(on_parameter) +#define __deref_opt_inout_ecount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_ecount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_bcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_xcount_part_opt(size,len) __allowed(on_parameter) +#define __deref_opt_inout_ecount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_xcount_full_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_z_opt __allowed(on_parameter) +#define __deref_opt_inout_ecount_z_opt(size) __allowed(on_parameter) +#define __deref_opt_inout_bcount_z_opt(size) __allowed(on_parameter) +#define __deref_in_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_out_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_inout_ecount_iterator(size,incr) __allowed(on_parameter) +#define __deref_realloc_bcount(insize,outsize) __allowed(on_parameter) + +/************************************************************************ +* SAL 2 _Ouptr_ family of annotations +************************************************************************/ + +#define _Outptr_ __allowed(on_parameter) +#define _Outptr_result_maybenull_ __allowed(on_parameter) +#define _Outptr_opt_ __allowed(on_parameter) +#define _Outptr_opt_result_maybenull_ __allowed(on_parameter) +#define _Outptr_result_z_ __allowed(on_parameter) +#define _Outptr_opt_result_z_ __allowed(on_parameter) +#define _Outptr_result_maybenull_z_ __allowed(on_parameter) +#define _Outptr_opt_result_maybenull_z_ __allowed(on_parameter) +#define _Outptr_result_nullonfailure_ __allowed(on_parameter) +#define _Outptr_opt_result_nullonfailure_ __allowed(on_parameter) +#define _COM_Outptr_ __allowed(on_parameter) +#define _COM_Outptr_result_maybenull_ __allowed(on_parameter) +#define _COM_Outptr_opt_ __allowed(on_parameter) +#define _COM_Outptr_opt_result_maybenull_ __allowed(on_parameter) +#define _Outptr_result_buffer_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_result_buffer_all_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_all_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_buffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_result_buffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_buffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_to_(size, count) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_all_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_all_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_maybenull_(size) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) __allowed(on_parameter) +#define _Outptr_result_bytebuffer_all_maybenull_(size) __allowed(on_parameter) +#define _Outptr_opt_result_bytebuffer_all_maybenull_(size) __allowed(on_parameter) + +/************************************************************************ +* Orcas SAL +************************************************************************/ +#define _Deref_out_ _SAL_VERSION_CHECK(_Deref_out_) +#define _Deref_out_opt_ _SAL_VERSION_CHECK(_Deref_out_opt_) +#define _Deref_opt_out_ _SAL_VERSION_CHECK(_Deref_opt_out_) +#define _Deref_opt_out_opt_ _SAL_VERSION_CHECK(_Deref_opt_out_opt_) +#define _In_count_(size) _SAL_VERSION_CHECK(_In_count_) +#define _In_opt_count_(size) _SAL_VERSION_CHECK(_In_opt_count_) +#define _In_bytecount_(size) _SAL_VERSION_CHECK(_In_bytecount_) +#define _In_opt_bytecount_(size) _SAL_VERSION_CHECK(_In_opt_bytecount_) +#define _Out_cap_(size) _SAL_VERSION_CHECK(_Out_cap_) +#define _Out_opt_cap_(size) _SAL_VERSION_CHECK(_Out_opt_cap_) +#define _Out_bytecap_(size) _SAL_VERSION_CHECK(_Out_bytecap_) +#define _Out_opt_bytecap_(size) _SAL_VERSION_CHECK(_Out_opt_bytecap_) +#define _Deref_post_count_(size) _SAL_VERSION_CHECK(_Deref_post_count_) +#define _Deref_post_opt_count_(size) _SAL_VERSION_CHECK(_Deref_post_opt_count_) +#define _Deref_post_bytecount_(size) _SAL_VERSION_CHECK(_Deref_post_bytecount_) +#define _Deref_post_opt_bytecount_(size) _SAL_VERSION_CHECK(_Deref_post_opt_bytecount_) +#define _Deref_post_cap_(size) _SAL_VERSION_CHECK(_Deref_post_cap_) +#define _Deref_post_opt_cap_(size) _SAL_VERSION_CHECK(_Deref_post_opt_cap_) +#define _Deref_post_bytecap_(size) _SAL_VERSION_CHECK(_Deref_post_bytecap_) +#define _Deref_post_opt_bytecap_(size) _SAL_VERSION_CHECK(_Deref_post_opt_bytecap_) + +/************************************************************************ +* Advanced Annotations +* +* Advanced annotations describe behavior that is not expressible with the +* regular buffer macros. These may be used either to annotate buffer +* parameters that involve complex or conditional behavior, or to enrich +* existing annotations with additional information. +* +* _At_(expr, annotes) : annotation list annotes applies to target 'expr' +* +* _When_(expr, annotes) : annotation list annotes applies when 'expr' is true +* +* __success(expr) T f() : indicates whether function f succeeded or +* not. If is true at exit, all the function's guarantees (as given +* by other annotations) must hold. If is false at exit, the caller +* should not expect any of the function's guarantees to hold. If not used, +* the function must always satisfy its guarantees. Added automatically to +* functions that indicate success in standard ways, such as by returning an +* HRESULT. +* +* __out_awcount(expr, size) T *p : Pointer p is a buffer whose size may be +* given in either bytes or elements. If is true, this acts like +* __out_bcount. If is false, this acts like __out_ecount. This +* should only be used to annotate old APIs. +* +* __in_awcount(expr, size) T* p : Pointer p is a buffer whose size may be given +* in either bytes or elements. If is true, this acts like +* __in_bcount. If is false, this acts like __in_ecount. This should +* only be used to annotate old APIs. +* +* __nullterminated T* p : Pointer p is a buffer that may be read or written +* up to and including the first '\0' character or pointer. May be used on +* typedefs, which marks valid (properly initialized) instances of that type +* as being null-terminated. +* +* __nullnullterminated T* p : Pointer p is a buffer that may be read or +* written up to and including the first sequence of two '\0' characters or +* pointers. May be used on typedefs, which marks valid instances of that +* type as being double-null terminated. +* +* __reserved T v : Value v must be 0/NULL, reserved for future use. +* +* __checkReturn T f(); : Return value of f must not be ignored by callers +* of this function. +* +* __typefix(ctype) T v : Value v should be treated as an instance of ctype, +* rather than its declared type when considering validity. +* +* __override T f(); : Specify C#-style 'override' behaviour for overriding +* virtual methods. +* +* __callback T f(); : Function f can be used as a function pointer. +* +* __format_string T p : Pointer p is a string that contains % markers in +* the style of printf. +* +* __blocksOn(resource) f(); : Function f blocks on the resource 'resource'. +* +* __fallthrough : Annotates switch statement labels where fall-through is +* desired, to distinguish from forgotten break statements. +* +* __range(low_bnd, up_bnd) int f(): The return from the function "f" must +* be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __in_range(low_bnd, up_bnd) int i : Precondition that integer i must be +* in the inclusive numeric range [low_bnd, up_bnd]. +* +* __out_range(low_bnd, up_bnd) int i : Postcondition that integer i must be +* in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_in_range(low_bnd, up_bnd) int* pi : Precondition that integer *pi +* must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_out_range(low_bnd, up_bnd) int* pi : Postcondition that integer +* *pi must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* __deref_inout_range(low_bnd, up_bnd) int* pi : Invariant that the integer +* *pi must be in the inclusive numeric range [low_bnd, up_bnd]. +* +* The first argument of a range macro may also be a C relational operator +* (<,>,!=, ==, <=, >=). +* +* __range(rel_op, j) int f(): Postcondition that "f() rel_op j" must be +* true. Note that j may be a expression known only at runtime. +* +* __in_range(rel_op, j) int i : Precondition that "i rel_op j" must be +* true. Note that j may be a expression known only at runtime. +* +* __out_range(rel_op, j) int i : Postcondition that integer "i rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_in_range(rel_op, j) int *pi : Precondition that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_out_range(rel_op, j) int *pi : Postcondition that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __deref_inout_range(rel_op, j) int *pi : Invariant that "*pi rel_op j" +* must be true. Note that j may be a expression known only at runtime. +* +* __range_max(a, b) int f(): Postcondition f acts as 'max', returns larger +* of a and b. Note that a and b may be expressions known only at runtime. +* +* __range_min(a, b) int f(): Postcondition f acts as 'min', returns smaller +* of a and b. Note that a and b may be expressions known only at runtime. +* +* __in_bound int i : Precondition that integer i must be bound, but the +* exact range can't be specified at compile time. __in_range should be +* used if the range can be explicitly stated. +* +* __out_bound int i : Postcondition that integer i must be bound, but the +* exact range can't be specified at compile time. __out_range should be +* used if the range can be explicitly stated. +* +* __deref_out_bound int pi : Postcondition that integer *pi must be bound, +* but the exact range can't be specified at compile time. +* __deref_out_range should be used if the range can be explicitly stated. +* +* __assume_bound(expr); : Assume that the expression is bound to some known +* range. This can be used to suppress integer overflow warnings on integral +* expressions that are known to be bound due to reasons not explicit in the +* code. Use as a statement in the body of a function. +* +* __analysis_assume_nulltermianted(expr); : Assume that the expression is +* a null terminated buffer. Use this to suppress tool noise specific to +* nulltermination warnings, and capture deeper invariants tools can not +* discover. +* +* __allocator void f(): Function allocates memory using an integral size +* argument +* +* void myfree(__deallocate(Mem) void *p) : Memory is freed, no longer usable +* upon return, and p may not be null. +* +* void myfree(__deallocate_opt(Mem) void *p) : Memory is freed, no longer +* usable upon return, and p may be null. +* +* void free(__post_invalid void* x): Mark memory as untouchable when +* function returns. +* +* ---------------------------------------------------------------------------- +* Advanced Annotation Examples +* +* __success(return == TRUE) LWSTDAPI_(BOOL) +* PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath); +* // pszBuf is only guaranteed to be null-terminated when TRUE is returned. +* +* // Initialized LPWSTRs are null-terminated strings. +* typedef __nullterminated WCHAR* LPWSTR; +* +* __out_ecount(cch) __typefix(LPWSTR) void *psz; +* // psz is a buffer parameter which will be a null-terminated WCHAR string +* // at exit, and which initially contains cch WCHARs. +* +************************************************************************/ +#define _At_(expr, annotes) __allowed(on_parameter_or_return) +#define _When_(expr, annotes) __allowed(on_parameter_or_return) +#define __success(expr) _SAL_VERSION_CHECK(__success) +#define __out_awcount(expr,size) __allowed(on_parameter) +#define __in_awcount(expr,size) __allowed(on_parameter) +#define __nullterminated _SAL_VERSION_CHECK(__nullterminated) +#define __nullnullterminated _SAL_VERSION_CHECK(__nullnullterminated) +#define __reserved _SAL_VERSION_CHECK(__reserved) +#define __checkReturn _SAL_VERSION_CHECK(__checkReturn) +#define __typefix(ctype) __allowed(on_parameter_or_return) +#define __override __allowed(on_function) +#define __callback __allowed(on_function) +#define __format_string __allowed(on_parameter_or_return) +#define __blocksOn(resource) __allowed(on_function) +#define __fallthrough __allowed(as_statement) +#define __range(lb,ub) __allowed(on_return) +#define __in_range(lb,ub) _SAL_VERSION_CHECK(__in_range) +#define __out_range(lb,ub) _SAL_VERSION_CHECK(__out_range) +#define __deref_in_range(lb,ub) __allowed(on_parameter) +#define __deref_out_range(lb,ub) _SAL_VERSION_CHECK(__deref_out_range) +#define __deref_inout_range(lb,ub) __allowed(on_parameter) +#define __field_range(lb,ub) _SAL_VERSION_CHECK(__field_range) +#define __range_max(a,b) __allowed(on_return) +#define __range_min(a,b) __allowed(on_return) +#define __bound __allowed(on_return) +#define __in_bound __allowed(on_parameter) +#define __out_bound __allowed(on_parameter) +#define __deref_out_bound __allowed(on_parameter) +#define __assume_bound(i) __allowed(as_statement_with_arg(i)) +#define __analysis_assume_nullterminated(x) \ + __allowed(as_statement_with_arg(x)) +#define __allocator __allowed(on_function) +#define __deallocate(kind) __allowed(on_parameter) +#define __deallocate_opt(kind) __allowed(on_parameter) +#define __post_invalid __allowed(on_parameter_or_return) +#define __post_nullnullterminated \ + __allowed(on_parameter_or_return) +/*************************************************************************** +* Expert Macros +***************************************************************************/ +#define __null __allowed(on_typedecl) +#define __notnull __allowed(on_typedecl) +#define __maybenull __allowed(on_typedecl) +#define __exceptthat __allowed(on_typedecl) +/*************************************************************************** +* Macros to classify fields of structures. +* Structure Annotations +* +* The buffer annotations are a convenient way of describing +* relationships between buffers and their size on a function by +* function basis. Very often struct or class data members have similar +* invariants, which can be expressed directly on the type. +* +* Similar to our buffer annotations we can summarize all the various +* structure annotations by one choosing an element from each column of +* this table to build a composite annotation. +* +* +--------------------------------------------------+ +* | Selector | Units | Size/Init | Optional | +* |----------+---------+------------------+----------| +* | __field | _ecount | (size) | empty | +* |----------+---------+------------------+----------| +* | __struct | _bcount | _full(size) | _opt | +* |----------+---------+------------------+----------| +* | | _xcount | _part(size,init) | | +* +--------------------------------------------------+ +* +* Note that empty represents the empty string. Sometime arguments need +* to be "floated" to the left to give us a valid annotation name. For +* example the naive combination __field_ecount(size)_opt is actually +* written as __field_ecount_opt(size). Not all possible combinations +* are currently supported or sensible. See specstrings_strict.h for +* the currently supported set. Those that are supported are documented +* below. +* +*Summary of Elements +* +* Selector +* +* __field +* The annotation should only be placed in front +* of data members of structures and classes. The +* data members are pointers to a block of data. +* The annotations describe properties about the +* size of the block of data. This can be used for +* +* __struct +* The annotation should only be placed at the +* beginning of the definition of a structure or +* class. These annotations are used when a struct +* or class is used as a "header" that is +* allocated inline with a block of data and there +* is no apparent field that represents the tail +* end of the structure. +* +* Units +* +* _ecount +* All size and initialization values are in terms +* of elements of the appropriate type +* +* _bcount +* All size and initialization values are in terms +* of raw byte sizes. +* +* _xcount +* The size or initialization values cannot be +* properly expressed as a simple byte or element +* count, and instead a place holder is used to +* document the relationship. +* +* Size/Init +* All the size/init expressions can contain references to +* other fields in the struct or class. +* +* (size) +* The size of the buffer is determined by the +* expression size. Unless, the type of the buffer +* provides more information nothing is know about +* how much of this data is initialized. For +* example, if the data member happens to be a +* string type such as LPSTR. It is assumed that +* the data is initialized to the first '\0'. +* +* _full(size) +* The size of the buffer is determined by the +* expression size and all the data in the buffer +* is guaranteed to be initialized. +* +* _part(size,init) +* The size of the buffer is determined by the +* expression size and all the data in the buffer +* is guaranteed to be initialized up to init +* elements or bytes. +* +* Optional +* +* empty +* The pointer to the block of memory is never +* NULL +* +* _opt +* The pointer to the block of memory is may be +* NULL +* +* +* // Basic Usage of Struct Annotations +* #include +* #include +* struct buf_s { +* int sz; +* __field_bcount_full(sz) +* char *buf; +* }; +* void InitBuf(__out struct *buf_s b,int sz) { +* b->buf = calloc(sz,sizeof(char)); +* b->sz = sz; +* } +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(b->buf,b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(b->buf,b->sz,sizeof(char),fp); +* } +* +* +* +* // Inline Allocated Buffer +* struct buf_s { +* int sz; +* __field_bcount(sz) +* char buf[1]; +* }; +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(&(b->buf),b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(&(b->buf),b->sz,sizeof(char),fp); +* } +* +* +* +* // Embedded Header Structure +* __struct_bcount(sz) +* struct buf_s { +* int sz; +* }; +* void WriteBuf(__in FILE *fp,__in struct *buf_s b) { +* fwrite(&b,b->sz,sizeof(char),fp); +* } +* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) { +* fread(&b,b->sz,sizeof(char),fp); +* } +* +* +****************************************************************************/ +#define __field_ecount(size) _SAL_VERSION_CHECK(__field_ecount) +#define __field_bcount(size) _SAL_VERSION_CHECK(__field_bcount) +#define __field_xcount(size) __allowed(on_field) +#define __field_ecount_opt(size) __allowed(on_field) +#define __field_bcount_opt(size) __allowed(on_field) +#define __field_xcount_opt(size) __allowed(on_field) +#define __field_ecount_part(size,init) __allowed(on_field) +#define __field_bcount_part(size,init) __allowed(on_field) +#define __field_xcount_part(size,init) __allowed(on_field) +#define __field_ecount_part_opt(size,init) __allowed(on_field) +#define __field_bcount_part_opt(size,init) __allowed(on_field) +#define __field_xcount_part_opt(size,init) __allowed(on_field) +#define __field_ecount_full(size) __allowed(on_field) +#define __field_bcount_full(size) __allowed(on_field) +#define __field_xcount_full(size) __allowed(on_field) +#define __field_ecount_full_opt(size) __allowed(on_field) +#define __field_bcount_full_opt(size) __allowed(on_field) +#define __field_xcount_full_opt(size) __allowed(on_field) +#define __field_nullterminated __allowed(on_field) +#define __struct_bcount(size) __allowed(on_struct) +#define __struct_xcount(size) __allowed(on_struct) + +/*************************************************************************** +* Macros to classify the entrypoints and indicate their category. +* +* Pre-defined control point categories include: RPC, KERNEL, GDI. +* +* Pre-defined control point macros include: +* __rpc_entry, __kernel_entry, __gdi_entry. +***************************************************************************/ +#define __control_entrypoint(category) __allowed(on_function) +#define __rpc_entry __allowed(on_function) +#define __kernel_entry __allowed(on_function) +#define __gdi_entry __allowed(on_function) + +/*************************************************************************** +* Macros to track untrusted data and their validation. The list of untrusted +* sources include: +* +* FILE - File reading stream or API +* NETWORK - Socket readers +* INTERNET - WinInet and WinHttp readers +* USER_REGISTRY - HKCU portions of the registry +* USER_MODE - Parameters to kernel entry points +* RPC - Parameters to RPC entry points +* DRIVER - Device driver +***************************************************************************/ +#define __in_data_source(src_sym) __allowed(on_parameter) +#define __out_data_source(src_sym) __allowed(on_parameter) +#define __field_data_source(src_sym) __allowed(on_field) +#define __this_out_data_source(src_syn) __allowed(on_function) + +/************************************************************************** +* Macros to tag file parsing code. Predefined formats include: +* PNG - Portable Network Graphics +* JPEG - Joint Photographic Experts Group +* BMP - Bitmap +* RC_BMP - Resource bitmap +* WMF - Windows Metafile +* EMF - Windows Enhanced Metafile +* GIF - Graphics Interchange Format +* MIME_TYPE - MIME type from header tokens +* MAIL_MONIKER - MAIL information refered by URL moniker +* HTML - HyperText Markup Language +* WMPHOTO - Windows media photo +* OE_VCARD - Outlook Express virtual card +* OE_CONTACT - Outlook Express contact +* MIDI - Musical Instrument Digital Interface +* LDIF - LDAP Data Interchange Format +* AVI - Audio Visual Interchange +* ACM - Audio Compression Manager +**************************************************************************/ +#define __out_validated(filetype_sym) __allowed(on_parameter) +#define __this_out_validated(filetype_sym) __allowed(on_function) +#define __file_parser(filetype_sym) __allowed(on_function) +#define __file_parser_class(filetype_sym) __allowed(on_struct) +#define __file_parser_library(filetype_sym) __allowed(as_global_decl) + +/*************************************************************************** +* Macros to track the code content in the file. The type of code +* contents currently tracked: +* +* NDIS_DRIVER - NDIS Device driver +***************************************************************************/ +#define __source_code_content(codetype_sym) __allowed(as_global_decl) + +/*************************************************************************** +* Macros to track the code content in the class. The type of code +* contents currently tracked: +* +* DCOM - Class implementing DCOM +***************************************************************************/ +#define __class_code_content(codetype_sym) __allowed(on_struct) + +/************************************************************************* +* Macros to tag encoded function pointers +**************************************************************************/ +#define __encoded_pointer +#define __encoded_array +#define __field_encoded_pointer __allowed(on_field) +#define __field_encoded_array __allowed(on_field) + +#define __transfer(formal) __allowed(on_parameter_or_return) +#define __assume_validated(exp) __allowed(as_statement_with_arg(exp)) + +/************************************************************************* +* __analysis_assume(expr) : Expert macro use only when directed. Use this to +* tell static analysis tools like PREfix and PREfast about a non-coded +* assumption that you wish the tools to assume. The assumption will be +* understood by those tools. By default there is no dynamic checking or +* static checking of the assumption in any build. +* +* To obtain dynamic checking wrap this macro in your local version of a debug +* assert. +* Please do not put function calls in the expression because this is not +* supported by all tools: +* __analysis_assume(GetObject () != NULL); // DO NOT DO THIS +* +*************************************************************************/ +#define __analysis_assume(expr) __allowed(as_statement_with_arg(expr)) +#define __analysis_assert(expr) __allowed(as_statement_with_arg(expr)) + +/************************************************************************* +* __analysis_hint(hint_sym) : Expert macro use only when +* directed. Use this to influence certain analysis heuristics +* used by the tools. These hints do not describe the semantics +* of functions but simply direct the tools to act in a certain +* way. +* +* Current hints that are supported are: +* +* INLINE - inline this function during analysis overrides any +* default heuristics +* NOINLINE - do not inline this function during analysis overrides +* and default heuristics +*************************************************************************/ +#define __analysis_hint(hint) __allowed(on_function) + +/************************************************************************* +* Macros to encode abstract properties of values. Used by SALadt.h +*************************************************************************/ +#define __type_has_adt_prop(adt,prop) __allowed(on_typdecl) +#define __out_has_adt_prop(adt,prop) __allowed(on_parameter) +#define __out_not_has_adt_prop(adt,prop) __allowed(on_parameter) +#define __out_transfer_adt_prop(arg) __allowed(on_parameter) +#define __out_has_type_adt_props(typ) __allowed(on_parameter) + +/************************************************************************* +* Macros used by Prefast for Drivers +* +* __possibly_notnullterminated : +* +* Used for return values of parameters or functions that do not +* guarantee nulltermination in all cases. +* +*************************************************************************/ +#define __possibly_notnullterminated __allowed(on_parameter_or_return) + +/************************************************************************* +* Advanced macros +* +* __volatile +* The __volatile annotation identifies a global variable or +* structure field that: +* 1) is not declared volatile; +* 2) is accessed concurrently by multiple threads. +* +* The __deref_volatile annotation identifies a global variable +* or structure field that stores a pointer to some data that: +* 1) is not declared volatile; +* 2) is accessed concurrently by multiple threads. +* +* Prefast uses these annotations to find patterns of code that +* may result in unexpected re-fetching of the global variable +* into a local variable. +* +* We also provide two complimentary annotations __nonvolatile +* and __deref_nonvolatile that could be used to suppress Prefast +* +* re-fetching warnings on variables that are known either: +* 1) not to be in danger of being re-fetched or, +* 2) not to lead to incorrect results if they are re-fetched +* +*************************************************************************/ +#define __volatile __allowed(on_global_or_field) +#define __deref_volatile __allowed(on_global_or_field) +#define __nonvolatile __allowed(on_global_or_field) +#define __deref_nonvolatile __allowed(on_global_or_field) + +/************************************************************************* +* Macros deprecated with strict level greater then 1. +**************************************************************************/ +#if (__SPECSTRINGS_STRICT_LEVEL > 1) +/* Must come before macro defintions */ +#pragma deprecated(__in_nz) +#pragma deprecated(__in_ecount_nz) +#pragma deprecated(__in_bcount_nz) +#pragma deprecated(__out_nz) +#pragma deprecated(__out_nz_opt) +#pragma deprecated(__out_ecount_nz) +#pragma deprecated(__out_bcount_nz) +#pragma deprecated(__inout_nz) +#pragma deprecated(__inout_ecount_nz) +#pragma deprecated(__inout_bcount_nz) +#pragma deprecated(__in_nz_opt) +#pragma deprecated(__in_ecount_nz_opt) +#pragma deprecated(__in_bcount_nz_opt) +#pragma deprecated(__out_ecount_nz_opt) +#pragma deprecated(__out_bcount_nz_opt) +#pragma deprecated(__inout_nz_opt) +#pragma deprecated(__inout_ecount_nz_opt) +#pragma deprecated(__inout_bcount_nz_opt) +#pragma deprecated(__deref_out_nz) +#pragma deprecated(__deref_out_ecount_nz) +#pragma deprecated(__deref_out_bcount_nz) +#pragma deprecated(__deref_inout_nz) +#pragma deprecated(__deref_inout_ecount_nz) +#pragma deprecated(__deref_inout_bcount_nz) +#pragma deprecated(__deref_out_nz_opt) +#pragma deprecated(__deref_out_ecount_nz_opt) +#pragma deprecated(__deref_out_bcount_nz_opt) +#pragma deprecated(__deref_inout_nz_opt) +#pragma deprecated(__deref_inout_ecount_nz_opt) +#pragma deprecated(__deref_inout_bcount_nz_opt) +#pragma deprecated(__deref_opt_inout_nz) +#pragma deprecated(__deref_opt_inout_ecount_nz) +#pragma deprecated(__deref_opt_inout_bcount_nz) +#pragma deprecated(__deref_opt_out_nz_opt) +#pragma deprecated(__deref_opt_out_ecount_nz_opt) +#pragma deprecated(__deref_opt_out_bcount_nz_opt) +#pragma deprecated(__deref_opt_inout_nz_opt) +#pragma deprecated(__deref_opt_inout_ecount_nz_opt) +#pragma deprecated(__deref_opt_inout_bcount_nz_opt) +#pragma deprecated(__deref) +#pragma deprecated(__pre) +#pragma deprecated(__post) +#pragma deprecated(__readableTo) +#pragma deprecated(__writableTo) +#pragma deprecated(__maybevalid) +#pragma deprecated(__data_entrypoint) +#pragma deprecated(__inexpressible_readableTo) +#pragma deprecated(__readonly) +#pragma deprecated(__byte_writableTo) +#pragma deprecated(__byte_readableTo) +#pragma deprecated(__elem_readableTo) +#pragma deprecated(__elem_writableTo) +#pragma deprecated(__valid) +#pragma deprecated(__notvalid) +#pragma deprecated(__refparam) +#pragma deprecated(__precond) +#endif +/* Define soon to be deprecated macros to nops. */ +#define __in_nz +#define __in_ecount_nz(size) +#define __in_bcount_nz(size) +#define __out_nz +#define __out_nz_opt +#define __out_ecount_nz(size) +#define __out_bcount_nz(size) +#define __inout_nz +#define __inout_ecount_nz(size) +#define __inout_bcount_nz(size) +#define __in_nz_opt +#define __in_ecount_nz_opt(size) +#define __in_bcount_nz_opt(size) +#define __out_ecount_nz_opt(size) +#define __out_bcount_nz_opt(size) +#define __inout_nz_opt +#define __inout_ecount_nz_opt(size) +#define __inout_bcount_nz_opt(size) +#define __deref_out_nz +#define __deref_out_ecount_nz(size) +#define __deref_out_bcount_nz(size) +#define __deref_inout_nz +#define __deref_inout_ecount_nz(size) +#define __deref_inout_bcount_nz(size) +#define __deref_out_nz_opt +#define __deref_out_ecount_nz_opt(size) +#define __deref_out_bcount_nz_opt(size) +#define __deref_inout_nz_opt +#define __deref_inout_ecount_nz_opt(size) +#define __deref_inout_bcount_nz_opt(size) +#define __deref_opt_inout_nz +#define __deref_opt_inout_ecount_nz(size) +#define __deref_opt_inout_bcount_nz(size) +#define __deref_opt_out_nz_opt +#define __deref_opt_out_ecount_nz_opt(size) +#define __deref_opt_out_bcount_nz_opt(size) +#define __deref_opt_inout_nz_opt +#define __deref_opt_inout_ecount_nz_opt(size) +#define __deref_opt_inout_bcount_nz_opt(size) +#define __deref +#define __pre +#define __post +#define __readableTo(count) +#define __writableTo(count) +#define __maybevalid +#define __inexpressible_readableTo(string) +#define __data_entrypoint(category) +#define __readonly +#define __byte_writableTo(count) +#define __byte_readableTo(count) +#define __elem_readableTo(count) +#define __elem_writableTo(count) +#define __valid +#define __notvalid +#define __refparam +#define __precond(condition) + +/************************************************************************* +* Definitions to force a compile error when macros are used improperly. +* Relies on VS 2005 source annotations. +*************************************************************************/ +#if !defined(_MSC_EXTENSIONS) && !defined(_PREFAST_) && !defined(OACR) +#define __allowed(p) /* nothing */ +#else +#define __allowed(p) __$allowed_##p +#define __$allowed_as_global_decl /* empty */ +#define __$allowed_as_statement_with_arg(x) \ + __pragma(warning(push)) __pragma(warning(disable : 4548)) \ + do {__noop(x);} while((0,0) __pragma(warning(pop)) ) +#define __$allowed_as_statement __$allowed_as_statement_with_arg(1) + +/************************************************************************** +* This should go away. It's only for __success which we should split into. +* __success and __typdecl_sucess +***************************************************************************/ +#define __$allowed_on_function_or_typedecl /* empty */ +#if (__SPECSTRINGS_STRICT_LEVEL == 1) || (__SPECSTRINGS_STRICT_LEVEL == 2) +#define __$allowed_on_typedecl /* empty */ +#define __$allowed_on_return /* empty */ +#define __$allowed_on_parameter /* empty */ +#define __$allowed_on_function /* empty */ +#define __$allowed_on_struct /* empty */ +#define __$allowed_on_field /* empty */ +#define __$allowed_on_parameter_or_return /* empty */ +#define __$allowed_on_global_or_field /* empty */ +#elif __SPECSTRINGS_STRICT_LEVEL == 3 +#define __$allowed_on_typedecl /* empty */ +/* Define dummy source attributes. Still needs more testing */ +#define __$allowed_on_return [returnvalue: OnReturnOnly] +#define __$allowed_on_parameter [OnParameterOnly] +#define __$allowed_on_function [method: OnFunctionOnly] +#define __$allowed_on_struct [OnStructOnly] +#define __$allowed_on_field [OnFieldOnly] +#define __$allowed_on_parameter_or_return [OnParameterOrReturnOnly] +#define __$allowed_on_global_or_field /* empty */ +#pragma push_macro( "DECL_SA" ) +#pragma push_macro( "SA" ) +#ifdef __cplusplus +#define SA(x) x +#define DECL_SA(name,loc) \ + [repeatable] \ + [source_annotation_attribute( loc )] \ + struct name##Attribute { name##Attribute(); const char* ignored; }; +#else +#define SA(x) SA_##x +#define DECL_SA(name,loc) \ + [source_annotation_attribute( loc )] \ + struct name { const char* ignored; };\ + typedef struct name name; +#endif /* #endif __cplusplus */ +DECL_SA(OnParameterOnly,SA(Parameter)); +DECL_SA(OnReturnOnly,SA(ReturnValue)); +DECL_SA(OnFunctionOnly,SA(Method)); +DECL_SA(OnStructOnly,SA(Struct)); +DECL_SA(OnFieldOnly,SA(Field)); +DECL_SA(OnParameterOrReturnOnly,SA(Parameter) | SA(ReturnValue)); +#pragma pop_macro( "SA" ) +#pragma pop_macro( "DECL_SA" ) +#endif +#endif +#endif \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper/specstrings_undef.h b/src/nativeInterop/cinterop/versionhelper/specstrings_undef.h new file mode 100644 index 0000000..86d8625 --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/specstrings_undef.h @@ -0,0 +1,455 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +#undef _At_ +#undef _Deref_out_ +#undef _Deref_out_opt_ +#undef _Deref_opt_out_ +#undef _Deref_opt_out_opt_ +#undef _Deref_post_cap_ +#undef _Deref_post_opt_cap_ +#undef _Deref_post_bytecap_ +#undef _Deref_post_opt_bytecap_ +#undef _Deref_post_count_ +#undef _Deref_post_opt_count_ +#undef _Deref_post_bytecount_ +#undef _Deref_post_opt_bytecount_ +#undef _In_count_ +#undef _In_opt_count_ +#undef _In_bytecount_ +#undef _In_opt_bytecount_ +#undef _Out_cap_ +#undef _Out_opt_cap_ +#undef _Out_bytecap_ +#undef _Out_opt_bytecap_ +#undef _Outptr_ +#undef _Outptr_result_maybenull_ +#undef _Outptr_opt_ +#undef _Outptr_opt_result_maybenull_ +#undef _Outptr_result_z_ +#undef _Outptr_opt_result_z_ +#undef _Outptr_result_maybenull_z_ +#undef _Outptr_opt_result_maybenull_z_ +#undef _Outptr_result_nullonfailure_ +#undef _Outptr_opt_result_nullonfailure_ +#undef _COM_Outptr_ +#undef _COM_Outptr_result_maybenull_ +#undef _COM_Outptr_opt_ +#undef _COM_Outptr_opt_result_maybenull_ +#undef _Outptr_result_buffer_ +#undef _Outptr_opt_result_buffer_ +#undef _Outptr_result_buffer_to_ +#undef _Outptr_opt_result_buffer_to_ +#undef _Outptr_result_buffer_all_ +#undef _Outptr_opt_result_buffer_all_ +#undef _Outptr_result_buffer_maybenull_ +#undef _Outptr_opt_result_buffer_maybenull_ +#undef _Outptr_result_buffer_to_maybenull_ +#undef _Outptr_opt_result_buffer_to_maybenull_ +#undef _Outptr_result_buffer_all_maybenull_ +#undef _Outptr_opt_result_buffer_all_maybenull_ +#undef _Outptr_result_bytebuffer_ +#undef _Outptr_opt_result_bytebuffer_ +#undef _Outptr_result_bytebuffer_to_ +#undef _Outptr_opt_result_bytebuffer_to_ +#undef _Outptr_result_bytebuffer_all_ +#undef _Outptr_opt_result_bytebuffer_all_ +#undef _Outptr_result_bytebuffer_maybenull_ +#undef _Outptr_opt_result_bytebuffer_maybenull_ +#undef _Outptr_result_bytebuffer_to_maybenull_ +#undef _Outptr_opt_result_bytebuffer_to_maybenull_ +#undef _Outptr_result_bytebuffer_all_maybenull_ +#undef _Outptr_opt_result_bytebuffer_all_maybenull_ +#undef _When_ +#undef __allocator +#undef __analysis_assert +#undef __analysis_assume +#undef __analysis_assume_nullterminated +#undef __analysis_hint +#undef __assume_bound +#undef __assume_validated +#undef __bcount +#undef __bcount_opt +#undef __blocksOn +#undef __bound +#undef __byte_readableTo +#undef __byte_writableTo +#undef __callback +#undef __checkReturn +#undef __class_code_content +#undef __control_entrypoint +#undef __data_entrypoint +#undef __deallocate +#undef __deallocate_opt +#undef __deref +#undef __deref_bcount +#undef __deref_bcount_opt +#undef __deref_ecount +#undef __deref_ecount_opt +#undef __deref_in +#undef __deref_in_bcount +#undef __deref_in_bcount_opt +#undef __deref_in_ecount +#undef __deref_in_ecount_opt +#undef __deref_in_ecount_iterator +#undef __deref_in_opt +#undef __deref_in_opt_out +#undef __deref_in_range +#undef __deref_in_xcount +#undef __deref_in_xcount_opt +#undef __deref_inout +#undef __deref_inout_bcount +#undef __deref_inout_bcount_full +#undef __deref_inout_bcount_full_opt +#undef __deref_inout_bcount_nz +#undef __deref_inout_bcount_nz_opt +#undef __deref_inout_bcount_opt +#undef __deref_inout_bcount_part +#undef __deref_inout_bcount_part_opt +#undef __deref_inout_bcount_z +#undef __deref_inout_bcount_z_opt +#undef __deref_inout_ecount +#undef __deref_inout_ecount_full +#undef __deref_inout_ecount_full_opt +#undef __deref_inout_ecount_nz +#undef __deref_inout_ecount_nz_opt +#undef __deref_inout_ecount_opt +#undef __deref_inout_ecount_part +#undef __deref_inout_ecount_part_opt +#undef __deref_inout_ecount_z +#undef __deref_inout_ecount_z_opt +#undef __deref_inout_ecount_iterator +#undef __deref_inout_nz +#undef __deref_inout_nz_opt +#undef __deref_inout_opt +#undef __deref_inout_range +#undef __deref_inout_xcount +#undef __deref_inout_xcount_full +#undef __deref_inout_xcount_full_opt +#undef __deref_inout_xcount_opt +#undef __deref_inout_xcount_part +#undef __deref_inout_xcount_part_opt +#undef __deref_inout_z +#undef __deref_inout_z_opt +#undef __deref_nonvolatile +#undef __deref_opt_bcount +#undef __deref_opt_bcount_opt +#undef __deref_opt_ecount +#undef __deref_opt_ecount_opt +#undef __deref_opt_in +#undef __deref_opt_in_bcount +#undef __deref_opt_in_bcount_opt +#undef __deref_opt_in_ecount +#undef __deref_opt_in_ecount_opt +#undef __deref_opt_in_opt +#undef __deref_opt_in_xcount +#undef __deref_opt_in_xcount_opt +#undef __deref_opt_inout +#undef __deref_opt_inout_bcount +#undef __deref_opt_inout_bcount_full +#undef __deref_opt_inout_bcount_full_opt +#undef __deref_opt_inout_bcount_nz +#undef __deref_opt_inout_bcount_nz_opt +#undef __deref_opt_inout_bcount_opt +#undef __deref_opt_inout_bcount_part +#undef __deref_opt_inout_bcount_part_opt +#undef __deref_opt_inout_bcount_z +#undef __deref_opt_inout_bcount_z_opt +#undef __deref_opt_inout_ecount +#undef __deref_opt_inout_ecount_full +#undef __deref_opt_inout_ecount_full_opt +#undef __deref_opt_inout_ecount_nz +#undef __deref_opt_inout_ecount_nz_opt +#undef __deref_opt_inout_ecount_opt +#undef __deref_opt_inout_ecount_part +#undef __deref_opt_inout_ecount_part_opt +#undef __deref_opt_inout_ecount_z +#undef __deref_opt_inout_ecount_z_opt +#undef __deref_opt_inout_nz +#undef __deref_opt_inout_nz_opt +#undef __deref_opt_inout_opt +#undef __deref_opt_inout_xcount +#undef __deref_opt_inout_xcount_full +#undef __deref_opt_inout_xcount_full_opt +#undef __deref_opt_inout_xcount_opt +#undef __deref_opt_inout_xcount_part +#undef __deref_opt_inout_xcount_part_opt +#undef __deref_opt_inout_z +#undef __deref_opt_inout_z_opt +#undef __deref_opt_out +#undef __deref_opt_out_bcount +#undef __deref_opt_out_bcount_full +#undef __deref_opt_out_bcount_full_opt +#undef __deref_opt_out_bcount_nz_opt +#undef __deref_opt_out_bcount_opt +#undef __deref_opt_out_bcount_part +#undef __deref_opt_out_bcount_part_opt +#undef __deref_opt_out_bcount_z_opt +#undef __deref_opt_out_ecount +#undef __deref_opt_out_ecount_full +#undef __deref_opt_out_ecount_full_opt +#undef __deref_opt_out_ecount_nz_opt +#undef __deref_opt_out_ecount_opt +#undef __deref_opt_out_ecount_part +#undef __deref_opt_out_ecount_part_opt +#undef __deref_opt_out_ecount_z_opt +#undef __deref_opt_out_nz_opt +#undef __deref_opt_out_opt +#undef __deref_opt_out_xcount +#undef __deref_opt_out_xcount_full +#undef __deref_opt_out_xcount_full_opt +#undef __deref_opt_out_xcount_opt +#undef __deref_opt_out_xcount_part +#undef __deref_opt_out_xcount_part_opt +#undef __deref_opt_out_z_opt +#undef __deref_opt_xcount +#undef __deref_opt_xcount_opt +#undef __deref_out +#undef __deref_out_bcount +#undef __deref_out_bcount_full +#undef __deref_out_bcount_full_opt +#undef __deref_out_bcount_nz +#undef __deref_out_bcount_nz_opt +#undef __deref_out_bcount_opt +#undef __deref_out_bcount_part +#undef __deref_out_bcount_part_opt +#undef __deref_out_bcount_z +#undef __deref_out_bcount_z_opt +#undef __deref_out_bound +#undef __deref_out_ecount +#undef __deref_out_ecount_full +#undef __deref_out_ecount_full_opt +#undef __deref_out_ecount_iterator +#undef __deref_out_ecount_nz +#undef __deref_out_ecount_nz_opt +#undef __deref_out_ecount_opt +#undef __deref_out_ecount_part +#undef __deref_out_ecount_part_opt +#undef __deref_out_ecount_z +#undef __deref_out_ecount_z_opt +#undef __deref_out_nz +#undef __deref_out_nz_opt +#undef __deref_out_opt +#undef __deref_out_range +#undef __deref_out_range +#undef __deref_out_xcount +#undef __deref_out_xcount +#undef __deref_out_xcount_full +#undef __deref_out_xcount_full_opt +#undef __deref_out_xcount_opt +#undef __deref_out_xcount_part +#undef __deref_out_xcount_part_opt +#undef __deref_out_z +#undef __deref_out_z_opt +#undef __deref_realloc_bcount +#undef __deref_volatile +#undef __deref_xcount +#undef __deref_xcount_opt +#undef __ecount +#undef __ecount_opt +#undef __elem_readableTo +#undef __elem_writableTo +#undef __encoded_array +#undef __encoded_pointer +#undef __exceptthat +#undef __fallthrough +#undef __field_bcount +#undef __field_bcount_full +#undef __field_bcount_full_opt +#undef __field_bcount_opt +#undef __field_bcount_part +#undef __field_bcount_part_opt +#undef __field_data_source +#undef __field_ecount +#undef __field_ecount_full +#undef __field_ecount_full_opt +#undef __field_ecount_opt +#undef __field_ecount_part +#undef __field_ecount_part_opt +#undef __field_encoded_array +#undef __field_encoded_pointer +#undef __field_nullterminated +#undef __field_range +#undef __field_xcount +#undef __field_xcount_full +#undef __field_xcount_full_opt +#undef __field_xcount_opt +#undef __field_xcount_part +#undef __field_xcount_part_opt +#undef __file_parser +#undef __file_parser_class +#undef __file_parser_library +#undef __format_string +#undef __format_string +#undef __gdi_entry +#undef __in +#undef __in_awcount +#undef __in_bcount +#undef __in_bcount_nz +#undef __in_bcount_nz_opt +#undef __in_bcount_opt +#undef __in_bcount_z +#undef __in_bcount_z_opt +#undef __in_bound +#undef __in_data_source +#undef __in_ecount +#undef __in_ecount_nz +#undef __in_ecount_nz_opt +#undef __in_ecount_opt +#undef __in_ecount_z +#undef __in_ecount_z_opt +#undef __in_nz +#undef __in_nz_opt +#undef __in_opt +#undef __in_range +#undef __in_xcount +#undef __in_xcount_opt +#undef __in_z +#undef __in_z_opt +#undef __inexpressible_readableTo +#undef __inexpressible_writableTo +#undef __inner_adt_add_prop +#undef __inner_adt_prop +#undef __inner_adt_remove_prop +#undef __inner_adt_transfer_prop +#undef __inner_adt_type_props +#undef __inner_analysis_assume_nulltermianted_dec +#undef __inner_analysis_assume_nullterminated +#undef __inner_assume_bound +#undef __inner_assume_bound_dec +#undef __inner_assume_validated +#undef __inner_assume_validated_dec +#undef __inner_blocksOn +#undef __inner_bound +#undef __inner_callback +#undef __inner_checkReturn +#undef __inner_compname_props +#undef __inner_control_entrypoint +#undef __inner_data_entrypoint +#undef __inner_data_source +#undef __inner_encoded +#undef __inner_fallthrough +#undef __inner_fallthrough_dec +#undef __inner_nonvolatile +#undef __inner_out_validated +#undef __inner_override +#undef __inner_possibly_notnullterminated +#undef __inner_range +#undef __inner_success +#undef __inner_transfer +#undef __inner_typefix +#undef __inner_volatile +#undef __inout +#undef __inout_bcount +#undef __inout_bcount_full +#undef __inout_bcount_full_opt +#undef __inout_bcount_nz +#undef __inout_bcount_nz_opt +#undef __inout_bcount_opt +#undef __inout_bcount_part +#undef __inout_bcount_part_opt +#undef __inout_bcount_z +#undef __inout_bcount_z_opt +#undef __inout_ecount +#undef __inout_ecount_full +#undef __inout_ecount_full_opt +#undef __inout_ecount_nz +#undef __inout_ecount_nz_opt +#undef __inout_ecount_opt +#undef __inout_ecount_part +#undef __inout_ecount_part_opt +#undef __inout_ecount_z +#undef __inout_ecount_z_opt +#undef __inout_ecount_z_opt +#undef __inout_nz +#undef __inout_nz_opt +#undef __inout_opt +#undef __inout_xcount +#undef __inout_xcount_full +#undef __inout_xcount_full_opt +#undef __inout_xcount_opt +#undef __inout_xcount_part +#undef __inout_xcount_part_opt +#undef __inout_z +#undef __inout_z_opt +#undef __kernel_entry +#undef __maybenull +#undef __maybereadonly +#undef __maybevalid +#undef __range_max +#undef __range_min +#undef __nonvolatile +#undef __notnull +#undef __notreadonly +#undef __notvalid +#undef __null +#undef __nullnullterminated +#undef __nullterminated +#undef __out +#undef __out_awcount +#undef __out_bcount +#undef __out_bcount_full +#undef __out_bcount_full_opt +#undef __out_bcount_nz +#undef __out_bcount_nz_opt +#undef __out_bcount_opt +#undef __out_bcount_part +#undef __out_bcount_part_opt +#undef __out_bcount_z +#undef __out_bcount_z_opt +#undef __out_bound +#undef __out_data_source +#undef __out_ecount +#undef __out_ecount_full +#undef __out_ecount_full_opt +#undef __out_ecount_nz +#undef __out_ecount_nz_opt +#undef __out_ecount_opt +#undef __out_ecount_part +#undef __out_ecount_part_opt +#undef __out_ecount_z +#undef __out_ecount_z_opt +#undef __out_has_adt_prop +#undef __out_has_type_adt_props +#undef __out_not_has_adt_prop +#undef __out_nz +#undef __out_nz_opt +#undef __out_opt +#undef __out_range +#undef __out_transfer_adt_prop +#undef __out_validated +#undef __out_xcount +#undef __out_xcount_full +#undef __out_xcount_full_opt +#undef __out_xcount_opt +#undef __out_xcount_part +#undef __out_xcount_part_opt +#undef __out_z +#undef __override +#undef __possibly_notnullterminated +#undef __post +#undef __post_invalid +#undef __postcond +#undef __post_nullnullterminated +#undef __pre +#undef __precond +#undef __range +#undef __readableTo +#undef __readonly +#undef __refparam +#undef __reserved +#undef __rpc_entry +#undef __source_code_content +#undef __struct_bcount +#undef __struct_xcount +#undef __success +#undef __this_out_data_source +#undef __this_out_validated +#undef __transfer +#undef __type_has_adt_prop +#undef __typefix +#undef __valid +#undef __volatile +#undef __writableTo +#undef __xcount +#undef __xcount_opt diff --git a/src/nativeInterop/cinterop/versionhelper/versionhelper.h b/src/nativeInterop/cinterop/versionhelper/versionhelper.h new file mode 100644 index 0000000..3edfc3a --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/versionhelper.h @@ -0,0 +1,154 @@ + +/****************************************************************** +* * +* VersionHelpers.h -- This module defines helper functions to * +* promote version check with proper * +* comparisons. * +* * +* Copyright (c) Microsoft Corp. All rights reserved. * +* * +******************************************************************/ +#include + +#ifdef _MSC_VER +#pragma once +#endif // _MSC_VER + +#pragma region Application Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + +#include // for _In_, etc. + +#if !defined(__midl) && !defined(SORTPP_PASS) + +#if (NTDDI_VERSION >= NTDDI_WINXP) + +#ifndef _versionhelpers_H_INCLUDED_ +#define _versionhelpers_H_INCLUDED_ + +#ifdef __cplusplus + +#define VERSIONHELPERAPI inline bool + +#else // __cplusplus + +// Added by Trumeet@GitHub +#include + +#define VERSIONHELPERAPI FORCEINLINE BOOL + +#endif // __cplusplus + +VERSIONHELPERAPI +IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 }; + DWORDLONG const dwlConditionMask = VerSetConditionMask( + VerSetConditionMask( + VerSetConditionMask( + 0, VER_MAJORVERSION, VER_GREATER_EQUAL), + VER_MINORVERSION, VER_GREATER_EQUAL), + VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); + + osvi.dwMajorVersion = wMajorVersion; + osvi.dwMinorVersion = wMinorVersion; + osvi.wServicePackMajor = wServicePackMajor; + + return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; +} + +VERSIONHELPERAPI +IsWindowsXPOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1); +} + +VERSIONHELPERAPI +IsWindowsXPSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2); +} + +VERSIONHELPERAPI +IsWindowsXPSP3OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3); +} + +VERSIONHELPERAPI +IsWindowsVistaOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1); +} + +VERSIONHELPERAPI +IsWindowsVistaSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2); +} + +VERSIONHELPERAPI +IsWindows7OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); +} + +VERSIONHELPERAPI +IsWindows7SP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1); +} + +VERSIONHELPERAPI +IsWindows8OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0); +} + +VERSIONHELPERAPI +IsWindows8Point1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0); +} + +VERSIONHELPERAPI +IsWindowsThresholdOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32_WINNT_WINTHRESHOLD), 0); +} + +VERSIONHELPERAPI +IsWindows10OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32_WINNT_WINTHRESHOLD), 0); +} + +VERSIONHELPERAPI +IsWindowsServer() +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0, 0, VER_NT_WORKSTATION }; + DWORDLONG const dwlConditionMask = VerSetConditionMask( 0, VER_PRODUCT_TYPE, VER_EQUAL ); + + return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); +} + +#endif // _VERSIONHELPERS_H_INCLUDED_ + +#endif // NTDDI_VERSION + +#endif // defined(__midl) + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ +#pragma endregion diff --git a/src/nativeInterop/cinterop/versionhelper/winapifamily.h b/src/nativeInterop/cinterop/versionhelper/winapifamily.h new file mode 100644 index 0000000..8d26f0a --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/winapifamily.h @@ -0,0 +1,234 @@ +/* + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + winapifamily.h + +Abstract: + + Master include file for API family partitioning. + +*/ + +#ifndef _INC_WINAPIFAMILY +#define _INC_WINAPIFAMILY + +#if defined(_MSC_VER) && !defined(MOFCOMP_PASS) +#if _MSC_VER >= 1200 +#pragma warning(push) +#pragma warning(disable:4001) /* nonstandard extension 'single line comment' was used */ +#endif +#pragma once +#endif // defined(_MSC_VER) && !defined(MOFCOMP_PASS) + +#include + +/* + * When compiling C and C++ code using SDK header files, the development + * environment can specify a target platform by #define-ing the + * pre-processor symbol WINAPI_FAMILY to one of the following values. + * Each FAMILY value denotes an application family for which a different + * subset of the total set of header-file-defined APIs are available. + * Setting the WINAPI_FAMILY value will effectively hide from the + * editing and compilation environments the existence of APIs that + * are not applicable to the family of applications targeting a + * specific platform. + */ + +/* In Windows 10, WINAPI_PARTITIONs will be used to add additional + * device specific APIs to a particular WINAPI_FAMILY. + * For example, when writing Windows Universal apps, specifying + * WINAPI_FAMILY_APP will hide phone APIs from compilation. + * However, specifying WINAPI_PARTITION_PHONE_APP=1 additionally, will + * unhide any API hidden behind the partition, to the compiler. + + * The following partitions are currently defined: + * WINAPI_PARTITION_DESKTOP // usable for Desktop Win32 apps (but not store apps) + * WINAPI_PARTITION_APP // usable for Windows Universal store apps + * WINAPI_PARTITION_PC_APP // specific to Desktop-only store apps + * WINAPI_PARTITION_PHONE_APP // specific to Phone-only store apps + * WINAPI_PARTITION_SYSTEM // specific to System applications + * WINAPI_PARTITION_SERVER // specific to Server applications +*/ + +/* + * The WINAPI_FAMILY values of 0 and 1 are reserved to ensure that + * an error will occur if WINAPI_FAMILY is set to any + * WINAPI_PARTITION value (which must be 0 or 1, see below). + */ +#define WINAPI_FAMILY_PC_APP 2 /* Windows Store Applications */ +#define WINAPI_FAMILY_PHONE_APP 3 /* Windows Phone Applications */ +#define WINAPI_FAMILY_SYSTEM 4 /* Windows Drivers and Tools */ +#define WINAPI_FAMILY_SERVER 5 /* Windows Server Applications */ +#define WINAPI_FAMILY_DESKTOP_APP 100 /* Windows Desktop Applications */ +/* The value of WINAPI_FAMILY_DESKTOP_APP may change in future SDKs. */ +/* Additional WINAPI_FAMILY values may be defined in future SDKs. */ + +/* + * For compatibility with Windows 8 header files, the following + * synonym for WINAPI_FAMILY_PC_APP is temporarily #define'd. + * Use of this symbol should be considered deprecated. + */ +#define WINAPI_FAMILY_APP WINAPI_FAMILY_PC_APP + +/* + * If no WINAPI_FAMILY value is specified, then all APIs available to + * Windows desktop applications are exposed. + */ +#ifndef WINAPI_FAMILY +#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP +#endif + +/* + * API PARTITONs are part of an indirection mechanism for mapping between + * individual APIs and the FAMILYs to which they apply. + * Each PARTITION is a category or subset of named APIs. PARTITIONs + * are permitted to have overlapping membership -- some single API + * might be part of more than one PARTITION. PARTITIONS are each #define-ed + * to be either 1 or 0 or depending on the platform at which the app is targeted. + */ + +/* + * The mapping between families and partitions is summarized here. + * An X indicates that the given partition is active for the given + * platform/family. + * + * +-------------------+---+ + * | *Partition* | | + * +---+---+---+---+---+---+ + * | | | | | | | + * | | | | | | | + * | | | | P | | | + * | | | | H | | | + * | D | | | O | | | + * | E | | P | N | S | S | + * | S | | C | E | Y | E | + * | K | | _ | _ | S | R | + * | T | A | A | A | T | V | + * +-------------------------+----+ O | P | P | P | E | E | + * | *Platform/Family* \| P | P | P | P | M | R | + * +------------------------------+---+---+---+---+---+---+ + * | WINAPI_FAMILY_DESKTOP_APP | X | X | X | | | | + * +------------------------------+---+---+---+---+---+---+ + * | WINAPI_FAMILY_PC_APP | | X | X | | | | + * +------------------------------+---+---+---+---+---+---+ + * | WINAPI_FAMILY_PHONE_APP | | X | | X | | | + * +----------------------------- +---+---+---+---+---+---+ + * | WINAPI_FAMILY_SYSTEM | | | | | X | | + * +----------------------------- +---+---+---+---+---+---+ + * | WINAPI_FAMILY_SERVER | | | | | X | X | + * +------------------------------+---+---+---+---+---+---+ + * + * The table above is encoded in the following expressions, + * each of which evaluates to 1 or 0. + * + * Whenever a new family is added, all of these expressions + * need to be reconsidered. + */ +#if WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP && \ + WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && \ + WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP && \ + WINAPI_FAMILY != WINAPI_FAMILY_SYSTEM && \ + WINAPI_FAMILY != WINAPI_FAMILY_SERVER +#error Unknown WINAPI_FAMILY value. Was it defined in terms of a WINAPI_PARTITION_* value? +#endif + +#ifndef WINAPI_PARTITION_DESKTOP +#define WINAPI_PARTITION_DESKTOP (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +#endif + +#ifndef WINAPI_PARTITION_APP +#define WINAPI_PARTITION_APP \ + (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || \ + WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || \ + WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#endif + +#ifndef WINAPI_PARTITION_PC_APP +#define WINAPI_PARTITION_PC_APP \ + (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || \ + WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) +#endif + +#ifndef WINAPI_PARTITION_PHONE_APP +#define WINAPI_PARTITION_PHONE_APP (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#endif + +/* + * SYSTEM is the only partition defined here. + * All other System based editions are defined as packages + * on top of the System partition. + * See winpackagefamily.h for packages level partitions + */ +#ifndef WINAPI_PARTITION_SYSTEM +#define WINAPI_PARTITION_SYSTEM \ + (WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM || \ + WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#endif + +/* + * For compatibility with Windows Phone 8 header files, the following + * synonym for WINAPI_PARTITION_PHONE_APP is temporarily #define'd. + * Use of this symbol should be regarded as deprecated. + */ +#define WINAPI_PARTITION_PHONE WINAPI_PARTITION_PHONE_APP + +/* + * Header files use the WINAPI_FAMILY_PARTITION macro to assign one or + * more declarations to some group of partitions. The macro chooses + * whether the preprocessor will emit or omit a sequence of declarations + * bracketed by an #if/#endif pair. All header file references to the + * WINAPI_PARTITION_* values should be in the form of occurrences of + * WINAPI_FAMILY_PARTITION(...). + * + * For example, the following usage of WINAPI_FAMILY_PARTITION identifies + * a sequence of declarations that are part of both the Windows Desktop + * Partition and the Windows-Phone-Specific Store Partition: + * + * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP) + * ... + * #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP) + * + * The comment on the closing #endif allow tools as well as people to find the + * matching #ifdef properly. + * + * Usages of WINAPI_FAMILY_PARTITION may be combined, when the partitition definitions are + * related. In particular one might use declarations like + * + * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + * + * or + * + * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) + * + * Direct references to WINAPI_PARTITION_ values (eg #if !WINAPI_FAMILY_PARTITION_...) + * should not be used. + */ +#define WINAPI_FAMILY_PARTITION(Partitions) (Partitions) + +/* + * Macro used to #define or typedef a symbol used for selective deprecation + * of individual methods of a COM interfaces that are otherwise available + * for a given set of partitions. + */ +#define _WINAPI_DEPRECATED_DECLARATION __declspec(deprecated("This API cannot be used in the context of the caller's application type.")) + +/* + * For compatibility with Windows 8 header files, the following + * symbol is temporarily conditionally #define'd. Additional symbols + * like this should be not defined in winapifamily.h, but rather should be + * introduced locally to the header files of the component that needs them. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#define APP_DEPRECATED_HRESULT HRESULT _WINAPI_DEPRECATED_DECLARATION +#endif // WINAPIFAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + +#if defined(_MSC_VER) && !defined(MOFCOMP_PASS) +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif +#endif + +#endif /* !_INC_WINAPIFAMILY */ \ No newline at end of file diff --git a/src/nativeInterop/cinterop/versionhelper/winpackagefamily.h b/src/nativeInterop/cinterop/versionhelper/winpackagefamily.h new file mode 100644 index 0000000..dfe1830 --- /dev/null +++ b/src/nativeInterop/cinterop/versionhelper/winpackagefamily.h @@ -0,0 +1,72 @@ +/* + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + winpackagefamily.h + +Abstract: + + API family partitioning based on packages. + +*/ + +#ifndef _INC_WINPACKAGEFAMILY +#define _INC_WINPACKAGEFAMILY + +#if defined(_MSC_VER) && !defined(MOFCOMP_PASS) +#if _MSC_VER >= 1200 +#pragma warning(push) +#pragma warning(disable:4001) /* nonstandard extension 'single line comment' was used */ +#endif +#pragma once +#endif // defined(_MSC_VER) && !defined(MOFCOMP_PASS) + + +/* + * PARTITIONS based on packages are each #undef'ed below, and then will be #define-ed + * to be either 1 or 0 or depending on the active WINAPI_FAMILY. + */ +#undef WINAPI_PARTITION_PKG_WINTRUST +#undef WINAPI_PARTITION_PKG_WEBSERVICES +#undef WINAPI_PARTITION_PKG_EVENTLOGSERVICE +#undef WINAPI_PARTITION_PKG_VHD +#undef WINAPI_PARTITION_PKG_PERFCOUNTER +#undef WINAPI_PARTITION_PKG_SECURESTARTUP +#undef WINAPI_PARTITION_PKG_REMOTEFS +#undef WINAPI_PARTITION_PKG_BOOTABLESKU +#undef WINAPI_PARTITION_PKG_CMD +#undef WINAPI_PARTITION_PKG_CMDTOOLS +#undef WINAPI_PARTITION_PKG_DISM +#undef WINAPI_PARTITION_PKG_CORESETUP +#undef WINAPI_PARTITION_PKG_APPRUNTIME +#undef WINAPI_PARTITION_PKG_ESENT +#undef WINAPI_PARTITION_PKG_WINMGMT + +/* + * PARTITIONS for feature packages. Each package might be active for one or more editions + */ +#define WINAPI_PARTITION_PKG_WINTRUST (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_WEBSERVICES (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_EVENTLOGSERVICE (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_VHD (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_PERFCOUNTER (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_SECURESTARTUP (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_REMOTEFS (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_BOOTABLESKU (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_CMD (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_CMDTOOLS (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_DISM (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_CORESETUP (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_APPRUNTIME (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_ESENT (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) +#define WINAPI_PARTITION_PKG_WINMGMT (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) + +#if defined(_MSC_VER) && !defined(MOFCOMP_PASS) +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif +#endif + +#endif /* !_INC_WINPACKAGEFAMILY */ \ No newline at end of file -- cgit v1.2.3