Files
Charles Milette 8cbb9e2b82 Feature: Add DetourFindRemotePayload and improve other payload-related methods (#81)
Other improvements:

- Makes the pcbData parameter in DetourFindPayload and DetourFindPayloadEx optional, so that if an application only needs to search for the presence of a payload, they can ignore the size by passing nullptr.

- Makes the pvData parameter in DetourCopyPayloadToProcess const, so that a pointer to a const C++ object can be passed instead of the object needing to be const_casted or being non-const.

- Adds DetourCopyPayloadToProcessEx, which has the same interface than DetourCopyPayloadToProcess, but it returns the address of the payload in the remote module, if the program later wants to write to it.

- Add payload example and extra unit tests covering new APIs. 

Fixes #79

Co-authored-by: Charles Milette <me@charlesmilette.net>
2021-03-06 00:22:08 -08:00

26 lines
626 B
C++

//////////////////////////////////////////////////////////////////////////////
//
// Test Payload for Detours Module API tests (payload.cpp of unittests.exe)
//
// Microsoft Research Detours Package
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#include "payload.h"
// Define a detours payload for testing.
//
#pragma data_seg(".detour")
static CPrivateStuff private_stuff = {
DETOUR_SECTION_HEADER_DECLARE(sizeof(CPrivateStuff)),
{
(sizeof(CPrivateStuff) - sizeof(DETOUR_SECTION_HEADER)),
0,
TEST_PAYLOAD_GUID
},
"Testing Payload 123"
};
#pragma data_seg()