зеркало из https://github.com/microsoft/BuildXL.git
Merged PR 533817: Allows Detours plugin to use Detours Dbg function
Allows Detours plugin to use Detours Dbg function
This commit is contained in:
Родитель
b92034fb1c
Коммит
c77e6412c7
|
@ -31,6 +31,7 @@ namespace Test.BuildXL.Processes.Detours
|
|||
: base(output)
|
||||
{
|
||||
m_output = output;
|
||||
RegisterEventSource(ETWLogger.Log);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -331,7 +332,13 @@ namespace Test.BuildXL.Processes.Detours
|
|||
await SandboxedProcessFactory.StartAsync(sandboxedProcessInfo, forceSandboxing: true)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return await sandboxedProcess.GetResultAsync().ConfigureAwait(false);
|
||||
SandboxedProcessResult result = await sandboxedProcess.GetResultAsync().ConfigureAwait(false);
|
||||
|
||||
// When plugin is entered, expect to see "Entering CommandMatches" text in the log.
|
||||
// CODESYNC: Public\Src\Engine\UnitTests\Processes.TestPrograms\SubstituteProcessExecutionPlugin\dllmain.cpp
|
||||
AssertLogContains(true, "Entering CommandMatches");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -50,17 +50,23 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||
// workingDirectory: The working directory for the command.
|
||||
//
|
||||
// modifiedArguments: Pointer to null-terminated wide char array allocated using HeapAlloc on the default process' heap.
|
||||
// This value may be nullptr in which case the original arguments are used
|
||||
// This value may be nullptr in which case the original arguments are used.
|
||||
//
|
||||
// logFunc: Function for logging messages from the plugin back to the Detours. This function is Detours' Dbg function.
|
||||
// Dbg function automatically appends a new line at the end of the string format.
|
||||
extern "C" __declspec(dllexport) BOOL WINAPI CommandMatches(
|
||||
const wchar_t* command,
|
||||
const wchar_t* arguments,
|
||||
LPVOID environmentBlock,
|
||||
const wchar_t* workingDirectory,
|
||||
wchar_t** modifiedArguments)
|
||||
wchar_t** modifiedArguments,
|
||||
void(__stdcall * logFunc)(PCWSTR format, ...))
|
||||
{
|
||||
UNREFERENCED_PARAMETER(environmentBlock);
|
||||
UNREFERENCED_PARAMETER(workingDirectory);
|
||||
|
||||
logFunc(L"Entering %s", L"CommandMatches");
|
||||
|
||||
std::wstring marker(L"DoNotShimMe");
|
||||
|
||||
if (command != nullptr)
|
||||
|
|
|
@ -202,7 +202,8 @@ static bool CallPluginFunc(
|
|||
commandArgs.c_str(),
|
||||
lpEnvironment,
|
||||
lpWorkingDirectory,
|
||||
modifiedArguments) != 0;
|
||||
modifiedArguments,
|
||||
Dbg) != 0;
|
||||
}
|
||||
|
||||
static bool ShouldSubstituteShim(
|
||||
|
|
|
@ -94,13 +94,17 @@ extern DetouredProcessInjector* g_pDetouredProcessInjector;
|
|||
// workingDirectory: The working directory for the command.
|
||||
//
|
||||
// modifiedArguments: Pointer to null-terminated wide char array allocated using HeapAlloc on the default process' heap.
|
||||
// This value may be nullptr in which case the original arguments are used
|
||||
// This value may be nullptr in which case the original arguments are used.
|
||||
//
|
||||
// logFunc: Function for logging messages from the plugin back to the Detours. This function is Detours' Dbg function.
|
||||
// Dbg function automatically appends a new line at the end of the string format.
|
||||
typedef BOOL(__stdcall* SubstituteProcessExecutionPluginFunc)(
|
||||
const wchar_t* command,
|
||||
const wchar_t* arguments,
|
||||
LPVOID environmentBlock,
|
||||
const wchar_t* workingDirectory,
|
||||
wchar_t** modifiedArguments);
|
||||
wchar_t** modifiedArguments,
|
||||
void (__stdcall* logFunc)(PCWSTR format, ...));
|
||||
|
||||
extern wchar_t* g_SubstituteProcessExecutionShimPath;
|
||||
extern bool g_ProcessExecutionShimAllProcesses;
|
||||
|
|
Загрузка…
Ссылка в новой задаче