Cleanup headers and enable MultiProcessorCompilation (#845)

This commit is contained in:
Pavel Krymets 2018-05-29 09:06:21 -07:00 committed by Justin Kotalik
parent 04656d9790
commit 2a467bfd6d
22 changed files with 802 additions and 643 deletions

View File

@ -82,7 +82,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile> <PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile> <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>..\IISLib;inc;..\CommonLib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
@ -96,12 +96,14 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile> <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
@ -115,7 +117,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile> <PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile> <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>..\IISLib;inc;..\CommonLib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
@ -128,6 +130,7 @@
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile> </ClCompile>
<Link> <Link>
@ -135,6 +138,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile> <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
@ -148,7 +152,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\IISLib;inc;..\CommonLib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile> <PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
@ -162,6 +166,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -170,6 +175,7 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile> <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;winhttp.lib;odbc32.lib;ws2_32.lib;odbccp32.lib;wbemuuid.lib;iphlpapi.lib;pdh.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;winhttp.lib;odbc32.lib;ws2_32.lib;odbccp32.lib;wbemuuid.lib;iphlpapi.lib;pdh.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
@ -184,7 +190,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile> <PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\IISLib;inc;..\CommonLib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
@ -197,6 +203,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -205,6 +212,7 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile> <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
@ -218,7 +226,7 @@
<ClInclude Include="Inc\applicationmanager.h" /> <ClInclude Include="Inc\applicationmanager.h" />
<ClInclude Include="Inc\filewatcher.h" /> <ClInclude Include="Inc\filewatcher.h" />
<ClInclude Include="Inc\proxymodule.h" /> <ClInclude Include="Inc\proxymodule.h" />
<ClInclude Include="Src\precomp.hxx" /> <ClInclude Include="Inc\precomp.hxx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Src\applicationinfo.cpp" /> <ClCompile Include="Src\applicationinfo.cpp" />

View File

@ -3,9 +3,17 @@
#pragma once #pragma once
#define API_BUFFER_TOO_SMALL 0x80008098 #include "precomp.hxx"
extern BOOL g_fRecycleProcessCalled; #include "hostfxroptions.h"
#include "appoffline.h"
#include "filewatcher.h"
#include "hashtable.h"
#include "hashfn.h"
#include "aspnetcore_shim_config.h"
#include "iapplication.h"
#define API_BUFFER_TOO_SMALL 0x80008098
typedef typedef
HRESULT HRESULT
@ -16,6 +24,9 @@ HRESULT
_Out_ IAPPLICATION **pApplication _Out_ IAPPLICATION **pApplication
); );
extern BOOL g_fRecycleProcessCalled;
extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
// //
// The key used for hash-table lookups, consists of the port on which the http process is created. // The key used for hash-table lookups, consists of the port on which the http process is created.
// //
@ -168,6 +179,9 @@ private:
SRWLOCK m_srwLock; SRWLOCK m_srwLock;
IHttpServer *m_pServer; IHttpServer *m_pServer;
PFN_ASPNETCORE_CREATE_APPLICATION m_pfnAspNetCoreCreateApplication; PFN_ASPNETCORE_CREATE_APPLICATION m_pfnAspNetCoreCreateApplication;
static const PCWSTR s_pwzAspnetcoreInProcessRequestHandlerName;
static const PCWSTR s_pwzAspnetcoreOutOfProcessRequestHandlerName;
}; };
class APPLICATION_INFO_HASH : class APPLICATION_INFO_HASH :

View File

@ -3,6 +3,12 @@
#pragma once #pragma once
#include "precomp.hxx"
#include "applicationinfo.h"
#include "multisz.h"
#include "filewatcher.h"
#define DEFAULT_HASH_BUCKETS 17 #define DEFAULT_HASH_BUCKETS 17
// //

View File

