102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
pcdogs.c File Reference
#include <dttr_test.h>
#include <dttr_pcdogs.h>
#include "pcdogs_blueprint_test_rows.h"

Go to the source code of this file.

Data Structures

struct  blueprint_signature
struct  blueprint_function

Macros

#define STABLE_SIGNATURE_COUNT   (sizeof(DTTR_PCDOGS_SIGNATURES) / sizeof(*DTTR_PCDOGS_SIGNATURES))
#define STABLE_FUNCTION_COUNT   (sizeof(DTTR_PCDOGS_FUNCTIONS) / sizeof(*DTTR_PCDOGS_FUNCTIONS))
#define UNSTABLE_SIGNATURE_COUNT   (sizeof(DTTR_PCDOGS_UNSTABLE_SIGNATURES) / sizeof(*DTTR_PCDOGS_UNSTABLE_SIGNATURES))
#define UNSTABLE_FUNCTION_COUNT   (sizeof(DTTR_PCDOGS_UNSTABLE_FUNCTIONS) / sizeof(*DTTR_PCDOGS_UNSTABLE_FUNCTIONS))

Functions

static uintptr_t require_sigscan (const DTTR_TestPCDOGSFixture *fixture, const char *kind, const char *name, const uint8_t *sig, const char *mask, const DTTR_TestPEImage *image)
static void assert_decodes_at (const DTTR_TestPCDOGSFixture *fixture, const char *kind, const char *name, const DTTR_TestPEImage *image, uintptr_t rva)
static void assert_signature_resolved (const DTTR_TestPCDOGSFixture *fixture, const blueprint_signature *sig, const DTTR_TestPEImage *image)
static bool assert_signatures_for_fixture (size_t fixture_index, const DTTR_TestBinaryFixture *fixture, const char *path, const DTTR_TestPEImage *image, void *userdata)
static void test_expected_pcdogs_signatures_resolve (void **state)
static uintptr_t blueprint_function_site (const DTTR_TestPCDOGSFixture *fixture, const blueprint_function *fn, const DTTR_TestPEImage *image)
static bool instruction_has_unsupported_reloc (const DTTR_TestDecodedInstruction *decoded)
static void assert_patch_window_decodes (const DTTR_TestPCDOGSFixture *fixture, const blueprint_function *fn, const DTTR_TestPEImage *image, uintptr_t site, uint32_t patch_size)
static uint32_t ret_stack_bytes (const DTTR_TestDecodedInstruction *decoded)
static void assert_abi_return_matches (const DTTR_TestPCDOGSFixture *fixture, const blueprint_function *fn, const DTTR_TestPEImage *image, uintptr_t site)
static void assert_blueprint_function_resolved (const DTTR_TestPCDOGSFixture *fixture, const blueprint_function *fn, const DTTR_TestPEImage *image)
static bool assert_blueprint_functions_for_fixture (size_t fixture_index, const DTTR_TestBinaryFixture *fixture, const char *path, const DTTR_TestPEImage *image, void *userdata)
static void test_blueprint_functions_resolve_and_match_abi (void **state)

Variables

static const DTTR_TestCase TEST_CASES []

Macro Definition Documentation

◆ STABLE_FUNCTION_COUNT

#define STABLE_FUNCTION_COUNT   (sizeof(DTTR_PCDOGS_FUNCTIONS) / sizeof(*DTTR_PCDOGS_FUNCTIONS))

Definition at line 30 of file pcdogs.c.

Referenced by assert_blueprint_functions_for_fixture().

◆ STABLE_SIGNATURE_COUNT

#define STABLE_SIGNATURE_COUNT   (sizeof(DTTR_PCDOGS_SIGNATURES) / sizeof(*DTTR_PCDOGS_SIGNATURES))

Definition at line 28 of file pcdogs.c.

Referenced by assert_signatures_for_fixture().

◆ UNSTABLE_FUNCTION_COUNT

#define UNSTABLE_FUNCTION_COUNT   (sizeof(DTTR_PCDOGS_UNSTABLE_FUNCTIONS) / sizeof(*DTTR_PCDOGS_UNSTABLE_FUNCTIONS))

Definition at line 34 of file pcdogs.c.

Referenced by assert_blueprint_functions_for_fixture().

◆ UNSTABLE_SIGNATURE_COUNT

#define UNSTABLE_SIGNATURE_COUNT   (sizeof(DTTR_PCDOGS_UNSTABLE_SIGNATURES) / sizeof(*DTTR_PCDOGS_UNSTABLE_SIGNATURES))

Definition at line 32 of file pcdogs.c.

Referenced by assert_signatures_for_fixture().

Function Documentation

◆ assert_abi_return_matches()

void assert_abi_return_matches ( const DTTR_TestPCDOGSFixture * fixture,
const blueprint_function * fn,
const DTTR_TestPEImage * image,
uintptr_t site )
static

◆ assert_blueprint_function_resolved()

◆ assert_blueprint_functions_for_fixture()

bool assert_blueprint_functions_for_fixture ( size_t fixture_index,
const DTTR_TestBinaryFixture * fixture,
const char * path,
const DTTR_TestPEImage * image,
void * userdata )
static

◆ assert_decodes_at()

void assert_decodes_at ( const DTTR_TestPCDOGSFixture * fixture,
const char * kind,
const char * name,
const DTTR_TestPEImage * image,
uintptr_t rva )
static

◆ assert_patch_window_decodes()

void assert_patch_window_decodes ( const DTTR_TestPCDOGSFixture * fixture,
const blueprint_function * fn,
const DTTR_TestPEImage * image,
uintptr_t site,
uint32_t patch_size )
static

◆ assert_signature_resolved()

void assert_signature_resolved ( const DTTR_TestPCDOGSFixture * fixture,
const blueprint_signature * sig,
const DTTR_TestPEImage * image )
static

◆ assert_signatures_for_fixture()

bool assert_signatures_for_fixture ( size_t fixture_index,
const DTTR_TestBinaryFixture * fixture,
const char * path,
const DTTR_TestPEImage * image,
void * userdata )
static

◆ blueprint_function_site()

uintptr_t blueprint_function_site ( const DTTR_TestPCDOGSFixture * fixture,
const blueprint_function * fn,
const DTTR_TestPEImage * image )
static

◆ instruction_has_unsupported_reloc()

bool instruction_has_unsupported_reloc ( const DTTR_TestDecodedInstruction * decoded)
static

Definition at line 177 of file pcdogs.c.

Referenced by assert_patch_window_decodes().

◆ require_sigscan()

uintptr_t require_sigscan ( const DTTR_TestPCDOGSFixture * fixture,
const char * kind,
const char * name,
const uint8_t * sig,
const char * mask,
const DTTR_TestPEImage * image )
static

◆ ret_stack_bytes()

uint32_t ret_stack_bytes ( const DTTR_TestDecodedInstruction * decoded)
static

Definition at line 240 of file pcdogs.c.

Referenced by assert_abi_return_matches().

◆ test_blueprint_functions_resolve_and_match_abi()

void test_blueprint_functions_resolve_and_match_abi ( void ** state)
static

◆ test_expected_pcdogs_signatures_resolve()

void test_expected_pcdogs_signatures_resolve ( void ** state)
static

Variable Documentation

◆ TEST_CASES

const DTTR_TestCase TEST_CASES[]
static
Initial value:
= {
}
static void test_blueprint_functions_resolve_and_match_abi(void **state)
Definition pcdogs.c:350
static void test_expected_pcdogs_signatures_resolve(void **state)
Definition pcdogs.c:144

Definition at line 355 of file pcdogs.c.