102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
dttr_test.h File Reference

Go to the source code of this file.

Macros

#define DTTR_TEST_BINARY_SUPPORT
#define DTTR_TEST_PCDOGS_REQUIRED_ALL   DTTR_TEST_FIXTURE_MASK_ALL(DTTR_TEST_PCDOGS_FIXTURE_COUNT)
#define DTTR_TEST_PCDOGS_REQUIRED_EN   DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN)
#define DTTR_TEST_PCDOGS_REQUIRED_EU_SC
#define DTTR_TEST_PCDOGS_REQUIRED_EN_EU
#define DTTR_TEST_PCDOGS_REQUIRED_EN_SC
#define DTTR_TEST_PCDOGS_SIG_NOT_FOUND   DTTR_TEST_SIG_NOT_FOUND
#define DTTR_TEST_PCDOGS_IMPORT_CAP   DTTR_TEST_IMPORT_CAP
#define TARGET_RESOLVE   DTTR_TEST_TARGET_RESOLVE
#define TARGET_JMP_HOOK   DTTR_TEST_TARGET_JMP_HOOK
#define TARGET_TRAMPOLINE_HOOK   DTTR_TEST_TARGET_TRAMPOLINE_HOOK
#define TARGET_POINTER_FF25_E8_TARGET   DTTR_TEST_TARGET_POINTER_FF25_E8_TARGET
#define TARGET_POINTER_U32_AT_MATCH_PLUS_2   DTTR_TEST_TARGET_POINTER_U32_AT_MATCH_PLUS_2
#define TARGET_BYTE_PATCH   DTTR_TEST_TARGET_BYTE_PATCH

Typedefs

typedef DTTR_TestBinaryFixture DTTR_TestPCDOGSFixture
typedef DTTR_TestPatternExpectation DTTR_TestPCDOGSSignatureExpectation
typedef DTTR_TestTargetKind E_TargetKind
typedef DTTR_TestTargetExpectation pcdogs_target_expectation

Enumerations

enum  DTTR_TestPCDOGSFixtureID { DTTR_TEST_PCDOGS_EN = 0 , DTTR_TEST_PCDOGS_EU , DTTR_TEST_PCDOGS_SC , DTTR_TEST_PCDOGS_FIXTURE_COUNT }

Functions

const char * pcdogs_fixture_dir ()
 Return the fixture directory used by PCDOGS signature tests.
bool pcdogs_fixtures_available ()
 Report whether all PCDOGS binary fixtures are available for signature tests.
bool pcdogs_for_each_fixture (DTTR_TestPEFixtureVisitor visitor, void *userdata)
 Visit each available PCDOGS fixture image for signature and ABI checks.
static uintptr_t pcdogs_sigscan (const DTTR_TestPEImage *image, const uint8_t *sig, const char *mask)
 Scan a fixture image with the same signature format used by SDK symbol rows.
static size_t pcdogs_sigscan_count (const DTTR_TestPEImage *image, const uint8_t *sig, const char *mask)
 Count signature matches in a fixture image.
static size_t pcdogs_collect_imports (const DTTR_TestPEImage *image, DTTR_TestImportEntry *imports, size_t imports_cap)
 Collect fixture imports for tests that validate recovered sidecar targets.

Variables

const DTTR_TestPCDOGSFixture DTTR_TEST_PCDOGS_FIXTURES []
const pcdogs_target_expectation DTTR_TEST_PCDOGS_SIDECAR_TARGETS []
const size_t DTTR_TEST_PCDOGS_SIDECAR_TARGET_COUNT
const char *const DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOKS []
const size_t DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOK_COUNT

Macro Definition Documentation

◆ DTTR_TEST_BINARY_SUPPORT

#define DTTR_TEST_BINARY_SUPPORT

Definition at line 4 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_IMPORT_CAP

#define DTTR_TEST_PCDOGS_IMPORT_CAP   DTTR_TEST_IMPORT_CAP

Definition at line 21 of file dttr_test.h.

Referenced by assert_imports_for_fixture().

◆ DTTR_TEST_PCDOGS_REQUIRED_ALL

#define DTTR_TEST_PCDOGS_REQUIRED_ALL   DTTR_TEST_FIXTURE_MASK_ALL(DTTR_TEST_PCDOGS_FIXTURE_COUNT)

Definition at line 8 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_REQUIRED_EN

#define DTTR_TEST_PCDOGS_REQUIRED_EN   DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN)

Definition at line 10 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_REQUIRED_EN_EU

#define DTTR_TEST_PCDOGS_REQUIRED_EN_EU
Value:
(DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN) \
| DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EU))
@ DTTR_TEST_PCDOGS_EN
Definition dttr_test.h:31
@ DTTR_TEST_PCDOGS_EU
Definition dttr_test.h:32

Definition at line 14 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_REQUIRED_EN_SC

#define DTTR_TEST_PCDOGS_REQUIRED_EN_SC
Value:
(DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN) \
| DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_SC))
@ DTTR_TEST_PCDOGS_SC
Definition dttr_test.h:33

Definition at line 17 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_REQUIRED_EU_SC

#define DTTR_TEST_PCDOGS_REQUIRED_EU_SC
Value:
(DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EU) \
| DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_SC))

Definition at line 11 of file dttr_test.h.

◆ DTTR_TEST_PCDOGS_SIG_NOT_FOUND

#define DTTR_TEST_PCDOGS_SIG_NOT_FOUND   DTTR_TEST_SIG_NOT_FOUND

Definition at line 20 of file dttr_test.h.

