library: init zeroed memory in stub gen

I don't understand why this was necessary. C and C++ standards specify
that this memory should be zeroed by virtue of it being static and
constant, yet various different compilers produce various different
errors about this line...
This commit is contained in:
Adam
2024-07-29 21:52:04 +01:00
parent cc2c700547
commit 18902eecab

View File

@@ -70,7 +70,7 @@ int wmain(int argc, const wchar_t **argv) {
std::cout << "};" << std::endl;
}
// embed the amount of zeroes we'll need (WriteProcessMemory needs actual memory to copy from)
std::cout << "static const uint8_t zeroes[" << stub_nt_headers->OptionalHeader.SizeOfHeaders << "];" << std::endl;
std::cout << "static constexpr uint8_t zeroes[" << stub_nt_headers->OptionalHeader.SizeOfHeaders << "] = {0};" << std::endl;
std::cout << "void InjectStub(HANDLE process) {" << std::endl;
// allocate memory in the remote process