diff --git a/src/Microsoft.PowerShell.ConsoleHost/map.json b/src/Microsoft.PowerShell.ConsoleHost/map.json index 5277a8d1d9..10b79cf1d9 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/map.json +++ b/src/Microsoft.PowerShell.ConsoleHost/map.json @@ -10,7 +10,7 @@ "monad/src/host/msh/resources/ProgressNodeStrings.resx": "resources/ProgressNodeStrings.resx", "monad/src/host/msh/resources/ConsoleHostRawUserInterfaceStrings.resx": "resources/ConsoleHostRawUserInterfaceStrings.resx", "monad/src/host/msh/PendingProgress.cs": "host/msh/PendingProgress.cs", - "monad/src/host/msh/ConsoleTextWriter.cs": "host/msh/ConsoleTextWriter.cs", + "monad/src/host/msh/Consoletextwriter.cs": "host/msh/ConsoleTextWriter.cs", "monad/src/host/msh/resources/ConsoleControlStrings.resx": "resources/ConsoleControlStrings.resx", "monad/src/host/msh/ConsoleHostUserInterfacePromptForChoice.cs": "host/msh/ConsoleHostUserInterfacePromptForChoice.cs", "monad/src/host/msh/ConsoleShell.cs": "host/msh/ConsoleShell.cs", diff --git a/src/System.Management.Automation/map.json b/src/System.Management.Automation/map.json index 686728edb2..17e1a53709 100644 --- a/src/System.Management.Automation/map.json +++ b/src/System.Management.Automation/map.json @@ -472,7 +472,6 @@ "monad/src/engine/resources/Authenticode.resx": "resources/Authenticode.resx", "monad/src/engine/COM/ComUtil.cs": "engine/COM/ComUtil.cs", "monad/src/engine/hostifaces/MshHostUserInterface.cs": "engine/hostifaces/MshHostUserInterface.cs", - "monad/src/utils/ArchitectureSensitiveAttribute.cs": "utils/ArchitectureSensitiveAttribute.cs", "monad/src/engine/DriveInterfaces.cs": "engine/DriveInterfaces.cs", "monad/src/engine/ComInterop/Errors.cs": "engine/ComInterop/Errors.cs", "monad/src/singleshell/config/MshConsoleInfo.cs": "singleshell/config/MshConsoleInfo.cs", diff --git a/src/System.Management.Automation/utils/ArchitectureSensitiveAttribute.cs b/src/System.Management.Automation/utils/ArchitectureSensitiveAttribute.cs deleted file mode 100644 index 9cf302f0fd..0000000000 --- a/src/System.Management.Automation/utils/ArchitectureSensitiveAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -/********************************************************************++ -Copyright (c) Microsoft Corporation. All rights reserved. ---********************************************************************/ - -using System; -using System.Reflection; - -namespace System.Management.Automation.Internal -{ - /// - /// This attribute is used for Design For Testability. - /// It should be placed on any method containing code - /// which is likely to be sensitive to X86/X64/IA64 issues, - /// primarily code which calls DllImports or otherwise uses - /// NativeMethods. This allows us to generate code coverage - /// data specific to architecture sensitive code. - /// - [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)] - internal class ArchitectureSensitiveAttribute : Attribute - { - /// - /// Constructor for the ArchitectureSensitiveAttribute class. - /// - internal ArchitectureSensitiveAttribute () - { - } - } -} diff --git a/src/powershell-native/CMakeLists.txt b/src/powershell-native/CMakeLists.txt index 5811791588..885acfcbef 100644 --- a/src/powershell-native/CMakeLists.txt +++ b/src/powershell-native/CMakeLists.txt @@ -25,7 +25,6 @@ add_definitions(-DUNICODE) add_definitions(-D_UNICODE) add_executable(powershell WIN32 - nativemsh/pwrshcommon/ConfigFileReader.cpp nativemsh/pwrshcommon/pwrshcommon.cpp nativemsh/pwrshcommon/WinSystemCallFacade.cpp diff --git a/src/powershell-native/map.json b/src/powershell-native/map.json index 6e047a5991..cdcb1cc0ed 100644 --- a/src/powershell-native/map.json +++ b/src/powershell-native/map.json @@ -1,8 +1,6 @@ { "monad/nttargets/assemblies/nativemsh/pwrshexe/OutputWriter.h": "nativemsh/pwrshexe/OutputWriter.h", - "monad/nttargets/assemblies/nativemsh/pwrshcommon/ConfigFileReader.cpp": "nativemsh/pwrshcommon/ConfigFileReader.cpp", "monad/nttargets/assemblies/nativemsh/pwrshcommon/NativeMsh.h": "nativemsh/pwrshcommon/NativeMsh.h", - "monad/nttargets/assemblies/nativemsh/pwrshcommon/ConfigFileReader.h": "nativemsh/pwrshcommon/ConfigFileReader.h", "monad/nttargets/assemblies/nativemsh/pwrshcommon/pwrshcommon.cpp": "nativemsh/pwrshcommon/pwrshcommon.cpp", "monad/nttargets/assemblies/nativemsh/pwrshcommon/SystemCallFacade.h": "nativemsh/pwrshcommon/SystemCallFacade.h", "monad/nttargets/assemblies/nativemsh/pwrshcommon/WinSystemCallFacade.cpp": "nativemsh/pwrshcommon/WinSystemCallFacade.cpp", diff --git a/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.cpp b/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.cpp deleted file mode 100644 index a070b67825..0000000000 --- a/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// ---------------------------------------------------------------------- -// -// Microsoft Windows NT -// Copyright (C) Microsoft Corporation, 2014. -// -// Contents: Source code for abstraction of CLR and worker differences between PowerShell versions. -// pwrshplugin is totally unmanaged. -// ---------------------------------------------------------------------- - -#include -#include -#include - -#include "NativeMsh.h" -#include "ConfigFileReader.h" - -namespace NativeMsh -{ - // The name of the PowerShell config file that identifies the PowerShell install location. - // We use a config file to avoid writing to the registry during install. - static PCWSTR powerShellConfigFileName = L"PowerShellConfig.txt"; - - ConfigFileReader::ConfigFileReader() - { - } - - unsigned int ConfigFileReader::Read( - std::wstring pathToConfig) - { - std::wstring absolutePathToConfigFile(pathToConfig); - absolutePathToConfigFile += powerShellConfigFileName; - std::wfstream psConfigFile(absolutePathToConfigFile.c_str()); - - if (!psConfigFile.is_open()) - { - return EXIT_CODE_INIT_FAILURE; - } - - std::wstring line; - std::wstring psRootTag(L"PSROOTDIR="); - while (std::getline(psConfigFile, line)) - { - this->pathToPowerShellAssemblies = this->getValueFromLine(line, psRootTag); - if (this->pathToPowerShellAssemblies.size() > 0) // Found a match - { - std::wstring::const_iterator iter = this->pathToPowerShellAssemblies.end(); - if (*iter != L'\\') - { - // Guarantee that there is a '\' at the end of the path - this->pathToPowerShellAssemblies.append(L"\\"); - } - break; - } - } - - if (0 == this->pathToPowerShellAssemblies.size()) - { - return EXIT_CODE_INIT_FAILURE; - } - else - { - return EXIT_CODE_SUCCESS; - } - } - - // This trim function removes beginning and ending whitespace. It does not - // remove internal whitespace because that is valid within paths. - std::wstring ConfigFileReader::trim( - const std::wstring& toTrim) - { - static PCWSTR WHITESPACE_CHARS = L" \n\r\t"; - std::wstring copyToTrim = toTrim; - std::size_t first = copyToTrim.find_first_not_of(WHITESPACE_CHARS); - - if (first == std::wstring::npos) - { - // No non-whitespace found - return std::wstring(L""); - } - - // Result not checked for std::wstring::npos because it is guaranteed to have a value if the first pass succeeded. - copyToTrim.erase(copyToTrim.find_last_not_of(WHITESPACE_CHARS)+1); - - return copyToTrim.substr(first); - } - - // Parses the specified line for the given tag - std::wstring ConfigFileReader::getValueFromLine( - const std::wstring& line, // Passed by value to preserve the original line. - std::wstring& tagToFind) - { - std::wstring trimmedLine = this->trim(line); - std::size_t index = trimmedLine.find(tagToFind); - if (std::string::npos != index) - { - std::wstring value = trimmedLine.substr(index + tagToFind.size()); // Everything else after the tag - return this->trim(value); - } - else - { - return std::wstring(L""); - } - } -} diff --git a/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.h b/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.h deleted file mode 100644 index 7e2d4454bb..0000000000 --- a/src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.h +++ /dev/null @@ -1,34 +0,0 @@ -// ---------------------------------------------------------------------- -// -// Microsoft Windows NT -// Copyright (C) Microsoft Corporation, 2014. -// -// Contents: Source code for abstraction of CLR and worker differences between PowerShell versions. -// pwrshplugin is totally unmanaged. -// ---------------------------------------------------------------------- - -#pragma once - -#include - -namespace NativeMsh -{ - class ConfigFileReader - { - protected: - std::wstring pathToPowerShellAssemblies; - - protected: - std::wstring trim(const std::wstring& toTrim); - - std::wstring getValueFromLine(const std::wstring& line, std::wstring& tagToFind); - - public: - ConfigFileReader(); - - virtual unsigned int Read(std::wstring pathToConfig); - - // Information Getters - std::wstring GetPathToPowerShell() { return pathToPowerShellAssemblies; } - }; -} // namespace NativeMsh \ No newline at end of file