Expose VirtualDirectory to In Process mode (#210)

This commit is contained in:
Justin Kotalik 2017-10-25 12:35:47 -07:00 committed by GitHub
parent 332b108f41
commit 9c5d38a786
3 changed files with 51 additions and 6 deletions

View File

@ -139,6 +139,14 @@ public:
return &m_struApplicationFullPath;
}
STRU*
QueryApplicationVirtualPath(
VOID
)
{
return &m_struApplicationVirtualPath;
}
STRU*
QueryProcessPath(
VOID
@ -233,6 +241,7 @@ private:
STRU m_struStdoutLogFile;
STRU m_struApplicationFullPath;
STRU m_strHostingModel;
STRU m_struApplicationVirtualPath;
BOOL m_fStdoutLogEnabled;
BOOL m_fForwardWindowsAuthToken;
BOOL m_fDisableStartUpErrorPage;

View File

@ -157,6 +157,9 @@ ASPNETCORE_CONFIG::Populate(
ULONGLONG ullRawTimeSpan = 0;
ENUM_INDEX index;
ENVIRONMENT_VAR_ENTRY* pEntry = NULL;
DWORD dwCounter = 0;
DWORD dwPosition = 0;
WCHAR* pszPath = NULL;
m_pEnvironmentVariables = new ENVIRONMENT_VAR_HASH();
if (m_pEnvironmentVariables == NULL)
@ -184,6 +187,33 @@ ASPNETCORE_CONFIG::Populate(
goto Finished;
}
pszPath = strSiteConfigPath.QueryStr();
while (pszPath[dwPosition] != NULL)
{
if (pszPath[dwPosition] == '/')
{
dwCounter++;
if (dwCounter == 4)
break;
}
dwPosition++;
}
if (dwCounter == 4)
{
hr = m_struApplicationVirtualPath.Copy(pszPath + dwPosition);
}
else
{
hr = m_struApplicationVirtualPath.Copy(L"/");
}
// Will setup the application virtual path.
if (FAILED(hr))
{
goto Finished;
}
hr = pAdminManager->GetAdminSection(CS_WINDOWS_AUTHENTICATION_SECTION,
strSiteConfigPath.QueryStr(),
&pWindowsAuthenticationElement);

View File

@ -136,16 +136,22 @@ http_get_completion_info(
// the signature should be changed. application's based address should be passed in
//
EXTERN_C __MIDL_DECLSPEC_DLLEXPORT
BSTR // TODO probably should make this a wide string
http_get_application_full_path()
HRESULT // TODO probably should make this a wide string
http_get_application_paths(
_Out_ BSTR* pwzFullPath,
_Out_ BSTR* pwzVirtualPath
)
{
LPWSTR pwzPath = NULL;
IN_PROCESS_APPLICATION* pApplication = IN_PROCESS_APPLICATION::GetInstance();
if (pApplication != NULL)
if (pApplication == NULL)
{
pwzPath = pApplication->QueryConfig()->QueryApplicationFullPath()->QueryStr();
return E_FAIL;
}
return SysAllocString(pwzPath);
// These should be provided to the in process application as arguments?
*pwzFullPath = SysAllocString(pApplication->QueryConfig()->QueryApplicationFullPath()->QueryStr());
*pwzVirtualPath = SysAllocString(pApplication->QueryConfig()->QueryApplicationVirtualPath()->QueryStr());
return S_OK;
}
EXTERN_C __MIDL_DECLSPEC_DLLEXPORT