102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
dttr_test.h
Go to the documentation of this file.
1#ifndef DTTR_TEST_H
2#define DTTR_TEST_H
3
4#define DTTR_TEST_BINARY_SUPPORT
5#include <dttr_test_support.h>
6#undef DTTR_TEST_BINARY_SUPPORT
7
8#define DTTR_TEST_PCDOGS_REQUIRED_ALL \
9 DTTR_TEST_FIXTURE_MASK_ALL(DTTR_TEST_PCDOGS_FIXTURE_COUNT)
10#define DTTR_TEST_PCDOGS_REQUIRED_EN DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN)
11#define DTTR_TEST_PCDOGS_REQUIRED_EU_SC \
12 (DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EU) \
13 | DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_SC))
14#define DTTR_TEST_PCDOGS_REQUIRED_EN_EU \
15 (DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN) \
16 | DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EU))
17#define DTTR_TEST_PCDOGS_REQUIRED_EN_SC \
18 (DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_EN) \
19 | DTTR_TEST_FIXTURE_BIT(DTTR_TEST_PCDOGS_SC))
20#define DTTR_TEST_PCDOGS_SIG_NOT_FOUND DTTR_TEST_SIG_NOT_FOUND
21#define DTTR_TEST_PCDOGS_IMPORT_CAP DTTR_TEST_IMPORT_CAP
22
23#define TARGET_RESOLVE DTTR_TEST_TARGET_RESOLVE
24#define TARGET_JMP_HOOK DTTR_TEST_TARGET_JMP_HOOK
25#define TARGET_TRAMPOLINE_HOOK DTTR_TEST_TARGET_TRAMPOLINE_HOOK
26#define TARGET_POINTER_FF25_E8_TARGET DTTR_TEST_TARGET_POINTER_FF25_E8_TARGET
27#define TARGET_POINTER_U32_AT_MATCH_PLUS_2 DTTR_TEST_TARGET_POINTER_U32_AT_MATCH_PLUS_2
28#define TARGET_BYTE_PATCH DTTR_TEST_TARGET_BYTE_PATCH
29
36
37typedef DTTR_TestBinaryFixture DTTR_TestPCDOGSFixture;
38typedef DTTR_TestPatternExpectation DTTR_TestPCDOGSSignatureExpectation;
39typedef DTTR_TestTargetKind E_TargetKind;
40typedef DTTR_TestTargetExpectation pcdogs_target_expectation;
41
45extern const char *const DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOKS[];
47
49const char *pcdogs_fixture_dir();
53bool pcdogs_for_each_fixture(DTTR_TestPEFixtureVisitor visitor, void *userdata);
54
56static inline uintptr_t pcdogs_sigscan(
57 const DTTR_TestPEImage *image,
58 const uint8_t *sig,
59 const char *mask
60) {
61 return DTTR_TestPE_Sigscan(image, sig, mask);
62}
63
65static inline size_t pcdogs_sigscan_count(
66 const DTTR_TestPEImage *image,
67 const uint8_t *sig,
68 const char *mask
69) {
70 return DTTR_TestPE_SigscanCount(image, sig, mask);
71}
72
74static inline size_t pcdogs_collect_imports(
75 const DTTR_TestPEImage *image,
76 DTTR_TestImportEntry *imports,
77 size_t imports_cap
78) {
79 return DTTR_TestPE_CollectImports(image, imports, imports_cap);
80}
81
82#endif // DTTR_TEST_H
size_t DTTR_TestPE_CollectImports(const DTTR_TestPEImage *image, DTTR_TestImportEntry *imports, size_t imports_cap)
Definition binary.c:567
uintptr_t DTTR_TestPE_Sigscan(const DTTR_TestPEImage *image, const uint8_t *sig, const char *mask)
Definition binary.c:524
size_t DTTR_TestPE_SigscanCount(const DTTR_TestPEImage *image, const uint8_t *sig, const char *mask)
Definition binary.c:512
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.
Definition dttr_test.h:56
const char * pcdogs_fixture_dir()
Return the fixture directory used by PCDOGS signature tests.
const size_t DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOK_COUNT
Definition pcdogs.c:216
DTTR_TestBinaryFixture DTTR_TestPCDOGSFixture
Definition dttr_test.h:37
DTTR_TestPatternExpectation DTTR_TestPCDOGSSignatureExpectation
Definition dttr_test.h:38
const char *const DTTR_TEST_PCDOGS_SIDECAR_MSS_IMPORT_HOOKS[]
Definition pcdogs.c:185
DTTR_TestPCDOGSFixtureID
Definition dttr_test.h:30
@ DTTR_TEST_PCDOGS_EN
Definition dttr_test.h:31
@ DTTR_TEST_PCDOGS_FIXTURE_COUNT
Definition dttr_test.h:34
@ DTTR_TEST_PCDOGS_EU
Definition dttr_test.h:32
@ DTTR_TEST_PCDOGS_SC
Definition dttr_test.h:33
const pcdogs_target_expectation DTTR_TEST_PCDOGS_SIDECAR_TARGETS[]
Definition pcdogs.c:49
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.
Definition dttr_test.h:74
DTTR_TestTargetKind E_TargetKind
Definition dttr_test.h:39
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.
DTTR_TestTargetExpectation pcdogs_target_expectation
Definition dttr_test.h:40
static size_t pcdogs_sigscan_count(const DTTR_TestPEImage *image, const uint8_t *sig, const char *mask)
Count signature matches in a fixture image.
Definition dttr_test.h:65
const DTTR_TestPCDOGSFixture DTTR_TEST_PCDOGS_FIXTURES[]
const size_t DTTR_TEST_PCDOGS_SIDECAR_TARGET_COUNT
Definition pcdogs.c:178