1211
This commit is contained in:
37
test/Detours/tests/process_helpers.h
Normal file
37
test/Detours/tests/process_helpers.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Process Test Helpers (process_helpers.h of unittests.exe)
|
||||
//
|
||||
// Microsoft Research Detours Package
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
struct TerminateOnScopeExit
|
||||
{
|
||||
PROCESS_INFORMATION information;
|
||||
|
||||
TerminateOnScopeExit(const TerminateOnScopeExit&) = delete;
|
||||
TerminateOnScopeExit& operator=(const TerminateOnScopeExit&) = delete;
|
||||
|
||||
~TerminateOnScopeExit()
|
||||
{
|
||||
if (information.hThread)
|
||||
{
|
||||
TerminateThread(information.hThread, 0);
|
||||
CloseHandle(information.hThread);
|
||||
}
|
||||
|
||||
if (information.hProcess)
|
||||
{
|
||||
TerminateProcess(information.hProcess, 0);
|
||||
CloseHandle(information.hProcess);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT GetProcessFileName(HANDLE process, std::wstring& filename);
|
||||
HRESULT CreateSuspendedCopy(TerminateOnScopeExit& wrapper);
|
||||
Reference in New Issue
Block a user