Update SD file mappings

The `ConsoleTextWriter.cs` file had a case-sensitivity issue. The
`ArchitectureSensitiveAttribute.cs` and `nativemsh` files were deleted
in SD.
This commit is contained in:
Andrew Schwartzmeyer
2016-06-15 15:45:12 -07:00
parent 2192c31a64
commit 2afe0a1ad3
7 changed files with 1 additions and 171 deletions
@@ -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",
@@ -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",
@@ -1,28 +0,0 @@
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System;
using System.Reflection;
namespace System.Management.Automation.Internal
{
/// <summary>
/// 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.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
internal class ArchitectureSensitiveAttribute : Attribute
{
/// <summary>
/// Constructor for the ArchitectureSensitiveAttribute class.
/// </summary>
internal ArchitectureSensitiveAttribute ()
{
}
}
}
-1
View File
@@ -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
-2
View File
@@ -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",
@@ -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 <iostream>
#include <fstream>
#include <windows.h>
#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"");
}
}
}
@@ -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 <string>
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