Cleanup debug logging (#932)
This commit is contained in:
parent
60711bfca1
commit
b24a838301
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "proxymodule.h"
|
#include "proxymodule.h"
|
||||||
#include "hostfxr_utility.h"
|
#include "hostfxr_utility.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
#include "debugutil.h"
|
||||||
|
|
||||||
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreInProcessRequestHandlerName = L"aspnetcorev2_inprocess.dll";
|
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreInProcessRequestHandlerName = L"aspnetcorev2_inprocess.dll";
|
||||||
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreOutOfProcessRequestHandlerName = L"aspnetcorev2_outofprocess.dll";
|
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreOutOfProcessRequestHandlerName = L"aspnetcorev2_outofprocess.dll";
|
||||||
|
|
@ -332,6 +333,8 @@ APPLICATION_INFO::FindRequestHandlerAssembly(STRU& location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WDebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO, L"Loading request handler: %s", struFileName.QueryStr());
|
||||||
|
|
||||||
g_hAspnetCoreRH = LoadLibraryW(struFileName.QueryStr());
|
g_hAspnetCoreRH = LoadLibraryW(struFileName.QueryStr());
|
||||||
|
|
||||||
if (g_hAspnetCoreRH == NULL)
|
if (g_hAspnetCoreRH == NULL)
|
||||||
|
|
@ -406,7 +409,7 @@ APPLICATION_INFO::FindNativeAssemblyFromGlobalLocation(
|
||||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
|
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
|
||||||
struEvent.QueryStr());
|
struEvent.QueryStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
#include "globalmodule.h"
|
#include "globalmodule.h"
|
||||||
#include "acache.h"
|
#include "acache.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
#include "debugutil.h"
|
||||||
|
|
||||||
|
DECLARE_DEBUG_PRINT_OBJECT("aspnetcore.dll");
|
||||||
|
|
||||||
HTTP_MODULE_ID g_pModuleId = NULL;
|
HTTP_MODULE_ID g_pModuleId = NULL;
|
||||||
IHttpServer * g_pHttpServer = NULL;
|
IHttpServer * g_pHttpServer = NULL;
|
||||||
|
|
@ -20,11 +23,8 @@ HMODULE g_hAspnetCoreRH = NULL;
|
||||||
BOOL g_fAspnetcoreRHAssemblyLoaded = FALSE;
|
BOOL g_fAspnetcoreRHAssemblyLoaded = FALSE;
|
||||||
BOOL g_fAspnetcoreRHLoadedError = FALSE;
|
BOOL g_fAspnetcoreRHLoadedError = FALSE;
|
||||||
BOOL g_fInShutdown = FALSE;
|
BOOL g_fInShutdown = FALSE;
|
||||||
DWORD g_dwAspNetCoreDebugFlags = 0;
|
|
||||||
DWORD g_dwActiveServerProcesses = 0;
|
DWORD g_dwActiveServerProcesses = 0;
|
||||||
SRWLOCK g_srwLock;
|
SRWLOCK g_srwLock;
|
||||||
DWORD g_dwDebugFlags = 0;
|
|
||||||
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE";
|
|
||||||
PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
@ -100,13 +100,6 @@ HRESULT
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(dwServerVersion);
|
UNREFERENCED_PARAMETER(dwServerVersion);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
CREATE_DEBUG_PRINT_OBJECT("Asp.Net Core Module");
|
|
||||||
g_dwDebugFlags = DEBUG_FLAGS_ANY;
|
|
||||||
#endif // DEBUG
|
|
||||||
|
|
||||||
CREATE_DEBUG_PRINT_OBJECT;
|
|
||||||
|
|
||||||
//LoadGlobalConfiguration();
|
//LoadGlobalConfiguration();
|
||||||
|
|
||||||
InitializeSRWLock(&g_srwLock);
|
InitializeSRWLock(&g_srwLock);
|
||||||
|
|
@ -147,21 +140,11 @@ HRESULT
|
||||||
fDisableANCM = (dwData != 0);
|
fDisableANCM = (dwData != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"DebugFlags",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD))
|
|
||||||
{
|
|
||||||
g_dwAspNetCoreDebugFlags = dwData;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugInitialize();
|
||||||
|
|
||||||
if (fDisableANCM)
|
if (fDisableANCM)
|
||||||
{
|
{
|
||||||
// Logging
|
// Logging
|
||||||
|
|
|
||||||
|
|
@ -1,241 +1,242 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{55494E58-E061-4C4C-A0A8-837008E72F85}</ProjectGuid>
|
<ProjectGuid>{55494E58-E061-4C4C-A0A8-837008E72F85}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>NewCommon</RootNamespace>
|
<RootNamespace>NewCommon</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>C:\AspNetCoreModule\src\IISLib;$(IncludePath)</IncludePath>
|
<IncludePath>C:\AspNetCoreModule\src\IISLib;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>false</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>false</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>false</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>false</SDLCheck>
|
<SDLCheck>false</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<AdditionalUsingDirectories>
|
<AdditionalUsingDirectories>
|
||||||
</AdditionalUsingDirectories>
|
</AdditionalUsingDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="application.h" />
|
<ClInclude Include="application.h" />
|
||||||
<ClInclude Include="config_utility.h" />
|
<ClInclude Include="config_utility.h" />
|
||||||
<ClInclude Include="GlobalVersionUtility.h" />
|
<ClInclude Include="GlobalVersionUtility.h" />
|
||||||
<ClInclude Include="fx_ver.h" />
|
<ClInclude Include="fx_ver.h" />
|
||||||
<ClInclude Include="hostfxroptions.h" />
|
<ClInclude Include="hostfxroptions.h" />
|
||||||
<ClInclude Include="hostfxr_utility.h" />
|
<ClInclude Include="hostfxr_utility.h" />
|
||||||
<ClInclude Include="iapplication.h" />
|
<ClInclude Include="iapplication.h" />
|
||||||
<ClInclude Include="debugutil.h" />
|
<ClInclude Include="debugutil.h" />
|
||||||
<ClInclude Include="disconnectcontext.h" />
|
<ClInclude Include="disconnectcontext.h" />
|
||||||
<ClInclude Include="irequesthandler.h" />
|
<ClInclude Include="irequesthandler.h" />
|
||||||
<ClInclude Include="requesthandler.h" />
|
<ClInclude Include="requesthandler.h" />
|
||||||
<ClInclude Include="resources.h" />
|
<ClInclude Include="resources.h" />
|
||||||
<ClInclude Include="SRWLockWrapper.h" />
|
<ClInclude Include="SRWLockWrapper.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="sttimer.h" />
|
<ClInclude Include="sttimer.h" />
|
||||||
<ClInclude Include="utility.h" />
|
<ClInclude Include="utility.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="fx_ver.cxx" />
|
<ClCompile Include="debugutil.cpp" />
|
||||||
<ClCompile Include="GlobalVersionUtility.cpp" />
|
<ClCompile Include="fx_ver.cxx" />
|
||||||
<ClCompile Include="hostfxr_utility.cpp" />
|
<ClCompile Include="GlobalVersionUtility.cpp" />
|
||||||
<ClCompile Include="hostfxroptions.cpp" />
|
<ClCompile Include="hostfxr_utility.cpp" />
|
||||||
<ClCompile Include="SRWLockWrapper.cpp" />
|
<ClCompile Include="hostfxroptions.cpp" />
|
||||||
<ClCompile Include="utility.cxx" />
|
<ClCompile Include="SRWLockWrapper.cpp" />
|
||||||
</ItemGroup>
|
<ClCompile Include="utility.cxx" />
|
||||||
<ItemGroup>
|
</ItemGroup>
|
||||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
<ItemGroup>
|
||||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||||
</ProjectReference>
|
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||||
</ItemGroup>
|
</ProjectReference>
|
||||||
<ItemGroup>
|
</ItemGroup>
|
||||||
<CustomBuild Include="aspnetcore_msg.mc">
|
<ItemGroup>
|
||||||
<FileType>Document</FileType>
|
<CustomBuild Include="aspnetcore_msg.mc">
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
<FileType>Document</FileType>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
||||||
</CustomBuild>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
</ItemGroup>
|
</CustomBuild>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
</ItemGroup>
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
</ImportGroup>
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "debugutil.h"
|
||||||
|
#include "dbgutil.h"
|
||||||
|
|
||||||
|
inline HANDLE g_hStandardOutput;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DebugInitialize()
|
||||||
|
{
|
||||||
|
g_hStandardOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
|
HKEY hKey;
|
||||||
|
|
||||||
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&hKey) == NO_ERROR)
|
||||||
|
{
|
||||||
|
DWORD dwType;
|
||||||
|
DWORD dwData;
|
||||||
|
DWORD cbData;
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"DebugFlags",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD))
|
||||||
|
{
|
||||||
|
DEBUG_FLAGS_VAR = dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We expect single digit value and a null char
|
||||||
|
const size_t environmentVariableValueSize = 2;
|
||||||
|
std::wstring environmentVariableValue(environmentVariableValueSize, '\0');
|
||||||
|
|
||||||
|
if (GetEnvironmentVariable(L"ASPNETCORE_MODULE_DEBUG", environmentVariableValue.data(), environmentVariableValueSize) == environmentVariableValueSize - 1)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const auto value = std::stoi(environmentVariableValue);
|
||||||
|
|
||||||
|
if (value >= 1) DEBUG_FLAGS_VAR |= ASPNETCORE_DEBUG_FLAG_ERROR;
|
||||||
|
if (value >= 2) DEBUG_FLAGS_VAR |= ASPNETCORE_DEBUG_FLAG_WARNING;
|
||||||
|
if (value >= 3) DEBUG_FLAGS_VAR |= ASPNETCORE_DEBUG_FLAG_INFO;
|
||||||
|
if (value >= 4) DEBUG_FLAGS_VAR |= ASPNETCORE_DEBUG_FLAG_CONSOLE;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
IsEnabled(
|
||||||
|
DWORD dwFlag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ( dwFlag & DEBUG_FLAGS_VAR );
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DebugPrint(
|
||||||
|
DWORD dwFlag,
|
||||||
|
const LPCSTR szString
|
||||||
|
)
|
||||||
|
{
|
||||||
|
STACK_STRA (strOutput, 256);
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if ( IsEnabled( dwFlag ) )
|
||||||
|
{
|
||||||
|
hr = strOutput.SafeSnprintf(
|
||||||
|
"[%s] %s\r\n",
|
||||||
|
DEBUG_LABEL_VAR, szString );
|
||||||
|
|
||||||
|
if (FAILED (hr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputDebugStringA( strOutput.QueryStr() );
|
||||||
|
|
||||||
|
if (IsEnabled(ASPNETCORE_DEBUG_FLAG_CONSOLE))
|
||||||
|
{
|
||||||
|
DWORD nBytesWritten = 0;
|
||||||
|
WriteFile(g_hStandardOutput, strOutput.QueryStr(), strOutput.QueryCB(), &nBytesWritten, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DebugPrintf(
|
||||||
|
DWORD dwFlag,
|
||||||
|
const LPCSTR szFormat,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
STACK_STRA (strCooked,256);
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if ( IsEnabled( dwFlag ) )
|
||||||
|
{
|
||||||
|
va_start( args, szFormat );
|
||||||
|
|
||||||
|
hr = strCooked.SafeVsnprintf(szFormat, args );
|
||||||
|
|
||||||
|
va_end( args );
|
||||||
|
|
||||||
|
if (FAILED (hr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugPrint( dwFlag, strCooked.QueryStr() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WDebugPrintf(
|
||||||
|
DWORD dwFlag,
|
||||||
|
LPWSTR szFormat,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if ( IsEnabled( dwFlag ) )
|
||||||
|
{
|
||||||
|
STACK_STRU (formatted,256);
|
||||||
|
|
||||||
|
va_start( args, szFormat );
|
||||||
|
|
||||||
|
hr = formatted.SafeVsnwprintf(szFormat, args );
|
||||||
|
|
||||||
|
va_end( args );
|
||||||
|
|
||||||
|
if (FAILED (hr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
STACK_STRA (converted, 256);
|
||||||
|
if (FAILED ( converted.CopyW(formatted.QueryStr(), formatted.QueryCCH()) ))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugPrint( dwFlag, converted.QueryStr() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,80 +2,37 @@
|
||||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#define ASPNETCORE_DEBUG_FLAG_INFO 0x00000001
|
#include "stdafx.h"
|
||||||
#define ASPNETCORE_DEBUG_FLAG_WARNING 0x00000002
|
|
||||||
#define ASPNETCORE_DEBUG_FLAG_ERROR 0x00000004
|
|
||||||
|
|
||||||
extern DWORD g_dwAspNetCoreDebugFlags;
|
#define ASPNETCORE_DEBUG_FLAG_INFO DEBUG_FLAG_INFO
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_WARNING DEBUG_FLAG_WARN
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_ERROR DEBUG_FLAG_ERROR
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_CONSOLE 0x00000008
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DebugInitialize();
|
||||||
|
|
||||||
static
|
|
||||||
BOOL
|
BOOL
|
||||||
IfDebug(
|
IsEnabled(
|
||||||
DWORD dwFlag
|
DWORD dwFlag
|
||||||
)
|
);
|
||||||
{
|
|
||||||
return ( dwFlag & g_dwAspNetCoreDebugFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
VOID
|
VOID
|
||||||
DebugPrint(
|
DebugPrint(
|
||||||
DWORD dwFlag,
|
DWORD dwFlag,
|
||||||
LPCSTR szString
|
LPCSTR szString
|
||||||
)
|
);
|
||||||
{
|
|
||||||
STACK_STRA (strOutput, 256);
|
|
||||||
HRESULT hr = S_OK;
|
|
||||||
|
|
||||||
if ( IfDebug( dwFlag ) )
|
|
||||||
{
|
|
||||||
hr = strOutput.SafeSnprintf(
|
|
||||||
"[aspnetcore.dll] %s\r\n",
|
|
||||||
szString );
|
|
||||||
|
|
||||||
if (FAILED (hr))
|
|
||||||
{
|
|
||||||
goto Finished;
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputDebugStringA( strOutput.QueryStr() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Finished:
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
VOID
|
VOID
|
||||||
DebugPrintf(
|
DebugPrintf(
|
||||||
DWORD dwFlag,
|
DWORD dwFlag,
|
||||||
LPCSTR szFormat,
|
LPCSTR szFormat,
|
||||||
...
|
...
|
||||||
)
|
);
|
||||||
{
|
|
||||||
STACK_STRA (strCooked,256);
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
HRESULT hr = S_OK;
|
|
||||||
|
|
||||||
if ( IfDebug( dwFlag ) )
|
|
||||||
{
|
|
||||||
va_start( args, szFormat );
|
|
||||||
|
|
||||||
hr = strCooked.SafeVsnprintf(szFormat, args );
|
|
||||||
|
|
||||||
va_end( args );
|
|
||||||
|
|
||||||
if (FAILED (hr))
|
|
||||||
{
|
|
||||||
goto Finished;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugPrint( dwFlag, strCooked.QueryStr() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Finished:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WDebugPrintf(
|
||||||
|
DWORD dwFlag,
|
||||||
|
LPWSTR szFormat,
|
||||||
|
...
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,6 @@
|
||||||
<ClInclude Include="percpu.h" />
|
<ClInclude Include="percpu.h" />
|
||||||
<ClInclude Include="precomp.h" />
|
<ClInclude Include="precomp.h" />
|
||||||
<ClInclude Include="prime.h" />
|
<ClInclude Include="prime.h" />
|
||||||
<ClInclude Include="pudebug.h" />
|
|
||||||
<ClInclude Include="reftrace.h" />
|
<ClInclude Include="reftrace.h" />
|
||||||
<ClInclude Include="rwlock.h" />
|
<ClInclude Include="rwlock.h" />
|
||||||
<ClInclude Include="stringa.h" />
|
<ClInclude Include="stringa.h" />
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO
|
// TODO
|
||||||
// Using _CrtDbg implementation. If hooking is desired
|
// Using _CrtDbg implementation. If hooking is desired
|
||||||
// wrappers should be provided here so that we can reimplement
|
// wrappers should be provided here so that we can reimplement
|
||||||
// if neecessary.
|
// if neecessary.
|
||||||
//
|
//
|
||||||
// IF_DEBUG/DEBUG FLAGS
|
// IF_DEBUG/DEBUG FLAGS
|
||||||
//
|
//
|
||||||
// registry configuration
|
// registry configuration
|
||||||
|
|
@ -56,7 +56,7 @@ extern DWORD DEBUG_FLAGS_VAR;
|
||||||
|
|
||||||
#define DECLARE_DEBUG_PRINT_OBJECT( _pszLabel_ ) \
|
#define DECLARE_DEBUG_PRINT_OBJECT( _pszLabel_ ) \
|
||||||
PCSTR DEBUG_LABEL_VAR = _pszLabel_; \
|
PCSTR DEBUG_LABEL_VAR = _pszLabel_; \
|
||||||
DWORD DEBUG_FLAGS_VAR = DEBUG_FLAGS_ANY; \
|
DWORD DEBUG_FLAGS_VAR = DEBUG_FLAGS_WARN; \
|
||||||
|
|
||||||
#define DECLARE_DEBUG_PRINT_OBJECT2( _pszLabel_, _dwLevel_ ) \
|
#define DECLARE_DEBUG_PRINT_OBJECT2( _pszLabel_, _dwLevel_ ) \
|
||||||
PCSTR DEBUG_LABEL_VAR = _pszLabel_; \
|
PCSTR DEBUG_LABEL_VAR = _pszLabel_; \
|
||||||
|
|
|
||||||
|
|
@ -1,736 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
# ifndef _PUDEBUG_H_
|
|
||||||
# define _PUDEBUG_H_
|
|
||||||
|
|
||||||
#ifndef _NO_TRACING_
|
|
||||||
# define _NO_TRACING_
|
|
||||||
#endif // _NO_TRACING_
|
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
* Include Headers
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
# ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
# endif // __cplusplus
|
|
||||||
|
|
||||||
# include <windows.h>
|
|
||||||
|
|
||||||
# ifndef dllexp
|
|
||||||
# define dllexp __declspec( dllexport)
|
|
||||||
# endif // dllexp
|
|
||||||
|
|
||||||
#include <specstrings.h>
|
|
||||||
|
|
||||||
#ifndef IN_OUT
|
|
||||||
#define IN_OUT __inout
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Macros
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
enum PRINT_REASONS {
|
|
||||||
PrintNone = 0x0, // Nothing to be printed
|
|
||||||
PrintError = 0x1, // An error message
|
|
||||||
PrintWarning = 0x2, // A warning message
|
|
||||||
PrintLog = 0x3, // Just logging. Indicates a trace of where ...
|
|
||||||
PrintMsg = 0x4, // Echo input message
|
|
||||||
PrintCritical = 0x5, // Print and Exit
|
|
||||||
PrintAssertion= 0x6 // Printing for an assertion failure
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum DEBUG_OUTPUT_FLAGS {
|
|
||||||
DbgOutputNone = 0x0, // None
|
|
||||||
DbgOutputKdb = 0x1, // Output to Kernel Debugger
|
|
||||||
DbgOutputLogFile = 0x2, // Output to LogFile
|
|
||||||
DbgOutputTruncate = 0x4, // Truncate Log File if necessary
|
|
||||||
DbgOutputStderr = 0x8, // Send output to std error
|
|
||||||
DbgOutputBackup = 0x10, // Make backup of debug file ?
|
|
||||||
DbgOutputMemory = 0x20, // Dump to memory buffer
|
|
||||||
DbgOutputAll = 0xFFFFFFFF // All the bits set.
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# define MAX_LABEL_LENGTH ( 100)
|
|
||||||
|
|
||||||
|
|
||||||
// The following flags are used internally to track what level of tracing we
|
|
||||||
// are currently using. Bitmapped for extensibility.
|
|
||||||
#define DEBUG_FLAG_ODS 0x00000001
|
|
||||||
//#define DEBUG_FLAG_INFO 0x00000002
|
|
||||||
//#define DEBUG_FLAG_WARN 0x00000004
|
|
||||||
//#define DEBUG_FLAG_ERROR 0x00000008
|
|
||||||
// The following are used internally to determine whether to log or not based
|
|
||||||
// on what the current state is
|
|
||||||
//#define DEBUG_FLAGS_INFO (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO)
|
|
||||||
//#define DEBUG_FLAGS_WARN (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO | DEBUG_FLAG_WARN)
|
|
||||||
//#define DEBUG_FLAGS_ERROR (DEBUG_FLAG_ODS | DEBUG_FLAG_INFO | DEBUG_FLAG_WARN | DEBUG_FLAG_ERROR)
|
|
||||||
|
|
||||||
#define DEBUG_FLAGS_ANY (DEBUG_FLAG_INFO | DEBUG_FLAG_WARN | DEBUG_FLAG_ERROR)
|
|
||||||
|
|
||||||
//
|
|
||||||
// user of DEBUG infrastructure may choose unique variable name for DEBUG_FLAGS
|
|
||||||
// that's specially useful for cases where DEBUG infrastructure is used within
|
|
||||||
// static library (static library may prefer to maintain it's own DebugFlags independent
|
|
||||||
// on the main program it links to
|
|
||||||
//
|
|
||||||
#ifndef DEBUG_FLAGS_VAR
|
|
||||||
#define DEBUG_FLAGS_VAR g_dwDebugFlags
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern
|
|
||||||
#ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
DWORD DEBUG_FLAGS_VAR ; // Debugging Flags
|
|
||||||
|
|
||||||
# define DECLARE_DEBUG_VARIABLE()
|
|
||||||
|
|
||||||
# define SET_DEBUG_FLAGS( dwFlags) DEBUG_FLAGS_VAR = dwFlags
|
|
||||||
# define GET_DEBUG_FLAGS() ( DEBUG_FLAGS_VAR )
|
|
||||||
|
|
||||||
# define LOAD_DEBUG_FLAGS_FROM_REG(hkey, dwDefault) \
|
|
||||||
DEBUG_FLAGS_VAR = PuLoadDebugFlagsFromReg((hkey), (dwDefault))
|
|
||||||
|
|
||||||
# define LOAD_DEBUG_FLAGS_FROM_REG_STR(pszRegKey, dwDefault) \
|
|
||||||
DEBUG_FLAGS_VAR = PuLoadDebugFlagsFromRegStr((pszRegKey), (dwDefault))
|
|
||||||
|
|
||||||
# define SAVE_DEBUG_FLAGS_IN_REG(hkey, dwDbg) \
|
|
||||||
PuSaveDebugFlagsInReg((hkey), (dwDbg))
|
|
||||||
|
|
||||||
# define DEBUG_IF( arg, s) if ( DEBUG_ ## arg & GET_DEBUG_FLAGS()) { \
|
|
||||||
s \
|
|
||||||
} else {}
|
|
||||||
|
|
||||||
# define IF_DEBUG( arg) if ( DEBUG_## arg & GET_DEBUG_FLAGS())
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
|
||||||
class DEBUG_PRINTS
|
|
||||||
|
|
||||||
This class is responsible for printing messages to log file / kernel debugger
|
|
||||||
|
|
||||||
Currently the class supports only member functions for <ANSI> char.
|
|
||||||
( not unicode-strings).
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _DEBUG_PRINTS {
|
|
||||||
|
|
||||||
CHAR m_rgchLabel[MAX_LABEL_LENGTH];
|
|
||||||
CHAR m_rgchLogFilePath[MAX_PATH];
|
|
||||||
CHAR m_rgchLogFileName[MAX_PATH];
|
|
||||||
HANDLE m_LogFileHandle;
|
|
||||||
HANDLE m_StdErrHandle;
|
|
||||||
BOOL m_fInitialized;
|
|
||||||
BOOL m_fBreakOnAssert;
|
|
||||||
DWORD m_dwOutputFlags;
|
|
||||||
VOID *m_pMemoryLog;
|
|
||||||
} DEBUG_PRINTS, FAR * LPDEBUG_PRINTS;
|
|
||||||
|
|
||||||
|
|
||||||
LPDEBUG_PRINTS
|
|
||||||
PuCreateDebugPrintsObject(
|
|
||||||
IN const char * pszPrintLabel,
|
|
||||||
IN DWORD dwOutputFlags);
|
|
||||||
|
|
||||||
//
|
|
||||||
// frees the debug prints object and closes any file if necessary.
|
|
||||||
// Returns NULL on success or returns pDebugPrints on failure.
|
|
||||||
//
|
|
||||||
LPDEBUG_PRINTS
|
|
||||||
PuDeleteDebugPrintsObject(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
PuDbgPrint(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN const char * pszFormat,
|
|
||||||
...);
|
|
||||||
// arglist
|
|
||||||
VOID
|
|
||||||
PuDbgPrintW(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN const WCHAR * pszFormat,
|
|
||||||
...); // arglist
|
|
||||||
|
|
||||||
// PuDbgPrintError is similar to PuDbgPrint() but allows
|
|
||||||
// one to print error code in friendly manner
|
|
||||||
VOID
|
|
||||||
PuDbgPrintError(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN DWORD dwError,
|
|
||||||
IN const char * pszFormat,
|
|
||||||
...); // arglist
|
|
||||||
|
|
||||||
/*++
|
|
||||||
PuDbgDump() does not do any formatting of output.
|
|
||||||
It just dumps the given message onto the debug destinations.
|
|
||||||
--*/
|
|
||||||
VOID
|
|
||||||
PuDbgDump(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN const char * pszDump
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// PuDbgAssertFailed() *must* be __cdecl to properly capture the
|
|
||||||
// thread context at the time of the failure.
|
|
||||||
//
|
|
||||||
|
|
||||||
INT
|
|
||||||
__cdecl
|
|
||||||
PuDbgAssertFailed(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN const char * pszExpression,
|
|
||||||
IN const char * pszMessage);
|
|
||||||
|
|
||||||
INT
|
|
||||||
WINAPI
|
|
||||||
PuDbgPrintAssertFailed(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName,
|
|
||||||
IN const char * pszExpression,
|
|
||||||
IN const char * pszMessage);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
PuDbgCaptureContext (
|
|
||||||
OUT PCONTEXT ContextRecord
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
PuDbgPrintCurrentTime(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFilePath,
|
|
||||||
IN int nLineNum,
|
|
||||||
IN const char * pszFunctionName
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
PuSetDbgOutputFlags(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN DWORD dwFlags);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuGetDbgOutputFlags(
|
|
||||||
IN const LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Following functions return Win32 error codes.
|
|
||||||
// NO_ERROR if success
|
|
||||||
//
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuOpenDbgPrintFile(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints,
|
|
||||||
IN const char * pszFileName,
|
|
||||||
IN const char * pszPathForFile);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuReOpenDbgPrintFile(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuCloseDbgPrintFile(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuOpenDbgMemoryLog(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuCloseDbgMemoryLog(
|
|
||||||
IN_OUT LPDEBUG_PRINTS pDebugPrints);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuLoadDebugFlagsFromReg(IN HKEY hkey, IN DWORD dwDefault);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuLoadDebugFlagsFromRegStr(IN LPCSTR pszRegKey, IN DWORD dwDefault);
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
PuSaveDebugFlagsInReg(IN HKEY hkey, IN DWORD dwDbg);
|
|
||||||
|
|
||||||
|
|
||||||
# define PuPrintToKdb( pszOutput) \
|
|
||||||
if ( pszOutput != NULL) { \
|
|
||||||
OutputDebugString( pszOutput); \
|
|
||||||
} else {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ifdef __cplusplus
|
|
||||||
};
|
|
||||||
# endif // __cplusplus
|
|
||||||
|
|
||||||
// begin_user_unmodifiable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Macros
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
extern
|
|
||||||
#ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
DEBUG_PRINTS * g_pDebug; // define a global debug variable
|
|
||||||
|
|
||||||
# if DBG
|
|
||||||
|
|
||||||
// For the CHK build we want ODS enabled. For an explanation of these flags see
|
|
||||||
// the comment just after the definition of DBG_CONTEXT
|
|
||||||
# define DECLARE_DEBUG_PRINTS_OBJECT() \
|
|
||||||
DEBUG_PRINTS * g_pDebug = NULL; \
|
|
||||||
DWORD DEBUG_FLAGS_VAR = DEBUG_FLAG_ERROR;
|
|
||||||
|
|
||||||
#else // !DBG
|
|
||||||
|
|
||||||
# define DECLARE_DEBUG_PRINTS_OBJECT() \
|
|
||||||
DEBUG_PRINTS * g_pDebug = NULL; \
|
|
||||||
DWORD DEBUG_FLAGS_VAR = 0;
|
|
||||||
|
|
||||||
#endif // !DBG
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Call the following macro as part of your initialization for program
|
|
||||||
// planning to use the debugging class.
|
|
||||||
//
|
|
||||||
/** DEBUGDEBUG
|
|
||||||
# define CREATE_DEBUG_PRINT_OBJECT( pszLabel) \
|
|
||||||
g_pDebug = PuCreateDebugPrintsObject( pszLabel, DEFAULT_OUTPUT_FLAGS);\
|
|
||||||
if ( g_pDebug == NULL) { \
|
|
||||||
OutputDebugStringA( "Unable to Create Debug Print Object \n"); \
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// Call the following macro once as part of the termination of program
|
|
||||||
// which uses the debugging class.
|
|
||||||
//
|
|
||||||
# define DELETE_DEBUG_PRINT_OBJECT( ) \
|
|
||||||
g_pDebug = PuDeleteDebugPrintsObject( g_pDebug);
|
|
||||||
|
|
||||||
|
|
||||||
# define VALID_DEBUG_PRINT_OBJECT() \
|
|
||||||
( ( g_pDebug != NULL) && g_pDebug->m_fInitialized)
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Use the DBG_CONTEXT without any surrounding braces.
|
|
||||||
// This is used to pass the values for global DebugPrintObject
|
|
||||||
// and File/Line information
|
|
||||||
//
|
|
||||||
//# define DBG_CONTEXT g_pDebug, __FILE__, __LINE__, __FUNCTION__
|
|
||||||
|
|
||||||
// The 3 main tracing macros, each one corresponds to a different level of
|
|
||||||
// tracing
|
|
||||||
|
|
||||||
// The 3 main tracing macros, each one corresponds to a different level of
|
|
||||||
// tracing
|
|
||||||
//# define DBGINFO(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_INFO) { PuDbgPrint args; }}
|
|
||||||
//# define DBGWARN(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_WARN) { PuDbgPrint args; }}
|
|
||||||
//# define DBGERROR(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrint args; }}
|
|
||||||
|
|
||||||
# define DBGINFOW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_INFO) { PuDbgPrintW args; }}
|
|
||||||
# define DBGWARNW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_WARN) { PuDbgPrintW args; }}
|
|
||||||
# define DBGERRORW(args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrintW args; }}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// DBGPRINTF() is printing function ( much like printf) but always called
|
|
||||||
// with the DBG_CONTEXT as follows
|
|
||||||
// DBGPRINTF( ( DBG_CONTEXT, format-string, arguments for format list));
|
|
||||||
//
|
|
||||||
# define DBGPRINTF DBGINFO
|
|
||||||
|
|
||||||
//
|
|
||||||
// DPERROR() is printing function ( much like printf) but always called
|
|
||||||
// with the DBG_CONTEXT as follows
|
|
||||||
// DPERROR( ( DBG_CONTEXT, error, format-string,
|
|
||||||
// arguments for format list));
|
|
||||||
//
|
|
||||||
# define DPERROR( args) {if (DEBUG_FLAGS_VAR & DEBUG_FLAGS_ERROR) { PuDbgPrintError args; }}
|
|
||||||
|
|
||||||
# if DBG
|
|
||||||
|
|
||||||
# define DBG_CODE(s) s /* echoes code in debugging mode */
|
|
||||||
|
|
||||||
// The same 3 main tracing macros however in this case the macros are only compiled
|
|
||||||
// into the CHK build. This is necessary because some tracing info used functions or
|
|
||||||
// variables which are not compiled into the FRE build.
|
|
||||||
# define CHKINFO(args) { PuDbgPrint args; }
|
|
||||||
# define CHKWARN(args) { PuDbgPrint args; }
|
|
||||||
# define CHKERROR(args) { PuDbgPrint args; }
|
|
||||||
|
|
||||||
# define CHKINFOW(args) { PuDbgPrintW args; }
|
|
||||||
# define CHKWARNW(args) { PuDbgPrintW args; }
|
|
||||||
# define CHKERRORW(args) { PuDbgPrintW args; }
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DBG_ASSERT
|
|
||||||
# ifdef _PREFAST_
|
|
||||||
# define DBG_ASSERT(exp) ((void)0) /* Do Nothing */
|
|
||||||
# define DBG_ASSERT_MSG(exp, pszMsg) ((void)0) /* Do Nothing */
|
|
||||||
# define DBG_REQUIRE( exp) ((void) (exp))
|
|
||||||
# else // !_PREFAST_
|
|
||||||
# define DBG_ASSERT( exp ) \
|
|
||||||
( (VOID)( ( exp ) || ( DebugBreak(), \
|
|
||||||
PuDbgPrintAssertFailed( DBG_CONTEXT, #exp, "" ) ) ) )
|
|
||||||
|
|
||||||
# define DBG_ASSERT_MSG( exp, pszMsg) \
|
|
||||||
( (VOID)( ( exp ) || ( DebugBreak(), \
|
|
||||||
PuDbgPrintAssertFailed( DBG_CONTEXT, #exp, pszMsg ) ) ) )
|
|
||||||
|
|
||||||
# define DBG_REQUIRE( exp ) \
|
|
||||||
DBG_ASSERT( exp )
|
|
||||||
# endif // !_PREFAST_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# define DBG_LOG() PuDbgPrint( DBG_CONTEXT, "\n" )
|
|
||||||
|
|
||||||
# define DBG_OPEN_LOG_FILE( pszFile, pszPath ) \
|
|
||||||
PuOpenDbgPrintFile( g_pDebug, (pszFile), (pszPath) )
|
|
||||||
|
|
||||||
# define DBG_CLOSE_LOG_FILE( ) \
|
|
||||||
PuCloseDbgPrintFile( g_pDebug )
|
|
||||||
|
|
||||||
# define DBG_OPEN_MEMORY_LOG( ) \
|
|
||||||
PuOpenDbgMemoryLog( g_pDebug )
|
|
||||||
|
|
||||||
|
|
||||||
# define DBGDUMP( args ) PuDbgDump args
|
|
||||||
|
|
||||||
# define DBGPRINT_CURRENT_TIME() PuDbgPrintCurrentTime( DBG_CONTEXT )
|
|
||||||
|
|
||||||
# else // !DBG
|
|
||||||
|
|
||||||
# define DBG_CODE(s) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define CHKINFO(args) ((void)0) /* Do Nothing */
|
|
||||||
# define CHKWARN(args) ((void)0) /* Do Nothing */
|
|
||||||
# define CHKERROR(args) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define CHKINFOW(args) ((void)0) /* Do Nothing */
|
|
||||||
# define CHKWARNW(args) ((void)0) /* Do Nothing */
|
|
||||||
# define CHKERRORW(args) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
#ifndef DBG_ASSERT
|
|
||||||
# define DBG_ASSERT(exp) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBG_ASSERT_MSG(exp, pszMsg) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBG_REQUIRE( exp) ((void) (exp))
|
|
||||||
#endif // !DBG_ASSERT
|
|
||||||
|
|
||||||
# define DBGDUMP( args) ((void)0) /* Do nothing */
|
|
||||||
|
|
||||||
# define DBG_LOG() ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBG_OPEN_LOG_FILE( pszFile, pszPath) ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBG_OPEN_MEMORY_LOG() ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBG_CLOSE_LOG_FILE() ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# define DBGPRINT_CURRENT_TIME() ((void)0) /* Do Nothing */
|
|
||||||
|
|
||||||
# endif // !DBG
|
|
||||||
|
|
||||||
|
|
||||||
// end_user_unmodifiable
|
|
||||||
|
|
||||||
// begin_user_unmodifiable
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
# undef ASSERT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# define ASSERT( exp) DBG_ASSERT( exp)
|
|
||||||
|
|
||||||
|
|
||||||
// end_user_unmodifiable
|
|
||||||
|
|
||||||
// begin_user_modifiable
|
|
||||||
|
|
||||||
//
|
|
||||||
// Debugging constants consist of two pieces.
|
|
||||||
// All constants in the range 0x0 to 0x8000 are reserved
|
|
||||||
// User extensions may include additional constants (bit flags)
|
|
||||||
//
|
|
||||||
|
|
||||||
# define DEBUG_API_ENTRY 0x00000001L
|
|
||||||
# define DEBUG_API_EXIT 0x00000002L
|
|
||||||
# define DEBUG_INIT_CLEAN 0x00000004L
|
|
||||||
# define DEBUG_ERROR 0x00000008L
|
|
||||||
|
|
||||||
// End of Reserved Range
|
|
||||||
# define DEBUG_RESERVED 0x00000FFFL
|
|
||||||
|
|
||||||
// end_user_modifiable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Platform Type related variables and macros
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
//
|
|
||||||
// Enum for product types
|
|
||||||
//
|
|
||||||
|
|
||||||
typedef enum _PLATFORM_TYPE {
|
|
||||||
|
|
||||||
PtInvalid = 0, // Invalid
|
|
||||||
PtNtWorkstation = 1, // NT Workstation
|
|
||||||
PtNtServer = 2, // NT Server
|
|
||||||
|
|
||||||
} PLATFORM_TYPE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// IISGetPlatformType is the function used to the platform type
|
|
||||||
//
|
|
||||||
|
|
||||||
extern
|
|
||||||
#ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
PLATFORM_TYPE
|
|
||||||
IISGetPlatformType(
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// External Macros
|
|
||||||
//
|
|
||||||
|
|
||||||
#define InetIsNtServer( _pt ) ((_pt) == PtNtServer)
|
|
||||||
#define InetIsNtWksta( _pt ) ((_pt) == PtNtWorkstation)
|
|
||||||
#define InetIsValidPT(_pt) ((_pt) != PtInvalid)
|
|
||||||
|
|
||||||
extern
|
|
||||||
#ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
PLATFORM_TYPE g_PlatformType;
|
|
||||||
|
|
||||||
|
|
||||||
// Use the DECLARE_PLATFORM_TYPE macro to declare the platform type
|
|
||||||
#define DECLARE_PLATFORM_TYPE() \
|
|
||||||
PLATFORM_TYPE g_PlatformType = PtInvalid;
|
|
||||||
|
|
||||||
// Use the INITIALIZE_PLATFORM_TYPE to init the platform type
|
|
||||||
// This should typically go inside the DLLInit or equivalent place.
|
|
||||||
#define INITIALIZE_PLATFORM_TYPE() \
|
|
||||||
g_PlatformType = IISGetPlatformType();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Additional Macros to use the Platform Type
|
|
||||||
//
|
|
||||||
|
|
||||||
#define TsIsNtServer( ) InetIsNtServer(g_PlatformType)
|
|
||||||
#define TsIsNtWksta( ) InetIsNtWksta(g_PlatformType)
|
|
||||||
#define IISIsValidPlatform() InetIsValidPT(g_PlatformType)
|
|
||||||
#define IISPlatformType() (g_PlatformType)
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* Some utility functions for Critical Sections
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
//
|
|
||||||
// IISSetCriticalSectionSpinCount() provides a thunk for the
|
|
||||||
// original NT4.0sp3 API SetCriticalSectionSpinCount() for CS with Spin counts
|
|
||||||
// Users of this function should definitely dynlink with kernel32.dll,
|
|
||||||
// Otherwise errors will surface to a large extent
|
|
||||||
//
|
|
||||||
extern
|
|
||||||
# ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
DWORD
|
|
||||||
IISSetCriticalSectionSpinCount(
|
|
||||||
LPCRITICAL_SECTION lpCriticalSection,
|
|
||||||
DWORD dwSpinCount
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Macro for the calls to SetCriticalSectionSpinCount()
|
|
||||||
//
|
|
||||||
# define SET_CRITICAL_SECTION_SPIN_COUNT( lpCS, dwSpins) \
|
|
||||||
IISSetCriticalSectionSpinCount( (lpCS), (dwSpins))
|
|
||||||
|
|
||||||
//
|
|
||||||
// IIS_DEFAULT_CS_SPIN_COUNT is the default value of spins used by
|
|
||||||
// Critical sections defined within IIS.
|
|
||||||
// NYI: We should have to switch the individual values based on experiments!
|
|
||||||
// Current value is an arbitrary choice
|
|
||||||
//
|
|
||||||
# define IIS_DEFAULT_CS_SPIN_COUNT (1000)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Initializes a critical section and sets its spin count
|
|
||||||
// to IIS_DEFAULT_CS_SPIN_COUNT. Equivalent to
|
|
||||||
// InitializeCriticalSectionAndSpinCount(lpCS, IIS_DEFAULT_CS_SPIN_COUNT),
|
|
||||||
// but provides a safe thunking layer for older systems that don't provide
|
|
||||||
// this API.
|
|
||||||
//
|
|
||||||
extern
|
|
||||||
# ifdef __cplusplus
|
|
||||||
"C"
|
|
||||||
# endif // _cplusplus
|
|
||||||
BOOL
|
|
||||||
IISInitializeCriticalSection(
|
|
||||||
LPCRITICAL_SECTION lpCriticalSection
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Macro for the calls to InitializeCriticalSection()
|
|
||||||
//
|
|
||||||
# define INITIALIZE_CRITICAL_SECTION(lpCS) IISInitializeCriticalSection(lpCS)
|
|
||||||
|
|
||||||
# endif /* _DEBUG_HXX_ */
|
|
||||||
|
|
||||||
//
|
|
||||||
// The following macros allow the automatic naming of certain Win32 objects.
|
|
||||||
// See IIS\SVCS\IISRTL\WIN32OBJ.C for details on the naming convention.
|
|
||||||
//
|
|
||||||
// Set IIS_NAMED_WIN32_OBJECTS to a non-zero value to enable named events,
|
|
||||||
// semaphores, and mutexes.
|
|
||||||
//
|
|
||||||
|
|
||||||
#if DBG
|
|
||||||
#define IIS_NAMED_WIN32_OBJECTS 1
|
|
||||||
#else
|
|
||||||
#define IIS_NAMED_WIN32_OBJECTS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HANDLE
|
|
||||||
PuDbgCreateEvent(
|
|
||||||
__in LPSTR FileName,
|
|
||||||
IN ULONG LineNumber,
|
|
||||||
__in LPSTR MemberName,
|
|
||||||
IN PVOID Address,
|
|
||||||
IN BOOL ManualReset,
|
|
||||||
IN BOOL InitialState
|
|
||||||
);
|
|
||||||
|
|
||||||
HANDLE
|
|
||||||
PuDbgCreateSemaphore(
|
|
||||||
__in LPSTR FileName,
|
|
||||||
IN ULONG LineNumber,
|
|
||||||
__in LPSTR MemberName,
|
|
||||||
IN PVOID Address,
|
|
||||||
IN LONG InitialCount,
|
|
||||||
IN LONG MaximumCount
|
|
||||||
);
|
|
||||||
|
|
||||||
HANDLE
|
|
||||||
PuDbgCreateMutex(
|
|
||||||
__in LPSTR FileName,
|
|
||||||
IN ULONG LineNumber,
|
|
||||||
__in LPSTR MemberName,
|
|
||||||
IN PVOID Address,
|
|
||||||
IN BOOL InitialOwner
|
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if IIS_NAMED_WIN32_OBJECTS
|
|
||||||
|
|
||||||
#define IIS_CREATE_EVENT( membername, address, manual, state ) \
|
|
||||||
PuDbgCreateEvent( \
|
|
||||||
(LPSTR)__FILE__, \
|
|
||||||
(ULONG)__LINE__, \
|
|
||||||
(membername), \
|
|
||||||
(PVOID)(address), \
|
|
||||||
(manual), \
|
|
||||||
(state) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define IIS_CREATE_SEMAPHORE( membername, address, initial, maximum ) \
|
|
||||||
PuDbgCreateSemaphore( \
|
|
||||||
(LPSTR)__FILE__, \
|
|
||||||
(ULONG)__LINE__, \
|
|
||||||
(membername), \
|
|
||||||
(PVOID)(address), \
|
|
||||||
(initial), \
|
|
||||||
(maximum) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define IIS_CREATE_MUTEX( membername, address, initial ) \
|
|
||||||
PuDbgCreateMutex( \
|
|
||||||
(LPSTR)__FILE__, \
|
|
||||||
(ULONG)__LINE__, \
|
|
||||||
(membername), \
|
|
||||||
(PVOID)(address), \
|
|
||||||
(initial) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#else // !IIS_NAMED_WIN32_OBJECTS
|
|
||||||
|
|
||||||
#define IIS_CREATE_EVENT( membername, address, manual, state ) \
|
|
||||||
CreateEventA( \
|
|
||||||
NULL, \
|
|
||||||
(manual), \
|
|
||||||
(state), \
|
|
||||||
NULL \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define IIS_CREATE_SEMAPHORE( membername, address, initial, maximum ) \
|
|
||||||
CreateSemaphoreA( \
|
|
||||||
NULL, \
|
|
||||||
(initial), \
|
|
||||||
(maximum), \
|
|
||||||
NULL \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define IIS_CREATE_MUTEX( membername, address, initial ) \
|
|
||||||
CreateMutexA( \
|
|
||||||
NULL, \
|
|
||||||
(initial), \
|
|
||||||
NULL \
|
|
||||||
)
|
|
||||||
|
|
||||||
#endif // IIS_NAMED_WIN32_OBJECTS
|
|
||||||
|
|
||||||
|
|
||||||
/************************ End of File ***********************/
|
|
||||||
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "dbgutil.h"
|
#include "dbgutil.h"
|
||||||
#include "pudebug.h"
|
|
||||||
#include "reftrace.h"
|
#include "reftrace.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "pudebug.h"
|
|
||||||
#include "tracelog.h"
|
#include "tracelog.h"
|
||||||
#include <intsafe.h>
|
#include <intsafe.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,24 +10,23 @@
|
||||||
#include "inprocessapplication.h"
|
#include "inprocessapplication.h"
|
||||||
#include "inprocesshandler.h"
|
#include "inprocesshandler.h"
|
||||||
#include "requesthandler_config.h"
|
#include "requesthandler_config.h"
|
||||||
|
#include "debugutil.h"
|
||||||
|
|
||||||
|
DECLARE_DEBUG_PRINT_OBJECT("aspnetcorev2_inprocess.dll");
|
||||||
|
|
||||||
BOOL g_fGlobalInitialize = FALSE;
|
BOOL g_fGlobalInitialize = FALSE;
|
||||||
BOOL g_fProcessDetach = FALSE;
|
BOOL g_fProcessDetach = FALSE;
|
||||||
DWORD g_dwAspNetCoreDebugFlags = 0;
|
|
||||||
DWORD g_dwDebugFlags = 0;
|
|
||||||
SRWLOCK g_srwLockRH;
|
SRWLOCK g_srwLockRH;
|
||||||
IHttpServer * g_pHttpServer = NULL;
|
IHttpServer * g_pHttpServer = NULL;
|
||||||
HINSTANCE g_hWinHttpModule;
|
HINSTANCE g_hWinHttpModule;
|
||||||
HINSTANCE g_hAspNetCoreModule;
|
HINSTANCE g_hAspNetCoreModule;
|
||||||
HANDLE g_hEventLog = NULL;
|
HANDLE g_hEventLog = NULL;
|
||||||
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE_INPROCESS_REQUEST_HANDLER";
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
InitializeGlobalConfiguration(
|
InitializeGlobalConfiguration(
|
||||||
IHttpServer * pServer
|
IHttpServer * pServer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
|
||||||
BOOL fLocked = FALSE;
|
BOOL fLocked = FALSE;
|
||||||
|
|
||||||
if (!g_fGlobalInitialize)
|
if (!g_fGlobalInitialize)
|
||||||
|
|
@ -51,29 +50,7 @@ InitializeGlobalConfiguration(
|
||||||
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_EVENT_PROVIDER);
|
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_EVENT_PROVIDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
DebugInitialize();
|
||||||
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
|
||||||
0,
|
|
||||||
KEY_READ,
|
|
||||||
&hKey) == NO_ERROR)
|
|
||||||
{
|
|
||||||
DWORD dwType;
|
|
||||||
DWORD dwData;
|
|
||||||
DWORD cbData;
|
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"DebugFlags",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD))
|
|
||||||
{
|
|
||||||
g_dwAspNetCoreDebugFlags = dwData;
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_fGlobalInitialize = TRUE;
|
g_fGlobalInitialize = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ IN_PROCESS_APPLICATION::LoadManagedApplication
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_status != APPLICATION_STATUS::STARTING)
|
if (m_status != APPLICATION_STATUS::STARTING)
|
||||||
{
|
{
|
||||||
if (m_status == APPLICATION_STATUS::FAIL)
|
if (m_status == APPLICATION_STATUS::FAIL)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include <IPHlpApi.h>
|
#include <IPHlpApi.h>
|
||||||
#include <VersionHelpers.h>
|
#include <VersionHelpers.h>
|
||||||
|
|
||||||
|
DECLARE_DEBUG_PRINT_OBJECT("aspnetcorev2_outofprocess.dll");
|
||||||
|
|
||||||
BOOL g_fNsiApiNotSupported = FALSE;
|
BOOL g_fNsiApiNotSupported = FALSE;
|
||||||
BOOL g_fWebSocketStaticInitialize = FALSE;
|
BOOL g_fWebSocketStaticInitialize = FALSE;
|
||||||
BOOL g_fEnableReferenceCountTracing = FALSE;
|
BOOL g_fEnableReferenceCountTracing = FALSE;
|
||||||
|
|
@ -12,8 +14,6 @@ BOOL g_fOutOfProcessInitializeError = FALSE;
|
||||||
BOOL g_fWinHttpNonBlockingCallbackAvailable = FALSE;
|
BOOL g_fWinHttpNonBlockingCallbackAvailable = FALSE;
|
||||||
BOOL g_fProcessDetach = FALSE;
|
BOOL g_fProcessDetach = FALSE;
|
||||||
DWORD g_OptionalWinHttpFlags = 0;
|
DWORD g_OptionalWinHttpFlags = 0;
|
||||||
DWORD g_dwAspNetCoreDebugFlags = 0;
|
|
||||||
DWORD g_dwDebugFlags = 0;
|
|
||||||
DWORD g_dwTlsIndex = TLS_OUT_OF_INDEXES;
|
DWORD g_dwTlsIndex = TLS_OUT_OF_INDEXES;
|
||||||
SRWLOCK g_srwLockRH;
|
SRWLOCK g_srwLockRH;
|
||||||
HINTERNET g_hWinhttpSession = NULL;
|
HINTERNET g_hWinhttpSession = NULL;
|
||||||
|
|
@ -21,7 +21,6 @@ IHttpServer * g_pHttpServer = NULL;
|
||||||
HINSTANCE g_hWinHttpModule;
|
HINSTANCE g_hWinHttpModule;
|
||||||
HINSTANCE g_hAspNetCoreModule;
|
HINSTANCE g_hAspNetCoreModule;
|
||||||
HANDLE g_hEventLog = NULL;
|
HANDLE g_hEventLog = NULL;
|
||||||
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE_REQUEST_HANDLER";
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
InitializeGlobalConfiguration(
|
InitializeGlobalConfiguration(
|
||||||
|
|
@ -87,21 +86,10 @@ InitializeGlobalConfiguration(
|
||||||
{
|
{
|
||||||
g_fEnableReferenceCountTracing = !!dwData;
|
g_fEnableReferenceCountTracing = !!dwData;
|
||||||
}
|
}
|
||||||
|
|
||||||
cbData = sizeof(dwData);
|
|
||||||
if ((RegQueryValueEx(hKey,
|
|
||||||
L"DebugFlags",
|
|
||||||
NULL,
|
|
||||||
&dwType,
|
|
||||||
(LPBYTE)&dwData,
|
|
||||||
&cbData) == NO_ERROR) &&
|
|
||||||
(dwType == REG_DWORD))
|
|
||||||
{
|
|
||||||
g_dwAspNetCoreDebugFlags = dwData;
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugInitialize();
|
||||||
|
|
||||||
dwResult = GetExtendedTcpTable(NULL,
|
dwResult = GetExtendedTcpTable(NULL,
|
||||||
&dwSize,
|
&dwSize,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
// Externals defined in inprocess
|
// Externals defined in inprocess
|
||||||
BOOL g_fProcessDetach;
|
BOOL g_fProcessDetach;
|
||||||
HANDLE g_hEventLog;
|
HANDLE g_hEventLog;
|
||||||
DWORD g_dwAspNetCoreDebugFlags;
|
|
||||||
PCSTR g_szDebugLabel;
|
PCSTR g_szDebugLabel;
|
||||||
DWORD g_dwDebugFlags;
|
DWORD g_dwDebugFlags;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
var response = await deploymentResult.RetryingHttpClient.GetAsync(_helloWorldRequest);
|
var response = await deploymentResult.RetryingHttpClient.GetAsync(_helloWorldRequest);
|
||||||
var responseText = await response.Content.ReadAsStringAsync();
|
var responseText = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Equal(_helloWorldResponse, responseText);
|
Assert.Equal(_helloWorldResponse, responseText);
|
||||||
|
AssertLoadedVersion(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory] // Tests need to publish to change folder locations
|
[Theory] // Tests need to publish to change folder locations
|
||||||
|
|
@ -99,9 +100,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
var responseText = await response.Content.ReadAsStringAsync();
|
var responseText = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
Assert.Equal(_helloWorldResponse, responseText);
|
Assert.Equal(_helloWorldResponse, responseText);
|
||||||
|
AssertLoadedVersion(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("2.1.0")]
|
[InlineData("2.1.0")]
|
||||||
[InlineData("2.1.0-preview")]
|
[InlineData("2.1.0-preview")]
|
||||||
public async Task GlobalVersion_MultipleRequestHandlers_UpgradeWorks(string version)
|
public async Task GlobalVersion_MultipleRequestHandlers_UpgradeWorks(string version)
|
||||||
|
|
@ -134,6 +136,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
responseText = await response.Content.ReadAsStringAsync();
|
responseText = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
Assert.Equal(_helloWorldResponse, responseText);
|
Assert.Equal(_helloWorldResponse, responseText);
|
||||||
|
AssertLoadedVersion(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeploymentParameters GetGlobalVersionBaseDeploymentParameters()
|
private DeploymentParameters GetGlobalVersionBaseDeploymentParameters()
|
||||||
|
|
@ -156,5 +159,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
version,
|
version,
|
||||||
_aspNetCoreDll);
|
_aspNetCoreDll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AssertLoadedVersion(string version)
|
||||||
|
{
|
||||||
|
Assert.Contains(TestSink.Writes, context => context.Message.Contains(version + @"\aspnetcorev2_outofprocess.dll"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
|
||||||
{
|
{
|
||||||
public class FunctionalTestsBase : LoggedTest
|
public class FunctionalTestsBase : LoggedTest
|
||||||
{
|
{
|
||||||
|
private const string DebugEnvironmentVariable = "ASPNETCORE_MODULE_DEBUG";
|
||||||
|
|
||||||
public FunctionalTestsBase(ITestOutputHelper output = null) : base(output)
|
public FunctionalTestsBase(ITestOutputHelper output = null) : base(output)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -17,6 +19,11 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
|
||||||
|
|
||||||
protected virtual async Task<IISDeploymentResult> DeployAsync(DeploymentParameters parameters)
|
protected virtual async Task<IISDeploymentResult> DeployAsync(DeploymentParameters parameters)
|
||||||
{
|
{
|
||||||
|
if (!parameters.EnvironmentVariables.ContainsKey(DebugEnvironmentVariable))
|
||||||
|
{
|
||||||
|
// enable debug output
|
||||||
|
parameters.EnvironmentVariables[DebugEnvironmentVariable] = "4";
|
||||||
|
}
|
||||||
_deployer = ApplicationDeployerFactory.Create(parameters, LoggerFactory);
|
_deployer = ApplicationDeployerFactory.Create(parameters, LoggerFactory);
|
||||||
|
|
||||||
var result = await _deployer.DeployAsync();
|
var result = await _deployer.DeployAsync();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ANCM IIS": {
|
"ANCM IIS": {
|
||||||
|
|
@ -30,7 +31,8 @@
|
||||||
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
"ANCM_PATH": "$(TargetDir)$(AncmV2Path)",
|
||||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"LAUNCHER_PATH": "$(DotNetPath)"
|
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||||
|
"ASPNETCORE_MODULE_DEBUG": "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue