Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- miniCUDA124/nvvm/bin/cicc.exe +3 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/tmmta.cpp +51 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/tmsta.cpp +51 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/type.cpp +271 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/vccorlib.cpp +116 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/vcwinrt.cpp +494 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/weakreference.cpp +112 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/winmain.cpp +13 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ManagedMain.cpp +28 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/app_appinit.cpp +19 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/argv_mode.cpp +16 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/c11_atomic_support.c +150 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/checkcfg.c +70 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/commit_mode.cpp +16 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/debugger_jmc.c +29 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/default_precision.cpp +22 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array.cpp +32 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_align.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_align_nothrow.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_nothrow.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_size.cpp +32 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_size_align.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_debug.cpp +72 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar.cpp +38 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_align.cpp +33 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_align_nothrow.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_nothrow.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_size.cpp +32 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_size_align.cpp +31 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/denormal_control.cpp +16 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dll_dllmain.cpp +335 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dll_dllmain_stub.cpp +38 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dyn_tls_init.c +21 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehhelpers.cpp +333 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehhelpers.h +87 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehstate.cpp +237 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvccctr.cpp +94 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvcccvb.cpp +95 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvecctr.cpp +89 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehveccvb.cpp +99 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvecdtr.cpp +140 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/env_mode.cpp +16 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_common.inl +331 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_main.cpp +17 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_winmain.cpp +17 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_wmain.cpp +17 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_wwinmain.cpp +17 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/file_mode.cpp +17 -0
- miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/fltused.cpp +9 -0
.gitattributes
CHANGED
|
@@ -109,3 +109,4 @@ miniCUDA124/lib/x64/nvfatbin_static.lib filter=lfs diff=lfs merge=lfs -text
|
|
| 109 |
miniCUDA124/bin/cublas64_12.dll filter=lfs diff=lfs merge=lfs -text
|
| 110 |
miniCUDA124/lib/x64/nvrtc-builtins_static.lib filter=lfs diff=lfs merge=lfs -text
|
| 111 |
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vccorlib140d.dll filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 109 |
miniCUDA124/bin/cublas64_12.dll filter=lfs diff=lfs merge=lfs -text
|
| 110 |
miniCUDA124/lib/x64/nvrtc-builtins_static.lib filter=lfs diff=lfs merge=lfs -text
|
| 111 |
miniMSVC/VC/Redist/MSVC/14.42.34433/debug_nonredist/x64/Microsoft.VC143.DebugCRT/vccorlib140d.dll filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
miniCUDA124/nvvm/bin/cicc.exe filter=lfs diff=lfs merge=lfs -text
|
miniCUDA124/nvvm/bin/cicc.exe
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5f70fd7076807724c0065cff4bc2f19730b492a6e4556188c56f77fcd3e9a9e
|
| 3 |
+
size 28270080
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/tmmta.cpp
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
#include <crtdbg.h>
|
| 6 |
+
|
| 7 |
+
// From <vccorlib.h>, which we cannot include here
|
| 8 |
+
#define _VCCORLIB_THREADING_MODEL_DEFAULT 0
|
| 9 |
+
#define _VCCORLIB_THREADING_MODEL_STA 1
|
| 10 |
+
#define _VCCORLIB_THREADING_MODEL_MTA 2
|
| 11 |
+
#define _VCCORLIB_THREADING_MODEL_OVERRIDE 3
|
| 12 |
+
|
| 13 |
+
extern int __abi___threading_model;
|
| 14 |
+
|
| 15 |
+
// Compiler is pulling in the following symbol:
|
| 16 |
+
// INCLUDE:___refMTAThread (decorated x86) to enable MTA
|
| 17 |
+
extern "C" int __refMTAThread = 0;
|
| 18 |
+
|
| 19 |
+
// External symbol to ensure that only one threading model initializer can be
|
| 20 |
+
// linked into a module. If a project uses both Platform::STAThreadAttribute
|
| 21 |
+
// and Platform::MTAThreadAttribute, this should cause a link error.
|
| 22 |
+
extern "C" int __abi___threading_model_initializer = 0;
|
| 23 |
+
|
| 24 |
+
static int __cdecl initialize_threading_model_for_mta() throw()
|
| 25 |
+
{
|
| 26 |
+
// If the threading model is 'override', some prior initializer has requested that
|
| 27 |
+
// we not initialize the threading model. This feature exists to support the XAML
|
| 28 |
+
// designer, which loads EXEs as if they were DLLs, and thus needs to be able to
|
| 29 |
+
// suppress our initialization.
|
| 30 |
+
if (__abi___threading_model == _VCCORLIB_THREADING_MODEL_OVERRIDE)
|
| 31 |
+
{
|
| 32 |
+
return 0;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if (__abi___threading_model != _VCCORLIB_THREADING_MODEL_DEFAULT)
|
| 36 |
+
{
|
| 37 |
+
// If you hit this assertion, this indicates that both Platform::STAThreadAttribute
|
| 38 |
+
// and Platform::MTAThreadAttribute were used in your source files and libraries.
|
| 39 |
+
// These attributes are mutually exclusive. Search your sources for the attributes
|
| 40 |
+
// or link your project with the /verbose option and find which object files caused
|
| 41 |
+
// the __refSTAThread and __refMTAThread symbols to be linked into your binary.
|
| 42 |
+
_ASSERTE(("__abi___threading_model has already been initialized", 0));
|
| 43 |
+
return 1;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
__abi___threading_model = _VCCORLIB_THREADING_MODEL_MTA;
|
| 47 |
+
return 0;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
#pragma section(".CRT$XIYA", long, read)
|
| 51 |
+
__declspec(allocate(".CRT$XIYA")) static auto initializer = initialize_threading_model_for_mta;
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/tmsta.cpp
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
#include <crtdbg.h>
|
| 6 |
+
|
| 7 |
+
// From <vccorlib.h>, which we cannot include here
|
| 8 |
+
#define _VCCORLIB_THREADING_MODEL_DEFAULT 0
|
| 9 |
+
#define _VCCORLIB_THREADING_MODEL_STA 1
|
| 10 |
+
#define _VCCORLIB_THREADING_MODEL_MTA 2
|
| 11 |
+
#define _VCCORLIB_THREADING_MODEL_OVERRIDE 3
|
| 12 |
+
|
| 13 |
+
extern int __abi___threading_model;
|
| 14 |
+
|
| 15 |
+
// Compiler is pulling in the following symbol:
|
| 16 |
+
// INCLUDE:___refSTAThread (decorated x86) to enable STA
|
| 17 |
+
extern "C" int __refSTAThread = 0;
|
| 18 |
+
|
| 19 |
+
// External symbol to ensure that only one threading model initializer can be
|
| 20 |
+
// linked into a module. If a project uses both Platform::STAThreadAttribute
|
| 21 |
+
// and Platform::MTAThreadAttribute, this should cause a link error.
|
| 22 |
+
extern "C" int __abi___threading_model_initializer = 0;
|
| 23 |
+
|
| 24 |
+
static int __cdecl initialize_threading_model_for_sta() throw()
|
| 25 |
+
{
|
| 26 |
+
// If the threading model is 'override', some prior initializer has requested that
|
| 27 |
+
// we not initialize the threading model. This feature exists to support the XAML
|
| 28 |
+
// designer, which loads EXEs as if they were DLLs, and thus needs to be able to
|
| 29 |
+
// suppress our initialization.
|
| 30 |
+
if (__abi___threading_model == _VCCORLIB_THREADING_MODEL_OVERRIDE)
|
| 31 |
+
{
|
| 32 |
+
return 0;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if (__abi___threading_model != _VCCORLIB_THREADING_MODEL_DEFAULT)
|
| 36 |
+
{
|
| 37 |
+
// If you hit this assertion, this indicates that both Platform::STAThreadAttribute
|
| 38 |
+
// and Platform::MTAThreadAttribute were used in your source files and libraries.
|
| 39 |
+
// These attributes are mutually exclusive. Search your sources for the attributes
|
| 40 |
+
// or link your project with the /verbose option and find which object files caused
|
| 41 |
+
// the __refSTAThread and __refMTAThread symbols to be linked into your binary.
|
| 42 |
+
_ASSERTE(("__abi___threading_model has already been initialized", 0));
|
| 43 |
+
return 1;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
__abi___threading_model = _VCCORLIB_THREADING_MODEL_STA;
|
| 47 |
+
return 0;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
#pragma section(".CRT$XIYA", long, read)
|
| 51 |
+
__declspec(allocate(".CRT$XIYA")) static auto initializer = initialize_threading_model_for_sta;
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/type.cpp
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
|
| 6 |
+
#include "pch.h"
|
| 7 |
+
#pragma hdrstop
|
| 8 |
+
|
| 9 |
+
#pragma warning(disable:4483)
|
| 10 |
+
|
| 11 |
+
size_t SafeAdd(size_t left, size_t right)
|
| 12 |
+
{
|
| 13 |
+
if (static_cast<size_t>(-1) - left < right)
|
| 14 |
+
{
|
| 15 |
+
throw ref new ::Platform::COMException(HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW));
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
return left + right;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
size_t SafeMultiply(size_t left, size_t right)
|
| 22 |
+
{
|
| 23 |
+
if (static_cast<size_t>(-1) / left < right)
|
| 24 |
+
{
|
| 25 |
+
throw ref new ::Platform::COMException(HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW));
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
return left * right;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
struct {
|
| 32 |
+
const __wchar_t* typeName;
|
| 33 |
+
const __wchar_t* platformName;
|
| 34 |
+
::Platform::TypeCode typeId;
|
| 35 |
+
::Windows::Foundation::PropertyType propertyType;
|
| 36 |
+
} primitiveMatchArr[] = {
|
| 37 |
+
{ L"Boolean", L"Boolean", ::Platform::TypeCode::Boolean , ::Windows::Foundation::PropertyType::Boolean },
|
| 38 |
+
{ L"Char16", L"Char16", ::Platform::TypeCode::Char16 , ::Windows::Foundation::PropertyType::Char16 },
|
| 39 |
+
{ L"Int8", L"Int8", ::Platform::TypeCode::Int8 , static_cast<::Windows::Foundation::PropertyType>(-1) },
|
| 40 |
+
{ L"UInt8", L"UInt8", ::Platform::TypeCode::UInt8 , ::Windows::Foundation::PropertyType::UInt8 },
|
| 41 |
+
{ L"Int16", L"Int16", ::Platform::TypeCode::Int16 , ::Windows::Foundation::PropertyType::Int16 },
|
| 42 |
+
{ L"UInt16", L"UInt16", ::Platform::TypeCode::UInt16 , ::Windows::Foundation::PropertyType::UInt16 },
|
| 43 |
+
{ L"Int32", L"Int32", ::Platform::TypeCode::Int32 , ::Windows::Foundation::PropertyType::Int32 },
|
| 44 |
+
{ L"UInt32", L"UInt32", ::Platform::TypeCode::UInt32 , ::Windows::Foundation::PropertyType::UInt32 },
|
| 45 |
+
{ L"Int64", L"Int64", ::Platform::TypeCode::Int64 , ::Windows::Foundation::PropertyType::Int64 },
|
| 46 |
+
{ L"UInt64", L"UInt64", ::Platform::TypeCode::UInt64 , ::Windows::Foundation::PropertyType::UInt64 },
|
| 47 |
+
{ L"Single", L"Single", ::Platform::TypeCode::Single , ::Windows::Foundation::PropertyType::Single },
|
| 48 |
+
{ L"Double", L"Double", ::Platform::TypeCode::Double , ::Windows::Foundation::PropertyType::Double },
|
| 49 |
+
{ L"String", L"Platform.String", ::Platform::TypeCode::String , ::Windows::Foundation::PropertyType::String },
|
| 50 |
+
{ L"Guid", L"Platform.Guid", ::Platform::TypeCode::Guid , ::Windows::Foundation::PropertyType::Guid },
|
| 51 |
+
{ L"DateTime", L"Windows.Foundation.DateTime", ::Platform::TypeCode::DateTime , ::Windows::Foundation::PropertyType::DateTime },
|
| 52 |
+
{ L"TimeSpan", L"Windows.Foundation.TimeSpan", ::Platform::TypeCode::TimeSpan , ::Windows::Foundation::PropertyType::TimeSpan },
|
| 53 |
+
{ L"Point", L"Windows.Foundation.Point", ::Platform::TypeCode::Point , ::Windows::Foundation::PropertyType::Point },
|
| 54 |
+
{ L"Rect", L"Windows.Foundation.Rect", ::Platform::TypeCode::Rect , ::Windows::Foundation::PropertyType::Rect },
|
| 55 |
+
{ L"Size", L"Windows.Foundation.Size", ::Platform::TypeCode::Size , ::Windows::Foundation::PropertyType::Size },
|
| 56 |
+
{ L"Object", L"Platform.Object", ::Platform::TypeCode::Object , ::Windows::Foundation::PropertyType::Inspectable}
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
__abi_type_descriptor* CreateDescriptior(const __wchar_t* typeName, int typeId)
|
| 60 |
+
{
|
| 61 |
+
size_t len = ::wcslen(typeName);
|
| 62 |
+
|
| 63 |
+
len = SafeAdd(len, 4);
|
| 64 |
+
|
| 65 |
+
size_t size = SafeMultiply(len, sizeof(__wchar_t));
|
| 66 |
+
size = SafeAdd(size, sizeof(__abi_type_descriptor));
|
| 67 |
+
|
| 68 |
+
__abi_type_descriptor* descriptor = reinterpret_cast<__abi_type_descriptor*>(Platform::Details::Heap::Allocate(size));
|
| 69 |
+
descriptor->__typeName = reinterpret_cast<const __wchar_t*>(descriptor + 1);
|
| 70 |
+
wcscpy_s( const_cast<__wchar_t*>(descriptor->__typeName), len, typeName);
|
| 71 |
+
descriptor->__typeId = typeId;
|
| 72 |
+
|
| 73 |
+
return descriptor;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
namespace Platform
|
| 77 |
+
{
|
| 78 |
+
/*
|
| 79 |
+
extern "C" CPPCLI_FUNC void __identifier("?<Dispose>@Type@Platform@@U$AAAXXZ")(Platform::Type^ pThis)
|
| 80 |
+
{
|
| 81 |
+
// no-op. We don't need 'delete Type' to do anything.
|
| 82 |
+
}
|
| 83 |
+
*/
|
| 84 |
+
|
| 85 |
+
CPPCLI_FUNC void Type::__identifier("<Dispose>")()
|
| 86 |
+
{
|
| 87 |
+
if (_owndescriptor)
|
| 88 |
+
{
|
| 89 |
+
Platform::Details::Heap::Free(_descriptor);
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
// Add this back in when non-virtual private destructors are available.
|
| 94 |
+
// CPPCLI_FUNC void Type::~Type()
|
| 95 |
+
// {
|
| 96 |
+
// if (_owndescriptor)
|
| 97 |
+
// {
|
| 98 |
+
// Platform::Details::Heap::Free(_descriptor);
|
| 99 |
+
// }
|
| 100 |
+
// }
|
| 101 |
+
|
| 102 |
+
CPPCLI_FUNC Type::Type(IntPtr descriptor) : _descriptor( (void *)descriptor ), _owndescriptor(false)
|
| 103 |
+
{
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
CPPCLI_FUNC Type::Type(Windows::UI::Xaml::Interop::TypeName type) : _descriptor(nullptr), _owndescriptor(true)
|
| 107 |
+
{
|
| 108 |
+
const __wchar_t *typeName = type.Name->Data();
|
| 109 |
+
int typeId = 0;
|
| 110 |
+
|
| 111 |
+
switch(type.Kind)
|
| 112 |
+
{
|
| 113 |
+
case Windows::UI::Xaml::Interop::TypeKind::Metadata:
|
| 114 |
+
typeId = static_cast<int>(Platform::TypeCode::Object);
|
| 115 |
+
break;
|
| 116 |
+
case Windows::UI::Xaml::Interop::TypeKind::Custom:
|
| 117 |
+
typeId = static_cast<int>(Platform::TypeCode::Custom);
|
| 118 |
+
break;
|
| 119 |
+
case Windows::UI::Xaml::Interop::TypeKind::Primitive:
|
| 120 |
+
{
|
| 121 |
+
for(unsigned int i = 0; i < _countof(primitiveMatchArr); i++)
|
| 122 |
+
{
|
| 123 |
+
if (::wcscmp(typeName, primitiveMatchArr[i].typeName) == 0)
|
| 124 |
+
{
|
| 125 |
+
typeId = static_cast<int>(primitiveMatchArr[i].typeId);
|
| 126 |
+
typeName = primitiveMatchArr[i].platformName;
|
| 127 |
+
break;
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
break;
|
| 131 |
+
}
|
| 132 |
+
default:
|
| 133 |
+
throw ref new ::Platform::FailureException();
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
_descriptor = CreateDescriptior(typeName, typeId);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
CPPCLI_FUNC Type::Type(Object^ obj) : _owndescriptor(true)
|
| 140 |
+
{
|
| 141 |
+
Windows::Foundation::IPropertyValue^ propertyValue;
|
| 142 |
+
::Platform::Guid gdIPropertyValue(__uuidof(Windows::Foundation::IPropertyValue^));
|
| 143 |
+
HRESULT hr = obj->__abi_QueryInterface(gdIPropertyValue, reinterpret_cast<void**>(&propertyValue));
|
| 144 |
+
if (SUCCEEDED(hr))
|
| 145 |
+
{
|
| 146 |
+
auto propertyType = propertyValue->Type;
|
| 147 |
+
|
| 148 |
+
for (unsigned int i = 0; i < _countof(primitiveMatchArr); i++)
|
| 149 |
+
{
|
| 150 |
+
if (propertyType == primitiveMatchArr[i].propertyType)
|
| 151 |
+
{
|
| 152 |
+
_descriptor = CreateDescriptior(primitiveMatchArr[i].platformName, static_cast<int>(primitiveMatchArr[i].typeId));
|
| 153 |
+
return;
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
Platform::String^ typeName;
|
| 159 |
+
hr = obj->__abi_GetRuntimeClassName(reinterpret_cast<HSTRING*>(&typeName));
|
| 160 |
+
__abi_ThrowIfFailed(hr);
|
| 161 |
+
|
| 162 |
+
int typeId = static_cast<int>(Platform::TypeCode::Object);
|
| 163 |
+
|
| 164 |
+
_descriptor = CreateDescriptior(typeName->Data(), typeId);
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
CPPCLI_FUNC String^ Type::FullName::get()
|
| 168 |
+
{
|
| 169 |
+
__abi_type_descriptor* descriptor = (__abi_type_descriptor*)(void*)_descriptor;
|
| 170 |
+
return ref new String(descriptor->__typeName);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
CPPCLI_FUNC TypeCode Type::GetTypeCode(Type^ type)
|
| 174 |
+
{
|
| 175 |
+
if (type == nullptr)
|
| 176 |
+
{
|
| 177 |
+
return TypeCode::Empty;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
__abi_type_descriptor* descriptor = (__abi_type_descriptor*)(void*)type->_descriptor;
|
| 181 |
+
return (TypeCode)descriptor->__typeId;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
CPPCLI_FUNC int32 Type::GetHashCode()
|
| 186 |
+
{
|
| 187 |
+
return Object::GetHashCode();
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
CPPCLI_FUNC String^ Type::ToString()
|
| 191 |
+
{
|
| 192 |
+
return FullName;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
CPPCLI_FUNC bool Type::Equals(Object^ o)
|
| 196 |
+
{
|
| 197 |
+
Type^ type = dynamic_cast<Type^>(o);
|
| 198 |
+
if (type == nullptr)
|
| 199 |
+
{
|
| 200 |
+
return this == nullptr;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
return _descriptor == type->_descriptor;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
CPPCLI_FUNC Platform::Type::operator class Windows::UI::Xaml::Interop::TypeName(class Platform::Type^ type)
|
| 207 |
+
{
|
| 208 |
+
Windows::UI::Xaml::Interop::TypeName typeName;
|
| 209 |
+
typeName.Name = type->FullName;
|
| 210 |
+
|
| 211 |
+
switch(::Platform::Type::GetTypeCode(type))
|
| 212 |
+
{
|
| 213 |
+
case ::Platform::TypeCode::Empty:
|
| 214 |
+
case ::Platform::TypeCode::Object:
|
| 215 |
+
case ::Platform::TypeCode::DateTime:
|
| 216 |
+
case ::Platform::TypeCode::TimeSpan:
|
| 217 |
+
case ::Platform::TypeCode::Point:
|
| 218 |
+
case ::Platform::TypeCode::Size:
|
| 219 |
+
case ::Platform::TypeCode::Rect:
|
| 220 |
+
typeName.Kind = Windows::UI::Xaml::Interop::TypeKind::Metadata;
|
| 221 |
+
break;
|
| 222 |
+
case ::Platform::TypeCode::Custom:
|
| 223 |
+
typeName.Kind = Windows::UI::Xaml::Interop::TypeKind::Custom;
|
| 224 |
+
break;
|
| 225 |
+
case ::Platform::TypeCode::Boolean:
|
| 226 |
+
case ::Platform::TypeCode::Char16:
|
| 227 |
+
case ::Platform::TypeCode::Int8:
|
| 228 |
+
case ::Platform::TypeCode::UInt8:
|
| 229 |
+
case ::Platform::TypeCode::Int16:
|
| 230 |
+
case ::Platform::TypeCode::UInt16:
|
| 231 |
+
case ::Platform::TypeCode::Int32:
|
| 232 |
+
case ::Platform::TypeCode::UInt32:
|
| 233 |
+
case ::Platform::TypeCode::Int64:
|
| 234 |
+
case ::Platform::TypeCode::UInt64:
|
| 235 |
+
case ::Platform::TypeCode::Single:
|
| 236 |
+
case ::Platform::TypeCode::Double:
|
| 237 |
+
case ::Platform::TypeCode::String:
|
| 238 |
+
case ::Platform::TypeCode::Guid:
|
| 239 |
+
typeName.Kind = Windows::UI::Xaml::Interop::TypeKind::Primitive;
|
| 240 |
+
break;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
// Gettting string name from typeName.Name because we hold reference to it
|
| 244 |
+
const wchar_t *name = typeName.Name->Data();
|
| 245 |
+
if (name != nullptr)
|
| 246 |
+
{
|
| 247 |
+
for(unsigned int i = 0; i < _countof(primitiveMatchArr); i++)
|
| 248 |
+
{
|
| 249 |
+
if (::wcscmp(name, primitiveMatchArr[i].platformName) == 0)
|
| 250 |
+
{
|
| 251 |
+
typeName.Name = ref new ::Platform::String(primitiveMatchArr[i].typeName);
|
| 252 |
+
break;
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
return typeName;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
CPPCLI_FUNC Platform::Type::operator class Platform::Type ^(class Windows::UI::Xaml::Interop::TypeName typeName)
|
| 261 |
+
{
|
| 262 |
+
return ref new ::Platform::Type(typeName);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
} // namespace Platform
|
| 266 |
+
|
| 267 |
+
CPPCLI_FUNC Platform::Type^ __stdcall __abi_make_type_id(const __abi_type_descriptor& typeInfo)
|
| 268 |
+
{
|
| 269 |
+
Platform::IntPtr ptr = const_cast<__abi_type_descriptor*>(&typeInfo);
|
| 270 |
+
return ref new Platform::Type(ptr);
|
| 271 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/vccorlib.cpp
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
#include "pch.h"
|
| 6 |
+
|
| 7 |
+
CPPCLI_FUNC void __stdcall FlushFactoryCache();
|
| 8 |
+
CPPCLI_FUNC void EnableFactoryCache();
|
| 9 |
+
void DisableFactoryCache();
|
| 10 |
+
|
| 11 |
+
__abi_Module* __abi_module = nullptr;
|
| 12 |
+
|
| 13 |
+
#include "crtdefs.h"
|
| 14 |
+
#include <corecrt_startup.h>
|
| 15 |
+
|
| 16 |
+
__declspec(noreturn) __declspec(dllexport) void __stdcall __abi_FailFast()
|
| 17 |
+
{
|
| 18 |
+
_invoke_watson(nullptr, nullptr, nullptr, 0, 0);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
namespace Platform {
|
| 22 |
+
namespace Details {
|
| 23 |
+
|
| 24 |
+
class InternalModule :
|
| 25 |
+
public __abi_Module
|
| 26 |
+
{
|
| 27 |
+
public:
|
| 28 |
+
InternalModule()
|
| 29 |
+
{
|
| 30 |
+
__abi_module = this;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
virtual ~InternalModule()
|
| 34 |
+
{
|
| 35 |
+
__abi_module = nullptr;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
virtual unsigned long __stdcall __abi_IncrementObjectCount()
|
| 39 |
+
{
|
| 40 |
+
return 0;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
virtual unsigned long __stdcall __abi_DecrementObjectCount()
|
| 44 |
+
{
|
| 45 |
+
return 0;
|
| 46 |
+
}
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
#pragma warning( disable: 4073 ) // initializers put in library initialization area
|
| 50 |
+
#pragma init_seg( lib )
|
| 51 |
+
|
| 52 |
+
InternalModule internalModule_;
|
| 53 |
+
|
| 54 |
+
VCCORLIB_API HRESULT InitializeData(int threadingModel)
|
| 55 |
+
{
|
| 56 |
+
if (threadingModel != _VCCORLIB_THREADING_MODEL_DEFAULT)
|
| 57 |
+
{
|
| 58 |
+
RO_INIT_TYPE initType = threadingModel == _VCCORLIB_THREADING_MODEL_STA
|
| 59 |
+
? static_cast<RO_INIT_TYPE>(0) /* RO_INIT_SINGLETHREADED */
|
| 60 |
+
: RO_INIT_MULTITHREADED;
|
| 61 |
+
|
| 62 |
+
HRESULT hr = Windows::Foundation::Initialize(initType);
|
| 63 |
+
if (FAILED(hr))
|
| 64 |
+
{
|
| 65 |
+
#ifdef _DEBUG
|
| 66 |
+
if (IsDebuggerPresent())
|
| 67 |
+
{
|
| 68 |
+
OutputDebugStringW(L"Call to Windows::Foundation::Initialize failed.");
|
| 69 |
+
}
|
| 70 |
+
#endif
|
| 71 |
+
return hr;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
EnableFactoryCache();
|
| 75 |
+
}
|
| 76 |
+
return S_OK;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
VCCORLIB_API void UninitializeData(int threadingModel)
|
| 80 |
+
{
|
| 81 |
+
if (threadingModel != 0)
|
| 82 |
+
{
|
| 83 |
+
DisableFactoryCache();
|
| 84 |
+
Windows::Foundation::Uninitialize();
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
VCCORLIB_API HRESULT STDMETHODCALLTYPE GetActivationFactory(
|
| 89 |
+
_In_ Microsoft::WRL::Details::ModuleBase* module,
|
| 90 |
+
_In_ HSTRING pActivatibleClassId,
|
| 91 |
+
_Deref_out_ ::IActivationFactory** ppFactory)
|
| 92 |
+
{
|
| 93 |
+
return Microsoft::WRL::Details::GetActivationFactory<Microsoft::WRL::InProcDisableCaching>(module, nullptr, pActivatibleClassId, ppFactory);
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
VCCORLIB_API bool STDMETHODCALLTYPE TerminateModule(_In_ Microsoft::WRL::Details::ModuleBase* module)
|
| 97 |
+
{
|
| 98 |
+
return Microsoft::WRL::Details::TerminateMap(module, nullptr, false);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
VCCORLIB_API wchar_t** GetCmdArguments(_Out_ int* argc)
|
| 102 |
+
{
|
| 103 |
+
_ASSERTE(argc != nullptr);
|
| 104 |
+
|
| 105 |
+
if (_configure_wide_argv(_get_startup_argv_mode()) != 0)
|
| 106 |
+
{
|
| 107 |
+
*argc = 0;
|
| 108 |
+
return nullptr;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
*argc = __argc;
|
| 112 |
+
return __wargv;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
} } // namespace Platform::Details
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/vcwinrt.cpp
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
|
| 6 |
+
#include "pch.h"
|
| 7 |
+
#include <string>
|
| 8 |
+
#include <map>
|
| 9 |
+
#include <unordered_map>
|
| 10 |
+
#include <vector>
|
| 11 |
+
#include "activation.h"
|
| 12 |
+
#pragma hdrstop
|
| 13 |
+
#include <strsafe.h>
|
| 14 |
+
#include <memory>
|
| 15 |
+
#include <combaseapi.h>
|
| 16 |
+
|
| 17 |
+
using namespace Microsoft::WRL;
|
| 18 |
+
using namespace std;
|
| 19 |
+
|
| 20 |
+
struct conditional_deleter
|
| 21 |
+
{
|
| 22 |
+
conditional_deleter(bool bDelete = true) : _bDelete(bDelete)
|
| 23 |
+
{
|
| 24 |
+
}
|
| 25 |
+
conditional_deleter(const conditional_deleter& other) : _bDelete(other._bDelete)
|
| 26 |
+
{
|
| 27 |
+
}
|
| 28 |
+
conditional_deleter(conditional_deleter&& other) : _bDelete(other._bDelete)
|
| 29 |
+
{
|
| 30 |
+
other._bDelete = true;
|
| 31 |
+
}
|
| 32 |
+
conditional_deleter& operator=(conditional_deleter other)
|
| 33 |
+
{
|
| 34 |
+
_bDelete = other._bDelete;
|
| 35 |
+
}
|
| 36 |
+
void operator()(const wchar_t* p)
|
| 37 |
+
{
|
| 38 |
+
if (_bDelete)
|
| 39 |
+
{
|
| 40 |
+
delete p; // TRANSITION, should be delete[]
|
| 41 |
+
}
|
| 42 |
+
return;
|
| 43 |
+
}
|
| 44 |
+
private:
|
| 45 |
+
bool _bDelete;
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
template <typename deletor>
|
| 49 |
+
struct hash_unique_wchar
|
| 50 |
+
{
|
| 51 |
+
size_t operator()(const unique_ptr<const wchar_t, deletor>& ele) const
|
| 52 |
+
{
|
| 53 |
+
const wstring_view sv{ele.get()};
|
| 54 |
+
return hash<wstring_view>{}(sv);
|
| 55 |
+
}
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
template <typename deletor>
|
| 59 |
+
struct equal_unique_wchar
|
| 60 |
+
{
|
| 61 |
+
bool operator()(const unique_ptr<const wchar_t, deletor>& first, const unique_ptr<const wchar_t, deletor>& second) const
|
| 62 |
+
{
|
| 63 |
+
return wcscmp(first.get(), second.get()) == 0;
|
| 64 |
+
}
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
CPPCLI_FUNC HRESULT __stdcall __getActivationFactoryByHSTRING(HSTRING str, ::Platform::Guid& riid, PVOID * ppActivationFactory)
|
| 68 |
+
{
|
| 69 |
+
HRESULT hr = S_OK;
|
| 70 |
+
IActivationFactory* pActivationFactory;
|
| 71 |
+
hr = Windows::Foundation::GetActivationFactory(str, &pActivationFactory);
|
| 72 |
+
if (SUCCEEDED(hr))
|
| 73 |
+
{
|
| 74 |
+
hr = pActivationFactory->QueryInterface(reinterpret_cast<REFIID>(riid), ppActivationFactory);
|
| 75 |
+
pActivationFactory->Release();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return hr;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
class PerApartmentFactoryCache : public RuntimeClass<RuntimeClassFlags<ClassicCom>, IApartmentShutdown, FtmBase>
|
| 82 |
+
{
|
| 83 |
+
UINT64 _apartmentId;
|
| 84 |
+
protected:
|
| 85 |
+
typedef unique_ptr<const wchar_t, conditional_deleter> ActivatableID; // TRANSITION, should be const wchar_t[]
|
| 86 |
+
private:
|
| 87 |
+
unordered_map<ActivatableID,
|
| 88 |
+
ComPtr<IUnknown>,
|
| 89 |
+
hash_unique_wchar<conditional_deleter>,
|
| 90 |
+
equal_unique_wchar<conditional_deleter >> _factoryCache;
|
| 91 |
+
protected:
|
| 92 |
+
virtual HRESULT AddFactoryInternal(std::pair<ActivatableID, ComPtr<IUnknown> > &&entry)
|
| 93 |
+
{
|
| 94 |
+
auto ret = _factoryCache.insert(std::move(entry));
|
| 95 |
+
if (ret.second == false)
|
| 96 |
+
{
|
| 97 |
+
return S_FALSE;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
return S_OK;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
virtual HRESULT GetFactoryInternal(const wchar_t* acid, Platform::Guid& iid, void** pFactory, bool& addToCache)
|
| 104 |
+
{
|
| 105 |
+
__WRL_ASSERT__(addToCache == true); // The default value for addToCache should be true
|
| 106 |
+
|
| 107 |
+
*pFactory = nullptr;
|
| 108 |
+
// Don't delete buffer
|
| 109 |
+
ActivatableID activatableID(acid, false);
|
| 110 |
+
auto it = _factoryCache.find(std::move(activatableID));
|
| 111 |
+
if (it == _factoryCache.end())
|
| 112 |
+
{
|
| 113 |
+
return E_FAIL;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
// The factory pointer is nullptr only
|
| 117 |
+
// in case that the factory has proxy
|
| 118 |
+
IUnknown* unk = it->second.Get();
|
| 119 |
+
if (unk == nullptr)
|
| 120 |
+
{
|
| 121 |
+
addToCache = false;
|
| 122 |
+
return E_FAIL;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
return unk->QueryInterface(iid, pFactory);
|
| 126 |
+
}
|
| 127 |
+
public:
|
| 128 |
+
HRESULT RuntimeClassInitialize(UINT64 appartmentId)
|
| 129 |
+
{
|
| 130 |
+
_apartmentId = appartmentId;
|
| 131 |
+
return S_OK;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
HRESULT AddFactory(const wchar_t* acid, IUnknown *factory)
|
| 135 |
+
{
|
| 136 |
+
try
|
| 137 |
+
{
|
| 138 |
+
auto len = wcslen(acid) + 1;
|
| 139 |
+
wchar_t* acidCopy = new wchar_t[len];
|
| 140 |
+
wcscpy_s(acidCopy, len, acid);
|
| 141 |
+
ActivatableID activatableID(acidCopy);
|
| 142 |
+
|
| 143 |
+
ComPtr<IMultiQI> multiQI;
|
| 144 |
+
// In case of OOP component there is possibility of RPC errors
|
| 145 |
+
// that can result in cache poisoning as there is no easy way
|
| 146 |
+
// to detect that the factory encounterd RPC errors.
|
| 147 |
+
// The QI for IMultiQI allows us to identify the proxy stub for OOP component
|
| 148 |
+
if (factory->QueryInterface(__uuidof(::IMultiQI), &multiQI) == S_OK)
|
| 149 |
+
{
|
| 150 |
+
// Insert empty marker to indicate that it's out of proc factory
|
| 151 |
+
return AddFactoryInternal(make_pair(std::move(activatableID), nullptr));
|
| 152 |
+
}
|
| 153 |
+
else
|
| 154 |
+
{
|
| 155 |
+
ComPtr<IUnknown> unk = factory;
|
| 156 |
+
return AddFactoryInternal(make_pair(std::move(activatableID), std::move(unk)));
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
catch (const bad_alloc&)
|
| 160 |
+
{
|
| 161 |
+
return E_OUTOFMEMORY;
|
| 162 |
+
}
|
| 163 |
+
catch (const exception&)
|
| 164 |
+
{
|
| 165 |
+
return E_FAIL;
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// addToCache parameter prevents from adding the factory into the cache
|
| 170 |
+
// this is used for MTA appartment to reduce contention
|
| 171 |
+
HRESULT GetFactory(const wchar_t* acid, Platform::Guid& iid, void** pFactory, bool& addToCache)
|
| 172 |
+
{
|
| 173 |
+
*pFactory = nullptr;
|
| 174 |
+
try
|
| 175 |
+
{
|
| 176 |
+
return GetFactoryInternal(acid, iid, pFactory, addToCache);
|
| 177 |
+
}
|
| 178 |
+
catch (const bad_alloc&)
|
| 179 |
+
{
|
| 180 |
+
return E_OUTOFMEMORY;
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
void __stdcall OnUninitialize(UINT64 apartmentIdentifier);
|
| 185 |
+
};
|
| 186 |
+
|
| 187 |
+
static bool IsMTA()
|
| 188 |
+
{
|
| 189 |
+
APTTYPE AptType;
|
| 190 |
+
APTTYPEQUALIFIER AptQualifier;
|
| 191 |
+
HRESULT hr = CoGetApartmentType(&AptType, &AptQualifier);
|
| 192 |
+
if (SUCCEEDED(hr) && (AptType == APTTYPE::APTTYPE_MTA || AptType == APTTYPE::APTTYPE_NA))
|
| 193 |
+
{
|
| 194 |
+
return true;
|
| 195 |
+
}
|
| 196 |
+
else
|
| 197 |
+
{
|
| 198 |
+
return false;
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
class PerApartmentFactoryCacheMTA : public PerApartmentFactoryCache
|
| 203 |
+
{
|
| 204 |
+
Wrappers::SRWLock _SRWLock;
|
| 205 |
+
protected:
|
| 206 |
+
virtual HRESULT AddFactoryInternal(std::pair<ActivatableID, ComPtr<IUnknown> > &&entry)
|
| 207 |
+
{
|
| 208 |
+
__WRL_ASSERT__(IsMTA());
|
| 209 |
+
|
| 210 |
+
// Lock exclusive on addition so we always make sure that we cache the value
|
| 211 |
+
auto lock = _SRWLock.LockExclusive();
|
| 212 |
+
return PerApartmentFactoryCache::AddFactoryInternal(std::move(entry));
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
virtual HRESULT GetFactoryInternal(const wchar_t* acid, Platform::Guid& iid, void** pFactory, bool& addToCache)
|
| 216 |
+
{
|
| 217 |
+
__WRL_ASSERT__(IsMTA());
|
| 218 |
+
|
| 219 |
+
// If we cannot access cache because of addition or deletion
|
| 220 |
+
// vccorlib will call windows to create new factory
|
| 221 |
+
auto lock = _SRWLock.TryLockShared();
|
| 222 |
+
if (!lock.IsLocked())
|
| 223 |
+
{
|
| 224 |
+
// The lock couldn't be taken so there must be either addition or removal happening
|
| 225 |
+
// in this case we will not try to put the factory to the cache
|
| 226 |
+
addToCache = false;
|
| 227 |
+
return E_FAIL;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
return PerApartmentFactoryCache::GetFactoryInternal(acid, iid, pFactory, addToCache);
|
| 231 |
+
}
|
| 232 |
+
};
|
| 233 |
+
|
| 234 |
+
static HRESULT CreateFactoryCache(PerApartmentFactoryCache** pFactory, UINT64 apartmentID)
|
| 235 |
+
{
|
| 236 |
+
if (IsMTA())
|
| 237 |
+
{
|
| 238 |
+
return MakeAndInitialize<PerApartmentFactoryCacheMTA>(reinterpret_cast<PerApartmentFactoryCacheMTA**>(pFactory), apartmentID);
|
| 239 |
+
}
|
| 240 |
+
else
|
| 241 |
+
{
|
| 242 |
+
return MakeAndInitialize<PerApartmentFactoryCache>(pFactory, apartmentID);
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
class FactoryCache
|
| 247 |
+
{
|
| 248 |
+
vector<pair<UINT64, pair<APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, ComPtr<PerApartmentFactoryCache>>>> perApartmentCache;
|
| 249 |
+
Wrappers::CriticalSection _criticalSection;
|
| 250 |
+
static volatile long _cacheEnabled;
|
| 251 |
+
static volatile long _cacheDestroyed;
|
| 252 |
+
public:
|
| 253 |
+
static void Enable()
|
| 254 |
+
{
|
| 255 |
+
::_InterlockedCompareExchange(&_cacheEnabled, 1, 0);
|
| 256 |
+
}
|
| 257 |
+
static void Disable()
|
| 258 |
+
{
|
| 259 |
+
::_InterlockedCompareExchange(&_cacheEnabled, 0, 1);
|
| 260 |
+
}
|
| 261 |
+
static bool IsEnabled()
|
| 262 |
+
{
|
| 263 |
+
return (_cacheEnabled == 1);
|
| 264 |
+
}
|
| 265 |
+
static bool IsDestroyed()
|
| 266 |
+
{
|
| 267 |
+
return (_cacheDestroyed != 0);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
~FactoryCache()
|
| 271 |
+
{
|
| 272 |
+
Disable();
|
| 273 |
+
::_InterlockedIncrement(&_cacheDestroyed);
|
| 274 |
+
Flush();
|
| 275 |
+
}
|
| 276 |
+
void Flush()
|
| 277 |
+
{
|
| 278 |
+
auto lock = _criticalSection.Lock();
|
| 279 |
+
for(auto it = perApartmentCache.begin(); it != perApartmentCache.end(); it++)
|
| 280 |
+
{
|
| 281 |
+
// Ignore any failures when unregistering cookies as there's nothing else we can do
|
| 282 |
+
(void) ::RoUnregisterForApartmentShutdown(it->second.first);
|
| 283 |
+
|
| 284 |
+
// Leak all per apartment factory cache as during shutdown
|
| 285 |
+
// we may try to release the factories in the wrong context
|
| 286 |
+
it->second.second.Detach();
|
| 287 |
+
}
|
| 288 |
+
perApartmentCache.clear();
|
| 289 |
+
}
|
| 290 |
+
HRESULT GetFactory(LPCWSTR acid, Platform::Guid& iid, void** pFactory)
|
| 291 |
+
{
|
| 292 |
+
UINT64 apartmentID;
|
| 293 |
+
bool addToCache = true;
|
| 294 |
+
|
| 295 |
+
HRESULT hr = ::RoGetApartmentIdentifier(&apartmentID);
|
| 296 |
+
ComPtr<PerApartmentFactoryCache> apartmentCache;
|
| 297 |
+
if (SUCCEEDED(hr) && IsEnabled())
|
| 298 |
+
{
|
| 299 |
+
auto lock = _criticalSection.Lock();
|
| 300 |
+
for(auto it = perApartmentCache.begin(); it != perApartmentCache.end(); it++)
|
| 301 |
+
{
|
| 302 |
+
if (it->first == apartmentID)
|
| 303 |
+
{
|
| 304 |
+
apartmentCache = it->second.second;
|
| 305 |
+
lock.Unlock();
|
| 306 |
+
hr = apartmentCache->GetFactory(acid, iid, pFactory, addToCache);
|
| 307 |
+
if (SUCCEEDED(hr))
|
| 308 |
+
{
|
| 309 |
+
return hr;
|
| 310 |
+
}
|
| 311 |
+
break;
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
if (apartmentCache == nullptr)
|
| 315 |
+
{
|
| 316 |
+
hr = CreateFactoryCache(&apartmentCache, apartmentID);
|
| 317 |
+
if (SUCCEEDED(hr))
|
| 318 |
+
{
|
| 319 |
+
UINT64 regAppartmentId;
|
| 320 |
+
APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie;
|
| 321 |
+
hr = ::RoRegisterForApartmentShutdown(apartmentCache.Get(), ®AppartmentId, ®Cookie);
|
| 322 |
+
if (SUCCEEDED(hr))
|
| 323 |
+
{
|
| 324 |
+
__WRL_ASSERT__(regAppartmentId == apartmentID);
|
| 325 |
+
perApartmentCache.push_back(pair<UINT64,
|
| 326 |
+
pair<APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, ComPtr<PerApartmentFactoryCache>>>
|
| 327 |
+
(apartmentID, pair<APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, ComPtr<PerApartmentFactoryCache>>(regCookie, apartmentCache.Get())));
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// Create Factory
|
| 334 |
+
HSTRING className;
|
| 335 |
+
HSTRING_HEADER classNameHeader;
|
| 336 |
+
hr = ::WindowsCreateStringReference(acid, static_cast<UINT32>(wcslen(acid)), &classNameHeader, &className);
|
| 337 |
+
if (FAILED(hr))
|
| 338 |
+
{
|
| 339 |
+
return hr;
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
ComPtr<IUnknown> factory;
|
| 343 |
+
Platform::Guid riidUnknown(__uuidof(IUnknown));
|
| 344 |
+
hr = __getActivationFactoryByHSTRING(className, riidUnknown, &factory);
|
| 345 |
+
|
| 346 |
+
::WindowsDeleteString(className);
|
| 347 |
+
|
| 348 |
+
if (FAILED(hr))
|
| 349 |
+
{
|
| 350 |
+
return hr;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
if (apartmentCache != nullptr && addToCache)
|
| 354 |
+
{
|
| 355 |
+
apartmentCache->AddFactory(acid, factory.Get());
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
return factory.CopyTo(iid, pFactory);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
void RemoveApartmentCache(UINT64 apartmentIdentifier)
|
| 362 |
+
{
|
| 363 |
+
auto lock = _criticalSection.Lock();
|
| 364 |
+
|
| 365 |
+
for(auto it = perApartmentCache.begin(); it != perApartmentCache.end(); it++)
|
| 366 |
+
{
|
| 367 |
+
if (it->first == apartmentIdentifier)
|
| 368 |
+
{
|
| 369 |
+
perApartmentCache.erase(it);
|
| 370 |
+
break;
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
}
|
| 374 |
+
};
|
| 375 |
+
|
| 376 |
+
volatile long FactoryCache::_cacheEnabled = 0;
|
| 377 |
+
volatile long FactoryCache::_cacheDestroyed = 0;
|
| 378 |
+
FactoryCache g_FactoryCache;
|
| 379 |
+
|
| 380 |
+
void __stdcall PerApartmentFactoryCache::OnUninitialize(UINT64 apartmentIdentifier)
|
| 381 |
+
{
|
| 382 |
+
if (apartmentIdentifier == _apartmentId)
|
| 383 |
+
{
|
| 384 |
+
g_FactoryCache.RemoveApartmentCache(apartmentIdentifier);
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
CPPCLI_FUNC void EnableFactoryCache()
|
| 389 |
+
{
|
| 390 |
+
FactoryCache::Enable();
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
void DisableFactoryCache()
|
| 394 |
+
{
|
| 395 |
+
FactoryCache::Disable();
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
CPPCLI_FUNC void __stdcall FlushFactoryCache()
|
| 399 |
+
{
|
| 400 |
+
if (!FactoryCache::IsDestroyed())
|
| 401 |
+
{
|
| 402 |
+
g_FactoryCache.Flush();
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
CPPCLI_FUNC HRESULT __stdcall GetActivationFactoryByPCWSTR(void* str, ::Platform::Guid& riid, void** ppActivationFactory)
|
| 407 |
+
{
|
| 408 |
+
wchar_t* acid = static_cast<wchar_t*>(str);
|
| 409 |
+
if (!FactoryCache::IsEnabled())
|
| 410 |
+
{
|
| 411 |
+
HSTRING className;
|
| 412 |
+
HSTRING_HEADER classNameHeader;
|
| 413 |
+
HRESULT hr = ::WindowsCreateStringReference(acid, static_cast<UINT32>(wcslen(acid)), &classNameHeader, &className);
|
| 414 |
+
if (SUCCEEDED(hr))
|
| 415 |
+
{
|
| 416 |
+
hr = __getActivationFactoryByHSTRING(className, riid, ppActivationFactory);
|
| 417 |
+
::WindowsDeleteString(className);
|
| 418 |
+
}
|
| 419 |
+
return hr;
|
| 420 |
+
}
|
| 421 |
+
return g_FactoryCache.GetFactory(acid, riid, ppActivationFactory);
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
CPPCLI_FUNC HRESULT __stdcall GetIidsFn(int nIids, unsigned long* iidCount, const __s_GUID* pIids, ::Platform::Guid** ppDuplicated)
|
| 425 |
+
{
|
| 426 |
+
int nBytes = nIids * sizeof(::Platform::Guid);
|
| 427 |
+
|
| 428 |
+
*ppDuplicated = (::Platform::Guid*)CoTaskMemAlloc(nBytes);
|
| 429 |
+
if (*ppDuplicated)
|
| 430 |
+
{
|
| 431 |
+
memcpy(*ppDuplicated, pIids, nBytes);
|
| 432 |
+
*iidCount = nIids;
|
| 433 |
+
return S_OK;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
*iidCount = 0;
|
| 437 |
+
return E_OUTOFMEMORY;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
#include "compiler.cpp"
|
| 441 |
+
#include "activation.cpp"
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
#pragma warning( disable: 4073 ) // initializers put in library initialization area
|
| 445 |
+
#pragma init_seg( lib )
|
| 446 |
+
|
| 447 |
+
#include "ehdata.h"
|
| 448 |
+
extern "C" void __cdecl _SetWinRTOutOfMemoryExceptionCallback(PGETWINRT_OOM_EXCEPTION pCallback);
|
| 449 |
+
|
| 450 |
+
namespace Platform { namespace Details {
|
| 451 |
+
extern bool __abi_firstAlloc;
|
| 452 |
+
extern bool __abi_is_global_oom_init;
|
| 453 |
+
extern void* __abi_oom_controlblock;
|
| 454 |
+
extern IUnknown* __abi_oom_singleton;
|
| 455 |
+
} }
|
| 456 |
+
|
| 457 |
+
void* __stdcall GetOutOfMemoryExceptionCallback()
|
| 458 |
+
{
|
| 459 |
+
Platform::Details::__abi_oom_singleton->AddRef();
|
| 460 |
+
return Platform::Details::__abi_oom_singleton;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
class CInitExceptions
|
| 464 |
+
{
|
| 465 |
+
public:
|
| 466 |
+
CInitExceptions()
|
| 467 |
+
{
|
| 468 |
+
// Ignore the effect on the ref new below on __abi_firstAlloc.
|
| 469 |
+
bool wasFirstAlloc = Platform::Details::__abi_firstAlloc;
|
| 470 |
+
|
| 471 |
+
Platform::Details::__abi_is_global_oom_init = true;
|
| 472 |
+
|
| 473 |
+
// Would take down the process if it throws. This is fine.
|
| 474 |
+
Platform::OutOfMemoryException^ oom = ref new Platform::OutOfMemoryException();
|
| 475 |
+
|
| 476 |
+
Platform::Details::__abi_is_global_oom_init = false;
|
| 477 |
+
|
| 478 |
+
// Recover firstalloc, so that user can set TrackingLevel in main.
|
| 479 |
+
Platform::Details::__abi_firstAlloc = wasFirstAlloc;
|
| 480 |
+
|
| 481 |
+
Platform::Details::__abi_oom_singleton = reinterpret_cast<IUnknown*>(oom);
|
| 482 |
+
Platform::Details::__abi_oom_singleton->AddRef();
|
| 483 |
+
|
| 484 |
+
_SetWinRTOutOfMemoryExceptionCallback(GetOutOfMemoryExceptionCallback);
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
~CInitExceptions()
|
| 488 |
+
{
|
| 489 |
+
_SetWinRTOutOfMemoryExceptionCallback(nullptr);
|
| 490 |
+
Platform::Details::__abi_oom_singleton->Release();
|
| 491 |
+
}
|
| 492 |
+
};
|
| 493 |
+
|
| 494 |
+
CInitExceptions initExceptions;
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/weakreference.cpp
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
|
| 6 |
+
#include "pch.h"
|
| 7 |
+
#pragma hdrstop
|
| 8 |
+
|
| 9 |
+
namespace Platform { namespace Details {
|
| 10 |
+
|
| 11 |
+
VCCORLIB_API void ControlBlock::ReleaseTarget()
|
| 12 |
+
{
|
| 13 |
+
// called by __abi_release after calling the destructor of object
|
| 14 |
+
if (!__bSingleAllocation && __strongRefCount < 0 && __target != nullptr)
|
| 15 |
+
{
|
| 16 |
+
if (__bAlignedAllocation)
|
| 17 |
+
{
|
| 18 |
+
if (__bExceptionAllocation)
|
| 19 |
+
{
|
| 20 |
+
::Platform::Details::Heap::AlignedFreeException(__target);
|
| 21 |
+
}
|
| 22 |
+
else
|
| 23 |
+
{
|
| 24 |
+
::Platform::Details::Heap::AlignedFree(__target);
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
else
|
| 28 |
+
{
|
| 29 |
+
if (__bExceptionAllocation)
|
| 30 |
+
{
|
| 31 |
+
::Platform::Details::Heap::FreeException(__target);
|
| 32 |
+
}
|
| 33 |
+
else
|
| 34 |
+
{
|
| 35 |
+
::Platform::Details::Heap::Free(__target);
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
__target = nullptr;
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
VCCORLIB_API long __stdcall ControlBlock::__abi_Resolve(::Platform::Guid& __riid, __abi_IInspectable ** __objectReference)
|
| 43 |
+
{
|
| 44 |
+
for(;;)
|
| 45 |
+
{
|
| 46 |
+
long __ref = __strongRefCount;
|
| 47 |
+
if (__ref <= 0)
|
| 48 |
+
{
|
| 49 |
+
return 0;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// InterlockedCompareExchange calls _InterlockedCompareExchange intrinsic thus we call directly _InterlockedCompareExchange to save the call
|
| 53 |
+
if (::_InterlockedCompareExchange(&__strongRefCount, __ref + 1, __ref) == __ref)
|
| 54 |
+
{
|
| 55 |
+
break;
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
long __hr = __target->__abi_QueryInterface(__riid, reinterpret_cast<void**>(__objectReference));
|
| 60 |
+
|
| 61 |
+
// Undo the "addref" that happened above during the _InterlockedCompareExchange call
|
| 62 |
+
__target->__abi_Release();
|
| 63 |
+
|
| 64 |
+
return __hr;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// Object has a reference to control block
|
| 68 |
+
VCCORLIB_API void ControlBlock::InitControlBlock(void* __object, bool __bSingleAllocationParam, bool __bAlignedAllocationParam, bool __bExceptionAllocationParam)
|
| 69 |
+
{
|
| 70 |
+
__vtable_initialize(ControlBlock);
|
| 71 |
+
__weakRefCount = 1;
|
| 72 |
+
__strongRefCount = 1;
|
| 73 |
+
__target = reinterpret_cast<__abi_IUnknown*>(__object);
|
| 74 |
+
__bSingleAllocation = __bSingleAllocationParam;
|
| 75 |
+
__bAlignedAllocation = __bAlignedAllocationParam;
|
| 76 |
+
__bExceptionAllocation = __bExceptionAllocationParam;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
#pragma warning(push)
|
| 80 |
+
#pragma warning(disable: 4400)
|
| 81 |
+
VCCORLIB_API __abi_IUnknown* __stdcall GetWeakReference(const volatile Platform::Object^ const other)
|
| 82 |
+
#pragma warning(pop)
|
| 83 |
+
{
|
| 84 |
+
if (other == nullptr)
|
| 85 |
+
{
|
| 86 |
+
throw ref new ::Platform::InvalidArgumentException();
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
Microsoft::WRL::WeakRef ref;
|
| 90 |
+
HRESULT hr = Microsoft::WRL::AsWeak(reinterpret_cast<IUnknown*>(const_cast<Platform::Object^>(other)), &ref);
|
| 91 |
+
__abi_ThrowIfFailed(hr);
|
| 92 |
+
|
| 93 |
+
return reinterpret_cast<__abi_IUnknown*>(ref.Detach());
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
VCCORLIB_API
|
| 97 |
+
__declspec(no_refcount)
|
| 98 |
+
::Platform::Object^ __stdcall ResolveWeakReference(const ::_GUID& guid, __abi_IUnknown** weakRef)
|
| 99 |
+
{
|
| 100 |
+
::Platform::Object ^strongRef = nullptr;
|
| 101 |
+
|
| 102 |
+
if (*weakRef != nullptr)
|
| 103 |
+
{
|
| 104 |
+
Microsoft::WRL::WeakRef *ref = reinterpret_cast<Microsoft::WRL::WeakRef*>(weakRef);
|
| 105 |
+
HRESULT hr = ref->CopyTo(guid, reinterpret_cast<IInspectable**>(&strongRef));
|
| 106 |
+
__abi_ThrowIfFailed(hr);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
return strongRef;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
} } // namesapce Platform::Details
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vccorlib/winmain.cpp
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (C) Microsoft Corporation
|
| 3 |
+
// All rights reserved.
|
| 4 |
+
//
|
| 5 |
+
|
| 6 |
+
#include "pch.h"
|
| 7 |
+
|
| 8 |
+
int __cdecl _main();
|
| 9 |
+
|
| 10 |
+
int CALLBACK WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int)
|
| 11 |
+
{
|
| 12 |
+
return _main();
|
| 13 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ManagedMain.cpp
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ManagedMain.cpp - Initialization for Windows EXE using CRT DLL and managed entry point
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* This is the startup routine for applications using the managed entry
|
| 8 |
+
* point int __clrcall main(array<String^>^).
|
| 9 |
+
* It calls the user's main routine after performing C Run-Time Library initialization.
|
| 10 |
+
*
|
| 11 |
+
*******************************************************************************/
|
| 12 |
+
|
| 13 |
+
#define _MANAGED_MAIN
|
| 14 |
+
|
| 15 |
+
#define WPRFLAG 1 /* Flag used by startup code to indicate wide strings */
|
| 16 |
+
|
| 17 |
+
#ifndef _UNICODE
|
| 18 |
+
#define _UNICODE 1
|
| 19 |
+
#endif /* _UNICODE */
|
| 20 |
+
|
| 21 |
+
#ifndef UNICODE
|
| 22 |
+
#define UNICODE 1
|
| 23 |
+
#endif /* UNICODE */
|
| 24 |
+
|
| 25 |
+
#undef _MBCS /* UNICODE not _MBCS */
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
#include "mcrtexe.cpp"
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/app_appinit.cpp
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// app_appinit.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// This object is part of the import library for the Windows Store app CRT. It
|
| 7 |
+
// coordinates the call to RoInitialize with vccorlib, to ensure that either
|
| 8 |
+
// vccorlib or the CRT (but not both) call RoInitialize. This object is linked
|
| 9 |
+
// into the client app if and only if it does not use vccorlib.
|
| 10 |
+
//
|
| 11 |
+
#include <roapi.h>
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
extern "C" int __crtWinrtInitType = RO_INIT_MULTITHREADED;
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
#pragma detect_mismatch("vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker", "0")
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/argv_mode.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// argv_mode.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Gets the default argv population mode, used during executable startup. This
|
| 7 |
+
// behavior is overridable at link-time by linking with one of the link options.
|
| 8 |
+
//
|
| 9 |
+
#include <vcruntime_startup.h>
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
extern "C" _crt_argv_mode __CRTDECL _get_startup_argv_mode()
|
| 14 |
+
{
|
| 15 |
+
return _crt_argv_unexpanded_arguments;
|
| 16 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/c11_atomic_support.c
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 2 |
+
//
|
| 3 |
+
// C11 atomic support routines: extern inline definitions
|
| 4 |
+
#include <vcruntime_c11_atomic_support.h>
|
| 5 |
+
|
| 6 |
+
extern inline void _Check_memory_order(const unsigned int _Order);
|
| 7 |
+
extern inline void _Atomic_thread_fence(const unsigned int _Order);
|
| 8 |
+
|
| 9 |
+
extern inline void _Atomic_lock_acquire(volatile long* _Spinlock);
|
| 10 |
+
extern inline void _Atomic_lock_release(volatile long* _Spinlock);
|
| 11 |
+
|
| 12 |
+
extern inline void _Atomic_signal_fence(int _Order);
|
| 13 |
+
extern inline _Bool _Atomic_is_lock_free(size_t _Sz);
|
| 14 |
+
|
| 15 |
+
extern inline void _Atomic_store8(volatile char* _Ptr, char _Desired, int _Order);
|
| 16 |
+
extern inline void _Atomic_store16(volatile short* _Ptr, short _Desired, int _Order);
|
| 17 |
+
extern inline void _Atomic_store32(volatile int* _Ptr, int _Desired, int _Order);
|
| 18 |
+
extern inline void _Atomic_store64(volatile long long* _Ptr, long long _Desired, int _Order);
|
| 19 |
+
extern inline void _Atomic_storef(volatile float* _Ptr, float _Desired, int _Order);
|
| 20 |
+
extern inline void _Atomic_stored(volatile double* _Ptr, double _Desired, int _Order);
|
| 21 |
+
|
| 22 |
+
extern inline char _Atomic_load8(const volatile char* _Ptr, int _Order);
|
| 23 |
+
extern inline short _Atomic_load16(const volatile short* _Ptr, int _Order);
|
| 24 |
+
extern inline int _Atomic_load32(const volatile int* _Ptr, int _Order);
|
| 25 |
+
extern inline long long _Atomic_load64(const volatile long long* _Ptr, int _Order);
|
| 26 |
+
extern inline float _Atomic_loadf(const volatile float* _Ptr, int _Order);
|
| 27 |
+
extern inline double _Atomic_loadd(const volatile double* _Ptr, int _Order);
|
| 28 |
+
|
| 29 |
+
extern inline _Bool _Atomic_compare_exchange_strong8(volatile char* _Ptr, char* _Expected, char _Desired, int _Order);
|
| 30 |
+
extern inline _Bool _Atomic_compare_exchange_strong16(
|
| 31 |
+
volatile short* _Ptr, short* _Expected, short _Desired, int _Order);
|
| 32 |
+
extern inline _Bool _Atomic_compare_exchange_strong32(volatile int* _Ptr, int* _Expected, int _Desired, int _Order);
|
| 33 |
+
extern inline _Bool _Atomic_compare_exchange_strong64(
|
| 34 |
+
volatile long long* _Ptr, long long* _Expected, long long _Desired, int _Order);
|
| 35 |
+
extern inline _Bool _Atomic_compare_exchange_strongf(volatile float* _Ptr, float* _Expected, float _Desired, int _Order);
|
| 36 |
+
extern inline _Bool _Atomic_compare_exchange_strongd(
|
| 37 |
+
volatile double* _Ptr, double* _Expected, double _Desired, int _Order);
|
| 38 |
+
|
| 39 |
+
extern inline char _Atomic_exchange8(volatile char* _Ptr, int _Desired, int _Order);
|
| 40 |
+
extern inline short _Atomic_exchange16(volatile short* _Ptr, int _Desired, int _Order);
|
| 41 |
+
extern inline int _Atomic_exchange32(volatile int* _Ptr, int _Desired, int _Order);
|
| 42 |
+
extern inline long long _Atomic_exchange64(volatile long long* _Ptr, long long _Desired, int _Order);
|
| 43 |
+
extern inline float _Atomic_exchangef(volatile float* _Ptr, float _Desired, int _Order);
|
| 44 |
+
extern inline double _Atomic_exchanged(volatile double* _Ptr, double _Desired, int _Order);
|
| 45 |
+
|
| 46 |
+
extern inline char _Atomic_fetch_add8(volatile char* _Ptr, int val, int _Order);
|
| 47 |
+
extern inline short _Atomic_fetch_add16(volatile short* _Ptr, int val, int _Order);
|
| 48 |
+
extern inline int _Atomic_fetch_add32(volatile int* _Ptr, int val, int _Order);
|
| 49 |
+
extern inline long long _Atomic_fetch_add64(volatile long long* _Ptr, long long val, int _Order);
|
| 50 |
+
extern inline float _Atomic_fetch_addf(volatile float* _Ptr, float val, int _Order);
|
| 51 |
+
extern inline double _Atomic_fetch_addd(volatile double* _Ptr, double val, int _Order);
|
| 52 |
+
|
| 53 |
+
extern inline char _Atomic_add_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 54 |
+
extern inline short _Atomic_add_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 55 |
+
extern inline int _Atomic_add_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 56 |
+
extern inline long long _Atomic_add_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 57 |
+
extern inline float _Atomic_add_fetchf(volatile float* _Ptr, float val, int _Order);
|
| 58 |
+
extern inline double _Atomic_add_fetchd(volatile double* _Ptr, double val, int _Order);
|
| 59 |
+
|
| 60 |
+
extern inline char _Atomic_fetch_sub8(volatile char* _Ptr, int val, int _Order);
|
| 61 |
+
extern inline short _Atomic_fetch_sub16(volatile short* _Ptr, int val, int _Order);
|
| 62 |
+
extern inline int _Atomic_fetch_sub32(volatile int* _Ptr, int val, int _Order);
|
| 63 |
+
extern inline long long _Atomic_fetch_sub64(volatile long long* _Ptr, long long val, int _Order);
|
| 64 |
+
extern inline float _Atomic_fetch_subf(volatile float* _Ptr, float val, int _Order);
|
| 65 |
+
extern inline double _Atomic_fetch_subd(volatile double* _Ptr, double val, int _Order);
|
| 66 |
+
|
| 67 |
+
extern inline char _Atomic_sub_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 68 |
+
extern inline short _Atomic_sub_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 69 |
+
extern inline int _Atomic_sub_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 70 |
+
extern inline long long _Atomic_sub_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 71 |
+
extern inline float _Atomic_sub_fetchf(volatile float* _Ptr, float val, int _Order);
|
| 72 |
+
extern inline double _Atomic_sub_fetchd(volatile double* _Ptr, double val, int _Order);
|
| 73 |
+
|
| 74 |
+
extern inline char _Atomic_fetch_and8(volatile char* _Ptr, int val, int _Order);
|
| 75 |
+
extern inline short _Atomic_fetch_and16(volatile short* _Ptr, int val, int _Order);
|
| 76 |
+
extern inline int _Atomic_fetch_and32(volatile int* _Ptr, int val, int _Order);
|
| 77 |
+
extern inline long long _Atomic_fetch_and64(volatile long long* _Ptr, long long val, int _Order);
|
| 78 |
+
|
| 79 |
+
extern inline char _Atomic_and_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 80 |
+
extern inline short _Atomic_and_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 81 |
+
extern inline int _Atomic_and_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 82 |
+
extern inline long long _Atomic_and_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 83 |
+
|
| 84 |
+
extern inline char _Atomic_fetch_or8(volatile char* _Ptr, int val, int _Order);
|
| 85 |
+
extern inline short _Atomic_fetch_or16(volatile short* _Ptr, int val, int _Order);
|
| 86 |
+
extern inline int _Atomic_fetch_or32(volatile int* _Ptr, int val, int _Order);
|
| 87 |
+
extern inline long long _Atomic_fetch_or64(volatile long long* _Ptr, long long val, int _Order);
|
| 88 |
+
|
| 89 |
+
extern inline char _Atomic_or_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 90 |
+
extern inline short _Atomic_or_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 91 |
+
extern inline int _Atomic_or_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 92 |
+
extern inline long long _Atomic_or_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 93 |
+
|
| 94 |
+
extern inline char _Atomic_fetch_xor8(volatile char* _Ptr, int val, int _Order);
|
| 95 |
+
extern inline short _Atomic_fetch_xor16(volatile short* _Ptr, int val, int _Order);
|
| 96 |
+
extern inline int _Atomic_fetch_xor32(volatile int* _Ptr, int val, int _Order);
|
| 97 |
+
extern inline long long _Atomic_fetch_xor64(volatile long long* _Ptr, long long val, int _Order);
|
| 98 |
+
|
| 99 |
+
extern inline char _Atomic_xor_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 100 |
+
extern inline short _Atomic_xor_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 101 |
+
extern inline int _Atomic_xor_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 102 |
+
extern inline long long _Atomic_xor_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 103 |
+
|
| 104 |
+
extern inline char _Atomic_mult_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 105 |
+
extern inline short _Atomic_mult_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 106 |
+
extern inline int _Atomic_mult_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 107 |
+
extern inline long long _Atomic_mult_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 108 |
+
extern inline float _Atomic_mult_fetchf(volatile float* _Ptr, float val, int _Order);
|
| 109 |
+
extern inline double _Atomic_mult_fetchd(volatile double* _Ptr, double val, int _Order);
|
| 110 |
+
|
| 111 |
+
extern inline unsigned char _Atomic_div_fetch8(volatile unsigned char* _Ptr, unsigned int val, int _Order);
|
| 112 |
+
extern inline unsigned short _Atomic_div_fetch16(volatile unsigned short* _Ptr, unsigned int val, int _Order);
|
| 113 |
+
extern inline unsigned int _Atomic_div_fetch32(volatile unsigned int* _Ptr, unsigned int val, int _Order);
|
| 114 |
+
extern inline unsigned long long _Atomic_div_fetch64(
|
| 115 |
+
volatile unsigned long long* _Ptr, unsigned long long val, int _Order);
|
| 116 |
+
extern inline float _Atomic_div_fetchf(volatile float* _Ptr, float val, int _Order);
|
| 117 |
+
extern inline double _Atomic_div_fetchd(volatile double* _Ptr, double val, int _Order);
|
| 118 |
+
|
| 119 |
+
extern inline signed char _Atomic_idiv_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 120 |
+
extern inline short _Atomic_idiv_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 121 |
+
extern inline int _Atomic_idiv_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 122 |
+
extern inline long long _Atomic_idiv_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 123 |
+
|
| 124 |
+
extern inline char _Atomic_shl_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 125 |
+
extern inline short _Atomic_shl_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 126 |
+
extern inline int _Atomic_shl_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 127 |
+
extern inline long long _Atomic_shl_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 128 |
+
|
| 129 |
+
extern inline char _Atomic_shr_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 130 |
+
extern inline short _Atomic_shr_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 131 |
+
extern inline int _Atomic_shr_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 132 |
+
extern inline long long _Atomic_shr_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 133 |
+
|
| 134 |
+
extern inline signed char _Atomic_imod_fetch8(volatile char* _Ptr, int val, int _Order);
|
| 135 |
+
extern inline short _Atomic_imod_fetch16(volatile short* _Ptr, int val, int _Order);
|
| 136 |
+
extern inline int _Atomic_imod_fetch32(volatile int* _Ptr, int val, int _Order);
|
| 137 |
+
extern inline long long _Atomic_imod_fetch64(volatile long long* _Ptr, long long val, int _Order);
|
| 138 |
+
|
| 139 |
+
extern inline unsigned char _Atomic_mod_fetch8(volatile unsigned char* _Ptr, unsigned int val, int _Order);
|
| 140 |
+
extern inline unsigned short _Atomic_mod_fetch16(volatile unsigned short* _Ptr, unsigned int val, int _Order);
|
| 141 |
+
extern inline unsigned int _Atomic_mod_fetch32(volatile unsigned int* _Ptr, unsigned int val, int _Order);
|
| 142 |
+
extern inline unsigned long long _Atomic_mod_fetch64(
|
| 143 |
+
volatile unsigned long long* _Ptr, unsigned long long val, int _Order);
|
| 144 |
+
|
| 145 |
+
extern inline void _Atomic_lock_and_store(volatile void* _Obj, const void* _Desired, int _Offset, size_t _Size);
|
| 146 |
+
extern inline void _Atomic_lock_and_load(volatile void* _Obj, void* _Dest, int _Offset, size_t _Size);
|
| 147 |
+
extern inline void _Atomic_lock_and_exchange(
|
| 148 |
+
volatile void* _Obj, const void* _Desired, void* _Dest, int _Offset, size_t _Size);
|
| 149 |
+
extern inline _Bool _Atomic_lock_and_compare_exchange_strong(
|
| 150 |
+
volatile void* _Obj, void* _Expected, const void* _Desired, int _Offset, size_t _Size);
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/checkcfg.c
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*checkcfg.c - logic and globals to support the Guard security feature
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* Define the globals and default check routine for the Guard security
|
| 8 |
+
* feature.
|
| 9 |
+
*
|
| 10 |
+
* N.B. Code and data declared by this module must be in the form of
|
| 11 |
+
* selectany COMDATs, so that duplicate definitions between the
|
| 12 |
+
* CRT and no_cfg_support are permitted for the restricted use
|
| 13 |
+
* cases of the no_cfg_support module.
|
| 14 |
+
*
|
| 15 |
+
*******************************************************************************/
|
| 16 |
+
|
| 17 |
+
#if defined(_M_ARM64) || defined(_M_ARM64EC)
|
| 18 |
+
// the codegen from the C version of this breaks ABI on ARM64
|
| 19 |
+
#error "This file should not be built on ARM64"
|
| 20 |
+
#endif
|
| 21 |
+
|
| 22 |
+
#include <vcruntime_internal.h>
|
| 23 |
+
|
| 24 |
+
extern PVOID __guard_check_icall_fptr;
|
| 25 |
+
|
| 26 |
+
typedef
|
| 27 |
+
void
|
| 28 |
+
(__fastcall *GUARDCF_CHECK_ROUTINE) (
|
| 29 |
+
uintptr_t Target
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
#pragma warning(suppress: 4918) // 'y' is not necessarily supported on all architectures
|
| 33 |
+
BEGIN_PRAGMA_OPTIMIZE_ENABLE("y", DevDivVSO:162582, "Required to avoid poor codegen")
|
| 34 |
+
|
| 35 |
+
extern
|
| 36 |
+
__declspec(guard(ignore))
|
| 37 |
+
__inline
|
| 38 |
+
void
|
| 39 |
+
__fastcall
|
| 40 |
+
_guard_check_icall (
|
| 41 |
+
_In_ uintptr_t Target
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
/*++
|
| 45 |
+
|
| 46 |
+
Routine Description:
|
| 47 |
+
|
| 48 |
+
This function performs an ICall check when invoked by the compiler to
|
| 49 |
+
check the integrity of a function pointer for Control Flow Guard (/guard).
|
| 50 |
+
|
| 51 |
+
N.B. This function is only retained for compatibility with pre-17.1 LKG4
|
| 52 |
+
compilers that do not directly invoke through the
|
| 53 |
+
__guard_check_icall_fptr function pointer.
|
| 54 |
+
|
| 55 |
+
Arguments:
|
| 56 |
+
|
| 57 |
+
Target - Supplies the function pointer to check.
|
| 58 |
+
|
| 59 |
+
Return Value:
|
| 60 |
+
|
| 61 |
+
None. If the function pointer supplied was invalid, then a fast fail event
|
| 62 |
+
or an access violation is raised.
|
| 63 |
+
|
| 64 |
+
--*/
|
| 65 |
+
|
| 66 |
+
{
|
| 67 |
+
|
| 68 |
+
((GUARDCF_CHECK_ROUTINE)__guard_check_icall_fptr)(Target);
|
| 69 |
+
return;
|
| 70 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/commit_mode.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// commit_mode.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Gets the default commit mode, used during executable startup. This behavior
|
| 7 |
+
// is overridable at link-time by linking with one of the link options.
|
| 8 |
+
//
|
| 9 |
+
#include <vcruntime.h>
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
extern "C" int __CRTDECL _get_startup_commit_mode()
|
| 14 |
+
{
|
| 15 |
+
return 0; // No commit
|
| 16 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/debugger_jmc.c
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*debugger_jmc.c
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* Define the helper function for VS debugger Just My Code stepping feature.
|
| 8 |
+
*
|
| 9 |
+
*******************************************************************************/
|
| 10 |
+
|
| 11 |
+
#include <Windows.h>
|
| 12 |
+
#include <intrin.h>
|
| 13 |
+
|
| 14 |
+
#pragma warning( disable : 4102 )
|
| 15 |
+
#pragma warning( disable : 4189 )
|
| 16 |
+
|
| 17 |
+
#pragma optimize( "", off )
|
| 18 |
+
|
| 19 |
+
__declspec(selectany) DWORD __DebuggerCurrentSteppingThreadId;
|
| 20 |
+
|
| 21 |
+
void __fastcall __CheckForDebuggerJustMyCode(unsigned char *JMC_flag)
|
| 22 |
+
{
|
| 23 |
+
unsigned char *__DebuggerLocalJMCFlag = JMC_flag;
|
| 24 |
+
|
| 25 |
+
if (*JMC_flag && __DebuggerCurrentSteppingThreadId != 0 && __DebuggerCurrentSteppingThreadId == GetCurrentThreadId()) {
|
| 26 |
+
NopLabel:
|
| 27 |
+
__nop();
|
| 28 |
+
}
|
| 29 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/default_precision.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// default_precision.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Initializes the floating point precision to the default state. This behavior
|
| 7 |
+
// is overridable at link-time by linking with one of the link options.
|
| 8 |
+
//
|
| 9 |
+
#ifndef _M_IX86
|
| 10 |
+
#error This file may only be built for x86
|
| 11 |
+
#endif
|
| 12 |
+
|
| 13 |
+
#include <float.h>
|
| 14 |
+
#include <vcstartup_internal.h>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
extern "C" void __CRTDECL _initialize_default_precision()
|
| 19 |
+
{
|
| 20 |
+
if (_controlfp_s(nullptr, _PC_53, _MCW_PC) != 0)
|
| 21 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 22 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array.cpp
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
////////////////////////////////////////////////////////////////
|
| 12 |
+
// delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------+
|
| 15 |
+
// |delete_scalar<----+-----------------------+
|
| 16 |
+
// +--^----------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 19 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 20 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +-------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------+ +------+-------------+
|
| 25 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 26 |
+
// +-----------------+ +--------------------+
|
| 27 |
+
|
| 28 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 29 |
+
void __CRTDECL operator delete[](void* const block) noexcept
|
| 30 |
+
{
|
| 31 |
+
operator delete(block);
|
| 32 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_align.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array_align.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete, align_val_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 12 |
+
// Aligned delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------------+
|
| 15 |
+
// |delete_scalar_align<----+---------------------------+
|
| 16 |
+
// +--^----------------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 19 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 20 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +------------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------------+ +------+-------------------+
|
| 25 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 26 |
+
// +-----------------------+ +--------------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete[](void* const block, std::align_val_t const al) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete(block, al);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_align_nothrow.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array_align_nothrow.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete, align_val_t and nothrow_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 12 |
+
// Aligned delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------------+
|
| 15 |
+
// |delete_scalar_align<----+---------------------------+
|
| 16 |
+
// +--^----------------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 19 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 20 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +------------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------------+ +------+-------------------+
|
| 25 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 26 |
+
// +-----------------------+ +--------------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete[](void* const block, std::align_val_t const al, std::nothrow_t const&) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete[](block, al);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_nothrow.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array_nothrow.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete, nothrow_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
////////////////////////////////////////////////////////////////
|
| 12 |
+
// delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------+
|
| 15 |
+
// |delete_scalar<----+-----------------------+
|
| 16 |
+
// +--^----------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 19 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 20 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +-------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------+ +------+-------------+
|
| 25 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 26 |
+
// +-----------------+ +--------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete[](void* const block, std::nothrow_t const&) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete[](block);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_size.cpp
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array_size.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete, size_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
////////////////////////////////////////////////////////////////
|
| 12 |
+
// delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------+
|
| 15 |
+
// |delete_scalar<----+-----------------------+
|
| 16 |
+
// +--^----------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 19 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 20 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +-------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------+ +------+-------------+
|
| 25 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 26 |
+
// +-----------------+ +--------------------+
|
| 27 |
+
|
| 28 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 29 |
+
void __CRTDECL operator delete[](void* const block, size_t const) noexcept
|
| 30 |
+
{
|
| 31 |
+
operator delete[](block);
|
| 32 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_array_size_align.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_array_size_align.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the array operator delete, size_t and align_val_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 12 |
+
// Aligned delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------------+
|
| 15 |
+
// |delete_scalar_align<----+---------------------------+
|
| 16 |
+
// +--^----------------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 19 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 20 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +------------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------------+ +------+-------------------+
|
| 25 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 26 |
+
// +-----------------------+ +--------------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete[](void* const block, size_t const, std::align_val_t const al) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete[](block, al);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_debug.cpp
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_debug.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the debug operator delete (both scalar and array forms).
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
#ifdef _DEBUG
|
| 14 |
+
|
| 15 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 16 |
+
void __CRTDECL operator delete(
|
| 17 |
+
void* block,
|
| 18 |
+
int const block_use,
|
| 19 |
+
char const* file_name,
|
| 20 |
+
int const line_number
|
| 21 |
+
) noexcept
|
| 22 |
+
{
|
| 23 |
+
UNREFERENCED_PARAMETER(file_name);
|
| 24 |
+
UNREFERENCED_PARAMETER(line_number);
|
| 25 |
+
|
| 26 |
+
_free_dbg(block, block_use);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 30 |
+
void __CRTDECL operator delete[](
|
| 31 |
+
void* block,
|
| 32 |
+
int const block_use,
|
| 33 |
+
char const* file_name,
|
| 34 |
+
int const line_number
|
| 35 |
+
) noexcept
|
| 36 |
+
{
|
| 37 |
+
return operator delete(block, block_use, file_name, line_number);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
#else // ^^^ _DEBUG ^^^ // vvv !_DEBUG vvv //
|
| 41 |
+
|
| 42 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 43 |
+
void __CRTDECL operator delete(
|
| 44 |
+
void* block,
|
| 45 |
+
int const block_use,
|
| 46 |
+
char const* file_name,
|
| 47 |
+
int const line_number
|
| 48 |
+
) noexcept
|
| 49 |
+
{
|
| 50 |
+
UNREFERENCED_PARAMETER(block_use);
|
| 51 |
+
UNREFERENCED_PARAMETER(file_name);
|
| 52 |
+
UNREFERENCED_PARAMETER(line_number);
|
| 53 |
+
|
| 54 |
+
return operator delete(block);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 58 |
+
void __CRTDECL operator delete[](
|
| 59 |
+
void* block,
|
| 60 |
+
int const block_use,
|
| 61 |
+
char const* file_name,
|
| 62 |
+
int const line_number
|
| 63 |
+
) noexcept
|
| 64 |
+
{
|
| 65 |
+
UNREFERENCED_PARAMETER(block_use);
|
| 66 |
+
UNREFERENCED_PARAMETER(file_name);
|
| 67 |
+
UNREFERENCED_PARAMETER(line_number);
|
| 68 |
+
|
| 69 |
+
return operator delete[](block);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
#endif
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar.cpp
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete.
|
| 7 |
+
//
|
| 8 |
+
#include <crtdbg.h>
|
| 9 |
+
#include <malloc.h>
|
| 10 |
+
#include <vcruntime_new.h>
|
| 11 |
+
#include <vcstartup_internal.h>
|
| 12 |
+
|
| 13 |
+
////////////////////////////////////////////////////////////////
|
| 14 |
+
// delete() Fallback Ordering
|
| 15 |
+
//
|
| 16 |
+
// +-------------+
|
| 17 |
+
// |delete_scalar<----+-----------------------+
|
| 18 |
+
// +--^----------+ | |
|
| 19 |
+
// | | |
|
| 20 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 21 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 22 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// | +-------------------+
|
| 25 |
+
// | |
|
| 26 |
+
// +--+--------------+ +------+-------------+
|
| 27 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 28 |
+
// +-----------------+ +--------------------+
|
| 29 |
+
|
| 30 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 31 |
+
void __CRTDECL operator delete(void* const block) noexcept
|
| 32 |
+
{
|
| 33 |
+
#ifdef _DEBUG
|
| 34 |
+
_free_dbg(block, _UNKNOWN_BLOCK);
|
| 35 |
+
#else
|
| 36 |
+
free(block);
|
| 37 |
+
#endif
|
| 38 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_align.cpp
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar_align.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete, align_val_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <malloc.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
#include <vcstartup_internal.h>
|
| 11 |
+
|
| 12 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 13 |
+
// Aligned delete() Fallback Ordering
|
| 14 |
+
//
|
| 15 |
+
// +-------------------+
|
| 16 |
+
// |delete_scalar_align<----+---------------------------+
|
| 17 |
+
// +--^----------------+ | |
|
| 18 |
+
// | | |
|
| 19 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 20 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 21 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 22 |
+
// | |
|
| 23 |
+
// | +------------------------+
|
| 24 |
+
// | |
|
| 25 |
+
// +--+--------------------+ +------+-------------------+
|
| 26 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 27 |
+
// +-----------------------+ +--------------------------+
|
| 28 |
+
|
| 29 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 30 |
+
void __CRTDECL operator delete(void* const block, std::align_val_t const) noexcept
|
| 31 |
+
{
|
| 32 |
+
_aligned_free(block);
|
| 33 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_align_nothrow.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar_align_nothrow.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete, align_val_t and nothrow_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 12 |
+
// Aligned delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------------+
|
| 15 |
+
// |delete_scalar_align<----+---------------------------+
|
| 16 |
+
// +--^----------------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 19 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 20 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +------------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------------+ +------+-------------------+
|
| 25 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 26 |
+
// +-----------------------+ +--------------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete(void* const block, std::align_val_t const al, std::nothrow_t const&) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete(block, al);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_nothrow.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar_nothrow.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete, nothrow_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
////////////////////////////////////////////////////////////////
|
| 12 |
+
// delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------+
|
| 15 |
+
// |delete_scalar<----+-----------------------+
|
| 16 |
+
// +--^----------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 19 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 20 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +-------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------+ +------+-------------+
|
| 25 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 26 |
+
// +-----------------+ +--------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete(void* const block, std::nothrow_t const&) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete(block);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_size.cpp
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar_size.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete, size_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
////////////////////////////////////////////////////////////////
|
| 12 |
+
// delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------+
|
| 15 |
+
// |delete_scalar<----+-----------------------+
|
| 16 |
+
// +--^----------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------+ +--+---------------+ +----+----------------+
|
| 19 |
+
// |delete_array| |delete_scalar_size| |delete_scalar_nothrow|
|
| 20 |
+
// +--^----^----+ +------------------+ +---------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +-------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------+ +------+-------------+
|
| 25 |
+
// |delete_array_size| |delete_array_nothrow|
|
| 26 |
+
// +-----------------+ +--------------------+
|
| 27 |
+
|
| 28 |
+
_CRT_SECURITYCRITICAL_ATTRIBUTE
|
| 29 |
+
void __CRTDECL operator delete(void* const block, size_t const) noexcept
|
| 30 |
+
{
|
| 31 |
+
operator delete(block);
|
| 32 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/delete_scalar_size_align.cpp
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// delete_scalar_size_align.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Defines the scalar operator delete, size_t and align_val_t overload.
|
| 7 |
+
//
|
| 8 |
+
#include <vcruntime_internal.h>
|
| 9 |
+
#include <vcruntime_new.h>
|
| 10 |
+
|
| 11 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 12 |
+
// Aligned delete() Fallback Ordering
|
| 13 |
+
//
|
| 14 |
+
// +-------------------+
|
| 15 |
+
// |delete_scalar_align<----+---------------------------+
|
| 16 |
+
// +--^----------------+ | |
|
| 17 |
+
// | | |
|
| 18 |
+
// +--+---------------+ +--+---------------------+ +--+------------------------+
|
| 19 |
+
// |delete_array_align| |delete_scalar_size_align| |delete_scalar_align_nothrow|
|
| 20 |
+
// +--^-----^---------+ +------------------------+ +---------------------------+
|
| 21 |
+
// | |
|
| 22 |
+
// | +------------------------+
|
| 23 |
+
// | |
|
| 24 |
+
// +--+--------------------+ +------+-------------------+
|
| 25 |
+
// |delete_array_size_align| |delete_array_align_nothrow|
|
| 26 |
+
// +-----------------------+ +--------------------------+
|
| 27 |
+
|
| 28 |
+
void __CRTDECL operator delete(void* const block, size_t const, std::align_val_t const al) noexcept
|
| 29 |
+
{
|
| 30 |
+
operator delete(block, al);
|
| 31 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/denormal_control.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// denormal_control.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Initializes the denormal mode to the default state. This behavior is
|
| 7 |
+
// overridable at link-time by linking with one of the link options.
|
| 8 |
+
//
|
| 9 |
+
#include <vcruntime.h>
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
extern "C" void __CRTDECL _initialize_denormal_control()
|
| 14 |
+
{
|
| 15 |
+
// No-op
|
| 16 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dll_dllmain.cpp
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// dll_dllmain.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The DLL entry point that initializes the DLL and calls the client-defined
|
| 7 |
+
// DllMain entry point.
|
| 8 |
+
//
|
| 9 |
+
#include <vcstartup_internal.h>
|
| 10 |
+
#include <vcruntime_internal.h>
|
| 11 |
+
#include <rtcapi.h>
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
// The client may define a _pRawDllMain. This function gets called for attach
|
| 16 |
+
// notifications before any other function is called, and gets called for detach
|
| 17 |
+
// notifications after any other function is called. If no _pRawDllMain is
|
| 18 |
+
// defined, it is aliased to the no-op _pDefaultRawDllMain.
|
| 19 |
+
extern "C" extern __scrt_dllmain_type const _pRawDllMain;
|
| 20 |
+
extern "C" extern __scrt_dllmain_type const _pDefaultRawDllMain = nullptr;
|
| 21 |
+
_VCRT_DECLARE_ALTERNATE_NAME_DATA(_pRawDllMain, _pDefaultRawDllMain)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// This flag is incremented each time DLL_PROCESS_ATTACH is processed successfully
|
| 26 |
+
// and is decremented each time DLL_PROCESS_DETACH is processed (the detach is
|
| 27 |
+
// always assumed to complete successfully).
|
| 28 |
+
static int __proc_attached = 0;
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
static BOOL __cdecl dllmain_crt_process_attach(HMODULE const instance,
|
| 33 |
+
LPVOID const reserved)
|
| 34 |
+
{
|
| 35 |
+
if (!__scrt_initialize_crt(__scrt_module_type::dll))
|
| 36 |
+
return FALSE;
|
| 37 |
+
|
| 38 |
+
bool const is_nested = __scrt_acquire_startup_lock();
|
| 39 |
+
bool fail = true;
|
| 40 |
+
__try
|
| 41 |
+
{
|
| 42 |
+
if (__scrt_current_native_startup_state != __scrt_native_startup_state::uninitialized)
|
| 43 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 44 |
+
|
| 45 |
+
__scrt_current_native_startup_state = __scrt_native_startup_state::initializing;
|
| 46 |
+
|
| 47 |
+
if (!__scrt_dllmain_before_initialize_c())
|
| 48 |
+
__leave;
|
| 49 |
+
|
| 50 |
+
#ifdef _RTC
|
| 51 |
+
_RTC_Initialize();
|
| 52 |
+
#endif
|
| 53 |
+
|
| 54 |
+
__scrt_initialize_type_info();
|
| 55 |
+
|
| 56 |
+
__scrt_initialize_default_local_stdio_options();
|
| 57 |
+
|
| 58 |
+
if (_initterm_e(__xi_a, __xi_z) != 0)
|
| 59 |
+
__leave;
|
| 60 |
+
|
| 61 |
+
if (!__scrt_dllmain_after_initialize_c())
|
| 62 |
+
__leave;
|
| 63 |
+
|
| 64 |
+
_initterm(__xc_a, __xc_z);
|
| 65 |
+
|
| 66 |
+
__scrt_current_native_startup_state = __scrt_native_startup_state::initialized;
|
| 67 |
+
fail = false;
|
| 68 |
+
}
|
| 69 |
+
__finally
|
| 70 |
+
{
|
| 71 |
+
__scrt_release_startup_lock(is_nested);
|
| 72 |
+
}
|
| 73 |
+
if (fail)
|
| 74 |
+
return FALSE;
|
| 75 |
+
|
| 76 |
+
// If we have any dynamically initialized __declspec(thread) variables, we
|
| 77 |
+
// invoke their initialization for the thread on which the DLL is being
|
| 78 |
+
// loaded. We cannot rely on the OS performing the initialization with the
|
| 79 |
+
// DLL_PROCESS_ATTACH notification because, on Windows Server 2003 and below,
|
| 80 |
+
// that call happens before the CRT is initialized.
|
| 81 |
+
PIMAGE_TLS_CALLBACK const* const tls_init_callback = __scrt_get_dyn_tls_init_callback();
|
| 82 |
+
if (*tls_init_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_init_callback))
|
| 83 |
+
{
|
| 84 |
+
(*tls_init_callback)(instance, DLL_THREAD_ATTACH, reserved);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
++__proc_attached;
|
| 88 |
+
return TRUE;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
// clang-format off
|
| 92 |
+
//
|
| 93 |
+
// DLL Uninitialization of the CRT
|
| 94 |
+
//
|
| 95 |
+
// +----------------------+
|
| 96 |
+
// | UserEXE!main returns |
|
| 97 |
+
// +--------+-------------+
|
| 98 |
+
// |
|
| 99 |
+
// +--------v-----------------------+
|
| 100 |
+
// | ExitProcess/LdrShutdownProcess |
|
| 101 |
+
// +--------+-----------------------+
|
| 102 |
+
// |
|
| 103 |
+
// +--------v--------+
|
| 104 |
+
// | UserDLL!DLLMain |
|
| 105 |
+
// +--------+--------+
|
| 106 |
+
// |
|
| 107 |
+
// +--------v----------------------------------------------+
|
| 108 |
+
// | UserDLL!dllmain_crt_process_detach | +-----------------------------+
|
| 109 |
+
// | +-----------------> UCRT _cexit() |
|
| 110 |
+
// | + Startup Lock +-------------------+ | | | |
|
| 111 |
+
// | | | | | | Run onexit table |
|
| 112 |
+
// | | __scrt_dllmain_uninitialize_c() | | | | Run XP* and XT* terminators |
|
| 113 |
+
// | | /MD: Run onexit table | | | | |
|
| 114 |
+
// | | /MT: _cexit() +-------------------------+ | +-----------------------------+
|
| 115 |
+
// | | | |
|
| 116 |
+
// | | | | +---------------------------------------------+
|
| 117 |
+
// | | __scrt_uninitialize_type_info() | | +---> UCRT Uninitializer Order |
|
| 118 |
+
// | | | | | | (__acrt_uninitialize) |
|
| 119 |
+
// | | _RTC_Terminate() | | | | |
|
| 120 |
+
// | | Run RTC terminators | | | | Release when terminating: |
|
| 121 |
+
// | | | | | | _flushall() |
|
| 122 |
+
// | +----------------------------------+ | | | |
|
| 123 |
+
// | | | | Debug (always), Release unless terminating: |
|
| 124 |
+
// | __scrt_uninitialize_crt() | | | uninitialize_c() |
|
| 125 |
+
// | /MT: __acrt_uninitialize() + __vcrt_uninitialize() +-----+ | uninitialize_environment() |
|
| 126 |
+
// | /MD: no-op (handled by UCRT/VCRuntime DLL unload) | | | uninitialize_allocated_memory() |
|
| 127 |
+
// | | | | uninitialize_allocated_io_buffers() |
|
| 128 |
+
// | + __finally +--------------------------------------+ | | | report_memory_leaks() |
|
| 129 |
+
// | | | | | | __acrt_uninitialize_command_line() |
|
| 130 |
+
// | | __scrt_dllmain_uninitialize_critical() | | | | __acrt_uninitialize_lowio() |
|
| 131 |
+
// | | /MT: __acrt_uninitialize_ptd() +----------------------------->__acrt_uninitialize_ptd() |
|
| 132 |
+
// | | __vcrt_uninitialize_ptd() +--------------------+ | | uninitialize_vcruntime() (the OS one) |
|
| 133 |
+
// | | /MD: no-op | | | | | __acrt_uninitialize_heap() |
|
| 134 |
+
// | | (handled by UCRT/VCRuntime DLL unload) | | | | | __acrt_uninitialize_locks() |
|
| 135 |
+
// | | | | | | | uninitialize_global_state_isolation() |
|
| 136 |
+
// | | Ensures PTD is released on error | | | | | |
|
| 137 |
+
// | | so FLS callbacks don't refer to unloaded module | | | | +---------------------------------------------+
|
| 138 |
+
// | | | | | |
|
| 139 |
+
// | +--------------------------------------------------+ | | | +--------------------------------------+
|
| 140 |
+
// | | | +---> VCRuntime Uninitializer Order |
|
| 141 |
+
// +-------------------------------------------------------+ | | (__vcrt_uninitialize) |
|
| 142 |
+
// | | |
|
| 143 |
+
// +---------------------------------+ | | Debug unless terminating: |
|
| 144 |
+
// | /MD Only | +-------->__vcrt_uninitialize_ptd() |
|
| 145 |
+
// | | | __vcrt_uninitialize_locks() |
|
| 146 |
+
// | ucrtbase(d)!__acrt_DllMain | | __vcrt_uninitialize_winapi_thunks() |
|
| 147 |
+
// | __acrt_uninitialize() | | |
|
| 148 |
+
// | | +--------------------------------------+
|
| 149 |
+
// | |
|
| 150 |
+
// | vcruntime140(d)!__vcrt_DllMain |
|
| 151 |
+
// | __vcrt_uninitialize() |
|
| 152 |
+
// | |
|
| 153 |
+
// +---------------------------------+
|
| 154 |
+
//
|
| 155 |
+
// clang-format on
|
| 156 |
+
|
| 157 |
+
static BOOL __cdecl dllmain_crt_process_detach(bool const is_terminating)
|
| 158 |
+
{
|
| 159 |
+
// If the attach did not complete successfully, or if the detach was already
|
| 160 |
+
// executed, do not execute the detach:
|
| 161 |
+
if (__proc_attached <= 0)
|
| 162 |
+
{
|
| 163 |
+
return FALSE;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
--__proc_attached;
|
| 167 |
+
|
| 168 |
+
BOOL result = TRUE;
|
| 169 |
+
|
| 170 |
+
__try
|
| 171 |
+
{
|
| 172 |
+
bool const is_nested = __scrt_acquire_startup_lock();
|
| 173 |
+
__try
|
| 174 |
+
{
|
| 175 |
+
if (__scrt_current_native_startup_state != __scrt_native_startup_state::initialized)
|
| 176 |
+
{
|
| 177 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
__scrt_dllmain_uninitialize_c();
|
| 181 |
+
|
| 182 |
+
__scrt_uninitialize_type_info();
|
| 183 |
+
|
| 184 |
+
#ifdef _RTC
|
| 185 |
+
_RTC_Terminate();
|
| 186 |
+
#endif
|
| 187 |
+
|
| 188 |
+
__scrt_current_native_startup_state = __scrt_native_startup_state::uninitialized;
|
| 189 |
+
}
|
| 190 |
+
__finally
|
| 191 |
+
{
|
| 192 |
+
__scrt_release_startup_lock(is_nested);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
if (!__scrt_uninitialize_crt(is_terminating, false))
|
| 196 |
+
{
|
| 197 |
+
result = FALSE;
|
| 198 |
+
__leave;
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
__finally
|
| 202 |
+
{
|
| 203 |
+
__scrt_dllmain_uninitialize_critical();
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
return result;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
static BOOL WINAPI dllmain_crt_dispatch(
|
| 212 |
+
HINSTANCE const instance,
|
| 213 |
+
DWORD const reason,
|
| 214 |
+
LPVOID const reserved
|
| 215 |
+
)
|
| 216 |
+
{
|
| 217 |
+
switch (reason)
|
| 218 |
+
{
|
| 219 |
+
case DLL_PROCESS_ATTACH: return dllmain_crt_process_attach(instance, reserved);
|
| 220 |
+
case DLL_PROCESS_DETACH: return dllmain_crt_process_detach(reserved != nullptr);
|
| 221 |
+
case DLL_THREAD_ATTACH: return __scrt_dllmain_crt_thread_attach();
|
| 222 |
+
case DLL_THREAD_DETACH: return __scrt_dllmain_crt_thread_detach();
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
return TRUE;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
// Define the _CRT_INIT function for compatibility.
|
| 229 |
+
extern "C" BOOL WINAPI _CRT_INIT(
|
| 230 |
+
HINSTANCE const instance,
|
| 231 |
+
DWORD const reason,
|
| 232 |
+
LPVOID const reserved
|
| 233 |
+
)
|
| 234 |
+
{
|
| 235 |
+
return dllmain_crt_dispatch(instance, reason, reserved);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
static BOOL WINAPI dllmain_raw(
|
| 239 |
+
HINSTANCE const instance,
|
| 240 |
+
DWORD const reason,
|
| 241 |
+
LPVOID const reserved
|
| 242 |
+
)
|
| 243 |
+
{
|
| 244 |
+
if (!_pRawDllMain)
|
| 245 |
+
return TRUE;
|
| 246 |
+
|
| 247 |
+
return _pRawDllMain(instance, reason, reserved);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
static BOOL __cdecl dllmain_dispatch(
|
| 253 |
+
HINSTANCE const instance,
|
| 254 |
+
DWORD const reason,
|
| 255 |
+
LPVOID const reserved
|
| 256 |
+
)
|
| 257 |
+
{
|
| 258 |
+
// If this is a process detach notification, check that there was a prior
|
| 259 |
+
// process attach notification that was processed successfully. This is
|
| 260 |
+
// to ensure that we don't detach more times than we attach.
|
| 261 |
+
if (reason == DLL_PROCESS_DETACH && __proc_attached <= 0)
|
| 262 |
+
{
|
| 263 |
+
return FALSE;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
BOOL result = TRUE;
|
| 267 |
+
|
| 268 |
+
__try
|
| 269 |
+
{
|
| 270 |
+
if (reason == DLL_PROCESS_ATTACH || reason == DLL_THREAD_ATTACH)
|
| 271 |
+
{
|
| 272 |
+
result = dllmain_raw(instance, reason, reserved);
|
| 273 |
+
if (!result)
|
| 274 |
+
__leave;
|
| 275 |
+
|
| 276 |
+
result = dllmain_crt_dispatch(instance, reason, reserved);
|
| 277 |
+
if (!result)
|
| 278 |
+
__leave;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
result = DllMain(instance, reason, reserved);
|
| 282 |
+
|
| 283 |
+
// If the client DllMain routine failed, unwind the initialization:
|
| 284 |
+
if (reason == DLL_PROCESS_ATTACH && !result)
|
| 285 |
+
{
|
| 286 |
+
DllMain(instance, DLL_PROCESS_DETACH, reserved);
|
| 287 |
+
dllmain_crt_dispatch(instance, DLL_PROCESS_DETACH, reserved);
|
| 288 |
+
dllmain_raw(instance, DLL_PROCESS_DETACH, reserved);
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
if (reason == DLL_PROCESS_DETACH || reason == DLL_THREAD_DETACH)
|
| 292 |
+
{
|
| 293 |
+
result = dllmain_crt_dispatch(instance, reason, reserved);
|
| 294 |
+
if (!result)
|
| 295 |
+
__leave;
|
| 296 |
+
|
| 297 |
+
result = dllmain_raw(instance, reason, reserved);
|
| 298 |
+
if (!result)
|
| 299 |
+
__leave;
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
__except(__scrt_dllmain_exception_filter(
|
| 303 |
+
instance,
|
| 304 |
+
reason,
|
| 305 |
+
reserved,
|
| 306 |
+
dllmain_crt_dispatch,
|
| 307 |
+
GetExceptionCode(),
|
| 308 |
+
GetExceptionInformation()))
|
| 309 |
+
{
|
| 310 |
+
result = FALSE;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
return result;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
// The entry point for this DLL.
|
| 319 |
+
extern "C" BOOL WINAPI _DllMainCRTStartup(
|
| 320 |
+
HINSTANCE const instance,
|
| 321 |
+
DWORD const reason,
|
| 322 |
+
LPVOID const reserved
|
| 323 |
+
)
|
| 324 |
+
{
|
| 325 |
+
if (reason == DLL_PROCESS_ATTACH)
|
| 326 |
+
{
|
| 327 |
+
// The /GS security cookie must be initialized before any exception
|
| 328 |
+
// handling targeting the current image is registered. No function
|
| 329 |
+
// using exception handling can be called in the current image until
|
| 330 |
+
// after this call:
|
| 331 |
+
__security_init_cookie();
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
return dllmain_dispatch(instance, reason, reserved);
|
| 335 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dll_dllmain_stub.cpp
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// dll_dllmain_stub.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// A DllMain to be used if the client does not define one.
|
| 7 |
+
//
|
| 8 |
+
#include <vcstartup_internal.h>
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
extern "C" extern __scrt_dllmain_type const _pRawDllMain;
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
extern "C" BOOL WINAPI DllMain(
|
| 17 |
+
_In_ HINSTANCE const instance,
|
| 18 |
+
_In_ DWORD const reason,
|
| 19 |
+
_In_ LPVOID const reserved
|
| 20 |
+
)
|
| 21 |
+
{
|
| 22 |
+
UNREFERENCED_PARAMETER(instance);
|
| 23 |
+
UNREFERENCED_PARAMETER(reason);
|
| 24 |
+
UNREFERENCED_PARAMETER(reserved);
|
| 25 |
+
|
| 26 |
+
// When the dynamic CRT libraries are used, the client DLL does not need the
|
| 27 |
+
// thread attach and detach notifications if the client does not provide a
|
| 28 |
+
// DllMain or _pRawDllMain, so we can disable them. (When the static CRT
|
| 29 |
+
// libraries are used, the CRT's DllMain that is linked into the DLL requires
|
| 30 |
+
// these notifications.)
|
| 31 |
+
// Enclaves do not support this performance optimization API.
|
| 32 |
+
#if defined CRTDLL && !defined _SCRT_ENCLAVE_BUILD
|
| 33 |
+
if (reason == DLL_PROCESS_ATTACH && !_pRawDllMain)
|
| 34 |
+
DisableThreadLibraryCalls(instance);
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
return TRUE;
|
| 38 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/dyn_tls_init.c
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// dyn_tls_init.c
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// This source file provides a fallback definition of __dyn_tls_init_callback,
|
| 7 |
+
// used whenever TLS initialization is not required.
|
| 8 |
+
//
|
| 9 |
+
// This relies on a feature of the C compiler known as "communal variables."
|
| 10 |
+
// This does not work in C++, and the linker's alternatename features is not
|
| 11 |
+
// sufficient here.
|
| 12 |
+
//
|
| 13 |
+
#include <Windows.h>
|
| 14 |
+
|
| 15 |
+
#pragma warning(disable: 4132) // const object should be initialized
|
| 16 |
+
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
|
| 17 |
+
|
| 18 |
+
PIMAGE_TLS_CALLBACK const* __cdecl __scrt_get_dyn_tls_init_callback()
|
| 19 |
+
{
|
| 20 |
+
return &__dyn_tls_init_callback;
|
| 21 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehhelpers.cpp
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehhelpers.cpp - Some target-independent helper routines used by the EH frame handler.
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
****/
|
| 7 |
+
|
| 8 |
+
#include <eh.h> // User-visible routines for eh
|
| 9 |
+
#include <ehassert.h> // This project's versions of standard assert macros
|
| 10 |
+
#include <ehdata.h> // Declarations of all types used for EH
|
| 11 |
+
#include <ehdata4.h>
|
| 12 |
+
#include <ehhooks.h> // Declarations of hook variables and callbacks
|
| 13 |
+
#include <trnsctrl.h> // Routines to handle transfer of control (trnsctrl.asm)
|
| 14 |
+
#include <vcruntime_exception.h>
|
| 15 |
+
#include <vcruntime_typeinfo.h>
|
| 16 |
+
|
| 17 |
+
#include <Unknwn.h>
|
| 18 |
+
#include <Windows.h>
|
| 19 |
+
|
| 20 |
+
#include "ehhelpers.h"
|
| 21 |
+
|
| 22 |
+
// If we call DestructExceptionObject directly from C_Specific_Handler/
|
| 23 |
+
// _except_handler3, then this obj file will be pulled in by the linker
|
| 24 |
+
// even in programs which do not have C++ exceptions. So we call it using a
|
| 25 |
+
// function pointer _pDestructExceptionObject which gets initialized to 0 by
|
| 26 |
+
// default. If C++ exceptions are present, this file will be pulled in naturally
|
| 27 |
+
// and _pDestructExceptionObject will point to __DestructExceptionObject.
|
| 28 |
+
|
| 29 |
+
extern "C" void (__cdecl * const _pDestructExceptionObject)(EHExceptionRecord *,BOOLEAN)
|
| 30 |
+
= &__DestructExceptionObject;
|
| 31 |
+
|
| 32 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 33 |
+
//
|
| 34 |
+
// __AdjustPointer - Adjust the pointer to the exception object to a pointer to a
|
| 35 |
+
// base instance.
|
| 36 |
+
//
|
| 37 |
+
// Output:
|
| 38 |
+
// The address point of the base.
|
| 39 |
+
//
|
| 40 |
+
// Side-effects:
|
| 41 |
+
// NONE.
|
| 42 |
+
|
| 43 |
+
extern "C" _VCRTIMP void *__AdjustPointer(
|
| 44 |
+
void *pThis, // Address point of exception object
|
| 45 |
+
const PMD& pmd // Generalized pointer-to-member
|
| 46 |
+
// descriptor
|
| 47 |
+
) {
|
| 48 |
+
char *pRet = (char *)pThis + pmd.mdisp;
|
| 49 |
+
|
| 50 |
+
if (pmd.pdisp >= 0) {
|
| 51 |
+
pRet += *(__int32 *)((char *)*(ptrdiff_t *)((char *)pThis + pmd.pdisp)
|
| 52 |
+
#if defined(_WIN64)
|
| 53 |
+
+ (unsigned __int64)pmd.vdisp
|
| 54 |
+
#else
|
| 55 |
+
+ pmd.vdisp
|
| 56 |
+
#endif
|
| 57 |
+
);
|
| 58 |
+
pRet += pmd.pdisp;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
return pRet;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 65 |
+
//
|
| 66 |
+
// __GetPlatformExceptionInfo - Get Platform Exception extra information from current exception
|
| 67 |
+
//
|
| 68 |
+
// Output:
|
| 69 |
+
// The address of WINRTEXCEPTIONINFO structure
|
| 70 |
+
//
|
| 71 |
+
// Side-effects:
|
| 72 |
+
// NONE.
|
| 73 |
+
extern "C" _VCRTIMP void * __GetPlatformExceptionInfo(
|
| 74 |
+
int *pIsBadAlloc
|
| 75 |
+
) {
|
| 76 |
+
*pIsBadAlloc = 0;
|
| 77 |
+
EHExceptionRecord *pExcept = _pCurrentException;
|
| 78 |
+
if (pExcept)
|
| 79 |
+
{
|
| 80 |
+
ThrowInfo* pTI = PER_PTHROW(pExcept);
|
| 81 |
+
if (pTI)
|
| 82 |
+
{
|
| 83 |
+
if (THROW_ISWINRT( (*pTI) ) )
|
| 84 |
+
{
|
| 85 |
+
ULONG_PTR *exceptionInfoPointer = *reinterpret_cast<ULONG_PTR**>(PER_PEXCEPTOBJ(pExcept));
|
| 86 |
+
exceptionInfoPointer--;
|
| 87 |
+
return reinterpret_cast<void*>(*exceptionInfoPointer);
|
| 88 |
+
}
|
| 89 |
+
else
|
| 90 |
+
{
|
| 91 |
+
_EXCEPTION_POINTERS exceptionPointers;
|
| 92 |
+
exceptionPointers.ExceptionRecord = reinterpret_cast<PEXCEPTION_RECORD>(pExcept);
|
| 93 |
+
exceptionPointers.ContextRecord = nullptr;
|
| 94 |
+
|
| 95 |
+
*pIsBadAlloc = _is_exception_typeof(typeid(std::bad_alloc), &exceptionPointers);
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
return nullptr;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 104 |
+
//
|
| 105 |
+
// __current_exception(), __current_exception_context(), __processing_throw()
|
| 106 |
+
// - Accessors for the per-thread exception state, used
|
| 107 |
+
// by the managed EH implementation, exception_ptr, etc.
|
| 108 |
+
//
|
| 109 |
+
|
| 110 |
+
// Don't define these "locally" for satellite DLL build, the satellite
|
| 111 |
+
// needs to call these from the base vcruntime to infer the location of the PTD
|
| 112 |
+
#if !defined _VCRT_SAT_1
|
| 113 |
+
extern "C" void** __cdecl __current_exception()
|
| 114 |
+
{
|
| 115 |
+
return &RENAME_BASE_PTD(__vcrt_getptd)()->_curexception;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
extern "C" void** __cdecl __current_exception_context()
|
| 119 |
+
{
|
| 120 |
+
return &RENAME_BASE_PTD(__vcrt_getptd)()->_curcontext;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
extern "C" int* __cdecl __processing_throw()
|
| 124 |
+
{
|
| 125 |
+
return &RENAME_BASE_PTD(__vcrt_getptd)()->_ProcessingThrow;
|
| 126 |
+
}
|
| 127 |
+
#endif
|
| 128 |
+
|
| 129 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 130 |
+
//
|
| 131 |
+
// __FrameUnwindFilter - Allows possibility of continuing through SEH during
|
| 132 |
+
// unwind.
|
| 133 |
+
//
|
| 134 |
+
|
| 135 |
+
extern "C" _VCRTIMP int __cdecl __FrameUnwindFilter(
|
| 136 |
+
EXCEPTION_POINTERS *pExPtrs
|
| 137 |
+
) {
|
| 138 |
+
EHExceptionRecord *pExcept = (EHExceptionRecord *)pExPtrs->ExceptionRecord;
|
| 139 |
+
|
| 140 |
+
switch (PER_CODE(pExcept)) {
|
| 141 |
+
case EH_EXCEPTION_NUMBER:
|
| 142 |
+
_pCurrentException = pExcept;
|
| 143 |
+
_pCurrentExContext = pExPtrs->ContextRecord;
|
| 144 |
+
terminate();
|
| 145 |
+
|
| 146 |
+
case MANAGED_EXCEPTION_CODE:
|
| 147 |
+
case MANAGED_EXCEPTION_CODE_V4:
|
| 148 |
+
/*
|
| 149 |
+
See VSW#544593 for more details. __ProcessingThrow is used to implement
|
| 150 |
+
std::uncaught_exception(). The interaction between C++, SEH and managed
|
| 151 |
+
exception wrt __ProcessingThrow is unspec'ed. From code inspection, it
|
| 152 |
+
looks like that __ProcessingThrow works ok with all C++ exceptions.
|
| 153 |
+
|
| 154 |
+
In this case, when we encounter a managed exception thrown from a destructor
|
| 155 |
+
during unwind, we choose to decrement the count. This means that the previous
|
| 156 |
+
C++ exception which incremented the count won't be considered any longer.
|
| 157 |
+
In fact, the managed exception will be thrown, and the native C++ one will
|
| 158 |
+
not have any possibility to be caught any longer.
|
| 159 |
+
|
| 160 |
+
We should revisit std::uncaught_exception() and SEH/managed exception in the
|
| 161 |
+
next version.
|
| 162 |
+
*/
|
| 163 |
+
if (__ProcessingThrow > 0)
|
| 164 |
+
{
|
| 165 |
+
--__ProcessingThrow;
|
| 166 |
+
}
|
| 167 |
+
return EXCEPTION_CONTINUE_SEARCH;
|
| 168 |
+
|
| 169 |
+
default:
|
| 170 |
+
return EXCEPTION_CONTINUE_SEARCH;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
PGETWINRT_OOM_EXCEPTION __WinRTOutOfMemoryExceptionCallback = nullptr;
|
| 176 |
+
|
| 177 |
+
extern "C" _VCRTIMP void __cdecl _SetWinRTOutOfMemoryExceptionCallback(PGETWINRT_OOM_EXCEPTION pCallback)
|
| 178 |
+
{
|
| 179 |
+
__WinRTOutOfMemoryExceptionCallback = pCallback;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 183 |
+
// __std_terminate: Helper function referenced by the front-end to assist in
|
| 184 |
+
// implementing noexcept. Noexcept termination semantics are generally handled
|
| 185 |
+
// by FindHandler() above, when we cross a function with the noexcept bit set
|
| 186 |
+
// in the xdata when looking for a handler. When noexcept functions are inlined,
|
| 187 |
+
// though, we may no longer cross a noexcept function boundary when searching for
|
| 188 |
+
// a handler. In this case the inlined code contains an EH state that will invoke
|
| 189 |
+
// this function should an exception occur.
|
| 190 |
+
extern "C" __declspec(noreturn) void __cdecl __std_terminate()
|
| 191 |
+
{
|
| 192 |
+
terminate();
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 196 |
+
//
|
| 197 |
+
// __DestructExceptionObject - Call the destructor (if any) of the original
|
| 198 |
+
// exception object.
|
| 199 |
+
//
|
| 200 |
+
// Returns: None.
|
| 201 |
+
//
|
| 202 |
+
// Side-effects:
|
| 203 |
+
// Original exception object is destructed.
|
| 204 |
+
//
|
| 205 |
+
// Notes:
|
| 206 |
+
// If destruction throws any exception, and we are destructing the exception
|
| 207 |
+
// object as a result of a new exception, we give up. If the destruction
|
| 208 |
+
// throws otherwise, we let it be.
|
| 209 |
+
|
| 210 |
+
static DWORD _FilterSetCurrentException(EXCEPTION_POINTERS* pointers, BOOLEAN fThrowNotAllowed)
|
| 211 |
+
{
|
| 212 |
+
if (fThrowNotAllowed) {
|
| 213 |
+
const auto eRecord = reinterpret_cast<EHExceptionRecord*>(pointers->ExceptionRecord);
|
| 214 |
+
if (PER_IS_MSVC_EH(eRecord))
|
| 215 |
+
{
|
| 216 |
+
// Can't have new exceptions when we're unwinding due to another
|
| 217 |
+
// exception.
|
| 218 |
+
_pCurrentException = eRecord;
|
| 219 |
+
_pCurrentExContext = pointers->ContextRecord;
|
| 220 |
+
terminate();
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
return EXCEPTION_CONTINUE_SEARCH;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
extern "C" _VCRTIMP void __cdecl __DestructExceptionObject(
|
| 228 |
+
EHExceptionRecord *pExcept, // The original exception record
|
| 229 |
+
BOOLEAN fThrowNotAllowed // TRUE if destructor not allowed to
|
| 230 |
+
// throw
|
| 231 |
+
) {
|
| 232 |
+
// Ignore if not a C++ exception (since this is now called from
|
| 233 |
+
// _except_handler3)
|
| 234 |
+
if (pExcept == nullptr || !(PER_IS_MSVC_EH(pExcept)))
|
| 235 |
+
{
|
| 236 |
+
return;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
EHTRACE_FMT1("Destroying object @ 0x%p", PER_PEXCEPTOBJ(pExcept));
|
| 240 |
+
|
| 241 |
+
/*UNDONE:Is this _SYSCRT specific */
|
| 242 |
+
#pragma prefast(suppress:__WARNING_REDUNDANT_POINTER_TEST, "Current definition of PER_CODE ensures that pExcept cannot be nullptr")
|
| 243 |
+
if (PER_PTHROW(pExcept)) {
|
| 244 |
+
if (THROW_UNWINDFUNC(*PER_PTHROW(pExcept)) != 0) {
|
| 245 |
+
|
| 246 |
+
__try {
|
| 247 |
+
|
| 248 |
+
#if _EH_RELATIVE_TYPEINFO
|
| 249 |
+
_CallMemberFunction0(PER_PEXCEPTOBJ(pExcept),
|
| 250 |
+
THROW_UNWINDFUNC_IB(*PER_PTHROW(pExcept),(ptrdiff_t)PER_PTHROWIB(pExcept)));
|
| 251 |
+
#else
|
| 252 |
+
_CallMemberFunction0(PER_PEXCEPTOBJ(pExcept),
|
| 253 |
+
THROW_UNWINDFUNC(*PER_PTHROW(pExcept)));
|
| 254 |
+
#endif
|
| 255 |
+
|
| 256 |
+
} __except(_FilterSetCurrentException(GetExceptionInformation(), fThrowNotAllowed)) {}
|
| 257 |
+
}
|
| 258 |
+
else if (THROW_ISWINRT(*PER_PTHROW(pExcept))) {
|
| 259 |
+
// Release if WinRT reference type exception
|
| 260 |
+
IUnknown* const pUnknown = *static_cast<IUnknown**>(PER_PEXCEPTOBJ(pExcept));
|
| 261 |
+
if (pUnknown) {
|
| 262 |
+
pUnknown->Release();
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
/////////////////////////////////////////////////////////////////////////////
|
| 269 |
+
//
|
| 270 |
+
// _IsExceptionObjectToBeDestroyed - Determine if an exception object is still
|
| 271 |
+
// in use by a more deeply nested catch frame, or if it unused and should be
|
| 272 |
+
// destroyed on exiting from the current catch block.
|
| 273 |
+
//
|
| 274 |
+
// Returns:
|
| 275 |
+
// TRUE if exception object not found and should be destroyed.
|
| 276 |
+
//
|
| 277 |
+
extern "C" BOOL __cdecl _IsExceptionObjectToBeDestroyed(
|
| 278 |
+
PVOID pExceptionObject
|
| 279 |
+
) {
|
| 280 |
+
FRAMEINFO * pFrameInfo;
|
| 281 |
+
|
| 282 |
+
for (pFrameInfo = pFrameInfoChain; pFrameInfo; pFrameInfo = pFrameInfo->pNext ) {
|
| 283 |
+
if (pFrameInfo->pExceptionObject == pExceptionObject) {
|
| 284 |
+
return FALSE;
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
return TRUE;
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 291 |
+
// _is_exception_typeof - checks if the thrown exception is the type, the caller
|
| 292 |
+
// has passed in.
|
| 293 |
+
//
|
| 294 |
+
extern "C" _VCRTIMP int __cdecl _is_exception_typeof(_In_ const type_info & type, _In_ struct _EXCEPTION_POINTERS * ep)
|
| 295 |
+
{
|
| 296 |
+
_VCRT_VERIFY(ep);
|
| 297 |
+
|
| 298 |
+
EHExceptionRecord *pExcept = (EHExceptionRecord *)ep->ExceptionRecord;
|
| 299 |
+
|
| 300 |
+
// Is this our Exception?
|
| 301 |
+
_VCRT_VERIFY(pExcept && PER_IS_MSVC_EH(pExcept));
|
| 302 |
+
|
| 303 |
+
#if _EH_RELATIVE_TYPEINFO
|
| 304 |
+
__int32 const *ppCatchable;
|
| 305 |
+
ptrdiff_t imgBase = (ptrdiff_t)pExcept->params.pThrowImageBase;
|
| 306 |
+
ppCatchable = THROW_CTLIST_IB(*PER_PTHROW(pExcept), imgBase );
|
| 307 |
+
int catchables = THROW_COUNT_IB(*PER_PTHROW(pExcept), imgBase );
|
| 308 |
+
#else
|
| 309 |
+
CatchableType * const *ppCatchable;
|
| 310 |
+
ppCatchable = THROW_CTLIST(*PER_PTHROW(pExcept));
|
| 311 |
+
int catchables = THROW_COUNT(*PER_PTHROW(pExcept));
|
| 312 |
+
#endif
|
| 313 |
+
|
| 314 |
+
CatchableType *pCatchable;
|
| 315 |
+
|
| 316 |
+
// Scan all types that thrown object can be converted to.
|
| 317 |
+
for (; catchables > 0; catchables--, ppCatchable++)
|
| 318 |
+
{
|
| 319 |
+
#if _EH_RELATIVE_TYPEINFO
|
| 320 |
+
pCatchable = (CatchableType *)(imgBase + *ppCatchable);
|
| 321 |
+
if(strcmp(type.raw_name(), CT_NAME_IB(*pCatchable, imgBase)) == 0)
|
| 322 |
+
#else
|
| 323 |
+
pCatchable = *ppCatchable;
|
| 324 |
+
if(strcmp(type.raw_name(), CT_NAME(*pCatchable)) == 0)
|
| 325 |
+
#endif
|
| 326 |
+
{
|
| 327 |
+
// Found a Match.
|
| 328 |
+
return 1;
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
return 0;
|
| 333 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehhelpers.h
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Copyright (c) Microsoft Corporation. All Rights reserved.
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
#pragma once
|
| 6 |
+
|
| 7 |
+
#if defined(_M_X64) || defined(_M_ARM_NT) || defined(_M_ARM64) || defined(_CHPE_X86_ARM64_EH_)
|
| 8 |
+
|
| 9 |
+
#define _pForeignExcept (*((EHExceptionRecord **)&(RENAME_BASE_PTD(__vcrt_getptd)()->_pForeignException)))
|
| 10 |
+
|
| 11 |
+
#endif
|
| 12 |
+
|
| 13 |
+
#define pFrameInfoChain (*((FRAMEINFO **) &(RENAME_BASE_PTD(__vcrt_getptd)()->_pFrameInfoChain)))
|
| 14 |
+
|
| 15 |
+
// Pre-V4 managed exception code
|
| 16 |
+
#define MANAGED_EXCEPTION_CODE 0XE0434F4D
|
| 17 |
+
|
| 18 |
+
// V4 and later managed exception code
|
| 19 |
+
#define MANAGED_EXCEPTION_CODE_V4 0XE0434352
|
| 20 |
+
|
| 21 |
+
extern "C" void
|
| 22 |
+
__except_validate_context_record(
|
| 23 |
+
_In_ PCONTEXT ContextRecord
|
| 24 |
+
);
|
| 25 |
+
|
| 26 |
+
extern "C" _VCRTIMP void * __AdjustPointer(
|
| 27 |
+
void *,
|
| 28 |
+
const PMD&
|
| 29 |
+
);
|
| 30 |
+
|
| 31 |
+
extern "C" _VCRTIMP void * __GetPlatformExceptionInfo(
|
| 32 |
+
int *
|
| 33 |
+
);
|
| 34 |
+
|
| 35 |
+
extern "C" _VCRTIMP int __cdecl __FrameUnwindFilter(
|
| 36 |
+
EXCEPTION_POINTERS *
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
extern PGETWINRT_OOM_EXCEPTION __WinRTOutOfMemoryExceptionCallback;
|
| 40 |
+
|
| 41 |
+
extern "C" _VCRTIMP void __cdecl __DestructExceptionObject(
|
| 42 |
+
EHExceptionRecord *,
|
| 43 |
+
BOOLEAN
|
| 44 |
+
);
|
| 45 |
+
|
| 46 |
+
extern "C" _VCRTIMP void __cdecl RENAME_EH_EXTERN(__BuildCatchObject)(
|
| 47 |
+
EHExceptionRecord *,
|
| 48 |
+
void *,
|
| 49 |
+
HandlerType *,
|
| 50 |
+
CatchableType *
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
extern "C" _VCRTIMP int __cdecl RENAME_EH_EXTERN(__TypeMatch4)(
|
| 54 |
+
FH4::HandlerType4 *,
|
| 55 |
+
CatchableType *,
|
| 56 |
+
ThrowInfo *
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
extern "C" _VCRTIMP int __cdecl RENAME_EH_EXTERN(__TypeMatch)(
|
| 60 |
+
HandlerType *,
|
| 61 |
+
CatchableType *,
|
| 62 |
+
ThrowInfo *
|
| 63 |
+
);
|
| 64 |
+
|
| 65 |
+
//
|
| 66 |
+
// Prototype for the internal handler
|
| 67 |
+
//
|
| 68 |
+
|
| 69 |
+
template<class T>
|
| 70 |
+
EXCEPTION_DISPOSITION __InternalCxxFrameHandlerWrapper(
|
| 71 |
+
EHExceptionRecord *pExcept,
|
| 72 |
+
EHRegistrationNode *pRN,
|
| 73 |
+
CONTEXT *pContext,
|
| 74 |
+
DispatcherContext *pDC,
|
| 75 |
+
typename T::FuncInfo *pFuncInfo,
|
| 76 |
+
int CatchDepth,
|
| 77 |
+
EHRegistrationNode *pMarkerRN,
|
| 78 |
+
BOOLEAN recursive);
|
| 79 |
+
|
| 80 |
+
#if _EH_RELATIVE_TYPEINFO
|
| 81 |
+
|
| 82 |
+
#undef THROW_COUNT
|
| 83 |
+
#define THROW_COUNT(ti) THROW_COUNT_IB(ti, _GetThrowImageBase())
|
| 84 |
+
#undef THROW_CTLIST
|
| 85 |
+
#define THROW_CTLIST(ti) THROW_CTLIST_IB(ti, _GetThrowImageBase())
|
| 86 |
+
|
| 87 |
+
#endif // _EH_RELATIVE_TYPEINFO
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehstate.cpp
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
* ehstate.cpp
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*Purpose:
|
| 6 |
+
* Contains state management code for all platforms.
|
| 7 |
+
*
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
#include <vcruntime_internal.h>
|
| 11 |
+
#include <eh.h>
|
| 12 |
+
#include <ehassert.h>
|
| 13 |
+
#include <ehdata.h>
|
| 14 |
+
#include <ehdata4.h>
|
| 15 |
+
#include <ehhooks.h>
|
| 16 |
+
#include <trnsctrl.h>
|
| 17 |
+
#include <type_traits>
|
| 18 |
+
#include "ehhelpers.h"
|
| 19 |
+
#include <windows.h>
|
| 20 |
+
|
| 21 |
+
#if _EH_RELATIVE_FUNCINFO
|
| 22 |
+
#if defined(_M_ARM_NT) || defined(_M_ARM64) || defined(_CHPE_X86_ARM64_EH_) || defined(_M_ARM64EC)
|
| 23 |
+
static uintptr_t adjustIp(DispatcherContext *pDC, uintptr_t Ip)
|
| 24 |
+
{
|
| 25 |
+
#if defined(_M_ARM64EC)
|
| 26 |
+
if(RtlIsEcCode(Ip)) {
|
| 27 |
+
PDISPATCHER_CONTEXT_ARM64EC pECDC;
|
| 28 |
+
pECDC = (PDISPATCHER_CONTEXT_ARM64EC) pDC;
|
| 29 |
+
|
| 30 |
+
if(pECDC->ControlPcIsUnwound != FALSE) {
|
| 31 |
+
Ip -= 4;
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
#else
|
| 35 |
+
|
| 36 |
+
//
|
| 37 |
+
// If this context came from an unwind to a call, then the ControlPc points
|
| 38 |
+
// to a return address, which could put us at the start of a neighboring
|
| 39 |
+
// scope. To correct for this, back the PC up by the minimum instruction
|
| 40 |
+
// size to ensure we are in the same scope as the original call opcode.
|
| 41 |
+
//
|
| 42 |
+
if (pDC->ControlPcIsUnwound) {
|
| 43 |
+
|
| 44 |
+
#if defined(_M_ARM_NT)
|
| 45 |
+
|
| 46 |
+
Ip -= 2;
|
| 47 |
+
|
| 48 |
+
#else
|
| 49 |
+
|
| 50 |
+
Ip -= 4;
|
| 51 |
+
|
| 52 |
+
#endif // _M_ARM_NT
|
| 53 |
+
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
#endif // _M_ARM64EC
|
| 57 |
+
return Ip;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
#else
|
| 61 |
+
static uintptr_t adjustIp(DispatcherContext* /*pDC*/, uintptr_t Ip)
|
| 62 |
+
{
|
| 63 |
+
return Ip;
|
| 64 |
+
}
|
| 65 |
+
#endif // (_M_ARM_NT) || defined(_M_ARM64) || defined(_CHPE_X86_ARM64_EH_) || defined(_M_ARM64EC)
|
| 66 |
+
|
| 67 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler4)::StateFromIp(
|
| 68 |
+
FuncInfo *pFuncInfo,
|
| 69 |
+
DispatcherContext *pDC,
|
| 70 |
+
uintptr_t Ip
|
| 71 |
+
)
|
| 72 |
+
{
|
| 73 |
+
unsigned int index; // loop control variable
|
| 74 |
+
unsigned int nIPMapEntry; // # of IpMapEntry; must be > 0
|
| 75 |
+
|
| 76 |
+
Ip = adjustIp(pDC, Ip);
|
| 77 |
+
|
| 78 |
+
if (pFuncInfo->dispIPtoStateMap == 0)
|
| 79 |
+
{
|
| 80 |
+
return EH_EMPTY_STATE;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
PBYTE buffer = (PBYTE)__RVAtoRealOffset(pDC, pFuncInfo->dispIPtoStateMap);
|
| 84 |
+
|
| 85 |
+
nIPMapEntry = FH4::ReadUnsigned(&buffer);
|
| 86 |
+
|
| 87 |
+
__ehstate_t prevState = EH_EMPTY_STATE;
|
| 88 |
+
unsigned int funcRelIP = 0;
|
| 89 |
+
for (index = 0; index < nIPMapEntry; index++) {
|
| 90 |
+
// States are delta-encoded relative to start of the function
|
| 91 |
+
funcRelIP += FH4::ReadUnsigned(&buffer);
|
| 92 |
+
if (Ip < __FuncRelToRealOffset(pDC, funcRelIP)) {
|
| 93 |
+
break;
|
| 94 |
+
}
|
| 95 |
+
// States are encoded +1 so as to not encode a negative
|
| 96 |
+
prevState = FH4::ReadUnsigned(&buffer) - 1;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
if (index == 0) {
|
| 100 |
+
// We are at the first entry, could be an error
|
| 101 |
+
return EH_EMPTY_STATE;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// We over-shot one iteration; return state from the previous slot
|
| 105 |
+
return prevState;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler3)::StateFromIp(
|
| 109 |
+
FuncInfo *pFuncInfo,
|
| 110 |
+
DispatcherContext *pDC,
|
| 111 |
+
uintptr_t Ip
|
| 112 |
+
)
|
| 113 |
+
{
|
| 114 |
+
|
| 115 |
+
unsigned int index; // loop control variable
|
| 116 |
+
unsigned int nIPMapEntry; // # of IpMapEntry; must be > 0
|
| 117 |
+
|
| 118 |
+
Ip = adjustIp(pDC, Ip);
|
| 119 |
+
|
| 120 |
+
_VCRT_VERIFY(pFuncInfo);
|
| 121 |
+
nIPMapEntry = FUNC_NIPMAPENT(*pFuncInfo);
|
| 122 |
+
|
| 123 |
+
_VCRT_VERIFY(FUNC_IPMAP(*pFuncInfo, pDC->ImageBase));
|
| 124 |
+
|
| 125 |
+
for (index = 0; index < nIPMapEntry; index++) {
|
| 126 |
+
IptoStateMapEntry *pIPtoStateMap = FUNC_PIPTOSTATE(*pFuncInfo, index, pDC->ImageBase);
|
| 127 |
+
if (Ip < (uintptr_t)__RVAtoRealOffset(pDC, pIPtoStateMap->Ip)) {
|
| 128 |
+
break;
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
if (index == 0) {
|
| 133 |
+
// We are at the first entry, could be an error
|
| 134 |
+
|
| 135 |
+
return EH_EMPTY_STATE;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// We over-shot one iteration; return state from the previous slot
|
| 139 |
+
|
| 140 |
+
return FUNC_IPTOSTATE(*pFuncInfo, index - 1, pDC->ImageBase).State;
|
| 141 |
+
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler3)::StateFromControlPc(
|
| 145 |
+
FuncInfo *pFuncInfo,
|
| 146 |
+
DispatcherContext *pDC
|
| 147 |
+
)
|
| 148 |
+
{
|
| 149 |
+
uintptr_t Ip = pDC->ControlPc;
|
| 150 |
+
|
| 151 |
+
return StateFromIp(pFuncInfo, pDC, Ip);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler4)::StateFromControlPc(
|
| 155 |
+
FuncInfo *pFuncInfo,
|
| 156 |
+
DispatcherContext *pDC
|
| 157 |
+
)
|
| 158 |
+
{
|
| 159 |
+
uintptr_t Ip = pDC->ControlPc;
|
| 160 |
+
|
| 161 |
+
return StateFromIp(pFuncInfo, pDC, Ip);
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
void RENAME_EH_EXTERN(__FrameHandler3)::SetUnwindTryBlock(
|
| 165 |
+
EHRegistrationNode *pRN,
|
| 166 |
+
DispatcherContext *pDC,
|
| 167 |
+
FuncInfo *pFuncInfo,
|
| 168 |
+
int curState
|
| 169 |
+
)
|
| 170 |
+
{
|
| 171 |
+
EHRegistrationNode EstablisherFramePointers;
|
| 172 |
+
EstablisherFramePointers = *RENAME_EH_EXTERN(__FrameHandler3)::GetEstablisherFrame(pRN, pDC, pFuncInfo, &EstablisherFramePointers);
|
| 173 |
+
if (curState > UNWINDTRYBLOCK(EstablisherFramePointers, FUNC_DISPUNWINDHELP(*pFuncInfo))) {
|
| 174 |
+
UNWINDTRYBLOCK(EstablisherFramePointers, FUNC_DISPUNWINDHELP(*pFuncInfo)) = (int)curState;
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler3)::GetUnwindTryBlock(
|
| 179 |
+
EHRegistrationNode *pRN,
|
| 180 |
+
DispatcherContext *pDC,
|
| 181 |
+
FuncInfo *pFuncInfo
|
| 182 |
+
)
|
| 183 |
+
{
|
| 184 |
+
EHRegistrationNode EstablisherFramePointers;
|
| 185 |
+
EstablisherFramePointers = *RENAME_EH_EXTERN(__FrameHandler3)::GetEstablisherFrame(pRN, pDC, pFuncInfo, &EstablisherFramePointers);
|
| 186 |
+
return UNWINDTRYBLOCK(EstablisherFramePointers, FUNC_DISPUNWINDHELP(*pFuncInfo));
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler3)::GetCurrentState(
|
| 190 |
+
EHRegistrationNode *pRN,
|
| 191 |
+
DispatcherContext *pDC,
|
| 192 |
+
FuncInfo *pFuncInfo
|
| 193 |
+
)
|
| 194 |
+
{
|
| 195 |
+
if (UNWINDSTATE(*pRN, FUNC_DISPUNWINDHELP(*pFuncInfo)) == -2) {
|
| 196 |
+
return RENAME_EH_EXTERN(__FrameHandler3)::StateFromControlPc(pFuncInfo, pDC);
|
| 197 |
+
}
|
| 198 |
+
else {
|
| 199 |
+
return UNWINDSTATE(*pRN, FUNC_DISPUNWINDHELP(*pFuncInfo));
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
void RENAME_EH_EXTERN(__FrameHandler3)::SetState(
|
| 204 |
+
EHRegistrationNode *pRN,
|
| 205 |
+
FuncInfo *pFuncInfo,
|
| 206 |
+
__ehstate_t newState
|
| 207 |
+
)
|
| 208 |
+
{
|
| 209 |
+
UNWINDSTATE(*pRN, FUNC_DISPUNWINDHELP(*pFuncInfo)) = newState;
|
| 210 |
+
}
|
| 211 |
+
#else
|
| 212 |
+
__ehstate_t RENAME_EH_EXTERN(__FrameHandler3)::GetCurrentState(
|
| 213 |
+
EHRegistrationNode *pRN,
|
| 214 |
+
DispatcherContext* /*pDC*/,
|
| 215 |
+
FuncInfo *pFuncInfo
|
| 216 |
+
)
|
| 217 |
+
{
|
| 218 |
+
// In the initial implementation, the state is simply stored in the registration node.
|
| 219 |
+
// Added support for byte states when max state <= 128. Note that max state is 1+real max state
|
| 220 |
+
if (pFuncInfo->maxState <= 128)
|
| 221 |
+
{
|
| 222 |
+
return (__ehstate_t)(signed char)((pRN)->state & 0xff);
|
| 223 |
+
}
|
| 224 |
+
else {
|
| 225 |
+
return (pRN)->state;
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
void RENAME_EH_EXTERN(__FrameHandler3)::SetState(
|
| 230 |
+
EHRegistrationNode *pRN,
|
| 231 |
+
FuncInfo* /*pFuncInfo*/,
|
| 232 |
+
__ehstate_t newState
|
| 233 |
+
)
|
| 234 |
+
{
|
| 235 |
+
pRN->state = newState;
|
| 236 |
+
}
|
| 237 |
+
#endif
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvccctr.cpp
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehvccctr.cpp - EH-aware version of copy constructor iterator helper function
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* These functions are called when constructing and destructing arrays of
|
| 8 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 9 |
+
* destructed if the constructor for one of the elements throws.
|
| 10 |
+
*
|
| 11 |
+
* Must be compiled using "-d1Binl" to be able to specify __thiscall
|
| 12 |
+
* at the user level
|
| 13 |
+
****/
|
| 14 |
+
|
| 15 |
+
#include <eh.h>
|
| 16 |
+
|
| 17 |
+
/*
|
| 18 |
+
* Note that we will be compiling all this with /clr option not /clr:pure
|
| 19 |
+
*/
|
| 20 |
+
#if defined _M_CEE
|
| 21 |
+
#define CALLTYPE __clrcall
|
| 22 |
+
#define CALLEETYPE __clrcall
|
| 23 |
+
#define __RELIABILITY_CONTRACT \
|
| 24 |
+
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
|
| 25 |
+
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
|
| 26 |
+
System::Runtime::ConstrainedExecution::Cer::Success \
|
| 27 |
+
)]
|
| 28 |
+
#else
|
| 29 |
+
#define CALLEETYPE __stdcall
|
| 30 |
+
#define __RELIABILITY_CONTRACT
|
| 31 |
+
|
| 32 |
+
#if defined _M_IX86
|
| 33 |
+
#define CALLTYPE __thiscall
|
| 34 |
+
#else
|
| 35 |
+
#define CALLTYPE __stdcall
|
| 36 |
+
#endif
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
using constructor_type = void (CALLTYPE*)(void*, void*);
|
| 40 |
+
using destructor_type = void (CALLTYPE*)(void*);
|
| 41 |
+
|
| 42 |
+
__RELIABILITY_CONTRACT
|
| 43 |
+
void CALLEETYPE __ArrayUnwind(
|
| 44 |
+
void* ptr, // Pointer to array to destruct
|
| 45 |
+
size_t size, // Size of each element (including padding)
|
| 46 |
+
size_t count, // Number of elements in the array
|
| 47 |
+
destructor_type destructor // The destructor to call
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
__RELIABILITY_CONTRACT
|
| 51 |
+
void CALLEETYPE __ehvec_copy_ctor(
|
| 52 |
+
void* dst, // Pointer to destination array
|
| 53 |
+
void* src, // Pointer to source array
|
| 54 |
+
size_t size, // Size of each element (including padding)
|
| 55 |
+
size_t count, // Number of elements in the array
|
| 56 |
+
constructor_type constructor, // Constructor to call
|
| 57 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 58 |
+
)
|
| 59 |
+
{
|
| 60 |
+
size_t i{0};
|
| 61 |
+
bool success{false};
|
| 62 |
+
|
| 63 |
+
__try
|
| 64 |
+
{
|
| 65 |
+
for (; i != count; ++i)
|
| 66 |
+
{
|
| 67 |
+
constructor(dst, src);
|
| 68 |
+
dst = static_cast<char*>(dst) + size;
|
| 69 |
+
src = static_cast<char*>(src) + size;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
success = true;
|
| 73 |
+
}
|
| 74 |
+
__finally
|
| 75 |
+
{
|
| 76 |
+
if (!success)
|
| 77 |
+
{
|
| 78 |
+
__ArrayUnwind(dst, size, i, destructor);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
__RELIABILITY_CONTRACT
|
| 84 |
+
void CALLEETYPE __ehvec_copy_ctor(
|
| 85 |
+
void* dst, // Pointer to destination array
|
| 86 |
+
void* src, // Pointer to source array
|
| 87 |
+
size_t size, // Size of each element (including padding)
|
| 88 |
+
int count, // Number of elements in the array
|
| 89 |
+
constructor_type constructor, // Constructor to call
|
| 90 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 91 |
+
)
|
| 92 |
+
{
|
| 93 |
+
__ehvec_copy_ctor(dst, src, size, static_cast<size_t>(count), constructor, destructor);
|
| 94 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvcccvb.cpp
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehvcccvb.cpp - EH copy-ctor iterator helper function for class w/ virtual bases
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* These functions are called when constructing and destructing arrays of
|
| 8 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 9 |
+
* destructed if the constructor for one of the elements throws.
|
| 10 |
+
*
|
| 11 |
+
* Must be compiled using "-d1Binl" to be able to specify __thiscall
|
| 12 |
+
* at the user level
|
| 13 |
+
****/
|
| 14 |
+
|
| 15 |
+
#include <eh.h>
|
| 16 |
+
|
| 17 |
+
#if defined _M_CEE
|
| 18 |
+
#define CALLTYPE __clrcall
|
| 19 |
+
#define CALLEETYPE __clrcall
|
| 20 |
+
#define __RELIABILITY_CONTRACT \
|
| 21 |
+
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
|
| 22 |
+
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
|
| 23 |
+
System::Runtime::ConstrainedExecution::Cer::Success \
|
| 24 |
+
)]
|
| 25 |
+
#else
|
| 26 |
+
#define CALLEETYPE __stdcall
|
| 27 |
+
#define __RELIABILITY_CONTRACT
|
| 28 |
+
|
| 29 |
+
#if defined _M_IX86
|
| 30 |
+
#define CALLTYPE __thiscall
|
| 31 |
+
#else
|
| 32 |
+
#define CALLTYPE __stdcall
|
| 33 |
+
#endif
|
| 34 |
+
#endif
|
| 35 |
+
|
| 36 |
+
using constructor_type = void (CALLTYPE*)(void*, void*);
|
| 37 |
+
using destructor_type = void (CALLTYPE*)(void*);
|
| 38 |
+
|
| 39 |
+
__RELIABILITY_CONTRACT
|
| 40 |
+
void CALLEETYPE __ArrayUnwind(
|
| 41 |
+
void* ptr, // Pointer to array to destruct
|
| 42 |
+
size_t size, // Size of each element (including padding)
|
| 43 |
+
size_t count, // Number of elements in the array
|
| 44 |
+
destructor_type destructor // The destructor to call
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
__RELIABILITY_CONTRACT
|
| 48 |
+
void CALLEETYPE __ehvec_copy_ctor_vb(
|
| 49 |
+
void* dst, // Pointer to destination array
|
| 50 |
+
void* src, // Pointer to source array
|
| 51 |
+
size_t size, // Size of each element (including padding)
|
| 52 |
+
size_t count, // Number of elements in the array
|
| 53 |
+
constructor_type constructor, // Constructor to call
|
| 54 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 55 |
+
)
|
| 56 |
+
{
|
| 57 |
+
size_t i{0};
|
| 58 |
+
bool success{false};
|
| 59 |
+
|
| 60 |
+
__try
|
| 61 |
+
{
|
| 62 |
+
for (; i != count; ++i)
|
| 63 |
+
{
|
| 64 |
+
#pragma warning(push)
|
| 65 |
+
#pragma warning(disable: 4191) // unsafe conversion
|
| 66 |
+
reinterpret_cast<void (CALLTYPE*)(void*, void*, int)>(constructor)(dst, src, 1);
|
| 67 |
+
#pragma warning(pop)
|
| 68 |
+
|
| 69 |
+
dst = static_cast<char*>(dst) + size;
|
| 70 |
+
src = static_cast<char*>(src) + size;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
success = true;
|
| 74 |
+
}
|
| 75 |
+
__finally
|
| 76 |
+
{
|
| 77 |
+
if (!success)
|
| 78 |
+
{
|
| 79 |
+
__ArrayUnwind(dst, size, i, destructor);
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
__RELIABILITY_CONTRACT
|
| 85 |
+
void CALLEETYPE __ehvec_copy_ctor_vb(
|
| 86 |
+
void* dst, // Pointer to destination array
|
| 87 |
+
void* src, // Pointer to source array
|
| 88 |
+
size_t size, // Size of each element (including padding)
|
| 89 |
+
int count, // Number of elements in the array
|
| 90 |
+
constructor_type constructor, // Constructor to call
|
| 91 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 92 |
+
)
|
| 93 |
+
{
|
| 94 |
+
__ehvec_copy_ctor_vb(dst, src, size, static_cast<size_t>(count), constructor, destructor);
|
| 95 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvecctr.cpp
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehvecctr.cpp - EH-aware version of constructor iterator helper function
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* These functions are called when constructing and destructing arrays of
|
| 8 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 9 |
+
* destructed if the constructor for one of the elements throws.
|
| 10 |
+
*
|
| 11 |
+
* Must be compiled using "-d1Binl" to be able to specify __thiscall
|
| 12 |
+
* at the user level
|
| 13 |
+
****/
|
| 14 |
+
|
| 15 |
+
#include <eh.h>
|
| 16 |
+
|
| 17 |
+
#if defined _M_CEE
|
| 18 |
+
#define CALLTYPE __clrcall
|
| 19 |
+
#define CALLEETYPE __clrcall
|
| 20 |
+
#define __RELIABILITY_CONTRACT \
|
| 21 |
+
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
|
| 22 |
+
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
|
| 23 |
+
System::Runtime::ConstrainedExecution::Cer::Success \
|
| 24 |
+
)]
|
| 25 |
+
#else
|
| 26 |
+
#define CALLEETYPE __stdcall
|
| 27 |
+
#define __RELIABILITY_CONTRACT
|
| 28 |
+
|
| 29 |
+
#if defined _M_IX86
|
| 30 |
+
#define CALLTYPE __thiscall
|
| 31 |
+
#else
|
| 32 |
+
#define CALLTYPE __stdcall
|
| 33 |
+
#endif
|
| 34 |
+
#endif
|
| 35 |
+
|
| 36 |
+
using constructor_type = void (CALLTYPE*)(void*);
|
| 37 |
+
using destructor_type = void (CALLTYPE*)(void*);
|
| 38 |
+
|
| 39 |
+
__RELIABILITY_CONTRACT
|
| 40 |
+
void CALLEETYPE __ArrayUnwind(
|
| 41 |
+
void* ptr, // Pointer to array to destruct
|
| 42 |
+
size_t size, // Size of each element (including padding)
|
| 43 |
+
size_t count, // Number of elements in the array
|
| 44 |
+
destructor_type destructor // The destructor to call
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
__RELIABILITY_CONTRACT
|
| 48 |
+
void CALLEETYPE __ehvec_ctor(
|
| 49 |
+
void* ptr, // Pointer to array to destruct
|
| 50 |
+
size_t size, // Size of each element (including padding)
|
| 51 |
+
size_t count, // Number of elements in the array
|
| 52 |
+
constructor_type constructor, // Constructor to call
|
| 53 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 54 |
+
)
|
| 55 |
+
{
|
| 56 |
+
size_t i{0};
|
| 57 |
+
bool success{false};
|
| 58 |
+
|
| 59 |
+
__try
|
| 60 |
+
{
|
| 61 |
+
for (; i != count; ++i)
|
| 62 |
+
{
|
| 63 |
+
constructor(ptr);
|
| 64 |
+
|
| 65 |
+
ptr = static_cast<char*>(ptr) + size;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
success = true;
|
| 69 |
+
}
|
| 70 |
+
__finally
|
| 71 |
+
{
|
| 72 |
+
if (!success)
|
| 73 |
+
{
|
| 74 |
+
__ArrayUnwind(ptr, size, i, destructor);
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
__RELIABILITY_CONTRACT
|
| 80 |
+
void CALLEETYPE __ehvec_ctor(
|
| 81 |
+
void* ptr, // Pointer to array to destruct
|
| 82 |
+
size_t size, // Size of each element (including padding)
|
| 83 |
+
int count, // Number of elements in the array
|
| 84 |
+
constructor_type constructor, // Constructor to call
|
| 85 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 86 |
+
)
|
| 87 |
+
{
|
| 88 |
+
__ehvec_ctor(ptr, size, static_cast<size_t>(count), constructor, destructor);
|
| 89 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehveccvb.cpp
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehveccvb.cpp - EH c-tor iterator helper function for class w/ virtual bases
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* EH-aware version of constructor iterator helper function for class
|
| 8 |
+
* with virtual bases
|
| 9 |
+
*
|
| 10 |
+
* These functions are called when constructing and destructing arrays of
|
| 11 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 12 |
+
* destructed if the constructor for one of the elements throws.
|
| 13 |
+
*
|
| 14 |
+
* These functions are called when constructing and destructing arrays of
|
| 15 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 16 |
+
* destructed if the constructor for one of the elements throws.
|
| 17 |
+
*
|
| 18 |
+
* Must be compiled using "-d1Binl" to be able to specify __thiscall
|
| 19 |
+
* at the user level
|
| 20 |
+
****/
|
| 21 |
+
|
| 22 |
+
#include <eh.h>
|
| 23 |
+
|
| 24 |
+
#if defined _M_CEE
|
| 25 |
+
#define CALLTYPE __clrcall
|
| 26 |
+
#define CALLEETYPE __clrcall
|
| 27 |
+
#define __RELIABILITY_CONTRACT \
|
| 28 |
+
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
|
| 29 |
+
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
|
| 30 |
+
System::Runtime::ConstrainedExecution::Cer::Success \
|
| 31 |
+
)]
|
| 32 |
+
#else
|
| 33 |
+
#define CALLEETYPE __stdcall
|
| 34 |
+
#define __RELIABILITY_CONTRACT
|
| 35 |
+
|
| 36 |
+
#if defined _M_IX86
|
| 37 |
+
#define CALLTYPE __thiscall
|
| 38 |
+
#else
|
| 39 |
+
#define CALLTYPE __stdcall
|
| 40 |
+
#endif
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
using constructor_type = void (CALLTYPE*)(void*);
|
| 44 |
+
using destructor_type = void (CALLTYPE*)(void*);
|
| 45 |
+
|
| 46 |
+
__RELIABILITY_CONTRACT
|
| 47 |
+
void CALLEETYPE __ArrayUnwind(
|
| 48 |
+
void* ptr, // Pointer to array to destruct
|
| 49 |
+
size_t size, // Size of each element (including padding)
|
| 50 |
+
size_t count, // Number of elements in the array
|
| 51 |
+
destructor_type destructor // The destructor to call
|
| 52 |
+
);
|
| 53 |
+
|
| 54 |
+
__RELIABILITY_CONTRACT
|
| 55 |
+
void CALLEETYPE __ehvec_ctor_vb(
|
| 56 |
+
void* ptr, // Pointer to array to destruct
|
| 57 |
+
size_t size, // Size of each element (including padding)
|
| 58 |
+
size_t count, // Number of elements in the array
|
| 59 |
+
constructor_type constructor, // Constructor to call
|
| 60 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 61 |
+
)
|
| 62 |
+
{
|
| 63 |
+
size_t i{0};
|
| 64 |
+
bool success{false};
|
| 65 |
+
|
| 66 |
+
__try
|
| 67 |
+
{
|
| 68 |
+
for (; i != count; ++i)
|
| 69 |
+
{
|
| 70 |
+
#pragma warning(push)
|
| 71 |
+
#pragma warning(disable: 4191) // unsafe conversion
|
| 72 |
+
reinterpret_cast<void (CALLTYPE*)(void*, int)>(constructor)(ptr, 1);
|
| 73 |
+
#pragma warning(pop)
|
| 74 |
+
|
| 75 |
+
ptr = static_cast<char*>(ptr) + size;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
success = true;
|
| 79 |
+
}
|
| 80 |
+
__finally
|
| 81 |
+
{
|
| 82 |
+
if (!success)
|
| 83 |
+
{
|
| 84 |
+
__ArrayUnwind(ptr, size, i, destructor);
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
__RELIABILITY_CONTRACT
|
| 90 |
+
void CALLEETYPE __ehvec_ctor_vb(
|
| 91 |
+
void* ptr, // Pointer to array to destruct
|
| 92 |
+
size_t size, // Size of each element (including padding)
|
| 93 |
+
int count, // Number of elements in the array
|
| 94 |
+
constructor_type constructor, // Constructor to call
|
| 95 |
+
destructor_type destructor // Destructor to call should exception be thrown
|
| 96 |
+
)
|
| 97 |
+
{
|
| 98 |
+
__ehvec_ctor_vb(ptr, size, static_cast<size_t>(count), constructor, destructor);
|
| 99 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/ehvecdtr.cpp
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/***
|
| 2 |
+
*ehvecdtr.cpp - EH-aware version of destructor iterator helper function
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
*Purpose:
|
| 7 |
+
* These functions are called when constructing and destructing arrays of
|
| 8 |
+
* objects. Their purpose is to assure that constructed elements get
|
| 9 |
+
* destructed if the constructor for one of the elements throws.
|
| 10 |
+
*
|
| 11 |
+
* Must be compiled using "-d1Binl" to be able to specify __thiscall
|
| 12 |
+
* at the user level
|
| 13 |
+
****/
|
| 14 |
+
|
| 15 |
+
#include <ehdata.h>
|
| 16 |
+
#include <eh.h>
|
| 17 |
+
#include <trnsctrl.h>
|
| 18 |
+
|
| 19 |
+
#if defined _M_CEE
|
| 20 |
+
#define CALLTYPE __clrcall
|
| 21 |
+
#define CALLEETYPE __clrcall
|
| 22 |
+
#define __RELIABILITY_CONTRACT \
|
| 23 |
+
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
|
| 24 |
+
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
|
| 25 |
+
System::Runtime::ConstrainedExecution::Cer::Success \
|
| 26 |
+
)]
|
| 27 |
+
|
| 28 |
+
#define ASSERT_UNMANAGED_CODE_ATTRIBUTE [System::Security::Permissions::SecurityPermissionAttribute(System::Security::Permissions::SecurityAction::Assert, UnmanagedCode = true)]
|
| 29 |
+
#define SECURITYCRITICAL_ATTRIBUTE [System::Security::SecurityCritical]
|
| 30 |
+
#else
|
| 31 |
+
#define CALLEETYPE __stdcall
|
| 32 |
+
#define __RELIABILITY_CONTRACT
|
| 33 |
+
#define ASSERT_UNMANAGED_CODE_ATTRIBUTE
|
| 34 |
+
#define SECURITYCRITICAL_ATTRIBUTE
|
| 35 |
+
|
| 36 |
+
#if defined _M_IX86
|
| 37 |
+
#define CALLTYPE __thiscall
|
| 38 |
+
#else
|
| 39 |
+
#define CALLTYPE __stdcall
|
| 40 |
+
#endif
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
using destructor_type = void (CALLTYPE*)(void*);
|
| 44 |
+
|
| 45 |
+
__RELIABILITY_CONTRACT
|
| 46 |
+
void CALLEETYPE __ArrayUnwind(
|
| 47 |
+
void* ptr, // Pointer to array to destruct
|
| 48 |
+
size_t size, // Size of each element (including padding)
|
| 49 |
+
size_t count, // Number of elements in the array
|
| 50 |
+
destructor_type destructor // The destructor to call
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
__RELIABILITY_CONTRACT
|
| 54 |
+
SECURITYCRITICAL_ATTRIBUTE
|
| 55 |
+
void CALLEETYPE __ehvec_dtor(
|
| 56 |
+
void* ptr, // Pointer to array to destruct
|
| 57 |
+
size_t size, // Size of each element (including padding)
|
| 58 |
+
size_t count, // Number of elements in the array
|
| 59 |
+
destructor_type destructor // The destructor to call
|
| 60 |
+
)
|
| 61 |
+
{
|
| 62 |
+
bool success{false};
|
| 63 |
+
|
| 64 |
+
// Advance pointer past end of array
|
| 65 |
+
ptr = static_cast<char*>(ptr) + size * count;
|
| 66 |
+
|
| 67 |
+
__try
|
| 68 |
+
{
|
| 69 |
+
// Destruct elements
|
| 70 |
+
while (count-- > 0)
|
| 71 |
+
{
|
| 72 |
+
ptr = static_cast<char*>(ptr) - size;
|
| 73 |
+
destructor(ptr);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
success = true;
|
| 77 |
+
}
|
| 78 |
+
__finally
|
| 79 |
+
{
|
| 80 |
+
if (!success)
|
| 81 |
+
{
|
| 82 |
+
__ArrayUnwind(ptr, size, count, destructor);
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
__RELIABILITY_CONTRACT
|
| 88 |
+
ASSERT_UNMANAGED_CODE_ATTRIBUTE
|
| 89 |
+
SECURITYCRITICAL_ATTRIBUTE
|
| 90 |
+
static int ArrayUnwindFilter(EXCEPTION_POINTERS* pExPtrs)
|
| 91 |
+
{
|
| 92 |
+
EHExceptionRecord *pExcept = reinterpret_cast<EHExceptionRecord*>(pExPtrs->ExceptionRecord);
|
| 93 |
+
|
| 94 |
+
switch(PER_CODE(pExcept))
|
| 95 |
+
{
|
| 96 |
+
case EH_EXCEPTION_NUMBER:
|
| 97 |
+
_pCurrentException = pExcept;
|
| 98 |
+
_pCurrentExContext = pExPtrs->ContextRecord;
|
| 99 |
+
terminate();
|
| 100 |
+
default:
|
| 101 |
+
return EXCEPTION_CONTINUE_SEARCH;
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
__RELIABILITY_CONTRACT
|
| 106 |
+
SECURITYCRITICAL_ATTRIBUTE
|
| 107 |
+
void CALLEETYPE __ArrayUnwind(
|
| 108 |
+
void* ptr, // Pointer to array to destruct
|
| 109 |
+
size_t size, // Size of each element (including padding)
|
| 110 |
+
size_t count, // Number of elements in the array
|
| 111 |
+
destructor_type destructor // The destructor to call
|
| 112 |
+
)
|
| 113 |
+
{
|
| 114 |
+
// 'unwind' rest of array
|
| 115 |
+
|
| 116 |
+
__try
|
| 117 |
+
{
|
| 118 |
+
for (size_t i{0}; i != count; ++i)
|
| 119 |
+
{
|
| 120 |
+
ptr = static_cast<char*>(ptr) - size;
|
| 121 |
+
destructor(ptr);
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
__except(ArrayUnwindFilter(exception_info()))
|
| 125 |
+
{
|
| 126 |
+
; // Deliberately do nothing
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
__RELIABILITY_CONTRACT
|
| 131 |
+
SECURITYCRITICAL_ATTRIBUTE
|
| 132 |
+
void CALLEETYPE __ehvec_dtor(
|
| 133 |
+
void* ptr, // Pointer to array to destruct
|
| 134 |
+
size_t size, // Size of each element (including padding)
|
| 135 |
+
int count, // Number of elements in the array
|
| 136 |
+
destructor_type destructor // The destructor to call
|
| 137 |
+
)
|
| 138 |
+
{
|
| 139 |
+
__ehvec_dtor(ptr, size, static_cast<size_t>(count), destructor);
|
| 140 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/env_mode.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// env_mode.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Specifies whether the environment should be initialized.
|
| 7 |
+
// This behavior is overridable at link-time by linking with noenv.obj.
|
| 8 |
+
//
|
| 9 |
+
#include <vcruntime_startup.h>
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
extern "C" bool __CRTDECL _should_initialize_environment()
|
| 14 |
+
{
|
| 15 |
+
return true;
|
| 16 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_common.inl
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// exe_common.inl
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The implementation of the common executable entry point code. There are four
|
| 7 |
+
// executable entry points defined by the CRT, one for each of the user-definable
|
| 8 |
+
// entry points:
|
| 9 |
+
//
|
| 10 |
+
// * mainCRTStartup => main
|
| 11 |
+
// * wmainCRTStartup => wmain
|
| 12 |
+
// * WinMainCRTStartup => WinMain
|
| 13 |
+
// * wWinMainCRTStartup => wWinMain
|
| 14 |
+
//
|
| 15 |
+
// These functions all behave the same, except for which user-definable main
|
| 16 |
+
// function they call and whether they accumulate and pass narrow or wide string
|
| 17 |
+
// arguments. This file contains the common code shared by all four of those
|
| 18 |
+
// entry points.
|
| 19 |
+
//
|
| 20 |
+
// The actual entry points are defined in four .cpp files alongside this .inl
|
| 21 |
+
// file. At most one of these .cpp files will be linked into the resulting
|
| 22 |
+
// executable, so we can treat this .inl file as if its contents are only linked
|
| 23 |
+
// into the executable once as well.
|
| 24 |
+
//
|
| 25 |
+
#include <vcstartup_internal.h>
|
| 26 |
+
#include <vcruntime_internal.h>
|
| 27 |
+
#include <locale.h>
|
| 28 |
+
#include <math.h>
|
| 29 |
+
#include <new.h>
|
| 30 |
+
#include <process.h>
|
| 31 |
+
#include <rtcapi.h>
|
| 32 |
+
#include <stdio.h>
|
| 33 |
+
#include <stdlib.h>
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| 38 |
+
//
|
| 39 |
+
// Common main()/WinMain() implementation
|
| 40 |
+
//
|
| 41 |
+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| 42 |
+
struct __scrt_main_policy
|
| 43 |
+
{
|
| 44 |
+
static void set_app_type() { _set_app_type(_crt_console_app); }
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
struct __scrt_winmain_policy
|
| 48 |
+
{
|
| 49 |
+
static void set_app_type() { _set_app_type(_crt_gui_app); }
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
struct __scrt_enclavemain_policy
|
| 53 |
+
{
|
| 54 |
+
static void set_app_type() { }
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
struct __scrt_file_policy
|
| 58 |
+
{
|
| 59 |
+
static void set_fmode() { _set_fmode(_get_startup_file_mode()); }
|
| 60 |
+
static void set_commode() { _commode = _get_startup_commit_mode(); }
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
struct __scrt_nofile_policy
|
| 64 |
+
{
|
| 65 |
+
static void set_fmode() { }
|
| 66 |
+
static void set_commode() { }
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
#if defined _SCRT_STARTUP_MAIN
|
| 70 |
+
|
| 71 |
+
using main_policy = __scrt_main_policy;
|
| 72 |
+
using file_policy = __scrt_file_policy;
|
| 73 |
+
using argv_policy = __scrt_narrow_argv_policy;
|
| 74 |
+
using environment_policy = __scrt_narrow_environment_policy;
|
| 75 |
+
|
| 76 |
+
static int __cdecl invoke_main()
|
| 77 |
+
{
|
| 78 |
+
return main(__argc, __argv, _get_initial_narrow_environment());
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
#elif defined _SCRT_STARTUP_WMAIN
|
| 82 |
+
|
| 83 |
+
using main_policy = __scrt_main_policy;
|
| 84 |
+
using file_policy = __scrt_file_policy;
|
| 85 |
+
using argv_policy = __scrt_wide_argv_policy;
|
| 86 |
+
using environment_policy = __scrt_wide_environment_policy;
|
| 87 |
+
|
| 88 |
+
static int __cdecl invoke_main()
|
| 89 |
+
{
|
| 90 |
+
return wmain(__argc, __wargv, _get_initial_wide_environment());
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
#elif defined _SCRT_STARTUP_WINMAIN
|
| 94 |
+
|
| 95 |
+
using main_policy = __scrt_winmain_policy;
|
| 96 |
+
using file_policy = __scrt_file_policy;
|
| 97 |
+
using argv_policy = __scrt_narrow_argv_policy;
|
| 98 |
+
using environment_policy = __scrt_narrow_environment_policy;
|
| 99 |
+
|
| 100 |
+
static int __cdecl invoke_main()
|
| 101 |
+
{
|
| 102 |
+
return WinMain(
|
| 103 |
+
reinterpret_cast<HINSTANCE>(&__ImageBase),
|
| 104 |
+
nullptr,
|
| 105 |
+
_get_narrow_winmain_command_line(),
|
| 106 |
+
__scrt_get_show_window_mode());
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
#elif defined _SCRT_STARTUP_WWINMAIN
|
| 110 |
+
|
| 111 |
+
using main_policy = __scrt_winmain_policy;
|
| 112 |
+
using file_policy = __scrt_file_policy;
|
| 113 |
+
using argv_policy = __scrt_wide_argv_policy;
|
| 114 |
+
using environment_policy = __scrt_wide_environment_policy;
|
| 115 |
+
|
| 116 |
+
static int __cdecl invoke_main()
|
| 117 |
+
{
|
| 118 |
+
return wWinMain(
|
| 119 |
+
reinterpret_cast<HINSTANCE>(&__ImageBase),
|
| 120 |
+
nullptr,
|
| 121 |
+
_get_wide_winmain_command_line(),
|
| 122 |
+
__scrt_get_show_window_mode());
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
#elif defined _SCRT_STARTUP_ENCLAVE || defined _SCRT_STARTUP_WENCLAVE
|
| 126 |
+
|
| 127 |
+
using main_policy = __scrt_enclavemain_policy;
|
| 128 |
+
using file_policy = __scrt_nofile_policy;
|
| 129 |
+
using argv_policy = __scrt_no_argv_policy;
|
| 130 |
+
using environment_policy = __scrt_no_environment_policy;
|
| 131 |
+
|
| 132 |
+
#if defined _SCRT_STARTUP_ENCLAVE
|
| 133 |
+
static int __cdecl invoke_main()
|
| 134 |
+
{
|
| 135 |
+
return main(0, nullptr, nullptr);
|
| 136 |
+
}
|
| 137 |
+
#else
|
| 138 |
+
static int __cdecl invoke_main()
|
| 139 |
+
{
|
| 140 |
+
return wmain(0, nullptr, nullptr);
|
| 141 |
+
}
|
| 142 |
+
#endif
|
| 143 |
+
|
| 144 |
+
#endif
|
| 145 |
+
|
| 146 |
+
static int __cdecl pre_c_initialization()
|
| 147 |
+
{
|
| 148 |
+
main_policy::set_app_type();
|
| 149 |
+
|
| 150 |
+
file_policy::set_fmode();
|
| 151 |
+
file_policy::set_commode();
|
| 152 |
+
|
| 153 |
+
if (!__scrt_initialize_onexit_tables(__scrt_module_type::exe))
|
| 154 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 155 |
+
|
| 156 |
+
#ifdef _M_IX86
|
| 157 |
+
// Clear the x87 exception flags. Any other floating point initialization
|
| 158 |
+
// should already have taken place before this function is called.
|
| 159 |
+
_asm { fnclex }
|
| 160 |
+
#endif
|
| 161 |
+
|
| 162 |
+
#ifdef _RTC
|
| 163 |
+
_RTC_Initialize();
|
| 164 |
+
atexit(_RTC_Terminate);
|
| 165 |
+
#endif
|
| 166 |
+
|
| 167 |
+
if (argv_policy::configure_argv() != 0)
|
| 168 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 169 |
+
|
| 170 |
+
__scrt_initialize_type_info();
|
| 171 |
+
|
| 172 |
+
// If the user provided a _matherr handler, register it with the Universal
|
| 173 |
+
// CRT. Windows OS components cannot set a custom matherr handler (this is
|
| 174 |
+
// a policy decision, to reduce complexity).
|
| 175 |
+
#ifndef _CRT_WINDOWS
|
| 176 |
+
if (__scrt_is_user_matherr_present())
|
| 177 |
+
{
|
| 178 |
+
__setusermatherr(_matherr);
|
| 179 |
+
}
|
| 180 |
+
#endif
|
| 181 |
+
|
| 182 |
+
_initialize_invalid_parameter_handler();
|
| 183 |
+
_initialize_denormal_control();
|
| 184 |
+
|
| 185 |
+
#ifdef _M_IX86
|
| 186 |
+
_initialize_default_precision();
|
| 187 |
+
#endif
|
| 188 |
+
|
| 189 |
+
_configthreadlocale(_get_startup_thread_locale_mode());
|
| 190 |
+
|
| 191 |
+
if (_should_initialize_environment())
|
| 192 |
+
environment_policy::initialize_environment();
|
| 193 |
+
|
| 194 |
+
__scrt_initialize_winrt();
|
| 195 |
+
|
| 196 |
+
if (__scrt_initialize_mta() != 0)
|
| 197 |
+
{
|
| 198 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
return 0;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
static int __cdecl post_pgo_initialization()
|
| 205 |
+
{
|
| 206 |
+
// This function calls the __local_stdio_{printf,scanf}_options() functions.
|
| 207 |
+
// These functions are defined in public headers with external linkage and
|
| 208 |
+
// thus may be PGO-instrumented. We must not call these functions before the
|
| 209 |
+
// PGO instrumentation library is initialized.
|
| 210 |
+
__scrt_initialize_default_local_stdio_options();
|
| 211 |
+
|
| 212 |
+
return 0;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
static void __cdecl pre_cpp_initialization()
|
| 216 |
+
{
|
| 217 |
+
// Before we begin C++ initialization, set the unhandled exception
|
| 218 |
+
// filter so that unhandled C++ exceptions result in std::terminate
|
| 219 |
+
// being called:
|
| 220 |
+
__scrt_set_unhandled_exception_filter();
|
| 221 |
+
|
| 222 |
+
_set_new_mode(_get_startup_new_mode());
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
// When both the PGO instrumentation library and the CRT are statically linked,
|
| 226 |
+
// PGO will initialize itself in XIAB. We do most pre-C initialization before
|
| 227 |
+
// PGO is initialized, but defer some initialization steps to after. See the
|
| 228 |
+
// commentary in post_pgo_initialization for details.
|
| 229 |
+
_CRTALLOC(".CRT$XIAA") static _PIFV pre_c_initializer = pre_c_initialization;
|
| 230 |
+
_CRTALLOC(".CRT$XIAC") static _PIFV post_pgo_initializer = post_pgo_initialization;
|
| 231 |
+
_CRTALLOC(".CRT$XCAA") static _PVFV pre_cpp_initializer = pre_cpp_initialization;
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
static __declspec(noinline) int __cdecl __scrt_common_main_seh()
|
| 236 |
+
{
|
| 237 |
+
if (!__scrt_initialize_crt(__scrt_module_type::exe))
|
| 238 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 239 |
+
|
| 240 |
+
bool has_cctor = false;
|
| 241 |
+
__try
|
| 242 |
+
{
|
| 243 |
+
bool const is_nested = __scrt_acquire_startup_lock();
|
| 244 |
+
|
| 245 |
+
if (__scrt_current_native_startup_state == __scrt_native_startup_state::initializing)
|
| 246 |
+
{
|
| 247 |
+
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
|
| 248 |
+
}
|
| 249 |
+
else if (__scrt_current_native_startup_state == __scrt_native_startup_state::uninitialized)
|
| 250 |
+
{
|
| 251 |
+
__scrt_current_native_startup_state = __scrt_native_startup_state::initializing;
|
| 252 |
+
|
| 253 |
+
if (_initterm_e(__xi_a, __xi_z) != 0)
|
| 254 |
+
return 255;
|
| 255 |
+
|
| 256 |
+
_initterm(__xc_a, __xc_z);
|
| 257 |
+
|
| 258 |
+
__scrt_current_native_startup_state = __scrt_native_startup_state::initialized;
|
| 259 |
+
}
|
| 260 |
+
else
|
| 261 |
+
{
|
| 262 |
+
has_cctor = true;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
__scrt_release_startup_lock(is_nested);
|
| 266 |
+
|
| 267 |
+
// If this module has any dynamically initialized __declspec(thread)
|
| 268 |
+
// variables, then we invoke their initialization for the primary thread
|
| 269 |
+
// used to start the process:
|
| 270 |
+
_tls_callback_type const* const tls_init_callback = __scrt_get_dyn_tls_init_callback();
|
| 271 |
+
if (*tls_init_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_init_callback))
|
| 272 |
+
{
|
| 273 |
+
(*tls_init_callback)(nullptr, DLL_THREAD_ATTACH, nullptr);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
// If this module has any thread-local destructors, register the
|
| 277 |
+
// callback function with the Unified CRT to run on exit.
|
| 278 |
+
_tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback();
|
| 279 |
+
if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback))
|
| 280 |
+
{
|
| 281 |
+
_register_thread_local_exe_atexit_callback(*tls_dtor_callback);
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
//
|
| 285 |
+
// Initialization is complete; invoke main...
|
| 286 |
+
//
|
| 287 |
+
|
| 288 |
+
int const main_result = invoke_main();
|
| 289 |
+
|
| 290 |
+
//
|
| 291 |
+
// main has returned; exit somehow...
|
| 292 |
+
//
|
| 293 |
+
|
| 294 |
+
if (!__scrt_is_managed_app())
|
| 295 |
+
exit(main_result);
|
| 296 |
+
|
| 297 |
+
if (!has_cctor)
|
| 298 |
+
_cexit();
|
| 299 |
+
|
| 300 |
+
// Finally, we terminate the CRT:
|
| 301 |
+
__scrt_uninitialize_crt(true, false);
|
| 302 |
+
return main_result;
|
| 303 |
+
}
|
| 304 |
+
__except (_seh_filter_exe(GetExceptionCode(), GetExceptionInformation()))
|
| 305 |
+
{
|
| 306 |
+
// Note: We should never reach this except clause.
|
| 307 |
+
int const main_result = GetExceptionCode();
|
| 308 |
+
|
| 309 |
+
if (!__scrt_is_managed_app())
|
| 310 |
+
_exit(main_result);
|
| 311 |
+
|
| 312 |
+
if (!has_cctor)
|
| 313 |
+
_c_exit();
|
| 314 |
+
|
| 315 |
+
return main_result;
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
// This is the common main implementation to which all of the CRT main functions
|
| 322 |
+
// delegate (for executables; DLLs are handled separately).
|
| 323 |
+
static __forceinline int __cdecl __scrt_common_main()
|
| 324 |
+
{
|
| 325 |
+
// The /GS security cookie must be initialized before any exception handling
|
| 326 |
+
// targeting the current image is registered. No function using exception
|
| 327 |
+
// handling can be called in the current image until after this call:
|
| 328 |
+
__security_init_cookie();
|
| 329 |
+
|
| 330 |
+
return __scrt_common_main_seh();
|
| 331 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_main.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// exe_main.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The mainCRTStartup() entry point, linked into client executables that
|
| 7 |
+
// uses main().
|
| 8 |
+
//
|
| 9 |
+
#define _SCRT_STARTUP_MAIN
|
| 10 |
+
#include "exe_common.inl"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
extern "C" DWORD mainCRTStartup(LPVOID)
|
| 15 |
+
{
|
| 16 |
+
return __scrt_common_main();
|
| 17 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_winmain.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// exe_winmain.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The WinMainCRTStartup() entry point, linked into a client executable that
|
| 7 |
+
// uses WinMain().
|
| 8 |
+
//
|
| 9 |
+
#define _SCRT_STARTUP_WINMAIN
|
| 10 |
+
#include "exe_common.inl"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
extern "C" DWORD WinMainCRTStartup(LPVOID)
|
| 15 |
+
{
|
| 16 |
+
return __scrt_common_main();
|
| 17 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_wmain.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// exe_wmain.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The wmainCRTStartup() entry point, linked into client executables that
|
| 7 |
+
// uses wmain().
|
| 8 |
+
//
|
| 9 |
+
#define _SCRT_STARTUP_WMAIN
|
| 10 |
+
#include "exe_common.inl"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
extern "C" DWORD wmainCRTStartup(LPVOID)
|
| 15 |
+
{
|
| 16 |
+
return __scrt_common_main();
|
| 17 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/exe_wwinmain.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// exe_wwinmain.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// The wWinMainCRTStartup() entry point, linked into client executables that
|
| 7 |
+
// uses wWinMain().
|
| 8 |
+
//
|
| 9 |
+
#define _SCRT_STARTUP_WWINMAIN
|
| 10 |
+
#include "exe_common.inl"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
extern "C" DWORD wWinMainCRTStartup(LPVOID)
|
| 15 |
+
{
|
| 16 |
+
return __scrt_common_main();
|
| 17 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/file_mode.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// file_mode.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Gets the default file open mode, used during executable startup. This
|
| 7 |
+
// behavior is overridable at link-time by linking with one of the link options.
|
| 8 |
+
//
|
| 9 |
+
#include <vcruntime.h>
|
| 10 |
+
#include <fcntl.h>
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
extern "C" int __CRTDECL _get_startup_file_mode()
|
| 15 |
+
{
|
| 16 |
+
return _O_TEXT;
|
| 17 |
+
}
|
miniMSVC/VC/Tools/MSVC/14.42.34433/crt/src/vcruntime/fltused.cpp
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// fltused.cpp
|
| 3 |
+
//
|
| 4 |
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
| 5 |
+
//
|
| 6 |
+
// Default definition of _fltused.
|
| 7 |
+
//
|
| 8 |
+
|
| 9 |
+
extern "C" int _fltused{0x9875};
|