upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/loader_test.cpp
diff options
context:
space:
mode:
authorDiesel <dev.diesel@proton.me>2026-11-21 22:04:18 +0100
committerDiesel <dev.diesel@proton.me>2026-11-21 22:04:18 +0100
commitce2cf7578549159ed6bb649c1bcb4f24142a1395 (patch)
tree23abb2dd20d25ca6252472587c6053e044074bb9 /runtime/test/loader_test.cpp
parent5b3bbad6e65a556f65dffb0be819ce7d60190ff2 (diff)
parentaae4d99e10784eb21b4f14d08470c79613b9e7fe (diff)
Merge main and share compute fixture header overrides
Diffstat (limited to 'runtime/test/loader_test.cpp')
-rw-r--r--runtime/test/loader_test.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/test/loader_test.cpp b/runtime/test/loader_test.cpp
index b05f35b15..6fd1dced4 100644
--- a/runtime/test/loader_test.cpp
+++ b/runtime/test/loader_test.cpp
@@ -94,7 +94,7 @@ std::filesystem::path write_image_as(const std::vector<uint8_t>& bytes, const st
94// export directory, which is how a forwarder is encoded. 94// export directory, which is how a forwarder is encoded.
95std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_base) { 95std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_base) {
96 auto img = make_image(); 96 auto img = make_image();
97 std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); // real tables end in a zero descriptor 97 std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0}); // real tables end in a zero descriptor
98 nt_of(img)->OptionalHeader.ImageBase = image_base; 98 nt_of(img)->OptionalHeader.ImageBase = image_base;
99 auto* ed = reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(img.data() + 0x200); 99 auto* ed = reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(img.data() + 0x200);
100 ed->Base = 1; 100 ed->Base = 1;
@@ -117,7 +117,7 @@ std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_bas
117// An image importing `dll`!`symbol` by name. 117// An image importing `dll`!`symbol` by name.
118std::vector<uint8_t> make_import_image(const char* dll, const char* symbol) { 118std::vector<uint8_t> make_import_image(const char* dll, const char* symbol) {
119 auto img = make_image(); 119 auto img = make_image();
120 std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); 120 std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0});
121 auto* d = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(img.data() + 0x200); 121 auto* d = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(img.data() + 0x200);
122 d->Name = 0x1060; // past the zero descriptor that ends the table 122 d->Name = 0x1060; // past the zero descriptor that ends the table
123 d->OriginalFirstThunk = 0x1100; 123 d->OriginalFirstThunk = 0x1100;
@@ -589,7 +589,7 @@ void test_delay_descriptor_fields() {
589 { 589 {
590 // Without dlattrRva the fields are 32-bit virtual addresses, which cannot address an x64 image. 590 // Without dlattrRva the fields are 32-bit virtual addresses, which cannot address an x64 image.
591 auto img = make_image(); 591 auto img = make_image();
592 std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); 592 std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0});
593 auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); 593 auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200);
594 d->Attributes.AllAttributes = 0; 594 d->Attributes.AllAttributes = 0;
595 d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table 595 d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table
@@ -603,7 +603,7 @@ void test_delay_descriptor_fields() {
603 { 603 {
604 const char* what = "a delay import with no name table binds through its address table"; 604 const char* what = "a delay import with no name table binds through its address table";
605 auto img = make_image(); 605 auto img = make_image();
606 std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); 606 std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0});
607 auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); 607 auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200);
608 d->Attributes.AllAttributes = 1; // dlattrRva 608 d->Attributes.AllAttributes = 1; // dlattrRva
609 d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table 609 d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table