Skip to content

DetourFindPayloadEx

Brian Gianforcaro edited this page Mar 6, 2021 · 5 revisions

DetourFindPayloadEx

Return the address of the specified payload within a process.

Definition

_Writable_bytes_(*pcbData)
_Readable_bytes_(*pcbData)
_Success_(return != NULL)
PVOID DetourFindPayloadEx(
    _In_      REFGUID rguid,
    _Out_opt_ DWORD  *pcbData
);

Parameters

rguid : GUID of the specified payload.

pcbData : Variable to receive the size in bytes of the specified payload.

Return value

Pointer to the specified payload or NULL if the payload doesn't exist.

Error codes

The function sets one of the following error codes if it was unable to search the module for the target payload. The error code may be retrieved after the function has returned by calling GetLastError.

ERROR_BAD_EXE_FORMAT : The MZ header of specified module is invalid.

ERROR_EXE_MARKED_INVALID : The NT COFF header of the specified module is invalid.

ERROR_INVALID_EXE_SIGNATURE : The NT COFF header of the specified module has an invalid signature.

ERROR_MOD_NOT_FOUND : All modules in the process were enumerated, and non matching payload was found.

Remarks

Where DetourFindPayload takes a module to search for the payload in, DetourFindPayloadEx instead enumerates over every module in the process, searching for the specified payload.

DetourFindPayloadEx returns the address of the specified payload within a module. Payloads can either be created at compile link time, see the Einst, or can be inserted it an existing binary using the DetourBinarySetPayload API.

For more information on binary editing with Detours and payloads, see Payloads and DLL Import Editing in the Detours Overview.

Related Samples

Einst, Payload, Tracebld.

Clone this wiki locally