@ -2,6 +2,9 @@
// 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
#include "precomp.hxx"
class APP_OFFLINE_HTM class APP_OFFLINE_HTM
{ {
public: public:

View File

@ -2,6 +2,9 @@
// 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
#include "precomp.hxx"
#define CS_ASPNETCORE_SECTION L"system.webServer/aspNetCore" #define CS_ASPNETCORE_SECTION L"system.webServer/aspNetCore"
#define CS_ASPNETCORE_PROCESS_EXE_PATH L"processPath" #define CS_ASPNETCORE_PROCESS_EXE_PATH L"processPath"
#define CS_ASPNETCORE_PROCESS_ARGUMENTS L"arguments" #define CS_ASPNETCORE_PROCESS_ARGUMENTS L"arguments"

View File

@ -3,6 +3,8 @@
#pragma once #pragma once
#include "precomp.hxx"
#define FILE_WATCHER_SHUTDOWN_KEY (ULONG_PTR)(-1) #define FILE_WATCHER_SHUTDOWN_KEY (ULONG_PTR)(-1)
#define FILE_WATCHER_ENTRY_BUFFER_SIZE 4096 #define FILE_WATCHER_ENTRY_BUFFER_SIZE 4096
#ifndef CONTAINING_RECORD #ifndef CONTAINING_RECORD

View File

@ -3,6 +3,10 @@
#pragma once #pragma once
#include "precomp.hxx"
#include "applicationmanager.h"
class ASPNET_CORE_GLOBAL_MODULE : public CGlobalModule class ASPNET_CORE_GLOBAL_MODULE : public CGlobalModule
{ {

View File

@ -0,0 +1,66 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
#pragma warning( disable : 4091)
//
// System related headers
//
#define WIN32_LEAN_AND_MEAN
#define NTDDI_VERSION 0x06010000
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#include <Windows.h>
#include <atlbase.h>
#include <httpserv.h>
#include "stringu.h"
#include "stringa.h"
#include "ntassert.h"
#include "dbgutil.h"
#include "aspnetcore_msg.h"
#include "resources.h"
#include <memory>
FORCEINLINE
DWORD
WIN32_FROM_HRESULT(
HRESULT hr
)
{
if ((FAILED(hr)) &&
(HRESULT_FACILITY(hr) == FACILITY_WIN32))
{
return HRESULT_CODE(hr);
}
return hr;
}
FORCEINLINE
HRESULT
HRESULT_FROM_GETLASTERROR()
{
return ( GetLastError() != NO_ERROR )
? HRESULT_FROM_WIN32( GetLastError() )
: E_FAIL;
}
extern PVOID g_pModuleId;
extern BOOL g_fAspnetcoreRHAssemblyLoaded;
extern BOOL g_fAspnetcoreRHLoadedError;
extern BOOL g_fInShutdown;
extern BOOL g_fEnableReferenceCountTracing;
extern DWORD g_dwActiveServerProcesses;
extern HINSTANCE g_hModule;
extern HMODULE g_hAspnetCoreRH;
extern SRWLOCK g_srwLock;
extern PCWSTR g_pwzAspnetcoreRequestHandlerName;
extern HANDLE g_hEventLog;
#pragma warning( error : 4091)

View File

@ -3,6 +3,11 @@
#pragma once #pragma once
#include "precomp.hxx"
#include "applicationinfo.h"
#include "irequesthandler.h"
extern HTTP_MODULE_ID g_pModuleId; extern HTTP_MODULE_ID g_pModuleId;
extern IHttpServer *g_pHttpServer; extern IHttpServer *g_pHttpServer;
extern HMODULE g_hAspnetCoreRH; extern HMODULE g_hAspnetCoreRH;

View File

@ -1,7 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// 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 "precomp.hxx" #include "applicationinfo.h"
#include "proxymodule.h"
#include "hostfxr_utility.h"
#include "utility.h"
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreInProcessRequestHandlerName = L"aspnetcorev2_inprocess.dll";
const PCWSTR APPLICATION_INFO::s_pwzAspnetcoreOutOfProcessRequestHandlerName = L"aspnetcorev2_outofprocess.dll";
APPLICATION_INFO::~APPLICATION_INFO() APPLICATION_INFO::~APPLICATION_INFO()
{ {
@ -258,11 +265,11 @@ APPLICATION_INFO::FindRequestHandlerAssembly(STRU& location)
if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS) if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
{ {
pstrHandlerDllName = g_pwzAspnetcoreInProcessRequestHandlerName; pstrHandlerDllName = s_pwzAspnetcoreInProcessRequestHandlerName;
} }
else else
{ {
pstrHandlerDllName = g_pwzAspnetcoreOutOfProcessRequestHandlerName; pstrHandlerDllName = s_pwzAspnetcoreOutOfProcessRequestHandlerName;
} }
// Try to see if RH is already loaded // Try to see if RH is already loaded
@ -272,7 +279,7 @@ APPLICATION_INFO::FindRequestHandlerAssembly(STRU& location)
{ {
if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS) if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
{ {
std:: unique_ptr<HOSTFXR_OPTIONS> options; std::unique_ptr<HOSTFXR_OPTIONS> options;
if (FAILED(hr = HOSTFXR_OPTIONS::Create( if (FAILED(hr = HOSTFXR_OPTIONS::Create(
NULL, NULL,

View File

@ -1,7 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// 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 "precomp.hxx" #include "applicationmanager.h"
#include "proxymodule.h"
#include "utility.h"
#include <memory>
// The application manager is a singleton across ANCM. // The application manager is a singleton across ANCM.
APPLICATION_MANAGER* APPLICATION_MANAGER::sm_pApplicationManager = NULL; APPLICATION_MANAGER* APPLICATION_MANAGER::sm_pApplicationManager = NULL;

View File

@ -1,7 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// 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 "precomp.hxx" #include "aspnetcore_shim_config.h"
#include "hostfxr_utility.h"
#include "debugutil.h"
#include "ahutil.h"
ASPNETCORE_SHIM_CONFIG::~ASPNETCORE_SHIM_CONFIG() ASPNETCORE_SHIM_CONFIG::~ASPNETCORE_SHIM_CONFIG()
{ {

View File

@ -2,7 +2,13 @@
// 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 "precomp.hxx" #include "precomp.hxx"
#include <IPHlpApi.h>
#include "applicationinfo.h"
#include "applicationmanager.h"
#include "proxymodule.h"
#include "globalmodule.h"
#include "acache.h"
#include "utility.h"
HTTP_MODULE_ID g_pModuleId = NULL; HTTP_MODULE_ID g_pModuleId = NULL;
IHttpServer * g_pHttpServer = NULL; IHttpServer * g_pHttpServer = NULL;
@ -19,8 +25,6 @@ DWORD g_dwActiveServerProcesses = 0;
SRWLOCK g_srwLock; SRWLOCK g_srwLock;
DWORD g_dwDebugFlags = 0; DWORD g_dwDebugFlags = 0;
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE"; PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE";
PCWSTR g_pwzAspnetcoreInProcessRequestHandlerName = L"aspnetcorev2_inprocess.dll";
PCWSTR g_pwzAspnetcoreOutOfProcessRequestHandlerName = L"aspnetcorev2_outofprocess.dll";
PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication; PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
VOID VOID

View File

@ -1,7 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// 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 "precomp.hxx" #include "filewatcher.h"
#include "ntassert.h"
#include "applicationinfo.h"
FILE_WATCHER::FILE_WATCHER() : FILE_WATCHER::FILE_WATCHER() :
m_hCompletionPort(NULL), m_hCompletionPort(NULL),

View File

@ -1,4 +1,7 @@
#include "precomp.hxx" // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "globalmodule.h"
ASPNET_CORE_GLOBAL_MODULE::ASPNET_CORE_GLOBAL_MODULE( ASPNET_CORE_GLOBAL_MODULE::ASPNET_CORE_GLOBAL_MODULE(
APPLICATION_MANAGER* pApplicationManager) APPLICATION_MANAGER* pApplicationManager)

View File

@ -1,160 +1,160 @@
// Copyright (c) .NET Foundation. All rights reserved. // // Copyright (c) .NET Foundation. All rights reserved.
// 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
#pragma warning( disable : 4091) // #pragma warning( disable : 4091)
// // //
// System related headers // // System related headers
// // //
#define _WINSOCKAPI_ // #define _WINSOCKAPI_
#define NTDDI_VERSION 0x06010000 // #define NTDDI_VERSION 0x06010000
#define WINVER 0x0601 // #define WINVER 0x0601
#define _WIN32_WINNT 0x0601 // #define _WIN32_WINNT 0x0601
#include <windows.h> // #include <windows.h>
#include <atlbase.h> // #include <atlbase.h>
#include <pdh.h> // #include <pdh.h>
//#include <ntassert.h> // //#include <ntassert.h>
#include <Shlobj.h> // #include <Shlobj.h>
#include <httpserv.h> // #include <httpserv.h>
// This should remove our issue of compiling for win7 without header files. // // This should remove our issue of compiling for win7 without header files.
// We force the Windows 8 version check logic in iiswebsocket.h to succeed even though we're compiling for Windows 7. // // We force the Windows 8 version check logic in iiswebsocket.h to succeed even though we're compiling for Windows 7.
// Then, we set the version defines back to Windows 7 to for the remainder of the compilation. // // Then, we set the version defines back to Windows 7 to for the remainder of the compilation.
#undef NTDDI_VERSION // #undef NTDDI_VERSION
#undef WINVER // #undef WINVER
#undef _WIN32_WINNT // #undef _WIN32_WINNT
#define NTDDI_VERSION 0x06020000 // #define NTDDI_VERSION 0x06020000
#define WINVER 0x0602 // #define WINVER 0x0602
#define _WIN32_WINNT 0x0602 // #define _WIN32_WINNT 0x0602
#include <iiswebsocket.h> // #include <iiswebsocket.h>
#undef NTDDI_VERSION // #undef NTDDI_VERSION
#undef WINVER // #undef WINVER
#undef _WIN32_WINNT // #undef _WIN32_WINNT
#define NTDDI_VERSION 0x06010000 // #define NTDDI_VERSION 0x06010000
#define WINVER 0x0601 // #define WINVER 0x0601
#define _WIN32_WINNT 0x0601 // #define _WIN32_WINNT 0x0601
#include <httptrace.h> // #include <httptrace.h>
#include <winhttp.h> // #include <winhttp.h>
#include <cstdlib> // #include <cstdlib>
#include <vector> // #include <vector>
#include <wchar.h> // #include <wchar.h>
// // //
// Option available starting Windows 8. // // Option available starting Windows 8.
// 111 is the value in SDK on May 15, 2012. // // 111 is the value in SDK on May 15, 2012.
// // //
#ifndef WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS // #ifndef WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS
#define WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS 111 // #define WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS 111
#endif // #endif
#ifdef max // #ifdef max
#undef max // #undef max
template<typename T> inline T max(T a, T b) // template<typename T> inline T max(T a, T b)
{ // {
return a > b ? a : b; // return a > b ? a : b;
} // }
#endif // #endif
#ifdef min // #ifdef min
#undef min // #undef min
template<typename T> inline T min(T a, T b) // template<typename T> inline T min(T a, T b)
{ // {
return a < b ? a : b; // return a < b ? a : b;
} // }
#endif // #endif
inline bool IsSpace(char ch) // inline bool IsSpace(char ch)
{ // {
switch(ch) // switch(ch)
{ // {
case 32: // ' ' // case 32: // ' '
case 9: // '\t' // case 9: // '\t'
case 10: // '\n' // case 10: // '\n'
case 13: // '\r' // case 13: // '\r'
case 11: // '\v' // case 11: // '\v'
case 12: // '\f' // case 12: // '\f'
return true; // return true;
default: // default:
return false; // return false;
} // }
} // }
#include <hashfn.h> // #include <hashfn.h>
#include <hashtable.h> // #include <hashtable.h>
#include "stringa.h" // #include "stringa.h"
#include "stringu.h" // #include "stringu.h"
#include "dbgutil.h" // #include "dbgutil.h"
#include "ahutil.h" // #include "ahutil.h"
#include "multisz.h" // #include "multisz.h"
#include "multisza.h" // #include "multisza.h"
#include "base64.h" // #include "base64.h"
#include <listentry.h> // #include <listentry.h>
#include <datetime.h> // #include <datetime.h>
#include <reftrace.h> // #include <reftrace.h>
#include <acache.h> // #include <acache.h>
#include <time.h> // #include <time.h>
#include "environmentvariablehash.h" // #include "environmentvariablehash.h"
#include "hostfxr_utility.h" // #include "hostfxr_utility.h"
#include "utility.h" // #include "utility.h"
#include "debugutil.h" // #include "debugutil.h"
#include "requesthandler.h" // #include "requesthandler.h"
#include "resources.h" // #include "resources.h"
#include "aspnetcore_msg.h" // #include "aspnetcore_msg.h"
//#include "aspnetcore_event.h" // //#include "aspnetcore_event.h"
#include "aspnetcore_shim_config.h" // #include "aspnetcore_shim_config.h"
#include "fx_ver.h" // #include "fx_ver.h"
#include "appoffline.h" // #include "appoffline.h"
#include "filewatcher.h" // #include "filewatcher.h"
#include "applicationinfo.h" // #include "applicationinfo.h"
#include "applicationmanager.h" // #include "applicationmanager.h"
#include "globalmodule.h" // #include "globalmodule.h"
#include "proxymodule.h" // #include "proxymodule.h"
#include "applicationinfo.h" // #include "applicationinfo.h"
#include "hostfxroptions.h" // #include "hostfxroptions.h"
FORCEINLINE // FORCEINLINE
DWORD // DWORD
WIN32_FROM_HRESULT( // WIN32_FROM_HRESULT(
HRESULT hr // HRESULT hr
) // )
{ // {
if ((FAILED(hr)) && // if ((FAILED(hr)) &&
(HRESULT_FACILITY(hr) == FACILITY_WIN32)) // (HRESULT_FACILITY(hr) == FACILITY_WIN32))
{ // {
return HRESULT_CODE(hr); // return HRESULT_CODE(hr);
} // }
return hr; // return hr;
} // }
FORCEINLINE // FORCEINLINE
HRESULT // HRESULT
HRESULT_FROM_GETLASTERROR() // HRESULT_FROM_GETLASTERROR()
{ // {
return ( GetLastError() != NO_ERROR ) // return ( GetLastError() != NO_ERROR )
? HRESULT_FROM_WIN32( GetLastError() ) // ? HRESULT_FROM_WIN32( GetLastError() )
: E_FAIL; // : E_FAIL;
} // }
extern PVOID g_pModuleId; // extern PVOID g_pModuleId;
extern BOOL g_fAspnetcoreRHAssemblyLoaded; // extern BOOL g_fAspnetcoreRHAssemblyLoaded;
extern BOOL g_fAspnetcoreRHLoadedError; // extern BOOL g_fAspnetcoreRHLoadedError;
extern BOOL g_fInShutdown; // extern BOOL g_fInShutdown;
extern BOOL g_fEnableReferenceCountTracing; // extern BOOL g_fEnableReferenceCountTracing;
extern DWORD g_dwActiveServerProcesses; // extern DWORD g_dwActiveServerProcesses;
extern HINSTANCE g_hModule; // extern HINSTANCE g_hModule;
extern HMODULE g_hAspnetCoreRH; // extern HMODULE g_hAspnetCoreRH;
extern SRWLOCK g_srwLock; // extern SRWLOCK g_srwLock;
extern HANDLE g_hEventLog; // extern HANDLE g_hEventLog;
extern PCWSTR g_pwzAspnetcoreInProcessRequestHandlerName; // extern PCWSTR g_pwzAspnetcoreInProcessRequestHandlerName;
extern PCWSTR g_pwzAspnetcoreOutOfProcessRequestHandlerName; // extern PCWSTR g_pwzAspnetcoreOutOfProcessRequestHandlerName;
extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication; // extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
#pragma warning( error : 4091) // #pragma warning( error : 4091)

View File

@ -1,9 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// 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 "precomp.hxx" #include "proxymodule.h"
#include "applicationmanager.h"
#include "applicationinfo.h"
#include "acache.h"
#include "hostfxroptions.h" #include "hostfxroptions.h"
__override __override
HRESULT HRESULT
ASPNET_CORE_PROXY_MODULE_FACTORY::GetHttpModule( ASPNET_CORE_PROXY_MODULE_FACTORY::GetHttpModule(
@ -41,7 +46,7 @@ Return value:
--*/ --*/
{ {
/* FORWARDING_HANDLER::StaticTerminate(); /* FORWARDING_HANDLER::StaticTerminate();
WEBSOCKET_HANDLER::StaticTerminate();*/ WEBSOCKET_HANDLER::StaticTerminate();*/
@ -81,7 +86,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
APPLICATION_MANAGER *pApplicationManager = NULL; APPLICATION_MANAGER *pApplicationManager = NULL;
REQUEST_NOTIFICATION_STATUS retVal = RQ_NOTIFICATION_CONTINUE; REQUEST_NOTIFICATION_STATUS retVal = RQ_NOTIFICATION_CONTINUE;
IAPPLICATION* pApplication = NULL; IAPPLICATION* pApplication = NULL;
STACK_STRU(struFileName, 256); STRU struExeLocation;
if (g_fInShutdown) if (g_fInShutdown)
{ {
@ -123,9 +128,9 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
// Set fTrySkipCustomErrors to true as we want client see the offline content // Set fTrySkipCustomErrors to true as we want client see the offline content
pResponse->SetStatus(503, "Service Unavailable", 0, hr, NULL, TRUE); pResponse->SetStatus(503, "Service Unavailable", 0, hr, NULL, TRUE);
pResponse->SetHeader("Content-Type", pResponse->SetHeader("Content-Type",
"text/html", "text/html",
(USHORT)strlen("text/html"), (USHORT)strlen("text/html"),
FALSE FALSE
); );
DataChunk.DataChunkType = HttpDataChunkFromMemory; DataChunk.DataChunkType = HttpDataChunkFromMemory;
@ -158,7 +163,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
// Create RequestHandler and process the request // Create RequestHandler and process the request
hr = pApplication->CreateHandler(pHttpContext, hr = pApplication->CreateHandler(pHttpContext,
&m_pHandler); &m_pHandler);
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -96,6 +96,7 @@
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -116,6 +117,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -136,6 +138,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -160,6 +163,7 @@
</AdditionalUsingDirectories> </AdditionalUsingDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -202,6 +206,11 @@
</ClCompile> </ClCompile>
<ClCompile Include="utility.cxx" /> <ClCompile Include="utility.cxx" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="aspnetcore_msg.mc"> <CustomBuild Include="aspnetcore_msg.mc">
<FileType>Document</FileType> <FileType>Document</FileType>
@ -219,11 +228,6 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
<Project>{09d9d1d6-2951-4e14-bc35-76a23cf9391a}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -3,6 +3,10 @@
#pragma once #pragma once
#include "precomp.h"
#include <vector>
typedef INT(*hostfxr_get_native_search_directories_fn) (CONST INT argc, CONST PCWSTR* argv, PWSTR buffer, DWORD buffer_size, DWORD* required_buffer_size); typedef INT(*hostfxr_get_native_search_directories_fn) (CONST INT argc, CONST PCWSTR* argv, PWSTR buffer, DWORD buffer_size, DWORD* required_buffer_size);
typedef INT(*hostfxr_main_fn) (CONST DWORD argc, CONST PCWSTR argv[]); typedef INT(*hostfxr_main_fn) (CONST DWORD argc, CONST PCWSTR argv[]);

View File

@ -3,6 +3,8 @@
#pragma once #pragma once
#include <memory>
class HOSTFXR_OPTIONS class HOSTFXR_OPTIONS
{ {
public: public:

View File

@ -92,6 +92,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -110,6 +111,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -129,6 +131,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -150,6 +153,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>

View File

@ -103,6 +103,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -133,6 +134,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -163,6 +165,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -195,6 +198,7 @@
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>