Referenced by require_sigscan().

◆ TARGET_BYTE_PATCH

#define TARGET_BYTE_PATCH   DTTR_TEST_TARGET_BYTE_PATCH

Definition at line 28 of file dttr_test.h.

Referenced by test_expected_pcdogs_byte_patch_targets_resolve().

◆ TARGET_JMP_HOOK

#define TARGET_JMP_HOOK   DTTR_TEST_TARGET_JMP_HOOK

Definition at line 24 of file dttr_test.h.

Referenced by test_expected_pcdogs_jmp_hook_targets_resolve().

◆ TARGET_POINTER_FF25_E8_TARGET

#define TARGET_POINTER_FF25_E8_TARGET   DTTR_TEST_TARGET_POINTER_FF25_E8_TARGET

Definition at line 26 of file dttr_test.h.

◆ TARGET_POINTER_U32_AT_MATCH_PLUS_2

#define TARGET_POINTER_U32_AT_MATCH_PLUS_2   DTTR_TEST_TARGET_POINTER_U32_AT_MATCH_PLUS_2

Definition at line 27 of file dttr_test.h.

◆ TARGET_RESOLVE

#define TARGET_RESOLVE   DTTR_TEST_TARGET_RESOLVE

Definition at line 23 of file dttr_test.h.

◆ TARGET_TRAMPOLINE_HOOK

#define TARGET_TRAMPOLINE_HOOK   DTTR_TEST_TARGET_TRAMPOLINE_HOOK

Definition at line 25 of file dttr_test.h.

Typedef Documentation

◆ DTTR_TestPCDOGSFixture

typedef DTTR_TestBinaryFixture DTTR_TestPCDOGSFixture

Definition at line 37 of file dttr_test.h.

◆ DTTR_TestPCDOGSSignatureExpectation

typedef DTTR_TestPatternExpectation DTTR_TestPCDOGSSignatureExpectation

Definition at line 38 of file dttr_test.h.

◆ E_TargetKind

typedef DTTR_TestTargetKind E_TargetKind

Definition at line 39 of file dttr_test.h.

◆ pcdogs_target_expectation

typedef DTTR_TestTargetExpectation pcdogs_target_expectation

Definition at line 40 of file dttr_test.h.

Enumeration Type Documentation

◆ DTTR_TestPCDOGSFixtureID

Enumerator
DTTR_TEST_PCDOGS_EN 
DTTR_TEST_PCDOGS_EU 
DTTR_TEST_PCDOGS_SC 
DTTR_TEST_PCDOGS_FIXTURE_COUNT 

Definition at line 30 of file dttr_test.h.

Function Documentation

◆ pcdogs_collect_imports()

size_t pcdogs_collect_imports ( const DTTR_TestPEImage * image,
DTTR_TestImportEntry * imports,
size_t imports_cap )
inlinestatic

Collect fixture imports for tests that validate recovered sidecar targets.

Definition at line 74 of file dttr_test.h.

References DTTR_TestPE_CollectImports().

Referenced by assert_imports_for_fixture().

◆ pcdogs_fixture_dir()

const char * pcdogs_fixture_dir ( )

Return the fixture directory used by PCDOGS signature tests.

Definition at line 27 of file pcdogs_fixtures.c.

Referenced by pcdogs_fixtures_available(), and pcdogs_for_each_fixture().

◆ pcdogs_fixtures_available()

◆ pcdogs_for_each_fixture()

bool pcdogs_for_each_fixture ( DTTR_TestPEFixtureVisitor visitor,
void * userdata )

◆ pcdogs_sigscan()

uintptr_t pcdogs_sigscan ( const DTTR_TestPEImage * image,
const uint8_t * sig,
const char * mask )
inlinestatic

Scan a fixture image with the same signature format used by SDK symbol rows.

Definition at line 56 of file dttr_test.h.

References DTTR_TestPE_Sigscan().

Referenced by require_sigscan().

◆ pcdogs_sigscan_count()

size_t pcdogs_sigscan_count ( const DTTR_TestPEImage * image,
const uint8_t * sig,
const char * mask )
inlinestatic

Count signature matches in a fixture image.

Definition at line 65 of file dttr_test.h.

References DTTR_TestPE_SigscanCount().

Referenced by require_sigscan().

Variable Documentation

◆ DTTR_TEST_PCDOGS_FIXTURES

const DTTR_TestPCDOGSFixture DTTR_TEST_PCDOGS_FIXTURES[]
extern

Definition at line 5 of file pcdogs_fixtures.c.

Referenced by pcdogs_fixtures_available(), and pcdogs_for_each_fixture().

◆ DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOK_COUNT

const size_t DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOK_COUNT
extern

Definition at line 215 of file pcdogs.c.

Referenced by assert_imports_for_fixture(), and import_hook_expected().

◆ DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOKS

const char* const DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOKS[]
extern

Definition at line 185 of file pcdogs.c.

Referenced by import_hook_expected().

◆ DTTR_TEST_PCDOGS_SIDECAR_TARGET_COUNT

const size_t DTTR_TEST_PCDOGS_SIDECAR_TARGET_COUNT
extern

Definition at line 178 of file pcdogs.c.

Referenced by assert_targets_for_fixture().

◆ DTTR_TEST_PCDOGS_SIDECAR_TARGETS

const pcdogs_target_expectation DTTR_TEST_PCDOGS_SIDECAR_TARGETS[]
extern

Definition at line 49 of file pcdogs.c.

Referenced by assert_targets_for_fixture().