diff --git a/.dockerignore b/.dockerignore
index 21eaf16e7..d4861b4b4 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -11,6 +11,7 @@ packages/
**/obj/
!tracer/src/bin/
+!shared/bin/monitoring-home/tracer/
!tracer/test/test-applications/integrations/Samples.AWS.Lambda/bin/
!tracer/test/test-applications/aspnet/Samples.AspNet472.LoaderOptimizationRegKey/bin/
!tracer/src/WindowsInstaller/bin/
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7e76cc2f9..d707dbea8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -42,11 +42,12 @@ on:
env:
buildConfiguration: Release
dotnetSdkVersion: 6.0.200
- relativeTracerHome: /tracer/src/bin/windows-tracer-home
+ relativeTracerHome: /shared/bin/monitoring-home/tracer
relativeArtifacts: /tracer/src/bin/artifacts
binDir: ${{ github.workspace }}/tracer/src/bin
ddTracerHome: ${{ github.workspace }}/tracer/src/bin/dd-tracer-home
- tracerHome: ${{ github.workspace }}/tracer/src/bin/windows-tracer-home
+ tracerHome: ${{ github.workspace }}/shared/bin/monitoring-home/tracer
+ profilerSrcDirectory: ${{ github.workspace }}/../dd-continuous-profiler-dotnet
artifacts: ${{ github.workspace }}/tracer/src/bin/artifacts
isMainBranch: $[eq(github.ref, 'refs/heads/main')]
NugetPackageDirectory: ${{ github.workspace }}/packages
diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml
index aadd8e8da..ad19aac61 100644
--- a/.github/workflows/release-draft.yml
+++ b/.github/workflows/release-draft.yml
@@ -31,7 +31,7 @@ jobs:
docker run --rm \
--mount type=bind,source="${GITHUB_WORKSPACE}",target=/project \
--env NugetPackageDirectory=/project/packages \
- --env tracerHome=/project/tracer/bin/tracer-home \
+ --env tracerHome=/shared/bin/monitoring-home/tracer \
--env artifacts=/project/tracer/src/bin/artifacts \
dd-trace-dotnet/${baseImage}-builder \
dotnet /build/bin/Debug/_build.dll Clean BuildTracerHome ZipTracerHome
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 339ea66ee..408706988 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,7 +26,7 @@ linux-build:
- |
docker run \
--env NugetPackageDirectory=/project/packages \
- --env tracerHome=/project/tracer/bin/tracer-home \
+ --env tracerHome=/shared/bin/monitoring-home/tracer \
--env artifacts=/project/tracer/src/bin/artifacts \
--name release \
dd-trace-dotnet/${baseImage}-builder \
diff --git a/dev/envvars.sh b/dev/envvars.sh
index 907f5ad8f..fe4f7e0a9 100755
--- a/dev/envvars.sh
+++ b/dev/envvars.sh
@@ -41,15 +41,15 @@ CURDIR=$(current_dir)
# Enable .NET Framework Profiling API
export COR_ENABLE_PROFILING="1"
export COR_PROFILER="{B4C89B0F-9908-4F73-9F59-0D77C5A06874}"
-export COR_PROFILER_PATH="${CURDIR}/tracer/bin/tracer-home/${OPT_DIR}SignalFx.Tracing.ClrProfiler.Native.${SUFIX}"
+export COR_PROFILER_PATH="${CURDIR}/shared/bin/monitoring-home/tracer${OPT_DIR}SignalFx.Tracing.ClrProfiler.Native.${SUFIX}"
# Enable .NET Core Profiling API
export CORECLR_ENABLE_PROFILING="1"
export CORECLR_PROFILER="{B4C89B0F-9908-4F73-9F59-0D77C5A06874}"
-export CORECLR_PROFILER_PATH="${CURDIR}/tracer/bin/tracer-home/${OPT_DIR}SignalFx.Tracing.ClrProfiler.Native.${SUFIX}"
+export CORECLR_PROFILER_PATH="${CURDIR}/shared/bin/monitoring-home/tracer/${OPT_DIR}SignalFx.Tracing.ClrProfiler.Native.${SUFIX}"
# Configure SFx .NET Tracer
-export SIGNALFX_DOTNET_TRACER_HOME="${CURDIR}/tracer/bin/tracer-home"
+export SIGNALFX_DOTNET_TRACER_HOME="${CURDIR}/shared/bin/monitoring-home/tracer"
export SIGNALFX_VERSION="1.0.0"
export SIGNALFX_TRACE_DEBUG="1"
export SIGNALFX_DUMP_ILREWRITE_ENABLED="0"
diff --git a/docker-compose.yml b/docker-compose.yml
index ceab3ae12..307e14543 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -441,7 +441,7 @@ services:
- ./:/project
environment:
- NugetPackageDirectory=/project/${relativeNugetPackageDirectory:-packages}
- - tracerHome=/project/${relativeTracerHome:-tracer/src/bin/windows-tracer-home}
+ - tracerHome=/project/${relativeTracerHome:-shared/bin/monitoring-home/tracer}
- artifacts=/project/${relativeArtifacts:-tracer/src/bin/artifacts}
- framework=${framework:-netcoreapp3.1}
- baseImage=${baseImage:-default}
@@ -510,7 +510,7 @@ services:
- ./:/project
environment:
- NugetPackageDirectory=/project/${relativeNugetPackageDirectory:-packages}
- - tracerHome=/project/${relativeTracerHome:-tracer/src/bin/windows-tracer-home}
+ - tracerHome=/project/${relativeTracerHome:-shared/bin/monitoring-home/tracer}
- artifacts=/project/${relativeArtifacts:-tracer/src/bin/artifacts}
- framework=${framework:-netcoreapp3.1}
- explorationTestUseCase=${explorationTestUseCase:-debugger}
@@ -563,7 +563,7 @@ services:
- ./:/project
environment:
- NugetPackageDirectory=/project/${relativeNugetPackageDirectory:-packages}
- - tracerHome=/project/${relativeTracerHome:-tracer/src/bin/windows-tracer-home}
+ - tracerHome=/project/${relativeTracerHome:-shared/bin/monitoring-home/tracer}
- artifacts=/project/${relativeArtifacts:-tracer/src/bin/artifacts}
- framework=${framework:-netcoreapp3.1}
- baseImage=${baseImage:-debian}
diff --git a/docs/internal/internal-config.md b/docs/internal/internal-config.md
index ac6de99ca..df8188810 100644
--- a/docs/internal/internal-config.md
+++ b/docs/internal/internal-config.md
@@ -29,11 +29,6 @@ These settings should be never used by the users.
|-|-|-|
| `SIGNALFX_AGENT_HOST` | The Agent host where the tracer can send traces. | |
| `SIGNALFX_APM_RECEIVER_PORT` | The port for Trace Agent binding. | `8126` |
-| `SIGNALFX_APPSEC_ENABLED` | Enables the AppSec. | `false` |
-| `SIGNALFX_APPSEC_EXTRA_HEADERS` | Optional custom headers the user wants to send. | |
-| `SIGNALFX_APPSEC_IPHEADER` | Optional name of the custom header to take into account for the ip address. | |
-| `SIGNALFX_APPSEC_KEEP_TRACES` | Specifies if the AppSec traces should be explicitly kept or droped. | `true` |
-| `SIGNALFX_APPSEC_RULES` | Overrides the default rules file provided. Must be a path to a valid JSON rules file. | |
| `SIGNALFX_CIVISIBILITY_AGENTLESS_ENABLED` | Enable to activate Agentless in CI Visibility. | `false` |
| `SIGNALFX_CIVISIBILITY_ENABLED` | Enable to activate CI Visibility. | `false` |
| `SIGNALFX_DOGSTATSD_ARGS` | Comma-separated list of arguments to be passed to the DogStatsD process. | |
diff --git a/profiler/Directory.Build.props b/profiler/Directory.Build.props
index e5758d6a2..ebeb43b70 100644
--- a/profiler/Directory.Build.props
+++ b/profiler/Directory.Build.props
@@ -188,9 +188,9 @@
- $(EnlistmentRoot)/profiler/src/dotnet-runtime-coreclr/
$([System.IO.Path]::GetFullPath( $(EnlistmentRoot)/ ))
- $(DOTNET-TRACER-REPO-ROOT-PATH)shared/src/native-lib/
+ $(DOTNET-TRACER-REPO-ROOT-PATH)shared\src\native-lib\
+ $(SHARED-LIB-PATH)coreclr\src
x64
x86
$(SHARED-LIB-PATH)fmt_$(SHARED-LIB-PLATFORM)-windows-static\include;$(SHARED-LIB-PATH)spdlog\include
diff --git a/profiler/cppcheck-suppressions.txt b/profiler/cppcheck-suppressions.txt
index add6066c1..34cce1040 100644
--- a/profiler/cppcheck-suppressions.txt
+++ b/profiler/cppcheck-suppressions.txt
@@ -1,9 +1,9 @@
-*:*/dotnet-runtime-coreclr/*
+*:*/coreclr/*
*:*/test/*
*:*/_deps/*
// This error is an issue with cppcheck. So do not report this one specifically
preprocessorErrorDirective:*/logging.h
-preprocessorErrorDirective:*/fmt/core.h
+preprocessorErrorDirective:*/fmt/bundled/core.h
// in the loader, we compute the size of the assembly and the pdb file (l.1791 and l.1794)
// this triggers the rule below. So skip for the whole file for now, and add inline suppression
// later.
diff --git a/profiler/src/Demos/WindowsService01/ReadMe.md b/profiler/src/Demos/WindowsService01/ReadMe.md
index 37ccd8393..b11110a38 100644
--- a/profiler/src/Demos/WindowsService01/ReadMe.md
+++ b/profiler/src/Demos/WindowsService01/ReadMe.md
@@ -137,7 +137,7 @@ Wait until the shutdown is complete.
Start the service again.
Wait until starting is complete (pausing/resuming will not be enough).
-6. Profiler should attach and start working. Logs should be found in the default (or specified) log location. The default is `C:\ProgramData\Datadog-APM\logs\DotNet\`.
+6. Profiler should attach and start working. Logs should be found in the default (or specified) log location. The default is `C:\ProgramData\SignalFx .NET Tracing\logs\DotNet\`.
For some additional info, see https://docs.datadoghq.com/tracing/setup_overview/setup/dotnet-framework/?tab=environmentvariables#installation-and-getting-started
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/ConfigurationProviderUtils.cs b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/ConfigurationProviderUtils.cs
index ca8ac4e91..dc1c17fbd 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/ConfigurationProviderUtils.cs
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/ConfigurationProviderUtils.cs
@@ -240,7 +240,7 @@ private static bool IsWindowsFileSystem()
private static class DefaultDirectories
{
- public const string WindowsAppDataRoot = @"Datadog-APM\"; // relative to Environment.SpecialFolder.CommonApplicationData
+ public const string WindowsAppDataRoot = @"SignalFx .NET Tracing\"; // relative to Environment.SpecialFolder.CommonApplicationData
public const string LinuxAppDataRoot = @"/var/log/signalfx"; // global path
public const string WindowsLogsDir = @"logs"; // relative to AppDataRoot
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/DevProductConfigurationProvider.cs b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/DevProductConfigurationProvider.cs
index 7997b0ad6..077d858bb 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/DevProductConfigurationProvider.cs
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Configuration/DevProductConfigurationProvider.cs
@@ -109,7 +109,7 @@ public static IProductConfiguration ApplyDevDefaults(this IProductConfiguration
// --> to preprod
mutableConfig.ProfilesIngestionEndpoint_Url = "https://intake.profile.datadoghq.com/v1/input";
- mutableConfig.ProfilesIngestionEndpoint_DatadogApiKey = "";
+ mutableConfig.ProfilesIngestionEndpoint_DatadogApiKey = string.Empty;
string ddService = ConfigurationProviderUtils.GetDdServiceFallback();
mutableConfig.DDDataTags_Host = ConfigurationProviderUtils.GetMachineName();
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/GlobalSuppressions.cs b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/GlobalSuppressions.cs
new file mode 100644
index 000000000..d1c5e23b0
--- /dev/null
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/GlobalSuppressions.cs
@@ -0,0 +1,13 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1518:Use line endings correctly at end of file", Justification = "Add no value")]
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/PProf.Export/PProfSampleValueType.cs b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/PProf.Export/PProfSampleValueType.cs
index a84e1788a..44ea9e367 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/PProf.Export/PProfSampleValueType.cs
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Managed/PProf.Export/PProfSampleValueType.cs
@@ -1,10 +1,8 @@
-//
+//
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
//
-using System;
-
namespace Datadog.PProf.Export
{
internal struct PProfSampleValueType
@@ -19,4 +17,4 @@ public PProfSampleValueType(string type, string unit)
public string Unit { get; }
}
-}
\ No newline at end of file
+}
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt
index 98f5f1341..bd4d4ca59 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt
@@ -145,7 +145,7 @@ add_library(${PROFILER_STATIC_LIB_NAME} STATIC
${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-src/miniutf.cpp
${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-src/il_rewriter.cpp
${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-src/il_rewriter_wrapper.cpp
- ../../dotnet-runtime-coreclr/pal/prebuilt/idl/corprof_i.cpp
+ ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corprof_i.cpp
${GENERATED_OBJ_FILES}
)
@@ -154,10 +154,10 @@ set_target_properties(${PROFILER_STATIC_LIB_NAME} PROPERTIES PREFIX "")
# Define directories includes
target_include_directories(${PROFILER_STATIC_LIB_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../Datadog.Profiler.Native
- PUBLIC ../../dotnet-runtime-coreclr/pal/inc/rt
- PUBLIC ../../dotnet-runtime-coreclr/pal/prebuilt/inc
- PUBLIC ../../dotnet-runtime-coreclr/pal/inc
- PUBLIC ../../dotnet-runtime-coreclr/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/inc/rt
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/prebuilt/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/inc
PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/spdlog/include
PUBLIC ${OUTPUT_DEPS_DIR}/fmt/include
PUBLIC ${OUTPUT_DEPS_DIR}/libunwind/include
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Resource.rc b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Resource.rc
index f4b0c1811..78dea6711 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Resource.rc
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native.Windows/Resource.rc
@@ -90,11 +90,12 @@ NETCOREAPP20_Datadog_AutoInstrumentation_ManagedLoader_pdb SYMBOLS "net
// ------- version info -------------------------------------------------------
// Alpha 1.0.2
// Beta 1.1.1
-// GA 1.2.0
+// Beta 2.?.?.x once integrated into Tracer repository (where x = beta version such as 1 or 2)
+// GA ???
//
VS_VERSION_INFO VERSIONINFO
-FILEVERSION 1, 1, 1, 1
-PRODUCTVERSION 1, 1, 1, 1
+FILEVERSION 0, 2, 2, 0
+PRODUCTVERSION 0, 2, 2, 0
FILEFLAGSMASK VS_FF_PRERELEASE
FILEOS VOS_NT
FILETYPE VFT_DLL
@@ -105,12 +106,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Datadog"
VALUE "FileDescription", "Continuous Profiler for .NET Applications"
- VALUE "FileVersion", "1.1.1.1"
+ VALUE "FileVersion", "0.2.2.0"
VALUE "InternalName", "Native Profiler Engine"
VALUE "LegalCopyright", "(c) Datadog 2020-2022"
VALUE "OriginalFilename", "Datadog.Profiler.Native.dll"
VALUE "ProductName", "Continuous Profiler for .NET Applications"
- VALUE "ProductVersion", "1.1.1.1"
+ VALUE "ProductVersion", "0.2.2.0"
END
END
BLOCK "VarFileInfo"
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/CorProfilerCallback.cpp b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/CorProfilerCallback.cpp
index 91a893919..7cd831b40 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/CorProfilerCallback.cpp
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/CorProfilerCallback.cpp
@@ -31,6 +31,7 @@
#include "shared/src/native-src/loader.h"
#include "shared/src/native-src/pal.h"
#include "shared/src/native-src/string.h"
+#include "shared/src/native-src/environment_variables.h"
// The following macros are used to construct the profiler file:
#ifdef _WINDOWS
diff --git a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Log.h b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Log.h
index 822c8c101..2e4939199 100644
--- a/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Log.h
+++ b/profiler/src/ProfilerEngine/Datadog.Profiler.Native/Log.h
@@ -7,7 +7,7 @@
#include
-#include "shared/src/native-src/logging.h"
+#include "shared/src/native-src/logger_impl.h"
#include "shared/src/native-src/string.h"
class Log final
@@ -15,12 +15,11 @@ class Log final
private:
struct ProfilerLoggerPolicy
{
- inline static const shared::WSTRING filename = WStr("dotNet-profiler-native");
+ inline static const std::string file_name = WStr("dotNet-profiler-native");
#ifdef _WIN32
- inline static const shared::WSTRING folder_path = WStr(R"(SignalFx .NET Tracing\logs)");
-#endif
+ inline static const shared::WSTRING folder_path = WStr(R"(SignalFx .NET Tracing\logDotNets)");
inline static const std::string pattern = "[%Y-%m-%d %H:%M:%S.%e | %l | PId: %P | TId: %t] %v";
- struct environment
+ struct logging_environment
{
inline static const shared::WSTRING log_path = EnvironmentVariables::LogPath;
inline static const shared::WSTRING log_directory = EnvironmentVariables::LogDirectory;
@@ -30,29 +29,29 @@ class Log final
public:
static bool IsDebugEnabled()
{
- return shared::Logger::IsDebugEnabled();
+ return shared::LoggerImpl::Instance()->IsDebugEnabled();
}
static void EnableDebug()
{
- shared::Logger::EnableDebug();
+ shared::LoggerImpl::Instance()->EnableDebug();
}
template
static inline void Debug(const Args... args)
{
- shared::Logger::Debug(args...);
+ shared::LoggerImpl::Instance()->Debug(args...);
}
template
static void Info(const Args... args)
{
- shared::Logger::Info(args...);
+ shared::LoggerImpl::Instance()->Info(args...);
}
template
static void Error(const Args... args)
{
- shared::Logger::Error(args...);
+ shared::LoggerImpl::Instance()->Error(args...);
}
};
diff --git a/profiler/src/ProfilerEngine/ProductVersion.props b/profiler/src/ProfilerEngine/ProductVersion.props
index a44a52673..e5074c82b 100644
--- a/profiler/src/ProfilerEngine/ProductVersion.props
+++ b/profiler/src/ProfilerEngine/ProductVersion.props
@@ -5,16 +5,18 @@
- 1
- 1
- 1
+ 0
+ 2
+ 2
+ 0
-
+
+
$(ProductVersionMajor).$(ProductVersionMinor).$(ProductVersionBuild)
- beta.$(ProductVersionBuild)
+ beta.$(BetaVersion)
@@ -32,8 +34,8 @@
- $(ProductVersion).1
- $(ProductVersion).1
+ $(ProductVersion).$(BetaVersion)
+ $(ProductVersion).$(BetaVersion)
$(ProductVersion)$(ProductSuffix)
diff --git a/profiler/src/dotnet-runtime-coreclr/README.md b/profiler/src/dotnet-runtime-coreclr/README.md
deleted file mode 100644
index cfb36c7ba..000000000
--- a/profiler/src/dotnet-runtime-coreclr/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-The files here were copied from https://github.com/dotnet/runtime/tree/v5.0.5/src/coreclr/src.
-
-This is to allow using the runtime's Platform Adaptation Layer.
-
-Add back the definition of g_tkCorEncodeToken in cor.h l.2096:
-
-replace
-extern const mdToken g_tkCorEncodeToken[];
-by
-const mdToken g_tkCorEncodeToken[4] = { mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType };
-
-Commented #define statements because there is naming conflicts when compiling with the stdlibc++ 8 (+ C++17)
-in `dotnet-runtime-coreclr\pal\inc\rt\sal.h`
-l.2612 // commented because it conflicts with stdlibc++ 8
-l.2613 //#define __valid
-
-and
-
-l.2622 // commented because it conflicts with stdlibc++ 8
-l.2623 //#define __pre
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cor.h b/profiler/src/dotnet-runtime-coreclr/inc/cor.h
deleted file mode 100644
index 6e9feaeb0..000000000
--- a/profiler/src/dotnet-runtime-coreclr/inc/cor.h
+++ /dev/null
@@ -1,2389 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*****************************************************************************
- ** **
- ** Cor.h - general header for the Runtime. **
- ** **
- *****************************************************************************/
-
-
-#ifndef _COR_H_
-#define _COR_H_
-
-//*****************************************************************************
-// Required includes
-#include // Definitions of OLE types.
-#include
-#include "corerror.h"
-
-//*****************************************************************************
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// {BED7F4EA-1A96-11d2-8F08-00A0C9A6186D}
-EXTERN_GUID(LIBID_ComPlusRuntime, 0xbed7f4ea, 0x1a96, 0x11d2, 0x8f, 0x8, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
-
-// {90883F05-3D28-11D2-8F17-00A0C9A6186D}
-EXTERN_GUID(GUID_ExportedFromComPlus, 0x90883f05, 0x3d28, 0x11d2, 0x8f, 0x17, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
-
-// {0F21F359-AB84-41e8-9A78-36D110E6D2F9}
-EXTERN_GUID(GUID_ManagedName, 0xf21f359, 0xab84, 0x41e8, 0x9a, 0x78, 0x36, 0xd1, 0x10, 0xe6, 0xd2, 0xf9);
-
-// {54FC8F55-38DE-4703-9C4E-250351302B1C}
-EXTERN_GUID(GUID_Function2Getter, 0x54fc8f55, 0x38de, 0x4703, 0x9c, 0x4e, 0x25, 0x3, 0x51, 0x30, 0x2b, 0x1c);
-
-// CLSID_CorMetaDataDispenserRuntime: {1EC2DE53-75CC-11d2-9775-00A0C9B4D50C}
-// Dispenser coclass for version 1.5 and 2.0 meta data. To get the "latest" bind
-// to CLSID_MetaDataDispenser.
-EXTERN_GUID(CLSID_CorMetaDataDispenserRuntime, 0x1ec2de53, 0x75cc, 0x11d2, 0x97, 0x75, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
-
-// {CD2BC5C9-F452-4326-B714-F9C539D4DA58}
-EXTERN_GUID(GUID_DispIdOverride, 0xcd2bc5c9, 0xf452, 0x4326, 0xb7, 0x14, 0xf9, 0xc5, 0x39, 0xd4, 0xda, 0x58);
-
-// {B64784EB-D8D4-4d9b-9ACD-0E30806426F7}
-EXTERN_GUID(GUID_ForceIEnumerable, 0xb64784eb, 0xd8d4, 0x4d9b, 0x9a, 0xcd, 0x0e, 0x30, 0x80, 0x64, 0x26, 0xf7);
-
-// {2941FF83-88D8-4F73-B6A9-BDF8712D000D}
-EXTERN_GUID(GUID_PropGetCA, 0x2941ff83, 0x88d8, 0x4f73, 0xb6, 0xa9, 0xbd, 0xf8, 0x71, 0x2d, 0x00, 0x0d);
-
-// {29533527-3683-4364-ABC0-DB1ADD822FA2}
-EXTERN_GUID(GUID_PropPutCA, 0x29533527, 0x3683, 0x4364, 0xab, 0xc0, 0xdb, 0x1a, 0xdd, 0x82, 0x2f, 0xa2);
-
-// CLSID_CLR_v1_MetaData: {005023CA-72B1-11D3-9FC4-00C04F79A0A3}
-// Used to generate v1 metadata (for v1.0 and v1.1 CLR compatibility).
-EXTERN_GUID(CLSID_CLR_v1_MetaData, 0x005023ca, 0x72b1, 0x11d3, 0x9f, 0xc4, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-// CLSID_CLR_v2_MetaData: {EFEA471A-44FD-4862-9292-0C58D46E1F3A}
-EXTERN_GUID(CLSID_CLR_v2_MetaData, 0xefea471a, 0x44fd, 0x4862, 0x92, 0x92, 0xc, 0x58, 0xd4, 0x6e, 0x1f, 0x3a);
-
-
-// CLSID_CorMetaDataRuntime:
-// This will can always be used to generate the "latest" metadata available.
-#define CLSID_CorMetaDataRuntime CLSID_CLR_v2_MetaData
-
-
-// {30FE7BE8-D7D9-11D2-9F80-00C04F79A0A3}
-EXTERN_GUID(MetaDataCheckDuplicatesFor, 0x30fe7be8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-// {DE3856F8-D7D9-11D2-9F80-00C04F79A0A3}
-EXTERN_GUID(MetaDataRefToDefCheck, 0xde3856f8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-// {E5D71A4C-D7DA-11D2-9F80-00C04F79A0A3}
-EXTERN_GUID(MetaDataNotificationForTokenMovement, 0xe5d71a4c, 0xd7da, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-// {2eee315c-d7db-11d2-9f80-00c04f79a0a3}
-EXTERN_GUID(MetaDataSetUpdate, 0x2eee315c, 0xd7db, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-#define MetaDataSetENC MetaDataSetUpdate
-
-// Use this guid in SetOption to indicate if the import enumerator should skip over
-// delete items or not. The default is yes.
-//
-// {79700F36-4AAC-11d3-84C3-009027868CB1}
-EXTERN_GUID(MetaDataImportOption, 0x79700f36, 0x4aac, 0x11d3, 0x84, 0xc3, 0x0, 0x90, 0x27, 0x86, 0x8c, 0xb1);
-
-// Use this guid in the SetOption if compiler wants to have MetaData API to take reader/writer lock
-//
-// {F7559806-F266-42ea-8C63-0ADB45E8B234}
-EXTERN_GUID(MetaDataThreadSafetyOptions, 0xf7559806, 0xf266, 0x42ea, 0x8c, 0x63, 0xa, 0xdb, 0x45, 0xe8, 0xb2, 0x34);
-
-// Use this guid in the SetOption if compiler wants error when some tokens are emitted out of order
-// {1547872D-DC03-11d2-9420-0000F8083460}
-EXTERN_GUID(MetaDataErrorIfEmitOutOfOrder, 0x1547872d, 0xdc03, 0x11d2, 0x94, 0x20, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
-
-// Use this guid in the SetOption to indicate if the tlbimporter should generate the
-// TCE adapters for COM connection point containers.
-// {DCC9DE90-4151-11d3-88D6-00902754C43A}
-EXTERN_GUID(MetaDataGenerateTCEAdapters, 0xdcc9de90, 0x4151, 0x11d3, 0x88, 0xd6, 0x0, 0x90, 0x27, 0x54, 0xc4, 0x3a);
-
-// Use this guid in the SetOption to specifiy a non-default namespace for typelib import.
-// {F17FF889-5A63-11d3-9FF2-00C04FF7431A}
-EXTERN_GUID(MetaDataTypeLibImportNamespace, 0xf17ff889, 0x5a63, 0x11d3, 0x9f, 0xf2, 0x0, 0xc0, 0x4f, 0xf7, 0x43, 0x1a);
-
-// Use this guid in the SetOption to specify the behavior of UnmarkAll. See CorLinkerOptions.
-// {47E099B6-AE7C-4797-8317-B48AA645B8F9}
-EXTERN_GUID(MetaDataLinkerOptions, 0x47e099b6, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
-
-// Use this guid in the SetOption to specify the runtime version stored in the CLR metadata.
-// {47E099B7-AE7C-4797-8317-B48AA645B8F9}
-EXTERN_GUID(MetaDataRuntimeVersion, 0x47e099b7, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
-
-// Use this guid in the SetOption to specify the behavior of the merger.
-// {132D3A6E-B35D-464e-951A-42EFB9FB6601}
-EXTERN_GUID(MetaDataMergerOptions, 0x132d3a6e, 0xb35d, 0x464e, 0x95, 0x1a, 0x42, 0xef, 0xb9, 0xfb, 0x66, 0x1);
-
-// Use this guid in SetOption to disable optimizing module-local refs to defs
-// {a55c0354-e91b-468b-8648-7cc31035d533}
-EXTERN_GUID(MetaDataPreserveLocalRefs, 0xa55c0354, 0xe91b, 0x468b, 0x86, 0x48, 0x7c, 0xc3, 0x10, 0x35, 0xd5, 0x33);
-
-interface IMetaDataImport;
-interface IMetaDataAssemblyEmit;
-interface IMetaDataAssemblyImport;
-interface IMetaDataEmit;
-interface ICeeGen;
-
-
-typedef UNALIGNED void const *UVCP_CONSTANT;
-
-
-// Constant for connection id and task id
-#define INVALID_CONNECTION_ID 0x0
-#define INVALID_TASK_ID 0x0
-#define MAX_CONNECTION_NAME MAX_PATH
-
-
-#define MAIN_CLR_MODULE_NAME_W W("coreclr")
-#define MAIN_CLR_MODULE_NAME_A "coreclr"
-
-#define MAIN_CLR_DLL_NAME_W MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W)
-#define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A)
-
-#define TARGET_MAIN_CLR_DLL_NAME_W MAKE_TARGET_DLLNAME_W(MAIN_CLR_MODULE_NAME_W)
-#define TARGET_MAIN_CLR_DLL_NAME_A MAKE_TARGET_DLLNAME_A(MAIN_CLR_MODULE_NAME_A)
-
-#define SWITCHOUT_HANDLE_VALUE ((HANDLE)(LONG_PTR)-2)
-
-//*****************************************************************************
-//*****************************************************************************
-//
-// I L & F I L E F O R M A T D E C L A R A T I O N S
-//
-//*****************************************************************************
-//*****************************************************************************
-
-
-//
-#ifndef _WINDOWS_UPDATES_
-#include
-#endif // updates
-
-//*****************************************************************************
-//*****************************************************************************
-
-// CLSID_Cor: {bee00000-ee77-11d0-a015-00c04fbbb884}
-EXTERN_GUID(CLSID_Cor, 0xbee00010, 0xee77, 0x11d0, 0xa0, 0x15, 0x00, 0xc0, 0x4f, 0xbb, 0xb8, 0x84);
-
-// CLSID_CorMetaDataDispenser: {E5CB7A31-7512-11d2-89CE-0080C792E5D8}
-// This is the "Master Dispenser", always guaranteed to be the most recent
-// dispenser on the machine.
-EXTERN_GUID(CLSID_CorMetaDataDispenser, 0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x0, 0x80, 0xc7, 0x92, 0xe5, 0xd8);
-
-
-// CLSID_CorMetaDataDispenserReg: {435755FF-7397-11d2-9771-00A0C9B4D50C}
-// Dispenser coclass for version 1.0 meta data. To get the "latest" bind
-// to CLSID_CorMetaDataDispenser.
-EXTERN_GUID(CLSID_CorMetaDataDispenserReg, 0x435755ff, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
-
-
-// CLSID_CorMetaDataReg: {87F3A1F5-7397-11d2-9771-00A0C9B4D50C}
-// For COM+ Meta Data, Data Driven Registration
-EXTERN_GUID(CLSID_CorMetaDataReg, 0x87f3a1f5, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
-
-
-interface IMetaDataDispenser;
-
-//-------------------------------------
-//--- IMetaDataError
-//-------------------------------------
-// {B81FF171-20F3-11d2-8DCC-00A0C9B09C19}
-EXTERN_GUID(IID_IMetaDataError, 0xb81ff171, 0x20f3, 0x11d2, 0x8d, 0xcc, 0x0, 0xa0, 0xc9, 0xb0, 0x9c, 0x19);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataError
-DECLARE_INTERFACE_(IMetaDataError, IUnknown)
-{
- STDMETHOD(OnError)(HRESULT hrError, mdToken token) PURE;
-};
-
-//-------------------------------------
-//--- IMapToken
-//-------------------------------------
-// IID_IMapToken: {06A3EA8B-0225-11d1-BF72-00C04FC31E12}
-EXTERN_GUID(IID_IMapToken, 0x6a3ea8b, 0x225, 0x11d1, 0xbf, 0x72, 0x0, 0xc0, 0x4f, 0xc3, 0x1e, 0x12);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMapToken
-DECLARE_INTERFACE_(IMapToken, IUnknown)
-{
- STDMETHOD(Map)(mdToken tkImp, mdToken tkEmit) PURE;
-};
-
-//-------------------------------------
-//--- IMetaDataDispenser
-//-------------------------------------
-// {809C652E-7396-11D2-9771-00A0C9B4D50C}
-EXTERN_GUID(IID_IMetaDataDispenser, 0x809c652e, 0x7396, 0x11d2, 0x97, 0x71, 0x00, 0xa0, 0xc9, 0xb4, 0xd5, 0x0c);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataDispenser
-DECLARE_INTERFACE_(IMetaDataDispenser, IUnknown)
-{
- STDMETHOD(DefineScope)( // Return code.
- REFCLSID rclsid, // [in] What version to create.
- DWORD dwCreateFlags, // [in] Flags on the create.
- REFIID riid, // [in] The interface desired.
- IUnknown **ppIUnk) PURE; // [out] Return interface on success.
-
- STDMETHOD(OpenScope)( // Return code.
- LPCWSTR szScope, // [in] The scope to open.
- DWORD dwOpenFlags, // [in] Open mode flags.
- REFIID riid, // [in] The interface desired.
- IUnknown **ppIUnk) PURE; // [out] Return interface on success.
-
- STDMETHOD(OpenScopeOnMemory)( // Return code.
- LPCVOID pData, // [in] Location of scope data.
- ULONG cbData, // [in] Size of the data pointed to by pData.
- DWORD dwOpenFlags, // [in] Open mode flags.
- REFIID riid, // [in] The interface desired.
- IUnknown **ppIUnk) PURE; // [out] Return interface on success.
-};
-
-//-------------------------------------
-//--- IMetaDataEmit
-//-------------------------------------
-// {BA3FEE4C-ECB9-4e41-83B7-183FA41CD859}
-EXTERN_GUID(IID_IMetaDataEmit, 0xba3fee4c, 0xecb9, 0x4e41, 0x83, 0xb7, 0x18, 0x3f, 0xa4, 0x1c, 0xd8, 0x59);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataEmit
-DECLARE_INTERFACE_(IMetaDataEmit, IUnknown)
-{
- STDMETHOD(SetModuleProps)( // S_OK or error.
- LPCWSTR szName) PURE; // [IN] If not NULL, the name of the module to set.
-
- STDMETHOD(Save)( // S_OK or error.
- LPCWSTR szFile, // [IN] The filename to save to.
- DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
-
- STDMETHOD(SaveToStream)( // S_OK or error.
- IStream *pIStream, // [IN] A writable stream to save to.
- DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
-
- STDMETHOD(GetSaveSize)( // S_OK or error.
- CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
- DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
-
- STDMETHOD(DefineTypeDef)( // S_OK or error.
- LPCWSTR szTypeDef, // [IN] Name of TypeDef
- DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
- mdToken tkExtends, // [IN] extends this TypeDef or typeref
- mdToken rtkImplements[], // [IN] Implements interfaces
- mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
-
- STDMETHOD(DefineNestedType)( // S_OK or error.
- LPCWSTR szTypeDef, // [IN] Name of TypeDef
- DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
- mdToken tkExtends, // [IN] extends this TypeDef or typeref
- mdToken rtkImplements[], // [IN] Implements interfaces
- mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type.
- mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
-
- STDMETHOD(SetHandler)( // S_OK.
- IUnknown *pUnk) PURE; // [IN] The new error handler.
-
- STDMETHOD(DefineMethod)( // S_OK or error.
- mdTypeDef td, // Parent TypeDef
- LPCWSTR szName, // Name of member
- DWORD dwMethodFlags, // Member attributes
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- ULONG ulCodeRVA,
- DWORD dwImplFlags,
- mdMethodDef *pmd) PURE; // Put member token here
-
- STDMETHOD(DefineMethodImpl)( // S_OK or error.
- mdTypeDef td, // [IN] The class implementing the method
- mdToken tkBody, // [IN] Method body - MethodDef or MethodRef
- mdToken tkDecl) PURE; // [IN] Method declaration - MethodDef or MethodRef
-
- STDMETHOD(DefineTypeRefByName)( // S_OK or error.
- mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
- LPCWSTR szName, // [IN] Name of the TypeRef.
- mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
-
- STDMETHOD(DefineImportType)( // S_OK or error.
- IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the TypeDef.
- const void *pbHashValue, // [IN] Hash Blob for Assembly.
- ULONG cbHashValue, // [IN] Count of bytes.
- IMetaDataImport *pImport, // [IN] Scope containing the TypeDef.
- mdTypeDef tdImport, // [IN] The imported TypeDef.
- IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported.
- mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
-
- STDMETHOD(DefineMemberRef)( // S_OK or error
- mdToken tkImport, // [IN] ClassRef or ClassDef importing a member.
- LPCWSTR szName, // [IN] member's name
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdMemberRef *pmr) PURE; // [OUT] memberref token
-
- STDMETHOD(DefineImportMember)( // S_OK or error.
- IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the Member.
- const void *pbHashValue, // [IN] Hash Blob for Assembly.
- ULONG cbHashValue, // [IN] Count of bytes.
- IMetaDataImport *pImport, // [IN] Import scope, with member.
- mdToken mbMember, // [IN] Member in import scope.
- IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the Member is imported.
- mdToken tkParent, // [IN] Classref or classdef in emit scope.
- mdMemberRef *pmr) PURE; // [OUT] Put member ref here.
-
- STDMETHOD(DefineEvent) (
- mdTypeDef td, // [IN] the class/interface on which the event is being defined
- LPCWSTR szEvent, // [IN] Name of the event
- DWORD dwEventFlags, // [IN] CorEventAttr
- mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class
- mdMethodDef mdAddOn, // [IN] required add method
- mdMethodDef mdRemoveOn, // [IN] required remove method
- mdMethodDef mdFire, // [IN] optional fire method
- mdMethodDef rmdOtherMethods[], // [IN] optional array of other methods associate with the event
- mdEvent *pmdEvent) PURE; // [OUT] output event token
-
- STDMETHOD(SetClassLayout) (
- mdTypeDef td, // [IN] typedef
- DWORD dwPackSize, // [IN] packing size specified as 1, 2, 4, 8, or 16
- COR_FIELD_OFFSET rFieldOffsets[], // [IN] array of layout specification
- ULONG ulClassSize) PURE; // [IN] size of the class
-
- STDMETHOD(DeleteClassLayout) (
- mdTypeDef td) PURE; // [IN] typedef whose layout is to be deleted.
-
- STDMETHOD(SetFieldMarshal) (
- mdToken tk, // [IN] given a fieldDef or paramDef token
- PCCOR_SIGNATURE pvNativeType, // [IN] native type specification
- ULONG cbNativeType) PURE; // [IN] count of bytes of pvNativeType
-
- STDMETHOD(DeleteFieldMarshal) (
- mdToken tk) PURE; // [IN] given a fieldDef or paramDef token
-
- STDMETHOD(DefinePermissionSet) (
- mdToken tk, // [IN] the object to be decorated.
- DWORD dwAction, // [IN] CorDeclSecurity.
- void const *pvPermission, // [IN] permission blob.
- ULONG cbPermission, // [IN] count of bytes of pvPermission.
- mdPermission *ppm) PURE; // [OUT] returned permission token.
-
- STDMETHOD(SetRVA)( // S_OK or error.
- mdMethodDef md, // [IN] Method for which to set offset
- ULONG ulRVA) PURE; // [IN] The offset
-
- STDMETHOD(GetTokenFromSig)( // S_OK or error.
- PCCOR_SIGNATURE pvSig, // [IN] Signature to define.
- ULONG cbSig, // [IN] Size of signature data.
- mdSignature *pmsig) PURE; // [OUT] returned signature token.
-
- STDMETHOD(DefineModuleRef)( // S_OK or error.
- LPCWSTR szName, // [IN] DLL name
- mdModuleRef *pmur) PURE; // [OUT] returned
-
- // @FUTURE: This should go away once everyone starts using SetMemberRefProps.
- STDMETHOD(SetParent)( // S_OK or error.
- mdMemberRef mr, // [IN] Token for the ref to be fixed up.
- mdToken tk) PURE; // [IN] The ref parent.
-
- STDMETHOD(GetTokenFromTypeSpec)( // S_OK or error.
- PCCOR_SIGNATURE pvSig, // [IN] TypeSpec Signature to define.
- ULONG cbSig, // [IN] Size of signature data.
- mdTypeSpec *ptypespec) PURE; // [OUT] returned TypeSpec token.
-
- STDMETHOD(SaveToMemory)( // S_OK or error.
- void *pbData, // [OUT] Location to write data.
- ULONG cbData) PURE; // [IN] Max size of data buffer.
-
- STDMETHOD(DefineUserString)( // Return code.
- LPCWSTR szString, // [IN] User literal string.
- ULONG cchString, // [IN] Length of string.
- mdString *pstk) PURE; // [OUT] String token.
-
- STDMETHOD(DeleteToken)( // Return code.
- mdToken tkObj) PURE; // [IN] The token to be deleted
-
- STDMETHOD(SetMethodProps)( // S_OK or error.
- mdMethodDef md, // [IN] The MethodDef.
- DWORD dwMethodFlags, // [IN] Method attributes.
- ULONG ulCodeRVA, // [IN] Code RVA.
- DWORD dwImplFlags) PURE; // [IN] Impl flags.
-
- STDMETHOD(SetTypeDefProps)( // S_OK or error.
- mdTypeDef td, // [IN] The TypeDef.
- DWORD dwTypeDefFlags, // [IN] TypeDef flags.
- mdToken tkExtends, // [IN] Base TypeDef or TypeRef.
- mdToken rtkImplements[]) PURE; // [IN] Implemented interfaces.
-
- STDMETHOD(SetEventProps)( // S_OK or error.
- mdEvent ev, // [IN] The event token.
- DWORD dwEventFlags, // [IN] CorEventAttr.
- mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class.
- mdMethodDef mdAddOn, // [IN] Add method.
- mdMethodDef mdRemoveOn, // [IN] Remove method.
- mdMethodDef mdFire, // [IN] Fire method.
- mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods associate with the event.
-
- STDMETHOD(SetPermissionSetProps)( // S_OK or error.
- mdToken tk, // [IN] The object to be decorated.
- DWORD dwAction, // [IN] CorDeclSecurity.
- void const *pvPermission, // [IN] Permission blob.
- ULONG cbPermission, // [IN] Count of bytes of pvPermission.
- mdPermission *ppm) PURE; // [OUT] Permission token.
-
- STDMETHOD(DefinePinvokeMap)( // Return code.
- mdToken tk, // [IN] FieldDef or MethodDef.
- DWORD dwMappingFlags, // [IN] Flags used for mapping.
- LPCWSTR szImportName, // [IN] Import name.
- mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
-
- STDMETHOD(SetPinvokeMap)( // Return code.
- mdToken tk, // [IN] FieldDef or MethodDef.
- DWORD dwMappingFlags, // [IN] Flags used for mapping.
- LPCWSTR szImportName, // [IN] Import name.
- mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
-
- STDMETHOD(DeletePinvokeMap)( // Return code.
- mdToken tk) PURE; // [IN] FieldDef or MethodDef.
-
- // New CustomAttribute functions.
- STDMETHOD(DefineCustomAttribute)( // Return code.
- mdToken tkOwner, // [IN] The object to put the value on.
- mdToken tkCtor, // [IN] Constructor of the CustomAttribute type (MemberRef/MethodDef).
- void const *pCustomAttribute, // [IN] The custom value data.
- ULONG cbCustomAttribute, // [IN] The custom value data length.
- mdCustomAttribute *pcv) PURE; // [OUT] The custom value token value on return.
-
- STDMETHOD(SetCustomAttributeValue)( // Return code.
- mdCustomAttribute pcv, // [IN] The custom value token whose value to replace.
- void const *pCustomAttribute, // [IN] The custom value data.
- ULONG cbCustomAttribute) PURE;// [IN] The custom value data length.
-
- STDMETHOD(DefineField)( // S_OK or error.
- mdTypeDef td, // Parent TypeDef
- LPCWSTR szName, // Name of member
- DWORD dwFieldFlags, // Member attributes
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
- void const *pValue, // [IN] constant value
- ULONG cchValue, // [IN] size of constant value (string, in wide chars).
- mdFieldDef *pmd) PURE; // [OUT] Put member token here
-
- STDMETHOD(DefineProperty)(
- mdTypeDef td, // [IN] the class/interface on which the property is being defined
- LPCWSTR szProperty, // [IN] Name of the property
- DWORD dwPropFlags, // [IN] CorPropertyAttr
- PCCOR_SIGNATURE pvSig, // [IN] the required type signature
- ULONG cbSig, // [IN] the size of the type signature blob
- DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
- void const *pValue, // [IN] constant value
- ULONG cchValue, // [IN] size of constant value (string, in wide chars).
- mdMethodDef mdSetter, // [IN] optional setter of the property
- mdMethodDef mdGetter, // [IN] optional getter of the property
- mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods
- mdProperty *pmdProp) PURE; // [OUT] output property token
-
- STDMETHOD(DefineParam)(
- mdMethodDef md, // [IN] Owning method
- ULONG ulParamSeq, // [IN] Which param
- LPCWSTR szName, // [IN] Optional param name
- DWORD dwParamFlags, // [IN] Optional param flags
- DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
- void const *pValue, // [IN] constant value
- ULONG cchValue, // [IN] size of constant value (string, in wide chars).
- mdParamDef *ppd) PURE; // [OUT] Put param token here
-
- STDMETHOD(SetFieldProps)( // S_OK or error.
- mdFieldDef fd, // [IN] The FieldDef.
- DWORD dwFieldFlags, // [IN] Field attributes.
- DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_*
- void const *pValue, // [IN] Constant value.
- ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
-
- STDMETHOD(SetPropertyProps)( // S_OK or error.
- mdProperty pr, // [IN] Property token.
- DWORD dwPropFlags, // [IN] CorPropertyAttr.
- DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_*
- void const *pValue, // [IN] Constant value.
- ULONG cchValue, // [IN] size of constant value (string, in wide chars).
- mdMethodDef mdSetter, // [IN] Setter of the property.
- mdMethodDef mdGetter, // [IN] Getter of the property.
- mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods.
-
- STDMETHOD(SetParamProps)( // Return code.
- mdParamDef pd, // [IN] Param token.
- LPCWSTR szName, // [IN] Param name.
- DWORD dwParamFlags, // [IN] Param flags.
- DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*.
- void const *pValue, // [OUT] Constant value.
- ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
-
- // Specialized Custom Attributes for security.
- STDMETHOD(DefineSecurityAttributeSet)( // Return code.
- mdToken tkObj, // [IN] Class or method requiring security attributes.
- COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions.
- ULONG cSecAttrs, // [IN] Count of elements in above array.
- ULONG *pulErrorAttr) PURE; // [OUT] On error, index of attribute causing problem.
-
- STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
- IUnknown *pImport) PURE; // [IN] Metadata from the delta PE.
-
- STDMETHOD(TranslateSigWithScope)(
- IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
- const void *pbHashValue, // [IN] Hash Blob for Assembly.
- ULONG cbHashValue, // [IN] Count of bytes.
- IMetaDataImport *import, // [IN] importing interface
- PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
- ULONG cbSigBlob, // [IN] count of bytes of signature
- IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
- IMetaDataEmit *emit, // [IN] emit interface
- PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
- ULONG cbTranslatedSigMax,
- ULONG *pcbTranslatedSig) PURE;// [OUT] count of bytes in the translated signature
-
- STDMETHOD(SetMethodImplFlags)( // [IN] S_OK or error.
- mdMethodDef md, // [IN] Method for which to set ImplFlags
- DWORD dwImplFlags) PURE;
-
- STDMETHOD(SetFieldRVA)( // [IN] S_OK or error.
- mdFieldDef fd, // [IN] Field for which to set offset
- ULONG ulRVA) PURE; // [IN] The offset
-
- STDMETHOD(Merge)( // S_OK or error.
- IMetaDataImport *pImport, // [IN] The scope to be merged.
- IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
- IUnknown *pHandler) PURE; // [IN] An object to receive to receive error notification.
-
- STDMETHOD(MergeEnd)() PURE; // S_OK or error.
-
- // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
-
-}; // IMetaDataEmit
-
-//-------------------------------------
-//--- IMetaDataEmit2
-//-------------------------------------
-// {F5DD9950-F693-42e6-830E-7B833E8146A9}
-EXTERN_GUID(IID_IMetaDataEmit2, 0xf5dd9950, 0xf693, 0x42e6, 0x83, 0xe, 0x7b, 0x83, 0x3e, 0x81, 0x46, 0xa9);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataEmit2
-DECLARE_INTERFACE_(IMetaDataEmit2, IMetaDataEmit)
-{
- STDMETHOD(DefineMethodSpec)(
- mdToken tkParent, // [IN] MethodDef or MemberRef
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdMethodSpec *pmi) PURE; // [OUT] method instantiation token
-
- STDMETHOD(GetDeltaSaveSize)( // S_OK or error.
- CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
- DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
-
- STDMETHOD(SaveDelta)( // S_OK or error.
- LPCWSTR szFile, // [IN] The filename to save to.
- DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
-
- STDMETHOD(SaveDeltaToStream)( // S_OK or error.
- IStream *pIStream, // [IN] A writable stream to save to.
- DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
-
- STDMETHOD(SaveDeltaToMemory)( // S_OK or error.
- void *pbData, // [OUT] Location to write data.
- ULONG cbData) PURE; // [IN] Max size of data buffer.
-
- STDMETHOD(DefineGenericParam)( // S_OK or error.
- mdToken tk, // [IN] TypeDef or MethodDef
- ULONG ulParamSeq, // [IN] Index of the type parameter
- DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
- LPCWSTR szname, // [IN] Name
- DWORD reserved, // [IN] For future use (e.g. non-type parameters)
- mdToken rtkConstraints[], // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
- mdGenericParam *pgp) PURE; // [OUT] Put GenericParam token here
-
- STDMETHOD(SetGenericParamProps)( // S_OK or error.
- mdGenericParam gp, // [IN] GenericParam
- DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
- LPCWSTR szName, // [IN] Optional name
- DWORD reserved, // [IN] For future use (e.g. non-type parameters)
- mdToken rtkConstraints[]) PURE;// [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
-
- STDMETHOD(ResetENCLog)() PURE; // S_OK or error.
-
-};
-
-//-------------------------------------
-//--- IMetaDataImport
-//-------------------------------------
-// {7DAC8207-D3AE-4c75-9B67-92801A497D44}
-EXTERN_GUID(IID_IMetaDataImport, 0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataImport
-DECLARE_INTERFACE_(IMetaDataImport, IUnknown)
-{
- STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
- STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
- STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
- STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
- ULONG cMax, ULONG *pcTypeDefs) PURE;
- STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td,
- mdInterfaceImpl rImpls[], ULONG cMax,
- ULONG* pcImpls) PURE;
- STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
- ULONG cMax, ULONG* pcTypeRefs) PURE;
-
- STDMETHOD(FindTypeDefByName)( // S_OK or error.
- LPCWSTR szTypeDef, // [IN] Name of the Type.
- mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
- mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
-
- STDMETHOD(GetScopeProps)( // S_OK or error.
- _Out_writes_to_opt_(cchName, *pchName)
- LPWSTR szName, // [OUT] Put the name here.
- ULONG cchName, // [IN] Size of name buffer in wide chars.
- ULONG *pchName, // [OUT] Put size of name (wide chars) here.
- GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
-
- STDMETHOD(GetModuleFromScope)( // S_OK.
- mdModule *pmd) PURE; // [OUT] Put mdModule token here.
-
- STDMETHOD(GetTypeDefProps)( // S_OK or error.
- mdTypeDef td, // [IN] TypeDef token for inquiry.
- _Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
- LPWSTR szTypeDef, // [OUT] Put name here.
- ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
- ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
- DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
- mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
-
- STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
- mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
- mdTypeDef *pClass, // [OUT] Put implementing class token here.
- mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
-
- STDMETHOD(GetTypeRefProps)( // S_OK or error.
- mdTypeRef tr, // [IN] TypeRef token.
- mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
- _Out_writes_to_opt_(cchName, *pchName)
- LPWSTR szName, // [OUT] Name of the TypeRef.
- ULONG cchName, // [IN] Size of buffer.
- ULONG *pchName) PURE; // [OUT] Size of Name.
-
- STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
-
- STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- mdToken rMembers[], // [OUT] Put MemberDefs here.
- ULONG cMax, // [IN] Max MemberDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- LPCWSTR szName, // [IN] Limit results to those with this name.
- mdToken rMembers[], // [OUT] Put MemberDefs here.
- ULONG cMax, // [IN] Max MemberDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
- ULONG cMax, // [IN] Max MethodDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- LPCWSTR szName, // [IN] Limit results to those with this name.
- mdMethodDef rMethods[], // [OU] Put MethodDefs here.
- ULONG cMax, // [IN] Max MethodDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- mdFieldDef rFields[], // [OUT] Put FieldDefs here.
- ULONG cMax, // [IN] Max FieldDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
- LPCWSTR szName, // [IN] Limit results to those with this name.
- mdFieldDef rFields[], // [OUT] Put MemberDefs here.
- ULONG cMax, // [IN] Max MemberDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
-
- STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
- mdParamDef rParams[], // [OUT] Put ParamDefs here.
- ULONG cMax, // [IN] Max ParamDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdToken tkParent, // [IN] Parent token to scope the enumeration.
- mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
- ULONG cMax, // [IN] Max MemberRefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef td, // [IN] TypeDef to scope the enumeration.
- mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
- mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
- ULONG cMax, // [IN] Max tokens to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdToken tk, // [IN] if !NIL, token to scope the enumeration.
- DWORD dwActions, // [IN] if !0, return only these actions.
- mdPermission rPermission[], // [OUT] Put Permissions here.
- ULONG cMax, // [IN] Max Permissions to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(FindMember)(
- mdTypeDef td, // [IN] given typedef
- LPCWSTR szName, // [IN] member name
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdToken *pmb) PURE; // [OUT] matching memberdef
-
- STDMETHOD(FindMethod)(
- mdTypeDef td, // [IN] given typedef
- LPCWSTR szName, // [IN] member name
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdMethodDef *pmb) PURE; // [OUT] matching memberdef
-
- STDMETHOD(FindField)(
- mdTypeDef td, // [IN] given typedef
- LPCWSTR szName, // [IN] member name
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdFieldDef *pmb) PURE; // [OUT] matching memberdef
-
- STDMETHOD(FindMemberRef)(
- mdTypeRef td, // [IN] given typeRef
- LPCWSTR szName, // [IN] member name
- PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
- ULONG cbSigBlob, // [IN] count of bytes in the signature blob
- mdMemberRef *pmr) PURE; // [OUT] matching memberref
-
- STDMETHOD (GetMethodProps)(
- mdMethodDef mb, // The method for which to get props.
- mdTypeDef *pClass, // Put method's class here.
- _Out_writes_to_opt_(cchMethod, *pchMethod)
- LPWSTR szMethod, // Put method's name here.
- ULONG cchMethod, // Size of szMethod buffer in wide chars.
- ULONG *pchMethod, // Put actual size here
- DWORD *pdwAttr, // Put flags here.
- PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
- ULONG *pcbSigBlob, // [OUT] actual size of signature blob
- ULONG *pulCodeRVA, // [OUT] codeRVA
- DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
-
- STDMETHOD(GetMemberRefProps)( // S_OK or error.
- mdMemberRef mr, // [IN] given memberref
- mdToken *ptk, // [OUT] Put classref or classdef here.
- _Out_writes_to_opt_(cchMember, *pchMember)
- LPWSTR szMember, // [OUT] buffer to fill for member's name
- ULONG cchMember, // [IN] the count of char of szMember
- ULONG *pchMember, // [OUT] actual count of char in member name
- PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
- ULONG *pbSig) PURE; // [OUT] actual size of signature blob
-
- STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef td, // [IN] TypeDef to scope the enumeration.
- mdProperty rProperties[], // [OUT] Put Properties here.
- ULONG cMax, // [IN] Max properties to put.
- ULONG *pcProperties) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdTypeDef td, // [IN] TypeDef to scope the enumeration.
- mdEvent rEvents[], // [OUT] Put events here.
- ULONG cMax, // [IN] Max events to put.
- ULONG *pcEvents) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
- mdEvent ev, // [IN] event token
- mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
- LPCWSTR szEvent, // [OUT] Event name
- ULONG cchEvent, // [IN] the count of wchar of szEvent
- ULONG *pchEvent, // [OUT] actual count of wchar for event's name
- DWORD *pdwEventFlags, // [OUT] Event flags.
- mdToken *ptkEventType, // [OUT] EventType class
- mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
- mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
- mdMethodDef *pmdFire, // [OUT] Fire method of the event
- mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
- ULONG cMax, // [IN] size of rmdOtherMethod
- ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
-
- STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
- mdToken rEventProp[], // [OUT] Put Event/Property here.
- ULONG cMax, // [IN] Max properties to put.
- ULONG *pcEventProp) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
- mdMethodDef mb, // [IN] method token
- mdToken tkEventProp, // [IN] event/property token.
- DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
-
- STDMETHOD(GetClassLayout) (
- mdTypeDef td, // [IN] give typedef
- DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
- COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
- ULONG cMax, // [IN] size of the array
- ULONG *pcFieldOffset, // [OUT] needed array size
- ULONG *pulClassSize) PURE; // [OUT] the size of the class
-
- STDMETHOD(GetFieldMarshal) (
- mdToken tk, // [IN] given a field's memberdef
- PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
- ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
-
- STDMETHOD(GetRVA)( // S_OK or error.
- mdToken tk, // Member for which to set offset
- ULONG *pulCodeRVA, // The offset
- DWORD *pdwImplFlags) PURE; // the implementation flags
-
- STDMETHOD(GetPermissionSetProps) (
- mdPermission pm, // [IN] the permission token.
- DWORD *pdwAction, // [OUT] CorDeclSecurity.
- void const **ppvPermission, // [OUT] permission blob.
- ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
-
- STDMETHOD(GetSigFromToken)( // S_OK or error.
- mdSignature mdSig, // [IN] Signature token.
- PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
- ULONG *pcbSig) PURE; // [OUT] return size of signature.
-
- STDMETHOD(GetModuleRefProps)( // S_OK or error.
- mdModuleRef mur, // [IN] moduleref token.
- _Out_writes_to_opt_(cchName, *pchName)
- LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
- ULONG cchName, // [IN] size of szName in wide characters.
- ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
-
- STDMETHOD(EnumModuleRefs)( // S_OK or error.
- HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
- mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
- ULONG cmax, // [IN] max memberrefs to put.
- ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
-
- STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
- mdTypeSpec typespec, // [IN] TypeSpec token.
- PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
- ULONG *pcbSig) PURE; // [OUT] return size of signature.
-
- STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
- mdToken tk, // [IN] Token to get name from. Must have a name.
- MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
-
- STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdToken rMethods[], // [OUT] Put MemberDefs here.
- ULONG cMax, // [IN] Max MemberDefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetUserString)( // S_OK or error.
- mdString stk, // [IN] String token.
- _Out_writes_to_opt_(cchString, *pchString)
- LPWSTR szString, // [OUT] Copy of string.
- ULONG cchString, // [IN] Max chars of room in szString.
- ULONG *pchString) PURE; // [OUT] How many chars in actual string.
-
- STDMETHOD(GetPinvokeMap)( // S_OK or error.
- mdToken tk, // [IN] FieldDef or MethodDef.
- DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
- _Out_writes_to_opt_(cchImportName, *pchImportName)
- LPWSTR szImportName, // [OUT] Import name.
- ULONG cchImportName, // [IN] Size of the name buffer.
- ULONG *pchImportName, // [OUT] Actual number of characters stored.
- mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
-
- STDMETHOD(EnumSignatures)( // S_OK or error.
- HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
- mdSignature rSignatures[], // [OUT] put signatures here.
- ULONG cmax, // [IN] max signatures to put.
- ULONG *pcSignatures) PURE; // [OUT] put # put here.
-
- STDMETHOD(EnumTypeSpecs)( // S_OK or error.
- HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
- mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
- ULONG cmax, // [IN] max TypeSpecs to put.
- ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
-
- STDMETHOD(EnumUserStrings)( // S_OK or error.
- HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
- mdString rStrings[], // [OUT] put Strings here.
- ULONG cmax, // [IN] max Strings to put.
- ULONG *pcStrings) PURE; // [OUT] put # put here.
-
- STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
- mdMethodDef md, // [IN] Method token.
- ULONG ulParamSeq, // [IN] Parameter sequence.
- mdParamDef *ppd) PURE; // [IN] Put Param token here.
-
- STDMETHOD(EnumCustomAttributes)( // S_OK or error.
- HCORENUM *phEnum, // [IN, OUT] COR enumerator.
- mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
- mdToken tkType, // [IN] Type of interest, 0 for all.
- mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
- ULONG cMax, // [IN] Size of rCustomAttributes.
- ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
-
- STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
- mdCustomAttribute cv, // [IN] CustomAttribute token.
- mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
- mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
- void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
- ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
-
- STDMETHOD(FindTypeRef)(
- mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
- LPCWSTR szName, // [IN] TypeRef Name.
- mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
-
- STDMETHOD(GetMemberProps)(
- mdToken mb, // The member for which to get props.
- mdTypeDef *pClass, // Put member's class here.
- _Out_writes_to_opt_(cchMember, *pchMember)
- LPWSTR szMember, // Put member's name here.
- ULONG cchMember, // Size of szMember buffer in wide chars.
- ULONG *pchMember, // Put actual size here
- DWORD *pdwAttr, // Put flags here.
- PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
- ULONG *pcbSigBlob, // [OUT] actual size of signature blob
- ULONG *pulCodeRVA, // [OUT] codeRVA
- DWORD *pdwImplFlags, // [OUT] Impl. Flags
- DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
- UVCP_CONSTANT *ppValue, // [OUT] constant value
- ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
-
- STDMETHOD(GetFieldProps)(
- mdFieldDef mb, // The field for which to get props.
- mdTypeDef *pClass, // Put field's class here.
- _Out_writes_to_opt_(cchField, *pchField)
- LPWSTR szField, // Put field's name here.
- ULONG cchField, // Size of szField buffer in wide chars.
- ULONG *pchField, // Put actual size here
- DWORD *pdwAttr, // Put flags here.
- PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
- ULONG *pcbSigBlob, // [OUT] actual size of signature blob
- DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
- UVCP_CONSTANT *ppValue, // [OUT] constant value
- ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
-
- STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
- mdProperty prop, // [IN] property token
- mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
- LPCWSTR szProperty, // [OUT] Property name
- ULONG cchProperty, // [IN] the count of wchar of szProperty
- ULONG *pchProperty, // [OUT] actual count of wchar for property name
- DWORD *pdwPropFlags, // [OUT] property flags.
- PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
- ULONG *pbSig, // [OUT] count of bytes in *ppvSig
- DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
- UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
- ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
- mdMethodDef *pmdSetter, // [OUT] setter method of the property
- mdMethodDef *pmdGetter, // [OUT] getter method of the property
- mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
- ULONG cMax, // [IN] size of rmdOtherMethod
- ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
-
- STDMETHOD(GetParamProps)( // S_OK or error.
- mdParamDef tk, // [IN]The Parameter.
- mdMethodDef *pmd, // [OUT] Parent Method token.
- ULONG *pulSequence, // [OUT] Parameter sequence.
- _Out_writes_to_opt_(cchName, *pchName)
- LPWSTR szName, // [OUT] Put name here.
- ULONG cchName, // [OUT] Size of name buffer.
- ULONG *pchName, // [OUT] Put actual size of name here.
- DWORD *pdwAttr, // [OUT] Put flags here.
- DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
- UVCP_CONSTANT *ppValue, // [OUT] Constant value.
- ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
-
- STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
- mdToken tkObj, // [IN] Object with Custom Attribute.
- LPCWSTR szName, // [IN] Name of desired Custom Attribute.
- const void **ppData, // [OUT] Put pointer to data here.
- ULONG *pcbData) PURE; // [OUT] Put size of data here.
-
- STDMETHOD_(BOOL, IsValidToken)( // True or False.
- mdToken tk) PURE; // [IN] Given token.
-
- STDMETHOD(GetNestedClassProps)( // S_OK or error.
- mdTypeDef tdNestedClass, // [IN] NestedClass token.
- mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
-
- STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
- void const *pvSig, // [IN] Pointer to signature.
- ULONG cbSig, // [IN] Count of signature bytes.
- ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
-
- STDMETHOD(IsGlobal)( // S_OK or error.
- mdToken pd, // [IN] Type, Field, or Method token.
- int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
-
- // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
-
-}; // IMetaDataImport
-
-//-------------------------------------
-//--- IMetaDataImport2
-//-------------------------------------
-// {FCE5EFA0-8BBA-4f8e-A036-8F2022B08466}
-EXTERN_GUID(IID_IMetaDataImport2, 0xfce5efa0, 0x8bba, 0x4f8e, 0xa0, 0x36, 0x8f, 0x20, 0x22, 0xb0, 0x84, 0x66);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataImport2
-DECLARE_INTERFACE_(IMetaDataImport2, IMetaDataImport)
-{
- STDMETHOD(EnumGenericParams)(
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
- mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
- ULONG cMax, // [IN] Max GenericParams to put.
- ULONG *pcGenericParams) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetGenericParamProps)( // S_OK or error.
- mdGenericParam gp, // [IN] GenericParam
- ULONG *pulParamSeq, // [OUT] Index of the type parameter
- DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
- mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
- DWORD *reserved, // [OUT] For future use (e.g. non-type parameters)
- _Out_writes_to_opt_(cchName, *pchName)
- LPWSTR wzname, // [OUT] Put name here
- ULONG cchName, // [IN] Size of buffer
- ULONG *pchName) PURE; // [OUT] Put size of name (wide chars) here.
-
- STDMETHOD(GetMethodSpecProps)(
- mdMethodSpec mi, // [IN] The method instantiation
- mdToken *tkParent, // [OUT] MethodDef or MemberRef
- PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
- ULONG *pcbSigBlob) PURE; // [OUT] actual size of signature blob
-
- STDMETHOD(EnumGenericParamConstraints)(
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdGenericParam tk, // [IN] GenericParam whose constraints are requested
- mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
- ULONG cMax, // [IN] Max GenericParamConstraints to put.
- ULONG *pcGenericParamConstraints) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error.
- mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
- mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
- mdToken *ptkConstraintType) PURE; // [OUT] TypeDef/Ref/Spec constraint
-
- STDMETHOD(GetPEKind)( // S_OK or error.
- DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
- DWORD* pdwMAchine) PURE; // [OUT] Machine as defined in NT header
-
- STDMETHOD(GetVersionString)( // S_OK or error.
- _Out_writes_to_opt_(ccBufSize, *pccBufSize)
- LPWSTR pwzBuf, // [OUT] Put version string here.
- DWORD ccBufSize, // [IN] size of the buffer, in wide chars
- DWORD *pccBufSize) PURE; // [OUT] Size of the version string, wide chars, including terminating nul.
-
- STDMETHOD(EnumMethodSpecs)(
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
- mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
- ULONG cMax, // [IN] Max tokens to put.
- ULONG *pcMethodSpecs) PURE; // [OUT] Put actual count here.
-
-}; // IMetaDataImport2
-
-//-------------------------------------
-//--- IMetaDataFilter
-//-------------------------------------
-// {D0E80DD1-12D4-11d3-B39D-00C04FF81795}
-EXTERN_GUID(IID_IMetaDataFilter, 0xd0e80dd1, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataFilter
-DECLARE_INTERFACE_(IMetaDataFilter, IUnknown)
-{
- STDMETHOD(UnmarkAll)() PURE;
- STDMETHOD(MarkToken)(mdToken tk) PURE;
- STDMETHOD(IsTokenMarked)(mdToken tk, BOOL *pIsMarked) PURE;
-};
-
-
-//-------------------------------------
-//--- IHostFilter
-//-------------------------------------
-// {D0E80DD3-12D4-11d3-B39D-00C04FF81795}
-EXTERN_GUID(IID_IHostFilter, 0xd0e80dd3, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
-
-//---
-#undef INTERFACE
-#define INTERFACE IHostFilter
-DECLARE_INTERFACE_(IHostFilter, IUnknown)
-{
- STDMETHOD(MarkToken)(mdToken tk) PURE;
-};
-
-
-//*****************************************************************************
-// Assembly Declarations
-//*****************************************************************************
-
-typedef struct
-{
- DWORD dwOSPlatformId; // Operating system platform.
- DWORD dwOSMajorVersion; // OS Major version.
- DWORD dwOSMinorVersion; // OS Minor version.
-} OSINFO;
-
-
-typedef struct
-{
- USHORT usMajorVersion; // Major Version.
- USHORT usMinorVersion; // Minor Version.
- USHORT usBuildNumber; // Build Number.
- USHORT usRevisionNumber; // Revision Number.
- LPWSTR szLocale; // Locale.
- ULONG cbLocale; // [IN/OUT] Size of the buffer in wide chars/Actual size.
- DWORD *rProcessor; // Processor ID array.
- ULONG ulProcessor; // [IN/OUT] Size of the Processor ID array/Actual # of entries filled in.
- OSINFO *rOS; // OSINFO array.
- ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
-} ASSEMBLYMETADATA;
-
-
-// {211EF15B-5317-4438-B196-DEC87B887693}
-EXTERN_GUID(IID_IMetaDataAssemblyEmit, 0x211ef15b, 0x5317, 0x4438, 0xb1, 0x96, 0xde, 0xc8, 0x7b, 0x88, 0x76, 0x93);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataAssemblyEmit
-DECLARE_INTERFACE_(IMetaDataAssemblyEmit, IUnknown)
-{
- STDMETHOD(DefineAssembly)( // S_OK or error.
- const void *pbPublicKey, // [IN] Public key of the assembly.
- ULONG cbPublicKey, // [IN] Count of bytes in the public key.
- ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
- LPCWSTR szName, // [IN] Name of the assembly.
- const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
- DWORD dwAssemblyFlags, // [IN] Flags.
- mdAssembly *pma) PURE; // [OUT] Returned Assembly token.
-
- STDMETHOD(DefineAssemblyRef)( // S_OK or error.
- const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
- ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
- LPCWSTR szName, // [IN] Name of the assembly being referenced.
- const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
- const void *pbHashValue, // [IN] Hash Blob.
- ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
- DWORD dwAssemblyRefFlags, // [IN] Flags.
- mdAssemblyRef *pmdar) PURE; // [OUT] Returned AssemblyRef token.
-
- STDMETHOD(DefineFile)( // S_OK or error.
- LPCWSTR szName, // [IN] Name of the file.
- const void *pbHashValue, // [IN] Hash Blob.
- ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
- DWORD dwFileFlags, // [IN] Flags.
- mdFile *pmdf) PURE; // [OUT] Returned File token.
-
- STDMETHOD(DefineExportedType)( // S_OK or error.
- LPCWSTR szName, // [IN] Name of the Com Type.
- mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType
- mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
- DWORD dwExportedTypeFlags, // [IN] Flags.
- mdExportedType *pmdct) PURE; // [OUT] Returned ExportedType token.
-
- STDMETHOD(DefineManifestResource)( // S_OK or error.
- LPCWSTR szName, // [IN] Name of the resource.
- mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
- DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
- DWORD dwResourceFlags, // [IN] Flags.
- mdManifestResource *pmdmr) PURE; // [OUT] Returned ManifestResource token.
-
- STDMETHOD(SetAssemblyProps)( // S_OK or error.
- mdAssembly pma, // [IN] Assembly token.
- const void *pbPublicKey, // [IN] Public key of the assembly.
- ULONG cbPublicKey, // [IN] Count of bytes in the public key.
- ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
- LPCWSTR szName, // [IN] Name of the assembly.
- const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
- DWORD dwAssemblyFlags) PURE; // [IN] Flags.
-
- STDMETHOD(SetAssemblyRefProps)( // S_OK or error.
- mdAssemblyRef ar, // [IN] AssemblyRefToken.
- const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
- ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
- LPCWSTR szName, // [IN] Name of the assembly being referenced.
- const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
- const void *pbHashValue, // [IN] Hash Blob.
- ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
- DWORD dwAssemblyRefFlags) PURE; // [IN] Token for Execution Location.
-
- STDMETHOD(SetFileProps)( // S_OK or error.
- mdFile file, // [IN] File token.
- const void *pbHashValue, // [IN] Hash Blob.
- ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
- DWORD dwFileFlags) PURE; // [IN] Flags.
-
- STDMETHOD(SetExportedTypeProps)( // S_OK or error.
- mdExportedType ct, // [IN] ExportedType token.
- mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType.
- mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
- DWORD dwExportedTypeFlags) PURE; // [IN] Flags.
-
- STDMETHOD(SetManifestResourceProps)( // S_OK or error.
- mdManifestResource mr, // [IN] ManifestResource token.
- mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
- DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
- DWORD dwResourceFlags) PURE; // [IN] Flags.
-
-}; // IMetaDataAssemblyEmit
-
-
-// {EE62470B-E94B-424e-9B7C-2F00C9249F93}
-EXTERN_GUID(IID_IMetaDataAssemblyImport, 0xee62470b, 0xe94b, 0x424e, 0x9b, 0x7c, 0x2f, 0x0, 0xc9, 0x24, 0x9f, 0x93);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataAssemblyImport
-DECLARE_INTERFACE_(IMetaDataAssemblyImport, IUnknown)
-{
- STDMETHOD(GetAssemblyProps)( // S_OK or error.
- mdAssembly mda, // [IN] The Assembly for which to get the properties.
- const void **ppbPublicKey, // [OUT] Pointer to the public key.
- ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
- ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
- _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name.
- ULONG cchName, // [IN] Size of buffer in wide chars.
- ULONG *pchName, // [OUT] Actual # of wide chars in name.
- ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
- DWORD *pdwAssemblyFlags) PURE; // [OUT] Flags.
-
- STDMETHOD(GetAssemblyRefProps)( // S_OK or error.
- mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
- const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
- ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
- _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
- ULONG cchName, // [IN] Size of buffer in wide chars.
- ULONG *pchName, // [OUT] Actual # of wide chars in name.
- ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
- const void **ppbHashValue, // [OUT] Hash blob.
- ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
- DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
-
- STDMETHOD(GetFileProps)( // S_OK or error.
- mdFile mdf, // [IN] The File for which to get the properties.
- _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
- ULONG cchName, // [IN] Size of buffer in wide chars.
- ULONG *pchName, // [OUT] Actual # of wide chars in name.
- const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
- ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
- DWORD *pdwFileFlags) PURE; // [OUT] Flags.
-
- STDMETHOD(GetExportedTypeProps)( // S_OK or error.
- mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
- _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
- ULONG cchName, // [IN] Size of buffer in wide chars.
- ULONG *pchName, // [OUT] Actual # of wide chars in name.
- mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
- mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
- DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
-
- STDMETHOD(GetManifestResourceProps)( // S_OK or error.
- mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
- _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
- ULONG cchName, // [IN] Size of buffer in wide chars.
- ULONG *pchName, // [OUT] Actual # of wide chars in name.
- mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
- DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
- DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
-
- STDMETHOD(EnumAssemblyRefs)( // S_OK or error
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
- ULONG cMax, // [IN] Max AssemblyRefs to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumFiles)( // S_OK or error
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdFile rFiles[], // [OUT] Put Files here.
- ULONG cMax, // [IN] Max Files to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumExportedTypes)( // S_OK or error
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
- ULONG cMax, // [IN] Max ExportedTypes to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(EnumManifestResources)( // S_OK or error
- HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
- mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
- ULONG cMax, // [IN] Max Resources to put.
- ULONG *pcTokens) PURE; // [OUT] Put # put here.
-
- STDMETHOD(GetAssemblyFromScope)( // S_OK or error
- mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
-
- STDMETHOD(FindExportedTypeByName)( // S_OK or error
- LPCWSTR szName, // [IN] Name of the ExportedType.
- mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
- mdExportedType *ptkExportedType) PURE; // [OUT] Put the ExportedType token here.
-
- STDMETHOD(FindManifestResourceByName)( // S_OK or error
- LPCWSTR szName, // [IN] Name of the ManifestResource.
- mdManifestResource *ptkManifestResource) PURE; // [OUT] Put the ManifestResource token here.
-
- STDMETHOD_(void, CloseEnum)(
- HCORENUM hEnum) PURE; // Enum to be closed.
-
- STDMETHOD(FindAssembliesByName)( // S_OK or error
- LPCWSTR szAppBase, // [IN] optional - can be NULL
- LPCWSTR szPrivateBin, // [IN] optional - can be NULL
- LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
- IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
- ULONG cMax, // [IN] The max number to put
- ULONG *pcAssemblies) PURE; // [OUT] The number of assemblies returned.
-}; // IMetaDataAssemblyImport
-
-
-//*****************************************************************************
-// End Assembly Declarations
-//*****************************************************************************
-
-//*****************************************************************************
-// MetaData Validator Declarations
-//*****************************************************************************
-
-// Specifies the type of the module, PE file vs. .obj file.
-typedef enum
-{
- ValidatorModuleTypeInvalid = 0x0,
- ValidatorModuleTypeMin = 0x00000001,
- ValidatorModuleTypePE = 0x00000001,
- ValidatorModuleTypeObj = 0x00000002,
- ValidatorModuleTypeEnc = 0x00000003,
- ValidatorModuleTypeIncr = 0x00000004,
- ValidatorModuleTypeMax = 0x00000004,
-} CorValidatorModuleType;
-
-
-// {4709C9C6-81FF-11D3-9FC7-00C04F79A0A3}
-EXTERN_GUID(IID_IMetaDataValidate, 0x4709c9c6, 0x81ff, 0x11d3, 0x9f, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataValidate
-DECLARE_INTERFACE_(IMetaDataValidate, IUnknown)
-{
- STDMETHOD(ValidatorInit)( // S_OK or error.
- DWORD dwModuleType, // [IN] Specifies the type of the module.
- IUnknown *pUnk) PURE; // [IN] Validation error handler.
-
- STDMETHOD(ValidateMetaData)( // S_OK or error.
- ) PURE;
-}; // IMetaDataValidate
-
-//*****************************************************************************
-// End MetaData Validator Declarations
-//*****************************************************************************
-
-//*****************************************************************************
-// IMetaDataDispenserEx declarations.
-//*****************************************************************************
-
-// {31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3}
-EXTERN_GUID(IID_IMetaDataDispenserEx, 0x31bcfce2, 0xdafb, 0x11d2, 0x9f, 0x81, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
-
-#undef INTERFACE
-#define INTERFACE IMetaDataDispenserEx
-DECLARE_INTERFACE_(IMetaDataDispenserEx, IMetaDataDispenser)
-{
- STDMETHOD(SetOption)( // Return code.
- REFGUID optionid, // [in] GUID for the option to be set.
- const VARIANT *value) PURE; // [in] Value to which the option is to be set.
-
- STDMETHOD(GetOption)( // Return code.
- REFGUID optionid, // [in] GUID for the option to be set.
- VARIANT *pvalue) PURE; // [out] Value to which the option is currently set.
-
- STDMETHOD(OpenScopeOnITypeInfo)( // Return code.
- ITypeInfo *pITI, // [in] ITypeInfo to open.
- DWORD dwOpenFlags, // [in] Open mode flags.
- REFIID riid, // [in] The interface desired.
- IUnknown **ppIUnk) PURE; // [out] Return interface on success.
-
- STDMETHOD(GetCORSystemDirectory)( // Return code.
- _Out_writes_to_opt_(cchBuffer, *pchBuffer)
- LPWSTR szBuffer, // [out] Buffer for the directory name
- DWORD cchBuffer, // [in] Size of the buffer
- DWORD* pchBuffer) PURE; // [OUT] Number of characters returned
-
- STDMETHOD(FindAssembly)( // S_OK or error
- LPCWSTR szAppBase, // [IN] optional - can be NULL
- LPCWSTR szPrivateBin, // [IN] optional - can be NULL
- LPCWSTR szGlobalBin, // [IN] optional - can be NULL
- LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
- LPCWSTR szName, // [OUT] buffer - to hold name
- ULONG cchName, // [IN] the name buffer's size
- ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
-
- STDMETHOD(FindAssemblyModule)( // S_OK or error
- LPCWSTR szAppBase, // [IN] optional - can be NULL
- LPCWSTR szPrivateBin, // [IN] optional - can be NULL
- LPCWSTR szGlobalBin, // [IN] optional - can be NULL
- LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
- LPCWSTR szModuleName, // [IN] required - the name of the module
- _Out_writes_to_opt_(cchName, *pcName)
- LPWSTR szName, // [OUT] buffer - to hold name
- ULONG cchName, // [IN] the name buffer's size
- ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
-
-};
-
-//*****************************************************************************
-//*****************************************************************************
-//
-// Registration declarations. Will be replace by Services' Registration
-// implementation.
-//
-//*****************************************************************************
-//*****************************************************************************
-// Various flags for use in installing a module or a composite
-typedef enum
-{
- regNoCopy = 0x00000001, // Don't copy files into destination
- regConfig = 0x00000002, // Is a configuration
- regHasRefs = 0x00000004 // Has class references
-} CorRegFlags;
-
-typedef GUID CVID;
-
-typedef struct {
- short Major;
- short Minor;
- short Sub;
- short Build;
-} CVStruct;
-
-
-//*****************************************************************************
-//*****************************************************************************
-//
-// CeeGen interfaces for generating in-memory Common Language Runtime files
-//
-//*****************************************************************************
-//*****************************************************************************
-
-typedef void *HCEESECTION;
-
-typedef enum {
- sdNone = 0,
- sdReadOnly = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA,
- sdReadWrite = sdReadOnly | IMAGE_SCN_MEM_WRITE,
- sdExecute = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE
-} CeeSectionAttr;
-
-//
-// Relocation types.
-//
-
-typedef enum {
- // generate only a section-relative reloc, nothing into .reloc section
- srRelocAbsolute,
-
- // generate a .reloc for a pointer sized location,
- // This is transformed into BASED_HIGHLOW or BASED_DIR64 based on the platform
- srRelocHighLow = 3,
-
- // generate a .reloc for the top 16-bits of a 32 bit number, where the
- // bottom 16 bits are included in the next word in the .reloc table
- srRelocHighAdj, // Never Used
-
- // generate a token map relocation, nothing into .reloc section
- srRelocMapToken,
-
- // relative address fixup
- srRelocRelative,
-
- // Generate only a section-relative reloc, nothing into .reloc
- // section. This reloc is relative to the file position of the
- // section, not the section's virtual address.
- srRelocFilePos,
-
- // code relative address fixup
- srRelocCodeRelative,
-
- // generate a .reloc for a 64 bit address in an ia64 movl instruction
- srRelocIA64Imm64,
-
- // generate a .reloc for a 64 bit address
- srRelocDir64,
-
- // generate a .reloc for a 25-bit PC relative address in an ia64 br.call instruction
- srRelocIA64PcRel25,
-
- // generate a .reloc for a 64-bit PC relative address in an ia64 brl.call instruction
- srRelocIA64PcRel64,
-
- // generate a 30-bit section-relative reloc, used for tagged pointer values
- srRelocAbsoluteTagged,
-
-
- // A sentinel value to help ensure any additions to this enum are reflected
- // in PEWriter.cpp's RelocName array.
- srRelocSentinel,
-
- // Flags that can be used with the above reloc types
-
- // do not emit base reloc
- srNoBaseReloc = 0x4000,
-
- // pre-fixup contents of memory are ptr rather than a section offset
- srRelocPtr = 0x8000,
-
- // legal enums which include the Ptr flag
- srRelocAbsolutePtr = srRelocPtr + srRelocAbsolute,
- srRelocHighLowPtr = srRelocPtr + srRelocHighLow,
- srRelocRelativePtr = srRelocPtr + srRelocRelative,
- srRelocIA64Imm64Ptr = srRelocPtr + srRelocIA64Imm64,
- srRelocDir64Ptr = srRelocPtr + srRelocDir64,
-
-} CeeSectionRelocType;
-
-typedef union {
- USHORT highAdj;
-} CeeSectionRelocExtra;
-
-//-------------------------------------
-//--- ICeeGen
-//-------------------------------------
-// {7ED1BDFF-8E36-11d2-9C56-00A0C9B7CC45}
-EXTERN_GUID(IID_ICeeGen, 0x7ed1bdff, 0x8e36, 0x11d2, 0x9c, 0x56, 0x0, 0xa0, 0xc9, 0xb7, 0xcc, 0x45);
-
-DECLARE_INTERFACE_(ICeeGen, IUnknown)
-{
- STDMETHOD (EmitString) (
- _In_
- LPWSTR lpString, // [IN] String to emit
- ULONG *RVA) PURE; // [OUT] RVA for string emitted string
-
- STDMETHOD (GetString) (
- ULONG RVA, // [IN] RVA for string to return
- _Out_opt_
- LPWSTR *lpString) PURE; // [OUT] Returned string
-
- STDMETHOD (AllocateMethodBuffer) (
- ULONG cchBuffer, // [IN] Length of buffer to create
- UCHAR **lpBuffer, // [OUT] Returned buffer
- ULONG *RVA) PURE; // [OUT] RVA for method
-
- STDMETHOD (GetMethodBuffer) (
- ULONG RVA, // [IN] RVA for method to return
- UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
-
- STDMETHOD (GetIMapTokenIface) (
- IUnknown **pIMapToken) PURE;
-
- STDMETHOD (GenerateCeeFile) () PURE;
-
- STDMETHOD (GetIlSection) (
- HCEESECTION *section) PURE;
-
- STDMETHOD (GetStringSection) (
- HCEESECTION *section) PURE;
-
- STDMETHOD (AddSectionReloc) (
- HCEESECTION section,
- ULONG offset,
- HCEESECTION relativeTo,
- CeeSectionRelocType relocType) PURE;
-
- // use these only if you have special section requirements not handled
- // by other APIs
- STDMETHOD (GetSectionCreate) (
- const char *name,
- DWORD flags,
- HCEESECTION *section) PURE;
-
- STDMETHOD (GetSectionDataLen) (
- HCEESECTION section,
- ULONG *dataLen) PURE;
-
- STDMETHOD (GetSectionBlock) (
- HCEESECTION section,
- ULONG len,
- ULONG align=1,
- void **ppBytes=0) PURE;
-
- STDMETHOD (TruncateSection) (
- HCEESECTION section,
- ULONG len) PURE;
-
- STDMETHOD (GenerateCeeMemoryImage) (
- void **ppImage) PURE;
-
- STDMETHOD (ComputePointer) (
- HCEESECTION section,
- ULONG RVA, // [IN] RVA for method to return
- UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
-
-};
-
-//*****************************************************************************
-//*****************************************************************************
-//
-// End of CeeGen declarations.
-//
-//*****************************************************************************
-
-//**********************************************************************
-//**********************************************************************
-//--- IMetaDataTables
-//-------------------------------------
-// This API isn't big endian friendly since it indexes directly into the memory that
-// is stored in little endian format.
-// {D8F579AB-402D-4b8e-82D9-5D63B1065C68}
-EXTERN_GUID(IID_IMetaDataTables, 0xd8f579ab, 0x402d, 0x4b8e, 0x82, 0xd9, 0x5d, 0x63, 0xb1, 0x6, 0x5c, 0x68);
-
-DECLARE_INTERFACE_(IMetaDataTables, IUnknown)
-{
- STDMETHOD (GetStringHeapSize) (
- ULONG *pcbStrings) PURE; // [OUT] Size of the string heap.
-
- STDMETHOD (GetBlobHeapSize) (
- ULONG *pcbBlobs) PURE; // [OUT] Size of the Blob heap.
-
- STDMETHOD (GetGuidHeapSize) (
- ULONG *pcbGuids) PURE; // [OUT] Size of the Guid heap.
-
- STDMETHOD (GetUserStringHeapSize) (
- ULONG *pcbBlobs) PURE; // [OUT] Size of the User String heap.
-
- STDMETHOD (GetNumTables) (
- ULONG *pcTables) PURE; // [OUT] Count of tables.
-
- STDMETHOD (GetTableIndex) (
- ULONG token, // [IN] Token for which to get table index.
- ULONG *pixTbl) PURE; // [OUT] Put table index here.
-
- STDMETHOD (GetTableInfo) (
- ULONG ixTbl, // [IN] Which table.
- ULONG *pcbRow, // [OUT] Size of a row, bytes.
- ULONG *pcRows, // [OUT] Number of rows.
- ULONG *pcCols, // [OUT] Number of columns in each row.
- ULONG *piKey, // [OUT] Key column, or -1 if none.
- const char **ppName) PURE; // [OUT] Name of the table.
-
- STDMETHOD (GetColumnInfo) (
- ULONG ixTbl, // [IN] Which Table
- ULONG ixCol, // [IN] Which Column in the table
- ULONG *poCol, // [OUT] Offset of the column in the row.
- ULONG *pcbCol, // [OUT] Size of a column, bytes.
- ULONG *pType, // [OUT] Type of the column.
- const char **ppName) PURE; // [OUT] Name of the Column.
-
- STDMETHOD (GetCodedTokenInfo) (
- ULONG ixCdTkn, // [IN] Which kind of coded token.
- ULONG *pcTokens, // [OUT] Count of tokens.
- ULONG **ppTokens, // [OUT] List of tokens.
- const char **ppName) PURE; // [OUT] Name of the CodedToken.
-
- STDMETHOD (GetRow) (
- ULONG ixTbl, // [IN] Which table.
- ULONG rid, // [IN] Which row.
- void **ppRow) PURE; // [OUT] Put pointer to row here.
-
- STDMETHOD (GetColumn) (
- ULONG ixTbl, // [IN] Which table.
- ULONG ixCol, // [IN] Which column.
- ULONG rid, // [IN] Which row.
- ULONG *pVal) PURE; // [OUT] Put the column contents here.
-
- STDMETHOD (GetString) (
- ULONG ixString, // [IN] Value from a string column.
- const char **ppString) PURE; // [OUT] Put a pointer to the string here.
-
- STDMETHOD (GetBlob) (
- ULONG ixBlob, // [IN] Value from a blob column.
- ULONG *pcbData, // [OUT] Put size of the blob here.
- const void **ppData) PURE; // [OUT] Put a pointer to the blob here.
-
- STDMETHOD (GetGuid) (
- ULONG ixGuid, // [IN] Value from a guid column.
- const GUID **ppGUID) PURE; // [OUT] Put a pointer to the GUID here.
-
- STDMETHOD (GetUserString) (
- ULONG ixUserString, // [IN] Value from a UserString column.
- ULONG *pcbData, // [OUT] Put size of the UserString here.
- const void **ppData) PURE; // [OUT] Put a pointer to the UserString here.
-
- STDMETHOD (GetNextString) (
- ULONG ixString, // [IN] Value from a string column.
- ULONG *pNext) PURE; // [OUT] Put the index of the next string here.
-
- STDMETHOD (GetNextBlob) (
- ULONG ixBlob, // [IN] Value from a blob column.
- ULONG *pNext) PURE; // [OUT] Put the index of the netxt blob here.
-
- STDMETHOD (GetNextGuid) (
- ULONG ixGuid, // [IN] Value from a guid column.
- ULONG *pNext) PURE; // [OUT] Put the index of the next guid here.
-
- STDMETHOD (GetNextUserString) (
- ULONG ixUserString, // [IN] Value from a UserString column.
- ULONG *pNext) PURE; // [OUT] Put the index of the next user string here.
-
- // Interface is sealed.
-
-};
-// This API isn't big endian friendly since it indexes directly into the memory that
-// is stored in little endian format.
-// {BADB5F70-58DA-43a9-A1C6-D74819F19B15}
-EXTERN_GUID(IID_IMetaDataTables2, 0xbadb5f70, 0x58da, 0x43a9, 0xa1, 0xc6, 0xd7, 0x48, 0x19, 0xf1, 0x9b, 0x15);
-
-DECLARE_INTERFACE_(IMetaDataTables2, IMetaDataTables)
-{
- STDMETHOD (GetMetaDataStorage) ( //@todo: name?
- const void **ppvMd, // [OUT] put pointer to MD section here (aka, 'BSJB').
- ULONG *pcbMd) PURE; // [OUT] put size of the stream here.
-
- STDMETHOD (GetMetaDataStreamInfo) ( // Get info about the MD stream.
- ULONG ix, // [IN] Stream ordinal desired.
- const char **ppchName, // [OUT] put pointer to stream name here.
- const void **ppv, // [OUT] put pointer to MD stream here.
- ULONG *pcb) PURE; // [OUT] put size of the stream here.
-
-}; // IMetaDataTables2
-
-#ifdef _DEFINE_META_DATA_META_CONSTANTS
-#ifndef _META_DATA_META_CONSTANTS_DEFINED
-#define _META_DATA_META_CONSTANTS_DEFINED
-const unsigned int iRidMax = 63;
-const unsigned int iCodedToken = 64; // base of coded tokens.
-const unsigned int iCodedTokenMax = 95;
-const unsigned int iSHORT = 96; // fixed types.
-const unsigned int iUSHORT = 97;
-const unsigned int iLONG = 98;
-const unsigned int iULONG = 99;
-const unsigned int iBYTE = 100;
-const unsigned int iSTRING = 101; // pool types.
-const unsigned int iGUID = 102;
-const unsigned int iBLOB = 103;
-
-inline int IsRidType(ULONG ix) { return ix <= iRidMax; }
-inline int IsCodedTokenType(ULONG ix) { return (ix >= iCodedToken) && (ix <= iCodedTokenMax); }
-inline int IsRidOrToken(ULONG ix) { return ix <= iCodedTokenMax; }
-inline int IsHeapType(ULONG ix) { return ix >= iSTRING; }
-inline int IsFixedType(ULONG ix) { return (ix < iSTRING) && (ix > iCodedTokenMax); }
-#endif
-#endif
-
-//**********************************************************************
-// End of IMetaDataTables.
-//**********************************************************************
-
-//-------------------------------------
-//--- IMetaDataInfo
-//-------------------------------------
-// {7998EA64-7F95-48B8-86FC-17CAF48BF5CB}
-EXTERN_GUID(IID_IMetaDataInfo, 0x7998EA64, 0x7F95, 0x48B8, 0x86, 0xFC, 0x17, 0xCA, 0xF4, 0x8B, 0xF5, 0xCB);
-
-//---
-#undef INTERFACE
-#define INTERFACE IMetaDataInfo
-DECLARE_INTERFACE_(IMetaDataInfo, IUnknown)
-{
- // Return Values:
- // S_OK - All parameters are filled.
- // COR_E_NOTSUPPORTED - The API is not supported for this particular scope (e.g. .obj files, scope
- // opened without whole file via code:IMetaDataDispenser::OpenScopeOnMemory, etc.).
- // E_INVALIDARG - If NULL is passed as parameter.
- STDMETHOD(GetFileMapping)(
- const void ** ppvData, // [out] Pointer to the start of the mapped file.
- ULONGLONG * pcbData, // [out] Size of the mapped memory region.
- DWORD * pdwMappingType) PURE; // [out] Type of file mapping (code:CorFileMapping).
-}; // class IMetaDataInfo
-
-//**********************************************************************
-//
-// Predefined CustomAttribute and structures for these custom value
-//
-//**********************************************************************
-
-//
-// Native Link method custom value definitions. This is for N-direct support.
-//
-
-#define COR_NATIVE_LINK_CUSTOM_VALUE L"COMPLUS_NativeLink"
-#define COR_NATIVE_LINK_CUSTOM_VALUE_ANSI "COMPLUS_NativeLink"
-
-// count of chars for COR_NATIVE_LINK_CUSTOM_VALUE(_ANSI)
-#define COR_NATIVE_LINK_CUSTOM_VALUE_CC 18
-
-#include
-typedef struct
-{
- BYTE m_linkType; // see CorNativeLinkType below
- BYTE m_flags; // see CorNativeLinkFlags below
- mdMemberRef m_entryPoint; // member ref token giving entry point, format is lib:entrypoint
-} COR_NATIVE_LINK;
-#include
-
-typedef enum
-{
- nltNone = 1, // none of the keywords are specified
- nltAnsi = 2, // ansi keyword specified
- nltUnicode = 3, // unicode keyword specified
- nltAuto = 4, // auto keyword specified
- nltMaxValue = 7, // used so we can assert how many bits are required for this enum
-} CorNativeLinkType;
-
-typedef enum
-{
- nlfNone = 0x00, // no flags
- nlfLastError = 0x01, // setLastError keyword specified
- nlfNoMangle = 0x02, // nomangle keyword specified
- nlfMaxValue = 0x03, // used so we can assert how many bits are required for this enum
-} CorNativeLinkFlags;
-
-//
-// Base class for security custom attributes.
-//
-
-#define COR_BASE_SECURITY_ATTRIBUTE_CLASS L"System.Security.Permissions.SecurityAttribute"
-#define COR_BASE_SECURITY_ATTRIBUTE_CLASS_ANSI "System.Security.Permissions.SecurityAttribute"
-
-//
-// Name of custom attribute used to indicate that per-call security checks should
-// be disabled for P/Invoke calls.
-//
-
-#define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE L"System.Security.SuppressUnmanagedCodeSecurityAttribute"
-#define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI "System.Security.SuppressUnmanagedCodeSecurityAttribute"
-
-//
-// Name of custom attribute tagged on module to indicate it contains
-// unverifiable code.
-//
-
-#define COR_UNVER_CODE_ATTRIBUTE L"System.Security.UnverifiableCodeAttribute"
-#define COR_UNVER_CODE_ATTRIBUTE_ANSI "System.Security.UnverifiableCodeAttribute"
-
-//
-// Name of custom attribute indicating that a method requires a security object
-// slot on the caller's stack.
-//
-
-#define COR_REQUIRES_SECOBJ_ATTRIBUTE W("System.Security.DynamicSecurityMethodAttribute")
-#define COR_REQUIRES_SECOBJ_ATTRIBUTE_ANSI "System.Security.DynamicSecurityMethodAttribute"
-
-#define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE L"System.Runtime.CompilerServices.DiscardableAttribute"
-#define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE_ASNI "System.Runtime.CompilerServices.DiscardableAttribute"
-
-
-#ifdef __cplusplus
-}
-
-//*****************************************************************************
-//*****************************************************************************
-//
-// C O M + s i g n a t u r e s u p p o r t
-//
-//*****************************************************************************
-//*****************************************************************************
-
-#ifndef FORCEINLINE
- #if _MSC_VER < 1200
- #define FORCEINLINE inline
- #else
- #define FORCEINLINE __forceinline
- #endif
-#endif
-
-
-// We need a version that is FORCEINLINE on retail and NOINLINE on debug
-
-#ifndef DEBUG_NOINLINE
-#if defined(_DEBUG)
-#define DEBUG_NOINLINE NOINLINE
-#else
-#define DEBUG_NOINLINE
-#endif
-#endif
-
-#ifndef NOINLINE
-#ifdef _MSC_VER
-#define NOINLINE __declspec(noinline)
-#elif defined __GNUC__
-#define NOINLINE __attribute__ ((noinline))
-#else
-#define NOINLINE
-#endif
-#endif // !NOINLINE
-
-// return true if it is a primitive type, i.e. only need to store CorElementType
-FORCEINLINE int CorIsPrimitiveType(CorElementType elementtype)
-{
- return (elementtype < ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_I || elementtype == ELEMENT_TYPE_U);
-}
-
-
-// Return true if element type is a modifier, i.e. ELEMENT_TYPE_MODIFIER bits are
-// turned on. For now, it is checking for ELEMENT_TYPE_PTR and ELEMENT_TYPE_BYREF
-// as well. This will be removed when we turn on ELEMENT_TYPE_MODIFIER bits for
-// these two enum members.
-//
-FORCEINLINE int CorIsModifierElementType(CorElementType elementtype)
-{
- if (elementtype == ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_BYREF)
- return 1;
- return (elementtype & ELEMENT_TYPE_MODIFIER);
-}
-
-// Given a compress byte (*pData), return the size of the uncompressed data.
-inline ULONG CorSigUncompressedDataSize(
- PCCOR_SIGNATURE pData)
-{
- if ((*pData & 0x80) == 0)
- return 1;
- else if ((*pData & 0xC0) == 0x80)
- return 2;
- else
- return 4;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Given a compressed integer(*pData), expand the compressed int to *pDataOut.
-// Return value is the number of bytes that the integer occupies in the compressed format
-// It is caller's responsibility to ensure pDataOut has at least 4 bytes to be written to.
-//
-// This function returns -1 if pass in with an incorrectly compressed data, such as
-// (*pBytes & 0xE0) == 0XE0.
-/////////////////////////////////////////////////////////////////////////////////////////////
-inline ULONG CorSigUncompressBigData(
- PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
-{
- ULONG res;
-
- // 1 byte data is handled in CorSigUncompressData
- // _ASSERTE(*pData & 0x80);
-
- // Medium.
- if ((*pData & 0xC0) == 0x80) // 10?? ????
- {
- res = (ULONG)((*pData++ & 0x3f) << 8);
- res |= *pData++;
- }
- else // 110? ????
- {
- res = (*pData++ & 0x1f) << 24;
- res |= *pData++ << 16;
- res |= *pData++ << 8;
- res |= *pData++;
- }
- return res;
-}
-FORCEINLINE ULONG CorSigUncompressData(
- PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
-{
- // Handle smallest data inline.
- if ((*pData & 0x80) == 0x00) // 0??? ????
- return *pData++;
- return CorSigUncompressBigData(pData);
-}
-
-inline HRESULT CorSigUncompressData(// return S_OK or E_BADIMAGEFORMAT if the signature is bad
- PCCOR_SIGNATURE pData, // [IN] compressed data
- DWORD len, // [IN] length of the signature
- ULONG * pDataOut, // [OUT] the expanded *pData
- ULONG * pDataLen) // [OUT] length of the expanded *pData
-{
- HRESULT hr = S_OK;
- BYTE const *pBytes = reinterpret_cast(pData);
-
- // Smallest.
- if ((*pBytes & 0x80) == 0x00) // 0??? ????
- {
- if (len < 1)
- {
- *pDataOut = 0;
- *pDataLen = 0;
- hr = META_E_BAD_SIGNATURE;
- }
- else
- {
- *pDataOut = *pBytes;
- *pDataLen = 1;
- }
- }
- // Medium.
- else if ((*pBytes & 0xC0) == 0x80) // 10?? ????
- {
- if (len < 2)
- {
- *pDataOut = 0;
- *pDataLen = 0;
- hr = META_E_BAD_SIGNATURE;
- }
- else
- {
- *pDataOut = (ULONG)(((*pBytes & 0x3f) << 8 | *(pBytes+1)));
- *pDataLen = 2;
- }
- }
- else if ((*pBytes & 0xE0) == 0xC0) // 110? ????
- {
- if (len < 4)
- {
- *pDataOut = 0;
- *pDataLen = 0;
- hr = META_E_BAD_SIGNATURE;
- }
- else
- {
- *pDataOut = (ULONG)(((*pBytes & 0x1f) << 24 | *(pBytes+1) << 16 | *(pBytes+2) << 8 | *(pBytes+3)));
- *pDataLen = 4;
- }
- }
- else // We don't recognize this encoding
- {
- *pDataOut = 0;
- *pDataLen = 0;
- hr = META_E_BAD_SIGNATURE;
- }
-
- return hr;
-}
-
-inline ULONG CorSigUncompressData( // return number of bytes of that compressed data occupied in pData
- PCCOR_SIGNATURE pData, // [IN] compressed data
- ULONG *pDataOut) // [OUT] the expanded *pData
-{
- ULONG dwSizeOfData = 0;
-
- // We don't know how big the signature is, so we'll just say that it's big enough
- if (FAILED(CorSigUncompressData(pData, 0xff, pDataOut, &dwSizeOfData)))
- {
- *pDataOut = 0;
- return (ULONG)-1;
- }
-
- return dwSizeOfData;
-}
-
-
-const mdToken g_tkCorEncodeToken[4] = { mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType };
-
-// uncompress a token
-inline mdToken CorSigUncompressToken( // return the token.
- PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
-{
- mdToken tk;
- mdToken tkType;
-
- tk = CorSigUncompressData(pData);
- tkType = g_tkCorEncodeToken[tk & 0x3];
- tk = TokenFromRid(tk >> 2, tkType);
- return tk;
-}
-
-
-inline ULONG CorSigUncompressToken( // return number of bytes of that compressed data occupied in pData
- PCCOR_SIGNATURE pData, // [IN] compressed data
- mdToken * pToken) // [OUT] the expanded *pData
-{
- ULONG cb;
- mdToken tk;
- mdToken tkType;
-
- cb = CorSigUncompressData(pData, (ULONG *)&tk);
- tkType = g_tkCorEncodeToken[tk & 0x3];
- tk = TokenFromRid(tk >> 2, tkType);
- *pToken = tk;
- return cb;
-}
-
-inline HRESULT CorSigUncompressToken(
- PCCOR_SIGNATURE pData, // [IN] compressed data
- DWORD dwLen, // [IN] Remaining length of sigature
- mdToken * pToken, // [OUT] the expanded *pData
- DWORD * dwTokenLength) // [OUT] The length of the token in the sigature
-{
- mdToken tk;
- mdToken tkType;
-
- HRESULT hr = CorSigUncompressData(pData, dwLen, (ULONG *)&tk, dwTokenLength);
-
- if (SUCCEEDED(hr))
- {
- tkType = g_tkCorEncodeToken[tk & 0x3];
- tk = TokenFromRid(tk >> 2, tkType);
- *pToken = tk;
- }
- else
- {
- *pToken = mdTokenNil;
- }
- return hr;
-}
-
-
-
-FORCEINLINE ULONG CorSigUncompressCallingConv(
- PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
-{
- return *pData++;
-}
-
-FORCEINLINE HRESULT CorSigUncompressCallingConv(
- PCCOR_SIGNATURE pData, // [IN] Signature
- DWORD dwLen, // [IN] Length of signature
- ULONG * data) // [OUT] Compressed data
-{
- if (dwLen > 0)
- {
- *data = *pData;
- return S_OK;
- }
- else
- {
- *data = 0;
- return META_E_BAD_SIGNATURE;
- }
-}
-
-
-enum {
- SIGN_MASK_ONEBYTE = 0xffffffc0, // Mask the same size as the missing bits.
- SIGN_MASK_TWOBYTE = 0xffffe000, // Mask the same size as the missing bits.
- SIGN_MASK_FOURBYTE = 0xf0000000, // Mask the same size as the missing bits.
-};
-
-// uncompress a signed integer
-inline ULONG CorSigUncompressSignedInt( // return number of bytes of that compressed data occupied in pData
- PCCOR_SIGNATURE pData, // [IN] compressed data
- int * pInt) // [OUT] the expanded *pInt
-{
- ULONG cb;
- ULONG ulSigned;
- ULONG iData;
-
- cb = CorSigUncompressData(pData, &iData);
- if (cb == (ULONG) -1) return cb;
- ulSigned = iData & 0x1;
- iData = iData >> 1;
- if (ulSigned)
- {
- if (cb == 1)
- {
- iData |= SIGN_MASK_ONEBYTE;
- }
- else if (cb == 2)
- {
- iData |= SIGN_MASK_TWOBYTE;
- }
- else
- {
- iData |= SIGN_MASK_FOURBYTE;
- }
- }
- *pInt = (int)iData;
- return cb;
-}
-
-
-// uncompress encoded element type
-FORCEINLINE CorElementType CorSigUncompressElementType( // Element type
- PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
-{
- return (CorElementType)*pData++;
-}
-
-inline ULONG CorSigUncompressElementType( // Return number of bytes of that compressed data occupied in pData
- PCCOR_SIGNATURE pData, // [IN] Compressed data
- CorElementType * pElementType) // [OUT] The expanded *pData
-{
- *pElementType = (CorElementType)(*pData & 0x7f);
- return 1;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Given an uncompressed unsigned integer (iLen), Store it to pDataOut in a compressed format.
-// Return value is the number of bytes that the integer occupies in the compressed format.
-// It is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to write to.
-//
-// Note that this function returns -1 if iLen is too big to be compressed. We currently can
-// only represent to 0x1FFFFFFF.
-//
-/////////////////////////////////////////////////////////////////////////////////////////////
-inline ULONG CorSigCompressData( // return number of bytes that compressed form of iLen will take
- ULONG iLen, // [IN] given uncompressed data
- void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
-{
- BYTE *pBytes = reinterpret_cast(pDataOut);
-
- if (iLen <= 0x7F)
- {
- *pBytes = BYTE(iLen);
- return 1;
- }
-
- if (iLen <= 0x3FFF)
- {
- *pBytes = BYTE((iLen >> 8) | 0x80);
- *(pBytes+1) = BYTE(iLen & 0xff);
- return 2;
- }
-
- if (iLen <= 0x1FFFFFFF)
- {
- *pBytes = BYTE((iLen >> 24) | 0xC0);
- *(pBytes+1) = BYTE((iLen >> 16) & 0xff);
- *(pBytes+2) = BYTE((iLen >> 8) & 0xff);
- *(pBytes+3) = BYTE(iLen & 0xff);
- return 4;
- }
- return (ULONG) -1;
-}
-
-// compress a token
-// The least significant bit of the first compress byte will indicate the token type.
-//
-inline ULONG CorSigCompressToken( // return number of bytes that compressed form of the token will take
- mdToken tk, // [IN] given token
- void * pDataOut) // [OUT] buffer where the token will be compressed and stored.
-{
- RID rid = RidFromToken(tk);
- ULONG32 ulTyp = TypeFromToken(tk);
-
- if (rid > 0x3FFFFFF)
- // token is too big to be compressed
- return (ULONG) -1;
-
- rid = (rid << 2);
-
- // TypeDef is encoded with low bits 00
- // TypeRef is encoded with low bits 01
- // TypeSpec is encoded with low bits 10
- // BaseType is encoded with low bit 11
- //
- if (ulTyp == g_tkCorEncodeToken[1])
- {
- // make the last two bits 01
- rid |= 0x1;
- }
- else if (ulTyp == g_tkCorEncodeToken[2])
- {
- // make last two bits 0
- rid |= 0x2;
- }
- else if (ulTyp == g_tkCorEncodeToken[3])
- {
- rid |= 0x3;
- }
- return CorSigCompressData((ULONG)rid, pDataOut);
-}
-
-// compress a signed integer
-// The least significant bit of the first compress byte will be the signed bit.
-//
-inline ULONG CorSigCompressSignedInt( // return number of bytes that compressed form of iData will take
- int iData, // [IN] given integer
- void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
-{
- ULONG isSigned = 0;
- BYTE *pBytes = reinterpret_cast(pDataOut);
-
- if (iData < 0)
- isSigned = 0x1;
-
- // Note that we cannot use code:CorSigCompressData to pack the iData value, because of negative values
- // like: 0xffffe000 (-8192) which has to be encoded as 1 in 2 bytes, i.e. 0x81 0x00
- // However CorSigCompressedData would store value 1 as 1 byte: 0x01
- if ((iData & SIGN_MASK_ONEBYTE) == 0 || (iData & SIGN_MASK_ONEBYTE) == SIGN_MASK_ONEBYTE)
- {
- iData = (int)((iData & ~SIGN_MASK_ONEBYTE) << 1 | isSigned);
- //_ASSERTE(iData <= 0x7f);
- *pBytes = BYTE(iData);
- return 1;
- }
- else if ((iData & SIGN_MASK_TWOBYTE) == 0 || (iData & SIGN_MASK_TWOBYTE) == SIGN_MASK_TWOBYTE)
- {
- iData = (int)((iData & ~SIGN_MASK_TWOBYTE) << 1 | isSigned);
- //_ASSERTE(iData <= 0x3fff);
- *pBytes = BYTE((iData >> 8) | 0x80);
- *(pBytes + 1) = BYTE(iData & 0xff);
- return 2;
- }
- else if ((iData & SIGN_MASK_FOURBYTE) == 0 || (iData & SIGN_MASK_FOURBYTE) == SIGN_MASK_FOURBYTE)
- {
- iData = (int)((iData & ~SIGN_MASK_FOURBYTE) << 1 | isSigned);
- //_ASSERTE(iData <= 0x1FFFFFFF);
- *pBytes = BYTE((iData >> 24) | 0xC0);
- *(pBytes + 1) = BYTE((iData >> 16) & 0xff);
- *(pBytes + 2) = BYTE((iData >> 8) & 0xff);
- *(pBytes + 3) = BYTE(iData & 0xff);
- return 4;
- }
- // Out of compressable range
- return (ULONG)-1;
-} // CorSigCompressSignedInt
-
-
-// uncompress encoded element type
-inline ULONG CorSigCompressElementType( // return number of bytes of that compressed data occupied in pData
- CorElementType et, // [OUT] the expanded *pData
- void * pData) // [IN] compressed data
-{
- BYTE *pBytes = (BYTE *)(pData);
-
- *pBytes = BYTE(et);
- return 1;
-}
-
-// Compress a pointer (used for internal element types only, never for persisted
-// signatures).
-inline ULONG CorSigCompressPointer( // return number of bytes of that compressed data occupied
- void * pvPointer, // [IN] given uncompressed data
- void * pData) // [OUT] buffer where iLen will be compressed and stored.
-{
- *((void * UNALIGNED *)pData) = pvPointer;
- return sizeof(void *);
-}
-
-// Uncompress a pointer (see above for comments).
-inline ULONG CorSigUncompressPointer( // return number of bytes of that compressed data occupied
- PCCOR_SIGNATURE pData, // [IN] compressed data
- void ** ppvPointer) // [OUT] the expanded *pData
-{
- *ppvPointer = *(void * const UNALIGNED *)pData;
- return sizeof(void *);
-}
-
-#endif // __cplusplus
-
-#endif // _COR_H_
-// EOF =======================================================================
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/sal.h b/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/sal.h
deleted file mode 100644
index 507385b42..000000000
--- a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/sal.h
+++ /dev/null
@@ -1,2954 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/***
-*sal.h - markers for documenting the semantics of APIs
-*
-
-*
-*Purpose:
-* sal.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.
-****/
-#pragma once
-
-/*==========================================================================
-
- The comments in this file are intended to give basic understanding of
- the usage of SAL, the Microsoft Source Code Annotation Language.
- For more details, please see http://go.microsoft.com/fwlink/?LinkID=242134
-
- The macros are defined in 3 layers, plus the structural set:
-
- _In_/_Out_/_Ret_ Layer:
- ----------------------
- This layer provides the highest abstraction and its macros should be used
- in most cases. These macros typically start with:
- _In_ : input parameter to a function, unmodified by called function
- _Out_ : output parameter, written to by called function, pointed-to
- location not expected to be initialized prior to call
- _Outptr_ : like _Out_ when returned variable is a pointer type
- (so param is pointer-to-pointer type). Called function
- provides/allocated space.
- _Outref_ : like _Outptr_, except param is reference-to-pointer type.
- _Inout_ : inout parameter, read from and potentially modified by
- called function.
- _Ret_ : for return values
- _Field_ : class/struct field invariants
- For common usage, this class of SAL provides the most concise annotations.
- Note that _In_/_Out_/_Inout_/_Outptr_ annotations are designed to be used
- with a parameter target. Using them with _At_ to specify non-parameter
- targets may yield unexpected results.
-
- This layer also includes a number of other properties that can be specified
- to extend the ability of code analysis, most notably:
- -- Designating parameters as format strings for printf/scanf/scanf_s
- -- Requesting stricter type checking for C enum parameters
-
- _Pre_/_Post_ Layer:
- ------------------
- The macros of this layer only should be used when there is no suitable macro
- in the _In_/_Out_ layer. Its macros start with _Pre_ or _Post_.
- This layer provides the most flexibility for annotations.
-
- Implementation Abstraction Layer:
- --------------------------------
- Macros from this layer should never be used directly. The layer only exists
- to hide the implementation of the annotation macros.
-
- Structural Layer:
- ----------------
- These annotations, like _At_ and _When_, are used with annotations from
- any of the other layers as modifiers, indicating exactly when and where
- the annotations apply.
-
-
- Common syntactic conventions:
- ----------------------------
-
- Usage:
- -----
- _In_, _Out_, _Inout_, _Pre_, _Post_, are for formal parameters.
- _Ret_, _Deref_ret_ must be used for return values.
-
- Nullness:
- --------
- If the parameter can be NULL as a precondition to the function, the
- annotation contains _opt. If the macro does not contain '_opt' the
- parameter cannot be NULL.
-
- If an out/inout parameter returns a null pointer as a postcondition, this is
- indicated by _Ret_maybenull_ or _result_maybenull_. If the macro is not
- of this form, then the result will not be NULL as a postcondition.
- _Outptr_ - output value is not NULL
- _Outptr_result_maybenull_ - output value might be NULL
-
- String Type:
- -----------
- _z: NullTerminated string
- for _In_ parameters the buffer must have the specified stringtype before the call
- for _Out_ parameters the buffer must have the specified stringtype after the call
- for _Inout_ parameters both conditions apply
-
- Extent Syntax:
- -------------
- Buffer sizes are expressed as element counts, unless the macro explicitly
- contains _byte_ or _bytes_. Some annotations specify two buffer sizes, in
- which case the second is used to indicate how much of the buffer is valid
- as a postcondition. This table outlines the precondition buffer allocation
- size, precondition number of valid elements, postcondition allocation size,
- and postcondition number of valid elements for representative buffer size
- annotations:
- Pre | Pre | Post | Post
- alloc | valid | alloc | valid
- Annotation elems | elems | elems | elems
- ---------- ------------------------------------
- _In_reads_(s) s | s | s | s
- _Inout_updates_(s) s | s | s | s
- _Inout_updates_to_(s,c) s | s | s | c
- _Out_writes_(s) s | 0 | s | s
- _Out_writes_to_(s,c) s | 0 | s | c
- _Outptr_result_buffer_(s) ? | ? | s | s
- _Outptr_result_buffer_to_(s,c) ? | ? | s | c
-
- For the _Outptr_ annotations, the buffer in question is at one level of
- dereference. The called function is responsible for supplying the buffer.
-
- Success and failure:
- -------------------
- The SAL concept of success allows functions to define expressions that can
- be tested by the caller, which if it evaluates to non-zero, indicates the
- function succeeded, which means that its postconditions are guaranteed to
- hold. Otherwise, if the expression evaluates to zero, the function is
- considered to have failed, and the postconditions are not guaranteed.
-
- The success criteria can be specified with the _Success_(expr) annotation:
- _Success_(return != FALSE) BOOL
- PathCanonicalizeA(_Out_writes_(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) :
- pszBuf is only guaranteed to be NULL-terminated when TRUE is returned,
- and FALSE indiates failure. In common practice, callers check for zero
- vs. non-zero returns, so it is preferable to express the success
- criteria in terms of zero/non-zero, not checked for exactly TRUE.
-
- Functions can specify that some postconditions will still hold, even when
- the function fails, using _On_failure_(anno-list), or postconditions that
- hold regardless of success or failure using _Always_(anno-list).
-
- The annotation _Return_type_success_(expr) may be used with a typedef to
- give a default _Success_ criteria to all functions returning that type.
- This is the case for common Windows API status types, including
- HRESULT and NTSTATUS. This may be overridden on a per-function basis by
- specifying a _Success_ annotation locally.
-
-============================================================================*/
-
-#define __ATTR_SAL
-
-#ifndef _SAL_VERSION /*IFSTRIP=IGN*/
-#define _SAL_VERSION 20
-#endif
-
-#ifdef _PREFAST_ // [
-
-// choose attribute or __declspec implementation
-#ifndef _USE_DECLSPECS_FOR_SAL // [
-#define _USE_DECLSPECS_FOR_SAL 1
-#endif // ]
-
-#if _USE_DECLSPECS_FOR_SAL // [
-#undef _USE_ATTRIBUTES_FOR_SAL
-#define _USE_ATTRIBUTES_FOR_SAL 0
-#elif !defined(_USE_ATTRIBUTES_FOR_SAL) // ][
-#if _MSC_VER >= 1400 /*IFSTRIP=IGN*/ // [
-#define _USE_ATTRIBUTES_FOR_SAL 1
-#else // ][
-#define _USE_ATTRIBUTES_FOR_SAL 0
-#endif // ]
-#endif // ]
-
-
-#if !_USE_DECLSPECS_FOR_SAL // [
-#if !_USE_ATTRIBUTES_FOR_SAL // [
-#if _MSC_VER >= 1400 /*IFSTRIP=IGN*/ // [
-#undef _USE_ATTRIBUTES_FOR_SAL
-#define _USE_ATTRIBUTES_FOR_SAL 1
-#else // ][
-#undef _USE_DECLSPECS_FOR_SAL
-#define _USE_DECLSPECS_FOR_SAL 1
-#endif // ]
-#endif // ]
-#endif // ]
-
-#else
-
-// Disable expansion of SAL macros in non-Prefast mode to
-// improve compiler throughput.
-#ifndef _USE_DECLSPECS_FOR_SAL // [
-#define _USE_DECLSPECS_FOR_SAL 0
-#endif // ]
-#ifndef _USE_ATTRIBUTES_FOR_SAL // [
-#define _USE_ATTRIBUTES_FOR_SAL 0
-#endif // ]
-
-#endif // ]
-
-// safeguard for MIDL and RC builds
-#if _USE_DECLSPECS_FOR_SAL && ( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) || !defined(_PREFAST_) ) /*IFSTRIP=IGN*/ // [
-#undef _USE_DECLSPECS_FOR_SAL
-#define _USE_DECLSPECS_FOR_SAL 0
-#endif // ]
-#if _USE_ATTRIBUTES_FOR_SAL && ( !defined(_MSC_EXTENSIONS) || defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) /*IFSTRIP=IGN*/ // [
-#undef _USE_ATTRIBUTES_FOR_SAL
-#define _USE_ATTRIBUTES_FOR_SAL 0
-#endif // ]
-
-#if _USE_DECLSPECS_FOR_SAL || _USE_ATTRIBUTES_FOR_SAL
-
-// Special enum type for Y/N/M
-enum __SAL_YesNo {_SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default};
-
-#endif
-
-#if defined(BUILD_WINDOWS) && !_USE_ATTRIBUTES_FOR_SAL /*IFSTRIP=IGN*/
-#define _SAL1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1") _GrouP_(annotes _SAL_nop_impl_)
-#define _SAL1_1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.1") _GrouP_(annotes _SAL_nop_impl_)
-#define _SAL1_2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.2") _GrouP_(annotes _SAL_nop_impl_)
-#define _SAL2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _GrouP_(annotes _SAL_nop_impl_)
-#else
-#define _SAL1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1") _Group_(annotes _SAL_nop_impl_)
-#define _SAL1_1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.1") _Group_(annotes _SAL_nop_impl_)
-#define _SAL1_2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.2") _Group_(annotes _SAL_nop_impl_)
-#define _SAL2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _Group_(annotes _SAL_nop_impl_)
-#endif
-
-//============================================================================
-// Structural SAL:
-// These annotations modify the use of other annotations. They may
-// express the annotation target (i.e. what parameter/field the annotation
-// applies to) or the condition under which the annotation is applicable.
-//============================================================================
-
-// _At_(target, annos) specifies that the annotations listed in 'annos' is to
-// be applied to 'target' rather than to the identifier which is the current
-// lexical target.
-#define _At_(target, annos) _At_impl_(target, annos _SAL_nop_impl_)
-
-// _At_buffer_(target, iter, bound, annos) is similar to _At_, except that
-// target names a buffer, and each annotation in annos is applied to each
-// element of target up to bound, with the variable named in iter usable
-// by the annotations to refer to relevant offsets within target.
-#define _At_buffer_(target, iter, bound, annos) _At_buffer_impl_(target, iter, bound, annos _SAL_nop_impl_)
-
-// _When_(expr, annos) specifies that the annotations listed in 'annos' only
-// apply when 'expr' evaluates to non-zero.
-#define _When_(expr, annos) _When_impl_(expr, annos _SAL_nop_impl_)
-#define _Group_(annos) _Group_impl_(annos _SAL_nop_impl_)
-#define _GrouP_(annos) _GrouP_impl_(annos _SAL_nop_impl_)
-
-// indicates whether normal post conditions apply to a function
-#define _Success_(expr) _SAL2_Source_(_Success_, (expr), _Success_impl_(expr))
-
-// indicates whether post conditions apply to a function returning
-// the type that this annotation is applied to
-#define _Return_type_success_(expr) _SAL2_Source_(_Return_type_success_, (expr), _Success_impl_(expr))
-
-// Establish postconditions that apply only if the function does not succeed
-#define _On_failure_(annos) _On_failure_impl_(annos _SAL_nop_impl_)
-
-// Establish postconditions that apply in both success and failure cases.
-// Only applicable with functions that have _Success_ or _Return_type_succss_.
-#define _Always_(annos) _Always_impl_(annos _SAL_nop_impl_)
-
-// Usable on a function defintion. Asserts that a function declaration is
-// in scope, and its annotations are to be used. There are no other annotations
-// allowed on the function definition.
-#define _Use_decl_annotations_ _Use_decl_anno_impl_
-
-// _Notref_ may precede a _Deref_ or "real" annotation, and removes one
-// level of dereference if the parameter is a C++ reference (&). If the
-// net deref on a "real" annotation is negative, it is simply discarded.
-#define _Notref_ _Notref_impl_
-
-// Annotations for defensive programming styles.
-#define _Pre_defensive_ _SA_annotes0(SAL_pre_defensive)
-#define _Post_defensive_ _SA_annotes0(SAL_post_defensive)
-
-#define _In_defensive_(annotes) _Pre_defensive_ _Group_(annotes)
-#define _Out_defensive_(annotes) _Post_defensive_ _Group_(annotes)
-#define _Inout_defensive_(annotes) _Pre_defensive_ _Post_defensive_ _Group_(annotes)
-
-//============================================================================
-// _In_\_Out_ Layer:
-//============================================================================
-
-// Reserved pointer parameters, must always be NULL.
-#define _Reserved_ _SAL2_Source_(_Reserved_, (), _Pre1_impl_(__null_impl))
-
-// _Const_ allows specification that any namable memory location is considered
-// readonly for a given call.
-#define _Const_ _SAL2_Source_(_Const_, (), _Pre1_impl_(__readaccess_impl_notref))
-
-
-// Input parameters --------------------------
-
-// _In_ - Annotations for parameters where data is passed into the function, but not modified.
-// _In_ by itself can be used with non-pointer types (although it is redundant).
-
-// e.g. void SetPoint( _In_ const POINT* pPT );
-#define _In_ _SAL2_Source_(_In_, (), _Pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))
-#define _In_opt_ _SAL2_Source_(_In_opt_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_ _Deref_pre_readonly_)
-
-// nullterminated 'in' parameters.
-// e.g. void CopyStr( _In_z_ const char* szFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
-#define _In_z_ _SAL2_Source_(_In_z_, (), _In_ _Pre1_impl_(__zterm_impl))
-#define _In_opt_z_ _SAL2_Source_(_In_opt_z_, (), _In_opt_ _Pre1_impl_(__zterm_impl))
-
-
-// 'input' buffers with given size
-
-#define _In_reads_(size) _SAL2_Source_(_In_reads_, (size), _Pre_count_(size) _Deref_pre_readonly_)
-#define _In_reads_opt_(size) _SAL2_Source_(_In_reads_opt_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_)
-#define _In_reads_bytes_(size) _SAL2_Source_(_In_reads_bytes_, (size), _Pre_bytecount_(size) _Deref_pre_readonly_)
-#define _In_reads_bytes_opt_(size) _SAL2_Source_(_In_reads_bytes_opt_, (size), _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
-#define _In_reads_z_(size) _SAL2_Source_(_In_reads_z_, (size), _In_reads_(size) _Pre_z_)
-#define _In_reads_opt_z_(size) _SAL2_Source_(_In_reads_opt_z_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_ _Pre_opt_z_)
-#define _In_reads_or_z_(size) _SAL2_Source_(_In_reads_or_z_, (size), _In_ _When_(_String_length_(_Curr_) < (size), _Pre_z_) _When_(_String_length_(_Curr_) >= (size), _Pre1_impl_(__count_impl(size))))
-#define _In_reads_or_z_opt_(size) _SAL2_Source_(_In_reads_or_z_opt_, (size), _In_opt_ _When_(_String_length_(_Curr_) < (size), _Pre_z_) _When_(_String_length_(_Curr_) >= (size), _Pre1_impl_(__count_impl(size))))
-
-
-// 'input' buffers valid to the given end pointer
-
-#define _In_reads_to_ptr_(ptr) _SAL2_Source_(_In_reads_to_ptr_, (ptr), _Pre_ptrdiff_count_(ptr) _Deref_pre_readonly_)
-#define _In_reads_to_ptr_opt_(ptr) _SAL2_Source_(_In_reads_to_ptr_opt_, (ptr), _Pre_opt_ptrdiff_count_(ptr) _Deref_pre_readonly_)
-#define _In_reads_to_ptr_z_(ptr) _SAL2_Source_(_In_reads_to_ptr_z_, (ptr), _In_reads_to_ptr_(ptr) _Pre_z_)
-#define _In_reads_to_ptr_opt_z_(ptr) _SAL2_Source_(_In_reads_to_ptr_opt_z_, (ptr), _Pre_opt_ptrdiff_count_(ptr) _Deref_pre_readonly_ _Pre_opt_z_)
-
-
-
-// Output parameters --------------------------
-
-// _Out_ - Annotations for pointer or reference parameters where data passed back to the caller.
-// These are mostly used where the pointer/reference is to a non-pointer type.
-// _Outptr_/_Outref) (see below) are typically used to return pointers via parameters.
-
-// e.g. void GetPoint( _Out_ POINT* pPT );
-#define _Out_ _SAL2_Source_(_Out_, (), _Out_impl_)
-#define _Out_opt_ _SAL2_Source_(_Out_opt_, (), _Out_opt_impl_)
-
-#define _Out_writes_(size) _SAL2_Source_(_Out_writes_, (size), _Pre_cap_(size) _Post_valid_impl_)
-#define _Out_writes_opt_(size) _SAL2_Source_(_Out_writes_opt_, (size), _Pre_opt_cap_(size) _Post_valid_impl_)
-#define _Out_writes_bytes_(size) _SAL2_Source_(_Out_writes_bytes_, (size), _Pre_bytecap_(size) _Post_valid_impl_)
-#define _Out_writes_bytes_opt_(size) _SAL2_Source_(_Out_writes_bytes_opt_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_)
-#define _Out_writes_z_(size) _SAL2_Source_(_Out_writes_z_, (size), _Pre_cap_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_writes_opt_z_(size) _SAL2_Source_(_Out_writes_opt_z_, (size), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_z_)
-
-#define _Out_writes_to_(size,count) _SAL2_Source_(_Out_writes_to_, (size,count), _Pre_cap_(size) _Post_valid_impl_ _Post_count_(count))
-#define _Out_writes_to_opt_(size,count) _SAL2_Source_(_Out_writes_to_opt_, (size,count), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_count_(count))
-#define _Out_writes_all_(size) _SAL2_Source_(_Out_writes_all_, (size), _Out_writes_to_(_Old_(size), _Old_(size)))
-#define _Out_writes_all_opt_(size) _SAL2_Source_(_Out_writes_all_opt_, (size), _Out_writes_to_opt_(_Old_(size), _Old_(size)))
-
-#define _Out_writes_bytes_to_(size,count) _SAL2_Source_(_Out_writes_bytes_to_, (size,count), _Pre_bytecap_(size) _Post_valid_impl_ _Post_bytecount_(count))
-#define _Out_writes_bytes_to_opt_(size,count) _SAL2_Source_(_Out_writes_bytes_to_opt_, (size,count), _Pre_opt_bytecap_(size) _Post_valid_impl_ _Post_bytecount_(count))
-#define _Out_writes_bytes_all_(size) _SAL2_Source_(_Out_writes_bytes_all_, (size), _Out_writes_bytes_to_(_Old_(size), _Old_(size)))
-#define _Out_writes_bytes_all_opt_(size) _SAL2_Source_(_Out_writes_bytes_all_opt_, (size), _Out_writes_bytes_to_opt_(_Old_(size), _Old_(size)))
-
-#define _Out_writes_to_ptr_(ptr) _SAL2_Source_(_Out_writes_to_ptr_, (ptr), _Pre_ptrdiff_cap_(ptr) _Post_valid_impl_)
-#define _Out_writes_to_ptr_opt_(ptr) _SAL2_Source_(_Out_writes_to_ptr_opt_, (ptr), _Pre_opt_ptrdiff_cap_(ptr) _Post_valid_impl_)
-#define _Out_writes_to_ptr_z_(ptr) _SAL2_Source_(_Out_writes_to_ptr_z_, (ptr), _Pre_ptrdiff_cap_(ptr) _Post_valid_impl_ Post_z_)
-#define _Out_writes_to_ptr_opt_z_(ptr) _SAL2_Source_(_Out_writes_to_ptr_opt_z_, (ptr), _Pre_opt_ptrdiff_cap_(ptr) _Post_valid_impl_ Post_z_)
-
-
-// Inout parameters ----------------------------
-
-// _Inout_ - Annotations for pointer or reference parameters where data is passed in and
-// potentially modified.
-// void ModifyPoint( _Inout_ POINT* pPT );
-// void ModifyPointByRef( _Inout_ POINT& pPT );
-
-#define _Inout_ _SAL2_Source_(_Inout_, (), _Prepost_valid_)
-#define _Inout_opt_ _SAL2_Source_(_Inout_opt_, (), _Prepost_opt_valid_)
-
-// For modifying string buffers
-// void toupper( _Inout_z_ char* sz );
-#define _Inout_z_ _SAL2_Source_(_Inout_z_, (), _Prepost_z_)
-#define _Inout_opt_z_ _SAL2_Source_(_Inout_opt_z_, (), _Prepost_opt_z_)
-
-// For modifying buffers with explicit element size
-#define _Inout_updates_(size) _SAL2_Source_(_Inout_updates_, (size), _Pre_cap_(size) _Pre_valid_impl_ _Post_valid_impl_)
-#define _Inout_updates_opt_(size) _SAL2_Source_(_Inout_updates_opt_, (size), _Pre_opt_cap_(size) _Pre_valid_impl_ _Post_valid_impl_)
-#define _Inout_updates_z_(size) _SAL2_Source_(_Inout_updates_z_, (size), _Pre_cap_(size) _Pre_valid_impl_ _Post_valid_impl_ _Pre1_impl_(__zterm_impl) _Post1_impl_(__zterm_impl))
-#define _Inout_updates_opt_z_(size) _SAL2_Source_(_Inout_updates_opt_z_, (size), _Pre_opt_cap_(size) _Pre_valid_impl_ _Post_valid_impl_ _Pre1_impl_(__zterm_impl) _Post1_impl_(__zterm_impl))
-
-#define _Inout_updates_to_(size,count) _SAL2_Source_(_Inout_updates_to_, (size,count), _Out_writes_to_(size,count) _Pre_valid_impl_ _Pre1_impl_(__count_impl(count)))
-#define _Inout_updates_to_opt_(size,count) _SAL2_Source_(_Inout_updates_to_opt_, (size,count), _Out_writes_to_opt_(size,count) _Pre_valid_impl_ _Pre1_impl_(__count_impl(count)))
-
-#define _Inout_updates_all_(size) _SAL2_Source_(_Inout_updates_all_, (size), _Inout_updates_to_(_Old_(size), _Old_(size)))
-#define _Inout_updates_all_opt_(size) _SAL2_Source_(_Inout_updates_all_opt_, (size), _Inout_updates_to_opt_(_Old_(size), _Old_(size)))
-
-// For modifying buffers with explicit byte size
-#define _Inout_updates_bytes_(size) _SAL2_Source_(_Inout_updates_bytes_, (size), _Pre_bytecap_(size) _Pre_valid_impl_ _Post_valid_impl_)
-#define _Inout_updates_bytes_opt_(size) _SAL2_Source_(_Inout_updates_bytes_opt_, (size), _Pre_opt_bytecap_(size) _Pre_valid_impl_ _Post_valid_impl_)
-
-#define _Inout_updates_bytes_to_(size,count) _SAL2_Source_(_Inout_updates_bytes_to_, (size,count), _Out_writes_bytes_to_(size,count) _Pre_valid_impl_ _Pre1_impl_(__bytecount_impl(count)))
-#define _Inout_updates_bytes_to_opt_(size,count) _SAL2_Source_(_Inout_updates_bytes_to_opt_, (size,count), _Out_writes_bytes_to_opt_(size,count) _Pre_valid_impl_ _Pre1_impl_(__bytecount_impl(count)))
-
-#define _Inout_updates_bytes_all_(size) _SAL2_Source_(_Inout_updates_bytes_all_, (size), _Inout_updates_bytes_to_(_Old_(size), _Old_(size)))
-#define _Inout_updates_bytes_all_opt_(size) _SAL2_Source_(_Inout_updates_bytes_all_opt_, (size), _Inout_updates_bytes_to_opt_(_Old_(size), _Old_(size)))
-
-
-// Pointer to pointer parameters -------------------------
-
-// _Outptr_ - Annotations for output params returning pointers
-// These describe parameters where the called function provides the buffer:
-// HRESULT SHStrDupW(_In_ LPCWSTR psz, _Outptr_ LPWSTR *ppwsz);
-// The caller passes the address of an LPWSTR variable as ppwsz, and SHStrDupW allocates
-// and initializes memory and returns the pointer to the new LPWSTR in *ppwsz.
-//
-// _Outptr_opt_ - describes parameters that are allowed to be NULL.
-// _Outptr_*_result_maybenull_ - describes parameters where the called function might return NULL to the caller.
-//
-// Example:
-// void MyFunc(_Outptr_opt_ int **ppData1, _Outptr_result_maybenull_ int **ppData2);
-// Callers:
-// MyFunc(NULL, NULL); // error: parameter 2, ppData2, should not be NULL
-// MyFunc(&pData1, &pData2); // ok: both non-NULL
-// if (*pData1 == *pData2) ... // error: pData2 might be NULL after call
-
-#define _Outptr_ _SAL2_Source_(_Outptr_, (), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(1)))
-#define _Outptr_result_maybenull_ _SAL2_Source_(_Outptr_result_maybenull_, (), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(1)))
-#define _Outptr_opt_ _SAL2_Source_(_Outptr_opt_, (), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(1)))
-#define _Outptr_opt_result_maybenull_ _SAL2_Source_(_Outptr_opt_result_maybenull_, (), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(1)))
-
-// Annotations for _Outptr_ parameters returning pointers to null terminated strings.
-
-#define _Outptr_result_z_ _SAL2_Source_(_Outptr_result_z_, (), _Out_impl_ _Deref_post_z_)
-#define _Outptr_opt_result_z_ _SAL2_Source_(_Outptr_opt_result_z_, (), _Out_opt_impl_ _Deref_post_z_)
-#define _Outptr_result_maybenull_z_ _SAL2_Source_(_Outptr_result_maybenull_z_, (), _Out_impl_ _Deref_post_opt_z_)
-#define _Outptr_opt_result_maybenull_z_ _SAL2_Source_(_Outptr_opt_result_maybenull_z_, (), _Out_opt_impl_ _Deref_post_opt_z_)
-
-// Annotations for _Outptr_ parameters where the output pointer is set to NULL if the function fails.
-
-#define _Outptr_result_nullonfailure_ _SAL2_Source_(_Outptr_result_nullonfailure_, (), _Outptr_ _On_failure_(_Deref_post_null_))
-#define _Outptr_opt_result_nullonfailure_ _SAL2_Source_(_Outptr_opt_result_nullonfailure_, (), _Outptr_opt_ _On_failure_(_Deref_post_null_))
-
-// Annotations for _Outptr_ parameters which return a pointer to a ref-counted COM object,
-// following the COM convention of setting the output to NULL on failure.
-// The current implementation is identical to _Outptr_result_nullonfailure_.
-// For pointers to types that are not COM objects, _Outptr_result_nullonfailure_ is preferred.
-
-#define _COM_Outptr_ _SAL2_Source_(_COM_Outptr_, (), _Outptr_ _On_failure_(_Deref_post_null_))
-#define _COM_Outptr_result_maybenull_ _SAL2_Source_(_COM_Outptr_result_maybenull_, (), _Outptr_result_maybenull_ _On_failure_(_Deref_post_null_))
-#define _COM_Outptr_opt_ _SAL2_Source_(_COM_Outptr_opt_, (), _Outptr_opt_ _On_failure_(_Deref_post_null_))
-#define _COM_Outptr_opt_result_maybenull_ _SAL2_Source_(_COM_Outptr_opt_result_maybenull_, (), _Outptr_opt_result_maybenull_ _On_failure_(_Deref_post_null_))
-
-// Annotations for _Outptr_ parameters returning a pointer to buffer with a specified number of elements/bytes
-
-#define _Outptr_result_buffer_(size) _SAL2_Source_(_Outptr_result_buffer_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __cap_impl(size)))
-#define _Outptr_opt_result_buffer_(size) _SAL2_Source_(_Outptr_opt_result_buffer_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __cap_impl(size)))
-#define _Outptr_result_buffer_to_(size, count) _SAL2_Source_(_Outptr_result_buffer_to_, (size, count), _Out_impl_ _Deref_post3_impl_(__notnull_impl_notref, __cap_impl(size), __count_impl(count)))
-#define _Outptr_opt_result_buffer_to_(size, count) _SAL2_Source_(_Outptr_opt_result_buffer_to_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__notnull_impl_notref, __cap_impl(size), __count_impl(count)))
-
-#define _Outptr_result_buffer_all_(size) _SAL2_Source_(_Outptr_result_buffer_all_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(size)))
-#define _Outptr_opt_result_buffer_all_(size) _SAL2_Source_(_Outptr_opt_result_buffer_all_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(size)))
-
-#define _Outptr_result_buffer_maybenull_(size) _SAL2_Source_(_Outptr_result_buffer_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __cap_impl(size)))
-#define _Outptr_opt_result_buffer_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_buffer_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __cap_impl(size)))
-#define _Outptr_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_result_buffer_to_maybenull_, (size, count), _Out_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __cap_impl(size), __count_impl(count)))
-#define _Outptr_opt_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_opt_result_buffer_to_maybenull_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __cap_impl(size), __count_impl(count)))
-
-#define _Outptr_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outptr_result_buffer_all_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(size)))
-#define _Outptr_opt_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_buffer_all_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(size)))
-
-#define _Outptr_result_bytebuffer_(size) _SAL2_Source_(_Outptr_result_bytebuffer_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecap_impl(size)))
-#define _Outptr_opt_result_bytebuffer_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecap_impl(size)))
-#define _Outptr_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outptr_result_bytebuffer_to_, (size, count), _Out_impl_ _Deref_post3_impl_(__notnull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
-#define _Outptr_opt_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outptr_opt_result_bytebuffer_to_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__notnull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
-
-#define _Outptr_result_bytebuffer_all_(size) _SAL2_Source_(_Outptr_result_bytebuffer_all_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecount_impl(size)))
-#define _Outptr_opt_result_bytebuffer_all_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_all_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecount_impl(size)))
-
-#define _Outptr_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outptr_result_bytebuffer_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecap_impl(size)))
-#define _Outptr_opt_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecap_impl(size)))
-#define _Outptr_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_result_bytebuffer_to_maybenull_, (size, count), _Out_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
-#define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_opt_result_bytebuffer_to_maybenull_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
-
-#define _Outptr_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outptr_result_bytebuffer_all_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecount_impl(size)))
-#define _Outptr_opt_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_all_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecount_impl(size)))
-
-// Annotations for output reference to pointer parameters.
-
-#define _Outref_ _SAL2_Source_(_Outref_, (), _Out_impl_ _Post_notnull_)
-#define _Outref_result_maybenull_ _SAL2_Source_(_Outref_result_maybenull_, (), _Pre2_impl_(__notnull_impl_notref, __cap_c_one_notref_impl) _Post_maybenull_ _Post_valid_impl_)
-
-#define _Outref_result_buffer_(size) _SAL2_Source_(_Outref_result_buffer_, (size), _Outref_ _Post1_impl_(__cap_impl(size)))
-#define _Outref_result_bytebuffer_(size) _SAL2_Source_(_Outref_result_bytebuffer_, (size), _Outref_ _Post1_impl_(__bytecap_impl(size)))
-#define _Outref_result_buffer_to_(size, count) _SAL2_Source_(_Outref_result_buffer_to_, (size, count), _Outref_result_buffer_(size) _Post1_impl_(__count_impl(count)))
-#define _Outref_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outref_result_bytebuffer_to_, (size, count), _Outref_result_bytebuffer_(size) _Post1_impl_(__bytecount_impl(count)))
-#define _Outref_result_buffer_all_(size) _SAL2_Source_(_Outref_result_buffer_all_, (size), _Outref_result_buffer_to_(size, _Old_(size)))
-#define _Outref_result_bytebuffer_all_(size) _SAL2_Source_(_Outref_result_bytebuffer_all_, (size), _Outref_result_bytebuffer_to_(size, _Old_(size)))
-
-#define _Outref_result_buffer_maybenull_(size) _SAL2_Source_(_Outref_result_buffer_maybenull_, (size), _Outref_result_maybenull_ _Post1_impl_(__cap_impl(size)))
-#define _Outref_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outref_result_bytebuffer_maybenull_, (size), _Outref_result_maybenull_ _Post1_impl_(__bytecap_impl(size)))
-#define _Outref_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outref_result_buffer_to_maybenull_, (size, count), _Outref_result_buffer_maybenull_(size) _Post1_impl_(__count_impl(count)))
-#define _Outref_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outref_result_bytebuffer_to_maybenull_, (size, count), _Outref_result_bytebuffer_maybenull_(size) _Post1_impl_(__bytecount_impl(count)))
-#define _Outref_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outref_result_buffer_all_maybenull_, (size), _Outref_result_buffer_to_maybenull_(size, _Old_(size)))
-#define _Outref_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outref_result_bytebuffer_all_maybenull_, (size), _Outref_result_bytebuffer_to_maybenull_(size, _Old_(size)))
-
-// Annotations for output reference to pointer parameters that guarantee
-// that the pointer is set to NULL on failure.
-#define _Outref_result_nullonfailure_ _SAL2_Source_(_Outref_result_nullonfailure_, (), _Outref_ _On_failure_(_Post_null_))
-
-// Generic annotations to set output value of a by-pointer or by-reference parameter to null/zero on failure.
-#define _Result_nullonfailure_ _SAL2_Source_(_Result_nullonfailure_, (), _On_failure_(_Notref_impl_ _Deref_impl_ _Post_null_))
-#define _Result_zeroonfailure_ _SAL2_Source_(_Result_zeroonfailure_, (), _On_failure_(_Notref_impl_ _Deref_impl_ _Out_range_(==, 0)))
-
-
-// return values -------------------------------
-
-//
-// _Ret_ annotations
-//
-// describing conditions that hold for return values after the call
-
-// e.g. _Ret_z_ CString::operator const WCHAR*() const throw();
-#define _Ret_z_ _SAL2_Source_(_Ret_z_, (), _Ret2_impl_(__notnull_impl, __zterm_impl) _Ret_valid_impl_)
-#define _Ret_maybenull_z_ _SAL2_Source_(_Ret_maybenull_z_, (), _Ret2_impl_(__maybenull_impl,__zterm_impl) _Ret_valid_impl_)
-
-// used with allocated but not yet initialized objects
-#define _Ret_notnull_ _SAL2_Source_(_Ret_notnull_, (), _Ret1_impl_(__notnull_impl))
-#define _Ret_maybenull_ _SAL2_Source_(_Ret_maybenull_, (), _Ret1_impl_(__maybenull_impl))
-#define _Ret_null_ _SAL2_Source_(_Ret_null_, (), _Ret1_impl_(__null_impl))
-
-// used with allocated and initialized objects
-// returns single valid object
-#define _Ret_valid_ _SAL2_Source_(_Ret_valid_, (), _Ret1_impl_(__notnull_impl_notref) _Ret_valid_impl_)
-
-// returns pointer to initialized buffer of specified size
-#define _Ret_writes_(size) _SAL2_Source_(_Ret_writes_, (size), _Ret2_impl_(__notnull_impl, __count_impl(size)) _Ret_valid_impl_)
-#define _Ret_writes_z_(size) _SAL2_Source_(_Ret_writes_z_, (size), _Ret3_impl_(__notnull_impl, __count_impl(size), __zterm_impl) _Ret_valid_impl_)
-#define _Ret_writes_bytes_(size) _SAL2_Source_(_Ret_writes_bytes_, (size), _Ret2_impl_(__notnull_impl, __bytecount_impl(size)) _Ret_valid_impl_)
-#define _Ret_writes_maybenull_(size) _SAL2_Source_(_Ret_writes_maybenull_, (size), _Ret2_impl_(__maybenull_impl,__count_impl(size)) _Ret_valid_impl_)
-#define _Ret_writes_maybenull_z_(size) _SAL2_Source_(_Ret_writes_maybenull_z_, (size), _Ret3_impl_(__maybenull_impl,__count_impl(size),__zterm_impl) _Ret_valid_impl_)
-#define _Ret_writes_bytes_maybenull_(size) _SAL2_Source_(_Ret_writes_bytes_maybenull_, (size), _Ret2_impl_(__maybenull_impl,__bytecount_impl(size)) _Ret_valid_impl_)
-
-// returns pointer to partially initialized buffer, with total size 'size' and initialized size 'count'
-#define _Ret_writes_to_(size,count) _SAL2_Source_(_Ret_writes_to_, (size,count), _Ret3_impl_(__notnull_impl, __cap_impl(size), __count_impl(count)) _Ret_valid_impl_)
-#define _Ret_writes_bytes_to_(size,count) _SAL2_Source_(_Ret_writes_bytes_to_, (size,count), _Ret3_impl_(__notnull_impl, __bytecap_impl(size), __bytecount_impl(count)) _Ret_valid_impl_)
-#define _Ret_writes_to_maybenull_(size,count) _SAL2_Source_(_Ret_writes_to_maybenull_, (size,count), _Ret3_impl_(__maybenull_impl, __cap_impl(size), __count_impl(count)) _Ret_valid_impl_)
-#define _Ret_writes_bytes_to_maybenull_(size,count) _SAL2_Source_(_Ret_writes_bytes_to_maybenull_, (size,count), _Ret3_impl_(__maybenull_impl, __bytecap_impl(size), __bytecount_impl(count)) _Ret_valid_impl_)
-
-
-// Annotations for strict type checking
-#define _Points_to_data_ _SAL2_Source_(_Points_to_data_, (), _Pre_ _Points_to_data_impl_)
-#define _Literal_ _SAL2_Source_(_Literal_, (), _Pre_ _Literal_impl_)
-#define _Notliteral_ _SAL2_Source_(_Notliteral_, (), _Pre_ _Notliteral_impl_)
-
-// Check the return value of a function e.g. _Check_return_ ErrorCode Foo();
-#define _Check_return_ _SAL2_Source_(_Check_return_, (), _Check_return_impl_)
-#define _Must_inspect_result_ _SAL2_Source_(_Must_inspect_result_, (), _Must_inspect_impl_ _Check_return_impl_)
-
-// e.g. MyPrintF( _Printf_format_string_ const WCHAR* wzFormat, ... );
-#define _Printf_format_string_ _SAL2_Source_(_Printf_format_string_, (), _Printf_format_string_impl_)
-#define _Scanf_format_string_ _SAL2_Source_(_Scanf_format_string_, (), _Scanf_format_string_impl_)
-#define _Scanf_s_format_string_ _SAL2_Source_(_Scanf_s_format_string_, (), _Scanf_s_format_string_impl_)
-
-#define _Format_string_impl_(kind,where) _SA_annotes2(SAL_IsFormatString2, kind, where)
-#define _Printf_format_string_params_(x) _SAL2_Source_(_Printf_format_string_params_, (x), _Format_string_impl_("printf", x))
-#define _Scanf_format_string_params_(x) _SAL2_Source_(_Scanf_format_string_params_, (x), _Format_string_impl_("scanf", x))
-#define _Scanf_s_format_string_params_(x) _SAL2_Source_(_Scanf_s_format_string_params_, (x), _Format_string_impl_("scanf_s", x))
-
-// annotations to express value of integral or pointer parameter
-#define _In_range_(lb,ub) _SAL2_Source_(_In_range_, (lb,ub), _In_range_impl_(lb,ub))
-#define _Out_range_(lb,ub) _SAL2_Source_(_Out_range_, (lb,ub), _Out_range_impl_(lb,ub))
-#define _Ret_range_(lb,ub) _SAL2_Source_(_Ret_range_, (lb,ub), _Ret_range_impl_(lb,ub))
-#define _Deref_in_range_(lb,ub) _SAL2_Source_(_Deref_in_range_, (lb,ub), _Deref_in_range_impl_(lb,ub))
-#define _Deref_out_range_(lb,ub) _SAL2_Source_(_Deref_out_range_, (lb,ub), _Deref_out_range_impl_(lb,ub))
-#define _Deref_ret_range_(lb,ub) _SAL2_Source_(_Deref_ret_range_, (lb,ub), _Deref_ret_range_impl_(lb,ub))
-#define _Pre_equal_to_(expr) _SAL2_Source_(_Pre_equal_to_, (expr), _In_range_(==, expr))
-#define _Post_equal_to_(expr) _SAL2_Source_(_Post_equal_to_, (expr), _Out_range_(==, expr))
-
-// annotation to express that a value (usually a field of a mutable class)
-// is not changed by a function call
-#define _Unchanged_(e) _SAL2_Source_(_Unchanged_, (e), _At_(e, _Post_equal_to_(_Old_(e)) _Const_))
-
-// Annotations to allow expressing generalized pre and post conditions.
-// 'cond' may be any valid SAL expression that is considered to be true as a precondition
-// or postcondition (respsectively).
-#define _Pre_satisfies_(cond) _SAL2_Source_(_Pre_satisfies_, (cond), _Pre_satisfies_impl_(cond))
-#define _Post_satisfies_(cond) _SAL2_Source_(_Post_satisfies_, (cond), _Post_satisfies_impl_(cond))
-
-// Annotations to express struct, class and field invariants
-#define _Struct_size_bytes_(size) _SAL2_Source_(_Struct_size_bytes_, (size), _Writable_bytes_(size))
-
-#define _Field_size_(size) _SAL2_Source_(_Field_size_, (size), _Notnull_ _Writable_elements_(size))
-#define _Field_size_opt_(size) _SAL2_Source_(_Field_size_opt_, (size), _Maybenull_ _Writable_elements_(size))
-#define _Field_size_part_(size, count) _SAL2_Source_(_Field_size_part_, (size, count), _Notnull_ _Writable_elements_(size) _Readable_elements_(count))
-#define _Field_size_part_opt_(size, count) _SAL2_Source_(_Field_size_part_opt_, (size, count), _Maybenull_ _Writable_elements_(size) _Readable_elements_(count))
-#define _Field_size_full_(size) _SAL2_Source_(_Field_size_full_, (size), _Field_size_part_(size, size))
-#define _Field_size_full_opt_(size) _SAL2_Source_(_Field_size_full_opt_, (size), _Field_size_part_opt_(size, size))
-
-#define _Field_size_bytes_(size) _SAL2_Source_(_Field_size_bytes_, (size), _Notnull_ _Writable_bytes_(size))
-#define _Field_size_bytes_opt_(size) _SAL2_Source_(_Field_size_bytes_opt_, (size), _Maybenull_ _Writable_bytes_(size))
-#define _Field_size_bytes_part_(size, count) _SAL2_Source_(_Field_size_bytes_part_, (size, count), _Notnull_ _Writable_bytes_(size) _Readable_bytes_(count))
-#define _Field_size_bytes_part_opt_(size, count) _SAL2_Source_(_Field_size_bytes_part_opt_, (size, count), _Maybenull_ _Writable_bytes_(size) _Readable_bytes_(count))
-#define _Field_size_bytes_full_(size) _SAL2_Source_(_Field_size_bytes_full_, (size), _Field_size_bytes_part_(size, size))
-#define _Field_size_bytes_full_opt_(size) _SAL2_Source_(_Field_size_bytes_full_opt_, (size), _Field_size_bytes_part_opt_(size, size))
-
-#define _Field_z_ _SAL2_Source_(_Field_z_, (), _Null_terminated_)
-
-#define _Field_range_(min,max) _SAL2_Source_(_Field_range_, (min,max), _Field_range_impl_(min,max))
-
-//============================================================================
-// _Pre_\_Post_ Layer:
-//============================================================================
-
-//
-// Raw Pre/Post for declaring custom pre/post conditions
-//
-
-#define _Pre_ _Pre_impl_
-#define _Post_ _Post_impl_
-
-//
-// Validity property
-//
-
-#define _Valid_ _Valid_impl_
-#define _Notvalid_ _Notvalid_impl_
-#define _Maybevalid_ _Maybevalid_impl_
-
-//
-// Buffer size properties
-//
-
-// Expressing buffer sizes without specifying pre or post condition
-#define _Readable_bytes_(size) _SAL2_Source_(_Readable_bytes_, (size), _Readable_bytes_impl_(size))
-#define _Readable_elements_(size) _SAL2_Source_(_Readable_elements_, (size), _Readable_elements_impl_(size))
-#define _Writable_bytes_(size) _SAL2_Source_(_Writable_bytes_, (size), _Writable_bytes_impl_(size))
-#define _Writable_elements_(size) _SAL2_Source_(_Writable_elements_, (size), _Writable_elements_impl_(size))
-
-#define _Null_terminated_ _SAL2_Source_(_Null_terminated_, (), _Null_terminated_impl_)
-#define _NullNull_terminated_ _SAL2_Source_(_NullNull_terminated_, (), _NullNull_terminated_impl_)
-
-// Expressing buffer size as pre or post condition
-#define _Pre_readable_size_(size) _SAL2_Source_(_Pre_readable_size_, (size), _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
-#define _Pre_writable_size_(size) _SAL2_Source_(_Pre_writable_size_, (size), _Pre1_impl_(__cap_impl(size)))
-#define _Pre_readable_byte_size_(size) _SAL2_Source_(_Pre_readable_byte_size_, (size), _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
-#define _Pre_writable_byte_size_(size) _SAL2_Source_(_Pre_writable_byte_size_, (size), _Pre1_impl_(__bytecap_impl(size)))
-
-#define _Post_readable_size_(size) _SAL2_Source_(_Post_readable_size_, (size), _Post1_impl_(__count_impl(size)) _Post_valid_impl_)
-#define _Post_writable_size_(size) _SAL2_Source_(_Post_writable_size_, (size), _Post1_impl_(__cap_impl(size)))
-#define _Post_readable_byte_size_(size) _SAL2_Source_(_Post_readable_byte_size_, (size), _Post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
-#define _Post_writable_byte_size_(size) _SAL2_Source_(_Post_writable_byte_size_, (size), _Post1_impl_(__bytecap_impl(size)))
-
-//
-// Pointer null-ness properties
-//
-#define _Null_ _Null_impl_
-#define _Notnull_ _Notnull_impl_
-#define _Maybenull_ _Maybenull_impl_
-
-//
-// _Pre_ annotations ---
-//
-// describing conditions that must be met before the call of the function
-
-// e.g. int strlen( _Pre_z_ const char* sz );
-// buffer is a zero terminated string
-#define _Pre_z_ _SAL2_Source_(_Pre_z_, (), _Pre1_impl_(__zterm_impl) _Pre_valid_impl_)
-
-// valid size unknown or indicated by type (e.g.:LPSTR)
-#define _Pre_valid_ _SAL2_Source_(_Pre_valid_, (), _Pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_)
-#define _Pre_opt_valid_ _SAL2_Source_(_Pre_opt_valid_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_)
-
-#define _Pre_invalid_ _SAL2_Source_(_Pre_invalid_, (), _Deref_pre1_impl_(__notvalid_impl))
-
-// Overrides recursive valid when some field is not yet initialized when using _Inout_
-#define _Pre_unknown_ _SAL2_Source_(_Pre_unknown_, (), _Pre1_impl_(__maybevalid_impl))
-
-// used with allocated but not yet initialized objects
-#define _Pre_notnull_ _SAL2_Source_(_Pre_notnull_, (), _Pre1_impl_(__notnull_impl_notref))
-#define _Pre_maybenull_ _SAL2_Source_(_Pre_maybenull_, (), _Pre1_impl_(__maybenull_impl_notref))
-#define _Pre_null_ _SAL2_Source_(_Pre_null_, (), _Pre1_impl_(__null_impl_notref))
-
-//
-// _Post_ annotations ---
-//
-// describing conditions that hold after the function call
-
-// void CopyStr( _In_z_ const char* szFrom, _Pre_cap_(cch) _Post_z_ char* szFrom, size_t cchFrom );
-// buffer will be a zero-terminated string after the call
-#define _Post_z_ _SAL2_Source_(_Post_z_, (), _Post1_impl_(__zterm_impl) _Post_valid_impl_)
-
-// e.g. HRESULT InitStruct( _Post_valid_ Struct* pobj );
-#define _Post_valid_ _SAL2_Source_(_Post_valid_, (), _Post_valid_impl_)
-#define _Post_invalid_ _SAL2_Source_(_Post_invalid_, (), _Deref_post1_impl_(__notvalid_impl))
-
-// e.g. void free( _Post_ptr_invalid_ void* pv );
-#define _Post_ptr_invalid_ _SAL2_Source_(_Post_ptr_invalid_, (), _Post1_impl_(__notvalid_impl))
-
-// e.g. void ThrowExceptionIfNull( _Post_notnull_ const void* pv );
-#define _Post_notnull_ _SAL2_Source_(_Post_notnull_, (), _Post1_impl_(__notnull_impl))
-
-// e.g. HRESULT GetObject(_Outptr_ _On_failure_(_At_(*p, _Post_null_)) T **p);
-#define _Post_null_ _SAL2_Source_(_Post_null_, (), _Post1_impl_(__null_impl))
-
-#define _Post_maybenull_ _SAL2_Source_(_Post_maybenull_, (), _Post1_impl_(__maybenull_impl))
-
-#define _Prepost_z_ _SAL2_Source_(_Prepost_z_, (), _Pre_z_ _Post_z_)
-
-
-// #pragma region Input Buffer SAL 1 compatibility macros
-
-/*==========================================================================
-
- This section contains definitions for macros defined for VS2010 and earlier.
- Usage of these macros is still supported, but the SAL 2 macros defined above
- are recommended instead. This comment block is retained to assist in
- understanding SAL that still uses the older syntax.
-
- The macros are defined in 3 layers:
-
- _In_\_Out_ Layer:
- ----------------
- This layer provides the highest abstraction and its macros should be used
- in most cases. Its macros start with _In_, _Out_ or _Inout_. For the
- typical case they provide the most concise annotations.
-
- _Pre_\_Post_ Layer:
- ------------------
- The macros of this layer only should be used when there is no suitable macro
- in the _In_\_Out_ layer. Its macros start with _Pre_, _Post_, _Ret_,
- _Deref_pre_ _Deref_post_ and _Deref_ret_. This layer provides the most
- flexibility for annotations.
-
- Implementation Abstraction Layer:
- --------------------------------
- Macros from this layer should never be used directly. The layer only exists
- to hide the implementation of the annotation macros.
-
-
- Annotation Syntax:
- |--------------|----------|----------------|-----------------------------|
- | Usage | Nullness | ZeroTerminated | Extent |
- |--------------|----------|----------------|-----------------------------|
- | _In_ | <> | <> | <> |
- | _Out_ | opt_ | z_ | [byte]cap_[c_|x_]( size ) |
- | _Inout_ | | | [byte]count_[c_|x_]( size ) |
- | _Deref_out_ | | | ptrdiff_cap_( ptr ) |
- |--------------| | | ptrdiff_count_( ptr ) |
- | _Ret_ | | | |
- | _Deref_ret_ | | | |
- |--------------| | | |
- | _Pre_ | | | |
- | _Post_ | | | |
- | _Deref_pre_ | | | |
- | _Deref_post_ | | | |
- |--------------|----------|----------------|-----------------------------|
-
- Usage:
- -----
- _In_, _Out_, _Inout_, _Pre_, _Post_, _Deref_pre_, _Deref_post_ are for
- formal parameters.
- _Ret_, _Deref_ret_ must be used for return values.
-
- Nullness:
- --------
- If the pointer can be NULL the annotation contains _opt. If the macro
- does not contain '_opt' the pointer may not be NULL.
-
- String Type:
- -----------
- _z: NullTerminated string
- for _In_ parameters the buffer must have the specified stringtype before the call
- for _Out_ parameters the buffer must have the specified stringtype after the call
- for _Inout_ parameters both conditions apply
-
- Extent Syntax:
- |------|---------------|---------------|
- | Unit | Writ\Readable | Argument Type |
- |------|---------------|---------------|
- | <> | cap_ | <> |
- | byte | count_ | c_ |
- | | | x_ |
- |------|---------------|---------------|
-
- 'cap' (capacity) describes the writable size of the buffer and is typically used
- with _Out_. The default unit is elements. Use 'bytecap' if the size is given in bytes
- 'count' describes the readable size of the buffer and is typically used with _In_.
- The default unit is elements. Use 'bytecount' if the size is given in bytes.
-
- Argument syntax for cap_, bytecap_, count_, bytecount_:
- (|return)[+n] e.g. cch, return, cb+2
-
- If the buffer size is a constant expression use the c_ postfix.
- E.g. cap_c_(20), count_c_(MAX_PATH), bytecount_c_(16)
-
- If the buffer size is given by a limiting pointer use the ptrdiff_ versions
- of the macros.
-
- If the buffer size is neither a parameter nor a constant expression use the x_
- postfix. e.g. bytecount_x_(num*size) x_ annotations accept any arbitrary string.
- No analysis can be done for x_ annotations but they at least tell the tool that
- the buffer has some sort of extent description. x_ annotations might be supported
- by future compiler versions.
-
-============================================================================*/
-
-// e.g. void SetCharRange( _In_count_(cch) const char* rgch, size_t cch )
-// valid buffer extent described by another parameter
-#define _In_count_(size) _SAL1_1_Source_(_In_count_, (size), _Pre_count_(size) _Deref_pre_readonly_)
-#define _In_opt_count_(size) _SAL1_1_Source_(_In_opt_count_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_)
-#define _In_bytecount_(size) _SAL1_1_Source_(_In_bytecount_, (size), _Pre_bytecount_(size) _Deref_pre_readonly_)
-#define _In_opt_bytecount_(size) _SAL1_1_Source_(_In_opt_bytecount_, (size), _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
-
-// valid buffer extent described by a constant extression
-#define _In_count_c_(size) _SAL1_1_Source_(_In_count_c_, (size), _Pre_count_c_(size) _Deref_pre_readonly_)
-#define _In_opt_count_c_(size) _SAL1_1_Source_(_In_opt_count_c_, (size), _Pre_opt_count_c_(size) _Deref_pre_readonly_)
-#define _In_bytecount_c_(size) _SAL1_1_Source_(_In_bytecount_c_, (size), _Pre_bytecount_c_(size) _Deref_pre_readonly_)
-#define _In_opt_bytecount_c_(size) _SAL1_1_Source_(_In_opt_bytecount_c_, (size), _Pre_opt_bytecount_c_(size) _Deref_pre_readonly_)
-
-// nullterminated 'input' buffers with given size
-
-// e.g. void SetCharRange( _In_count_(cch) const char* rgch, size_t cch )
-// nullterminated valid buffer extent described by another parameter
-#define _In_z_count_(size) _SAL1_1_Source_(_In_z_count_, (size), _Pre_z_ _Pre_count_(size) _Deref_pre_readonly_)
-#define _In_opt_z_count_(size) _SAL1_1_Source_(_In_opt_z_count_, (size), _Pre_opt_z_ _Pre_opt_count_(size) _Deref_pre_readonly_)
-#define _In_z_bytecount_(size) _SAL1_1_Source_(_In_z_bytecount_, (size), _Pre_z_ _Pre_bytecount_(size) _Deref_pre_readonly_)
-#define _In_opt_z_bytecount_(size) _SAL1_1_Source_(_In_opt_z_bytecount_, (size), _Pre_opt_z_ _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
-
-// nullterminated valid buffer extent described by a constant extression
-#define _In_z_count_c_(size) _SAL1_1_Source_(_In_z_count_c_, (size), _Pre_z_ _Pre_count_c_(size) _Deref_pre_readonly_)
-#define _In_opt_z_count_c_(size) _SAL1_1_Source_(_In_opt_z_count_c_, (size), _Pre_opt_z_ _Pre_opt_count_c_(size) _Deref_pre_readonly_)
-#define _In_z_bytecount_c_(size) _SAL1_1_Source_(_In_z_bytecount_c_, (size), _Pre_z_ _Pre_bytecount_c_(size) _Deref_pre_readonly_)
-#define _In_opt_z_bytecount_c_(size) _SAL1_1_Source_(_In_opt_z_bytecount_c_, (size), _Pre_opt_z_ _Pre_opt_bytecount_c_(size) _Deref_pre_readonly_)
-
-// buffer capacity is described by another pointer
-// e.g. void Foo( _In_ptrdiff_count_(pchMax) const char* pch, const char* pchMax ) { while pch < pchMax ) pch++; }
-#define _In_ptrdiff_count_(size) _SAL1_1_Source_(_In_ptrdiff_count_, (size), _Pre_ptrdiff_count_(size) _Deref_pre_readonly_)
-#define _In_opt_ptrdiff_count_(size) _SAL1_1_Source_(_In_opt_ptrdiff_count_, (size), _Pre_opt_ptrdiff_count_(size) _Deref_pre_readonly_)
-
-// 'x' version for complex expressions that are not supported by the current compiler version
-// e.g. void Set3ColMatrix( _In_count_x_(3*cRows) const Elem* matrix, int cRows );
-#define _In_count_x_(size) _SAL1_1_Source_(_In_count_x_, (size), _Pre_count_x_(size) _Deref_pre_readonly_)
-#define _In_opt_count_x_(size) _SAL1_1_Source_(_In_opt_count_x_, (size), _Pre_opt_count_x_(size) _Deref_pre_readonly_)
-#define _In_bytecount_x_(size) _SAL1_1_Source_(_In_bytecount_x_, (size), _Pre_bytecount_x_(size) _Deref_pre_readonly_)
-#define _In_opt_bytecount_x_(size) _SAL1_1_Source_(_In_opt_bytecount_x_, (size), _Pre_opt_bytecount_x_(size) _Deref_pre_readonly_)
-
-
-// 'out' with buffer size
-// e.g. void GetIndeces( _Out_cap_(cIndeces) int* rgIndeces, size_t cIndices );
-// buffer capacity is described by another parameter
-#define _Out_cap_(size) _SAL1_1_Source_(_Out_cap_, (size), _Pre_cap_(size) _Post_valid_impl_)
-#define _Out_opt_cap_(size) _SAL1_1_Source_(_Out_opt_cap_, (size), _Pre_opt_cap_(size) _Post_valid_impl_)
-#define _Out_bytecap_(size) _SAL1_1_Source_(_Out_bytecap_, (size), _Pre_bytecap_(size) _Post_valid_impl_)
-#define _Out_opt_bytecap_(size) _SAL1_1_Source_(_Out_opt_bytecap_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_)
-
-// buffer capacity is described by a constant expression
-#define _Out_cap_c_(size) _SAL1_1_Source_(_Out_cap_c_, (size), _Pre_cap_c_(size) _Post_valid_impl_)
-#define _Out_opt_cap_c_(size) _SAL1_1_Source_(_Out_opt_cap_c_, (size), _Pre_opt_cap_c_(size) _Post_valid_impl_)
-#define _Out_bytecap_c_(size) _SAL1_1_Source_(_Out_bytecap_c_, (size), _Pre_bytecap_c_(size) _Post_valid_impl_)
-#define _Out_opt_bytecap_c_(size) _SAL1_1_Source_(_Out_opt_bytecap_c_, (size), _Pre_opt_bytecap_c_(size) _Post_valid_impl_)
-
-// buffer capacity is described by another parameter multiplied by a constant expression
-#define _Out_cap_m_(mult,size) _SAL1_1_Source_(_Out_cap_m_, (mult,size), _Pre_cap_m_(mult,size) _Post_valid_impl_)
-#define _Out_opt_cap_m_(mult,size) _SAL1_1_Source_(_Out_opt_cap_m_, (mult,size), _Pre_opt_cap_m_(mult,size) _Post_valid_impl_)
-#define _Out_z_cap_m_(mult,size) _SAL1_1_Source_(_Out_z_cap_m_, (mult,size), _Pre_cap_m_(mult,size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_cap_m_(mult,size) _SAL1_1_Source_(_Out_opt_z_cap_m_, (mult,size), _Pre_opt_cap_m_(mult,size) _Post_valid_impl_ _Post_z_)
-
-// buffer capacity is described by another pointer
-// e.g. void Foo( _Out_ptrdiff_cap_(pchMax) char* pch, const char* pchMax ) { while pch < pchMax ) pch++; }
-#define _Out_ptrdiff_cap_(size) _SAL1_1_Source_(_Out_ptrdiff_cap_, (size), _Pre_ptrdiff_cap_(size) _Post_valid_impl_)
-#define _Out_opt_ptrdiff_cap_(size) _SAL1_1_Source_(_Out_opt_ptrdiff_cap_, (size), _Pre_opt_ptrdiff_cap_(size) _Post_valid_impl_)
-
-// buffer capacity is described by a complex expression
-#define _Out_cap_x_(size) _SAL1_1_Source_(_Out_cap_x_, (size), _Pre_cap_x_(size) _Post_valid_impl_)
-#define _Out_opt_cap_x_(size) _SAL1_1_Source_(_Out_opt_cap_x_, (size), _Pre_opt_cap_x_(size) _Post_valid_impl_)
-#define _Out_bytecap_x_(size) _SAL1_1_Source_(_Out_bytecap_x_, (size), _Pre_bytecap_x_(size) _Post_valid_impl_)
-#define _Out_opt_bytecap_x_(size) _SAL1_1_Source_(_Out_opt_bytecap_x_, (size), _Pre_opt_bytecap_x_(size) _Post_valid_impl_)
-
-// a zero terminated string is filled into a buffer of given capacity
-// e.g. void CopyStr( _In_z_ const char* szFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
-// buffer capacity is described by another parameter
-#define _Out_z_cap_(size) _SAL1_1_Source_(_Out_z_cap_, (size), _Pre_cap_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_cap_(size) _SAL1_1_Source_(_Out_opt_z_cap_, (size), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_z_bytecap_(size) _SAL1_1_Source_(_Out_z_bytecap_, (size), _Pre_bytecap_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_bytecap_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_ _Post_z_)
-
-// buffer capacity is described by a constant expression
-#define _Out_z_cap_c_(size) _SAL1_1_Source_(_Out_z_cap_c_, (size), _Pre_cap_c_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_cap_c_(size) _SAL1_1_Source_(_Out_opt_z_cap_c_, (size), _Pre_opt_cap_c_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_z_bytecap_c_(size) _SAL1_1_Source_(_Out_z_bytecap_c_, (size), _Pre_bytecap_c_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_c_, (size), _Pre_opt_bytecap_c_(size) _Post_valid_impl_ _Post_z_)
-
-// buffer capacity is described by a complex expression
-#define _Out_z_cap_x_(size) _SAL1_1_Source_(_Out_z_cap_x_, (size), _Pre_cap_x_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_cap_x_(size) _SAL1_1_Source_(_Out_opt_z_cap_x_, (size), _Pre_opt_cap_x_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_z_bytecap_x_(size) _SAL1_1_Source_(_Out_z_bytecap_x_, (size), _Pre_bytecap_x_(size) _Post_valid_impl_ _Post_z_)
-#define _Out_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_x_, (size), _Pre_opt_bytecap_x_(size) _Post_valid_impl_ _Post_z_)
-
-// a zero terminated string is filled into a buffer of given capacity
-// e.g. size_t CopyCharRange( _In_count_(cchFrom) const char* rgchFrom, size_t cchFrom, _Out_cap_post_count_(cchTo,return)) char* rgchTo, size_t cchTo );
-#define _Out_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_cap_post_count_, (cap,count), _Pre_cap_(cap) _Post_valid_impl_ _Post_count_(count))
-#define _Out_opt_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_opt_cap_post_count_, (cap,count), _Pre_opt_cap_(cap) _Post_valid_impl_ _Post_count_(count))
-#define _Out_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_bytecap_post_bytecount_, (cap,count), _Pre_bytecap_(cap) _Post_valid_impl_ _Post_bytecount_(count))
-#define _Out_opt_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_opt_bytecap_post_bytecount_, (cap,count), _Pre_opt_bytecap_(cap) _Post_valid_impl_ _Post_bytecount_(count))
-
-// a zero terminated string is filled into a buffer of given capacity
-// e.g. size_t CopyStr( _In_z_ const char* szFrom, _Out_z_cap_post_count_(cchTo,return+1) char* szTo, size_t cchTo );
-#define _Out_z_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_z_cap_post_count_, (cap,count), _Pre_cap_(cap) _Post_valid_impl_ _Post_z_count_(count))
-#define _Out_opt_z_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_opt_z_cap_post_count_, (cap,count), _Pre_opt_cap_(cap) _Post_valid_impl_ _Post_z_count_(count))
-#define _Out_z_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_z_bytecap_post_bytecount_, (cap,count), _Pre_bytecap_(cap) _Post_valid_impl_ _Post_z_bytecount_(count))
-#define _Out_opt_z_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_opt_z_bytecap_post_bytecount_, (cap,count), _Pre_opt_bytecap_(cap) _Post_valid_impl_ _Post_z_bytecount_(count))
-
-// only use with dereferenced arguments e.g. '*pcch'
-#define _Out_capcount_(capcount) _SAL1_1_Source_(_Out_capcount_, (capcount), _Pre_cap_(capcount) _Post_valid_impl_ _Post_count_(capcount))
-#define _Out_opt_capcount_(capcount) _SAL1_1_Source_(_Out_opt_capcount_, (capcount), _Pre_opt_cap_(capcount) _Post_valid_impl_ _Post_count_(capcount))
-#define _Out_bytecapcount_(capcount) _SAL1_1_Source_(_Out_bytecapcount_, (capcount), _Pre_bytecap_(capcount) _Post_valid_impl_ _Post_bytecount_(capcount))
-#define _Out_opt_bytecapcount_(capcount) _SAL1_1_Source_(_Out_opt_bytecapcount_, (capcount), _Pre_opt_bytecap_(capcount) _Post_valid_impl_ _Post_bytecount_(capcount))
-
-#define _Out_capcount_x_(capcount) _SAL1_1_Source_(_Out_capcount_x_, (capcount), _Pre_cap_x_(capcount) _Post_valid_impl_ _Post_count_x_(capcount))
-#define _Out_opt_capcount_x_(capcount) _SAL1_1_Source_(_Out_opt_capcount_x_, (capcount), _Pre_opt_cap_x_(capcount) _Post_valid_impl_ _Post_count_x_(capcount))
-#define _Out_bytecapcount_x_(capcount) _SAL1_1_Source_(_Out_bytecapcount_x_, (capcount), _Pre_bytecap_x_(capcount) _Post_valid_impl_ _Post_bytecount_x_(capcount))
-#define _Out_opt_bytecapcount_x_(capcount) _SAL1_1_Source_(_Out_opt_bytecapcount_x_, (capcount), _Pre_opt_bytecap_x_(capcount) _Post_valid_impl_ _Post_bytecount_x_(capcount))
-
-// e.g. GetString( _Out_z_capcount_(*pLen+1) char* sz, size_t* pLen );
-#define _Out_z_capcount_(capcount) _SAL1_1_Source_(_Out_z_capcount_, (capcount), _Pre_cap_(capcount) _Post_valid_impl_ _Post_z_count_(capcount))
-#define _Out_opt_z_capcount_(capcount) _SAL1_1_Source_(_Out_opt_z_capcount_, (capcount), _Pre_opt_cap_(capcount) _Post_valid_impl_ _Post_z_count_(capcount))
-#define _Out_z_bytecapcount_(capcount) _SAL1_1_Source_(_Out_z_bytecapcount_, (capcount), _Pre_bytecap_(capcount) _Post_valid_impl_ _Post_z_bytecount_(capcount))
-#define _Out_opt_z_bytecapcount_(capcount) _SAL1_1_Source_(_Out_opt_z_bytecapcount_, (capcount), _Pre_opt_bytecap_(capcount) _Post_valid_impl_ _Post_z_bytecount_(capcount))
-
-
-// 'inout' buffers with initialized elements before and after the call
-// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices );
-#define _Inout_count_(size) _SAL1_1_Source_(_Inout_count_, (size), _Prepost_count_(size))
-#define _Inout_opt_count_(size) _SAL1_1_Source_(_Inout_opt_count_, (size), _Prepost_opt_count_(size))
-#define _Inout_bytecount_(size) _SAL1_1_Source_(_Inout_bytecount_, (size), _Prepost_bytecount_(size))
-#define _Inout_opt_bytecount_(size) _SAL1_1_Source_(_Inout_opt_bytecount_, (size), _Prepost_opt_bytecount_(size))
-
-#define _Inout_count_c_(size) _SAL1_1_Source_(_Inout_count_c_, (size), _Prepost_count_c_(size))
-#define _Inout_opt_count_c_(size) _SAL1_1_Source_(_Inout_opt_count_c_, (size), _Prepost_opt_count_c_(size))
-#define _Inout_bytecount_c_(size) _SAL1_1_Source_(_Inout_bytecount_c_, (size), _Prepost_bytecount_c_(size))
-#define _Inout_opt_bytecount_c_(size) _SAL1_1_Source_(_Inout_opt_bytecount_c_, (size), _Prepost_opt_bytecount_c_(size))
-
-// nullterminated 'inout' buffers with initialized elements before and after the call
-// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices );
-#define _Inout_z_count_(size) _SAL1_1_Source_(_Inout_z_count_, (size), _Prepost_z_ _Prepost_count_(size))
-#define _Inout_opt_z_count_(size) _SAL1_1_Source_(_Inout_opt_z_count_, (size), _Prepost_z_ _Prepost_opt_count_(size))
-#define _Inout_z_bytecount_(size) _SAL1_1_Source_(_Inout_z_bytecount_, (size), _Prepost_z_ _Prepost_bytecount_(size))
-#define _Inout_opt_z_bytecount_(size) _SAL1_1_Source_(_Inout_opt_z_bytecount_, (size), _Prepost_z_ _Prepost_opt_bytecount_(size))
-
-#define _Inout_z_count_c_(size) _SAL1_1_Source_(_Inout_z_count_c_, (size), _Prepost_z_ _Prepost_count_c_(size))
-#define _Inout_opt_z_count_c_(size) _SAL1_1_Source_(_Inout_opt_z_count_c_, (size), _Prepost_z_ _Prepost_opt_count_c_(size))
-#define _Inout_z_bytecount_c_(size) _SAL1_1_Source_(_Inout_z_bytecount_c_, (size), _Prepost_z_ _Prepost_bytecount_c_(size))
-#define _Inout_opt_z_bytecount_c_(size) _SAL1_1_Source_(_Inout_opt_z_bytecount_c_, (size), _Prepost_z_ _Prepost_opt_bytecount_c_(size))
-
-#define _Inout_ptrdiff_count_(size) _SAL1_1_Source_(_Inout_ptrdiff_count_, (size), _Pre_ptrdiff_count_(size))
-#define _Inout_opt_ptrdiff_count_(size) _SAL1_1_Source_(_Inout_opt_ptrdiff_count_, (size), _Pre_opt_ptrdiff_count_(size))
-
-#define _Inout_count_x_(size) _SAL1_1_Source_(_Inout_count_x_, (size), _Prepost_count_x_(size))
-#define _Inout_opt_count_x_(size) _SAL1_1_Source_(_Inout_opt_count_x_, (size), _Prepost_opt_count_x_(size))
-#define _Inout_bytecount_x_(size) _SAL1_1_Source_(_Inout_bytecount_x_, (size), _Prepost_bytecount_x_(size))
-#define _Inout_opt_bytecount_x_(size) _SAL1_1_Source_(_Inout_opt_bytecount_x_, (size), _Prepost_opt_bytecount_x_(size))
-
-// e.g. void AppendToLPSTR( _In_ LPCSTR szFrom, _Inout_cap_(cchTo) LPSTR* szTo, size_t cchTo );
-#define _Inout_cap_(size) _SAL1_1_Source_(_Inout_cap_, (size), _Pre_valid_cap_(size) _Post_valid_)
-#define _Inout_opt_cap_(size) _SAL1_1_Source_(_Inout_opt_cap_, (size), _Pre_opt_valid_cap_(size) _Post_valid_)
-#define _Inout_bytecap_(size) _SAL1_1_Source_(_Inout_bytecap_, (size), _Pre_valid_bytecap_(size) _Post_valid_)
-#define _Inout_opt_bytecap_(size) _SAL1_1_Source_(_Inout_opt_bytecap_, (size), _Pre_opt_valid_bytecap_(size) _Post_valid_)
-
-#define _Inout_cap_c_(size) _SAL1_1_Source_(_Inout_cap_c_, (size), _Pre_valid_cap_c_(size) _Post_valid_)
-#define _Inout_opt_cap_c_(size) _SAL1_1_Source_(_Inout_opt_cap_c_, (size), _Pre_opt_valid_cap_c_(size) _Post_valid_)
-#define _Inout_bytecap_c_(size) _SAL1_1_Source_(_Inout_bytecap_c_, (size), _Pre_valid_bytecap_c_(size) _Post_valid_)
-#define _Inout_opt_bytecap_c_(size) _SAL1_1_Source_(_Inout_opt_bytecap_c_, (size), _Pre_opt_valid_bytecap_c_(size) _Post_valid_)
-
-#define _Inout_cap_x_(size) _SAL1_1_Source_(_Inout_cap_x_, (size), _Pre_valid_cap_x_(size) _Post_valid_)
-#define _Inout_opt_cap_x_(size) _SAL1_1_Source_(_Inout_opt_cap_x_, (size), _Pre_opt_valid_cap_x_(size) _Post_valid_)
-#define _Inout_bytecap_x_(size) _SAL1_1_Source_(_Inout_bytecap_x_, (size), _Pre_valid_bytecap_x_(size) _Post_valid_)
-#define _Inout_opt_bytecap_x_(size) _SAL1_1_Source_(_Inout_opt_bytecap_x_, (size), _Pre_opt_valid_bytecap_x_(size) _Post_valid_)
-
-// inout string buffers with writable size
-// e.g. void AppendStr( _In_z_ const char* szFrom, _Inout_z_cap_(cchTo) char* szTo, size_t cchTo );
-#define _Inout_z_cap_(size) _SAL1_1_Source_(_Inout_z_cap_, (size), _Pre_z_cap_(size) _Post_z_)
-#define _Inout_opt_z_cap_(size) _SAL1_1_Source_(_Inout_opt_z_cap_, (size), _Pre_opt_z_cap_(size) _Post_z_)
-#define _Inout_z_bytecap_(size) _SAL1_1_Source_(_Inout_z_bytecap_, (size), _Pre_z_bytecap_(size) _Post_z_)
-#define _Inout_opt_z_bytecap_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_, (size), _Pre_opt_z_bytecap_(size) _Post_z_)
-
-#define _Inout_z_cap_c_(size) _SAL1_1_Source_(_Inout_z_cap_c_, (size), _Pre_z_cap_c_(size) _Post_z_)
-#define _Inout_opt_z_cap_c_(size) _SAL1_1_Source_(_Inout_opt_z_cap_c_, (size), _Pre_opt_z_cap_c_(size) _Post_z_)
-#define _Inout_z_bytecap_c_(size) _SAL1_1_Source_(_Inout_z_bytecap_c_, (size), _Pre_z_bytecap_c_(size) _Post_z_)
-#define _Inout_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_c_, (size), _Pre_opt_z_bytecap_c_(size) _Post_z_)
-
-#define _Inout_z_cap_x_(size) _SAL1_1_Source_(_Inout_z_cap_x_, (size), _Pre_z_cap_x_(size) _Post_z_)
-#define _Inout_opt_z_cap_x_(size) _SAL1_1_Source_(_Inout_opt_z_cap_x_, (size), _Pre_opt_z_cap_x_(size) _Post_z_)
-#define _Inout_z_bytecap_x_(size) _SAL1_1_Source_(_Inout_z_bytecap_x_, (size), _Pre_z_bytecap_x_(size) _Post_z_)
-#define _Inout_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_x_, (size), _Pre_opt_z_bytecap_x_(size) _Post_z_)
-
-
-// returning pointers to valid objects
-#define _Ret_ _SAL1_1_Source_(_Ret_, (), _Ret_valid_)
-#define _Ret_opt_ _SAL1_1_Source_(_Ret_opt_, (), _Ret_opt_valid_)
-
-// annotations to express 'boundedness' of integral value parameter
-#define _In_bound_ _SAL1_1_Source_(_In_bound_, (), _In_bound_impl_)
-#define _Out_bound_ _SAL1_1_Source_(_Out_bound_, (), _Out_bound_impl_)
-#define _Ret_bound_ _SAL1_1_Source_(_Ret_bound_, (), _Ret_bound_impl_)
-#define _Deref_in_bound_ _SAL1_1_Source_(_Deref_in_bound_, (), _Deref_in_bound_impl_)
-#define _Deref_out_bound_ _SAL1_1_Source_(_Deref_out_bound_, (), _Deref_out_bound_impl_)
-#define _Deref_inout_bound_ _SAL1_1_Source_(_Deref_inout_bound_, (), _Deref_in_bound_ _Deref_out_bound_)
-#define _Deref_ret_bound_ _SAL1_1_Source_(_Deref_ret_bound_, (), _Deref_ret_bound_impl_)
-
-// e.g. HRESULT HrCreatePoint( _Deref_out_opt_ POINT** ppPT );
-#define _Deref_out_ _SAL1_1_Source_(_Deref_out_, (), _Out_ _Deref_post_valid_)
-#define _Deref_out_opt_ _SAL1_1_Source_(_Deref_out_opt_, (), _Out_ _Deref_post_opt_valid_)
-#define _Deref_opt_out_ _SAL1_1_Source_(_Deref_opt_out_, (), _Out_opt_ _Deref_post_valid_)
-#define _Deref_opt_out_opt_ _SAL1_1_Source_(_Deref_opt_out_opt_, (), _Out_opt_ _Deref_post_opt_valid_)
-
-// e.g. void CloneString( _In_z_ const WCHAR* wzFrom, _Deref_out_z_ WCHAR** pWzTo );
-#define _Deref_out_z_ _SAL1_1_Source_(_Deref_out_z_, (), _Out_ _Deref_post_z_)
-#define _Deref_out_opt_z_ _SAL1_1_Source_(_Deref_out_opt_z_, (), _Out_ _Deref_post_opt_z_)
-#define _Deref_opt_out_z_ _SAL1_1_Source_(_Deref_opt_out_z_, (), _Out_opt_ _Deref_post_z_)
-#define _Deref_opt_out_opt_z_ _SAL1_1_Source_(_Deref_opt_out_opt_z_, (), _Out_opt_ _Deref_post_opt_z_)
-
-//
-// _Deref_pre_ ---
-//
-// describing conditions for array elements of dereferenced pointer parameters that must be met before the call
-
-// e.g. void SaveStringArray( _In_count_(cStrings) _Deref_pre_z_ const WCHAR* const rgpwch[] );
-#define _Deref_pre_z_ _SAL1_1_Source_(_Deref_pre_z_, (), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__zterm_impl) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_ _SAL1_1_Source_(_Deref_pre_opt_z_, (), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__zterm_impl) _Pre_valid_impl_)
-
-// e.g. void FillInArrayOfStr32( _In_count_(cStrings) _Deref_pre_cap_c_(32) _Deref_post_z_ WCHAR* const rgpwch[] );
-// buffer capacity is described by another parameter
-#define _Deref_pre_cap_(size) _SAL1_1_Source_(_Deref_pre_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)))
-#define _Deref_pre_opt_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)))
-#define _Deref_pre_bytecap_(size) _SAL1_1_Source_(_Deref_pre_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)))
-#define _Deref_pre_opt_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)))
-
-// buffer capacity is described by a constant expression
-#define _Deref_pre_cap_c_(size) _SAL1_1_Source_(_Deref_pre_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)))
-#define _Deref_pre_opt_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)))
-#define _Deref_pre_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)))
-#define _Deref_pre_opt_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)))
-
-// buffer capacity is described by a complex condition
-#define _Deref_pre_cap_x_(size) _SAL1_1_Source_(_Deref_pre_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)))
-#define _Deref_pre_opt_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)))
-#define _Deref_pre_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)))
-#define _Deref_pre_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)))
-
-// convenience macros for nullterminated buffers with given capacity
-#define _Deref_pre_z_cap_(size) _SAL1_1_Source_(_Deref_pre_z_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_z_bytecap_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
-
-#define _Deref_pre_z_cap_c_(size) _SAL1_1_Source_(_Deref_pre_z_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
-
-#define _Deref_pre_z_cap_x_(size) _SAL1_1_Source_(_Deref_pre_z_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
-
-// known capacity and valid but unknown readable extent
-#define _Deref_pre_valid_cap_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_valid_bytecap_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
-
-#define _Deref_pre_valid_cap_c_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
-
-#define _Deref_pre_valid_cap_x_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
-
-// e.g. void SaveMatrix( _In_count_(n) _Deref_pre_count_(n) const Elem** matrix, size_t n );
-// valid buffer extent is described by another parameter
-#define _Deref_pre_count_(size) _SAL1_1_Source_(_Deref_pre_count_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_count_(size) _SAL1_1_Source_(_Deref_pre_opt_count_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_bytecount_(size) _SAL1_1_Source_(_Deref_pre_bytecount_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_bytecount_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
-
-// valid buffer extent is described by a constant expression
-#define _Deref_pre_count_c_(size) _SAL1_1_Source_(_Deref_pre_count_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_count_c_(size) _SAL1_1_Source_(_Deref_pre_opt_count_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_bytecount_c_(size) _SAL1_1_Source_(_Deref_pre_bytecount_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_bytecount_c_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
-
-// valid buffer extent is described by a complex expression
-#define _Deref_pre_count_x_(size) _SAL1_1_Source_(_Deref_pre_count_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_count_x_(size) _SAL1_1_Source_(_Deref_pre_opt_count_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_bytecount_x_(size) _SAL1_1_Source_(_Deref_pre_bytecount_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
-#define _Deref_pre_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
-
-// e.g. void PrintStringArray( _In_count_(cElems) _Deref_pre_valid_ LPCSTR rgStr[], size_t cElems );
-#define _Deref_pre_valid_ _SAL1_1_Source_(_Deref_pre_valid_, (), _Deref_pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_)
-#define _Deref_pre_opt_valid_ _SAL1_1_Source_(_Deref_pre_opt_valid_, (), _Deref_pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_)
-#define _Deref_pre_invalid_ _SAL1_1_Source_(_Deref_pre_invalid_, (), _Deref_pre1_impl_(__notvalid_impl))
-
-#define _Deref_pre_notnull_ _SAL1_1_Source_(_Deref_pre_notnull_, (), _Deref_pre1_impl_(__notnull_impl_notref))
-#define _Deref_pre_maybenull_ _SAL1_1_Source_(_Deref_pre_maybenull_, (), _Deref_pre1_impl_(__maybenull_impl_notref))
-#define _Deref_pre_null_ _SAL1_1_Source_(_Deref_pre_null_, (), _Deref_pre1_impl_(__null_impl_notref))
-
-// restrict access rights
-#define _Deref_pre_readonly_ _SAL1_1_Source_(_Deref_pre_readonly_, (), _Deref_pre1_impl_(__readaccess_impl_notref))
-#define _Deref_pre_writeonly_ _SAL1_1_Source_(_Deref_pre_writeonly_, (), _Deref_pre1_impl_(__writeaccess_impl_notref))
-
-//
-// _Deref_post_ ---
-//
-// describing conditions for array elements or dereferenced pointer parameters that hold after the call
-
-// e.g. void CloneString( _In_z_ const Wchar_t* wzIn _Out_ _Deref_post_z_ WCHAR** pWzOut );
-#define _Deref_post_z_ _SAL1_1_Source_(_Deref_post_z_, (), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__zterm_impl) _Post_valid_impl_)
-#define _Deref_post_opt_z_ _SAL1_1_Source_(_Deref_post_opt_z_, (), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__zterm_impl) _Post_valid_impl_)
-
-// e.g. HRESULT HrAllocateMemory( size_t cb, _Out_ _Deref_post_bytecap_(cb) void** ppv );
-// buffer capacity is described by another parameter
-#define _Deref_post_cap_(size) _SAL1_1_Source_(_Deref_post_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_impl(size)))
-#define _Deref_post_opt_cap_(size) _SAL1_1_Source_(_Deref_post_opt_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_impl(size)))
-#define _Deref_post_bytecap_(size) _SAL1_1_Source_(_Deref_post_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)))
-#define _Deref_post_opt_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)))
-
-// buffer capacity is described by a constant expression
-#define _Deref_post_cap_c_(size) _SAL1_1_Source_(_Deref_post_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)))
-#define _Deref_post_opt_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)))
-#define _Deref_post_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)))
-#define _Deref_post_opt_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)))
-
-// buffer capacity is described by a complex expression
-#define _Deref_post_cap_x_(size) _SAL1_1_Source_(_Deref_post_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)))
-#define _Deref_post_opt_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)))
-#define _Deref_post_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)))
-#define _Deref_post_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)))
-
-// convenience macros for nullterminated buffers with given capacity
-#define _Deref_post_z_cap_(size) _SAL1_1_Source_(_Deref_post_z_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_cap_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_z_bytecap_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_impl(size)) _Post_valid_impl_)
-
-#define _Deref_post_z_cap_c_(size) _SAL1_1_Source_(_Deref_post_z_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Post_valid_impl_)
-
-#define _Deref_post_z_cap_x_(size) _SAL1_1_Source_(_Deref_post_z_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Post_valid_impl_)
-
-// known capacity and valid but unknown readable extent
-#define _Deref_post_valid_cap_(size) _SAL1_1_Source_(_Deref_post_valid_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_valid_bytecap_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)) _Post_valid_impl_)
-
-#define _Deref_post_valid_cap_c_(size) _SAL1_1_Source_(_Deref_post_valid_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)) _Post_valid_impl_)
-
-#define _Deref_post_valid_cap_x_(size) _SAL1_1_Source_(_Deref_post_valid_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)) _Post_valid_impl_)
-
-// e.g. HRESULT HrAllocateZeroInitializedMemory( size_t cb, _Out_ _Deref_post_bytecount_(cb) void** ppv );
-// valid buffer extent is described by another parameter
-#define _Deref_post_count_(size) _SAL1_1_Source_(_Deref_post_count_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_count_(size) _SAL1_1_Source_(_Deref_post_opt_count_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_impl(size)) _Post_valid_impl_)
-#define _Deref_post_bytecount_(size) _SAL1_1_Source_(_Deref_post_bytecount_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_bytecount_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
-
-// buffer capacity is described by a constant expression
-#define _Deref_post_count_c_(size) _SAL1_1_Source_(_Deref_post_count_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_count_c_(size) _SAL1_1_Source_(_Deref_post_opt_count_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_bytecount_c_(size) _SAL1_1_Source_(_Deref_post_bytecount_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_bytecount_c_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
-
-// buffer capacity is described by a complex expression
-#define _Deref_post_count_x_(size) _SAL1_1_Source_(_Deref_post_count_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_count_x_(size) _SAL1_1_Source_(_Deref_post_opt_count_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_bytecount_x_(size) _SAL1_1_Source_(_Deref_post_bytecount_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
-#define _Deref_post_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
-
-// e.g. void GetStrings( _Out_count_(cElems) _Deref_post_valid_ LPSTR const rgStr[], size_t cElems );
-#define _Deref_post_valid_ _SAL1_1_Source_(_Deref_post_valid_, (), _Deref_post1_impl_(__notnull_impl_notref) _Post_valid_impl_)
-#define _Deref_post_opt_valid_ _SAL1_1_Source_(_Deref_post_opt_valid_, (), _Deref_post1_impl_(__maybenull_impl_notref) _Post_valid_impl_)
-
-#define _Deref_post_notnull_ _SAL1_1_Source_(_Deref_post_notnull_, (), _Deref_post1_impl_(__notnull_impl_notref))
-#define _Deref_post_maybenull_ _SAL1_1_Source_(_Deref_post_maybenull_, (), _Deref_post1_impl_(__maybenull_impl_notref))
-#define _Deref_post_null_ _SAL1_1_Source_(_Deref_post_null_, (), _Deref_post1_impl_(__null_impl_notref))
-
-//
-// _Deref_ret_ ---
-//
-
-#define _Deref_ret_z_ _SAL1_1_Source_(_Deref_ret_z_, (), _Deref_ret1_impl_(__notnull_impl_notref) _Deref_ret1_impl_(__zterm_impl))
-#define _Deref_ret_opt_z_ _SAL1_1_Source_(_Deref_ret_opt_z_, (), _Deref_ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__zterm_impl))
-
-//
-// special _Deref_ ---
-//
-#define _Deref2_pre_readonly_ _SAL1_1_Source_(_Deref2_pre_readonly_, (), _Deref2_pre1_impl_(__readaccess_impl_notref))
-
-//
-// _Ret_ ---
-//
-
-// e.g. _Ret_opt_valid_ LPSTR void* CloneSTR( _Pre_valid_ LPSTR src );
-#define _Ret_opt_valid_ _SAL1_1_Source_(_Ret_opt_valid_, (), _Ret1_impl_(__maybenull_impl_notref) _Ret_valid_impl_)
-#define _Ret_opt_z_ _SAL1_1_Source_(_Ret_opt_z_, (), _Ret2_impl_(__maybenull_impl,__zterm_impl) _Ret_valid_impl_)
-
-// e.g. _Ret_opt_bytecap_(cb) void* AllocateMemory( size_t cb );
-// Buffer capacity is described by another parameter
-#define _Ret_cap_(size) _SAL1_1_Source_(_Ret_cap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_impl(size)))
-#define _Ret_opt_cap_(size) _SAL1_1_Source_(_Ret_opt_cap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_impl(size)))
-#define _Ret_bytecap_(size) _SAL1_1_Source_(_Ret_bytecap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_impl(size)))
-#define _Ret_opt_bytecap_(size) _SAL1_1_Source_(_Ret_opt_bytecap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_impl(size)))
-
-// Buffer capacity is described by a constant expression
-#define _Ret_cap_c_(size) _SAL1_1_Source_(_Ret_cap_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_c_impl(size)))
-#define _Ret_opt_cap_c_(size) _SAL1_1_Source_(_Ret_opt_cap_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_c_impl(size)))
-#define _Ret_bytecap_c_(size) _SAL1_1_Source_(_Ret_bytecap_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_c_impl(size)))
-#define _Ret_opt_bytecap_c_(size) _SAL1_1_Source_(_Ret_opt_bytecap_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_c_impl(size)))
-
-// Buffer capacity is described by a complex condition
-#define _Ret_cap_x_(size) _SAL1_1_Source_(_Ret_cap_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_x_impl(size)))
-#define _Ret_opt_cap_x_(size) _SAL1_1_Source_(_Ret_opt_cap_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_x_impl(size)))
-#define _Ret_bytecap_x_(size) _SAL1_1_Source_(_Ret_bytecap_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_x_impl(size)))
-#define _Ret_opt_bytecap_x_(size) _SAL1_1_Source_(_Ret_opt_bytecap_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_x_impl(size)))
-
-// return value is nullterminated and capacity is given by another parameter
-#define _Ret_z_cap_(size) _SAL1_1_Source_(_Ret_z_cap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__cap_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_z_cap_(size) _SAL1_1_Source_(_Ret_opt_z_cap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__cap_impl(size)) _Ret_valid_impl_)
-#define _Ret_z_bytecap_(size) _SAL1_1_Source_(_Ret_z_bytecap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecap_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_z_bytecap_(size) _SAL1_1_Source_(_Ret_opt_z_bytecap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecap_impl(size)) _Ret_valid_impl_)
-
-// e.g. _Ret_opt_bytecount_(cb) void* AllocateZeroInitializedMemory( size_t cb );
-// Valid Buffer extent is described by another parameter
-#define _Ret_count_(size) _SAL1_1_Source_(_Ret_count_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_count_(size) _SAL1_1_Source_(_Ret_opt_count_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_impl(size)) _Ret_valid_impl_)
-#define _Ret_bytecount_(size) _SAL1_1_Source_(_Ret_bytecount_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_bytecount_(size) _SAL1_1_Source_(_Ret_opt_bytecount_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_impl(size)) _Ret_valid_impl_)
-
-// Valid Buffer extent is described by a constant expression
-#define _Ret_count_c_(size) _SAL1_1_Source_(_Ret_count_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_c_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_count_c_(size) _SAL1_1_Source_(_Ret_opt_count_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_c_impl(size)) _Ret_valid_impl_)
-#define _Ret_bytecount_c_(size) _SAL1_1_Source_(_Ret_bytecount_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_c_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_bytecount_c_(size) _SAL1_1_Source_(_Ret_opt_bytecount_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_c_impl(size)) _Ret_valid_impl_)
-
-// Valid Buffer extent is described by a complex expression
-#define _Ret_count_x_(size) _SAL1_1_Source_(_Ret_count_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_x_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_count_x_(size) _SAL1_1_Source_(_Ret_opt_count_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_x_impl(size)) _Ret_valid_impl_)
-#define _Ret_bytecount_x_(size) _SAL1_1_Source_(_Ret_bytecount_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_x_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_bytecount_x_(size) _SAL1_1_Source_(_Ret_opt_bytecount_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_x_impl(size)) _Ret_valid_impl_)
-
-// return value is nullterminated and length is given by another parameter
-#define _Ret_z_count_(size) _SAL1_1_Source_(_Ret_z_count_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__count_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_z_count_(size) _SAL1_1_Source_(_Ret_opt_z_count_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__count_impl(size)) _Ret_valid_impl_)
-#define _Ret_z_bytecount_(size) _SAL1_1_Source_(_Ret_z_bytecount_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecount_impl(size)) _Ret_valid_impl_)
-#define _Ret_opt_z_bytecount_(size) _SAL1_1_Source_(_Ret_opt_z_bytecount_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecount_impl(size)) _Ret_valid_impl_)
-
-
-// _Pre_ annotations ---
-#define _Pre_opt_z_ _SAL1_1_Source_(_Pre_opt_z_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__zterm_impl) _Pre_valid_impl_)
-
-// restrict access rights
-#define _Pre_readonly_ _SAL1_1_Source_(_Pre_readonly_, (), _Pre1_impl_(__readaccess_impl_notref))
-#define _Pre_writeonly_ _SAL1_1_Source_(_Pre_writeonly_, (), _Pre1_impl_(__writeaccess_impl_notref))
-
-// e.g. void FreeMemory( _Pre_bytecap_(cb) _Post_ptr_invalid_ void* pv, size_t cb );
-// buffer capacity described by another parameter
-#define _Pre_cap_(size) _SAL1_1_Source_(_Pre_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_impl(size)))
-#define _Pre_opt_cap_(size) _SAL1_1_Source_(_Pre_opt_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_impl(size)))
-#define _Pre_bytecap_(size) _SAL1_1_Source_(_Pre_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_impl(size)))
-#define _Pre_opt_bytecap_(size) _SAL1_1_Source_(_Pre_opt_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_impl(size)))
-
-// buffer capacity described by a constant expression
-#define _Pre_cap_c_(size) _SAL1_1_Source_(_Pre_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_impl(size)))
-#define _Pre_opt_cap_c_(size) _SAL1_1_Source_(_Pre_opt_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_impl(size)))
-#define _Pre_bytecap_c_(size) _SAL1_1_Source_(_Pre_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)))
-#define _Pre_opt_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)))
-#define _Pre_cap_c_one_ _SAL1_1_Source_(_Pre_cap_c_one_, (), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl))
-#define _Pre_opt_cap_c_one_ _SAL1_1_Source_(_Pre_opt_cap_c_one_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl))
-
-// buffer capacity is described by another parameter multiplied by a constant expression
-#define _Pre_cap_m_(mult,size) _SAL1_1_Source_(_Pre_cap_m_, (mult,size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__mult_impl(mult,size)))
-#define _Pre_opt_cap_m_(mult,size) _SAL1_1_Source_(_Pre_opt_cap_m_, (mult,size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__mult_impl(mult,size)))
-
-// buffer capacity described by size of other buffer, only used by dangerous legacy APIs
-// e.g. int strcpy(_Pre_cap_for_(src) char* dst, const char* src);
-#define _Pre_cap_for_(param) _SAL1_1_Source_(_Pre_cap_for_, (param), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_for_impl(param)))
-#define _Pre_opt_cap_for_(param) _SAL1_1_Source_(_Pre_opt_cap_for_, (param), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_for_impl(param)))
-
-// buffer capacity described by a complex condition
-#define _Pre_cap_x_(size) _SAL1_1_Source_(_Pre_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(size)))
-#define _Pre_opt_cap_x_(size) _SAL1_1_Source_(_Pre_opt_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(size)))
-#define _Pre_bytecap_x_(size) _SAL1_1_Source_(_Pre_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)))
-#define _Pre_opt_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)))
-
-// buffer capacity described by the difference to another pointer parameter
-#define _Pre_ptrdiff_cap_(ptr) _SAL1_1_Source_(_Pre_ptrdiff_cap_, (ptr), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(__ptrdiff(ptr))))
-#define _Pre_opt_ptrdiff_cap_(ptr) _SAL1_1_Source_(_Pre_opt_ptrdiff_cap_, (ptr), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(__ptrdiff(ptr))))
-
-// e.g. void AppendStr( _Pre_z_ const char* szFrom, _Pre_z_cap_(cchTo) _Post_z_ char* szTo, size_t cchTo );
-#define _Pre_z_cap_(size) _SAL1_1_Source_(_Pre_z_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_cap_(size) _SAL1_1_Source_(_Pre_opt_z_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
-#define _Pre_z_bytecap_(size) _SAL1_1_Source_(_Pre_z_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_bytecap_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
-
-#define _Pre_z_cap_c_(size) _SAL1_1_Source_(_Pre_z_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_cap_c_(size) _SAL1_1_Source_(_Pre_opt_z_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_z_bytecap_c_(size) _SAL1_1_Source_(_Pre_z_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
-
-#define _Pre_z_cap_x_(size) _SAL1_1_Source_(_Pre_z_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_cap_x_(size) _SAL1_1_Source_(_Pre_opt_z_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_z_bytecap_x_(size) _SAL1_1_Source_(_Pre_z_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
-
-// known capacity and valid but unknown readable extent
-#define _Pre_valid_cap_(size) _SAL1_1_Source_(_Pre_valid_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_cap_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
-#define _Pre_valid_bytecap_(size) _SAL1_1_Source_(_Pre_valid_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_bytecap_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
-
-#define _Pre_valid_cap_c_(size) _SAL1_1_Source_(_Pre_valid_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_cap_c_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_valid_bytecap_c_(size) _SAL1_1_Source_(_Pre_valid_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
-
-#define _Pre_valid_cap_x_(size) _SAL1_1_Source_(_Pre_valid_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_cap_x_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_valid_bytecap_x_(size) _SAL1_1_Source_(_Pre_valid_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
-
-// e.g. void AppendCharRange( _Pre_count_(cchFrom) const char* rgFrom, size_t cchFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
-// Valid buffer extent described by another parameter
-#define _Pre_count_(size) _SAL1_1_Source_(_Pre_count_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_count_(size) _SAL1_1_Source_(_Pre_opt_count_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
-#define _Pre_bytecount_(size) _SAL1_1_Source_(_Pre_bytecount_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_bytecount_(size) _SAL1_1_Source_(_Pre_opt_bytecount_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
-
-// Valid buffer extent described by a constant expression
-#define _Pre_count_c_(size) _SAL1_1_Source_(_Pre_count_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_count_c_(size) _SAL1_1_Source_(_Pre_opt_count_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_bytecount_c_(size) _SAL1_1_Source_(_Pre_bytecount_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_bytecount_c_(size) _SAL1_1_Source_(_Pre_opt_bytecount_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
-
-// Valid buffer extent described by a complex expression
-#define _Pre_count_x_(size) _SAL1_1_Source_(_Pre_count_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_count_x_(size) _SAL1_1_Source_(_Pre_opt_count_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_bytecount_x_(size) _SAL1_1_Source_(_Pre_bytecount_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
-#define _Pre_opt_bytecount_x_(size) _SAL1_1_Source_(_Pre_opt_bytecount_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
-
-// Valid buffer extent described by the difference to another pointer parameter
-#define _Pre_ptrdiff_count_(ptr) _SAL1_1_Source_(_Pre_ptrdiff_count_, (ptr), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_x_impl(__ptrdiff(ptr))) _Pre_valid_impl_)
-#define _Pre_opt_ptrdiff_count_(ptr) _SAL1_1_Source_(_Pre_opt_ptrdiff_count_, (ptr), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_x_impl(__ptrdiff(ptr))) _Pre_valid_impl_)
-
-
-// char * strncpy(_Out_cap_(_Count) _Post_maybez_ char * _Dest, _In_z_ const char * _Source, _In_ size_t _Count)
-// buffer maybe zero-terminated after the call
-#define _Post_maybez_ _SAL1_1_Source_(_Post_maybez_, (), _Post1_impl_(__maybezterm_impl))
-
-// e.g. SIZE_T HeapSize( _In_ HANDLE hHeap, DWORD dwFlags, _Pre_notnull_ _Post_bytecap_(return) LPCVOID lpMem );
-#define _Post_cap_(size) _SAL1_1_Source_(_Post_cap_, (size), _Post1_impl_(__cap_impl(size)))
-#define _Post_bytecap_(size) _SAL1_1_Source_(_Post_bytecap_, (size), _Post1_impl_(__bytecap_impl(size)))
-
-// e.g. int strlen( _In_z_ _Post_count_(return+1) const char* sz );
-#define _Post_count_(size) _SAL1_1_Source_(_Post_count_, (size), _Post1_impl_(__count_impl(size)) _Post_valid_impl_)
-#define _Post_bytecount_(size) _SAL1_1_Source_(_Post_bytecount_, (size), _Post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
-#define _Post_count_c_(size) _SAL1_1_Source_(_Post_count_c_, (size), _Post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
-#define _Post_bytecount_c_(size) _SAL1_1_Source_(_Post_bytecount_c_, (size), _Post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
-#define _Post_count_x_(size) _SAL1_1_Source_(_Post_count_x_, (size), _Post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
-#define _Post_bytecount_x_(size) _SAL1_1_Source_(_Post_bytecount_x_, (size), _Post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
-
-// e.g. size_t CopyStr( _In_z_ const char* szFrom, _Pre_cap_(cch) _Post_z_count_(return+1) char* szFrom, size_t cchFrom );
-#define _Post_z_count_(size) _SAL1_1_Source_(_Post_z_count_, (size), _Post2_impl_(__zterm_impl,__count_impl(size)) _Post_valid_impl_)
-#define _Post_z_bytecount_(size) _SAL1_1_Source_(_Post_z_bytecount_, (size), _Post2_impl_(__zterm_impl,__bytecount_impl(size)) _Post_valid_impl_)
-#define _Post_z_count_c_(size) _SAL1_1_Source_(_Post_z_count_c_, (size), _Post2_impl_(__zterm_impl,__count_c_impl(size)) _Post_valid_impl_)
-#define _Post_z_bytecount_c_(size) _SAL1_1_Source_(_Post_z_bytecount_c_, (size), _Post2_impl_(__zterm_impl,__bytecount_c_impl(size)) _Post_valid_impl_)
-#define _Post_z_count_x_(size) _SAL1_1_Source_(_Post_z_count_x_, (size), _Post2_impl_(__zterm_impl,__count_x_impl(size)) _Post_valid_impl_)
-#define _Post_z_bytecount_x_(size) _SAL1_1_Source_(_Post_z_bytecount_x_, (size), _Post2_impl_(__zterm_impl,__bytecount_x_impl(size)) _Post_valid_impl_)
-
-//
-// _Prepost_ ---
-//
-// describing conditions that hold before and after the function call
-
-#define _Prepost_opt_z_ _SAL1_1_Source_(_Prepost_opt_z_, (), _Pre_opt_z_ _Post_z_)
-
-#define _Prepost_count_(size) _SAL1_1_Source_(_Prepost_count_, (size), _Pre_count_(size) _Post_count_(size))
-#define _Prepost_opt_count_(size) _SAL1_1_Source_(_Prepost_opt_count_, (size), _Pre_opt_count_(size) _Post_count_(size))
-#define _Prepost_bytecount_(size) _SAL1_1_Source_(_Prepost_bytecount_, (size), _Pre_bytecount_(size) _Post_bytecount_(size))
-#define _Prepost_opt_bytecount_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_, (size), _Pre_opt_bytecount_(size) _Post_bytecount_(size))
-#define _Prepost_count_c_(size) _SAL1_1_Source_(_Prepost_count_c_, (size), _Pre_count_c_(size) _Post_count_c_(size))
-#define _Prepost_opt_count_c_(size) _SAL1_1_Source_(_Prepost_opt_count_c_, (size), _Pre_opt_count_c_(size) _Post_count_c_(size))
-#define _Prepost_bytecount_c_(size) _SAL1_1_Source_(_Prepost_bytecount_c_, (size), _Pre_bytecount_c_(size) _Post_bytecount_c_(size))
-#define _Prepost_opt_bytecount_c_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_c_, (size), _Pre_opt_bytecount_c_(size) _Post_bytecount_c_(size))
-#define _Prepost_count_x_(size) _SAL1_1_Source_(_Prepost_count_x_, (size), _Pre_count_x_(size) _Post_count_x_(size))
-#define _Prepost_opt_count_x_(size) _SAL1_1_Source_(_Prepost_opt_count_x_, (size), _Pre_opt_count_x_(size) _Post_count_x_(size))
-#define _Prepost_bytecount_x_(size) _SAL1_1_Source_(_Prepost_bytecount_x_, (size), _Pre_bytecount_x_(size) _Post_bytecount_x_(size))
-#define _Prepost_opt_bytecount_x_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_x_, (size), _Pre_opt_bytecount_x_(size) _Post_bytecount_x_(size))
-
-#define _Prepost_valid_ _SAL1_1_Source_(_Prepost_valid_, (), _Pre_valid_ _Post_valid_)
-#define _Prepost_opt_valid_ _SAL1_1_Source_(_Prepost_opt_valid_, (), _Pre_opt_valid_ _Post_valid_)
-
-//
-// _Deref_ ---
-//
-// short version for _Deref_pre_ _Deref_post_
-// describing conditions for array elements or dereferenced pointer parameters that hold before and after the call
-
-#define _Deref_prepost_z_ _SAL1_1_Source_(_Deref_prepost_z_, (), _Deref_pre_z_ _Deref_post_z_)
-#define _Deref_prepost_opt_z_ _SAL1_1_Source_(_Deref_prepost_opt_z_, (), _Deref_pre_opt_z_ _Deref_post_opt_z_)
-
-#define _Deref_prepost_cap_(size) _SAL1_1_Source_(_Deref_prepost_cap_, (size), _Deref_pre_cap_(size) _Deref_post_cap_(size))
-#define _Deref_prepost_opt_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_cap_, (size), _Deref_pre_opt_cap_(size) _Deref_post_opt_cap_(size))
-#define _Deref_prepost_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_bytecap_, (size), _Deref_pre_bytecap_(size) _Deref_post_bytecap_(size))
-#define _Deref_prepost_opt_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecap_, (size), _Deref_pre_opt_bytecap_(size) _Deref_post_opt_bytecap_(size))
-
-#define _Deref_prepost_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_cap_x_, (size), _Deref_pre_cap_x_(size) _Deref_post_cap_x_(size))
-#define _Deref_prepost_opt_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_cap_x_, (size), _Deref_pre_opt_cap_x_(size) _Deref_post_opt_cap_x_(size))
-#define _Deref_prepost_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_bytecap_x_, (size), _Deref_pre_bytecap_x_(size) _Deref_post_bytecap_x_(size))
-#define _Deref_prepost_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecap_x_, (size), _Deref_pre_opt_bytecap_x_(size) _Deref_post_opt_bytecap_x_(size))
-
-#define _Deref_prepost_z_cap_(size) _SAL1_1_Source_(_Deref_prepost_z_cap_, (size), _Deref_pre_z_cap_(size) _Deref_post_z_cap_(size))
-#define _Deref_prepost_opt_z_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_z_cap_, (size), _Deref_pre_opt_z_cap_(size) _Deref_post_opt_z_cap_(size))
-#define _Deref_prepost_z_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_z_bytecap_, (size), _Deref_pre_z_bytecap_(size) _Deref_post_z_bytecap_(size))
-#define _Deref_prepost_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_z_bytecap_, (size), _Deref_pre_opt_z_bytecap_(size) _Deref_post_opt_z_bytecap_(size))
-
-#define _Deref_prepost_valid_cap_(size) _SAL1_1_Source_(_Deref_prepost_valid_cap_, (size), _Deref_pre_valid_cap_(size) _Deref_post_valid_cap_(size))
-#define _Deref_prepost_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_cap_, (size), _Deref_pre_opt_valid_cap_(size) _Deref_post_opt_valid_cap_(size))
-#define _Deref_prepost_valid_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_valid_bytecap_, (size), _Deref_pre_valid_bytecap_(size) _Deref_post_valid_bytecap_(size))
-#define _Deref_prepost_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_bytecap_, (size), _Deref_pre_opt_valid_bytecap_(size) _Deref_post_opt_valid_bytecap_(size))
-
-#define _Deref_prepost_valid_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_valid_cap_x_, (size), _Deref_pre_valid_cap_x_(size) _Deref_post_valid_cap_x_(size))
-#define _Deref_prepost_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_cap_x_, (size), _Deref_pre_opt_valid_cap_x_(size) _Deref_post_opt_valid_cap_x_(size))
-#define _Deref_prepost_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_valid_bytecap_x_, (size), _Deref_pre_valid_bytecap_x_(size) _Deref_post_valid_bytecap_x_(size))
-#define _Deref_prepost_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_bytecap_x_, (size), _Deref_pre_opt_valid_bytecap_x_(size) _Deref_post_opt_valid_bytecap_x_(size))
-
-#define _Deref_prepost_count_(size) _SAL1_1_Source_(_Deref_prepost_count_, (size), _Deref_pre_count_(size) _Deref_post_count_(size))
-#define _Deref_prepost_opt_count_(size) _SAL1_1_Source_(_Deref_prepost_opt_count_, (size), _Deref_pre_opt_count_(size) _Deref_post_opt_count_(size))
-#define _Deref_prepost_bytecount_(size) _SAL1_1_Source_(_Deref_prepost_bytecount_, (size), _Deref_pre_bytecount_(size) _Deref_post_bytecount_(size))
-#define _Deref_prepost_opt_bytecount_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecount_, (size), _Deref_pre_opt_bytecount_(size) _Deref_post_opt_bytecount_(size))
-
-#define _Deref_prepost_count_x_(size) _SAL1_1_Source_(_Deref_prepost_count_x_, (size), _Deref_pre_count_x_(size) _Deref_post_count_x_(size))
-#define _Deref_prepost_opt_count_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_count_x_, (size), _Deref_pre_opt_count_x_(size) _Deref_post_opt_count_x_(size))
-#define _Deref_prepost_bytecount_x_(size) _SAL1_1_Source_(_Deref_prepost_bytecount_x_, (size), _Deref_pre_bytecount_x_(size) _Deref_post_bytecount_x_(size))
-#define _Deref_prepost_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecount_x_, (size), _Deref_pre_opt_bytecount_x_(size) _Deref_post_opt_bytecount_x_(size))
-
-#define _Deref_prepost_valid_ _SAL1_1_Source_(_Deref_prepost_valid_, (), _Deref_pre_valid_ _Deref_post_valid_)
-#define _Deref_prepost_opt_valid_ _SAL1_1_Source_(_Deref_prepost_opt_valid_, (), _Deref_pre_opt_valid_ _Deref_post_opt_valid_)
-
-//
-// _Deref_
-//
-// used with references to arrays
-
-#define _Deref_out_z_cap_c_(size) _SAL1_1_Source_(_Deref_out_z_cap_c_, (size), _Deref_pre_cap_c_(size) _Deref_post_z_)
-#define _Deref_inout_z_cap_c_(size) _SAL1_1_Source_(_Deref_inout_z_cap_c_, (size), _Deref_pre_z_cap_c_(size) _Deref_post_z_)
-#define _Deref_out_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_out_z_bytecap_c_, (size), _Deref_pre_bytecap_c_(size) _Deref_post_z_)
-#define _Deref_inout_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_inout_z_bytecap_c_, (size), _Deref_pre_z_bytecap_c_(size) _Deref_post_z_)
-#define _Deref_inout_z_ _SAL1_1_Source_(_Deref_inout_z_, (), _Deref_prepost_z_)
-
-// #pragma endregion Input Buffer SAL 1 compatibility macros
-
-
-//============================================================================
-// Implementation Layer:
-//============================================================================
-
-
-// Naming conventions:
-// A symbol the begins with _SA_ is for the machinery of creating any
-// annotations; many of those come from sourceannotations.h in the case
-// of attributes.
-
-// A symbol that ends with _impl is the very lowest level macro. It is
-// not required to be a legal standalone annotation, and in the case
-// of attribute annotations, usually is not. (In the case of some declspec
-// annotations, it might be, but it should not be assumed so.) Those
-// symols will be used in the _PreN..., _PostN... and _RetN... annotations
-// to build up more complete annotations.
-
-// A symbol ending in _impl_ is reserved to the implementation as well,
-// but it does form a complete annotation; usually they are used to build
-// up even higher level annotations.
-
-
-#if _USE_ATTRIBUTES_FOR_SAL || _USE_DECLSPECS_FOR_SAL // [
-// Sharable "_impl" macros: these can be shared between the various annotation
-// forms but are part of the implementation of the macros. These are collected
-// here to assure that only necessary differences in the annotations
-// exist.
-
-#define _Always_impl_(annos) _Group_(annos _SAL_nop_impl_) _On_failure_impl_(annos _SAL_nop_impl_)
-#define _Bound_impl_ _SA_annotes0(SAL_bound)
-#define _Field_range_impl_(min,max) _Range_impl_(min,max)
-#define _Literal_impl_ _SA_annotes1(SAL_constant, __yes)
-#define _Maybenull_impl_ _SA_annotes1(SAL_null, __maybe)
-#define _Maybevalid_impl_ _SA_annotes1(SAL_valid, __maybe)
-#define _Must_inspect_impl_ _Post_impl_ _SA_annotes0(SAL_mustInspect)
-#define _Notliteral_impl_ _SA_annotes1(SAL_constant, __no)
-#define _Notnull_impl_ _SA_annotes1(SAL_null, __no)
-#define _Notvalid_impl_ _SA_annotes1(SAL_valid, __no)
-#define _NullNull_terminated_impl_ _Group_(_SA_annotes1(SAL_nullTerminated, __yes) _SA_annotes1(SAL_readableTo,inexpressibleCount("NullNull terminated string")))
-#define _Null_impl_ _SA_annotes1(SAL_null, __yes)
-#define _Null_terminated_impl_ _SA_annotes1(SAL_nullTerminated, __yes)
-#define _Out_impl_ _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl) _Post_valid_impl_
-#define _Out_opt_impl_ _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl) _Post_valid_impl_
-#define _Points_to_data_impl_ _At_(*_Curr_, _SA_annotes1(SAL_mayBePointer, __no))
-#define _Post_satisfies_impl_(cond) _Post_impl_ _Satisfies_impl_(cond)
-#define _Post_valid_impl_ _Post1_impl_(__valid_impl)
-#define _Pre_satisfies_impl_(cond) _Pre_impl_ _Satisfies_impl_(cond)
-#define _Pre_valid_impl_ _Pre1_impl_(__valid_impl)
-#define _Range_impl_(min,max) _SA_annotes2(SAL_range, min, max)
-#define _Readable_bytes_impl_(size) _SA_annotes1(SAL_readableTo, byteCount(size))
-#define _Readable_elements_impl_(size) _SA_annotes1(SAL_readableTo, elementCount(size))
-#define _Ret_valid_impl_ _Ret1_impl_(__valid_impl)
-#define _Satisfies_impl_(cond) _SA_annotes1(SAL_satisfies, cond)
-#define _Valid_impl_ _SA_annotes1(SAL_valid, __yes)
-#define _Writable_bytes_impl_(size) _SA_annotes1(SAL_writableTo, byteCount(size))
-#define _Writable_elements_impl_(size) _SA_annotes1(SAL_writableTo, elementCount(size))
-
-#define _In_range_impl_(min,max) _Pre_impl_ _Range_impl_(min,max)
-#define _Out_range_impl_(min,max) _Post_impl_ _Range_impl_(min,max)
-#define _Ret_range_impl_(min,max) _Post_impl_ _Range_impl_(min,max)
-#define _Deref_in_range_impl_(min,max) _Deref_pre_impl_ _Range_impl_(min,max)
-#define _Deref_out_range_impl_(min,max) _Deref_post_impl_ _Range_impl_(min,max)
-#define _Deref_ret_range_impl_(min,max) _Deref_post_impl_ _Range_impl_(min,max)
-
-#define _Deref_pre_impl_ _Pre_impl_ _Notref_impl_ _Deref_impl_
-#define _Deref_post_impl_ _Post_impl_ _Notref_impl_ _Deref_impl_
-
-// The following are for the implementation machinery, and are not
-// suitable for annotating general code.
-// We're tying to phase this out, someday. The parser quotes the param.
-#define __AuToQuOtE _SA_annotes0(SAL_AuToQuOtE)
-
-// Normally the parser does some simple type checking of annotation params,
-// defer that check to the plugin.
-#define __deferTypecheck _SA_annotes0(SAL_deferTypecheck)
-
-#define _SA_SPECSTRIZE( x ) #x
-#define _SAL_nop_impl_ /* nothing */
-#define __nop_impl(x) x
-#endif
-
-
-#if _USE_ATTRIBUTES_FOR_SAL // [
-
-// Using attributes for sal
-
-#include "codeanalysis\sourceannotations.h"
-
-
-#define _SA_annotes0(n) [SAL_annotes(Name=#n)]
-#define _SA_annotes1(n,pp1) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1))]
-#define _SA_annotes2(n,pp1,pp2) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1), p2=_SA_SPECSTRIZE(pp2))]
-#define _SA_annotes3(n,pp1,pp2,pp3) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1), p2=_SA_SPECSTRIZE(pp2), p3=_SA_SPECSTRIZE(pp3))]
-
-#define _Pre_impl_ [SAL_pre]
-#define _Post_impl_ [SAL_post]
-#define _Deref_impl_ [SAL_deref]
-#define _Notref_impl_ [SAL_notref]
-
-
-// Declare a function to be an annotation or primop (respectively).
-// Done this way so that they don't appear in the regular compiler's
-// namespace.
-#define __ANNOTATION(fun) _SA_annotes0(SAL_annotation) void __SA_##fun;
-#define __PRIMOP(type, fun) _SA_annotes0(SAL_primop) type __SA_##fun;
-#define __QUALIFIER(fun) _SA_annotes0(SAL_qualifier) void __SA_##fun;
-
-// Benign declspec needed here for WindowsPREfast
-#define __In_impl_ [SA_Pre(Valid=SA_Yes)] [SA_Pre(Deref=1, Notref=1, Access=SA_Read)] __declspec("SAL_pre SAL_valid")
-
-#elif _USE_DECLSPECS_FOR_SAL // ][
-
-// Using declspecs for sal
-
-#define _SA_annotes0(n) __declspec(#n)
-#define _SA_annotes1(n,pp1) __declspec(#n "(" _SA_SPECSTRIZE(pp1) ")" )
-#define _SA_annotes2(n,pp1,pp2) __declspec(#n "(" _SA_SPECSTRIZE(pp1) "," _SA_SPECSTRIZE(pp2) ")")
-#define _SA_annotes3(n,pp1,pp2,pp3) __declspec(#n "(" _SA_SPECSTRIZE(pp1) "," _SA_SPECSTRIZE(pp2) "," _SA_SPECSTRIZE(pp3) ")")
-
-#define _Pre_impl_ _SA_annotes0(SAL_pre)
-#define _Post_impl_ _SA_annotes0(SAL_post)
-#define _Deref_impl_ _SA_annotes0(SAL_deref)
-#define _Notref_impl_ _SA_annotes0(SAL_notref)
-
-// Declare a function to be an annotation or primop (respectively).
-// Done this way so that they don't appear in the regular compiler's
-// namespace.
-#define __ANNOTATION(fun) _SA_annotes0(SAL_annotation) void __SA_##fun
-
-#define __PRIMOP(type, fun) _SA_annotes0(SAL_primop) type __SA_##fun
-
-#define __QUALIFIER(fun) _SA_annotes0(SAL_qualifier) void __SA_##fun;
-
-#define __In_impl_ _Pre_impl_ _SA_annotes0(SAL_valid) _Pre_impl_ _Deref_impl_ _Notref_impl_ _SA_annotes0(SAL_readonly)
-
-#else // ][
-
-// Using "nothing" for sal
-
-#define _SA_annotes0(n)
-#define _SA_annotes1(n,pp1)
-#define _SA_annotes2(n,pp1,pp2)
-#define _SA_annotes3(n,pp1,pp2,pp3)
-
-#define __ANNOTATION(fun)
-#define __PRIMOP(type, fun)
-#define __QUALIFIER(type, fun)
-
-#endif // ]
-
-#if _USE_ATTRIBUTES_FOR_SAL || _USE_DECLSPECS_FOR_SAL // [
-
-// Declare annotations that need to be declared.
-__ANNOTATION(SAL_useHeader(void));
-__ANNOTATION(SAL_bound(void));
-__ANNOTATION(SAL_allocator(void)); //??? resolve with PFD
-__ANNOTATION(SAL_file_parser(__AuToQuOtE __In_impl_ char *, __In_impl_ char *));
-__ANNOTATION(SAL_source_code_content(__In_impl_ char *));
-__ANNOTATION(SAL_analysisHint(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_untrusted_data_source(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_untrusted_data_source_this(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_validated(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_validated_this(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_encoded(void));
-__ANNOTATION(SAL_adt(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_add_adt_property(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_remove_adt_property(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_transfer_adt_property_from(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_post_type(__AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_volatile(void));
-__ANNOTATION(SAL_nonvolatile(void));
-__ANNOTATION(SAL_entrypoint(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
-__ANNOTATION(SAL_blocksOn(__In_impl_ void*));
-__ANNOTATION(SAL_mustInspect(void));
-
-// Only appears in model files, but needs to be declared.
-__ANNOTATION(SAL_TypeName(__AuToQuOtE __In_impl_ char *));
-
-// To be declared well-known soon.
-__ANNOTATION(SAL_interlocked(void);)
-
-#pragma warning (suppress: 28227 28241)
-__ANNOTATION(SAL_name(__In_impl_ char *, __In_impl_ char *, __In_impl_ char *);)
-
-__PRIMOP(char *, _Macro_value_(__In_impl_ char *));
-__PRIMOP(int, _Macro_defined_(__In_impl_ char *));
-__PRIMOP(char *, _Strstr_(__In_impl_ char *, __In_impl_ char *));
-
-#endif // ]
-
-#if _USE_ATTRIBUTES_FOR_SAL // [
-
-#define _Check_return_impl_ [SA_Post(MustCheck=SA_Yes)]
-
-#define _Success_impl_(expr) [SA_Success(Condition=#expr)]
-#define _On_failure_impl_(annos) [SAL_context(p1="SAL_failed")] _Group_(_Post_impl_ _Group_(annos _SAL_nop_impl_))
-
-#define _Printf_format_string_impl_ [SA_FormatString(Style="printf")]
-#define _Scanf_format_string_impl_ [SA_FormatString(Style="scanf")]
-#define _Scanf_s_format_string_impl_ [SA_FormatString(Style="scanf_s")]
-
-#define _In_bound_impl_ [SA_PreBound(Deref=0)]
-#define _Out_bound_impl_ [SA_PostBound(Deref=0)]
-#define _Ret_bound_impl_ [SA_PostBound(Deref=0)]
-#define _Deref_in_bound_impl_ [SA_PreBound(Deref=1)]
-#define _Deref_out_bound_impl_ [SA_PostBound(Deref=1)]
-#define _Deref_ret_bound_impl_ [SA_PostBound(Deref=1)]
-
-#define __valid_impl Valid=SA_Yes
-#define __maybevalid_impl Valid=SA_Maybe
-#define __notvalid_impl Valid=SA_No
-
-#define __null_impl Null=SA_Yes
-#define __maybenull_impl Null=SA_Maybe
-#define __notnull_impl Null=SA_No
-
-#define __null_impl_notref Null=SA_Yes,Notref=1
-#define __maybenull_impl_notref Null=SA_Maybe,Notref=1
-#define __notnull_impl_notref Null=SA_No,Notref=1
-
-#define __zterm_impl NullTerminated=SA_Yes
-#define __maybezterm_impl NullTerminated=SA_Maybe
-#define __maybzterm_impl NullTerminated=SA_Maybe
-#define __notzterm_impl NullTerminated=SA_No
-
-#define __readaccess_impl Access=SA_Read
-#define __writeaccess_impl Access=SA_Write
-#define __allaccess_impl Access=SA_ReadWrite
-
-#define __readaccess_impl_notref Access=SA_Read,Notref=1
-#define __writeaccess_impl_notref Access=SA_Write,Notref=1
-#define __allaccess_impl_notref Access=SA_ReadWrite,Notref=1
-
-#if _MSC_VER >= 1610 /*IFSTRIP=IGN*/ // [
-
-// For SAL2, we need to expect general expressions.
-
-#define __cap_impl(size) WritableElements="\n"#size
-#define __bytecap_impl(size) WritableBytes="\n"#size
-#define __bytecount_impl(size) ValidBytes="\n"#size
-#define __count_impl(size) ValidElements="\n"#size
-
-#else // ][
-
-#define __cap_impl(size) WritableElements=#size
-#define __bytecap_impl(size) WritableBytes=#size
-#define __bytecount_impl(size) ValidBytes=#size
-#define __count_impl(size) ValidElements=#size
-
-#endif // ]
-
-#define __cap_c_impl(size) WritableElementsConst=size
-#define __cap_c_one_notref_impl WritableElementsConst=1,Notref=1
-#define __cap_for_impl(param) WritableElementsLength=#param
-#define __cap_x_impl(size) WritableElements="\n@"#size
-
-#define __bytecap_c_impl(size) WritableBytesConst=size
-#define __bytecap_x_impl(size) WritableBytes="\n@"#size
-
-#define __mult_impl(mult,size) __cap_impl((mult)*(size))
-
-#define __count_c_impl(size) ValidElementsConst=size
-#define __count_x_impl(size) ValidElements="\n@"#size
-
-#define __bytecount_c_impl(size) ValidBytesConst=size
-#define __bytecount_x_impl(size) ValidBytes="\n@"#size
-
-
-#define _At_impl_(target, annos) [SAL_at(p1=#target)] _Group_(annos)
-#define _At_buffer_impl_(target, iter, bound, annos) [SAL_at_buffer(p1=#target, p2=#iter, p3=#bound)] _Group_(annos)
-#define _When_impl_(expr, annos) [SAL_when(p1=#expr)] _Group_(annos)
-
-#define _Group_impl_(annos) [SAL_begin] annos [SAL_end]
-#define _GrouP_impl_(annos) [SAL_BEGIN] annos [SAL_END]
-
-#define _Use_decl_anno_impl_ _SA_annotes0(SAL_useHeader) // this is a special case!
-
-#define _Pre1_impl_(p1) [SA_Pre(p1)]
-#define _Pre2_impl_(p1,p2) [SA_Pre(p1,p2)]
-#define _Pre3_impl_(p1,p2,p3) [SA_Pre(p1,p2,p3)]
-
-#define _Post1_impl_(p1) [SA_Post(p1)]
-#define _Post2_impl_(p1,p2) [SA_Post(p1,p2)]
-#define _Post3_impl_(p1,p2,p3) [SA_Post(p1,p2,p3)]
-
-#define _Ret1_impl_(p1) [SA_Post(p1)]
-#define _Ret2_impl_(p1,p2) [SA_Post(p1,p2)]
-#define _Ret3_impl_(p1,p2,p3) [SA_Post(p1,p2,p3)]
-
-#define _Deref_pre1_impl_(p1) [SA_Pre(Deref=1,p1)]
-#define _Deref_pre2_impl_(p1,p2) [SA_Pre(Deref=1,p1,p2)]
-#define _Deref_pre3_impl_(p1,p2,p3) [SA_Pre(Deref=1,p1,p2,p3)]
-
-
-#define _Deref_post1_impl_(p1) [SA_Post(Deref=1,p1)]
-#define _Deref_post2_impl_(p1,p2) [SA_Post(Deref=1,p1,p2)]
-#define _Deref_post3_impl_(p1,p2,p3) [SA_Post(Deref=1,p1,p2,p3)]
-
-#define _Deref_ret1_impl_(p1) [SA_Post(Deref=1,p1)]
-#define _Deref_ret2_impl_(p1,p2) [SA_Post(Deref=1,p1,p2)]
-#define _Deref_ret3_impl_(p1,p2,p3) [SA_Post(Deref=1,p1,p2,p3)]
-
-#define _Deref2_pre1_impl_(p1) [SA_Pre(Deref=2,Notref=1,p1)]
-#define _Deref2_post1_impl_(p1) [SA_Post(Deref=2,Notref=1,p1)]
-#define _Deref2_ret1_impl_(p1) [SA_Post(Deref=2,Notref=1,p1)]
-
-// Obsolete -- may be needed for transition to attributes.
-#define __inner_typefix(ctype) [SAL_typefix(p1=_SA_SPECSTRIZE(ctype))]
-#define __inner_exceptthat [SAL_except]
-
-
-#elif _USE_DECLSPECS_FOR_SAL // ][
-
-#define _Check_return_impl_ __post _SA_annotes0(SAL_checkReturn)
-
-#define _Success_impl_(expr) _SA_annotes1(SAL_success, expr)
-#define _On_failure_impl_(annos) _SA_annotes1(SAL_context, SAL_failed) _Group_(_Post_impl_ _Group_(_SAL_nop_impl_ annos))
-
-#define _Printf_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "printf")
-#define _Scanf_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "scanf")
-#define _Scanf_s_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "scanf_s")
-
-#define _In_bound_impl_ _Pre_impl_ _Bound_impl_
-#define _Out_bound_impl_ _Post_impl_ _Bound_impl_
-#define _Ret_bound_impl_ _Post_impl_ _Bound_impl_
-#define _Deref_in_bound_impl_ _Deref_pre_impl_ _Bound_impl_
-#define _Deref_out_bound_impl_ _Deref_post_impl_ _Bound_impl_
-#define _Deref_ret_bound_impl_ _Deref_post_impl_ _Bound_impl_
-
-
-#define __null_impl _SA_annotes0(SAL_null) // _SA_annotes1(SAL_null, __yes)
-#define __notnull_impl _SA_annotes0(SAL_notnull) // _SA_annotes1(SAL_null, __no)
-#define __maybenull_impl _SA_annotes0(SAL_maybenull) // _SA_annotes1(SAL_null, __maybe)
-
-#define __valid_impl _SA_annotes0(SAL_valid) // _SA_annotes1(SAL_valid, __yes)
-#define __notvalid_impl _SA_annotes0(SAL_notvalid) // _SA_annotes1(SAL_valid, __no)
-#define __maybevalid_impl _SA_annotes0(SAL_maybevalid) // _SA_annotes1(SAL_valid, __maybe)
-
-#define __null_impl_notref _Notref_ _Null_impl_
-#define __maybenull_impl_notref _Notref_ _Maybenull_impl_
-#define __notnull_impl_notref _Notref_ _Notnull_impl_
-
-#define __zterm_impl _SA_annotes1(SAL_nullTerminated, __yes)
-#define __maybezterm_impl _SA_annotes1(SAL_nullTerminated, __maybe)
-#define __maybzterm_impl _SA_annotes1(SAL_nullTerminated, __maybe)
-#define __notzterm_impl _SA_annotes1(SAL_nullTerminated, __no)
-
-#define __readaccess_impl _SA_annotes1(SAL_access, 0x1)
-#define __writeaccess_impl _SA_annotes1(SAL_access, 0x2)
-#define __allaccess_impl _SA_annotes1(SAL_access, 0x3)
-
-#define __readaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x1)
-#define __writeaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x2)
-#define __allaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x3)
-
-#define __cap_impl(size) _SA_annotes1(SAL_writableTo,elementCount(size))
-#define __cap_c_impl(size) _SA_annotes1(SAL_writableTo,elementCount(size))
-#define __cap_c_one_notref_impl _Notref_ _SA_annotes1(SAL_writableTo,elementCount(1))
-#define __cap_for_impl(param) _SA_annotes1(SAL_writableTo,inexpressibleCount(sizeof(param)))
-#define __cap_x_impl(size) _SA_annotes1(SAL_writableTo,inexpressibleCount(#size))
-
-#define __bytecap_impl(size) _SA_annotes1(SAL_writableTo,byteCount(size))
-#define __bytecap_c_impl(size) _SA_annotes1(SAL_writableTo,byteCount(size))
-#define __bytecap_x_impl(size) _SA_annotes1(SAL_writableTo,inexpressibleCount(#size))
-
-#define __mult_impl(mult,size) _SA_annotes1(SAL_writableTo,(mult)*(size))
-
-#define __count_impl(size) _SA_annotes1(SAL_readableTo,elementCount(size))
-#define __count_c_impl(size) _SA_annotes1(SAL_readableTo,elementCount(size))
-#define __count_x_impl(size) _SA_annotes1(SAL_readableTo,inexpressibleCount(#size))
-
-#define __bytecount_impl(size) _SA_annotes1(SAL_readableTo,byteCount(size))
-#define __bytecount_c_impl(size) _SA_annotes1(SAL_readableTo,byteCount(size))
-#define __bytecount_x_impl(size) _SA_annotes1(SAL_readableTo,inexpressibleCount(#size))
-
-#define _At_impl_(target, annos) _SA_annotes0(SAL_at(target)) _Group_(annos)
-#define _At_buffer_impl_(target, iter, bound, annos) _SA_annotes3(SAL_at_buffer, target, iter, bound) _Group_(annos)
-#define _Group_impl_(annos) _SA_annotes0(SAL_begin) annos _SA_annotes0(SAL_end)
-#define _GrouP_impl_(annos) _SA_annotes0(SAL_BEGIN) annos _SA_annotes0(SAL_END)
-#define _When_impl_(expr, annos) _SA_annotes0(SAL_when(expr)) _Group_(annos)
-
-#define _Use_decl_anno_impl_ __declspec("SAL_useHeader()") // this is a special case!
-
-#define _Pre1_impl_(p1) _Pre_impl_ p1
-#define _Pre2_impl_(p1,p2) _Pre_impl_ p1 _Pre_impl_ p2
-#define _Pre3_impl_(p1,p2,p3) _Pre_impl_ p1 _Pre_impl_ p2 _Pre_impl_ p3
-
-#define _Post1_impl_(p1) _Post_impl_ p1
-#define _Post2_impl_(p1,p2) _Post_impl_ p1 _Post_impl_ p2
-#define _Post3_impl_(p1,p2,p3) _Post_impl_ p1 _Post_impl_ p2 _Post_impl_ p3
-
-#define _Ret1_impl_(p1) _Post_impl_ p1
-#define _Ret2_impl_(p1,p2) _Post_impl_ p1 _Post_impl_ p2
-#define _Ret3_impl_(p1,p2,p3) _Post_impl_ p1 _Post_impl_ p2 _Post_impl_ p3
-
-#define _Deref_pre1_impl_(p1) _Deref_pre_impl_ p1
-#define _Deref_pre2_impl_(p1,p2) _Deref_pre_impl_ p1 _Deref_pre_impl_ p2
-#define _Deref_pre3_impl_(p1,p2,p3) _Deref_pre_impl_ p1 _Deref_pre_impl_ p2 _Deref_pre_impl_ p3
-
-#define _Deref_post1_impl_(p1) _Deref_post_impl_ p1
-#define _Deref_post2_impl_(p1,p2) _Deref_post_impl_ p1 _Deref_post_impl_ p2
-#define _Deref_post3_impl_(p1,p2,p3) _Deref_post_impl_ p1 _Deref_post_impl_ p2 _Deref_post_impl_ p3
-
-#define _Deref_ret1_impl_(p1) _Deref_post_impl_ p1
-#define _Deref_ret2_impl_(p1,p2) _Deref_post_impl_ p1 _Deref_post_impl_ p2
-#define _Deref_ret3_impl_(p1,p2,p3) _Deref_post_impl_ p1 _Deref_post_impl_ p2 _Deref_post_impl_ p3
-
-#define _Deref2_pre1_impl_(p1) _Deref_pre_impl_ _Notref_impl_ _Deref_impl_ p1
-#define _Deref2_post1_impl_(p1) _Deref_post_impl_ _Notref_impl_ _Deref_impl_ p1
-#define _Deref2_ret1_impl_(p1) _Deref_post_impl_ _Notref_impl_ _Deref_impl_ p1
-
-#define __inner_typefix(ctype) _SA_annotes1(SAL_typefix, ctype)
-#define __inner_exceptthat _SA_annotes0(SAL_except)
-
-#elif defined(_MSC_EXTENSIONS) && !defined( MIDL_PASS ) && !defined(__midl) && !defined(RC_INVOKED) && defined(_PFT_VER) && _MSC_VER >= 1400 /*IFSTRIP=IGN*/ // ][
-
-// minimum attribute expansion for foreground build
-
-#pragma push_macro( "SA" )
-#pragma push_macro( "REPEATABLE" )
-
-#ifdef __cplusplus // [
-#define SA( id ) id
-#define REPEATABLE [repeatable]
-#else // !__cplusplus // ][
-#define SA( id ) SA_##id
-#define REPEATABLE
-#endif // !__cplusplus // ]
-
-REPEATABLE
-[source_annotation_attribute( SA( Parameter ) )]
-struct __P_impl
-{
-#ifdef __cplusplus // [
- __P_impl();
-#endif // ]
- int __d_;
-};
-typedef struct __P_impl __P_impl;
-
-REPEATABLE
-[source_annotation_attribute( SA( ReturnValue ) )]
-struct __R_impl
-{
-#ifdef __cplusplus // [
- __R_impl();
-#endif // ]
- int __d_;
-};
-typedef struct __R_impl __R_impl;
-
-[source_annotation_attribute( SA( Method ) )]
-struct __M_
-{
-#ifdef __cplusplus // [
- __M_();
-#endif // ]
- int __d_;
-};
-typedef struct __M_ __M_;
-
-[source_annotation_attribute( SA( All ) )]
-struct __A_
-{
-#ifdef __cplusplus // [
- __A_();
-#endif // ]
- int __d_;
-};
-typedef struct __A_ __A_;
-
-[source_annotation_attribute( SA( Field ) )]
-struct __F_
-{
-#ifdef __cplusplus // [
- __F_();
-#endif // ]
- int __d_;
-};
-typedef struct __F_ __F_;
-
-#pragma pop_macro( "REPEATABLE" )
-#pragma pop_macro( "SA" )
-
-
-#define _SAL_nop_impl_
-
-#define _At_impl_(target, annos) [__A_(__d_=0)]
-#define _At_buffer_impl_(target, iter, bound, annos) [__A_(__d_=0)]
-#define _When_impl_(expr, annos) annos
-#define _Group_impl_(annos) annos
-#define _GrouP_impl_(annos) annos
-#define _Use_decl_anno_impl_ [__M_(__d_=0)]
-
-#define _Points_to_data_impl_ [__P_impl(__d_=0)]
-#define _Literal_impl_ [__P_impl(__d_=0)]
-#define _Notliteral_impl_ [__P_impl(__d_=0)]
-
-#define _Pre_valid_impl_ [__P_impl(__d_=0)]
-#define _Post_valid_impl_ [__P_impl(__d_=0)]
-#define _Ret_valid_impl_ [__R_impl(__d_=0)]
-
-#define _Check_return_impl_ [__R_impl(__d_=0)]
-#define _Must_inspect_impl_ [__R_impl(__d_=0)]
-
-#define _Success_impl_(expr) [__M_(__d_=0)]
-#define _On_failure_impl_(expr) [__M_(__d_=0)]
-#define _Always_impl_(expr) [__M_(__d_=0)]
-
-#define _Printf_format_string_impl_ [__P_impl(__d_=0)]
-#define _Scanf_format_string_impl_ [__P_impl(__d_=0)]
-#define _Scanf_s_format_string_impl_ [__P_impl(__d_=0)]
-
-#define _Raises_SEH_exception_impl_ [__M_(__d_=0)]
-#define _Maybe_raises_SEH_exception_impl_ [__M_(__d_=0)]
-
-#define _In_bound_impl_ [__P_impl(__d_=0)]
-#define _Out_bound_impl_ [__P_impl(__d_=0)]
-#define _Ret_bound_impl_ [__R_impl(__d_=0)]
-#define _Deref_in_bound_impl_ [__P_impl(__d_=0)]
-#define _Deref_out_bound_impl_ [__P_impl(__d_=0)]
-#define _Deref_ret_bound_impl_ [__R_impl(__d_=0)]
-
-#define _Range_impl_(min,max) [__P_impl(__d_=0)]
-#define _In_range_impl_(min,max) [__P_impl(__d_=0)]
-#define _Out_range_impl_(min,max) [__P_impl(__d_=0)]
-#define _Ret_range_impl_(min,max) [__R_impl(__d_=0)]
-#define _Deref_in_range_impl_(min,max) [__P_impl(__d_=0)]
-#define _Deref_out_range_impl_(min,max) [__P_impl(__d_=0)]
-#define _Deref_ret_range_impl_(min,max) [__R_impl(__d_=0)]
-
-#define _Field_range_impl_(min,max) [__F_(__d_=0)]
-
-#define _Pre_satisfies_impl_(cond) [__A_(__d_=0)]
-#define _Post_satisfies_impl_(cond) [__A_(__d_=0)]
-#define _Satisfies_impl_(cond) [__A_(__d_=0)]
-
-#define _Null_impl_ [__A_(__d_=0)]
-#define _Notnull_impl_ [__A_(__d_=0)]
-#define _Maybenull_impl_ [__A_(__d_=0)]
-
-#define _Valid_impl_ [__A_(__d_=0)]
-#define _Notvalid_impl_ [__A_(__d_=0)]
-#define _Maybevalid_impl_ [__A_(__d_=0)]
-
-#define _Readable_bytes_impl_(size) [__A_(__d_=0)]
-#define _Readable_elements_impl_(size) [__A_(__d_=0)]
-#define _Writable_bytes_impl_(size) [__A_(__d_=0)]
-#define _Writable_elements_impl_(size) [__A_(__d_=0)]
-
-#define _Null_terminated_impl_ [__A_(__d_=0)]
-#define _NullNull_terminated_impl_ [__A_(__d_=0)]
-
-#define _Pre_impl_ [__P_impl(__d_=0)]
-#define _Pre1_impl_(p1) [__P_impl(__d_=0)]
-#define _Pre2_impl_(p1,p2) [__P_impl(__d_=0)]
-#define _Pre3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
-
-#define _Post_impl_ [__P_impl(__d_=0)]
-#define _Post1_impl_(p1) [__P_impl(__d_=0)]
-#define _Post2_impl_(p1,p2) [__P_impl(__d_=0)]
-#define _Post3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
-
-#define _Ret1_impl_(p1) [__R_impl(__d_=0)]
-#define _Ret2_impl_(p1,p2) [__R_impl(__d_=0)]
-#define _Ret3_impl_(p1,p2,p3) [__R_impl(__d_=0)]
-
-#define _Deref_pre1_impl_(p1) [__P_impl(__d_=0)]
-#define _Deref_pre2_impl_(p1,p2) [__P_impl(__d_=0)]
-#define _Deref_pre3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
-
-#define _Deref_post1_impl_(p1) [__P_impl(__d_=0)]
-#define _Deref_post2_impl_(p1,p2) [__P_impl(__d_=0)]
-#define _Deref_post3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
-
-#define _Deref_ret1_impl_(p1) [__R_impl(__d_=0)]
-#define _Deref_ret2_impl_(p1,p2) [__R_impl(__d_=0)]
-#define _Deref_ret3_impl_(p1,p2,p3) [__R_impl(__d_=0)]
-
-#define _Deref2_pre1_impl_(p1) //[__P_impl(__d_=0)]
-#define _Deref2_post1_impl_(p1) //[__P_impl(__d_=0)]
-#define _Deref2_ret1_impl_(p1) //[__P_impl(__d_=0)]
-
-#else // ][
-
-
-#define _SAL_nop_impl_ X
-
-#define _At_impl_(target, annos)
-#define _When_impl_(expr, annos)
-#define _Group_impl_(annos)
-#define _GrouP_impl_(annos)
-#define _At_buffer_impl_(target, iter, bound, annos)
-#define _Use_decl_anno_impl_
-#define _Points_to_data_impl_
-#define _Literal_impl_
-#define _Notliteral_impl_
-#define _Notref_impl_
-
-#define _Pre_valid_impl_
-#define _Post_valid_impl_
-#define _Ret_valid_impl_
-
-#define _Check_return_impl_
-#define _Must_inspect_impl_
-
-#define _Success_impl_(expr)
-#define _On_failure_impl_(annos)
-#define _Always_impl_(annos)
-
-#define _Printf_format_string_impl_
-#define _Scanf_format_string_impl_
-#define _Scanf_s_format_string_impl_
-
-#define _In_bound_impl_
-#define _Out_bound_impl_
-#define _Ret_bound_impl_
-#define _Deref_in_bound_impl_
-#define _Deref_out_bound_impl_
-#define _Deref_ret_bound_impl_
-
-#define _Range_impl_(min,max)
-#define _In_range_impl_(min,max)
-#define _Out_range_impl_(min,max)
-#define _Ret_range_impl_(min,max)
-#define _Deref_in_range_impl_(min,max)
-#define _Deref_out_range_impl_(min,max)
-#define _Deref_ret_range_impl_(min,max)
-
-#define _Satisfies_impl_(expr)
-#define _Pre_satisfies_impl_(expr)
-#define _Post_satisfies_impl_(expr)
-
-#define _Null_impl_
-#define _Notnull_impl_
-#define _Maybenull_impl_
-
-#define _Valid_impl_
-#define _Notvalid_impl_
-#define _Maybevalid_impl_
-
-#define _Field_range_impl_(min,max)
-
-#define _Pre_impl_
-#define _Pre1_impl_(p1)
-#define _Pre2_impl_(p1,p2)
-#define _Pre3_impl_(p1,p2,p3)
-
-#define _Post_impl_
-#define _Post1_impl_(p1)
-#define _Post2_impl_(p1,p2)
-#define _Post3_impl_(p1,p2,p3)
-
-#define _Ret1_impl_(p1)
-#define _Ret2_impl_(p1,p2)
-#define _Ret3_impl_(p1,p2,p3)
-
-#define _Deref_pre1_impl_(p1)
-#define _Deref_pre2_impl_(p1,p2)
-#define _Deref_pre3_impl_(p1,p2,p3)
-
-#define _Deref_post1_impl_(p1)
-#define _Deref_post2_impl_(p1,p2)
-#define _Deref_post3_impl_(p1,p2,p3)
-
-#define _Deref_ret1_impl_(p1)
-#define _Deref_ret2_impl_(p1,p2)
-#define _Deref_ret3_impl_(p1,p2,p3)
-
-#define _Deref2_pre1_impl_(p1)
-#define _Deref2_post1_impl_(p1)
-#define _Deref2_ret1_impl_(p1)
-
-#define _Readable_bytes_impl_(size)
-#define _Readable_elements_impl_(size)
-#define _Writable_bytes_impl_(size)
-#define _Writable_elements_impl_(size)
-
-#define _Null_terminated_impl_
-#define _NullNull_terminated_impl_
-
-// Obsolete -- may be needed for transition to attributes.
-#define __inner_typefix(ctype)
-#define __inner_exceptthat
-
-#endif // ]
-
-// This section contains the deprecated annotations
-
-/*
- -------------------------------------------------------------------------------
- Introduction
-
- sal.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 may be placed before either a function parameter's type or its return
- type, and describe the function's behavior regarding the parameter or return value.
- There are two classes of 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 sal.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 | NullTerm | Optional | Parameters |
- |------------|------------|---------|--------|----------|----------|---------------|
- | <> | <> | <> | <> | _z | <> | <> |
- | _deref | _in | _ecount | _full | _nz | _opt | (size) |
- | _deref_opt | _out | _bcount | _part | | | (size,length) |
- | | _inout | | | | | |
- | | | | | | | |
- |------------|------------|---------|--------|----------|----------|---------------|
-
- 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. Cannot be used with _deref.
- _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.
-
- NullTerm: States if the present of a '\0' marks the end of valid elements in the buffer.
- _z : A '\0' indicated the end of the buffer
- _nz : The buffer may not be null terminated and a '\0' does not indicate the end of the
- buffer.
- 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(
- __in LPCSTR pszString,
- 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 NULL terminated on exit.
- __in LPCSTR pszSrc,
- 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.
-
- -------------------------------------------------------------------------------
- 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.
-
- __success(expr) 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.
-
- __nullterminated p :
- Pointer p is a buffer that may be read or written up to and including the first
- NULL character or pointer. May be used on typedefs, which marks valid (properly
- initialized) instances of that type as being NULL-terminated.
-
- __nullnullterminated p :
- Pointer p is a buffer that may be read or written up to and including the first
- sequence of two NULL characters or pointers. May be used on typedefs, which marks
- valid instances of that type as being double-NULL terminated.
-
- __reserved v :
- Value v must be 0/NULL, reserved for future use.
-
- __checkReturn v :
- Return value v must not be ignored by callers of this function.
-
- __typefix(ctype) v :
- Value v should be treated as an instance of ctype, rather than its declared type.
-
- __override f :
- Specify C#-style 'override' behaviour for overriding virtual methods.
-
- __callback f :
- Function f can be used as a function pointer.
-
- __format_string 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.
-
- -------------------------------------------------------------------------------
- Advanced Annotation Examples
-
- __success(return != FALSE) LWSTDAPI_(BOOL)
- PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) :
- pszBuf is only guaranteed to be NULL-terminated when TRUE is returned.
-
- typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings.
-
- __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 __specstrings
-
-#ifdef __cplusplus // [
-#ifndef __nothrow // [
-# define __nothrow NOTHROW_DECL
-#endif // ]
-extern "C" {
-#else // ][
-#ifndef __nothrow // [
-# define __nothrow
-#endif // ]
-#endif /* #ifdef __cplusplus */ // ]
-
-
-/*
- -------------------------------------------------------------------------------
- Helper Macro Definitions
-
- These express behavior common to many of the high-level annotations.
- DO NOT USE THESE IN YOUR CODE.
- -------------------------------------------------------------------------------
-*/
-
-/*
- The helper annotations are only understood by the compiler version used by
- various defect detection tools. When the regular compiler is running, they
- are defined into nothing, and do not affect the compiled code.
-*/
-
-#if !defined(__midl) && defined(_PREFAST_) // [
-
- /*
- In the primitive "SAL_*" annotations "SAL" stands for Standard
- Annotation Language. These "SAL_*" annotations are the
- primitives the compiler understands and high-level MACROs
- will decompose into these primivates.
- */
-
- #define _SA_SPECSTRIZE( x ) #x
-
- /*
- __null p
- __notnull p
- __maybenull p
-
- Annotates a pointer p. States that pointer p is null. Commonly used
- in the negated form __notnull or the possibly null form __maybenull.
- */
-
-#ifndef PAL_STDCPP_COMPAT
- #define __null _Null_impl_
- #define __notnull _Notnull_impl_
- #define __maybenull _Maybenull_impl_
-#endif // !PAL_STDCPP_COMPAT
-
- /*
- __readonly l
- __notreadonly l
- __mabyereadonly l
-
- Annotates a location l. States that location l is not modified after
- this point. If the annotation is placed on the precondition state of
- a function, the restriction only applies until the postcondition state
- of the function. __maybereadonly states that the annotated location
- may be modified, whereas __notreadonly states that a location must be
- modified.
- */
-
- #define __readonly _Pre1_impl_(__readaccess_impl)
- #define __notreadonly _Pre1_impl_(__allaccess_impl)
- #define __maybereadonly _Pre1_impl_(__readaccess_impl)
-
- /*
- __valid v
- __notvalid v
- __maybevalid v
-
- Annotates any value v. States that the value satisfies all properties of
- valid values of its type. For example, for a string buffer, valid means
- that the buffer pointer is either NULL or points to a NULL-terminated string.
- */
-
- #define __valid _Valid_impl_
- #define __notvalid _Notvalid_impl_
- #define __maybevalid _Maybevalid_impl_
-
- /*
- __readableTo(extent) p
-
- Annotates a buffer pointer p. If the buffer can be read, extent describes
- how much of the buffer is readable. For a reader of the buffer, this is
- an explicit permission to read up to that amount, rather than a restriction to
- read only up to it.
- */
-
- #define __readableTo(extent) _SA_annotes1(SAL_readableTo, extent)
-
- /*
-
- __elem_readableTo(size)
-
- Annotates a buffer pointer p as being readable to size elements.
- */
-
- #define __elem_readableTo(size) _SA_annotes1(SAL_readableTo, elementCount( size ))
-
- /*
- __byte_readableTo(size)
-
- Annotates a buffer pointer p as being readable to size bytes.
- */
- #define __byte_readableTo(size) _SA_annotes1(SAL_readableTo, byteCount(size))
-
- /*
- __writableTo(extent) p
-
- Annotates a buffer pointer p. If the buffer can be modified, extent
- describes how much of the buffer is writable (usually the allocation
- size). For a writer of the buffer, this is an explicit permission to
- write up to that amount, rather than a restriction to write only up to it.
- */
- #define __writableTo(size) _SA_annotes1(SAL_writableTo, size)
-
- /*
- __elem_writableTo(size)
-
- Annotates a buffer pointer p as being writable to size elements.
- */
- #define __elem_writableTo(size) _SA_annotes1(SAL_writableTo, elementCount( size ))
-
- /*
- __byte_writableTo(size)
-
- Annotates a buffer pointer p as being writable to size bytes.
- */
- #define __byte_writableTo(size) _SA_annotes1(SAL_writableTo, byteCount( size))
-
- /*
- __deref p
-
- Annotates a pointer p. The next annotation applies one dereference down
- in the type. If readableTo(p, size) then the next annotation applies to
- all elements *(p+i) for which i satisfies the size. If p is a pointer
- to a struct, the next annotation applies to all fields of the struct.
- */
- #define __deref _Deref_impl_
-
- /*
- __pre __next_annotation
-
- The next annotation applies in the precondition state
- */
- #define __pre _Pre_impl_
-
- /*
- __post __next_annotation
-
- The next annotation applies in the postcondition state
- */
- #define __post _Post_impl_
-
- /*
- __precond()
-
- When is true, the next annotation applies in the precondition state
- (currently not enabled)
- */
- #define __precond(expr) __pre
-
- /*
- __postcond()
-
- When is true, the next annotation applies in the postcondition state
- (currently not enabled)
- */
- #define __postcond(expr) __post
-
- /*
- __exceptthat
-
- Given a set of annotations Q containing __exceptthat maybeP, the effect of
- the except clause is to erase any P or notP annotations (explicit or
- implied) within Q at the same level of dereferencing that the except
- clause appears, and to replace it with maybeP.
-
- Example 1: __valid __pre_except_maybenull on a pointer p means that the
- pointer may be null, and is otherwise valid, thus overriding
- the implicit notnull annotation implied by __valid on
- pointers.
-
- Example 2: __valid __deref __pre_except_maybenull on an int **p means
- that p is not null (implied by valid), but the elements
- pointed to by p could be null, and are otherwise valid.
- */
- #define __exceptthat __inner_exceptthat
-
- /*
- _refparam
-
- Added to all out parameter macros to indicate that they are all reference
- parameters.
- */
- #define __refparam _Notref_ __deref __notreadonly
-
- /*
- __inner_*
-
- Helper macros that directly correspond to certain high-level annotations.
-
- */
-
- /*
- Macros to classify the entrypoints and indicate their category.
-
- Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM.
-
- */
- #define __inner_control_entrypoint(category) _SA_annotes2(SAL_entrypoint, controlEntry, category)
-
-
- /*
- Pre-defined data entry point categories include: Registry, File, Network.
- */
- #define __inner_data_entrypoint(category) _SA_annotes2(SAL_entrypoint, dataEntry, category)
-
- #define __inner_override _SA_annotes0(__override)
- #define __inner_callback _SA_annotes0(__callback)
- #define __inner_blocksOn(resource) _SA_annotes1(SAL_blocksOn, resource)
- #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {}
- #define __inner_fallthrough __FallThrough();
-
- #define __post_except_maybenull __post __inner_exceptthat _Maybenull_impl_
- #define __pre_except_maybenull __pre __inner_exceptthat _Maybenull_impl_
-
- #define __post_deref_except_maybenull __post __deref __inner_exceptthat _Maybenull_impl_
- #define __pre_deref_except_maybenull __pre __deref __inner_exceptthat _Maybenull_impl_
-
- #define __inexpressible_readableTo(size) _Readable_elements_impl_(_Inexpressible_(size))
- #define __inexpressible_writableTo(size) _Writable_elements_impl_(_Inexpressible_(size))
-
-
-#else // ][
-#ifndef PAL_STDCPP_COMPAT
- #define __null
- #define __notnull
- #define __deref
-#endif // !PAL_STDCPP_COMPAT
- #define __maybenull
- #define __readonly
- #define __notreadonly
- #define __maybereadonly
- // commented because it conflicts with stdlibc++ 8
- //#define __valid
- #define __notvalid
- #define __maybevalid
- #define __readableTo(extent)
- #define __elem_readableTo(size)
- #define __byte_readableTo(size)
- #define __writableTo(size)
- #define __elem_writableTo(size)
- #define __byte_writableTo(size)
- // commented because it conflicts with stdlibc++ 8
- //#define __pre
- #define __post
- #define __precond(expr)
- #define __postcond(expr)
- #define __exceptthat
- #define __inner_override
- #define __inner_callback
- #define __inner_blocksOn(resource)
- #define __inner_fallthrough_dec
- #define __inner_fallthrough
- #define __refparam
- #define __inner_control_entrypoint(category)
- #define __inner_data_entrypoint(category)
-
- #define __post_except_maybenull
- #define __pre_except_maybenull
- #define __post_deref_except_maybenull
- #define __pre_deref_except_maybenull
-
- #define __inexpressible_readableTo(size)
- #define __inexpressible_writableTo(size)
-
-#endif /* #if !defined(__midl) && defined(_PREFAST_) */ // ]
-
-/*
--------------------------------------------------------------------------------
-Buffer Annotation Definitions
-
-Any of these may be used to directly annotate functions, but only one should
-be used for each parameter. To determine which annotation to use for a given
-buffer, use the table in the buffer annotations section.
--------------------------------------------------------------------------------
-*/
-
-// These macros conflict with c++ headers.
-#ifndef PAL_STDCPP_COMPAT
-#define __in _SAL1_Source_(__in, (), _In_)
-#define __out _SAL1_Source_(__out, (), _Out_)
-#endif // !PAL_STDCPP_COMPAT
-
-#define __ecount(size) _SAL1_Source_(__ecount, (size), __notnull __elem_writableTo(size))
-#define __bcount(size) _SAL1_Source_(__bcount, (size), __notnull __byte_writableTo(size))
-#define __in_ecount(size) _SAL1_Source_(__in_ecount, (size), _In_reads_(size))
-#define __in_bcount(size) _SAL1_Source_(__in_bcount, (size), _In_reads_bytes_(size))
-#define __in_z _SAL1_Source_(__in_z, (), _In_z_)
-#define __in_ecount_z(size) _SAL1_Source_(__in_ecount_z, (size), _In_reads_z_(size))
-#define __in_bcount_z(size) _SAL1_Source_(__in_bcount_z, (size), __in_bcount(size) __pre __nullterminated)
-#define __in_nz _SAL1_Source_(__in_nz, (), __in)
-#define __in_ecount_nz(size) _SAL1_Source_(__in_ecount_nz, (size), __in_ecount(size))
-#define __in_bcount_nz(size) _SAL1_Source_(__in_bcount_nz, (size), __in_bcount(size))
-#define __out_ecount(size) _SAL1_Source_(__out_ecount, (size), _Out_writes_(size))
-#define __out_bcount(size) _SAL1_Source_(__out_bcount, (size), _Out_writes_bytes_(size))
-#define __out_ecount_part(size,length) _SAL1_Source_(__out_ecount_part, (size,length), _Out_writes_to_(size,length))
-#define __out_bcount_part(size,length) _SAL1_Source_(__out_bcount_part, (size,length), _Out_writes_bytes_to_(size,length))
-#define __out_ecount_full(size) _SAL1_Source_(__out_ecount_full, (size), _Out_writes_all_(size))
-#define __out_bcount_full(size) _SAL1_Source_(__out_bcount_full, (size), _Out_writes_bytes_all_(size))
-#define __out_z _SAL1_Source_(__out_z, (), __post __valid __refparam __post __nullterminated)
-#define __out_z_opt _SAL1_Source_(__out_z_opt, (), __post __valid __refparam __post __nullterminated __pre_except_maybenull)
-#define __out_ecount_z(size) _SAL1_Source_(__out_ecount_z, (size), __ecount(size) __post __valid __refparam __post __nullterminated)
-#define __out_bcount_z(size) _SAL1_Source_(__out_bcount_z, (size), __bcount(size) __post __valid __refparam __post __nullterminated)
-#define __out_ecount_part_z(size,length) _SAL1_Source_(__out_ecount_part_z, (size,length), __out_ecount_part(size,length) __post __nullterminated)
-#define __out_bcount_part_z(size,length) _SAL1_Source_(__out_bcount_part_z, (size,length), __out_bcount_part(size,length) __post __nullterminated)
-#define __out_ecount_full_z(size) _SAL1_Source_(__out_ecount_full_z, (size), __out_ecount_full(size) __post __nullterminated)
-#define __out_bcount_full_z(size) _SAL1_Source_(__out_bcount_full_z, (size), __out_bcount_full(size) __post __nullterminated)
-#define __out_nz _SAL1_Source_(__out_nz, (), __post __valid __refparam)
-#define __out_nz_opt _SAL1_Source_(__out_nz_opt, (), __post __valid __refparam __post_except_maybenull_)
-#define __out_ecount_nz(size) _SAL1_Source_(__out_ecount_nz, (size), __ecount(size) __post __valid __refparam)
-#define __out_bcount_nz(size) _SAL1_Source_(__out_bcount_nz, (size), __bcount(size) __post __valid __refparam)
-#define __inout _SAL1_Source_(__inout, (), _Inout_)
-#define __inout_ecount(size) _SAL1_Source_(__inout_ecount, (size), _Inout_updates_(size))
-#define __inout_bcount(size) _SAL1_Source_(__inout_bcount, (size), _Inout_updates_bytes_(size))
-#define __inout_ecount_part(size,length) _SAL1_Source_(__inout_ecount_part, (size,length), _Inout_updates_to_(size,length))
-#define __inout_bcount_part(size,length) _SAL1_Source_(__inout_bcount_part, (size,length), _Inout_updates_bytes_to_(size,length))
-#define __inout_ecount_full(size) _SAL1_Source_(__inout_ecount_full, (size), _Inout_updates_all_(size))
-#define __inout_bcount_full(size) _SAL1_Source_(__inout_bcount_full, (size), _Inout_updates_bytes_all_(size))
-#define __inout_z _SAL1_Source_(__inout_z, (), _Inout_z_)
-#define __inout_ecount_z(size) _SAL1_Source_(__inout_ecount_z, (size), _Inout_updates_z_(size))
-#define __inout_bcount_z(size) _SAL1_Source_(__inout_bcount_z, (size), __inout_bcount(size) __pre __nullterminated __post __nullterminated)
-#define __inout_nz _SAL1_Source_(__inout_nz, (), __inout)
-#define __inout_ecount_nz(size) _SAL1_Source_(__inout_ecount_nz, (size), __inout_ecount(size))
-#define __inout_bcount_nz(size) _SAL1_Source_(__inout_bcount_nz, (size), __inout_bcount(size))
-#define __ecount_opt(size) _SAL1_Source_(__ecount_opt, (size), __ecount(size) __pre_except_maybenull)
-#define __bcount_opt(size) _SAL1_Source_(__bcount_opt, (size), __bcount(size) __pre_except_maybenull)
-#define __in_opt _SAL1_Source_(__in_opt, (), _In_opt_)
-#define __in_ecount_opt(size) _SAL1_Source_(__in_ecount_opt, (size), _In_reads_opt_(size))
-#define __in_bcount_opt(size) _SAL1_Source_(__in_bcount_opt, (size), _In_reads_bytes_opt_(size))
-#define __in_z_opt _SAL1_Source_(__in_z_opt, (), _In_opt_z_)
-#define __in_ecount_z_opt(size) _SAL1_Source_(__in_ecount_z_opt, (size), __in_ecount_opt(size) __pre __nullterminated)
-#define __in_bcount_z_opt(size) _SAL1_Source_(__in_bcount_z_opt, (size), __in_bcount_opt(size) __pre __nullterminated)
-#define __in_nz_opt _SAL1_Source_(__in_nz_opt, (), __in_opt)
-#define __in_ecount_nz_opt(size) _SAL1_Source_(__in_ecount_nz_opt, (size), __in_ecount_opt(size))
-#define __in_bcount_nz_opt(size) _SAL1_Source_(__in_bcount_nz_opt, (size), __in_bcount_opt(size))
-#define __out_opt _SAL1_Source_(__out_opt, (), _Out_opt_)
-#define __out_ecount_opt(size) _SAL1_Source_(__out_ecount_opt, (size), _Out_writes_opt_(size))
-#define __out_bcount_opt(size) _SAL1_Source_(__out_bcount_opt, (size), _Out_writes_bytes_opt_(size))
-#define __out_ecount_part_opt(size,length) _SAL1_Source_(__out_ecount_part_opt, (size,length), __out_ecount_part(size,length) __pre_except_maybenull)
-#define __out_bcount_part_opt(size,length) _SAL1_Source_(__out_bcount_part_opt, (size,length), __out_bcount_part(size,length) __pre_except_maybenull)
-#define __out_ecount_full_opt(size) _SAL1_Source_(__out_ecount_full_opt, (size), __out_ecount_full(size) __pre_except_maybenull)
-#define __out_bcount_full_opt(size) _SAL1_Source_(__out_bcount_full_opt, (size), __out_bcount_full(size) __pre_except_maybenull)
-#define __out_ecount_z_opt(size) _SAL1_Source_(__out_ecount_z_opt, (size), __out_ecount_opt(size) __post __nullterminated)
-#define __out_bcount_z_opt(size) _SAL1_Source_(__out_bcount_z_opt, (size), __out_bcount_opt(size) __post __nullterminated)
-#define __out_ecount_part_z_opt(size,length) _SAL1_Source_(__out_ecount_part_z_opt, (size,length), __out_ecount_part_opt(size,length) __post __nullterminated)
-#define __out_bcount_part_z_opt(size,length) _SAL1_Source_(__out_bcount_part_z_opt, (size,length), __out_bcount_part_opt(size,length) __post __nullterminated)
-#define __out_ecount_full_z_opt(size) _SAL1_Source_(__out_ecount_full_z_opt, (size), __out_ecount_full_opt(size) __post __nullterminated)
-#define __out_bcount_full_z_opt(size) _SAL1_Source_(__out_bcount_full_z_opt, (size), __out_bcount_full_opt(size) __post __nullterminated)
-#define __out_ecount_nz_opt(size) _SAL1_Source_(__out_ecount_nz_opt, (size), __out_ecount_opt(size) __post __nullterminated)
-#define __out_bcount_nz_opt(size) _SAL1_Source_(__out_bcount_nz_opt, (size), __out_bcount_opt(size) __post __nullterminated)
-#define __inout_opt _SAL1_Source_(__inout_opt, (), _Inout_opt_)
-#define __inout_ecount_opt(size) _SAL1_Source_(__inout_ecount_opt, (size), __inout_ecount(size) __pre_except_maybenull)
-#define __inout_bcount_opt(size) _SAL1_Source_(__inout_bcount_opt, (size), __inout_bcount(size) __pre_except_maybenull)
-#define __inout_ecount_part_opt(size,length) _SAL1_Source_(__inout_ecount_part_opt, (size,length), __inout_ecount_part(size,length) __pre_except_maybenull)
-#define __inout_bcount_part_opt(size,length) _SAL1_Source_(__inout_bcount_part_opt, (size,length), __inout_bcount_part(size,length) __pre_except_maybenull)
-#define __inout_ecount_full_opt(size) _SAL1_Source_(__inout_ecount_full_opt, (size), __inout_ecount_full(size) __pre_except_maybenull)
-#define __inout_bcount_full_opt(size) _SAL1_Source_(__inout_bcount_full_opt, (size), __inout_bcount_full(size) __pre_except_maybenull)
-#define __inout_z_opt _SAL1_Source_(__inout_z_opt, (), __inout_opt __pre __nullterminated __post __nullterminated)
-#define __inout_ecount_z_opt(size) _SAL1_Source_(__inout_ecount_z_opt, (size), __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated)
-#define __inout_ecount_z_opt(size) _SAL1_Source_(__inout_ecount_z_opt, (size), __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated)
-#define __inout_bcount_z_opt(size) _SAL1_Source_(__inout_bcount_z_opt, (size), __inout_bcount_opt(size))
-#define __inout_nz_opt _SAL1_Source_(__inout_nz_opt, (), __inout_opt)
-#define __inout_ecount_nz_opt(size) _SAL1_Source_(__inout_ecount_nz_opt, (size), __inout_ecount_opt(size))
-#define __inout_bcount_nz_opt(size) _SAL1_Source_(__inout_bcount_nz_opt, (size), __inout_bcount_opt(size))
-#define __deref_ecount(size) _SAL1_Source_(__deref_ecount, (size), _Notref_ __ecount(1) __post _Notref_ __elem_readableTo(1) __post _Notref_ __deref _Notref_ __notnull __post __deref __elem_writableTo(size))
-#define __deref_bcount(size) _SAL1_Source_(__deref_bcount, (size), _Notref_ __ecount(1) __post _Notref_ __elem_readableTo(1) __post _Notref_ __deref _Notref_ __notnull __post __deref __byte_writableTo(size))
-#define __deref_out _SAL1_Source_(__deref_out, (), _Outptr_)
-#define __deref_out_ecount(size) _SAL1_Source_(__deref_out_ecount, (size), _Outptr_result_buffer_(size))
-#define __deref_out_bcount(size) _SAL1_Source_(__deref_out_bcount, (size), _Outptr_result_bytebuffer_(size))
-#define __deref_out_ecount_part(size,length) _SAL1_Source_(__deref_out_ecount_part, (size,length), _Outptr_result_buffer_to_(size,length))
-#define __deref_out_bcount_part(size,length) _SAL1_Source_(__deref_out_bcount_part, (size,length), _Outptr_result_bytebuffer_to_(size,length))
-#define __deref_out_ecount_full(size) _SAL1_Source_(__deref_out_ecount_full, (size), __deref_out_ecount_part(size,size))
-#define __deref_out_bcount_full(size) _SAL1_Source_(__deref_out_bcount_full, (size), __deref_out_bcount_part(size,size))
-#define __deref_out_z _SAL1_Source_(__deref_out_z, (), _Outptr_result_z_)
-#define __deref_out_ecount_z(size) _SAL1_Source_(__deref_out_ecount_z, (size), __deref_out_ecount(size) __post __deref __nullterminated)
-#define __deref_out_bcount_z(size) _SAL1_Source_(__deref_out_bcount_z, (size), __deref_out_bcount(size) __post __deref __nullterminated)
-#define __deref_out_nz _SAL1_Source_(__deref_out_nz, (), __deref_out)
-#define __deref_out_ecount_nz(size) _SAL1_Source_(__deref_out_ecount_nz, (size), __deref_out_ecount(size))
-#define __deref_out_bcount_nz(size) _SAL1_Source_(__deref_out_bcount_nz, (size), __deref_out_ecount(size))
-#define __deref_inout _SAL1_Source_(__deref_inout, (), _Notref_ __notnull _Notref_ __elem_readableTo(1) __pre __deref __valid __post _Notref_ __deref __valid __refparam)
-#define __deref_inout_z _SAL1_Source_(__deref_inout_z, (), __deref_inout __pre __deref __nullterminated __post _Notref_ __deref __nullterminated)
-#define __deref_inout_ecount(size) _SAL1_Source_(__deref_inout_ecount, (size), __deref_inout __pre __deref __elem_writableTo(size) __post _Notref_ __deref __elem_writableTo(size))
-#define __deref_inout_bcount(size) _SAL1_Source_(__deref_inout_bcount, (size), __deref_inout __pre __deref __byte_writableTo(size) __post _Notref_ __deref __byte_writableTo(size))
-#define __deref_inout_ecount_part(size,length) _SAL1_Source_(__deref_inout_ecount_part, (size,length), __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length))
-#define __deref_inout_bcount_part(size,length) _SAL1_Source_(__deref_inout_bcount_part, (size,length), __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length))
-#define __deref_inout_ecount_full(size) _SAL1_Source_(__deref_inout_ecount_full, (size), __deref_inout_ecount_part(size,size))
-#define __deref_inout_bcount_full(size) _SAL1_Source_(__deref_inout_bcount_full, (size), __deref_inout_bcount_part(size,size))
-#define __deref_inout_ecount_z(size) _SAL1_Source_(__deref_inout_ecount_z, (size), __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_inout_bcount_z(size) _SAL1_Source_(__deref_inout_bcount_z, (size), __deref_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_inout_nz _SAL1_Source_(__deref_inout_nz, (), __deref_inout)
-#define __deref_inout_ecount_nz(size) _SAL1_Source_(__deref_inout_ecount_nz, (size), __deref_inout_ecount(size))
-#define __deref_inout_bcount_nz(size) _SAL1_Source_(__deref_inout_bcount_nz, (size), __deref_inout_ecount(size))
-#define __deref_ecount_opt(size) _SAL1_Source_(__deref_ecount_opt, (size), __deref_ecount(size) __post_deref_except_maybenull)
-#define __deref_bcount_opt(size) _SAL1_Source_(__deref_bcount_opt, (size), __deref_bcount(size) __post_deref_except_maybenull)
-#define __deref_out_opt _SAL1_Source_(__deref_out_opt, (), __deref_out __post_deref_except_maybenull)
-#define __deref_out_ecount_opt(size) _SAL1_Source_(__deref_out_ecount_opt, (size), __deref_out_ecount(size) __post_deref_except_maybenull)
-#define __deref_out_bcount_opt(size) _SAL1_Source_(__deref_out_bcount_opt, (size), __deref_out_bcount(size) __post_deref_except_maybenull)
-#define __deref_out_ecount_part_opt(size,length) _SAL1_Source_(__deref_out_ecount_part_opt, (size,length), __deref_out_ecount_part(size,length) __post_deref_except_maybenull)
-#define __deref_out_bcount_part_opt(size,length) _SAL1_Source_(__deref_out_bcount_part_opt, (size,length), __deref_out_bcount_part(size,length) __post_deref_except_maybenull)
-#define __deref_out_ecount_full_opt(size) _SAL1_Source_(__deref_out_ecount_full_opt, (size), __deref_out_ecount_full(size) __post_deref_except_maybenull)
-#define __deref_out_bcount_full_opt(size) _SAL1_Source_(__deref_out_bcount_full_opt, (size), __deref_out_bcount_full(size) __post_deref_except_maybenull)
-#define __deref_out_z_opt _SAL1_Source_(__deref_out_z_opt, (), _Outptr_result_maybenull_z_)
-#define __deref_out_ecount_z_opt(size) _SAL1_Source_(__deref_out_ecount_z_opt, (size), __deref_out_ecount_opt(size) __post __deref __nullterminated)
-#define __deref_out_bcount_z_opt(size) _SAL1_Source_(__deref_out_bcount_z_opt, (size), __deref_out_bcount_opt(size) __post __deref __nullterminated)
-#define __deref_out_nz_opt _SAL1_Source_(__deref_out_nz_opt, (), __deref_out_opt)
-#define __deref_out_ecount_nz_opt(size) _SAL1_Source_(__deref_out_ecount_nz_opt, (size), __deref_out_ecount_opt(size))
-#define __deref_out_bcount_nz_opt(size) _SAL1_Source_(__deref_out_bcount_nz_opt, (size), __deref_out_bcount_opt(size))
-#define __deref_inout_opt _SAL1_Source_(__deref_inout_opt, (), __deref_inout __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_ecount_opt(size) _SAL1_Source_(__deref_inout_ecount_opt, (size), __deref_inout_ecount(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_bcount_opt(size) _SAL1_Source_(__deref_inout_bcount_opt, (size), __deref_inout_bcount(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_ecount_part_opt(size,length) _SAL1_Source_(__deref_inout_ecount_part_opt, (size,length), __deref_inout_ecount_part(size,length) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_bcount_part_opt(size,length) _SAL1_Source_(__deref_inout_bcount_part_opt, (size,length), __deref_inout_bcount_part(size,length) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_ecount_full_opt(size) _SAL1_Source_(__deref_inout_ecount_full_opt, (size), __deref_inout_ecount_full(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_bcount_full_opt(size) _SAL1_Source_(__deref_inout_bcount_full_opt, (size), __deref_inout_bcount_full(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
-#define __deref_inout_z_opt _SAL1_Source_(__deref_inout_z_opt, (), __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_inout_ecount_z_opt(size) _SAL1_Source_(__deref_inout_ecount_z_opt, (size), __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_inout_bcount_z_opt(size) _SAL1_Source_(__deref_inout_bcount_z_opt, (size), __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_inout_nz_opt _SAL1_Source_(__deref_inout_nz_opt, (), __deref_inout_opt)
-#define __deref_inout_ecount_nz_opt(size) _SAL1_Source_(__deref_inout_ecount_nz_opt, (size), __deref_inout_ecount_opt(size))
-#define __deref_inout_bcount_nz_opt(size) _SAL1_Source_(__deref_inout_bcount_nz_opt, (size), __deref_inout_bcount_opt(size))
-#define __deref_opt_ecount(size) _SAL1_Source_(__deref_opt_ecount, (size), __deref_ecount(size) __pre_except_maybenull)
-#define __deref_opt_bcount(size) _SAL1_Source_(__deref_opt_bcount, (size), __deref_bcount(size) __pre_except_maybenull)
-#define __deref_opt_out _SAL1_Source_(__deref_opt_out, (), _Outptr_opt_)
-#define __deref_opt_out_z _SAL1_Source_(__deref_opt_out_z, (), _Outptr_opt_result_z_)
-#define __deref_opt_out_ecount(size) _SAL1_Source_(__deref_opt_out_ecount, (size), __deref_out_ecount(size) __pre_except_maybenull)
-#define __deref_opt_out_bcount(size) _SAL1_Source_(__deref_opt_out_bcount, (size), __deref_out_bcount(size) __pre_except_maybenull)
-#define __deref_opt_out_ecount_part(size,length) _SAL1_Source_(__deref_opt_out_ecount_part, (size,length), __deref_out_ecount_part(size,length) __pre_except_maybenull)
-#define __deref_opt_out_bcount_part(size,length) _SAL1_Source_(__deref_opt_out_bcount_part, (size,length), __deref_out_bcount_part(size,length) __pre_except_maybenull)
-#define __deref_opt_out_ecount_full(size) _SAL1_Source_(__deref_opt_out_ecount_full, (size), __deref_out_ecount_full(size) __pre_except_maybenull)
-#define __deref_opt_out_bcount_full(size) _SAL1_Source_(__deref_opt_out_bcount_full, (size), __deref_out_bcount_full(size) __pre_except_maybenull)
-#define __deref_opt_inout _SAL1_Source_(__deref_opt_inout, (), _Inout_opt_)
-#define __deref_opt_inout_ecount(size) _SAL1_Source_(__deref_opt_inout_ecount, (size), __deref_inout_ecount(size) __pre_except_maybenull)
-#define __deref_opt_inout_bcount(size) _SAL1_Source_(__deref_opt_inout_bcount, (size), __deref_inout_bcount(size) __pre_except_maybenull)
-#define __deref_opt_inout_ecount_part(size,length) _SAL1_Source_(__deref_opt_inout_ecount_part, (size,length), __deref_inout_ecount_part(size,length) __pre_except_maybenull)
-#define __deref_opt_inout_bcount_part(size,length) _SAL1_Source_(__deref_opt_inout_bcount_part, (size,length), __deref_inout_bcount_part(size,length) __pre_except_maybenull)
-#define __deref_opt_inout_ecount_full(size) _SAL1_Source_(__deref_opt_inout_ecount_full, (size), __deref_inout_ecount_full(size) __pre_except_maybenull)
-#define __deref_opt_inout_bcount_full(size) _SAL1_Source_(__deref_opt_inout_bcount_full, (size), __deref_inout_bcount_full(size) __pre_except_maybenull)
-#define __deref_opt_inout_z _SAL1_Source_(__deref_opt_inout_z, (), __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_ecount_z(size) _SAL1_Source_(__deref_opt_inout_ecount_z, (size), __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_bcount_z(size) _SAL1_Source_(__deref_opt_inout_bcount_z, (size), __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_nz _SAL1_Source_(__deref_opt_inout_nz, (), __deref_opt_inout)
-#define __deref_opt_inout_ecount_nz(size) _SAL1_Source_(__deref_opt_inout_ecount_nz, (size), __deref_opt_inout_ecount(size))
-#define __deref_opt_inout_bcount_nz(size) _SAL1_Source_(__deref_opt_inout_bcount_nz, (size), __deref_opt_inout_bcount(size))
-#define __deref_opt_ecount_opt(size) _SAL1_Source_(__deref_opt_ecount_opt, (size), __deref_ecount_opt(size) __pre_except_maybenull)
-#define __deref_opt_bcount_opt(size) _SAL1_Source_(__deref_opt_bcount_opt, (size), __deref_bcount_opt(size) __pre_except_maybenull)
-#define __deref_opt_out_opt _SAL1_Source_(__deref_opt_out_opt, (), _Outptr_opt_result_maybenull_)
-#define __deref_opt_out_ecount_opt(size) _SAL1_Source_(__deref_opt_out_ecount_opt, (size), __deref_out_ecount_opt(size) __pre_except_maybenull)
-#define __deref_opt_out_bcount_opt(size) _SAL1_Source_(__deref_opt_out_bcount_opt, (size), __deref_out_bcount_opt(size) __pre_except_maybenull)
-#define __deref_opt_out_ecount_part_opt(size,length) _SAL1_Source_(__deref_opt_out_ecount_part_opt, (size,length), __deref_out_ecount_part_opt(size,length) __pre_except_maybenull)
-#define __deref_opt_out_bcount_part_opt(size,length) _SAL1_Source_(__deref_opt_out_bcount_part_opt, (size,length), __deref_out_bcount_part_opt(size,length) __pre_except_maybenull)
-#define __deref_opt_out_ecount_full_opt(size) _SAL1_Source_(__deref_opt_out_ecount_full_opt, (size), __deref_out_ecount_full_opt(size) __pre_except_maybenull)
-#define __deref_opt_out_bcount_full_opt(size) _SAL1_Source_(__deref_opt_out_bcount_full_opt, (size), __deref_out_bcount_full_opt(size) __pre_except_maybenull)
-#define __deref_opt_out_z_opt _SAL1_Source_(__deref_opt_out_z_opt, (), __post __deref __valid __refparam __pre_except_maybenull __pre_deref_except_maybenull __post_deref_except_maybenull __post __deref __nullterminated)
-#define __deref_opt_out_ecount_z_opt(size) _SAL1_Source_(__deref_opt_out_ecount_z_opt, (size), __deref_opt_out_ecount_opt(size) __post __deref __nullterminated)
-#define __deref_opt_out_bcount_z_opt(size) _SAL1_Source_(__deref_opt_out_bcount_z_opt, (size), __deref_opt_out_bcount_opt(size) __post __deref __nullterminated)
-#define __deref_opt_out_nz_opt _SAL1_Source_(__deref_opt_out_nz_opt, (), __deref_opt_out_opt)
-#define __deref_opt_out_ecount_nz_opt(size) _SAL1_Source_(__deref_opt_out_ecount_nz_opt, (size), __deref_opt_out_ecount_opt(size))
-#define __deref_opt_out_bcount_nz_opt(size) _SAL1_Source_(__deref_opt_out_bcount_nz_opt, (size), __deref_opt_out_bcount_opt(size))
-#define __deref_opt_inout_opt _SAL1_Source_(__deref_opt_inout_opt, (), __deref_inout_opt __pre_except_maybenull)
-#define __deref_opt_inout_ecount_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_opt, (size), __deref_inout_ecount_opt(size) __pre_except_maybenull)
-#define __deref_opt_inout_bcount_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_opt, (size), __deref_inout_bcount_opt(size) __pre_except_maybenull)
-#define __deref_opt_inout_ecount_part_opt(size,length) _SAL1_Source_(__deref_opt_inout_ecount_part_opt, (size,length), __deref_inout_ecount_part_opt(size,length) __pre_except_maybenull)
-#define __deref_opt_inout_bcount_part_opt(size,length) _SAL1_Source_(__deref_opt_inout_bcount_part_opt, (size,length), __deref_inout_bcount_part_opt(size,length) __pre_except_maybenull)
-#define __deref_opt_inout_ecount_full_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_full_opt, (size), __deref_inout_ecount_full_opt(size) __pre_except_maybenull)
-#define __deref_opt_inout_bcount_full_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_full_opt, (size), __deref_inout_bcount_full_opt(size) __pre_except_maybenull)
-#define __deref_opt_inout_z_opt _SAL1_Source_(__deref_opt_inout_z_opt, (), __deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_ecount_z_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_z_opt, (size), __deref_opt_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_bcount_z_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_z_opt, (size), __deref_opt_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
-#define __deref_opt_inout_nz_opt _SAL1_Source_(__deref_opt_inout_nz_opt, (), __deref_opt_inout_opt)
-#define __deref_opt_inout_ecount_nz_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_nz_opt, (size), __deref_opt_inout_ecount_opt(size))
-#define __deref_opt_inout_bcount_nz_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_nz_opt, (size), __deref_opt_inout_bcount_opt(size))
-
-/*
--------------------------------------------------------------------------------
-Advanced Annotation Definitions
-
-Any of these may be used to directly annotate functions, and may be used in
-combination with each other or with regular buffer macros. For an explanation
-of each annotation, see the advanced annotations section.
--------------------------------------------------------------------------------
-*/
-
-#define __success(expr) _Success_(expr)
-#define __nullterminated _Null_terminated_
-#define __nullnullterminated
-#define __clr_reserved _SAL1_Source_(__reserved, (), _Reserved_)
-#define __checkReturn _SAL1_Source_(__checkReturn, (), _Check_return_)
-#define __typefix(ctype) _SAL1_Source_(__typefix, (ctype), __inner_typefix(ctype))
-#define __override __inner_override
-#define __callback __inner_callback
-#define __format_string _Printf_format_string_
-#define __blocksOn(resource) __inner_blocksOn(resource)
-#define __control_entrypoint(category) __inner_control_entrypoint(category)
-#define __data_entrypoint(category) __inner_data_entrypoint(category)
-#define __useHeader _Use_decl_anno_impl_
-#define __on_failure(annotes) _On_failure_impl_(annotes _SAL_nop_impl_)
-
-#ifndef __fallthrough // [
- __inner_fallthrough_dec
- #define __fallthrough __inner_fallthrough
-#endif // ]
-
-#ifndef __analysis_assume // [
-#ifdef _PREFAST_ // [
-#define __analysis_assume(expr) __assume(expr)
-#else // ][
-#define __analysis_assume(expr)
-#endif // ]
-#endif // ]
-
-#ifndef _Analysis_assume_ // [
-#ifdef _PREFAST_ // [
-#define _Analysis_assume_(expr) __assume(expr)
-#else // ][
-#define _Analysis_assume_(expr)
-#endif // ]
-#endif // ]
-
-#define _Analysis_noreturn_ _SAL2_Source_(_Analysis_noreturn_, (), _SA_annotes0(SAL_terminates))
-
-#ifdef _PREFAST_ // [
-__inline __nothrow
-void __AnalysisAssumeNullterminated(_Post_ __nullterminated void *p);
-
-#define _Analysis_assume_nullterminated_(x) __AnalysisAssumeNullterminated(x)
-#else // ][
-#define _Analysis_assume_nullterminated_(x)
-#endif // ]
-
-//
-// Set the analysis mode (global flags to analysis).
-// They take effect at the point of declaration; use at global scope
-// as a declaration.
-//
-
-// Synthesize a unique symbol.
-#define ___MKID(x, y) x ## y
-#define __MKID(x, y) ___MKID(x, y)
-#define __GENSYM(x) __MKID(x, __COUNTER__)
-
-__ANNOTATION(SAL_analysisMode(__AuToQuOtE __In_impl_ char *mode);)
-
-#define _Analysis_mode_impl_(mode) _SA_annotes1(SAL_analysisMode, #mode)
-
-#define _Analysis_mode_(mode) \
- typedef _Analysis_mode_impl_(mode) int \
- __GENSYM(__prefast_analysis_mode_flag);
-
-// The following are predefined:
-// _Analysis_operator_new_throw_ (operator new throws)
-// _Analysis_operator_new_null_ (operator new returns null)
-// _Analysis_operator_new_never_fails_ (operator new never fails)
-//
-
-// Function class annotations.
-__ANNOTATION(SAL_functionClassNew(__In_impl_ char*);)
-__PRIMOP(int, _In_function_class_(__In_impl_ char*);)
-#define _In_function_class_(x) _In_function_class_(#x)
-
-#define _Function_class_(x) _SA_annotes1(SAL_functionClassNew, #x)
-
-/*
- * interlocked operand used in interlocked instructions
- */
-//#define _Interlocked_operand_ _Pre_ _SA_annotes0(SAL_interlocked)
-
-#define _Enum_is_bitflag_ _SA_annotes0(SAL_enumIsBitflag)
-#define _Strict_type_match_ _SA_annotes0(SAL_strictType2)
-
-#define _Maybe_raises_SEH_exception_ _Pre_ _SA_annotes1(SAL_inTry,__yes)
-#define _Raises_SEH_exception_ _Group_(_Maybe_raises_SEH_exception_ _Analysis_noreturn_)
-
-#ifdef __cplusplus // [
-}
-#endif // ]
diff --git a/profiler/test/Datadog.Profiler.IntegrationTests/External/ProcessExtensions.cs b/profiler/test/Datadog.Profiler.IntegrationTests/External/ProcessExtensions.cs
index 061dc7416..89a9570e4 100644
--- a/profiler/test/Datadog.Profiler.IntegrationTests/External/ProcessExtensions.cs
+++ b/profiler/test/Datadog.Profiler.IntegrationTests/External/ProcessExtensions.cs
@@ -1,4 +1,4 @@
-//
+//
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
//
@@ -117,4 +117,4 @@ private static void RunProcessAndWaitForExit(string fileName, string arguments,
}
}
}
-}
\ No newline at end of file
+}
diff --git a/profiler/test/Datadog.Profiler.IntegrationTests/Helpers/EnvironmentHelper.cs b/profiler/test/Datadog.Profiler.IntegrationTests/Helpers/EnvironmentHelper.cs
index 45ec61ec0..28cd4c1c8 100644
--- a/profiler/test/Datadog.Profiler.IntegrationTests/Helpers/EnvironmentHelper.cs
+++ b/profiler/test/Datadog.Profiler.IntegrationTests/Helpers/EnvironmentHelper.cs
@@ -147,4 +147,4 @@ private bool IsCoreClr()
_framework.StartsWith("net5", StringComparison.Ordinal);
}
}
-}
\ No newline at end of file
+}
diff --git a/profiler/test/Datadog.Profiler.IntegrationTests/SmokeTests/WebsiteAspNetCore01Test.cs b/profiler/test/Datadog.Profiler.IntegrationTests/SmokeTests/WebsiteAspNetCore01Test.cs
index a829471ca..30d1fc10a 100644
--- a/profiler/test/Datadog.Profiler.IntegrationTests/SmokeTests/WebsiteAspNetCore01Test.cs
+++ b/profiler/test/Datadog.Profiler.IntegrationTests/SmokeTests/WebsiteAspNetCore01Test.cs
@@ -1,4 +1,4 @@
-//
+//
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
//
@@ -22,4 +22,4 @@ public void CheckSmoke(string appName, string framework, string appAssembly)
new SmokeTestRunner(appName, framework, appAssembly, _output).RunAndCheck();
}
}
-}
\ No newline at end of file
+}
diff --git a/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt b/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt
index 750b4b7f5..bdcea28cc 100644
--- a/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt
+++ b/profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt
@@ -59,10 +59,10 @@ add_executable(${TEST_EXECUTABLE_NAME}
# Define directories includes
target_include_directories(${TEST_EXECUTABLE_NAME}
- PUBLIC ../../src/dotnet-runtime-coreclr/pal/inc/rt
- PUBLIC ../../src/dotnet-runtime-coreclr/pal/prebuilt/inc
- PUBLIC ../../src/dotnet-runtime-coreclr/pal/inc
- PUBLIC ../../src/dotnet-runtime-coreclr/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/inc/rt
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/prebuilt/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/pal/inc
+ PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}/shared/src/native-lib/coreclr/src/inc
PUBLIC ../../src/ProfilerEngine/Datadog.Profiler.Native
PUBLIC ${DOTNET_TRACER_REPO_ROOT_PATH}
PUBLIC ${OUTPUT_DEPS_DIR}/fmt/include
diff --git a/shared/src/managed-src/Datadog.Collections/internal/GrowingCollection.cs b/shared/src/managed-src/Datadog.Collections/internal/GrowingCollection.cs
index 56694d27d..56ef4fbce 100644
--- a/shared/src/managed-src/Datadog.Collections/internal/GrowingCollection.cs
+++ b/shared/src/managed-src/Datadog.Collections/internal/GrowingCollection.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections;
using System.Collections.Generic;
@@ -6,12 +11,8 @@
using Datadog.Util;
-#pragma warning disable SA1124 // Do not use regions
-#pragma warning disable SA1131 // Use readable conditions
namespace Datadog.Collections
{
- #region class GrowingCollection
-
/// A very fast, lock free, unordered collection to which items can be added, but never removed.
/// Type of collection elements.
internal class GrowingCollection : GrowingCollectionSegment, IEnumerable, IReadOnlyCollection
@@ -93,8 +94,6 @@ IEnumerator IEnumerable.GetEnumerator()
return this.GetEnumerator();
}
- #region class Enumerator
-
/// An enumerator implementation for a .
/// The enumerator is resilient to concurrent additions to the collection.
/// No particular element order is guaranteed.
@@ -190,14 +189,9 @@ private void Dispose(bool disposing)
}
}
}
-
- #endregion class Enumerator
}
- #endregion class GrowingCollection
-
- #region class GrowingCollectionSegment
-
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Stay as is")]
internal class GrowingCollectionSegment
{
private readonly GrowingCollectionSegment _nextSegment;
@@ -308,6 +302,4 @@ internal bool TryAdd(T item)
return true;
}
}
-
- #endregion class GrowingCollectionSegment
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/AggregatedLogSink.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/AggregatedLogSink.cs
index df53c819a..044b17210 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/AggregatedLogSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/AggregatedLogSink.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using System.Runtime.ExceptionServices;
@@ -8,14 +13,16 @@ namespace Datadog.Logging.Composition
///
/// Collects data from a Log-sources and sends it to many Log Sinks.
///
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Worst piece of advise Style tools ever gave.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "Rule does not add redability")]
internal sealed class AggregatedLogSink : ILogSink, IDisposable
{
private readonly ILogSink[] _logSinks;
public AggregatedLogSink(params ILogSink[] logSinks)
+#pragma warning disable SA1003 // Symbols should be spaced correctly
+#pragma warning disable SA1009 // Closing parenthesis should be spaced correctly
: this((IEnumerable) logSinks)
+#pragma warning restore SA1009 // Closing parenthesis should be spaced correctly
+#pragma warning restore SA1003 // Symbols should be spaced correctly
{
}
@@ -111,7 +118,7 @@ private void InvokeForAllLogSinks(Func sinkFunction, out bool al
}
else
{
- List errorList = (List) errorHolder;
+ List errorList = errorHolder as List;
errorList.Add(ex);
}
}
@@ -125,10 +132,10 @@ private void InvokeForAllLogSinks(Func sinkFunction, out bool al
}
else
{
- List errorList = (List) errorHolder;
+ List errorList = errorHolder as List;
throw new AggregateException("Two or more Log sinks threw exceptions.", errorList);
}
}
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/DatadogEnvironmentFileLogSinkFactory.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/DatadogEnvironmentFileLogSinkFactory.cs
index 2eccec474..087d21558 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/DatadogEnvironmentFileLogSinkFactory.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/DatadogEnvironmentFileLogSinkFactory.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
// Modified by Splunk Inc.
using System;
@@ -10,68 +15,8 @@
namespace Datadog.Logging.Composition
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1308:Variable names must not be prefixed", Justification = "Should not apply to statics")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1311:Static readonly fields must begin with upper-case letter", Justification = "Should only apply to vars that are logically const.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters must start on line after declaration", Justification = "Bad rule")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names must not contain underscore", Justification = "Underscore aid visibility in long names")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Worst piece of advise Style tools ever gave.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1615:Element return value must be documented", Justification = "That would be great.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1611:Element parameters must be documented", Justification = "That would be great.")]
internal static class DatadogEnvironmentFileLogSinkFactory
{
- ///
- /// Encapsulates the information required to construct the filename base:
- /// DD-{ProductFamily}-{Product}-{ComponentGroup}-{ProcessName}
- ///
- public struct FilenameBaseInfo
- {
- public static void EnsureValidAsParam(FilenameBaseInfo filenameBaseInfo)
- {
- if (!filenameBaseInfo.IsValid)
- {
- throw new ArgumentException($"Specified {nameof(filenameBaseInfo)} is not valid."
- + $" Use the non-default (aka paramaterized) ctor to create valid {nameof(FilenameBaseInfo)} instances.",
- nameof(filenameBaseInfo));
- }
- }
-
- private string _logFilenameBase;
-
- public FilenameBaseInfo(string productFamily, string product, string componentGroup)
- : this(productFamily, product, componentGroup, GetProcessName())
- { }
-
- public FilenameBaseInfo(string productFamily, string product, string componentGroup, string processName)
- {
- ProductFamily = productFamily;
- Product = product;
- ComponentGroup = componentGroup;
- ProcessName = processName;
- IsValid = true;
- _logFilenameBase = null;
- }
-
- public bool IsValid { get; }
-
- public string ProductFamily { get; }
- public string Product { get; }
- public string ComponentGroup { get; }
- public string ProcessName { get; }
- public string LogFilenameBase
- {
- get
- {
- string logFilenameBase = _logFilenameBase;
- if (logFilenameBase == null && IsValid)
- {
- logFilenameBase = ConstructFilenameBase(ProductFamily, Product, ComponentGroup, ProcessName);
- _logFilenameBase = logFilenameBase;
- }
-
- return logFilenameBase;
- }
- }
- }
-
private const string FilenamePrefix = "DD-";
private const string FilenameMissingComponentFallback = "_";
private const char FilenameInvalidCharFallback = '_';
@@ -97,26 +42,29 @@ public static string ConstructFilename(FilenameBaseInfo filenameBaseInfo, DateTi
public static bool TryCreateNewFileLogSink(FilenameBaseInfo filenameBaseInfo, Guid logGroupId, out FileLogSink newLogSink)
{
- return TryCreateNewFileLogSink(filenameBaseInfo,
- logGroupId,
- preferredLogFileDirectory: null,
- FileLogSink.RotateLogFileWhenLargerBytesDefault,
- FileLogSink.DefaultFormatOptions,
- out newLogSink);
+ return TryCreateNewFileLogSink(
+ filenameBaseInfo,
+ logGroupId,
+ preferredLogFileDirectory: null,
+ FileLogSink.RotateLogFileWhenLargerBytesDefault,
+ FileLogSink.DefaultFormatOptions,
+ out newLogSink);
}
- public static bool TryCreateNewFileLogSink(FilenameBaseInfo filenameBaseInfo,
- Guid logGroupId,
- string preferredLogFileDirectory,
- DefaultFormat.Options formatOptions,
- out FileLogSink newLogSink)
+ public static bool TryCreateNewFileLogSink(
+ FilenameBaseInfo filenameBaseInfo,
+ Guid logGroupId,
+ string preferredLogFileDirectory,
+ DefaultFormat.Options formatOptions,
+ out FileLogSink newLogSink)
{
- return TryCreateNewFileLogSink(filenameBaseInfo,
- logGroupId,
- preferredLogFileDirectory,
- FileLogSink.RotateLogFileWhenLargerBytesDefault,
- formatOptions,
- out newLogSink);
+ return TryCreateNewFileLogSink(
+ filenameBaseInfo,
+ logGroupId,
+ preferredLogFileDirectory,
+ FileLogSink.RotateLogFileWhenLargerBytesDefault,
+ formatOptions,
+ out newLogSink);
}
///
@@ -137,13 +85,14 @@ public static bool TryCreateNewFileLogSink(FilenameBaseInfo filenameBaseInfo,
/// Formatting options for the log file.
/// Specify null to use default.
/// OUT parameter containing the newly created FileLogSink.
- /// True is a new FileLogSink was created and initialized, False otherwise.
- public static bool TryCreateNewFileLogSink(FilenameBaseInfo filenameBaseInfo,
- Guid logGroupId,
- string preferredLogFileDirectory,
- int rotateLogFileWhenLargerBytes,
- DefaultFormat.Options formatOptions,
- out FileLogSink newLogSink)
+ /// True is a new FileLogSink was created and initialized, False otherwise.
+ public static bool TryCreateNewFileLogSink(
+ FilenameBaseInfo filenameBaseInfo,
+ Guid logGroupId,
+ string preferredLogFileDirectory,
+ int rotateLogFileWhenLargerBytes,
+ DefaultFormat.Options formatOptions,
+ out FileLogSink newLogSink)
{
FilenameBaseInfo.EnsureValidAsParam(filenameBaseInfo);
@@ -173,9 +122,11 @@ public static bool TryCreateNewFileLogSink(FilenameBaseInfo filenameBaseInfo,
if (FileLogSink.IsWindowsFileSystem)
{
string commonAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
- defaultProductFamilyLogDir = Path.Combine(commonAppDataDir,
- WindowsDefaultLogDirectory,
- filenameBaseInfo.ProductFamily ?? FilenameMissingComponentFallback);
+ defaultProductFamilyLogDir =
+ Path.Combine(
+ commonAppDataDir,
+ WindowsDefaultLogDirectory,
+ filenameBaseInfo.ProductFamily ?? FilenameMissingComponentFallback);
}
else
{
@@ -261,7 +212,7 @@ private static void AppendToFilenameBase(StringBuilder filenameBase, string file
for (int p = 0; p < filenameComponent.Length; p++)
{
char c = filenameComponent[p];
- if (char.IsWhiteSpace(c) || c == '-')
+ if (Char.IsWhiteSpace(c) || c == '-')
{
filenameBase.Append(FilenameInvalidCharFallback);
}
@@ -304,7 +255,7 @@ private static string ReadEnvironmentVariable(string envVarName)
}
}
- ///
+ ///
/// !! This method should be called from within a try-catch block !!
/// On the (classic) .NET Framework the class is
/// guarded by a LinkDemand for FullTrust, so partial trust callers will throw an exception.
@@ -321,5 +272,59 @@ private static string GetCurrentProcessName()
return currentProcess.ProcessName;
}
}
+
+ ///
+ /// Encapsulates the information required to construct the filename base:
+ /// DD-{ProductFamily}-{Product}-{ComponentGroup}-{ProcessName}
+ ///
+ public struct FilenameBaseInfo
+ {
+ private string _logFilenameBase;
+
+ public FilenameBaseInfo(string productFamily, string product, string componentGroup)
+ : this(productFamily, product, componentGroup, GetProcessName())
+ {
+ }
+
+ public FilenameBaseInfo(string productFamily, string product, string componentGroup, string processName)
+ {
+ ProductFamily = productFamily;
+ Product = product;
+ ComponentGroup = componentGroup;
+ ProcessName = processName;
+ IsValid = true;
+ _logFilenameBase = null;
+ }
+
+ public bool IsValid { get; }
+ public string ProductFamily { get; }
+ public string Product { get; }
+ public string ComponentGroup { get; }
+ public string ProcessName { get; }
+ public string LogFilenameBase
+ {
+ get
+ {
+ string logFilenameBase = _logFilenameBase;
+ if (logFilenameBase == null && IsValid)
+ {
+ logFilenameBase = ConstructFilenameBase(ProductFamily, Product, ComponentGroup, ProcessName);
+ _logFilenameBase = logFilenameBase;
+ }
+
+ return logFilenameBase;
+ }
+ }
+
+ public static void EnsureValidAsParam(FilenameBaseInfo filenameBaseInfo)
+ {
+ if (!filenameBaseInfo.IsValid)
+ {
+ throw new ArgumentException(
+ $"Specified {nameof(filenameBaseInfo)} is not valid. Use the non-default (aka paramaterized) ctor.",
+ nameof(filenameBaseInfo));
+ }
+ }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/FileLogSink.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/FileLogSink.cs
index 48a85fe90..74055011a 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/FileLogSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/FileLogSink.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -7,36 +12,31 @@
namespace Datadog.Logging.Composition
{
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1308:Variable names must not be prefixed", Justification = "Should not apply to statics")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1311:Static readonly fields must begin with upper-case letter", Justification = "Should only apply to vars that are logically const.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters must start on line after declaration", Justification = "Bad rule")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names must not contain underscore", Justification = "Underscore aid visibility in long names")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Worst piece of advise Style tools ever gave.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1615:Element return value must be documented", Justification = "That would be great.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1611:Element parameters must be documented", Justification = "That would be great.")]
internal sealed class FileLogSink : ILogSink, IDisposable
{
public const int RotateLogFileWhenLargerBytesDefault = 1024 * 1024 * 128; // 128 MB
-
-#pragma warning disable IDE1006 // Runtime-initialized Constants {
- public static readonly DefaultFormat.Options DefaultFormatOptions = new DefaultFormat.Options(useUtcTimestamps: false,
- useNewLinesInErrorMessages: false,
- useNewLinesInDataNamesAndValues: false);
-
- private static readonly LogSourceInfo SelfLogSourceInfo = new LogSourceInfo(typeof(FileLogSink).FullName);
-
- private static readonly Encoding LogTextEncoding = Encoding.UTF8;
-#pragma warning restore IDE1006 // } Runtime-initialized Constants
-
private const string FilenameSeparatorForTimestamp = "-";
private const string FilenameTimestampFormat = "yyyyMMdd";
private const string FilenameSeparatorForIndex = "_";
private const string FilenameIndexFormat = "000";
private const string FilenameExtension = "log";
-
private const int FilenameTimestampAndIndexPartsLengthEstimate = 20;
+#pragma warning disable IDE1006 // Runtime-initialized Constants {
+#pragma warning disable SA1202 // Elements should be ordered by access
+ public static readonly DefaultFormat.Options DefaultFormatOptions =
+#pragma warning restore SA1202 // Elements should be ordered by access
+ new DefaultFormat.Options(useUtcTimestamps: false, useNewLinesInErrorMessages: false, useNewLinesInDataNamesAndValues: false);
+
+ private static readonly LogSourceInfo SelfLogSourceInfo = new LogSourceInfo(typeof(FileLogSink).FullName);
+ private static readonly Encoding LogTextEncoding = Encoding.UTF8;
+#pragma warning restore IDE1006 // } Runtime-initialized Constants
+
+#pragma warning disable SA1308 // Variable names should not be prefixed
+#pragma warning disable SA1311 // Static readonly fields should begin with upper-case letter
private static readonly bool s_isWindowsFileSystem = GetIsWindowsFileSystem();
+#pragma warning restore SA1311 // Static readonly fields should begin with upper-case letter
+#pragma warning restore SA1308 // Variable names should not be prefixed
private readonly DefaultFormat.Options _formatOptions;
private readonly Guid _logSessionId;
@@ -49,13 +49,14 @@ internal sealed class FileLogSink : ILogSink, IDisposable
private StreamWriter _logWriter;
private int _rotationIndex;
- private FileLogSink(LogGroupMutex logGroupMutex,
- string logFileDir,
- string logFileNameBase,
- int rotateLogFileWhenLargerBytes,
- FileStream logStream,
- int initialRotationIndex,
- DefaultFormat.Options formatOptions)
+ private FileLogSink(
+ LogGroupMutex logGroupMutex,
+ string logFileDir,
+ string logFileNameBase,
+ int rotateLogFileWhenLargerBytes,
+ FileStream logStream,
+ int initialRotationIndex,
+ DefaultFormat.Options formatOptions)
{
_logSessionId = Guid.NewGuid();
_logGroupMutex = logGroupMutex;
@@ -71,6 +72,11 @@ private FileLogSink(LogGroupMutex logGroupMutex,
_formatOptions = formatOptions ?? DefaultFormatOptions;
}
+ public static bool IsWindowsFileSystem
+ {
+ get { return s_isWindowsFileSystem; }
+ }
+
public Guid LogSessionId
{
get { return _logSessionId; }
@@ -91,8 +97,6 @@ public bool IsRotateLogFileBasedOnSizeEnabled
get { return (_rotateLogFileWhenLargerBytes > 0); }
}
- public static bool IsWindowsFileSystem { get { return s_isWindowsFileSystem; } }
-
public static bool TryCreateNew(string logFileDir, string logFileNameBase, Guid logGroupId, DefaultFormat.Options formatOptions, out FileLogSink newSink)
{
return TryCreateNew(logFileDir, logFileNameBase, logGroupId, FileLogSink.RotateLogFileWhenLargerBytesDefault, formatOptions, out newSink);
@@ -101,12 +105,13 @@ public static bool TryCreateNew(string logFileDir, string logFileNameBase, Guid
///
/// Attention: All loggers from all processes that write to the same logFileNameBase MUST use the same value for rotateLogFileWhenLargerBytes!
///
- public static bool TryCreateNew(string logFileDir,
- string logFileNameBase,
- Guid logGroupId,
- int rotateLogFileWhenLargerBytes,
- DefaultFormat.Options formatOptions,
- out FileLogSink newSink)
+ public static bool TryCreateNew(
+ string logFileDir,
+ string logFileNameBase,
+ Guid logGroupId,
+ int rotateLogFileWhenLargerBytes,
+ DefaultFormat.Options formatOptions,
+ out FileLogSink newSink)
{
// Bad usage - throw.
@@ -160,17 +165,18 @@ public static bool TryCreateNew(string logFileDir,
newSink = new FileLogSink(logGroupMutex, logFileDir, logFileNameBase, rotateLogFileWhenLargerBytes, logStream, rotationIndex, formatOptions);
}
- if (newSink.TryLogInfo(SelfLogSourceInfo.WithCallInfo().WithAssemblyName(),
- "Logging session started",
- new object[]
- {
- "LogGroupId",
- newSink.LogGroupId,
- "LogSessionId",
- newSink.LogSessionId,
- "RotateLogFileWhenLargerBytes",
- newSink.RotateLogFileWhenLargerBytes
- }))
+ if (newSink.TryLogInfo(
+ SelfLogSourceInfo.WithCallInfo().WithAssemblyName(),
+ "Logging session started",
+ new object[]
+ {
+ "LogGroupId",
+ newSink.LogGroupId,
+ "LogSessionId",
+ newSink.LogSessionId,
+ "RotateLogFileWhenLargerBytes",
+ newSink.RotateLogFileWhenLargerBytes
+ }))
{
return true;
}
@@ -268,17 +274,19 @@ public bool TryLogError(LogSourceInfo logSourceInfo, string message, Exception e
try
{
string errorMessage = DefaultFormat.ErrorMessage.Construct(message, exception, _formatOptions.UseNewLinesInErrorMessages);
- StringBuilder logLine = DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Error,
- logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- errorMessage,
- dataNamesAndValues,
- _formatOptions.UseUtcTimestamps,
- _formatOptions.UseNewLinesInDataNamesAndValues);
+ StringBuilder logLine =
+ DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Error,
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ errorMessage,
+ dataNamesAndValues,
+ _formatOptions.UseUtcTimestamps,
+ _formatOptions.UseNewLinesInDataNamesAndValues);
return TryWriteToFile(logLine.ToString());
}
catch
@@ -291,17 +299,19 @@ public bool TryLogInfo(LogSourceInfo logSourceInfo, string message, IEnumerable<
{
try
{
- StringBuilder logLine = DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Info,
- logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- message,
- dataNamesAndValues,
- _formatOptions.UseUtcTimestamps,
- _formatOptions.UseNewLinesInDataNamesAndValues);
+ StringBuilder logLine =
+ DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Info,
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ message,
+ dataNamesAndValues,
+ _formatOptions.UseUtcTimestamps,
+ _formatOptions.UseNewLinesInDataNamesAndValues);
return TryWriteToFile(logLine.ToString());
}
catch
@@ -314,17 +324,19 @@ public bool TryLogDebug(LogSourceInfo logSourceInfo, string message, IEnumerable
{
try
{
- StringBuilder logLine = DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Debug,
- logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- message,
- dataNamesAndValues,
- _formatOptions.UseUtcTimestamps,
- _formatOptions.UseNewLinesInDataNamesAndValues);
+ StringBuilder logLine =
+ DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Debug,
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ message,
+ dataNamesAndValues,
+ _formatOptions.UseUtcTimestamps,
+ _formatOptions.UseNewLinesInDataNamesAndValues);
return TryWriteToFile(logLine.ToString());
}
catch
@@ -448,7 +460,9 @@ private static bool GetIsWindowsFileSystem()
case PlatformID.Xbox:
default:
- throw new InvalidOperationException($"Unexpected OS PlatformID: \"{platformID}\" ({((int) platformID)})");
+#pragma warning disable format
+ throw new InvalidOperationException($"Unexpected OS PlatformID: \"{platformID}\" ({((int)platformID)})");
+#pragma warning restore format
}
}
catch
@@ -458,7 +472,8 @@ private static bool GetIsWindowsFileSystem()
}
}
- private static bool SafeDisposeAndSetToNull(ref T reference) where T : class, IDisposable
+ private static bool SafeDisposeAndSetToNull(ref T reference)
+ where T : class, IDisposable
{
T referencedItem = Interlocked.Exchange(ref reference, null);
if (referencedItem != null)
@@ -536,4 +551,4 @@ private bool RotateLogFile(LogGroupMutex.Handle logGroupMutexHandle)
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/ILogSink.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/ILogSink.cs
index 42bf86fa5..28341ad6d 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/ILogSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/ILogSink.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using Datadog.Logging.Emission;
@@ -12,4 +17,4 @@ internal interface ILogSink
bool TryLogDebug(LogSourceInfo logSourceInfo, string message, IEnumerable
internal sealed class LogGroupMutex : IDisposable
@@ -21,79 +26,14 @@ internal sealed class LogGroupMutex : IDisposable
private const int WaitForMutexMillis = 1000; // 0.5 sec
private const int IterationTimeoutMillis = 7000; // 7 sec
private const int MaxPauseBetweenWaitsMillis = 250; // 300 msecs
- private const int ImmediateIterationsBeforeGiveUp = 3; // 7 x 3 = total 21 secs of blocking (+ contention on _mutexProtector with other threads)
+ private const int ImmediateIterationsBeforeGiveUp = 3; // 7 x 3 = total 21 secs of blocking (+ contention on _mutexProtector with other threads)
- //private readonly object _iterationUpdateLock = new object();
private readonly SemaphoreSlim _mutexProtector = new SemaphoreSlim(1);
private readonly Guid _logGroupId;
private int _iteration;
private string _mutexName;
private Mutex _mutex;
- #region struct LogGroupMutex.Handle
- public struct Handle : IDisposable
- {
- internal static readonly Handle InvalidInstance = new Handle(null, null);
-
- private Mutex _acquiredMutex;
- private SemaphoreSlim _mutexProtector;
-
- internal Handle(Mutex acquiredMutex, SemaphoreSlim mutexProtector)
- {
- if ((acquiredMutex == null && mutexProtector != null) || (acquiredMutex != null && mutexProtector == null))
- {
- throw new ArgumentException($"{nameof(acquiredMutex)} and {nameof(mutexProtector)} must either both be null, or both be non-null.");
- }
-
- _acquiredMutex = acquiredMutex;
- _mutexProtector = mutexProtector;
- }
-
- public bool IsValid { get { return (_acquiredMutex != null && _mutexProtector != null); } }
-
- public void Dispose()
- {
- try
- {
- ReleaseMutex();
- }
- finally
- {
- _acquiredMutex = null;
- ReleaseMutexProtector();
- }
- }
-
- private void ReleaseMutex()
- {
- Mutex acquiredMutex = Interlocked.Exchange(ref _acquiredMutex, null);
- if (acquiredMutex != null)
- {
- try
- {
- acquiredMutex.ReleaseMutex();
- }
- catch (ObjectDisposedException)
- { }
- }
- }
-
- private void ReleaseMutexProtector()
- {
- SemaphoreSlim mutexProtector = Interlocked.Exchange(ref _mutexProtector, null);
- if (mutexProtector != null)
- {
- try
- {
- mutexProtector.Release();
- }
- catch (ObjectDisposedException)
- { }
- }
- }
- }
- #endregion struct LogGroupMutex.Handle
-
public LogGroupMutex(Guid logGroupId)
{
_logGroupId = logGroupId;
@@ -201,6 +141,24 @@ private static bool TryAcquireCore(Mutex mutex, SemaphoreSlim mutexProtector, re
return false;
}
+ private static bool SafeDisposeAndSetToNull(ref T reference)
+ where T : class, IDisposable
+ {
+ T referencedItem = Interlocked.Exchange(ref reference, null);
+ if (referencedItem != null)
+ {
+ try
+ {
+ referencedItem.Dispose();
+ return true;
+ }
+ catch
+ { }
+ }
+
+ return false;
+ }
+
private bool TryAcquireIteration(out LogGroupMutex.Handle acquiredMutex)
{
acquiredMutex = Handle.InvalidInstance;
@@ -277,21 +235,69 @@ private void IncMutexIteration()
_mutex = new Mutex(initiallyOwned: false, _mutexName);
}
- private static bool SafeDisposeAndSetToNull(ref T reference) where T : class, IDisposable
+ public struct Handle : IDisposable
{
- T referencedItem = Interlocked.Exchange(ref reference, null);
- if (referencedItem != null)
+ internal static readonly Handle InvalidInstance = new Handle(null, null);
+
+ private Mutex _acquiredMutex;
+ private SemaphoreSlim _mutexProtector;
+
+ internal Handle(Mutex acquiredMutex, SemaphoreSlim mutexProtector)
+ {
+ if ((acquiredMutex == null && mutexProtector != null) || (acquiredMutex != null && mutexProtector == null))
+ {
+ throw new ArgumentException($"{nameof(acquiredMutex)} and {nameof(mutexProtector)} must either both be null, or both be non-null.");
+ }
+
+ _acquiredMutex = acquiredMutex;
+ _mutexProtector = mutexProtector;
+ }
+
+ public bool IsValid
+ {
+ get { return (_acquiredMutex != null && _mutexProtector != null); }
+ }
+
+ public void Dispose()
{
try
{
- referencedItem.Dispose();
- return true;
+ ReleaseMutex();
+ }
+ finally
+ {
+ _acquiredMutex = null;
+ ReleaseMutexProtector();
}
- catch
- { }
}
- return false;
+ private void ReleaseMutex()
+ {
+ Mutex acquiredMutex = Interlocked.Exchange(ref _acquiredMutex, null);
+ if (acquiredMutex != null)
+ {
+ try
+ {
+ acquiredMutex.ReleaseMutex();
+ }
+ catch (ObjectDisposedException)
+ { }
+ }
+ }
+
+ private void ReleaseMutexProtector()
+ {
+ SemaphoreSlim mutexProtector = Interlocked.Exchange(ref _mutexProtector, null);
+ if (mutexProtector != null)
+ {
+ try
+ {
+ mutexProtector.Release();
+ }
+ catch (ObjectDisposedException)
+ { }
+ }
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/LogSourceNameCompositionLogSink.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/LogSourceNameCompositionLogSink.cs
index cdc6977fb..618848448 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/LogSourceNameCompositionLogSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/LogSourceNameCompositionLogSink.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using Datadog.Logging.Emission;
@@ -53,4 +58,4 @@ public void Dispose()
}
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Composition/internal/SimpleConsoleLogSink.cs b/shared/src/managed-src/Datadog.Logging.Composition/internal/SimpleConsoleLogSink.cs
index 87f46cadb..718df4012 100644
--- a/shared/src/managed-src/Datadog.Logging.Composition/internal/SimpleConsoleLogSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Composition/internal/SimpleConsoleLogSink.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using Datadog.Logging.Emission;
@@ -12,36 +17,37 @@ public bool TryLogError(LogSourceInfo logSourceInfo, string message, Exception e
{
try
{
- SimpleConsoleSink.Error(logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- message,
- exception,
- dataNamesAndValues);
+ SimpleConsoleSink.Error(
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ message,
+ exception,
+ dataNamesAndValues);
return true;
}
catch
{
return false;
}
-
}
public bool TryLogInfo(LogSourceInfo logSourceInfo, string message, IEnumerable dataNamesAndValues)
{
try
{
- SimpleConsoleSink.Info(logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- message,
- dataNamesAndValues);
+ SimpleConsoleSink.Info(
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ message,
+ dataNamesAndValues);
return true;
}
catch
@@ -54,14 +60,15 @@ public bool TryLogDebug(LogSourceInfo logSourceInfo, string message, IEnumerable
{
try
{
- SimpleConsoleSink.Debug(logSourceInfo.LogSourceNamePart1,
- logSourceInfo.LogSourceNamePart2,
- logSourceInfo.CallLineNumber,
- logSourceInfo.CallMemberName,
- logSourceInfo.CallFileName,
- logSourceInfo.AssemblyName,
- message,
- dataNamesAndValues);
+ SimpleConsoleSink.Debug(
+ logSourceInfo.LogSourceNamePart1,
+ logSourceInfo.LogSourceNamePart2,
+ logSourceInfo.CallLineNumber,
+ logSourceInfo.CallMemberName,
+ logSourceInfo.CallFileName,
+ logSourceInfo.AssemblyName,
+ message,
+ dataNamesAndValues);
return true;
}
catch
@@ -70,4 +77,4 @@ public bool TryLogDebug(LogSourceInfo logSourceInfo, string message, IEnumerable
}
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Emission/internal/DefaultFormat.cs b/shared/src/managed-src/Datadog.Logging.Emission/internal/DefaultFormat.cs
index a16982b65..91c3dbb49 100644
--- a/shared/src/managed-src/Datadog.Logging.Emission/internal/DefaultFormat.cs
+++ b/shared/src/managed-src/Datadog.Logging.Emission/internal/DefaultFormat.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -5,44 +10,22 @@
namespace Datadog.Logging.Emission
{
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1308:Variable names must not be prefixed", Justification = "Should not apply to statics")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1311:Static readonly fields must begin with upper-case letter", Justification = "Should only apply to vars that are logically const.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters must start on line after declaration", Justification = "Bad rule")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names must not contain underscore", Justification = "Underscore aid visibility in long names")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Worst piece of advise Style tools ever gave.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Usual convention")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1308:Variable names should not be prefixed", Justification = "Incompatible next")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1311:Static readonly fields should begin with upper-case letter", Justification = "Incompatible with previous")]
internal static class DefaultFormat
{
- public class Options
- {
- public static readonly Options SingleLines = new Options(useUtcTimestamps: false, useNewLinesInErrorMessages: false, useNewLinesInDataNamesAndValues: false);
- public static readonly Options StructuredMultilines = new Options(useUtcTimestamps: false, useNewLinesInErrorMessages: true, useNewLinesInDataNamesAndValues: true);
-
- public Options(bool useUtcTimestamps, bool useNewLinesInErrorMessages, bool useNewLinesInDataNamesAndValues)
- {
- this.UseUtcTimestamps = useUtcTimestamps;
- this.UseNewLinesInErrorMessages = useNewLinesInErrorMessages;
- this.UseNewLinesInDataNamesAndValues = useNewLinesInDataNamesAndValues;
- }
-
- public bool UseUtcTimestamps { get; }
- public bool UseNewLinesInErrorMessages { get; }
- public bool UseNewLinesInDataNamesAndValues { get; }
- }
-
public const string LogLevelMoniker_Error = "ERROR";
public const string LogLevelMoniker_Info = "INFO ";
public const string LogLevelMoniker_Debug = "DEBUG";
private const string LogSourceNamePartsSeparator = "::";
-
private const string TimestampPattern_Local = @"yyyy-MM-dd, HH\:mm\:ss\.fff \(zzz\)";
private const string TimestampPattern_Utc = @"yyyy-MM-dd, HH\:mm\:ss\.fff";
-
private const string NewLineReplacement = "^->";
private const string NullWord = "null";
private const string DataValueNotSpecifiedWord = "unspecified";
private const string IndentStr = " ";
-
private const string BlockMoniker_DataNamesAndValues = "DATA=";
private const string BlockMoniker_LogSourceInfo = "LOGSRC=";
@@ -62,12 +45,14 @@ public static string MergeNames(string part1, string part2)
{
return part1;
}
- else // MUST BE (part1 != null && part2 != null)
+ else
{
+ // MUST BE (part1 != null && part2 != null)
+
return part1 + LogSourceNamePartsSeparator + part2;
}
}
- } // class DefaultFormat.LogSourceInfo
+ }
public static class ErrorMessage
{
@@ -180,45 +165,48 @@ private static void DetectReplaceNewLines(string srcText, StringBuilder destBuff
}
}
}
- } // class DefaultFormat.LogSourceInfo
+ }
public static class LogLine
{
private static readonly string s_procIdInfo = GetProcIdInfoString();
- public static StringBuilder Construct(string logLevelMoniker,
- string logSourceNamePart1,
- string logSourceNamePart2,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- string message,
- IEnumerable dataNamesAndValues,
- bool useUtcTimestamp,
- bool useNewLines)
+ public static StringBuilder Construct(
+ string logLevelMoniker,
+ string logSourceNamePart1,
+ string logSourceNamePart2,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ string message,
+ IEnumerable dataNamesAndValues,
+ bool useUtcTimestamp,
+ bool useNewLines)
{
var logLine = new StringBuilder(capacity: 512);
AppendPrefix(logLine, logLevelMoniker, useUtcTimestamp);
- AppendEventInfo(logLine,
- logSourceNamePart1,
- logSourceNamePart2,
- logSourceCallLineNumber,
- logSourceCallMemberName,
- logSourceCallFileName,
- logSourceAssemblyName,
- message,
- dataNamesAndValues,
- useNewLines);
+ AppendEventInfo(
+ logLine,
+ logSourceNamePart1,
+ logSourceNamePart2,
+ logSourceCallLineNumber,
+ logSourceCallMemberName,
+ logSourceCallFileName,
+ logSourceAssemblyName,
+ message,
+ dataNamesAndValues,
+ useNewLines);
AppendDataNamesAndValues(logLine, dataNamesAndValues, useNewLines);
- AppendLogSourceInfo(logLine,
- logSourceCallLineNumber,
- logSourceCallMemberName,
- logSourceCallFileName,
- logSourceAssemblyName,
- useNewLines);
+ AppendLogSourceInfo(
+ logLine,
+ logSourceCallLineNumber,
+ logSourceCallMemberName,
+ logSourceCallFileName,
+ logSourceAssemblyName,
+ useNewLines);
return logLine;
}
@@ -265,16 +253,17 @@ public static void AppendPrefixCore(StringBuilder targetBuffer, string logLevelM
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "@ToDo review")]
- public static void AppendEventInfo(StringBuilder targetBuffer,
- string logSourceNamePart1,
- string logSourceNamePart2,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- string message,
- IEnumerable dataNamesAndValues,
- bool useNewLines)
+ public static void AppendEventInfo(
+ StringBuilder targetBuffer,
+ string logSourceNamePart1,
+ string logSourceNamePart2,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ string message,
+ IEnumerable dataNamesAndValues,
+ bool useNewLines)
{
bool hasLogSourceNamePart1 = !String.IsNullOrWhiteSpace(logSourceNamePart1);
bool hasLogSourceNamePart2 = !String.IsNullOrWhiteSpace(logSourceNamePart2);
@@ -336,6 +325,58 @@ public static void AppendDataNamesAndValues(StringBuilder targetBuffer, IEnumera
}
}
+ public static void AppendLogSourceInfo(
+ StringBuilder targetBuffer,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ bool useNewLines)
+ {
+ if ((targetBuffer == null)
+ || (logSourceCallLineNumber == 0
+ && logSourceCallMemberName == null
+ && logSourceCallFileName == null
+ && logSourceAssemblyName == null))
+ {
+ return;
+ }
+
+ AppendSectionWhitespaceSeparator(targetBuffer, useNewLines);
+
+ bool isFirstElement = true;
+
+ if (logSourceCallMemberName != null)
+ {
+ AppendLogSourceInfoElement(targetBuffer, "CallMemberName", logSourceCallMemberName, isFirstElement, useNewLines);
+ isFirstElement = false;
+ }
+
+ if (logSourceCallLineNumber != 0 || logSourceCallMemberName != null)
+ {
+ AppendLogSourceInfoElement(targetBuffer, "CallLineNumber", logSourceCallLineNumber, isFirstElement, useNewLines);
+ isFirstElement = false;
+ }
+
+ if (logSourceCallFileName != null)
+ {
+ AppendLogSourceInfoElement(targetBuffer, "CallFileName", logSourceCallFileName, isFirstElement, useNewLines);
+ isFirstElement = false;
+ }
+
+ if (logSourceAssemblyName != null)
+ {
+ AppendLogSourceInfoElement(targetBuffer, "AssemblyName", logSourceAssemblyName, isFirstElement, useNewLines);
+ }
+
+ if (useNewLines)
+ {
+ targetBuffer.AppendLine();
+ }
+
+ targetBuffer.Append('}');
+ }
+
private static void AppendDataNamesAndValuesArr(StringBuilder targetBuffer, object[] dataNamesAndValues, bool useNewLines)
{
const string BlockMonikerWithOpeningBrace = BlockMoniker_DataNamesAndValues + "{";
@@ -464,57 +505,6 @@ private static void AppendDataNamesAndValuesEnum(StringBuilder targetBuffer, IEn
}
}
- public static void AppendLogSourceInfo(StringBuilder targetBuffer,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- bool useNewLines)
- {
- if ((targetBuffer == null)
- || (logSourceCallLineNumber == 0
- && logSourceCallMemberName == null
- && logSourceCallFileName == null
- && logSourceAssemblyName == null))
- {
- return;
- }
-
- AppendSectionWhitespaceSeparator(targetBuffer, useNewLines);
-
- bool isFirstElement = true;
-
- if (logSourceCallMemberName != null)
- {
- AppendLogSourceInfoElement(targetBuffer, "CallMemberName", logSourceCallMemberName, isFirstElement, useNewLines);
- isFirstElement = false;
- }
-
- if (logSourceCallLineNumber != 0 || logSourceCallMemberName != null)
- {
- AppendLogSourceInfoElement(targetBuffer, "CallLineNumber", logSourceCallLineNumber, isFirstElement, useNewLines);
- isFirstElement = false;
- }
-
- if (logSourceCallFileName != null)
- {
- AppendLogSourceInfoElement(targetBuffer, "CallFileName", logSourceCallFileName, isFirstElement, useNewLines);
- isFirstElement = false;
- }
-
- if (logSourceAssemblyName != null)
- {
- AppendLogSourceInfoElement(targetBuffer, "AssemblyName", logSourceAssemblyName, isFirstElement, useNewLines);
- }
-
- if (useNewLines)
- {
- targetBuffer.AppendLine();
- }
-
- targetBuffer.Append('}');
- }
-
private static void AppendSectionWhitespaceSeparator(StringBuilder targetBuffer, bool useNewLines)
{
if (targetBuffer.Length > 0)
@@ -537,11 +527,12 @@ private static void AppendSectionWhitespaceSeparator(StringBuilder targetBuffer,
}
}
- private static void AppendLogSourceInfoElement(StringBuilder targetBuffer,
- string logSourceInfoElementName,
- T logSourceInfoElementValue,
- bool isFirstElement,
- bool useNewLines)
+ private static void AppendLogSourceInfoElement(
+ StringBuilder targetBuffer,
+ string logSourceInfoElementName,
+ T logSourceInfoElementValue,
+ bool isFirstElement,
+ bool useNewLines)
{
const string BlockMonikerWithOpeningBrace = BlockMoniker_LogSourceInfo + "{";
@@ -623,7 +614,7 @@ private static int GetCurrentProcessIdSafe()
}
}
- ///
+ ///
/// !! This method should be called from within a try-catch block !!
/// On the (classic) .NET Framework the class is
/// guarded by a LinkDemand for FullTrust, so partial trust callers will throw an exception.
@@ -640,6 +631,23 @@ private static int GetCurrentProcessId()
return currentProcess.Id;
}
}
- } // class DefaultFormat.LogLine
+ }
+
+ public class Options
+ {
+ public static readonly Options SingleLines = new Options(useUtcTimestamps: false, useNewLinesInErrorMessages: false, useNewLinesInDataNamesAndValues: false);
+ public static readonly Options StructuredMultilines = new Options(useUtcTimestamps: false, useNewLinesInErrorMessages: true, useNewLinesInDataNamesAndValues: true);
+
+ public Options(bool useUtcTimestamps, bool useNewLinesInErrorMessages, bool useNewLinesInDataNamesAndValues)
+ {
+ this.UseUtcTimestamps = useUtcTimestamps;
+ this.UseNewLinesInErrorMessages = useNewLinesInErrorMessages;
+ this.UseNewLinesInDataNamesAndValues = useNewLinesInDataNamesAndValues;
+ }
+
+ public bool UseUtcTimestamps { get; }
+ public bool UseNewLinesInErrorMessages { get; }
+ public bool UseNewLinesInDataNamesAndValues { get; }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Emission/internal/LogSourceInfo.cs b/shared/src/managed-src/Datadog.Logging.Emission/internal/LogSourceInfo.cs
index 49044ac51..61f620e37 100644
--- a/shared/src/managed-src/Datadog.Logging.Emission/internal/LogSourceInfo.cs
+++ b/shared/src/managed-src/Datadog.Logging.Emission/internal/LogSourceInfo.cs
@@ -1,4 +1,8 @@
-using System;
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System.IO;
using System.Runtime.CompilerServices;
@@ -6,18 +10,14 @@ namespace Datadog.Logging.Emission
{
internal struct LogSourceInfo
{
+#pragma warning disable SA1308 // Variable names should not be prefixed
private static string s_assemblyName = null;
-
- public string LogSourceNamePart1 { get; }
- public string LogSourceNamePart2 { get; }
- public int CallLineNumber { get; }
- public string CallMemberName { get; }
- public string CallFileName { get; }
- public string AssemblyName { get; }
+#pragma warning restore SA1308 // Variable names should not be prefixed
public LogSourceInfo(string logSourceName)
: this(logSourceNamePart1: null, logSourceNamePart2: logSourceName, callLineNumber: 0, callMemberName: null, callFileName: null, assemblyName: null)
- { }
+ {
+ }
public LogSourceInfo(string logSourceNamePart1, string logSourceNamePart2, int callLineNumber, string callMemberName, string callFileName, string assemblyName)
{
@@ -29,14 +29,22 @@ public LogSourceInfo(string logSourceNamePart1, string logSourceNamePart2, int c
AssemblyName = assemblyName;
}
+ public string LogSourceNamePart1 { get; }
+ public string LogSourceNamePart2 { get; }
+ public int CallLineNumber { get; }
+ public string CallMemberName { get; }
+ public string CallFileName { get; }
+ public string AssemblyName { get; }
+
public LogSourceInfo WithCallInfo([CallerLineNumber] int callLineNumber = 0, [CallerMemberName] string callMemberName = null)
{
return new LogSourceInfo(LogSourceNamePart1, LogSourceNamePart2, callLineNumber, callMemberName, callFileName: null, AssemblyName);
}
- public LogSourceInfo WithSrcFileInfo([CallerLineNumber] int callLineNumber = 0,
- [CallerMemberName] string callMemberName = null,
- [CallerFilePath] string callFilePath = null)
+ public LogSourceInfo WithSrcFileInfo(
+ [CallerLineNumber] int callLineNumber = 0,
+ [CallerMemberName] string callMemberName = null,
+ [CallerFilePath] string callFilePath = null)
{
string callFileName = null;
if (callFilePath != null)
@@ -139,4 +147,4 @@ private string GetAssemblyName()
return assemblyName;
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Logging.Emission/internal/SimpleConsoleSink.cs b/shared/src/managed-src/Datadog.Logging.Emission/internal/SimpleConsoleSink.cs
index ca5aefeab..28bc44bdd 100644
--- a/shared/src/managed-src/Datadog.Logging.Emission/internal/SimpleConsoleSink.cs
+++ b/shared/src/managed-src/Datadog.Logging.Emission/internal/SimpleConsoleSink.cs
@@ -1,89 +1,94 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
namespace Datadog.Logging.Emission
{
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Worst piece of advise Style tools ever gave.")]
- //[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters must start on line after declaration", Justification = "Bad rule")]
internal static class SimpleConsoleSink
{
#pragma warning disable IDE1006 // Runtime-initialized Constants {
private static readonly DefaultFormat.Options FormatOptions = DefaultFormat.Options.StructuredMultilines;
#pragma warning restore IDE1006 // } Runtime-initialized Constants
- public static void Error(string logSourceNamePart1,
- string logSourceNamePart2,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- string message,
- Exception exception,
- IEnumerable dataNamesAndValues)
+ public static void Error(
+ string logSourceNamePart1,
+ string logSourceNamePart2,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ string message,
+ Exception exception,
+ IEnumerable dataNamesAndValues)
{
string errorMessage = DefaultFormat.ErrorMessage.Construct(message, exception, FormatOptions.UseNewLinesInErrorMessages);
- Console.WriteLine(Environment.NewLine
- + DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Error,
- logSourceNamePart1,
- logSourceNamePart2,
- logSourceCallLineNumber,
- logSourceCallMemberName,
- logSourceCallFileName,
- logSourceAssemblyName,
- errorMessage,
- dataNamesAndValues,
- FormatOptions.UseUtcTimestamps,
- FormatOptions.UseNewLinesInDataNamesAndValues)
- .ToString());
+ Console.WriteLine(
+ Environment.NewLine + DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Error,
+ logSourceNamePart1,
+ logSourceNamePart2,
+ logSourceCallLineNumber,
+ logSourceCallMemberName,
+ logSourceCallFileName,
+ logSourceAssemblyName,
+ errorMessage,
+ dataNamesAndValues,
+ FormatOptions.UseUtcTimestamps,
+ FormatOptions.UseNewLinesInDataNamesAndValues).ToString());
}
- public static void Info(string logSourceNamePart1,
- string logSourceNamePart2,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- string message,
- IEnumerable dataNamesAndValues)
+ public static void Info(
+ string logSourceNamePart1,
+ string logSourceNamePart2,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ string message,
+ IEnumerable dataNamesAndValues)
{
- Console.WriteLine(Environment.NewLine
- + DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Info,
- logSourceNamePart1,
- logSourceNamePart2,
- logSourceCallLineNumber,
- logSourceCallMemberName,
- logSourceCallFileName,
- logSourceAssemblyName,
- message,
- dataNamesAndValues,
- FormatOptions.UseUtcTimestamps,
- FormatOptions.UseNewLinesInDataNamesAndValues)
- .ToString());
+ Console.WriteLine(
+ Environment.NewLine + DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Info,
+ logSourceNamePart1,
+ logSourceNamePart2,
+ logSourceCallLineNumber,
+ logSourceCallMemberName,
+ logSourceCallFileName,
+ logSourceAssemblyName,
+ message,
+ dataNamesAndValues,
+ FormatOptions.UseUtcTimestamps,
+ FormatOptions.UseNewLinesInDataNamesAndValues).ToString());
}
- public static void Debug(string logSourceNamePart1,
- string logSourceNamePart2,
- int logSourceCallLineNumber,
- string logSourceCallMemberName,
- string logSourceCallFileName,
- string logSourceAssemblyName,
- string message,
- IEnumerable dataNamesAndValues)
+ public static void Debug(
+ string logSourceNamePart1,
+ string logSourceNamePart2,
+ int logSourceCallLineNumber,
+ string logSourceCallMemberName,
+ string logSourceCallFileName,
+ string logSourceAssemblyName,
+ string message,
+ IEnumerable dataNamesAndValues)
{
- Console.WriteLine(Environment.NewLine
- + DefaultFormat.LogLine.Construct(DefaultFormat.LogLevelMoniker_Debug,
- logSourceNamePart1,
- logSourceNamePart2,
- logSourceCallLineNumber,
- logSourceCallMemberName,
- logSourceCallFileName,
- logSourceAssemblyName,
- message,
- dataNamesAndValues,
- FormatOptions.UseUtcTimestamps,
- FormatOptions.UseNewLinesInDataNamesAndValues)
- .ToString());
+ Console.WriteLine(Environment.NewLine + DefaultFormat.LogLine.Construct(
+ DefaultFormat.LogLevelMoniker_Debug,
+ logSourceNamePart1,
+ logSourceNamePart2,
+ logSourceCallLineNumber,
+ logSourceCallMemberName,
+ logSourceCallFileName,
+ logSourceAssemblyName,
+ message,
+ dataNamesAndValues,
+ FormatOptions.UseUtcTimestamps,
+ FormatOptions.UseNewLinesInDataNamesAndValues).ToString());
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/Concurrent.cs b/shared/src/managed-src/Datadog.Util/internal/Concurrent.cs
index 26ed2c565..c2c0bfda3 100644
--- a/shared/src/managed-src/Datadog.Util/internal/Concurrent.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/Concurrent.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Runtime.CompilerServices;
using System.Threading;
@@ -7,7 +12,8 @@ namespace Datadog.Util
internal static class Concurrent
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool TrySetIfNull(ref T storageLocation, T value) where T : class
+ public static bool TrySetIfNull(ref T storageLocation, T value)
+ where T : class
{
T prevValue = Interlocked.CompareExchange(ref storageLocation, value, null);
return Object.ReferenceEquals(null, prevValue);
@@ -15,32 +21,29 @@ public static bool TrySetIfNull(ref T storageLocation, T value) where T : cla
///
/// If storageLocation is null, sets the contents of storageLocation to value;
- /// otherwise keeps the previous contents (in an atomic, thread-safe manner).
+ /// otherwise keeps the previous contents (in an atomic, thread-safe manner).
/// Returns the contents of storageLocation after the operation.
///
/// The type of value (must be a class type).
- ///
- ///
/// If storageLocation was not null, the original value of storageLocation
/// (which is unchanged in that case);
/// otherwise, the new value of storageLocation (which, in that case, is the same as the
/// specified value parameter).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static T TrySetOrGetValue(ref T storageLocation, T value) where T : class
+ public static T TrySetOrGetValue(ref T storageLocation, T value)
+ where T : class
{
return TrySetOrGetValue(ref storageLocation, value, out bool _);
}
///
/// If storageLocation is null, sets the contents of storageLocation to value;
- /// otherwise keeps the previous contents (in an atomic, thread-safe manner).
+ /// otherwise keeps the previous contents (in an atomic, thread-safe manner).
/// Returns the contents of storageLocation after the operation.
/// valueIsAtStorageLocation indicates whether the specified value is stored
/// at the specified at the specified storageLocation after this operation completes.
///
/// The type of value (must be a class type).
- ///
- ///
/// true if after this operation the object reference stored
/// at the specified storageLocation is the same object as referenced by the specified value;
/// false otherwise.
@@ -49,7 +52,8 @@ public static T TrySetOrGetValue(ref T storageLocation, T value) where T : cl
/// otherwise, the new value of storageLocation (which, in that case, is the same as the
/// specified value parameter).
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static T TrySetOrGetValue(ref T storageLocation, T value, out bool valueIsAtStorageLocation) where T : class
+ public static T TrySetOrGetValue(ref T storageLocation, T value, out bool valueIsAtStorageLocation)
+ where T : class
{
T valueAtStorageLocation = CompareExchangeResult(ref storageLocation, value, null);
valueIsAtStorageLocation = Object.ReferenceEquals(valueAtStorageLocation, value);
@@ -60,16 +64,12 @@ public static T TrySetOrGetValue(ref T storageLocation, T value, out bool val
/// Is like Interlocked.CompareExchange(..), but returns the final/resulting value,
/// instead of the previous/original value.
///
- ///
- ///
- ///
- ///
- ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static T CompareExchangeResult(ref T storageLocation, T value, T comparand) where T : class
+ public static T CompareExchangeResult(ref T storageLocation, T value, T comparand)
+ where T : class
{
T prevValue = Interlocked.CompareExchange(ref storageLocation, value, comparand);
return Object.ReferenceEquals(prevValue, comparand) ? value : prevValue;
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/Converter.cs b/shared/src/managed-src/Datadog.Util/internal/Converter.cs
index a648cd4fa..007171691 100644
--- a/shared/src/managed-src/Datadog.Util/internal/Converter.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/Converter.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Runtime.CompilerServices;
@@ -37,13 +42,14 @@ private static DateTimeOffset ToDateTimeOffsetImplementation(long unixTimeUtcSec
if (unixTimeUtcSeconds < MinSeconds || unixTimeUtcSeconds > MaxSeconds)
{
- throw new ArgumentOutOfRangeException(nameof(unixTimeUtcSeconds),
- $"Valid values are between {MinSeconds} and {MaxSeconds} seconds, inclusive.");
+ throw new ArgumentOutOfRangeException(
+ nameof(unixTimeUtcSeconds),
+ $"Valid values are between {MinSeconds} and {MaxSeconds} seconds, inclusive.");
}
- long ticks = unixTimeUtcSeconds * TimeSpan.TicksPerSecond + UnixEpochTicks;
+ long ticks = (unixTimeUtcSeconds * TimeSpan.TicksPerSecond) + UnixEpochTicks;
return new DateTimeOffset(ticks, TimeSpan.Zero);
}
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/CurrentProcess.cs b/shared/src/managed-src/Datadog.Util/internal/CurrentProcess.cs
index 0c6e7745d..a3e397e9e 100644
--- a/shared/src/managed-src/Datadog.Util/internal/CurrentProcess.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/CurrentProcess.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Diagnostics;
using System.IO;
@@ -101,7 +106,7 @@ public static void GetIdentityInfo(out string processName, out string machineNam
///
/// CPU time in user mode.
/// CPU time in kernel mode.
- /// Total CPU time.
+ /// Total CPU time.
[MethodImpl(MethodImplOptions.NoInlining)]
public static void GetCpuTimeUsage(out TimeSpan userProcessorTime, out TimeSpan privilegedProcessorTime, out TimeSpan totalProcessorTime)
{
@@ -114,7 +119,7 @@ public static void GetCpuTimeUsage(out TimeSpan userProcessorTime, out TimeSpan
}
///
- /// Convenience method for getting the Count of ,
+ /// Convenience method for getting the Count of ,
/// and the mask
/// on the instance obtained via the -method.
///
@@ -154,15 +159,13 @@ public static void GetThreadingInfo(out int threadsCount, out IntPtr processorAf
/// This wrapper, when called from within a try-catch block, allows catching the exception.
///
///
- /// CPU time in user mode.
- /// CPU time in kernel mode.
- /// Total CPU time.
[MethodImpl(MethodImplOptions.NoInlining)]
- public static void GetMemoryUsage(out long nonpagedSystemMemorySize,
- out long pagedMemorySize,
- out long pagedSystemMemorySize,
- out long privateMemorySize,
- out long virtualMemorySize)
+ public static void GetMemoryUsage(
+ out long nonpagedSystemMemorySize,
+ out long pagedMemorySize,
+ out long pagedSystemMemorySize,
+ out long privateMemorySize,
+ out long virtualMemorySize)
{
using (Process currentProcess = Process.GetCurrentProcess())
{
@@ -175,7 +178,7 @@ public static void GetMemoryUsage(out long nonpagedSystemMemorySize,
}
///
- /// Convenience method for getting the Count of
+ /// Convenience method for getting the Count of
/// on the instance obtained via the -method.
///
/// !! This method should be called from within a try-catch block !!
@@ -196,7 +199,6 @@ public static int GetModulesCount()
}
}
-
///
/// Convenience method for calling
/// on the instance obtained via the -method.
@@ -270,7 +272,7 @@ public static ModuleInfo GetMainModule()
{
using (ProcessModule mainModule = currentProcess.MainModule)
{
- ModuleInfo mainModuleInfo = new ModuleInfo();
+ ModuleInfo mainModuleInfo = default(ModuleInfo);
if (mainModule != null)
{
@@ -311,7 +313,7 @@ public static string GetMainFileName()
/// This is the same situation as with the class.
/// The entire purpose of the utility is to help dealing with this conveniently.
/// The method returns information about the process modules.
- /// To allow working with that information without dealing with the partual trust issue, that method copies
+ /// To allow working with that information without dealing with the partual trust issue, that method copies
/// information from the internally obtained ProcessModule items into instances of this type.
///
///
@@ -360,4 +362,4 @@ internal void Reset()
}
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/ExceptionAggregator.cs b/shared/src/managed-src/Datadog.Util/internal/ExceptionAggregator.cs
index 5ad325271..c30263fe8 100644
--- a/shared/src/managed-src/Datadog.Util/internal/ExceptionAggregator.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/ExceptionAggregator.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
@@ -17,7 +22,7 @@ namespace Datadog.Util
/// - Two additional allocation are made (for a List{Exception} and for an AggregateException that encapsulates that list).
/// - TryGetAggregatedException(..) returns a new AggregateException instance which contains all the added exceptions.
/// - ThrowIfNotEmpty(..) throws a new AggregateException instance which contains all the added exceptions.
- ///
+ ///
/// Suggested usage pattern:
///
/// class Example
@@ -25,7 +30,7 @@ namespace Datadog.Util
/// void DoStuff()
/// {
/// var errors = new ExceptionAggregator();
- ///
+ ///
/// try
/// {
/// // ...
@@ -34,7 +39,7 @@ namespace Datadog.Util
/// {
/// errors.Add(ex);
/// }
- ///
+ ///
/// IEnumerable items = null;
/// foreach (object item in items)
/// {
@@ -47,7 +52,7 @@ namespace Datadog.Util
/// errors.Add(ex);
/// }
/// }
- ///
+ ///
/// errors.ThrowIfNotEmpty();
/// }
/// }
@@ -78,7 +83,7 @@ public int Count
}
else
{
- List prevList = (List) _aggregator;
+ List prevList = _aggregator as List;
return prevList.Count;
}
}
@@ -106,7 +111,7 @@ public void Add(Exception exception)
return;
}
- List prevList = (List) _aggregator;
+ List prevList = _aggregator as List;
prevList.Add(exception);
}
@@ -129,7 +134,7 @@ public bool TryGetAggregatedException(string aggregateExceptionMessage, out Exce
return true;
}
- List prevList = (List) _aggregator;
+ List prevList = _aggregator as List;
exception = (aggregateExceptionMessage == null)
? new AggregateException(prevList)
: new AggregateException(aggregateExceptionMessage, prevList);
@@ -153,11 +158,12 @@ public void ThrowIfNotEmpty(string aggregateExceptionMessage)
prevException.Rethrow();
}
- List prevList = (List) _aggregator;
- AggregateException aggEx = (aggregateExceptionMessage == null)
- ? new AggregateException(prevList)
- : new AggregateException(aggregateExceptionMessage, prevList);
+ List prevList = _aggregator as List;
+ AggregateException aggEx =
+ (aggregateExceptionMessage == null)
+ ? new AggregateException(prevList)
+ : new AggregateException(aggregateExceptionMessage, prevList);
throw aggEx;
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/ExceptionExtensions.cs b/shared/src/managed-src/Datadog.Util/internal/ExceptionExtensions.cs
index 6c640f2f4..5bb917573 100644
--- a/shared/src/managed-src/Datadog.Util/internal/ExceptionExtensions.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/ExceptionExtensions.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
@@ -19,7 +24,7 @@ internal static class ExceptionExtensions
/// throw ex.Rethrow();
/// }
///
- /// The throwing actually happens inside of the Rethrow<.c> method. However, this syntaxt allows the compiler to know that
+ /// The throwing actually happens inside of the Rethrow<.c> method. However, this syntaxt allows the compiler to know that
/// an exception will occur at that line. This prevents incorrect code analysis warnings/end errors such as 'missing return value',
/// 'missing initialization' and similar.
///
@@ -46,4 +51,4 @@ public static ExceptionDispatchInfo CaptureDispatchInfo(this Exception exception
return ExceptionDispatchInfo.Capture(exception);
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/Format.cs b/shared/src/managed-src/Datadog.Util/internal/Format.cs
index fc17fbb67..e6524f439 100644
--- a/shared/src/managed-src/Datadog.Util/internal/Format.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/Format.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@@ -16,8 +21,6 @@ internal static class Format
///
/// Returns either the specified str instrance, or the string "null" if str was null.
///
- ///
- ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string SpellIfNull(string str)
{
@@ -27,8 +30,6 @@ public static string SpellIfNull(string str)
///
/// Returns either the specified val instrance, or the string "null" if val was null.
///
- ///
- ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static object SpellIfNull(object val)
{
@@ -41,8 +42,6 @@ public static object SpellIfNull(object val)
/// If the specified parameter str is not null,
/// returns the a string that contains the specified str value pre-fixed and post-fixed with a quotes (") character.
///
- ///
- ///
public static string QuoteOrSpellNull(string str)
{
if (str == null)
@@ -76,8 +75,6 @@ public static string QuoteIfString(T val)
///
/// Determines whether the specified character is a valid lower-case hex digit.
///
- ///
- ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsLowerHexChar(char c)
{
@@ -88,10 +85,6 @@ public static bool IsLowerHexChar(char c)
/// Converts the specified key-value enumeration to a C#-style text notation.
/// Null values are spelled as "null", strings are quoted (") other objects are converted to strings and left unquoted.
///
- ///
- ///
- ///
- ///
public static IEnumerable AsTextLines(IEnumerable> table)
{
if (table == null)
@@ -107,17 +100,12 @@ public static IEnumerable AsTextLines(IEnumerable
/// Converts the specified value to a string and shortens it to not exceed the specified length.
/// If the specified length is 5 or more chars, the shortening occurs by removing characters from
/// the middle of the string and inserting "...".
/// Otherwise the string is truncated at the end.
///
- ///
- ///
- ///
- ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string LimitLength(object value, int maxLength, bool trim)
{
@@ -131,10 +119,6 @@ public static string LimitLength(object value, int maxLength, bool trim)
/// the middle of the string and inserting "...".
/// Otherwise the string is truncated at the end.
///
- ///
- ///
- ///
- ///
public static string LimitLength(string value, int maxLength, bool trim)
{
if (maxLength < 0)
@@ -214,4 +198,4 @@ public static string AsReadablePreciseLocal(DateTimeOffset dto)
return dto.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.FFFFFFF");
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/HResult.cs b/shared/src/managed-src/Datadog.Util/internal/HResult.cs
index 75b7c6c5b..6b1e36cbf 100644
--- a/shared/src/managed-src/Datadog.Util/internal/HResult.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/HResult.cs
@@ -1,26 +1,32 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Text;
namespace Datadog.Util
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0049:Simplify Names", Justification = "Uses Framework type names for correspondance with native types.")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Stay consistent with native constant names")]
public static class HResult
{
#pragma warning disable IDE1006 // Non-CodeStyle-conform names required here {
public const UInt32 S_OK = 0x00000000;
- public const UInt32 E_ABORT = 0x80004004; // Operation aborted
- public const UInt32 E_FAIL = 0x80004005; // Unspecified failure
- public const UInt32 E_NOTIMPL = 0x80004001; // Not implemented
- public const UInt32 E_POINTER = 0x80004003; // Pointer that is not valid
- public const UInt32 E_UNEXPECTED = 0x8000FFFF; // Unexpected/catastrophic failure
- public const UInt32 E_OUTOFMEMORY = 0x8007000E; // Ran out of memory
- public const UInt32 E_INVALIDARG = 0x80070057; // One or more arguments are invalid
- public const UInt32 E_ACCESSDENIED = 0x80070005; // General access denied error
- public const UInt32 E_PENDING = 0x8000000A; // The data necessary to complete this operation is not yet available.
- public const UInt32 E_BOUNDS = 0x8000000B; // The operation attempted to access data outside the valid range
- public const UInt32 E_CHANGED_STATE = 0x8000000C; // A concurrent operation changed the state of the object, invalidating this operation.
- public const UInt32 E_ILLEGAL_STATE_CHANGE = 0x8000000D;// An illegal state change was requested.
- public const UInt32 E_ILLEGAL_METHOD_CALL = 0x8000000E; // A method was called at an unexpected time.
+ public const UInt32 E_ABORT = 0x80004004; // Operation aborted
+ public const UInt32 E_FAIL = 0x80004005; // Unspecified failure
+ public const UInt32 E_NOTIMPL = 0x80004001; // Not implemented
+ public const UInt32 E_POINTER = 0x80004003; // Pointer that is not valid
+ public const UInt32 E_UNEXPECTED = 0x8000FFFF; // Unexpected/catastrophic failure
+ public const UInt32 E_OUTOFMEMORY = 0x8007000E; // Ran out of memory
+ public const UInt32 E_INVALIDARG = 0x80070057; // One or more arguments are invalid
+ public const UInt32 E_ACCESSDENIED = 0x80070005; // General access denied error
+ public const UInt32 E_PENDING = 0x8000000A; // The data necessary to complete this operation is not yet available.
+ public const UInt32 E_BOUNDS = 0x8000000B; // The operation attempted to access data outside the valid range
+ public const UInt32 E_CHANGED_STATE = 0x8000000C; // A concurrent operation changed the state of the object, invalidating this operation.
+ public const UInt32 E_ILLEGAL_STATE_CHANGE = 0x8000000D; // An illegal state change was requested.
+ public const UInt32 E_ILLEGAL_METHOD_CALL = 0x8000000E; // A method was called at an unexpected time.
#pragma warning restore IDE1006 // } Non-CodeStyle-conform names required here
private const UInt32 SeverityBitMask = 0x80000000;
@@ -29,6 +35,7 @@ public static bool IsSuccess(UInt32 hr)
{
return (hr & SeverityBitMask) == 0;
}
+
public static bool IsSuccess(Int32 hr)
{
return (hr & SeverityBitMask) == 0;
@@ -46,7 +53,11 @@ public static bool IsFailure(Int32 hr)
public static string ToString(Int32 hr)
{
+#pragma warning disable SA1009 // Closing parenthesis should be spaced correctly
+#pragma warning disable SA1003 // Symbols should be spaced correctly
return ToString((UInt32) hr);
+#pragma warning restore SA1003 // Symbols should be spaced correctly
+#pragma warning restore SA1009 // Closing parenthesis should be spaced correctly
}
public static string ToString(UInt32 hr)
@@ -108,7 +119,11 @@ public static string ToString(UInt32 hr)
public static string ToStringWithCode(Int32 hr)
{
+#pragma warning disable SA1003 // Symbols should be spaced correctly
+#pragma warning disable SA1009 // Closing parenthesis should be spaced correctly
return ToStringWithCode((UInt32) hr);
+#pragma warning restore SA1009 // Closing parenthesis should be spaced correctly
+#pragma warning restore SA1003 // Symbols should be spaced correctly
}
public static string ToStringWithCode(UInt32 hr)
@@ -127,7 +142,11 @@ public static UInt32 GetFailureCode(Exception ex)
return HResult.E_FAIL;
}
+#pragma warning disable SA1003 // Symbols should be spaced correctly
+#pragma warning disable SA1009 // Closing parenthesis should be spaced correctly
uint hr = (UInt32) ex.HResult;
+#pragma warning restore SA1009 // Closing parenthesis should be spaced correctly
+#pragma warning restore SA1003 // Symbols should be spaced correctly
return HResult.IsFailure(hr) ? hr : HResult.E_FAIL;
}
}
diff --git a/shared/src/managed-src/Datadog.Util/internal/RuntimeEnvironmentInfo.cs b/shared/src/managed-src/Datadog.Util/internal/RuntimeEnvironmentInfo.cs
index e41c4c1a9..08def446e 100644
--- a/shared/src/managed-src/Datadog.Util/internal/RuntimeEnvironmentInfo.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/RuntimeEnvironmentInfo.cs
@@ -1,4 +1,9 @@
-#if NETCOREAPP || NETSTANDARD
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
+#if NETCOREAPP || NETSTANDARD
#define RUNTIMEINFORMATION_TYPE_AVAILABLE
@@ -17,46 +22,102 @@ namespace Datadog.Util
{
internal class RuntimeEnvironmentInfo
{
- private const string CoreLibName_Mscorlib = "mscorlib";
- private const string CoreLibName_CoreLib = "System.Private.CoreLib";
+ private const string Mscorlib = "mscorlib";
+ private const string CoreLib = "System.Private.CoreLib";
private const string UnknownMoniker = "Unknown";
- #region Nested Types
+#pragma warning disable SA1308 // Variable names should not be prefixed
+ private static RuntimeEnvironmentInfo s_this = null;
+#pragma warning restore SA1308 // Variable names should not be prefixed
- public class CoreAssembyInformation
+ private string _stringView = null;
+ private string _osPlatformMoniker = null;
+
+ private RuntimeEnvironmentInfo(
+ string runtimeName,
+ string runtimeVersion,
+ string processArchitecture,
+ string osPlatform,
+ string osArchitecture,
+ string osDescription,
+ CoreAssembyInformation coreAssembyInfo)
{
- internal CoreAssembyInformation(bool isMscorlib, bool isSysPrivCoreLib, string name)
+ this.RuntimeName = runtimeName;
+ this.RuntimeVersion = runtimeVersion;
+ this.ProcessArchitecture = processArchitecture;
+ this.OsPlatform = osPlatform;
+ this.OsArchitecture = osArchitecture;
+ this.OsDescription = osDescription;
+ this.CoreAssembyInfo = coreAssembyInfo;
+ }
+
+ public static RuntimeEnvironmentInfo SingeltonInstance
+ {
+ get
{
- Validate.NotNull(name, nameof(name));
- this.IsMscorlib = isMscorlib;
- this.IsSysPrivCoreLib = isSysPrivCoreLib;
- this.Name = name;
- }
+ RuntimeEnvironmentInfo current = s_this;
+ if (current == null)
+ {
+ current = CreateNew();
+ s_this = current; // benign race
+ }
- public bool IsMscorlib { get; }
- public bool IsSysPrivCoreLib { get; }
- public string Name { get; }
+ return current;
+ }
}
- #endregion Nested Types
+ public string RuntimeName { get; }
+ public string RuntimeVersion { get; }
+ public string ProcessArchitecture { get; }
+ public string OsPlatform { get; }
+ public string OsArchitecture { get; }
+ public string OsDescription { get; }
+ public CoreAssembyInformation CoreAssembyInfo { get; }
+
+ public override string ToString()
+ {
+ string stringView = _stringView;
+ if (stringView == null)
+ {
+ stringView = $"{RuntimeName} {RuntimeVersion} ({ProcessArchitecture}) running on {OsPlatform} {OsArchitecture}";
- #region Static APIs
+ if (!String.IsNullOrWhiteSpace(OsDescription))
+ {
+ stringView = $"{stringView} ({OsDescription})";
+ }
- private static RuntimeEnvironmentInfo s_singeltonInstance = null;
+ _stringView = stringView;
+ }
- public static RuntimeEnvironmentInfo SingeltonInstance
+ return stringView;
+ }
+
+ public string GetOsPlatformMoniker()
{
- get
+ string osPlatformMoniker = _osPlatformMoniker;
+ if (osPlatformMoniker == null)
{
- RuntimeEnvironmentInfo singeltonInstance = s_singeltonInstance;
- if (singeltonInstance == null)
+ if (OsPlatform.StartsWith("win", StringComparison.OrdinalIgnoreCase))
+ {
+ osPlatformMoniker = "win";
+ }
+ else if (OsPlatform.StartsWith("linux", StringComparison.OrdinalIgnoreCase))
+ {
+ osPlatformMoniker = "linux";
+ }
+ else if (OsPlatform.StartsWith("macos", StringComparison.OrdinalIgnoreCase))
{
- singeltonInstance = CreateNew();
- s_singeltonInstance = singeltonInstance; // benign race
+ osPlatformMoniker = "osx";
+ }
+ else
+ {
+ osPlatformMoniker = OsPlatform.ToLower();
}
- return singeltonInstance;
+ _osPlatformMoniker = osPlatformMoniker;
}
+
+ return osPlatformMoniker;
}
private static RuntimeEnvironmentInfo CreateNew()
@@ -65,36 +126,37 @@ private static RuntimeEnvironmentInfo CreateNew()
{
Assembly objectTypeAssembly = (new object()).GetType().Assembly;
string objectTypeAssemblyName = objectTypeAssembly.GetName()?.Name ?? UnknownMoniker;
- var coreAssembyInfo = new CoreAssembyInformation(isMscorlib: CoreLibName_Mscorlib.Equals(objectTypeAssemblyName, StringComparison.OrdinalIgnoreCase),
- isSysPrivCoreLib: CoreLibName_CoreLib.Equals(objectTypeAssemblyName, StringComparison.OrdinalIgnoreCase),
- name: objectTypeAssemblyName);
+ var coreAssembyInfo = new CoreAssembyInformation(
+ isMscorlib: Mscorlib.Equals(objectTypeAssemblyName, StringComparison.OrdinalIgnoreCase),
+ isSysPrivCoreLib: CoreLib.Equals(objectTypeAssemblyName, StringComparison.OrdinalIgnoreCase),
+ name: objectTypeAssemblyName);
string runtimeName = GetRuntimeName(coreAssembyInfo);
string runtimeVersion = GetRuntimeVersion(coreAssembyInfo, objectTypeAssembly);
string processArchitecture = GetProcessArchitecture();
string osPlatform = GetOsPlatform();
string osArchitecture = GetOsArchitecture();
- string osDescription = GetOsDescriptio();
-
- return new RuntimeEnvironmentInfo(runtimeName,
- runtimeVersion,
- processArchitecture,
- osPlatform,
- osArchitecture,
- osDescription,
- coreAssembyInfo);
+ string osDescription = GetOsDescription();
+
+ return new RuntimeEnvironmentInfo(
+ runtimeName,
+ runtimeVersion,
+ processArchitecture,
+ osPlatform,
+ osArchitecture,
+ osDescription,
+ coreAssembyInfo);
}
catch
{
- return new RuntimeEnvironmentInfo(runtimeName: UnknownMoniker,
- runtimeVersion: UnknownMoniker,
- processArchitecture: UnknownMoniker,
- osPlatform: UnknownMoniker,
- osArchitecture: UnknownMoniker,
- osDescription: UnknownMoniker,
- coreAssembyInfo: new CoreAssembyInformation(isMscorlib: false,
- isSysPrivCoreLib: false,
- name: UnknownMoniker));
+ return new RuntimeEnvironmentInfo(
+ runtimeName: UnknownMoniker,
+ runtimeVersion: UnknownMoniker,
+ processArchitecture: UnknownMoniker,
+ osPlatform: UnknownMoniker,
+ osArchitecture: UnknownMoniker,
+ osDescription: UnknownMoniker,
+ coreAssembyInfo: new CoreAssembyInformation(isMscorlib: false, isSysPrivCoreLib: false, name: UnknownMoniker));
}
}
@@ -219,7 +281,7 @@ private static string GetOsArchitecture()
#endif
}
- private static string GetOsDescriptio()
+ private static string GetOsDescription()
{
#if RUNTIMEINFORMATION_TYPE_AVAILABLE
string osDescription = RuntimeInformation.OSDescription;
@@ -253,85 +315,20 @@ private static string ArchitectureToString(Architecture architecture)
}
}
#endif
- #endregion Static APIs
-
- #region Non-Static APIs
-
- private string _stringView = null;
- private string _osPlatformMoniker = null;
-
- private RuntimeEnvironmentInfo(string runtimeName,
- string runtimeVersion,
- string processArchitecture,
- string osPlatform,
- string osArchitecture,
- string osDescription,
- CoreAssembyInformation coreAssembyInfo)
- {
- this.RuntimeName = runtimeName;
- this.RuntimeVersion = runtimeVersion;
- this.ProcessArchitecture = processArchitecture;
- this.OsPlatform = osPlatform;
- this.OsArchitecture = osArchitecture;
- this.OsDescription = osDescription;
- this.CoreAssembyInfo = coreAssembyInfo;
- }
-
- public string RuntimeName { get; }
- public string RuntimeVersion { get; }
- public string ProcessArchitecture { get; }
- public string OsPlatform { get; }
- public string OsArchitecture { get; }
- public string OsDescription { get; }
- public CoreAssembyInformation CoreAssembyInfo { get; }
-
- public override string ToString()
- {
- string stringView = _stringView;
- if (stringView == null)
- {
- stringView = $"{RuntimeName} {RuntimeVersion} ({ProcessArchitecture}) running on {OsPlatform} {OsArchitecture}";
-
- if (!String.IsNullOrWhiteSpace(OsDescription))
- {
- stringView = $"{stringView} ({OsDescription})";
- }
-
- _stringView = stringView;
- }
-
- return stringView;
- }
-
- public string GetOsPlatformMoniker()
+ public class CoreAssembyInformation
{
- string osPlatformMoniker = _osPlatformMoniker;
- if (osPlatformMoniker == null)
+ internal CoreAssembyInformation(bool isMscorlib, bool isSysPrivCoreLib, string name)
{
- if (OsPlatform.StartsWith("win", StringComparison.OrdinalIgnoreCase))
- {
- osPlatformMoniker = "win";
- }
- else if (OsPlatform.StartsWith("linux", StringComparison.OrdinalIgnoreCase))
- {
- osPlatformMoniker = "linux";
- }
- else if (OsPlatform.StartsWith("macos", StringComparison.OrdinalIgnoreCase))
- {
- osPlatformMoniker = "osx";
- }
- else
- {
- osPlatformMoniker = OsPlatform.ToLower();
- }
-
- _osPlatformMoniker = osPlatformMoniker;
+ Validate.NotNull(name, nameof(name));
+ this.IsMscorlib = isMscorlib;
+ this.IsSysPrivCoreLib = isSysPrivCoreLib;
+ this.Name = name;
}
- return osPlatformMoniker;
+ public bool IsMscorlib { get; }
+ public bool IsSysPrivCoreLib { get; }
+ public string Name { get; }
}
-
- #endregion Non-Static APIs
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/managed-src/Datadog.Util/internal/Validate.cs b/shared/src/managed-src/Datadog.Util/internal/Validate.cs
index f2d1a10f6..82262fb72 100644
--- a/shared/src/managed-src/Datadog.Util/internal/Validate.cs
+++ b/shared/src/managed-src/Datadog.Util/internal/Validate.cs
@@ -1,3 +1,8 @@
+//
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
+//
+
using System;
using System.Runtime.CompilerServices;
@@ -64,4 +69,4 @@ public static void NotNullOrWhitespace(string value, string name)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/README.md b/shared/src/native-lib/coreclr/src/README.md
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/README.md
rename to shared/src/native-lib/coreclr/src/README.md
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/CMakeLists.txt b/shared/src/native-lib/coreclr/src/inc/CMakeLists.txt
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/CMakeLists.txt
rename to shared/src/native-lib/coreclr/src/inc/CMakeLists.txt
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/CrstTypeTool.cs b/shared/src/native-lib/coreclr/src/inc/CrstTypeTool.cs
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/CrstTypeTool.cs
rename to shared/src/native-lib/coreclr/src/inc/CrstTypeTool.cs
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/CrstTypes.def b/shared/src/native-lib/coreclr/src/inc/CrstTypes.def
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/CrstTypes.def
rename to shared/src/native-lib/coreclr/src/inc/CrstTypes.def
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/MSCOREE.IDL b/shared/src/native-lib/coreclr/src/inc/MSCOREE.IDL
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/MSCOREE.IDL
rename to shared/src/native-lib/coreclr/src/inc/MSCOREE.IDL
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/OpCodeGen.pl b/shared/src/native-lib/coreclr/src/inc/OpCodeGen.pl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/OpCodeGen.pl
rename to shared/src/native-lib/coreclr/src/inc/OpCodeGen.pl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/allocacheck.h b/shared/src/native-lib/coreclr/src/inc/allocacheck.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/allocacheck.h
rename to shared/src/native-lib/coreclr/src/inc/allocacheck.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/arrayholder.h b/shared/src/native-lib/coreclr/src/inc/arrayholder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/arrayholder.h
rename to shared/src/native-lib/coreclr/src/inc/arrayholder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/arraylist.h b/shared/src/native-lib/coreclr/src/inc/arraylist.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/arraylist.h
rename to shared/src/native-lib/coreclr/src/inc/arraylist.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bbsweep.h b/shared/src/native-lib/coreclr/src/inc/bbsweep.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bbsweep.h
rename to shared/src/native-lib/coreclr/src/inc/bbsweep.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bitmask.h b/shared/src/native-lib/coreclr/src/inc/bitmask.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bitmask.h
rename to shared/src/native-lib/coreclr/src/inc/bitmask.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bitmask.inl b/shared/src/native-lib/coreclr/src/inc/bitmask.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bitmask.inl
rename to shared/src/native-lib/coreclr/src/inc/bitmask.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bitposition.h b/shared/src/native-lib/coreclr/src/inc/bitposition.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bitposition.h
rename to shared/src/native-lib/coreclr/src/inc/bitposition.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bitvector.h b/shared/src/native-lib/coreclr/src/inc/bitvector.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bitvector.h
rename to shared/src/native-lib/coreclr/src/inc/bitvector.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/blobfetcher.h b/shared/src/native-lib/coreclr/src/inc/blobfetcher.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/blobfetcher.h
rename to shared/src/native-lib/coreclr/src/inc/blobfetcher.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/bundle.h b/shared/src/native-lib/coreclr/src/inc/bundle.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/bundle.h
rename to shared/src/native-lib/coreclr/src/inc/bundle.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cahlpr.h b/shared/src/native-lib/coreclr/src/inc/cahlpr.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cahlpr.h
rename to shared/src/native-lib/coreclr/src/inc/cahlpr.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/caparser.h b/shared/src/native-lib/coreclr/src/inc/caparser.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/caparser.h
rename to shared/src/native-lib/coreclr/src/inc/caparser.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ceefilegenwriter.h b/shared/src/native-lib/coreclr/src/inc/ceefilegenwriter.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ceefilegenwriter.h
rename to shared/src/native-lib/coreclr/src/inc/ceefilegenwriter.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ceegen.h b/shared/src/native-lib/coreclr/src/inc/ceegen.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ceegen.h
rename to shared/src/native-lib/coreclr/src/inc/ceegen.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ceegentokenmapper.h b/shared/src/native-lib/coreclr/src/inc/ceegentokenmapper.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ceegentokenmapper.h
rename to shared/src/native-lib/coreclr/src/inc/ceegentokenmapper.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ceesectionstring.h b/shared/src/native-lib/coreclr/src/inc/ceesectionstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ceesectionstring.h
rename to shared/src/native-lib/coreclr/src/inc/ceesectionstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cfi.h b/shared/src/native-lib/coreclr/src/inc/cfi.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cfi.h
rename to shared/src/native-lib/coreclr/src/inc/cfi.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/check.h b/shared/src/native-lib/coreclr/src/inc/check.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/check.h
rename to shared/src/native-lib/coreclr/src/inc/check.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/check.inl b/shared/src/native-lib/coreclr/src/inc/check.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/check.inl
rename to shared/src/native-lib/coreclr/src/inc/check.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr/fs.h b/shared/src/native-lib/coreclr/src/inc/clr/fs.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr/fs.h
rename to shared/src/native-lib/coreclr/src/inc/clr/fs.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr/fs/path.h b/shared/src/native-lib/coreclr/src/inc/clr/fs/path.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr/fs/path.h
rename to shared/src/native-lib/coreclr/src/inc/clr/fs/path.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr/stack.h b/shared/src/native-lib/coreclr/src/inc/clr/stack.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr/stack.h
rename to shared/src/native-lib/coreclr/src/inc/clr/stack.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr/str.h b/shared/src/native-lib/coreclr/src/inc/clr/str.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr/str.h
rename to shared/src/native-lib/coreclr/src/inc/clr/str.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr/win32.h b/shared/src/native-lib/coreclr/src/inc/clr/win32.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr/win32.h
rename to shared/src/native-lib/coreclr/src/inc/clr/win32.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr_std/algorithm b/shared/src/native-lib/coreclr/src/inc/clr_std/algorithm
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr_std/algorithm
rename to shared/src/native-lib/coreclr/src/inc/clr_std/algorithm
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr_std/string b/shared/src/native-lib/coreclr/src/inc/clr_std/string
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr_std/string
rename to shared/src/native-lib/coreclr/src/inc/clr_std/string
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr_std/type_traits b/shared/src/native-lib/coreclr/src/inc/clr_std/type_traits
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr_std/type_traits
rename to shared/src/native-lib/coreclr/src/inc/clr_std/type_traits
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr_std/utility b/shared/src/native-lib/coreclr/src/inc/clr_std/utility
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr_std/utility
rename to shared/src/native-lib/coreclr/src/inc/clr_std/utility
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clr_std/vector b/shared/src/native-lib/coreclr/src/inc/clr_std/vector
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clr_std/vector
rename to shared/src/native-lib/coreclr/src/inc/clr_std/vector
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrconfig.h b/shared/src/native-lib/coreclr/src/inc/clrconfig.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrconfig.h
rename to shared/src/native-lib/coreclr/src/inc/clrconfig.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrconfigvalues.h b/shared/src/native-lib/coreclr/src/inc/clrconfigvalues.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrconfigvalues.h
rename to shared/src/native-lib/coreclr/src/inc/clrconfigvalues.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrdata.idl b/shared/src/native-lib/coreclr/src/inc/clrdata.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrdata.idl
rename to shared/src/native-lib/coreclr/src/inc/clrdata.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrhost.h b/shared/src/native-lib/coreclr/src/inc/clrhost.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrhost.h
rename to shared/src/native-lib/coreclr/src/inc/clrhost.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrinternal.idl b/shared/src/native-lib/coreclr/src/inc/clrinternal.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrinternal.idl
rename to shared/src/native-lib/coreclr/src/inc/clrinternal.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrnt.h b/shared/src/native-lib/coreclr/src/inc/clrnt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrnt.h
rename to shared/src/native-lib/coreclr/src/inc/clrnt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrprivbinderutil.h b/shared/src/native-lib/coreclr/src/inc/clrprivbinderutil.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrprivbinderutil.h
rename to shared/src/native-lib/coreclr/src/inc/clrprivbinderutil.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrprivbinding.idl b/shared/src/native-lib/coreclr/src/inc/clrprivbinding.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrprivbinding.idl
rename to shared/src/native-lib/coreclr/src/inc/clrprivbinding.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrtypes.h b/shared/src/native-lib/coreclr/src/inc/clrtypes.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrtypes.h
rename to shared/src/native-lib/coreclr/src/inc/clrtypes.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/clrversion.h b/shared/src/native-lib/coreclr/src/inc/clrversion.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/clrversion.h
rename to shared/src/native-lib/coreclr/src/inc/clrversion.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/complex.h b/shared/src/native-lib/coreclr/src/inc/complex.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/complex.h
rename to shared/src/native-lib/coreclr/src/inc/complex.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/configuration.h b/shared/src/native-lib/coreclr/src/inc/configuration.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/configuration.h
rename to shared/src/native-lib/coreclr/src/inc/configuration.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/contract.h b/shared/src/native-lib/coreclr/src/inc/contract.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/contract.h
rename to shared/src/native-lib/coreclr/src/inc/contract.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/contract.inl b/shared/src/native-lib/coreclr/src/inc/contract.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/contract.inl
rename to shared/src/native-lib/coreclr/src/inc/contract.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/contxt.h b/shared/src/native-lib/coreclr/src/inc/contxt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/contxt.h
rename to shared/src/native-lib/coreclr/src/inc/contxt.h
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/inc/cor.h b/shared/src/native-lib/coreclr/src/inc/cor.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/inc/cor.h
rename to shared/src/native-lib/coreclr/src/inc/cor.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corbbtprof.h b/shared/src/native-lib/coreclr/src/inc/corbbtprof.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corbbtprof.h
rename to shared/src/native-lib/coreclr/src/inc/corbbtprof.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corcompile.h b/shared/src/native-lib/coreclr/src/inc/corcompile.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corcompile.h
rename to shared/src/native-lib/coreclr/src/inc/corcompile.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cordbpriv.h b/shared/src/native-lib/coreclr/src/inc/cordbpriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cordbpriv.h
rename to shared/src/native-lib/coreclr/src/inc/cordbpriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cordebug.idl b/shared/src/native-lib/coreclr/src/inc/cordebug.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cordebug.idl
rename to shared/src/native-lib/coreclr/src/inc/cordebug.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cordebuginfo.h b/shared/src/native-lib/coreclr/src/inc/cordebuginfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cordebuginfo.h
rename to shared/src/native-lib/coreclr/src/inc/cordebuginfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/coredistools.h b/shared/src/native-lib/coreclr/src/inc/coredistools.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/coredistools.h
rename to shared/src/native-lib/coreclr/src/inc/coredistools.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/coregen.h b/shared/src/native-lib/coreclr/src/inc/coregen.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/coregen.h
rename to shared/src/native-lib/coreclr/src/inc/coregen.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corerror.xml b/shared/src/native-lib/coreclr/src/inc/corerror.xml
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corerror.xml
rename to shared/src/native-lib/coreclr/src/inc/corerror.xml
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corexcep.h b/shared/src/native-lib/coreclr/src/inc/corexcep.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corexcep.h
rename to shared/src/native-lib/coreclr/src/inc/corexcep.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhdr.h b/shared/src/native-lib/coreclr/src/inc/corhdr.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhdr.h
rename to shared/src/native-lib/coreclr/src/inc/corhdr.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhlpr.cpp b/shared/src/native-lib/coreclr/src/inc/corhlpr.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhlpr.cpp
rename to shared/src/native-lib/coreclr/src/inc/corhlpr.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhlpr.h b/shared/src/native-lib/coreclr/src/inc/corhlpr.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhlpr.h
rename to shared/src/native-lib/coreclr/src/inc/corhlpr.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhlprpriv.cpp b/shared/src/native-lib/coreclr/src/inc/corhlprpriv.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhlprpriv.cpp
rename to shared/src/native-lib/coreclr/src/inc/corhlprpriv.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhlprpriv.h b/shared/src/native-lib/coreclr/src/inc/corhlprpriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhlprpriv.h
rename to shared/src/native-lib/coreclr/src/inc/corhlprpriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corhost.h b/shared/src/native-lib/coreclr/src/inc/corhost.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corhost.h
rename to shared/src/native-lib/coreclr/src/inc/corhost.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corimage.h b/shared/src/native-lib/coreclr/src/inc/corimage.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corimage.h
rename to shared/src/native-lib/coreclr/src/inc/corimage.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corinfo.h b/shared/src/native-lib/coreclr/src/inc/corinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corinfo.h
rename to shared/src/native-lib/coreclr/src/inc/corinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corinfoinstructionset.h b/shared/src/native-lib/coreclr/src/inc/corinfoinstructionset.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corinfoinstructionset.h
rename to shared/src/native-lib/coreclr/src/inc/corinfoinstructionset.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corjit.h b/shared/src/native-lib/coreclr/src/inc/corjit.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corjit.h
rename to shared/src/native-lib/coreclr/src/inc/corjit.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corjitflags.h b/shared/src/native-lib/coreclr/src/inc/corjitflags.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corjitflags.h
rename to shared/src/native-lib/coreclr/src/inc/corjitflags.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corjithost.h b/shared/src/native-lib/coreclr/src/inc/corjithost.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corjithost.h
rename to shared/src/native-lib/coreclr/src/inc/corjithost.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corpriv.h b/shared/src/native-lib/coreclr/src/inc/corpriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corpriv.h
rename to shared/src/native-lib/coreclr/src/inc/corpriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corprof.idl b/shared/src/native-lib/coreclr/src/inc/corprof.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corprof.idl
rename to shared/src/native-lib/coreclr/src/inc/corprof.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corpub.idl b/shared/src/native-lib/coreclr/src/inc/corpub.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corpub.idl
rename to shared/src/native-lib/coreclr/src/inc/corpub.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/corsym.idl b/shared/src/native-lib/coreclr/src/inc/corsym.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/corsym.idl
rename to shared/src/native-lib/coreclr/src/inc/corsym.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cortypeinfo.h b/shared/src/native-lib/coreclr/src/inc/cortypeinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cortypeinfo.h
rename to shared/src/native-lib/coreclr/src/inc/cortypeinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/crosscomp.h b/shared/src/native-lib/coreclr/src/inc/crosscomp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/crosscomp.h
rename to shared/src/native-lib/coreclr/src/inc/crosscomp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/crsttypes.h b/shared/src/native-lib/coreclr/src/inc/crsttypes.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/crsttypes.h
rename to shared/src/native-lib/coreclr/src/inc/crsttypes.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/crtwrap.h b/shared/src/native-lib/coreclr/src/inc/crtwrap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/crtwrap.h
rename to shared/src/native-lib/coreclr/src/inc/crtwrap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cvconst.h b/shared/src/native-lib/coreclr/src/inc/cvconst.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cvconst.h
rename to shared/src/native-lib/coreclr/src/inc/cvconst.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cvinfo.h b/shared/src/native-lib/coreclr/src/inc/cvinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cvinfo.h
rename to shared/src/native-lib/coreclr/src/inc/cvinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/cycletimer.h b/shared/src/native-lib/coreclr/src/inc/cycletimer.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/cycletimer.h
rename to shared/src/native-lib/coreclr/src/inc/cycletimer.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/daccess.h b/shared/src/native-lib/coreclr/src/inc/daccess.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/daccess.h
rename to shared/src/native-lib/coreclr/src/inc/daccess.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dacprivate.h b/shared/src/native-lib/coreclr/src/inc/dacprivate.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dacprivate.h
rename to shared/src/native-lib/coreclr/src/inc/dacprivate.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dacvars.h b/shared/src/native-lib/coreclr/src/inc/dacvars.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dacvars.h
rename to shared/src/native-lib/coreclr/src/inc/dacvars.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dbgconfigstrings.h b/shared/src/native-lib/coreclr/src/inc/dbgconfigstrings.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dbgconfigstrings.h
rename to shared/src/native-lib/coreclr/src/inc/dbgconfigstrings.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dbgenginemetrics.h b/shared/src/native-lib/coreclr/src/inc/dbgenginemetrics.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dbgenginemetrics.h
rename to shared/src/native-lib/coreclr/src/inc/dbgenginemetrics.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dbgmeta.h b/shared/src/native-lib/coreclr/src/inc/dbgmeta.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dbgmeta.h
rename to shared/src/native-lib/coreclr/src/inc/dbgmeta.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dbgportable.h b/shared/src/native-lib/coreclr/src/inc/dbgportable.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dbgportable.h
rename to shared/src/native-lib/coreclr/src/inc/dbgportable.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/debugmacros.h b/shared/src/native-lib/coreclr/src/inc/debugmacros.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/debugmacros.h
rename to shared/src/native-lib/coreclr/src/inc/debugmacros.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/debugmacrosext.h b/shared/src/native-lib/coreclr/src/inc/debugmacrosext.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/debugmacrosext.h
rename to shared/src/native-lib/coreclr/src/inc/debugmacrosext.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/debugreturn.h b/shared/src/native-lib/coreclr/src/inc/debugreturn.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/debugreturn.h
rename to shared/src/native-lib/coreclr/src/inc/debugreturn.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/defaultallocator.h b/shared/src/native-lib/coreclr/src/inc/defaultallocator.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/defaultallocator.h
rename to shared/src/native-lib/coreclr/src/inc/defaultallocator.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/dlwrap.h b/shared/src/native-lib/coreclr/src/inc/dlwrap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/dlwrap.h
rename to shared/src/native-lib/coreclr/src/inc/dlwrap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ecmakey.h b/shared/src/native-lib/coreclr/src/inc/ecmakey.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ecmakey.h
rename to shared/src/native-lib/coreclr/src/inc/ecmakey.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/eetwain.h b/shared/src/native-lib/coreclr/src/inc/eetwain.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/eetwain.h
rename to shared/src/native-lib/coreclr/src/inc/eetwain.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/eexcp.h b/shared/src/native-lib/coreclr/src/inc/eexcp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/eexcp.h
rename to shared/src/native-lib/coreclr/src/inc/eexcp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/entrypoints.h b/shared/src/native-lib/coreclr/src/inc/entrypoints.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/entrypoints.h
rename to shared/src/native-lib/coreclr/src/inc/entrypoints.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/eventtrace.h b/shared/src/native-lib/coreclr/src/inc/eventtrace.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/eventtrace.h
rename to shared/src/native-lib/coreclr/src/inc/eventtrace.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/eventtracebase.h b/shared/src/native-lib/coreclr/src/inc/eventtracebase.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/eventtracebase.h
rename to shared/src/native-lib/coreclr/src/inc/eventtracebase.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ex.h b/shared/src/native-lib/coreclr/src/inc/ex.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ex.h
rename to shared/src/native-lib/coreclr/src/inc/ex.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/factory.h b/shared/src/native-lib/coreclr/src/inc/factory.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/factory.h
rename to shared/src/native-lib/coreclr/src/inc/factory.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/factory.inl b/shared/src/native-lib/coreclr/src/inc/factory.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/factory.inl
rename to shared/src/native-lib/coreclr/src/inc/factory.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/fixuppointer.h b/shared/src/native-lib/coreclr/src/inc/fixuppointer.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/fixuppointer.h
rename to shared/src/native-lib/coreclr/src/inc/fixuppointer.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/formattype.cpp b/shared/src/native-lib/coreclr/src/inc/formattype.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/formattype.cpp
rename to shared/src/native-lib/coreclr/src/inc/formattype.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/formattype.h b/shared/src/native-lib/coreclr/src/inc/formattype.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/formattype.h
rename to shared/src/native-lib/coreclr/src/inc/formattype.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/fstream.h b/shared/src/native-lib/coreclr/src/inc/fstream.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/fstream.h
rename to shared/src/native-lib/coreclr/src/inc/fstream.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/fstring.h b/shared/src/native-lib/coreclr/src/inc/fstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/fstring.h
rename to shared/src/native-lib/coreclr/src/inc/fstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/fusion.idl b/shared/src/native-lib/coreclr/src/inc/fusion.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/fusion.idl
rename to shared/src/native-lib/coreclr/src/inc/fusion.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcdecoder.cpp b/shared/src/native-lib/coreclr/src/inc/gcdecoder.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcdecoder.cpp
rename to shared/src/native-lib/coreclr/src/inc/gcdecoder.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcdump.h b/shared/src/native-lib/coreclr/src/inc/gcdump.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcdump.h
rename to shared/src/native-lib/coreclr/src/inc/gcdump.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfo.h b/shared/src/native-lib/coreclr/src/inc/gcinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfo.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfoarraylist.h b/shared/src/native-lib/coreclr/src/inc/gcinfoarraylist.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfoarraylist.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfoarraylist.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfodecoder.h b/shared/src/native-lib/coreclr/src/inc/gcinfodecoder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfodecoder.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfodecoder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfodumper.h b/shared/src/native-lib/coreclr/src/inc/gcinfodumper.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfodumper.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfodumper.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfoencoder.h b/shared/src/native-lib/coreclr/src/inc/gcinfoencoder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfoencoder.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfoencoder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcinfotypes.h b/shared/src/native-lib/coreclr/src/inc/gcinfotypes.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcinfotypes.h
rename to shared/src/native-lib/coreclr/src/inc/gcinfotypes.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/gcrefmap.h b/shared/src/native-lib/coreclr/src/inc/gcrefmap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/gcrefmap.h
rename to shared/src/native-lib/coreclr/src/inc/gcrefmap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/genheaders.cs b/shared/src/native-lib/coreclr/src/inc/genheaders.cs
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/genheaders.cs
rename to shared/src/native-lib/coreclr/src/inc/genheaders.cs
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/genrops.pl b/shared/src/native-lib/coreclr/src/inc/genrops.pl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/genrops.pl
rename to shared/src/native-lib/coreclr/src/inc/genrops.pl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/getproductversionnumber.h b/shared/src/native-lib/coreclr/src/inc/getproductversionnumber.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/getproductversionnumber.h
rename to shared/src/native-lib/coreclr/src/inc/getproductversionnumber.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/guidfromname.h b/shared/src/native-lib/coreclr/src/inc/guidfromname.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/guidfromname.h
rename to shared/src/native-lib/coreclr/src/inc/guidfromname.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/holder.h b/shared/src/native-lib/coreclr/src/inc/holder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/holder.h
rename to shared/src/native-lib/coreclr/src/inc/holder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/holderinst.h b/shared/src/native-lib/coreclr/src/inc/holderinst.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/holderinst.h
rename to shared/src/native-lib/coreclr/src/inc/holderinst.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/iallocator.h b/shared/src/native-lib/coreclr/src/inc/iallocator.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/iallocator.h
rename to shared/src/native-lib/coreclr/src/inc/iallocator.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/iceefilegen.h b/shared/src/native-lib/coreclr/src/inc/iceefilegen.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/iceefilegen.h
rename to shared/src/native-lib/coreclr/src/inc/iceefilegen.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/il_kywd.h b/shared/src/native-lib/coreclr/src/inc/il_kywd.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/il_kywd.h
rename to shared/src/native-lib/coreclr/src/inc/il_kywd.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ildbsymlib.h b/shared/src/native-lib/coreclr/src/inc/ildbsymlib.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ildbsymlib.h
rename to shared/src/native-lib/coreclr/src/inc/ildbsymlib.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ilformatter.h b/shared/src/native-lib/coreclr/src/inc/ilformatter.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ilformatter.h
rename to shared/src/native-lib/coreclr/src/inc/ilformatter.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/internalunknownimpl.h b/shared/src/native-lib/coreclr/src/inc/internalunknownimpl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/internalunknownimpl.h
rename to shared/src/native-lib/coreclr/src/inc/internalunknownimpl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/intrinsic.h b/shared/src/native-lib/coreclr/src/inc/intrinsic.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/intrinsic.h
rename to shared/src/native-lib/coreclr/src/inc/intrinsic.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/iterator.h b/shared/src/native-lib/coreclr/src/inc/iterator.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/iterator.h
rename to shared/src/native-lib/coreclr/src/inc/iterator.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/jithelpers.h b/shared/src/native-lib/coreclr/src/inc/jithelpers.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/jithelpers.h
rename to shared/src/native-lib/coreclr/src/inc/jithelpers.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/livedatatarget.h b/shared/src/native-lib/coreclr/src/inc/livedatatarget.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/livedatatarget.h
rename to shared/src/native-lib/coreclr/src/inc/livedatatarget.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/llvm/Dwarf.def b/shared/src/native-lib/coreclr/src/inc/llvm/Dwarf.def
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/llvm/Dwarf.def
rename to shared/src/native-lib/coreclr/src/inc/llvm/Dwarf.def
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/llvm/Dwarf.h b/shared/src/native-lib/coreclr/src/inc/llvm/Dwarf.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/llvm/Dwarf.h
rename to shared/src/native-lib/coreclr/src/inc/llvm/Dwarf.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/llvm/ELF.h b/shared/src/native-lib/coreclr/src/inc/llvm/ELF.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/llvm/ELF.h
rename to shared/src/native-lib/coreclr/src/inc/llvm/ELF.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/loaderheap.h b/shared/src/native-lib/coreclr/src/inc/loaderheap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/loaderheap.h
rename to shared/src/native-lib/coreclr/src/inc/loaderheap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/log.h b/shared/src/native-lib/coreclr/src/inc/log.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/log.h
rename to shared/src/native-lib/coreclr/src/inc/log.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/loglf.h b/shared/src/native-lib/coreclr/src/inc/loglf.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/loglf.h
rename to shared/src/native-lib/coreclr/src/inc/loglf.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/longfilepathwrappers.h b/shared/src/native-lib/coreclr/src/inc/longfilepathwrappers.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/longfilepathwrappers.h
rename to shared/src/native-lib/coreclr/src/inc/longfilepathwrappers.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/md5.h b/shared/src/native-lib/coreclr/src/inc/md5.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/md5.h
rename to shared/src/native-lib/coreclr/src/inc/md5.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/mdcommon.h b/shared/src/native-lib/coreclr/src/inc/mdcommon.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/mdcommon.h
rename to shared/src/native-lib/coreclr/src/inc/mdcommon.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/mdfileformat.h b/shared/src/native-lib/coreclr/src/inc/mdfileformat.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/mdfileformat.h
rename to shared/src/native-lib/coreclr/src/inc/mdfileformat.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/memorypool.h b/shared/src/native-lib/coreclr/src/inc/memorypool.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/memorypool.h
rename to shared/src/native-lib/coreclr/src/inc/memorypool.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/memoryrange.h b/shared/src/native-lib/coreclr/src/inc/memoryrange.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/memoryrange.h
rename to shared/src/native-lib/coreclr/src/inc/memoryrange.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/metadata.h b/shared/src/native-lib/coreclr/src/inc/metadata.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/metadata.h
rename to shared/src/native-lib/coreclr/src/inc/metadata.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/metadataexports.h b/shared/src/native-lib/coreclr/src/inc/metadataexports.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/metadataexports.h
rename to shared/src/native-lib/coreclr/src/inc/metadataexports.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/metadatatracker.h b/shared/src/native-lib/coreclr/src/inc/metadatatracker.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/metadatatracker.h
rename to shared/src/native-lib/coreclr/src/inc/metadatatracker.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/metahost.idl b/shared/src/native-lib/coreclr/src/inc/metahost.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/metahost.idl
rename to shared/src/native-lib/coreclr/src/inc/metahost.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/metamodelpub.h b/shared/src/native-lib/coreclr/src/inc/metamodelpub.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/metamodelpub.h
rename to shared/src/native-lib/coreclr/src/inc/metamodelpub.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/mpl/type_list b/shared/src/native-lib/coreclr/src/inc/mpl/type_list
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/mpl/type_list
rename to shared/src/native-lib/coreclr/src/inc/mpl/type_list
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/mscorsvc.idl b/shared/src/native-lib/coreclr/src/inc/mscorsvc.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/mscorsvc.idl
rename to shared/src/native-lib/coreclr/src/inc/mscorsvc.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/msodw.h b/shared/src/native-lib/coreclr/src/inc/msodw.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/msodw.h
rename to shared/src/native-lib/coreclr/src/inc/msodw.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/msodwwrap.h b/shared/src/native-lib/coreclr/src/inc/msodwwrap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/msodwwrap.h
rename to shared/src/native-lib/coreclr/src/inc/msodwwrap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/nativevaraccessors.h b/shared/src/native-lib/coreclr/src/inc/nativevaraccessors.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/nativevaraccessors.h
rename to shared/src/native-lib/coreclr/src/inc/nativevaraccessors.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/new.hpp b/shared/src/native-lib/coreclr/src/inc/new.hpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/new.hpp
rename to shared/src/native-lib/coreclr/src/inc/new.hpp
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ngen.h b/shared/src/native-lib/coreclr/src/inc/ngen.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ngen.h
rename to shared/src/native-lib/coreclr/src/inc/ngen.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/nibblemapmacros.h b/shared/src/native-lib/coreclr/src/inc/nibblemapmacros.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/nibblemapmacros.h
rename to shared/src/native-lib/coreclr/src/inc/nibblemapmacros.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/nibblestream.h b/shared/src/native-lib/coreclr/src/inc/nibblestream.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/nibblestream.h
rename to shared/src/native-lib/coreclr/src/inc/nibblestream.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/nsutilpriv.h b/shared/src/native-lib/coreclr/src/inc/nsutilpriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/nsutilpriv.h
rename to shared/src/native-lib/coreclr/src/inc/nsutilpriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/opcode.def b/shared/src/native-lib/coreclr/src/inc/opcode.def
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/opcode.def
rename to shared/src/native-lib/coreclr/src/inc/opcode.def
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/openum.h b/shared/src/native-lib/coreclr/src/inc/openum.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/openum.h
rename to shared/src/native-lib/coreclr/src/inc/openum.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/opinfo.h b/shared/src/native-lib/coreclr/src/inc/opinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/opinfo.h
rename to shared/src/native-lib/coreclr/src/inc/opinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/optdefault.h b/shared/src/native-lib/coreclr/src/inc/optdefault.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/optdefault.h
rename to shared/src/native-lib/coreclr/src/inc/optdefault.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/optsmallperfcritical.h b/shared/src/native-lib/coreclr/src/inc/optsmallperfcritical.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/optsmallperfcritical.h
rename to shared/src/native-lib/coreclr/src/inc/optsmallperfcritical.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/ostype.h b/shared/src/native-lib/coreclr/src/inc/ostype.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/ostype.h
rename to shared/src/native-lib/coreclr/src/inc/ostype.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/outstring.h b/shared/src/native-lib/coreclr/src/inc/outstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/outstring.h
rename to shared/src/native-lib/coreclr/src/inc/outstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/palclr.h b/shared/src/native-lib/coreclr/src/inc/palclr.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/palclr.h
rename to shared/src/native-lib/coreclr/src/inc/palclr.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/palclr_win.h b/shared/src/native-lib/coreclr/src/inc/palclr_win.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/palclr_win.h
rename to shared/src/native-lib/coreclr/src/inc/palclr_win.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/patchpointinfo.h b/shared/src/native-lib/coreclr/src/inc/patchpointinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/patchpointinfo.h
rename to shared/src/native-lib/coreclr/src/inc/patchpointinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/pedecoder.h b/shared/src/native-lib/coreclr/src/inc/pedecoder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/pedecoder.h
rename to shared/src/native-lib/coreclr/src/inc/pedecoder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/pedecoder.inl b/shared/src/native-lib/coreclr/src/inc/pedecoder.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/pedecoder.inl
rename to shared/src/native-lib/coreclr/src/inc/pedecoder.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/peinformation.h b/shared/src/native-lib/coreclr/src/inc/peinformation.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/peinformation.h
rename to shared/src/native-lib/coreclr/src/inc/peinformation.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/pesectionman.h b/shared/src/native-lib/coreclr/src/inc/pesectionman.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/pesectionman.h
rename to shared/src/native-lib/coreclr/src/inc/pesectionman.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/posterror.h b/shared/src/native-lib/coreclr/src/inc/posterror.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/posterror.h
rename to shared/src/native-lib/coreclr/src/inc/posterror.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/predeftlsslot.h b/shared/src/native-lib/coreclr/src/inc/predeftlsslot.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/predeftlsslot.h
rename to shared/src/native-lib/coreclr/src/inc/predeftlsslot.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/prettyprintsig.h b/shared/src/native-lib/coreclr/src/inc/prettyprintsig.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/prettyprintsig.h
rename to shared/src/native-lib/coreclr/src/inc/prettyprintsig.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/profilepriv.h b/shared/src/native-lib/coreclr/src/inc/profilepriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/profilepriv.h
rename to shared/src/native-lib/coreclr/src/inc/profilepriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/profilepriv.inl b/shared/src/native-lib/coreclr/src/inc/profilepriv.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/profilepriv.inl
rename to shared/src/native-lib/coreclr/src/inc/profilepriv.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/random.h b/shared/src/native-lib/coreclr/src/inc/random.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/random.h
rename to shared/src/native-lib/coreclr/src/inc/random.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/rangetree.h b/shared/src/native-lib/coreclr/src/inc/rangetree.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/rangetree.h
rename to shared/src/native-lib/coreclr/src/inc/rangetree.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/readme.md b/shared/src/native-lib/coreclr/src/inc/readme.md
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/readme.md
rename to shared/src/native-lib/coreclr/src/inc/readme.md
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/readytorun.h b/shared/src/native-lib/coreclr/src/inc/readytorun.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/readytorun.h
rename to shared/src/native-lib/coreclr/src/inc/readytorun.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/readytorunhelpers.h b/shared/src/native-lib/coreclr/src/inc/readytorunhelpers.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/readytorunhelpers.h
rename to shared/src/native-lib/coreclr/src/inc/readytorunhelpers.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/readytoruninstructionset.h b/shared/src/native-lib/coreclr/src/inc/readytoruninstructionset.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/readytoruninstructionset.h
rename to shared/src/native-lib/coreclr/src/inc/readytoruninstructionset.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/regdisp.h b/shared/src/native-lib/coreclr/src/inc/regdisp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/regdisp.h
rename to shared/src/native-lib/coreclr/src/inc/regdisp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/regex_base.h b/shared/src/native-lib/coreclr/src/inc/regex_base.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/regex_base.h
rename to shared/src/native-lib/coreclr/src/inc/regex_base.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/regex_util.h b/shared/src/native-lib/coreclr/src/inc/regex_util.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/regex_util.h
rename to shared/src/native-lib/coreclr/src/inc/regex_util.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/registrywrapper.h b/shared/src/native-lib/coreclr/src/inc/registrywrapper.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/registrywrapper.h
rename to shared/src/native-lib/coreclr/src/inc/registrywrapper.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/releaseholder.h b/shared/src/native-lib/coreclr/src/inc/releaseholder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/releaseholder.h
rename to shared/src/native-lib/coreclr/src/inc/releaseholder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/safemath.h b/shared/src/native-lib/coreclr/src/inc/safemath.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/safemath.h
rename to shared/src/native-lib/coreclr/src/inc/safemath.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/safewrap.h b/shared/src/native-lib/coreclr/src/inc/safewrap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/safewrap.h
rename to shared/src/native-lib/coreclr/src/inc/safewrap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sarray.h b/shared/src/native-lib/coreclr/src/inc/sarray.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sarray.h
rename to shared/src/native-lib/coreclr/src/inc/sarray.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sarray.inl b/shared/src/native-lib/coreclr/src/inc/sarray.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sarray.inl
rename to shared/src/native-lib/coreclr/src/inc/sarray.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sbuffer.h b/shared/src/native-lib/coreclr/src/inc/sbuffer.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sbuffer.h
rename to shared/src/native-lib/coreclr/src/inc/sbuffer.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sbuffer.inl b/shared/src/native-lib/coreclr/src/inc/sbuffer.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sbuffer.inl
rename to shared/src/native-lib/coreclr/src/inc/sbuffer.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/securityutil.h b/shared/src/native-lib/coreclr/src/inc/securityutil.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/securityutil.h
rename to shared/src/native-lib/coreclr/src/inc/securityutil.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/securitywrapper.h b/shared/src/native-lib/coreclr/src/inc/securitywrapper.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/securitywrapper.h
rename to shared/src/native-lib/coreclr/src/inc/securitywrapper.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sha1.h b/shared/src/native-lib/coreclr/src/inc/sha1.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sha1.h
rename to shared/src/native-lib/coreclr/src/inc/sha1.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shash.h b/shared/src/native-lib/coreclr/src/inc/shash.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shash.h
rename to shared/src/native-lib/coreclr/src/inc/shash.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shash.inl b/shared/src/native-lib/coreclr/src/inc/shash.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shash.inl
rename to shared/src/native-lib/coreclr/src/inc/shash.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/locationinfo.h b/shared/src/native-lib/coreclr/src/inc/shim/locationinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/locationinfo.h
rename to shared/src/native-lib/coreclr/src/inc/shim/locationinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/runtimeselector.h b/shared/src/native-lib/coreclr/src/inc/shim/runtimeselector.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/runtimeselector.h
rename to shared/src/native-lib/coreclr/src/inc/shim/runtimeselector.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/runtimeselector.inl b/shared/src/native-lib/coreclr/src/inc/shim/runtimeselector.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/runtimeselector.inl
rename to shared/src/native-lib/coreclr/src/inc/shim/runtimeselector.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/shimselector.h b/shared/src/native-lib/coreclr/src/inc/shim/shimselector.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/shimselector.h
rename to shared/src/native-lib/coreclr/src/inc/shim/shimselector.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/shimselector.inl b/shared/src/native-lib/coreclr/src/inc/shim/shimselector.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/shimselector.inl
rename to shared/src/native-lib/coreclr/src/inc/shim/shimselector.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/versionandlocationinfo.h b/shared/src/native-lib/coreclr/src/inc/shim/versionandlocationinfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/versionandlocationinfo.h
rename to shared/src/native-lib/coreclr/src/inc/shim/versionandlocationinfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/versionandlocationinfo.inl b/shared/src/native-lib/coreclr/src/inc/shim/versionandlocationinfo.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/versionandlocationinfo.inl
rename to shared/src/native-lib/coreclr/src/inc/shim/versionandlocationinfo.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/versioninfo.h b/shared/src/native-lib/coreclr/src/inc/shim/versioninfo.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/versioninfo.h
rename to shared/src/native-lib/coreclr/src/inc/shim/versioninfo.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shim/versioninfo.inl b/shared/src/native-lib/coreclr/src/inc/shim/versioninfo.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shim/versioninfo.inl
rename to shared/src/native-lib/coreclr/src/inc/shim/versioninfo.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/shimload.h b/shared/src/native-lib/coreclr/src/inc/shimload.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/shimload.h
rename to shared/src/native-lib/coreclr/src/inc/shimload.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sigbuilder.h b/shared/src/native-lib/coreclr/src/inc/sigbuilder.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sigbuilder.h
rename to shared/src/native-lib/coreclr/src/inc/sigbuilder.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sigparser.h b/shared/src/native-lib/coreclr/src/inc/sigparser.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sigparser.h
rename to shared/src/native-lib/coreclr/src/inc/sigparser.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/simplerhash.h b/shared/src/native-lib/coreclr/src/inc/simplerhash.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/simplerhash.h
rename to shared/src/native-lib/coreclr/src/inc/simplerhash.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/simplerhash.inl b/shared/src/native-lib/coreclr/src/inc/simplerhash.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/simplerhash.inl
rename to shared/src/native-lib/coreclr/src/inc/simplerhash.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/slist.h b/shared/src/native-lib/coreclr/src/inc/slist.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/slist.h
rename to shared/src/native-lib/coreclr/src/inc/slist.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sospriv.idl b/shared/src/native-lib/coreclr/src/inc/sospriv.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sospriv.idl
rename to shared/src/native-lib/coreclr/src/inc/sospriv.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sstring.h b/shared/src/native-lib/coreclr/src/inc/sstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sstring.h
rename to shared/src/native-lib/coreclr/src/inc/sstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/sstring.inl b/shared/src/native-lib/coreclr/src/inc/sstring.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/sstring.inl
rename to shared/src/native-lib/coreclr/src/inc/sstring.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stack.h b/shared/src/native-lib/coreclr/src/inc/stack.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stack.h
rename to shared/src/native-lib/coreclr/src/inc/stack.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stackframe.h b/shared/src/native-lib/coreclr/src/inc/stackframe.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stackframe.h
rename to shared/src/native-lib/coreclr/src/inc/stackframe.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stacktrace.h b/shared/src/native-lib/coreclr/src/inc/stacktrace.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stacktrace.h
rename to shared/src/native-lib/coreclr/src/inc/stacktrace.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/static_assert.h b/shared/src/native-lib/coreclr/src/inc/static_assert.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/static_assert.h
rename to shared/src/native-lib/coreclr/src/inc/static_assert.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/staticcontract.h b/shared/src/native-lib/coreclr/src/inc/staticcontract.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/staticcontract.h
rename to shared/src/native-lib/coreclr/src/inc/staticcontract.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stdmacros.h b/shared/src/native-lib/coreclr/src/inc/stdmacros.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stdmacros.h
rename to shared/src/native-lib/coreclr/src/inc/stdmacros.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stgpool.h b/shared/src/native-lib/coreclr/src/inc/stgpool.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stgpool.h
rename to shared/src/native-lib/coreclr/src/inc/stgpool.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stgpooli.h b/shared/src/native-lib/coreclr/src/inc/stgpooli.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stgpooli.h
rename to shared/src/native-lib/coreclr/src/inc/stgpooli.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stresslog.h b/shared/src/native-lib/coreclr/src/inc/stresslog.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stresslog.h
rename to shared/src/native-lib/coreclr/src/inc/stresslog.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stringarraylist.h b/shared/src/native-lib/coreclr/src/inc/stringarraylist.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stringarraylist.h
rename to shared/src/native-lib/coreclr/src/inc/stringarraylist.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/stringarraylist.inl b/shared/src/native-lib/coreclr/src/inc/stringarraylist.inl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/stringarraylist.inl
rename to shared/src/native-lib/coreclr/src/inc/stringarraylist.inl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/strongnameholders.h b/shared/src/native-lib/coreclr/src/inc/strongnameholders.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/strongnameholders.h
rename to shared/src/native-lib/coreclr/src/inc/strongnameholders.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/strongnameinternal.h b/shared/src/native-lib/coreclr/src/inc/strongnameinternal.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/strongnameinternal.h
rename to shared/src/native-lib/coreclr/src/inc/strongnameinternal.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/switches.h b/shared/src/native-lib/coreclr/src/inc/switches.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/switches.h
rename to shared/src/native-lib/coreclr/src/inc/switches.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/thekey.h b/shared/src/native-lib/coreclr/src/inc/thekey.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/thekey.h
rename to shared/src/native-lib/coreclr/src/inc/thekey.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/tls.h b/shared/src/native-lib/coreclr/src/inc/tls.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/tls.h
rename to shared/src/native-lib/coreclr/src/inc/tls.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/unreachable.h b/shared/src/native-lib/coreclr/src/inc/unreachable.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/unreachable.h
rename to shared/src/native-lib/coreclr/src/inc/unreachable.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/utilcode.h b/shared/src/native-lib/coreclr/src/inc/utilcode.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/utilcode.h
rename to shared/src/native-lib/coreclr/src/inc/utilcode.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/utsem.h b/shared/src/native-lib/coreclr/src/inc/utsem.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/utsem.h
rename to shared/src/native-lib/coreclr/src/inc/utsem.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/volatile.h b/shared/src/native-lib/coreclr/src/inc/volatile.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/volatile.h
rename to shared/src/native-lib/coreclr/src/inc/volatile.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/vptr_list.h b/shared/src/native-lib/coreclr/src/inc/vptr_list.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/vptr_list.h
rename to shared/src/native-lib/coreclr/src/inc/vptr_list.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/win64unwind.h b/shared/src/native-lib/coreclr/src/inc/win64unwind.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/win64unwind.h
rename to shared/src/native-lib/coreclr/src/inc/win64unwind.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/winwrap.h b/shared/src/native-lib/coreclr/src/inc/winwrap.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/winwrap.h
rename to shared/src/native-lib/coreclr/src/inc/winwrap.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/xclrdata.idl b/shared/src/native-lib/coreclr/src/inc/xclrdata.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/xclrdata.idl
rename to shared/src/native-lib/coreclr/src/inc/xclrdata.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/xcordebug.idl b/shared/src/native-lib/coreclr/src/inc/xcordebug.idl
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/xcordebug.idl
rename to shared/src/native-lib/coreclr/src/inc/xcordebug.idl
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/yieldprocessornormalized.h b/shared/src/native-lib/coreclr/src/inc/yieldprocessornormalized.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/yieldprocessornormalized.h
rename to shared/src/native-lib/coreclr/src/inc/yieldprocessornormalized.h
diff --git a/profiler/src/dotnet-runtime-coreclr/inc/zapper.h b/shared/src/native-lib/coreclr/src/inc/zapper.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/inc/zapper.h
rename to shared/src/native-lib/coreclr/src/inc/zapper.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/mbusafecrt.h b/shared/src/native-lib/coreclr/src/pal/inc/mbusafecrt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/mbusafecrt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/mbusafecrt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal.h b/shared/src/native-lib/coreclr/src/pal/inc/pal.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal_assert.h b/shared/src/native-lib/coreclr/src/pal/inc/pal_assert.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal_assert.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal_assert.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal_endian.h b/shared/src/native-lib/coreclr/src/pal/inc/pal_endian.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal_endian.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal_endian.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal_error.h b/shared/src/native-lib/coreclr/src/pal/inc/pal_error.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal_error.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal_error.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal_mstypes.h b/shared/src/native-lib/coreclr/src/pal/inc/pal_mstypes.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal_mstypes.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal_mstypes.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/pal_safecrt.h b/shared/src/native-lib/coreclr/src/pal/inc/pal_safecrt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/pal_safecrt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/pal_safecrt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/palprivate.h b/shared/src/native-lib/coreclr/src/pal/inc/palprivate.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/palprivate.h
rename to shared/src/native-lib/coreclr/src/pal/inc/palprivate.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/accctrl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/accctrl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/accctrl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/accctrl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/aclapi.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/aclapi.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/aclapi.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/aclapi.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/commctrl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/commctrl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/commctrl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/commctrl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/commdlg.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/commdlg.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/commdlg.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/commdlg.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/conio.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/conio.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/conio.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/conio.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/assert.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/assert.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/assert.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/assert.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/cstdlib b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/cstdlib
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/cstdlib
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/cstdlib
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/ctype.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/ctype.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/ctype.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/ctype.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/emmintrin.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/emmintrin.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/emmintrin.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/emmintrin.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/fcntl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/fcntl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/fcntl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/fcntl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/float.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/float.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/float.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/float.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/io.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/io.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/io.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/io.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/limits.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/limits.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/limits.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/limits.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/malloc.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/malloc.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/malloc.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/malloc.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/math.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/math.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/math.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/math.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/memory.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/memory.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/memory.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/memory.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdarg.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdarg.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdarg.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdarg.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stddef.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stddef.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stddef.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stddef.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdint.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdint.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdint.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdint.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdio.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdio.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdio.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdio.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdlib.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdlib.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/stdlib.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/stdlib.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/string.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/string.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/string.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/string.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/time.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/time.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/time.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/time.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/wchar.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/wchar.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/wchar.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/wchar.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/xmmintrin.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/xmmintrin.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/cpp/xmmintrin.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/cpp/xmmintrin.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/crtdbg.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/crtdbg.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/crtdbg.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/crtdbg.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/dbghelp.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/dbghelp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/dbghelp.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/dbghelp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/eh.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/eh.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/eh.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/eh.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/errorrep.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/errorrep.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/errorrep.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/errorrep.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/guiddef.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/guiddef.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/guiddef.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/guiddef.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/hstring.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/hstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/hstring.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/hstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/htmlhelp.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/htmlhelp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/htmlhelp.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/htmlhelp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/imagehlp.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/imagehlp.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/imagehlp.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/imagehlp.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/intrin.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/intrin.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/intrin.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/intrin.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/intsafe.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/intsafe.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/intsafe.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/intsafe.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/mbstring.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/mbstring.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/mbstring.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/mbstring.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/new.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/new.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/new.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/new.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/no_sal2.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/no_sal2.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/no_sal2.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/no_sal2.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ntimage.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/ntimage.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ntimage.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/ntimage.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oaidl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/oaidl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oaidl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/oaidl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/objbase.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/objbase.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/objbase.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/objbase.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/objidl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/objidl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/objidl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/objidl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ocidl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/ocidl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ocidl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/ocidl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ole2.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/ole2.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/ole2.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/ole2.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oleauto.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/oleauto.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oleauto.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/oleauto.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/olectl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/olectl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/olectl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/olectl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oleidl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/oleidl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/oleidl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/oleidl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/palrt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/palrt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/palrt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/palrt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/poppack.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/poppack.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/poppack.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/poppack.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/process.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/process.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/process.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/process.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/psapi.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/psapi.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/psapi.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/psapi.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack1.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack1.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack1.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack1.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack2.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack2.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack2.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack2.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack4.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack4.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack4.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack4.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack8.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack8.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpack8.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/pshpack8.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpck16.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/pshpck16.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/pshpck16.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/pshpck16.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/richedit.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/richedit.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/richedit.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/richedit.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/rpc.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/rpc.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/rpc.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/rpc.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/rpcndr.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/rpcndr.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/rpcndr.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/rpcndr.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/safecrt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/safecrt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/safecrt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/safecrt.h
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/pal/inc/rt/sal.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/sal.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/coreclr/src/pal/inc/rt/sal.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/sal.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/servprov.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/servprov.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/servprov.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/servprov.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/share.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/share.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/share.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/share.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shellapi.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/shellapi.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shellapi.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/shellapi.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shlobj.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/shlobj.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shlobj.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/shlobj.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shlwapi.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/shlwapi.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/shlwapi.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/shlwapi.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_adt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_adt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_adt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_adt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_strict.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_strict.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_strict.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_strict.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_undef.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_undef.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/specstrings_undef.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/specstrings_undef.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/symcrypt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/symcrypt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/symcrypt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/symcrypt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/tchar.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/tchar.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/tchar.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/tchar.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/tlhelp32.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/tlhelp32.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/tlhelp32.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/tlhelp32.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/unknwn.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/unknwn.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/unknwn.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/unknwn.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/urlmon.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/urlmon.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/urlmon.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/urlmon.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/verrsrc.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/verrsrc.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/verrsrc.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/verrsrc.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winapifamily.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winapifamily.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winapifamily.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winapifamily.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winbase.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winbase.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winbase.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winbase.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wincrypt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/wincrypt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wincrypt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/wincrypt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/windef.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/windef.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/windef.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/windef.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/windows.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/windows.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/windows.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/windows.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winerror.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winerror.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winerror.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winerror.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wininet.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/wininet.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wininet.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/wininet.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winnls.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winnls.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winnls.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winnls.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winnt.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winnt.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winnt.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winnt.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winresrc.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winresrc.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winresrc.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winresrc.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winternl.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winternl.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winternl.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winternl.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winuser.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winuser.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winuser.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winuser.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winver.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/winver.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/winver.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/winver.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wtsapi32.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/wtsapi32.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/wtsapi32.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/wtsapi32.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/rt/x86intrin.h b/shared/src/native-lib/coreclr/src/pal/inc/rt/x86intrin.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/rt/x86intrin.h
rename to shared/src/native-lib/coreclr/src/pal/inc/rt/x86intrin.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/strsafe.h b/shared/src/native-lib/coreclr/src/pal/inc/strsafe.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/strsafe.h
rename to shared/src/native-lib/coreclr/src/pal/inc/strsafe.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacros.inc b/shared/src/native-lib/coreclr/src/pal/inc/unixasmmacros.inc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacros.inc
rename to shared/src/native-lib/coreclr/src/pal/inc/unixasmmacros.inc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosamd64.inc b/shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosamd64.inc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosamd64.inc
rename to shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosamd64.inc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosarm.inc b/shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosarm.inc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosarm.inc
rename to shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosarm.inc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosarm64.inc b/shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosarm64.inc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosarm64.inc
rename to shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosarm64.inc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosx86.inc b/shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosx86.inc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/inc/unixasmmacrosx86.inc
rename to shared/src/native-lib/coreclr/src/pal/inc/unixasmmacrosx86.inc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrdata_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrdata_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrdata_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrdata_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrinternal_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrinternal_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrinternal_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrinternal_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrprivappxhosting_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrprivappxhosting_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrprivappxhosting_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrprivappxhosting_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrprivbinding_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrprivbinding_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/clrprivbinding_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/clrprivbinding_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/cordebug_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/cordebug_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/cordebug_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/cordebug_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corprof_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corprof_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corprof_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corprof_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corpub_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corpub_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corpub_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corpub_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corsym_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corsym_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/corsym_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/corsym_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/mscorsvc_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/mscorsvc_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/mscorsvc_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/mscorsvc_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/sospriv_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/sospriv_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/sospriv_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/sospriv_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/xclrdata_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/xclrdata_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/xclrdata_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/xclrdata_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/xcordebug_i.cpp b/shared/src/native-lib/coreclr/src/pal/prebuilt/idl/xcordebug_i.cpp
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/idl/xcordebug_i.cpp
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/idl/xcordebug_i.cpp
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/CMakeLists.txt b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/CMakeLists.txt
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/CMakeLists.txt
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/CMakeLists.txt
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrdata.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrdata.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrdata.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrdata.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrinternal.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrinternal.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrinternal.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrinternal.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrprivbinding.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrprivbinding.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/clrprivbinding.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/clrprivbinding.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/cordebug.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/cordebug.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/cordebug.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/cordebug.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corerror.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corerror.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corerror.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corerror.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corprof.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corprof.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corprof.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corprof.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corpub.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corpub.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corpub.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corpub.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corsym.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corsym.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/corsym.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/corsym.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fusion.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fusion.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fusion.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fusion.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fxver.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fxver.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fxver.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fxver.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fxver.rc b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fxver.rc
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/fxver.rc
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/fxver.rc
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/metahost.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/metahost.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/metahost.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/metahost.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/mscoree.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/mscoree.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/mscoree.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/mscoree.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/mscorsvc.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/mscorsvc.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/mscorsvc.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/mscorsvc.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/readme.txt b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/readme.txt
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/readme.txt
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/readme.txt
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/sospriv.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/sospriv.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/sospriv.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/sospriv.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/xclrdata.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/xclrdata.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/xclrdata.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/xclrdata.h
diff --git a/profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/xcordebug.h b/shared/src/native-lib/coreclr/src/pal/prebuilt/inc/xcordebug.h
similarity index 100%
rename from profiler/src/dotnet-runtime-coreclr/pal/prebuilt/inc/xcordebug.h
rename to shared/src/native-lib/coreclr/src/pal/prebuilt/inc/xcordebug.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/async.h b/shared/src/native-lib/spdlog/include/spdlog/async.h
index 971becd70..bf8187dbf 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/async.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/async.h
@@ -1,8 +1,5 @@
-
-//
-// Copyright(c) 2018 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
@@ -23,6 +20,7 @@
#include
#include
+#include
namespace spdlog {
@@ -73,12 +71,18 @@ inline std::shared_ptr create_async_nb(std::string logger_name,
}
// set global thread pool.
-inline void init_thread_pool(size_t q_size, size_t thread_count)
+inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start)
{
- auto tp = std::make_shared(q_size, thread_count);
+ auto tp = std::make_shared(q_size, thread_count, on_thread_start);
details::registry::instance().set_tp(std::move(tp));
}
+// set global thread pool.
+inline void init_thread_pool(size_t q_size, size_t thread_count)
+{
+ init_thread_pool(q_size, thread_count, [] {});
+}
+
// get the global thread pool.
inline std::shared_ptr thread_pool()
{
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/async_logger-inl.h b/shared/src/native-lib/spdlog/include/spdlog/async_logger-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/async_logger-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/async_logger-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/async_logger.h b/shared/src/native-lib/spdlog/include/spdlog/async_logger.h
index a7ecb7873..9899837bf 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/async_logger.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/async_logger.h
@@ -1,31 +1,21 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
-// Very fast asynchronous logger (millions of logs per second on an average
-// desktop)
-// Uses pre allocated lockfree queue for maximum throughput even under large
-// number of threads.
+// Fast asynchronous logger.
+// Uses pre allocated queue.
// Creates a single back thread to pop messages from the queue and log them.
//
// Upon each log write the logger:
// 1. Checks if its log level is enough to log the message
// 2. Push a new copy of the message to a queue (or block the caller until
// space is available in the queue)
-// 3. will throw spdlog_ex upon log exceptions
// Upon destruction, logs all remaining messages in the queue before
// destructing..
-#include "spdlog/common.h"
#include "spdlog/logger.h"
-#include
-#include
-#include
-
namespace spdlog {
// Async overflow policy - block by default.
@@ -47,7 +37,11 @@ class async_logger final : public std::enable_shared_from_this, pu
public:
template
async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp,
- async_overflow_policy overflow_policy = async_overflow_policy::block);
+ async_overflow_policy overflow_policy = async_overflow_policy::block)
+ : logger(std::move(logger_name), begin, end)
+ , thread_pool_(std::move(tp))
+ , overflow_policy_(overflow_policy)
+ {}
async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp,
async_overflow_policy overflow_policy = async_overflow_policy::block);
@@ -70,4 +64,6 @@ class async_logger final : public std::enable_shared_from_this, pu
};
} // namespace spdlog
-#include "details/async_logger_impl.h"
+#ifdef SPDLOG_HEADER_ONLY
+#include "async_logger-inl.h"
+#endif
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/common-inl.h b/shared/src/native-lib/spdlog/include/spdlog/common-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/common-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/common-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/common.h b/shared/src/native-lib/spdlog/include/spdlog/common.h
index d078a1ab3..35941aff8 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/common.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/common.h
@@ -1,7 +1,5 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
@@ -9,21 +7,32 @@
#include
#include
-#include
#include
#include
-#include
+#include
#include
-#include
#include
-#include
+#include
-#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
-#include
-#include
+#ifdef _WIN32
+#ifndef NOMINMAX
+#define NOMINMAX // prevent windows redefining min/max
#endif
-#include "spdlog/details/null_mutex.h"
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include
+#endif //_WIN32
+
+#ifdef SPDLOG_COMPILED_LIB
+#undef SPDLOG_HEADER_ONLY
+#define SPDLOG_INLINE
+#else
+#define SPDLOG_HEADER_ONLY
+#define SPDLOG_INLINE inline
+#endif
#include "spdlog/fmt/fmt.h"
@@ -51,19 +60,6 @@
#endif
#endif
-// Get the basename of __FILE__ (at compile time if possible)
-#if FMT_HAS_FEATURE(__builtin_strrchr)
-#define SPDLOG_STRRCHR(str, sep) __builtin_strrchr(str, sep)
-#else
-#define SPDLOG_STRRCHR(str, sep) strrchr(str, sep)
-#endif //__builtin_strrchr not defined
-
-#ifdef _WIN32
-#define SPDLOG_FILE_BASENAME(file) SPDLOG_STRRCHR("\\" file, '\\') + 1
-#else
-#define SPDLOG_FILE_BASENAME(file) SPDLOG_STRRCHR("/" file, '/') + 1
-#endif
-
#ifndef SPDLOG_FUNCTION
#define SPDLOG_FUNCTION __FUNCTION__
#endif
@@ -76,17 +72,37 @@ namespace sinks {
class sink;
}
+#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
+using filename_t = std::wstring;
+#define SPDLOG_FILENAME_T(s) L##s
+#else
+using filename_t = std::string;
+#define SPDLOG_FILENAME_T(s) s
+#endif
+
using log_clock = std::chrono::system_clock;
using sink_ptr = std::shared_ptr;
using sinks_init_list = std::initializer_list;
-using log_err_handler = std::function;
+using err_handler = std::function;
-// string_view type - either std::string_view or fmt::string_view (pre c++17)
-#if defined(FMT_USE_STD_STRING_VIEW)
-using string_view_t = std::string_view;
+template
+using basic_string_view_t = fmt::basic_string_view;
+
+using string_view_t = basic_string_view_t;
+
+#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
+#ifndef _WIN32
+#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#else
-using string_view_t = fmt::string_view;
-#endif
+using wstring_view_t = basic_string_view_t;
+
+template
+struct is_convertible_to_wstring_view : std::is_convertible { };
+#endif // _WIN32
+#else
+template
+struct is_convertible_to_wstring_view : std::false_type { };
+#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
using level_t = details::null_atomic_int;
@@ -126,36 +142,31 @@ enum level_enum
}
#endif
-static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
-static const char *short_level_names[]{"T", "D", "I", "W", "E", "C", "O"};
-
-inline string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
-{
- return level_string_views[l];
-}
-
-inline const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
-{
- return short_level_names[l];
-}
+#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
-inline spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
-{
- int level = 0;
- for (const auto &level_str : level_string_views)
- {
- if (level_str == name)
- {
- return static_cast(level);
- }
- level++;
+#define SPDLOG_SHORT_LEVEL_NAMES \
+ { \
+ "T", "D", "I", "W", "E", "C", "O" \
}
- return level::off;
-}
+#endif
+
+string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
+const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
+spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
using level_hasher = std::hash;
} // namespace level
+//
+// Color mode used by sinks with color support.
+//
+enum class color_mode
+{
+ always,
+ automatic,
+ never
+};
+
//
// Pattern time - specific time getting to use for pattern_formatter.
// local time by default
@@ -172,58 +183,30 @@ enum class pattern_time_type
class spdlog_ex : public std::exception
{
public:
- explicit spdlog_ex(std::string msg)
- : msg_(std::move(msg))
- {
- }
-
- spdlog_ex(const std::string &msg, int last_errno)
- {
- fmt::memory_buffer outbuf;
- fmt::format_system_error(outbuf, last_errno, msg);
- msg_ = fmt::to_string(outbuf);
- }
-
- const char *what() const SPDLOG_NOEXCEPT override
- {
- return msg_.c_str();
- }
+ explicit spdlog_ex(std::string msg);
+ spdlog_ex(const std::string &msg, int last_errno);
+ const char *what() const SPDLOG_NOEXCEPT override;
private:
std::string msg_;
};
-//
-// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined)
-//
-#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
-using filename_t = std::wstring;
-#else
-using filename_t = std::string;
-#endif
-
struct source_loc
{
- SPDLOG_CONSTEXPR source_loc()
- : filename{""}
- , line{0}
- , funcname{""}
- {
- }
- SPDLOG_CONSTEXPR source_loc(const char *filename, int line, const char *funcname)
- : filename{filename}
- , line{static_cast(line)}
- , funcname{funcname}
- {
- }
+ SPDLOG_CONSTEXPR source_loc() = default;
+ SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)
+ : filename{filename_in}
+ , line{line_in}
+ , funcname{funcname_in}
+ {}
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
{
return line == 0;
}
- const char *filename;
- uint32_t line;
- const char *funcname;
+ const char *filename{nullptr};
+ int line{0};
+ const char *funcname{nullptr};
};
namespace details {
@@ -240,4 +223,9 @@ std::unique_ptr make_unique(Args &&... args)
}
#endif
} // namespace details
+
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "common-inl.h"
+#endif
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/circular_q.h b/shared/src/native-lib/spdlog/include/spdlog/details/circular_q.h
index b01325bb7..4db554c0a 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/circular_q.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/circular_q.h
@@ -1,7 +1,5 @@
-//
-// Copyright(c) 2018 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
// cirucal q view of std::vector.
#pragma once
@@ -19,8 +17,7 @@ class circular_q
explicit circular_q(size_t max_items)
: max_items_(max_items + 1) // one item is reserved as marker for full q
, v_(max_items_)
- {
- }
+ {}
// push back, overrun (oldest) item if no room left
void push_back(T &&item)
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/console_globals.h b/shared/src/native-lib/spdlog/include/spdlog/details/console_globals.h
index e2afb6bf0..6761a30d0 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/console_globals.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/console_globals.h
@@ -1,55 +1,13 @@
-#pragma once
-//
-// Copyright(c) 2018 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
+
+#pragma once
#include "spdlog/details/null_mutex.h"
-#include
#include
-#ifdef _WIN32
-
-#ifndef NOMINMAX
-#define NOMINMAX // prevent windows redefining min/max
-#endif
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include
-#endif
-
namespace spdlog {
namespace details {
-struct console_stdout
-{
- static std::FILE *stream()
- {
- return stdout;
- }
-#ifdef _WIN32
- static HANDLE handle()
- {
- return ::GetStdHandle(STD_OUTPUT_HANDLE);
- }
-#endif
-};
-
-struct console_stderr
-{
- static std::FILE *stream()
- {
- return stderr;
- }
-#ifdef _WIN32
- static HANDLE handle()
- {
- return ::GetStdHandle(STD_ERROR_HANDLE);
- }
-#endif
-};
struct console_mutex
{
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/file_helper-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/file_helper-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/file_helper-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/file_helper-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/file_helper.h b/shared/src/native-lib/spdlog/include/spdlog/details/file_helper.h
index 8c1132d9c..6fdecd06b 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/file_helper.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/file_helper.h
@@ -1,113 +1,35 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
-// Helper class for file sinks.
-// When failing to open a file, retry several times(5) with a delay interval(10 ms).
-// Throw spdlog_ex exception on errors.
-
-#include "spdlog/details/log_msg.h"
-#include "spdlog/details/os.h"
-
-#include
-#include
-#include
-#include
-#include
+#include "spdlog/common.h"
#include
namespace spdlog {
namespace details {
+// Helper class for file sinks.
+// When failing to open a file, retry several times(5) with a delay interval(10 ms).
+// Throw spdlog_ex exception on errors.
+
class file_helper
{
-
public:
- const int open_tries = 5;
- const int open_interval = 10;
-
explicit file_helper() = default;
file_helper(const file_helper &) = delete;
file_helper &operator=(const file_helper &) = delete;
+ ~file_helper();
- ~file_helper()
- {
- close();
- }
-
- void open(const filename_t &fname, bool truncate = false)
- {
- close();
- auto *mode = truncate ? SPDLOG_FILENAME_T("wb") : SPDLOG_FILENAME_T("ab");
- _filename = fname;
- for (int tries = 0; tries < open_tries; ++tries)
- {
- if (!os::fopen_s(&fd_, fname, mode))
- {
- return;
- }
-
- details::os::sleep_for_millis(open_interval);
- }
-
- throw spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno);
- }
-
- void reopen(bool truncate)
- {
- if (_filename.empty())
- {
- throw spdlog_ex("Failed re opening file - was not opened before");
- }
- open(_filename, truncate);
- }
-
- void flush()
- {
- std::fflush(fd_);
- }
-
- void close()
- {
- if (fd_ != nullptr)
- {
- std::fclose(fd_);
- fd_ = nullptr;
- }
- }
-
- void write(const fmt::memory_buffer &buf)
- {
- size_t msg_size = buf.size();
- auto data = buf.data();
- if (std::fwrite(data, 1, msg_size, fd_) != msg_size)
- {
- throw spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno);
- }
- }
-
- size_t size() const
- {
- if (fd_ == nullptr)
- {
- throw spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename));
- }
- return os::filesize(fd_);
- }
-
- const filename_t &filename() const
- {
- return _filename;
- }
-
- static bool file_exists(const filename_t &fname)
- {
- return os::file_exists(fname);
- }
+ void open(const filename_t &fname, bool truncate = false);
+ void reopen(bool truncate);
+ void flush();
+ void close();
+ void write(const fmt::memory_buffer &buf);
+ size_t size() const;
+ const filename_t &filename() const;
+ static bool file_exists(const filename_t &fname);
//
// return file path and its extension:
@@ -122,31 +44,17 @@ class file_helper
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
- static std::tuple split_by_extension(const spdlog::filename_t &fname)
- {
- auto ext_index = fname.rfind('.');
-
- // no valid extension found - return whole path and empty string as
- // extension
- if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1)
- {
- return std::make_tuple(fname, spdlog::filename_t());
- }
-
- // treat casese like "/etc/rc.d/somelogfile or "/abc/.hiddenfile"
- auto folder_index = fname.rfind(details::os::folder_sep);
- if (folder_index != filename_t::npos && folder_index >= ext_index - 1)
- {
- return std::make_tuple(fname, spdlog::filename_t());
- }
-
- // finally - return a valid base and extension tuple
- return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index));
- }
+ static std::tuple split_by_extension(const filename_t &fname);
private:
+ const int open_tries = 5;
+ const int open_interval = 10;
std::FILE *fd_{nullptr};
filename_t _filename;
};
} // namespace details
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "file_helper-inl.h"
+#endif
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/fmt_helper.h b/shared/src/native-lib/spdlog/include/spdlog/details/fmt_helper.h
index d76aac452..67494ed5c 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/fmt_helper.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/fmt_helper.h
@@ -1,12 +1,11 @@
-//
-// Created by gabi on 6/15/18.
-//
-
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
+// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include
#include
#include "spdlog/fmt/fmt.h"
+#include "spdlog/common.h"
// Some fmt helpers to efficiently format and pad ints and strings
namespace spdlog {
@@ -108,7 +107,7 @@ inline void pad9(T n, fmt::basic_memory_buffer &dest)
// e.g.
// fraction(tp) -> will return the millis part of the second
template
-inline ToDuration time_fraction(const log_clock::time_point &tp)
+inline ToDuration time_fraction(log_clock::time_point tp)
{
using std::chrono::duration_cast;
using std::chrono::seconds;
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/log_msg-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/log_msg-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/log_msg-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/log_msg-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/log_msg.h b/shared/src/native-lib/spdlog/include/spdlog/details/log_msg.h
index 69422ba37..f2976df8f 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/log_msg.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/log_msg.h
@@ -1,48 +1,23 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
#include "spdlog/common.h"
-#include "spdlog/details/os.h"
-
#include
-#include
namespace spdlog {
namespace details {
struct log_msg
{
-
- log_msg(source_loc loc, const std::string *loggers_name, level::level_enum lvl, string_view_t view)
- : logger_name(loggers_name)
- , level(lvl)
-#ifndef SPDLOG_NO_DATETIME
- , time(os::now())
-#endif
-
-#ifndef SPDLOG_NO_THREAD_ID
- , thread_id(os::thread_id())
-#endif
- , source(loc)
- , payload(view)
- {
- }
-
- log_msg(const std::string *loggers_name, level::level_enum lvl, string_view_t view)
- : log_msg(source_loc{}, loggers_name, lvl, view)
- {
- }
-
+ log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);
+ log_msg(string_view_t logger_name, level::level_enum lvl, string_view_t msg);
log_msg(const log_msg &other) = default;
- const std::string *logger_name{nullptr};
+ const string_view_t logger_name;
level::level_enum level{level::off};
log_clock::time_point time;
size_t thread_id{0};
- size_t msg_id{0};
// wrapping the formatted text with color (updated by pattern_formatter).
mutable size_t color_range_start{0};
@@ -53,3 +28,7 @@ struct log_msg
};
} // namespace details
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "log_msg-inl.h"
+#endif
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/mpmc_blocking_q.h b/shared/src/native-lib/spdlog/include/spdlog/details/mpmc_blocking_q.h
index ca789fc66..d8a1efe2e 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/mpmc_blocking_q.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/mpmc_blocking_q.h
@@ -1,9 +1,7 @@
-#pragma once
-
-//
-// Copyright(c) 2018 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
+
+#pragma once
// multi producer-multi consumer blocking queue.
// enqueue(..) - will block until room found to put the new message.
@@ -27,8 +25,7 @@ class mpmc_blocking_queue
using item_type = T;
explicit mpmc_blocking_queue(size_t max_items)
: q_(max_items)
- {
- }
+ {}
#ifndef __MINGW32__
// try to enqueue and block if no room left
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/null_mutex.h b/shared/src/native-lib/spdlog/include/spdlog/details/null_mutex.h
index 3f495bd98..d1062db7d 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/null_mutex.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/null_mutex.h
@@ -1,7 +1,5 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
@@ -27,8 +25,7 @@ struct null_atomic_int
explicit null_atomic_int(int val)
: value(val)
- {
- }
+ {}
int load(std::memory_order) const
{
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/os-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/os-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/os-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/os-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/os.h b/shared/src/native-lib/spdlog/include/spdlog/details/os.h
index 646805e60..276944945 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/os.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/os.h
@@ -1,112 +1,24 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
-#pragma once
-
-#include "../common.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifdef _WIN32
-
-#ifndef NOMINMAX
-#define NOMINMAX // prevent windows redefining min/max
-#endif
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include // _get_osfhandle and _isatty support
-#include // _get_pid support
-#include
-
-#ifdef __MINGW32__
-#include
-#endif
-
-#else // unix
-#include
-#include
-
-#ifdef __linux__
-#include //Use gettid() syscall under linux to get thread id
-
-#elif __FreeBSD__
-#include //Use thr_self() syscall under FreeBSD to get thread id
-#endif
-
-#endif // unix
+#pragma once
-#ifndef __has_feature // Clang - feature checking macros.
-#define __has_feature(x) 0 // Compatibility with non-clang compilers.
-#endif
+#include "spdlog/common.h"
+#include // std::time_t
namespace spdlog {
namespace details {
namespace os {
-inline spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT
-{
+spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT;
-#if defined __linux__ && defined SPDLOG_CLOCK_COARSE
- timespec ts;
- ::clock_gettime(CLOCK_REALTIME_COARSE, &ts);
- return std::chrono::time_point(
- std::chrono::duration_cast(std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec)));
+std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
-#else
- return log_clock::now();
-#endif
-}
-inline std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
-{
-
-#ifdef _WIN32
- std::tm tm;
- localtime_s(&tm, &time_tt);
-#else
- std::tm tm;
- localtime_r(&time_tt, &tm);
-#endif
- return tm;
-}
+std::tm localtime() SPDLOG_NOEXCEPT;
-inline std::tm localtime() SPDLOG_NOEXCEPT
-{
- std::time_t now_t = time(nullptr);
- return localtime(now_t);
-}
+std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
-inline std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
-{
-
-#ifdef _WIN32
- std::tm tm;
- gmtime_s(&tm, &time_tt);
-#else
- std::tm tm;
- gmtime_r(&time_tt, &tm);
-#endif
- return tm;
-}
-
-inline std::tm gmtime() SPDLOG_NOEXCEPT
-{
- std::time_t now_t = time(nullptr);
- return gmtime(now_t);
-}
+std::tm gmtime() SPDLOG_NOEXCEPT;
// eol definition
#if !defined(SPDLOG_EOL)
@@ -121,301 +33,61 @@ SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
// folder separator
#ifdef _WIN32
-SPDLOG_CONSTEXPR static const char folder_sep = '\\';
+const char folder_sep = '\\';
#else
SPDLOG_CONSTEXPR static const char folder_sep = '/';
#endif
-inline void prevent_child_fd(FILE *f)
-{
-
-#ifdef _WIN32
-#if !defined(__cplusplus_winrt)
- auto file_handle = (HANDLE)_get_osfhandle(_fileno(f));
- if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0))
- throw spdlog_ex("SetHandleInformation failed", errno);
-#endif
-#else
- auto fd = fileno(f);
- if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
- {
- throw spdlog_ex("fcntl with FD_CLOEXEC failed", errno);
- }
-#endif
-}
+void prevent_child_fd(FILE *f);
// fopen_s on non windows for writing
-inline bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode)
-{
-#ifdef _WIN32
-#ifdef SPDLOG_WCHAR_FILENAMES
- *fp = _wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
-#else
- *fp = _fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
-#endif
-#else // unix
- *fp = fopen((filename.c_str()), mode.c_str());
-#endif
+bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode);
-#ifdef SPDLOG_PREVENT_CHILD_FD
- if (*fp != nullptr)
- {
- prevent_child_fd(*fp);
- }
-#endif
- return *fp == nullptr;
-}
+int remove(const filename_t &filename) SPDLOG_NOEXCEPT;
-inline int remove(const filename_t &filename) SPDLOG_NOEXCEPT
-{
-#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
- return _wremove(filename.c_str());
-#else
- return std::remove(filename.c_str());
-#endif
-}
-
-inline int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT
-{
-#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
- return _wrename(filename1.c_str(), filename2.c_str());
-#else
- return std::rename(filename1.c_str(), filename2.c_str());
-#endif
-}
+int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT;
// Return if file exists
-inline bool file_exists(const filename_t &filename) SPDLOG_NOEXCEPT
-{
-#ifdef _WIN32
-#ifdef SPDLOG_WCHAR_FILENAMES
- auto attribs = GetFileAttributesW(filename.c_str());
-#else
- auto attribs = GetFileAttributesA(filename.c_str());
-#endif
- return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY));
-#else // common linux/unix all have the stat system call
- struct stat buffer;
- return (stat(filename.c_str(), &buffer) == 0);
-#endif
-}
+bool file_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
// Return file size according to open FILE* object
-inline size_t filesize(FILE *f)
-{
- if (f == nullptr)
- {
- throw spdlog_ex("Failed getting file size. fd is null");
- }
-#if defined(_WIN32) && !defined(__CYGWIN__)
- int fd = _fileno(f);
-#if _WIN64 // 64 bits
- __int64 ret = _filelengthi64(fd);
- if (ret >= 0)
- {
- return static_cast(ret);
- }
-
-#else // windows 32 bits
- long ret = _filelength(fd);
- if (ret >= 0)
- {
- return static_cast(ret);
- }
-#endif
-
-#else // unix
- int fd = fileno(f);
-// 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
-#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) && !defined(__CYGWIN__)
- struct stat64 st;
- if (fstat64(fd, &st) == 0)
- {
- return static_cast(st.st_size);
- }
-#else // unix 32 bits or cygwin
- struct stat st;
-
- if (fstat(fd, &st) == 0)
- {
- return static_cast(st.st_size);
- }
-#endif
-#endif
- throw spdlog_ex("Failed getting file size from fd", errno);
-}
+size_t filesize(FILE *f);
// Return utc offset in minutes or throw spdlog_ex on failure
-inline int utc_minutes_offset(const std::tm &tm = details::os::localtime())
-{
-
-#ifdef _WIN32
-#if _WIN32_WINNT < _WIN32_WINNT_WS08
- TIME_ZONE_INFORMATION tzinfo;
- auto rv = GetTimeZoneInformation(&tzinfo);
-#else
- DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
- auto rv = GetDynamicTimeZoneInformation(&tzinfo);
-#endif
- if (rv == TIME_ZONE_ID_INVALID)
- throw spdlog::spdlog_ex("Failed getting timezone info. ", errno);
-
- int offset = -tzinfo.Bias;
- if (tm.tm_isdst)
- {
- offset -= tzinfo.DaylightBias;
- }
- else
- {
- offset -= tzinfo.StandardBias;
- }
- return offset;
-#else
-
-#if defined(sun) || defined(__sun) || defined(_AIX)
- // 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
- struct helper
- {
- static long int calculate_gmt_offset(const std::tm &localtm = details::os::localtime(), const std::tm &gmtm = details::os::gmtime())
- {
- int local_year = localtm.tm_year + (1900 - 1);
- int gmt_year = gmtm.tm_year + (1900 - 1);
-
- long int days = (
- // difference in day of year
- localtm.tm_yday -
- gmtm.tm_yday
-
- // + intervening leap days
- + ((local_year >> 2) - (gmt_year >> 2)) - (local_year / 100 - gmt_year / 100) +
- ((local_year / 100 >> 2) - (gmt_year / 100 >> 2))
-
- // + difference in years * 365 */
- + (long int)(local_year - gmt_year) * 365);
-
- long int hours = (24 * days) + (localtm.tm_hour - gmtm.tm_hour);
- long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min);
- long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec);
-
- return secs;
- }
- };
-
- auto offset_seconds = helper::calculate_gmt_offset(tm);
-#else
- auto offset_seconds = tm.tm_gmtoff;
-#endif
-
- return static_cast(offset_seconds / 60);
-#endif
-}
+int utc_minutes_offset(const std::tm &tm = details::os::localtime());
// Return current thread id as size_t
// It exists because the std::this_thread::get_id() is much slower(especially
// under VS 2013)
-inline size_t _thread_id() SPDLOG_NOEXCEPT
-{
-#ifdef _WIN32
- return static_cast(::GetCurrentThreadId());
-#elif __linux__
-#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
-#define SYS_gettid __NR_gettid
-#endif
- return static_cast(syscall(SYS_gettid));
-#elif __FreeBSD__
- long tid;
- thr_self(&tid);
- return static_cast(tid);
-#elif __APPLE__
- uint64_t tid;
- pthread_threadid_np(nullptr, &tid);
- return static_cast(tid);
-#else // Default to standard C++11 (other Unix)
- return static_cast(std::hash()(std::this_thread::get_id()));
-#endif
-}
+size_t _thread_id() SPDLOG_NOEXCEPT;
// Return current thread id as size_t (from thread local storage)
-inline size_t thread_id() SPDLOG_NOEXCEPT
-{
-#if defined(SPDLOG_NO_TLS)
- return _thread_id();
-#else // cache thread id in tls
- static thread_local const size_t tid = _thread_id();
- return tid;
-#endif
-}
+size_t thread_id() SPDLOG_NOEXCEPT;
// This is avoid msvc issue in sleep_for that happens if the clock changes.
// See https://github.com/gabime/spdlog/issues/609
-inline void sleep_for_millis(int milliseconds) SPDLOG_NOEXCEPT
-{
-#if defined(_WIN32)
- ::Sleep(milliseconds);
-#else
- std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
-#endif
-}
+void sleep_for_millis(int milliseconds) SPDLOG_NOEXCEPT;
-// wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined)
-#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
-#define SPDLOG_FILENAME_T(s) L##s
-inline std::string filename_to_str(const filename_t &filename)
-{
- std::wstring_convert, wchar_t> c;
- return c.to_bytes(filename);
-}
-#else
-#define SPDLOG_FILENAME_T(s) s
-inline std::string filename_to_str(const filename_t &filename)
-{
- return filename;
-}
-#endif
+std::string filename_to_str(const filename_t &filename);
-inline int pid()
-{
-
-#ifdef _WIN32
- return static_cast(::GetCurrentProcessId());
-#else
- return static_cast(::getpid());
-#endif
-}
+int pid() SPDLOG_NOEXCEPT;
// Determine if the terminal supports colors
// Source: https://github.com/agauniyal/rang/
-inline bool is_color_terminal() SPDLOG_NOEXCEPT
-{
-#ifdef _WIN32
- return true;
-#else
- static constexpr const char *Terms[] = {
- "ansi", "color", "console", "cygwin", "gnome", "konsole", "kterm", "linux", "msys", "putty", "rxvt", "screen", "vt100", "xterm"};
-
- const char *env_p = std::getenv("TERM");
- if (env_p == nullptr)
- {
- return false;
- }
-
- static const bool result =
- std::any_of(std::begin(Terms), std::end(Terms), [&](const char *term) { return std::strstr(env_p, term) != nullptr; });
- return result;
-#endif
-}
+bool is_color_terminal() SPDLOG_NOEXCEPT;
// Detrmine if the terminal attached
// Source: https://github.com/agauniyal/rang/
-inline bool in_terminal(FILE *file) SPDLOG_NOEXCEPT
-{
+bool in_terminal(FILE *file) SPDLOG_NOEXCEPT;
-#ifdef _WIN32
- return _isatty(_fileno(file)) != 0;
-#else
- return isatty(fileno(file)) != 0;
+#if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32)
+void wstr_to_utf8buf(basic_string_view_t wstr, fmt::memory_buffer &target);
#endif
-}
+
} // namespace os
} // namespace details
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "os-inl.h"
+#endif
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/pattern_formatter-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/pattern_formatter-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter.h b/shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter.h
index c0ad86e8e..1fcaf394a 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/pattern_formatter.h
@@ -1,25 +1,18 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
-#include "spdlog/details/fmt_helper.h"
+#include "spdlog/common.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/details/os.h"
-#include "spdlog/fmt/fmt.h"
#include "spdlog/formatter.h"
-#include
#include
#include
-#include
#include
-#include
+
#include
-#include
-#include
#include
namespace spdlog {
@@ -39,8 +32,7 @@ struct padding_info
padding_info(size_t width, padding_info::pad_side side)
: width_(width)
, side_(side)
- {
- }
+ {}
bool enabled() const
{
@@ -50,71 +42,12 @@ struct padding_info
const pad_side side_ = left;
};
-class scoped_pad
-{
-public:
- scoped_pad(size_t wrapped_size, padding_info &padinfo, fmt::memory_buffer &dest)
- : padinfo_(padinfo)
- , dest_(dest)
- {
-
- if (padinfo_.width_ <= wrapped_size)
- {
- total_pad_ = 0;
- return;
- }
-
- total_pad_ = padinfo.width_ - wrapped_size;
- if (padinfo_.side_ == padding_info::left)
- {
- pad_it(total_pad_);
- total_pad_ = 0;
- }
- else if (padinfo_.side_ == padding_info::center)
- {
- auto half_pad = total_pad_ / 2;
- auto reminder = total_pad_ & 1;
- pad_it(half_pad);
- total_pad_ = half_pad + reminder; // for the right side
- }
- }
-
- scoped_pad(spdlog::string_view_t txt, padding_info &padinfo, fmt::memory_buffer &dest)
- : scoped_pad(txt.size(), padinfo, dest)
- {
- }
-
- ~scoped_pad()
- {
- if (total_pad_)
- {
- pad_it(total_pad_);
- }
- }
-
-private:
- void pad_it(size_t count)
- {
- // count = std::min(count, spaces_.size());
- assert(count <= spaces_.size());
- fmt_helper::append_string_view(string_view_t(spaces_.data(), count), dest_);
- }
-
- const padding_info &padinfo_;
- fmt::memory_buffer &dest_;
- size_t total_pad_;
- string_view_t spaces_{" "
- " ",
- 128};
-};
-
class flag_formatter
{
public:
explicit flag_formatter(padding_info padinfo)
: padinfo_(padinfo)
- {
- }
+ {}
flag_formatter() = default;
virtual ~flag_formatter() = default;
virtual void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) = 0;
@@ -123,944 +56,22 @@ class flag_formatter
padding_info padinfo_;
};
-///////////////////////////////////////////////////////////////////////
-// name & level pattern appender
-///////////////////////////////////////////////////////////////////////
-class name_formatter : public flag_formatter
-{
-public:
- explicit name_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (padinfo_.enabled())
- {
- scoped_pad p(*msg.logger_name, padinfo_, dest);
- fmt_helper::append_string_view(*msg.logger_name, dest);
- }
- else
- {
- fmt_helper::append_string_view(*msg.logger_name, dest);
- }
- }
-};
-
-// log level appender
-class level_formatter : public flag_formatter
-{
-public:
- explicit level_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- string_view_t &level_name = level::to_string_view(msg.level);
- if (padinfo_.enabled())
- {
- scoped_pad p(level_name, padinfo_, dest);
- fmt_helper::append_string_view(level_name, dest);
- }
- else
- {
- fmt_helper::append_string_view(level_name, dest);
- }
- }
-};
-
-// short log level appender
-class short_level_formatter : public flag_formatter
-{
-public:
- explicit short_level_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- string_view_t level_name{level::to_short_c_str(msg.level)};
- scoped_pad p(level_name, padinfo_, dest);
- fmt_helper::append_string_view(level_name, dest);
- }
-};
-
-///////////////////////////////////////////////////////////////////////
-// Date time pattern appenders
-///////////////////////////////////////////////////////////////////////
-
-static const char *ampm(const tm &t)
-{
- return t.tm_hour >= 12 ? "PM" : "AM";
-}
-
-static int to12h(const tm &t)
-{
- return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour;
-}
-
-// Abbreviated weekday name
-static const char *days[]{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-class a_formatter : public flag_formatter
-{
-public:
- explicit a_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- string_view_t field_value{days[tm_time.tm_wday]};
- scoped_pad p(field_value, padinfo_, dest);
- fmt_helper::append_string_view(field_value, dest);
- }
-};
-
-// Full weekday name
-static const char *full_days[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
-class A_formatter : public flag_formatter
-{
-public:
- explicit A_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- string_view_t field_value{full_days[tm_time.tm_wday]};
- scoped_pad p(field_value, padinfo_, dest);
- fmt_helper::append_string_view(field_value, dest);
- }
-};
-
-// Abbreviated month
-static const char *months[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"};
-class b_formatter : public flag_formatter
-{
-public:
- explicit b_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- string_view_t field_value{months[tm_time.tm_mon]};
- scoped_pad p(field_value, padinfo_, dest);
- fmt_helper::append_string_view(field_value, dest);
- }
-};
-
-// Full month name
-static const char *full_months[]{
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
-class B_formatter : public flag_formatter
-{
-public:
- explicit B_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- string_view_t field_value{full_months[tm_time.tm_mon]};
- scoped_pad p(field_value, padinfo_, dest);
- fmt_helper::append_string_view(field_value, dest);
- }
-};
-
-// Date and time representation (Thu Aug 23 15:35:46 2014)
-class c_formatter final : public flag_formatter
-{
-public:
- explicit c_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 24;
- scoped_pad p(field_size, padinfo_, dest);
-
- fmt_helper::append_string_view(days[tm_time.tm_wday], dest);
- dest.push_back(' ');
- fmt_helper::append_string_view(months[tm_time.tm_mon], dest);
- dest.push_back(' ');
- fmt_helper::append_int(tm_time.tm_mday, dest);
- dest.push_back(' ');
- // time
-
- fmt_helper::pad2(tm_time.tm_hour, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_min, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_sec, dest);
- dest.push_back(' ');
- fmt_helper::append_int(tm_time.tm_year + 1900, dest);
- }
-};
-
-// year - 2 digit
-class C_formatter final : public flag_formatter
-{
-public:
- explicit C_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_year % 100, dest);
- }
-};
-
-// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01
-class D_formatter final : public flag_formatter
-{
-public:
- explicit D_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 10;
- scoped_pad p(field_size, padinfo_, dest);
-
- fmt_helper::pad2(tm_time.tm_mon + 1, dest);
- dest.push_back('/');
- fmt_helper::pad2(tm_time.tm_mday, dest);
- dest.push_back('/');
- fmt_helper::pad2(tm_time.tm_year % 100, dest);
- }
-};
-
-// year - 4 digit
-class Y_formatter final : public flag_formatter
-{
-public:
- explicit Y_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 4;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::append_int(tm_time.tm_year + 1900, dest);
- }
-};
-
-// month 1-12
-class m_formatter final : public flag_formatter
-{
-public:
- explicit m_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_mon + 1, dest);
- }
-};
-
-// day of month 1-31
-class d_formatter final : public flag_formatter
-{
-public:
- explicit d_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_mday, dest);
- }
-};
-
-// hours in 24 format 0-23
-class H_formatter final : public flag_formatter
-{
-public:
- explicit H_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_hour, dest);
- }
-};
-
-// hours in 12 format 1-12
-class I_formatter final : public flag_formatter
-{
-public:
- explicit I_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(to12h(tm_time), dest);
- }
-};
-
-// minutes 0-59
-class M_formatter final : public flag_formatter
-{
-public:
- explicit M_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_min, dest);
- }
-};
-
-// seconds 0-59
-class S_formatter final : public flag_formatter
-{
-public:
- explicit S_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad2(tm_time.tm_sec, dest);
- }
-};
-
-// milliseconds
-class e_formatter final : public flag_formatter
-{
-public:
- explicit e_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- auto millis = fmt_helper::time_fraction(msg.time);
- if (padinfo_.enabled())
- {
- const size_t field_size = 3;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad3(static_cast(millis.count()), dest);
- }
- else
- {
- fmt_helper::pad3(static_cast(millis.count()), dest);
- }
- }
-};
-
-// microseconds
-class f_formatter final : public flag_formatter
-{
-public:
- explicit f_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- auto micros = fmt_helper::time_fraction(msg.time);
- if (padinfo_.enabled())
- {
- const size_t field_size = 6;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad6(static_cast(micros.count()), dest);
- }
- else
- {
- fmt_helper::pad6(static_cast(micros.count()), dest);
- }
- }
-};
-
-// nanoseconds
-class F_formatter final : public flag_formatter
-{
-public:
- explicit F_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- auto ns = fmt_helper::time_fraction(msg.time);
- if (padinfo_.enabled())
- {
- const size_t field_size = 9;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad9(static_cast(ns.count()), dest);
- }
- else
- {
- fmt_helper::pad9(static_cast(ns.count()), dest);
- }
- }
-};
-
-// seconds since epoch
-class E_formatter final : public flag_formatter
-{
-public:
- explicit E_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 10;
- scoped_pad p(field_size, padinfo_, dest);
- auto duration = msg.time.time_since_epoch();
- auto seconds = std::chrono::duration_cast(duration).count();
- fmt_helper::append_int(seconds, dest);
- }
-};
-
-// AM/PM
-class p_formatter final : public flag_formatter
-{
-public:
- explicit p_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 2;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::append_string_view(ampm(tm_time), dest);
- }
-};
-
-// 12 hour clock 02:55:02 pm
-class r_formatter final : public flag_formatter
-{
-public:
- explicit r_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 11;
- scoped_pad p(field_size, padinfo_, dest);
-
- fmt_helper::pad2(to12h(tm_time), dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_min, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_sec, dest);
- dest.push_back(' ');
- fmt_helper::append_string_view(ampm(tm_time), dest);
- }
-};
-
-// 24-hour HH:MM time, equivalent to %H:%M
-class R_formatter final : public flag_formatter
-{
-public:
- explicit R_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 5;
- scoped_pad p(field_size, padinfo_, dest);
-
- fmt_helper::pad2(tm_time.tm_hour, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_min, dest);
- }
-};
-
-// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S
-class T_formatter final : public flag_formatter
-{
-public:
- explicit T_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 8;
- scoped_pad p(field_size, padinfo_, dest);
-
- fmt_helper::pad2(tm_time.tm_hour, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_min, dest);
- dest.push_back(':');
- fmt_helper::pad2(tm_time.tm_sec, dest);
- }
-};
-
-// ISO 8601 offset from UTC in timezone (+-HH:MM)
-class z_formatter final : public flag_formatter
-{
-public:
- explicit z_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- const std::chrono::seconds cache_refresh = std::chrono::seconds(5);
-
- z_formatter() = default;
- z_formatter(const z_formatter &) = delete;
- z_formatter &operator=(const z_formatter &) = delete;
-
- void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 6;
- scoped_pad p(field_size, padinfo_, dest);
-
-#ifdef _WIN32
- int total_minutes = get_cached_offset(msg, tm_time);
-#else
- // No need to chache under gcc,
- // it is very fast (already stored in tm.tm_gmtoff)
- (void)(msg);
- int total_minutes = os::utc_minutes_offset(tm_time);
-#endif
- bool is_negative = total_minutes < 0;
- if (is_negative)
- {
- total_minutes = -total_minutes;
- dest.push_back('-');
- }
- else
- {
- dest.push_back('+');
- }
-
- fmt_helper::pad2(total_minutes / 60, dest); // hours
- dest.push_back(':');
- fmt_helper::pad2(total_minutes % 60, dest); // minutes
- }
-
-private:
- log_clock::time_point last_update_{std::chrono::seconds(0)};
-#ifdef _WIN32
- int offset_minutes_{0};
-
- int get_cached_offset(const log_msg &msg, const std::tm &tm_time)
- {
- if (msg.time - last_update_ >= cache_refresh)
- {
- offset_minutes_ = os::utc_minutes_offset(tm_time);
- last_update_ = msg.time;
- }
- return offset_minutes_;
- }
-#endif
-};
-
-// Thread id
-class t_formatter final : public flag_formatter
-{
-public:
- explicit t_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (padinfo_.enabled())
- {
- const auto field_size = fmt_helper::count_digits(msg.thread_id);
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::append_int(msg.thread_id, dest);
- }
- else
- {
- fmt_helper::append_int(msg.thread_id, dest);
- }
- }
-};
-
-// Current pid
-class pid_formatter final : public flag_formatter
-{
-public:
- explicit pid_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &, const std::tm &, fmt::memory_buffer &dest) override
- {
- const auto pid = static_cast(details::os::pid());
- if (padinfo_.enabled())
- {
- auto field_size = fmt_helper::count_digits(pid);
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::append_int(pid, dest);
- }
- else
- {
- fmt_helper::append_int(pid, dest);
- }
- }
-};
-
-// message counter formatter
-class i_formatter final : public flag_formatter
-{
-public:
- explicit i_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 6;
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::pad6(msg.msg_id, dest);
- }
-};
-
-class v_formatter final : public flag_formatter
-{
-public:
- explicit v_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (padinfo_.enabled())
- {
- scoped_pad p(msg.payload, padinfo_, dest);
- fmt_helper::append_string_view(msg.payload, dest);
- }
- else
- {
- fmt_helper::append_string_view(msg.payload, dest);
- }
- }
-};
-
-class ch_formatter final : public flag_formatter
-{
-public:
- explicit ch_formatter(char ch)
- : ch_(ch)
- {
- }
-
- void format(const details::log_msg &, const std::tm &, fmt::memory_buffer &dest) override
- {
- const size_t field_size = 1;
- scoped_pad p(field_size, padinfo_, dest);
- dest.push_back(ch_);
- }
-
-private:
- char ch_;
-};
-
-// aggregate user chars to display as is
-class aggregate_formatter final : public flag_formatter
-{
-public:
- aggregate_formatter() = default;
-
- void add_ch(char ch)
- {
- str_ += ch;
- }
- void format(const details::log_msg &, const std::tm &, fmt::memory_buffer &dest) override
- {
- fmt_helper::append_string_view(str_, dest);
- }
-
-private:
- std::string str_;
-};
-
-// mark the color range. expect it to be in the form of "%^colored text%$"
-class color_start_formatter final : public flag_formatter
-{
-public:
- explicit color_start_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- msg.color_range_start = dest.size();
- }
-};
-class color_stop_formatter final : public flag_formatter
-{
-public:
- explicit color_stop_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- msg.color_range_end = dest.size();
- }
-};
-
-// print source location
-class source_location_formatter final : public flag_formatter
-{
-public:
- explicit source_location_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (msg.source.empty())
- {
- return;
- }
- if (padinfo_.enabled())
- {
- const auto text_size = std::char_traits::length(msg.source.filename) + fmt_helper::count_digits(msg.source.line) + 1;
- scoped_pad p(text_size, padinfo_, dest);
- fmt_helper::append_string_view(msg.source.filename, dest);
- dest.push_back(':');
- fmt_helper::append_int(msg.source.line, dest);
- }
- else
- {
- fmt_helper::append_string_view(msg.source.filename, dest);
- dest.push_back(':');
- fmt_helper::append_int(msg.source.line, dest);
- }
- }
-};
-// print source filename
-class source_filename_formatter final : public flag_formatter
-{
-public:
- explicit source_filename_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (msg.source.empty())
- {
- return;
- }
- scoped_pad p(msg.source.filename, padinfo_, dest);
- fmt_helper::append_string_view(msg.source.filename, dest);
- }
-};
-
-class source_linenum_formatter final : public flag_formatter
-{
-public:
- explicit source_linenum_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (msg.source.empty())
- {
- return;
- }
- if (padinfo_.enabled())
- {
- auto field_size = fmt_helper::count_digits(msg.source.line);
- scoped_pad p(field_size, padinfo_, dest);
- fmt_helper::append_int(msg.source.line, dest);
- }
- else
- {
- fmt_helper::append_int(msg.source.line, dest);
- }
- }
-};
-// print source funcname
-class source_funcname_formatter final : public flag_formatter
-{
-public:
- explicit source_funcname_formatter(padding_info padinfo)
- : flag_formatter(padinfo){};
-
- void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
- {
- if (msg.source.empty())
- {
- return;
- }
- scoped_pad p(msg.source.funcname, padinfo_, dest);
- fmt_helper::append_string_view(msg.source.funcname, dest);
- }
-};
-
-// Full info formatter
-// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v
-class full_formatter final : public flag_formatter
-{
-public:
- explicit full_formatter(padding_info padinfo)
- : flag_formatter(padinfo)
- {
- }
-
- void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) override
- {
- using std::chrono::duration_cast;
- using std::chrono::milliseconds;
- using std::chrono::seconds;
-
-#ifndef SPDLOG_NO_DATETIME
-
- // cache the date/time part for the next second.
- auto duration = msg.time.time_since_epoch();
- auto secs = duration_cast(duration);
-
- if (cache_timestamp_ != secs || cached_datetime_.size() == 0)
- {
- cached_datetime_.clear();
- cached_datetime_.push_back('[');
- fmt_helper::append_int(tm_time.tm_year + 1900, cached_datetime_);
- cached_datetime_.push_back('-');
-
- fmt_helper::pad2(tm_time.tm_mon + 1, cached_datetime_);
- cached_datetime_.push_back('-');
-
- fmt_helper::pad2(tm_time.tm_mday, cached_datetime_);
- cached_datetime_.push_back(' ');
-
- fmt_helper::pad2(tm_time.tm_hour, cached_datetime_);
- cached_datetime_.push_back(':');
-
- fmt_helper::pad2(tm_time.tm_min, cached_datetime_);
- cached_datetime_.push_back(':');
-
- fmt_helper::pad2(tm_time.tm_sec, cached_datetime_);
- cached_datetime_.push_back('.');
-
- cache_timestamp_ = secs;
- }
- fmt_helper::append_buf(cached_datetime_, dest);
-
- auto millis = fmt_helper::time_fraction(msg.time);
- fmt_helper::pad3(static_cast(millis.count()), dest);
- dest.push_back(']');
- dest.push_back(' ');
-
-#else // no datetime needed
- (void)tm_time;
-#endif
-
-#ifndef SPDLOG_NO_NAME
- if (!msg.logger_name->empty())
- {
- dest.push_back('[');
- // fmt_helper::append_str(*msg.logger_name, dest);
- fmt_helper::append_string_view(*msg.logger_name, dest);
- dest.push_back(']');
- dest.push_back(' ');
- }
-#endif
-
- dest.push_back('[');
- // wrap the level name with color
- msg.color_range_start = dest.size();
- // fmt_helper::append_string_view(level::to_c_str(msg.level), dest);
- fmt_helper::append_string_view(level::to_string_view(msg.level), dest);
- msg.color_range_end = dest.size();
- dest.push_back(']');
- dest.push_back(' ');
-
- // add source location if present
- if (!msg.source.empty())
- {
- dest.push_back('[');
- fmt_helper::append_string_view(msg.source.filename, dest);
- dest.push_back(':');
- fmt_helper::append_int(msg.source.line, dest);
- dest.push_back(']');
- dest.push_back(' ');
- }
- // fmt_helper::append_string_view(msg.msg(), dest);
- fmt_helper::append_string_view(msg.payload, dest);
- }
-
-private:
- std::chrono::seconds cache_timestamp_{0};
- fmt::basic_memory_buffer cached_datetime_;
-};
-
} // namespace details
class pattern_formatter final : public formatter
{
public:
explicit pattern_formatter(
- std::string pattern, pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol)
- : pattern_(std::move(pattern))
- , eol_(std::move(eol))
- , pattern_time_type_(time_type)
- , last_log_secs_(0)
- {
- std::memset(&cached_tm_, 0, sizeof(cached_tm_));
- compile_pattern_(pattern_);
- }
+ std::string pattern, pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol);
- // use by default full formatter for if pattern is not given
- explicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol)
- : pattern_("%+")
- , eol_(std::move(eol))
- , pattern_time_type_(time_type)
- , last_log_secs_(0)
- {
- std::memset(&cached_tm_, 0, sizeof(cached_tm_));
- formatters_.push_back(details::make_unique(details::padding_info{}));
- }
+ // use default pattern is not given
+ explicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol);
pattern_formatter(const pattern_formatter &other) = delete;
pattern_formatter &operator=(const pattern_formatter &other) = delete;
- std::unique_ptr clone() const override
- {
- return details::make_unique(pattern_, pattern_time_type_, eol_);
- }
-
- void format(const details::log_msg &msg, fmt::memory_buffer &dest) override
- {
-#ifndef SPDLOG_NO_DATETIME
- auto secs = std::chrono::duration_cast(msg.time.time_since_epoch());
- if (secs != last_log_secs_)
- {
- cached_tm_ = get_time_(msg);
- last_log_secs_ = secs;
- }
-#endif
- for (auto &f : formatters_)
- {
- f->format(msg, cached_tm_, dest);
- }
- // write eol
- details::fmt_helper::append_string_view(eol_, dest);
- }
+ std::unique_ptr clone() const override;
+ void format(const details::log_msg &msg, fmt::memory_buffer &dest) override;
private:
std::string pattern_;
@@ -1068,269 +79,21 @@ class pattern_formatter final : public formatter
pattern_time_type pattern_time_type_;
std::tm cached_tm_;
std::chrono::seconds last_log_secs_;
-
std::vector> formatters_;
- std::tm get_time_(const details::log_msg &msg)
- {
- if (pattern_time_type_ == pattern_time_type::local)
- {
- return details::os::localtime(log_clock::to_time_t(msg.time));
- }
- return details::os::gmtime(log_clock::to_time_t(msg.time));
- }
-
- void handle_flag_(char flag, details::padding_info padding)
- {
- switch (flag)
- {
-
- case ('+'): // default formatter
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case 'n': // logger name
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case 'l': // level
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case 'L': // short level
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('t'): // thread id
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('v'): // the message text
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('a'): // weekday
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('A'): // short weekday
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('b'):
- case ('h'): // month
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('B'): // short month
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('c'): // datetime
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('C'): // year 2 digits
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('Y'): // year 4 digits
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('D'):
- case ('x'): // datetime MM/DD/YY
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('m'): // month 1-12
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('d'): // day of month 1-31
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('H'): // hours 24
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('I'): // hours 12
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('M'): // minutes
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('S'): // seconds
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('e'): // milliseconds
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('f'): // microseconds
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('F'): // nanoseconds
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('E'): // seconds since epoch
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('p'): // am/pm
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('r'): // 12 hour clock 02:55:02 pm
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('R'): // 24-hour HH:MM time
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('T'):
- case ('X'): // ISO 8601 time format (HH:MM:SS)
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('z'): // timezone
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('P'): // pid
- formatters_.push_back(details::make_unique(padding));
- break;
-
-#ifdef SPDLOG_ENABLE_MESSAGE_COUNTER
- case ('i'):
- formatters_.push_back(details::make_unique(padding));
- break;
-#endif
- case ('^'): // color range start
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('$'): // color range end
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('@'): // source location (filename:filenumber)
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('s'): // source filename
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('#'): // source line number
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('!'): // source funcname
- formatters_.push_back(details::make_unique(padding));
- break;
-
- case ('%'): // % char
- formatters_.push_back(details::make_unique('%'));
- break;
-
- default: // Unknown flag appears as is
- auto unknown_flag = details::make_unique();
- unknown_flag->add_ch('%');
- unknown_flag->add_ch(flag);
- formatters_.push_back((std::move(unknown_flag)));
- break;
- }
- }
+ std::tm get_time_(const details::log_msg &msg);
+ template
+ void handle_flag_(char flag, details::padding_info padding);
// Extract given pad spec (e.g. %8X)
// Advance the given it pass the end of the padding spec found (if any)
// Return padding.
- details::padding_info handle_padspec_(std::string::const_iterator &it, std::string::const_iterator end)
- {
- using details::padding_info;
- using details::scoped_pad;
- const size_t max_width = 128;
- if (it == end)
- {
- return padding_info{};
- }
-
- padding_info::pad_side side;
- switch (*it)
- {
- case '-':
- side = padding_info::right;
- ++it;
- break;
- case '=':
- side = padding_info::center;
- ++it;
- break;
- default:
- side = details::padding_info::left;
- break;
- }
-
- if (it == end || !std::isdigit(static_cast(*it)))
- {
- return padding_info{0, side};
- }
-
- auto width = static_cast(*it - '0');
- for (++it; it != end && std::isdigit(static_cast(*it)); ++it)
- {
- auto digit = static_cast(*it - '0');
- width = width * 10 + digit;
- }
- return details::padding_info{std::min(width, max_width), side};
- }
+ details::padding_info handle_padspec_(std::string::const_iterator &it, std::string::const_iterator end);
- void compile_pattern_(const std::string &pattern)
- {
- auto end = pattern.end();
- std::unique_ptr user_chars;
- formatters_.clear();
- for (auto it = pattern.begin(); it != end; ++it)
- {
- if (*it == '%')
- {
- if (user_chars) // append user chars found so far
- {
- formatters_.push_back(std::move(user_chars));
- }
-
- auto padding = handle_padspec_(++it, end);
-
- if (it != end)
- {
- handle_flag_(*it, padding);
- }
- else
- {
- break;
- }
- }
- else // chars not following the % sign should be displayed as is
- {
- if (!user_chars)
- {
- user_chars = details::make_unique();
- }
- user_chars->add_ch(*it);
- }
- }
- if (user_chars) // append raw chars found so far
- {
- formatters_.push_back(std::move(user_chars));
- }
- }
+ void compile_pattern_(const std::string &pattern);
};
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "pattern_formatter-inl.h"
+#endif
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/periodic_worker-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/periodic_worker-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker.h b/shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker.h
index fa6488d17..d3b5c639a 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/periodic_worker.h
@@ -1,8 +1,5 @@
-
-//
-// Copyright(c) 2018 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
@@ -23,43 +20,11 @@ namespace details {
class periodic_worker
{
public:
- periodic_worker(const std::function &callback_fun, std::chrono::seconds interval)
- {
- active_ = (interval > std::chrono::seconds::zero());
- if (!active_)
- {
- return;
- }
-
- worker_thread_ = std::thread([this, callback_fun, interval]() {
- for (;;)
- {
- std::unique_lock lock(this->mutex_);
- if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; }))
- {
- return; // active_ == false, so exit this thread
- }
- callback_fun();
- }
- });
- }
-
+ periodic_worker(const std::function &callback_fun, std::chrono::seconds interval);
periodic_worker(const periodic_worker &) = delete;
periodic_worker &operator=(const periodic_worker &) = delete;
-
// stop the worker thread and join it
- ~periodic_worker()
- {
- if (worker_thread_.joinable())
- {
- {
- std::lock_guard lock(mutex_);
- active_ = false;
- }
- cv_.notify_one();
- worker_thread_.join();
- }
- }
+ ~periodic_worker();
private:
bool active_;
@@ -69,3 +34,7 @@ class periodic_worker
};
} // namespace details
} // namespace spdlog
+
+#ifdef SPDLOG_HEADER_ONLY
+#include "periodic_worker-inl.h"
+#endif
diff --git a/tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/registry-inl.h b/shared/src/native-lib/spdlog/include/spdlog/details/registry-inl.h
similarity index 100%
rename from tracer/src/Datadog.Trace.ClrProfiler.Native/lib/spdlog/include/spdlog/details/registry-inl.h
rename to shared/src/native-lib/spdlog/include/spdlog/details/registry-inl.h
diff --git a/shared/src/native-lib/spdlog/include/spdlog/details/registry.h b/shared/src/native-lib/spdlog/include/spdlog/details/registry.h
index ccd539557..f96a7698e 100644
--- a/shared/src/native-lib/spdlog/include/spdlog/details/registry.h
+++ b/shared/src/native-lib/spdlog/include/spdlog/details/registry.h
@@ -1,37 +1,28 @@
-//
-// Copyright(c) 2015 Gabi Melman.
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
-//
#pragma once
-// Loggers registy of unique name->logger pointer
-// An attempt to create a logger with an already existing name will be ignored
+// Loggers registry of unique name->logger pointer
+// An attempt to create a logger with an already existing name will result with spdlog_ex exception.
// If user requests a non existing logger, nullptr will be returned
// This class is thread safe
#include "spdlog/common.h"
-#include "spdlog/details/periodic_worker.h"
-#include "spdlog/logger.h"
-
-#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
-// support for the default stdout color logger
-#ifdef _WIN32
-#include "spdlog/sinks/wincolor_sink.h"
-#else
-#include "spdlog/sinks/ansicolor_sink.h"
-#endif
-#endif // SPDLOG_DISABLE_DEFAULT_LOGGER
#include
#include
#include
#include
#include
+#include
namespace spdlog {
+class logger;
+
namespace details {
class thread_pool;
+class periodic_worker;
class registry
{
@@ -39,242 +30,66 @@ class registry
registry(const registry &) = delete;
registry &operator=(const registry &) = delete;
- void register_logger(std::shared_ptr new_logger)
- {
- std::lock_guard lock(logger_map_mutex_);
- register_logger_(std::move(new_logger));
- }
-
- void initialize_logger(std::shared_ptr new_logger)
- {
- std::lock_guard lock(logger_map_mutex_);
- new_logger->set_formatter(formatter_->clone());
-
- if (err_handler_)
- {
- new_logger->set_error_handler(err_handler_);
- }
-
- new_logger->set_level(level_);
- new_logger->flush_on(flush_level_);
-
- if (automatic_registration_)
- {
- register_logger_(std::move(new_logger));
- }
- }
-
- std::shared_ptr get(const std::string &logger_name)
- {
- std::lock_guard lock(logger_map_mutex_);
- auto found = loggers_.find(logger_name);
- return found == loggers_.end() ? nullptr : found->second;
- }
-
- std::shared_ptr default_logger()
- {
- std::lock_guard lock(logger_map_mutex_);
- return default_logger_;
- }
+ void register_logger(std::shared_ptr