diff --git a/src/BuildTools.sln b/src/BuildTools.sln
index 49cb0b4666..f6fd7339dd 100644
--- a/src/BuildTools.sln
+++ b/src/BuildTools.sln
@@ -4,8 +4,6 @@ VisualStudioVersion = 15.0.26730.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.Build.Tasks", "Microsoft.DotNet.Build.Tasks\Microsoft.DotNet.Build.Tasks.csproj", "{17C66BCE-EB35-44CA-893C-8AAFB67708E9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunit.console.netcore", "xunit.console.netcore\xunit.console.netcore.csproj", "{83FC1994-BCE0-427A-803B-02F20233A2D1}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8B5A7D0F-2BD5-4892-9662-8FDC3589D938}"
ProjectSection(SolutionItems) = preProject
.nuget\packages.Unix.config = .nuget\packages.Unix.config
@@ -27,8 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{DEEA
Scripts\set-package-build.cmd = Scripts\set-package-build.cmd
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunit.netcore.extensions", "xunit.netcore.extensions\xunit.netcore.extensions.csproj", "{BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Cci.Extensions", "Microsoft.Cci.Extensions\Microsoft.Cci.Extensions.csproj", "{2179F9B5-1DBA-4563-9402-A94DE75EA9FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenAPI", "GenAPI\GenAPI.csproj", "{E5BBF3AB-61AF-48FB-B105-799868C410C3}"
@@ -41,8 +37,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.Build.Clou
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.CodeAnalysis", "Microsoft.DotNet.CodeAnalysis\Microsoft.DotNet.CodeAnalysis.csproj", "{0847DEA9-C368-4C4D-BE57-EF4D244493C5}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunit.console.uwp", "xunit.console.uwp\xunit.console.uwp.csproj", "{36219AA4-D36A-4CB4-9C7B-FB48641D411A}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.VersionTools", "Microsoft.DotNet.VersionTools\Microsoft.DotNet.VersionTools.csproj", "{8D524FA5-A8C5-4EBD-BA8B-2A4FED03EE58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.Build.VstsBuildsApi", "Microsoft.DotNet.Build.VSTSBuildsApi\Microsoft.DotNet.Build.VstsBuildsApi.csproj", "{DD658734-88B2-48AD-8ADC-69D5C5798D9B}"
@@ -95,42 +89,6 @@ Global
{17C66BCE-EB35-44CA-893C-8AAFB67708E9}.Release|x64.ActiveCfg = Release|Any CPU
{17C66BCE-EB35-44CA-893C-8AAFB67708E9}.Release|x64.Build.0 = Release|Any CPU
{17C66BCE-EB35-44CA-893C-8AAFB67708E9}.Release|x86.ActiveCfg = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|x64.ActiveCfg = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|x64.Build.0 = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Debug|x86.ActiveCfg = Debug|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|Any CPU.Build.0 = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|ARM.ActiveCfg = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|x64.ActiveCfg = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|x64.Build.0 = Release|Any CPU
- {83FC1994-BCE0-427A-803B-02F20233A2D1}.Release|x86.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|ARM.Build.0 = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|x64.Build.0 = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Debug|x86.Build.0 = Debug|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|Any CPU.Build.0 = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|ARM.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|ARM.Build.0 = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|x64.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|x64.Build.0 = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|x86.ActiveCfg = Release|Any CPU
- {BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}.Release|x86.Build.0 = Release|Any CPU
{2179F9B5-1DBA-4563-9402-A94DE75EA9FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2179F9B5-1DBA-4563-9402-A94DE75EA9FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2179F9B5-1DBA-4563-9402-A94DE75EA9FA}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -245,26 +203,6 @@ Global
{0847DEA9-C368-4C4D-BE57-EF4D244493C5}.Release|x64.Build.0 = Release|Any CPU
{0847DEA9-C368-4C4D-BE57-EF4D244493C5}.Release|x86.ActiveCfg = Release|Any CPU
{0847DEA9-C368-4C4D-BE57-EF4D244493C5}.Release|x86.Build.0 = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|ARM.Build.0 = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|x64.Build.0 = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Debug|x86.Build.0 = Debug|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|Any CPU.Build.0 = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|ARM.ActiveCfg = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|ARM.Build.0 = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|x64.ActiveCfg = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|x64.Build.0 = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|x86.ActiveCfg = Release|Any CPU
- {36219AA4-D36A-4CB4-9C7B-FB48641D411A}.Release|x86.Build.0 = Release|Any CPU
{8D524FA5-A8C5-4EBD-BA8B-2A4FED03EE58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D524FA5-A8C5-4EBD-BA8B-2A4FED03EE58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D524FA5-A8C5-4EBD-BA8B-2A4FED03EE58}.Debug|ARM.ActiveCfg = Debug|Any CPU
diff --git a/src/Microsoft.xunit.extensibility.execution.netcore/Microsoft.xunit.extensibility.execution.netcore.depproj b/src/Microsoft.xunit.extensibility.execution.netcore/Microsoft.xunit.extensibility.execution.netcore.depproj
deleted file mode 100644
index 900aab273c..0000000000
--- a/src/Microsoft.xunit.extensibility.execution.netcore/Microsoft.xunit.extensibility.execution.netcore.depproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- 4.0.0.0
- Library
- .NETStandard,Version=v1.3
- any
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Microsoft.xunit.extensibility.execution.netcore/project.json b/src/Microsoft.xunit.extensibility.execution.netcore/project.json
deleted file mode 100644
index 42c15c6102..0000000000
--- a/src/Microsoft.xunit.extensibility.execution.netcore/project.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "dependencies": {
- "xunit.extensibility.execution": "2.1.0",
- },
- "frameworks": {
- "netstandard1.3": {
- "imports": "portable-net45+win8"
- }
- },
- "runtimes": {
- "any": {}
- }
-}
diff --git a/src/WindowsStoreAppLauncher/App.h b/src/WindowsStoreAppLauncher/App.h
deleted file mode 100644
index 807a2a7416..0000000000
--- a/src/WindowsStoreAppLauncher/App.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#pragma once
-#include
-#include
-using namespace std;
-
-class App
-{
-public:
- virtual ~App()
- {}
- virtual void Add() = 0;
- virtual void Remove() = 0;
-
- virtual void Start(bool runInBackground, bool testApp, const wstring& executionArgs) = 0;
- virtual void Start(bool runInBackground, bool testApp) = 0;
- virtual void Stop() = 0;
- virtual DWORD WaitForExit() = 0;
- virtual DWORD WaitForExit(DWORD milliseconds, bool* result) = 0;
-
- virtual void EnableDebug(const wstring& debuggerCommandLine) = 0;
- virtual void DisableDebug() = 0;
-
- virtual wstring GetAppStdOutContent() = 0;
- virtual DWORD GetAppExitCode() = 0;
- virtual wstring get_PackageFullName() const throw() = 0;
-};
\ No newline at end of file
diff --git a/src/WindowsStoreAppLauncher/AppxApp.cpp b/src/WindowsStoreAppLauncher/AppxApp.cpp
deleted file mode 100644
index eafcc27adf..0000000000
--- a/src/WindowsStoreAppLauncher/AppxApp.cpp
+++ /dev/null
@@ -1,427 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#include "stdafx.h"
-#include "AppxApp.h"
-#include "Support.h"
-#include "Stream.h"
-
-
-using namespace std;
-using namespace ABI::Windows::ApplicationModel::Activation;
-using namespace ABI::Windows::Management::Deployment;
-using namespace ABI::Windows::Foundation;
-using namespace Microsoft::WRL;
-
-typedef
-unique_ptr
-unique_char_array;
-
-void unique_char_deleter(wchar_t* arr)
-{
- delete [] arr;
-}
-
-AppxApp::AppxApp(const wstring& mainfestPath, const wstring& appId)
-:m_manifestPath(mainfestPath), m_appId(appId), m_hProcess(nullptr)
-{
- // Get the full path to the appx manifest file
- unique_ptr manifestFullPath(reinterpret_cast(malloc(MAX_PATH * sizeof(wchar_t))), free);
- IFT(GetFullPathName(m_manifestPath.c_str(), MAX_PATH, manifestFullPath.get(), nullptr) != 0 ? S_OK : HRESULT_FROM_WIN32(GetLastError()));
- m_manifestPath = manifestFullPath.get();
-
- // Create AppxFactory
- dprintf("Creating AppxFactory...\n");
- ComPtr appxFactory;
- IFT(CoCreateInstance(__uuidof(AppxFactory), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&appxFactory)));
-
- // Create IStream for Appx manifest file
- dprintf("Creating Stream...\n");
- ComPtr appxManifestPathStream = Make(m_manifestPath);
-
- // Read the AppXManifest.xml file
- dprintf("Creating Manifest Reader...\n");
- ComPtr appxManifestReader;
- IFT(appxFactory->CreateManifestReader(appxManifestPathStream.Get(), &appxManifestReader));
-
- dprintf("Creating PackageID...\n");
- // Get the AppxManifestPackageId
- ComPtr appxManifestPackageId;
- IFT(appxManifestReader->GetPackageId(&appxManifestPackageId));
-
- dprintf("Getting Package Full Name...\n");
- // Get the package full name
- LPWSTR packageId;
- IFT(appxManifestPackageId->GetPackageFullName(&packageId));
- m_packageId = packageId;
- dwprintf(L"%s\n", m_packageId.c_str());
-
- dprintf("Getting Package Family Name...\n");
- // Get the package family name
- LPWSTR packageFamilyName;
- IFT(appxManifestPackageId->GetPackageFamilyName(&packageFamilyName));
- m_packageFamilyName = packageFamilyName;
- dwprintf(L"%s\n", m_packageFamilyName.c_str());
-
- if (m_appId.empty()) // If App Id is empty get it from the manifest file
- {
- ComPtr appxManifestApplicationsEnumerator;
- ComPtr appxManifestApplication;
- BOOL hasCurrent;
- LPWSTR appUserModelId;
-
- dprintf("Getting Applications...\n");
- IFT(appxManifestReader->GetApplications(&appxManifestApplicationsEnumerator));
- IFT(appxManifestApplicationsEnumerator->GetHasCurrent(&hasCurrent));
-
- // If the enumerator is empty can't choose a default app
- if (!hasCurrent)
- {
- throw com_error(E_INVALIDARG);
- }
-
- IFT(appxManifestApplicationsEnumerator->GetCurrent(&appxManifestApplication));
- IFT(appxManifestApplicationsEnumerator->MoveNext(&hasCurrent));
-
- // If the enumerator has more than one item it is ambiguous what app to choose
- if (hasCurrent)
- {
- throw com_error(E_INVALIDARG);
- }
-
- dprintf("Getting UserModelId...\n");
- IFT(appxManifestApplication->GetAppUserModelId(&appUserModelId));
- m_appId = appUserModelId;
- }
- else // Else prepend the package family name to the supplied App Id
- {
- dprintf("Getting UserModelId...\n");
- m_appId = m_packageFamilyName + L"!" + m_appId;
- }
- dwprintf(L"%s\n", m_appId.c_str());
-}
-
-AppxApp::~AppxApp()
-{
- if (m_hProcess != nullptr)
- {
- CloseHandle(m_hProcess);
- }
-}
-
-const wstring& AppxApp::get_ManifestPath() const throw()
-{
- return m_manifestPath;
-}
-
-const wstring& AppxApp::get_PackageId() const throw()
-{
- return m_packageId;
-}
-
-const wstring& AppxApp::get_PackageFamilyName() const throw()
-{
- return m_packageFamilyName;
-}
-
-wstring AppxApp::get_PackageFullName() const throw()
-{
- return m_packageId;
-}
-
-typedef BOOL(WINAPI *fn_AssignProcessToJobObject)(_In_ HANDLE hJob, _In_ HANDLE hProcess);
-typedef HANDLE(WINAPI *fn_OpenJobObject)(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandles, _In_ LPCWSTR lpName);
-typedef DWORD(WINAPI *fn_GetProcessImageFileName)(_In_ HANDLE hProcess, _Out_ LPWSTR lpImageFileName, _In_ DWORD nSize);
-typedef DWORD(WINAPI *fn_GetEnvironmentVariable)(_In_opt_ LPCWSTR lpName, _Out_opt_ LPWSTR lpBuffer, _In_ DWORD nSize);
-
-fn_AssignProcessToJobObject p_AssignProcessToJobObject;
-fn_OpenJobObject p_OpenJobObject;
-fn_GetProcessImageFileName p_GetProcessImageFileName;
-fn_GetEnvironmentVariable p_GetEnvironmentVariable;
-
-
-void ProcessSmartyJob(HANDLE hProcess, const wchar_t* manifestPath)
-{
- unique_ptr::type, decltype(&FreeLibrary)> kernel32(LoadLibraryEx(L"kernel32.dll", NULL, NULL), &FreeLibrary);
- if (kernel32.get() == NULL)
- return;
- unique_ptr::type, decltype(&FreeLibrary)> psapi(LoadLibraryEx(L"api-ms-win-core-psapi-l1-1-0.dll", NULL, NULL), &FreeLibrary);
- if (psapi.get() == NULL)
- return;
- unique_ptr::type, decltype(&FreeLibrary)> procEnv(LoadLibraryEx(L"api-ms-win-core-processenvironment-l1-2-0.dll", NULL, NULL), &FreeLibrary);
- if (procEnv.get() == NULL)
- return;
- p_OpenJobObject = (fn_OpenJobObject) GetProcAddress(kernel32.get(), "OpenJobObject");
- p_AssignProcessToJobObject = (fn_AssignProcessToJobObject) GetProcAddress(kernel32.get(), "AssignProcessToJobObjectW");
- p_GetProcessImageFileName = (fn_GetProcessImageFileName) GetProcAddress(psapi.get(), "K32GetProcessImageFileNameW");
- p_GetEnvironmentVariable = (fn_GetEnvironmentVariable) GetProcAddress(procEnv.get(), "GetEnvironmentVariableW");
- auto varName = L"SMARTY_JOB_ID";
- DWORD sizeNeeded = (*p_GetEnvironmentVariable)(varName, nullptr, 0);
- if (sizeNeeded == 0)
- {
- DWORD err = GetLastError();
- if (err == ERROR_ENVVAR_NOT_FOUND)
- {
- return;
- }
- else
- {
- auto msg = MessageForHR(HRESULT_FROM_WIN32(err));
- fwprintf(stderr, L"Error reading environment:\n%s\n", msg.c_str());
- throw runtime_error(string(msg.begin(), msg.end()));
- }
- }
- unique_char_array smartyJobId(new wchar_t[sizeNeeded], unique_char_deleter);
- DWORD size = (*p_GetEnvironmentVariable)(L"SMARTY_JOB_ID", smartyJobId.get(), sizeNeeded);
- if (size == 0)
- {
- DWORD err = GetLastError();
- if (err == ERROR_ENVVAR_NOT_FOUND)
- return;
- else
- {
- fwprintf(stderr, L"Error reading environment:\n%s\n", MessageForHR(HRESULT_FROM_WIN32(err)).c_str());
- return;
- }
- }
- unique_char_array appxProcessFileName(new wchar_t[MAX_PATH], unique_char_deleter);
- if ((*p_GetProcessImageFileName)(hProcess, appxProcessFileName.get(), MAX_PATH) == 0)
- {
- fwprintf(stderr, L"Error getting process file name:\n%s\n", MessageForHR(HRESULT_FROM_WIN32(GetLastError())).c_str());
- return;
- }
- HRESULT hr = PathCchRemoveFileSpec(appxProcessFileName.get(), MAX_PATH);
- if (FAILED(hr))
- {
- fwprintf(stderr, L"Error processing path:\n%s\n", MessageForHR(hr).c_str());
- return;
- }
- unique_char_array manifestDirectory(new wchar_t[MAX_PATH], unique_char_deleter);
- wcscpy_s(manifestDirectory.get(), MAX_PATH, manifestPath);
- hr = PathCchRemoveFileSpec(manifestDirectory.get(), MAX_PATH);
- if (FAILED(hr))
- {
- fwprintf(stderr, L"Error processing path:\n%s\n", MessageForHR(hr).c_str());
- return;
- }
- if (wcscmp(appxProcessFileName.get(), manifestDirectory.get()) == 0)
- {
- // handle is the appx process handle
- // and SMARTY_JOB_ID is set
- HANDLE tmp = (*p_OpenJobObject)(JOB_OBJECT_ASSIGN_PROCESS, FALSE, smartyJobId.get());
- if (tmp == NULL)
- {
- fwprintf(stderr, L"Error opening job object %s:\n%s\n", smartyJobId.get(), MessageForHR(HRESULT_FROM_WIN32(GetLastError())).c_str());
- return;
- }
- unique_ptr < void, add_pointer::type> jobHandle(tmp, &CloseHandle);
- BOOL ret = (*p_AssignProcessToJobObject)(jobHandle.get(), hProcess);
- if (ret == 0)
- {
- fwprintf(stderr, L"Error assigning appx process to job:\n%s\n%s\n", smartyJobId.get(), MessageForHR(HRESULT_FROM_WIN32(GetLastError())).c_str());
- return;
- }
- }
-}
-
-void AppxApp::InitStdoutFile(bool testApp)
-{
- if (testApp)
- {
- wstring appContainerPath = GetAppContainerFolderPath();
-
- WIN32_FILE_ATTRIBUTE_DATA stdoutFileAttributeData;
- stdoutFile = appContainerPath + L"\\LocalState\\AC\\stdout.txt";
-
- // Delete the stdout file if it exists
- if (GetFileAttributesEx(stdoutFile.c_str(), ::GET_FILEEX_INFO_LEVELS::GetFileExInfoStandard, &stdoutFileAttributeData))
- {
- if (!DeleteFile(stdoutFile.c_str()))
- {
- throw com_error(HRESULT_FROM_WIN32(GetLastError()));
- }
- }
-
- // ExitCode.txt stores process Exit Code
- WIN32_FILE_ATTRIBUTE_DATA exitCodeFileAttributeData;
- exitCodeFile = appContainerPath + L"\\AC\\Temp\\exitcode.txt";
- if (GetFileAttributesEx(exitCodeFile.c_str(), ::GET_FILEEX_INFO_LEVELS::GetFileExInfoStandard, &exitCodeFileAttributeData))
- {
- if (!DeleteFile(exitCodeFile.c_str()))
- {
- throw com_error(HRESULT_FROM_WIN32(GetLastError()));
- }
- }
- }
-}
-
-void AppxApp::Start(bool runInBackground, bool testApp)
-{
- Start(runInBackground, testApp, L"");
-}
-
-void AppxApp::Start(bool runInBackground, bool testApp, const wstring& executionArgs)
-{
- InitStdoutFile(testApp);
-
- ComPtr applicationActivationManager = GetApplicationActivationManager();
- DWORD dwProcessId;
-
- ACTIVATEOPTIONS options = ACTIVATEOPTIONS::AO_NOSPLASHSCREEN;
- if (!runInBackground)
- options = ACTIVATEOPTIONS::AO_NONE;
-
- IFT(applicationActivationManager->ActivateApplication(m_appId.c_str(), executionArgs.c_str(), options, &dwProcessId));
- dwprintf(L"Process started, pid: %d\n", dwProcessId);
- // Get a process handle to the app
- // PROCESS_SET_QUOTA is required for using AssignProcessToJobObject
- m_hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE | PROCESS_SET_QUOTA, FALSE, dwProcessId);
-
- if (m_hProcess == nullptr)
- {
- DWORD openProcessError = GetLastError();
-
- // If the error is ERROR_INVALID_PARAMETER then the process exited before we could open a handle to it
- if (openProcessError != ERROR_INVALID_PARAMETER)
- {
- throw com_error(HRESULT_FROM_WIN32(openProcessError));
- }
- }
- ProcessSmartyJob(m_hProcess, m_manifestPath.c_str());
-}
-
-void AppxApp::Stop()
-{
- if (m_hProcess != nullptr)
- {
- if (!TerminateProcess(m_hProcess, (UINT) -1))
- {
- throw com_error(HRESULT_FROM_WIN32(GetLastError()));
- }
- }
-}
-
-DWORD AppxApp::WaitForExit()
-{
- bool result;
- return WaitForExit(INFINITE, &result);
-}
-
-DWORD AppxApp::WaitForExit(DWORD milliseconds, bool* result)
-{
- if (m_hProcess == nullptr)
- {
- throw com_error(E_POINTER);
- }
-
- DWORD waitResult = WaitForSingleObjectEx(m_hProcess, milliseconds, FALSE);
-
- if (waitResult == WAIT_TIMEOUT)
- {
- *result = false;
- return (DWORD) -1;
- }
- else if (waitResult != WAIT_FAILED)
- {
- *result = true;
- DWORD exitCode = GetAppExitCode();
- return exitCode;
- }
- else
- {
- throw com_error(HRESULT_FROM_WIN32(GetLastError()));
- }
-}
-
-void AppxApp::EnableDebug(const wstring& debuggerCommandLine)
-{
- if (packageDebugSettings == nullptr)
- IFT(CoCreateInstance(CLSID_PackageDebugSettings, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&packageDebugSettings)));
- wprintf(L"Package ID is %s\n", m_packageId.c_str());
- IFT(packageDebugSettings->EnableDebugging(m_packageId.c_str(), debuggerCommandLine.empty() ? nullptr : debuggerCommandLine.c_str(), nullptr));
-}
-
-void AppxApp::DisableDebug()
-{
- if (packageDebugSettings == nullptr)
- IFT(CoCreateInstance(CLSID_PackageDebugSettings, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&packageDebugSettings)));
- IFT(packageDebugSettings->DisableDebugging(m_packageId.c_str()));
-}
-
-// The package must be installed for this to succeed
-HRESULT AppxApp::GetAppContainerFolderPathInternal(wchar_t** appContainerFolderPath)
-{
- HRESULT hr;
-
- // Get the app container folder path
- PSID tempsid;
- IFR(DeriveAppContainerSidFromAppContainerName(m_packageFamilyName.c_str(), &tempsid));
- std::unique_ptr sid(tempsid, &FreeSid);
-
- wchar_t* tempSidString;
- IFR(ConvertSidToStringSid(sid.get(), &tempSidString) ? S_OK : HRESULT_FROM_WIN32(GetLastError()));
- std::unique_ptr sidString(tempSidString, LocalFree);
-
- wchar_t* tempfolderPath;
- IFR(::GetAppContainerFolderPath(sidString.get(), &tempfolderPath));
- std::unique_ptr folderPath(tempfolderPath, CoTaskMemFree);
-
- // Remove the trailing \AC from the path
- size_t pathLength = wcslen(folderPath.get());
-
- if (pathLength < 3)
- {
- return E_FAIL;
- }
-
- if (wcscmp(L"\\AC", folderPath.get() + (pathLength - 3)) != 0)
- {
- return E_FAIL;
- }
-
- folderPath.get()[pathLength - 3] = '\0';
-
- *appContainerFolderPath = folderPath.release();
-
- return hr;
-}
-
-wstring AppxApp::GetAppStdOutContent()
-{
- try
- {
- wifstream file(stdoutFile);
- return wstring((istreambuf_iterator(file)), istreambuf_iterator());
- }
- catch (...)
- {
- return L"(null)";
- }
-}
-
-// Some UI (or Jscript) app couldn't get its exit code directly
-// So App itself are supposed to write a file("exitcode.txt") into %temp% folder
-// then AppLauncher will fetch its vlaue if this file exists
-DWORD AppxApp::GetAppExitCode()
-{
- DWORD exitCode;
-
- // Check exitCode.txt file first
- ifstream file(exitCodeFile);
- if (file)
- {
- char content[256];
- memset(content, '\0', 256 * sizeof(char));
- file.getline(content, 256);
- exitCode = atoi(content);
- wprintf(L"Process exited with return code(from exitcode.txt) %d.\n", exitCode);
- }
- else
- {
- if (GetExitCodeProcess(m_hProcess, &exitCode) != 0)
- wprintf(L"Process has just exited with return code %d.\n", exitCode);
- }
-
- return exitCode;
-}
diff --git a/src/WindowsStoreAppLauncher/AppxApp.h b/src/WindowsStoreAppLauncher/AppxApp.h
deleted file mode 100644
index c2af1298ae..0000000000
--- a/src/WindowsStoreAppLauncher/AppxApp.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#pragma once
-#include "App.h"
-#include "Support.h"
-#include
-#include
-#include
-#include
-#include
-
-using namespace ABI::Windows::ApplicationModel::Activation;
-using namespace ABI::Windows::Foundation::Internal;
-using namespace ABI::Windows::Foundation;
-using namespace Microsoft::WRL;
-using namespace std;
-
-class AppxApp : public App
-{
-private:
- ComPtr packageDebugSettings;
- wstring m_manifestPath, m_appId, m_packageId, m_packageFamilyName, stdoutFile, exitCodeFile;
- HANDLE m_hProcess;
-
-
- void InitStdoutFile(bool testApp);
- HRESULT GetAppContainerFolderPathInternal(wchar_t** appContainerFolderPath);
-
-protected:
- template
- void Wait(
- IAsyncOperationWithProgress* asyncOperation,
- typename GetAbiType::TResult_complex>::type* result)
- {
- // Create an event so we can wait for the async operation to complete
- Event completeEvent(CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, WRITE_OWNER | EVENT_ALL_ACCESS));
- IFT(completeEvent.IsValid() ? S_OK : HRESULT_FROM_WIN32(GetLastError()));
-
- auto completeHandler = Callback>
- ([&completeEvent](
- IAsyncOperationWithProgress* asyncOperationWithProgress,
- AsyncStatus asyncStatus)
- -> HRESULT
- {
- UNREFERENCED_PARAMETER(asyncOperationWithProgress);
- UNREFERENCED_PARAMETER(asyncStatus);
- SetEvent(completeEvent.Get());
- return S_OK;
- });
- IFT(asyncOperation->put_Completed(completeHandler.Get()));
-
- // Wait for async operation to complete
- IFT(WaitForSingleObjectEx(completeEvent.Get(), INFINITE, FALSE) != WAIT_FAILED ? S_OK : HRESULT_FROM_WIN32(GetLastError()));
-
- // Check for errors
- ComPtr asyncInfo;
- HRESULT errorCode;
-
- IFT(asyncOperation->QueryInterface(__uuidof(IAsyncInfo), &asyncInfo));
- IFT(asyncInfo->get_ErrorCode(&errorCode));
-
- IFT(errorCode);
-
- // Get the result
- if (result != nullptr)
- {
- IFT(asyncOperation->GetResults(result));
- }
- }
-
-
- const wstring& get_ManifestPath() const throw();
- const wstring& get_PackageId() const throw();
- const wstring& get_PackageFamilyName() const throw();
- virtual ComPtr GetApplicationActivationManager() = 0;
- virtual wstring GetAppContainerFolderPath() const = 0;
-public:
- AppxApp(const wstring& manifestPath, const wstring& appId);
- virtual ~AppxApp(void);
-
- virtual void Start(bool runInBackground, bool testApp, const wstring& executionArgs) override;
- virtual void Start(bool runInBackground, bool testApp) override;
- virtual void Stop() override;
- virtual DWORD WaitForExit() override;
- virtual DWORD WaitForExit(DWORD milliseconds, bool* result) override;
-
- virtual void EnableDebug(const wstring& debuggerCommandLine) override;
- virtual void DisableDebug() override;
- virtual wstring GetAppStdOutContent() override;
- virtual wstring get_PackageFullName() const throw() override;
- virtual DWORD GetAppExitCode() override;
-};
diff --git a/src/WindowsStoreAppLauncher/Args.h b/src/WindowsStoreAppLauncher/Args.h
deleted file mode 100644
index 1f2d7bb8b2..0000000000
--- a/src/WindowsStoreAppLauncher/Args.h
+++ /dev/null
@@ -1,509 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#pragma once
-#include
-#include
-#include
-
-using namespace std;
-
-
-struct _Option
-{
- virtual const vector& Strings() = 0;
- virtual const wstring& Description() = 0;
- virtual bool HasParam() = 0;
- virtual const wstring& Param() = 0;
- virtual void Call(const wstring& arg) = 0;
- virtual void Call() = 0;
-};
-
-template
-class Option : public _Option
-{
- vector optStrings;
- const Function& func;
- wstring description;
-
- Option& operator=(const Option&) = delete;
-
-public:
- Option(vector s, const Function& f, const wstring& desc) :optStrings(move(s)), func(f), description(desc)
- {
- }
-
- virtual const vector& Strings() override
- {
- return optStrings;
- }
-
- virtual const wstring& Description() override
- {
- return description;
- }
-
- virtual bool HasParam()
- {
- return false;
- }
-
- virtual const wstring& Param()
- {
- // this function should never be called
- static const wstring empty(L"");
- return empty;
- }
-
- virtual void Call(const wstring& arg) override
- {
- UNREFERENCED_PARAMETER(arg);
- }
-
- virtual void Call() override
- {
- func();
- }
-};
-
-template
-class ParamOption : public _Option
-{
- vector optStrings;
- const Function& func;
- wstring description;
- wstring paramName;
-
- ParamOption& operator=(const ParamOption&) = delete;
-
-public:
-
- ParamOption(vector s, const wstring& param, const Function& f, const wstring& desc) :optStrings(move(s)), func(f), description(desc), paramName(param)
- {
- }
-
- virtual const vector& Strings() override
- {
- return optStrings;
- }
-
- virtual const wstring& Description() override
- {
- return description;
- }
-
- virtual bool HasParam()
- {
- return true;
- }
-
- virtual const wstring& Param()
- {
- return paramName;
- }
-
- virtual void Call(const wstring& arg) override
- {
- func(arg);
- }
-
- virtual void Call() override
- {
- }
-};
-
-template
-_Option* make_option(vector s, const Function& f, const wstring& desc)
-{
- return (_Option*)new Option(s, f, desc);
-}
-
-template
-_Option* make_option(vector s, const wstring& param, const Function& f, const wstring& desc)
-{
- return (_Option*)new ParamOption(s, param, f, desc);
-}
-
-class OptionList
-{
- vector> options;
- wstring exeName;
- wstring positionalArgs;
- wstring positionalArgInfo;
-
-public:
-
- OptionList(const wstring& exe, const wstring& positionalArgs, const wstring& positionalArgInfo) :exeName(exe), positionalArgs(positionalArgs), positionalArgInfo(positionalArgInfo)
- {
- }
-
- template
- void Add(vector s, const Function& f, const wstring& desc)
- {
- Add(make_option(s, f, desc));
- }
-
- template
- void Add(vector s, const wstring& param, const Function& f, const wstring& desc)
- {
- Add(make_option(s, param, f, desc));
- }
-
- void Add(_Option* option)
- {
- options.push_back(unique_ptr<_Option>(option));
- }
-
- wstring UsageShort()
- {
- wstringstream ret;
- for (const unique_ptr<_Option>& option : options)
- {
- ret << L" [";
- bool first = true;
- for (auto str : option->Strings())
- {
- if (first)
- first = false;
- else
- ret << L"|";
- ret << L"[-" << str << L"]";
- }
- if (option->HasParam())
- ret << L" <" << option->Param() << L">";
- ret << L"]";
- }
- return ret.str();
- }
-
- wstring UsageLong()
- {
- wstringstream ret;
- for (const unique_ptr<_Option>& option : options)
- {
- ret << L"\t";
- bool first = true;
- for (auto str : option->Strings())
- {
- if (first)
- first = false;
- else
- ret << L", ";
- ret << L"-" << str;
- }
- if (option->HasParam())
- ret << L" <" << option->Param() << L">";
- ret << L"\n\t\t" << option->Description() << L"\n";
- }
- return ret.str();
- }
-
- wstring Usage()
- {
- return exeName + L" " + UsageShort() + L" " + positionalArgs + L"\n\nOptions:\n" + UsageLong() + L"\nArguments:\n" + positionalArgInfo;
- }
-
- template
- wchar_t** Parse(int argc, wchar_t** argv, ErrorFunction onError)
- {
- if (argc == 0)
- return argv;
- if ((*argv)[0] != '-' && (*argv)[0] != '/')
- return argv;
- if (_Parse(&argc, &argv, onError))
- {
- return Parse(argc, argv, onError);
- }
- else
- {
- return argv;
- }
- }
-
- void PrintUsage()
- {
- wprintf(L"%s", Usage().c_str());
- }
-private:
- template
- bool _Parse(int* argc, wchar_t*** argv, ErrorFunction onError)
- {
- for (const unique_ptr<_Option>& option : options)
- {
- if (argc == 0)
- return false;
- wchar_t* curParam = **argv;
- for (auto str : option->Strings())
- {
- if (str.compare(curParam + 1) == 0)
- {
- if (option->HasParam())
- {
- if (*argc < 2)
- {
- onError(str);
- return false;
- }
- option->Call(*(*argv + 1));
- *argv += 2;
- *argc -= 2;
- return true;
- }
- else
- {
- option->Call();
- *argv += 1;
- *argc -= 1;
- return true;
- }
- }
- }
- }
- return false;
- }
-};
-
-/*
-template
-struct OptionWithParam
-{
- OptionWithParam(vector s, const T& f) :optStrings(move(s)), func(f)
- {
- }
- OptionWithParam& withDescription(wstring desc, wstring paramName)
- {
- description = desc;
- this->paramName = paramName;
- return *this;
- }
- vector optStrings;
- const T& func;
- wstring description;
- wstring paramName;
-};*/
-
-/*
-template
-struct OptionList;
-
-wstring _Usage(OptionList<>* list);
-
-template <>
-struct OptionList<>
-{
- template
- wchar_t** Parse(int argc, wchar_t** argv, err)
- {
- return argv;
- }
- wstring Usage()
- {
- return _Usage(this);
- }
- void PrintUsage()
- {
- wprintf(L"%s", Usage().c_str());
- }
- OptionList<>& withInfo(const wstring& exeName, const wstring& positionalArgs, const wstring& positionalArgInfo)
- {
- this->exeName = exeName;
- this->positionalArgs = positionalArgs;
- this->positionalArgInfo = positionalArgInfo;
- return *this;
- }
-protected:
- template
- bool _Parse(int& argc, wchar_t**& argv, err)
- {
- return false;
- }
- virtual wstring UsageLong()
- {
- return L"";
- }
- virtual wstring UsageShort()
- {
- return L"";
- }
- wstring exeName;
- wstring positionalArgs;
- wstring positionalArgInfo;
- friend wstring _Usage(OptionList<>* list);
-};
-
-
-template
-struct OptionList