-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Description
I'm testing loading a dll proteted with Themida using your MemoryModule project.
I protected the a.dll that comes with the project, when i try to load it the code fail at this line: status = STATUS_NO_MEMORY;
//
// Allocate and copy sections
//
PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(new_header);
for (DWORD i = 0; i < new_header->FileHeader.NumberOfSections; ++i, ++section) {
DWORD size = AlignValueUp(
section->Misc.VirtualSize,
new_header->OptionalHeader.SectionAlignment
);
if (size < section->SizeOfRawData) {
status = STATUS_INVALID_IMAGE_FORMAT;
break;
}
LPVOID dest = VirtualAlloc(
(LPSTR)new_header->OptionalHeader.ImageBase + section->VirtualAddress,
size,
MEM_COMMIT,
PAGE_READWRITE
);
if (!dest) {
status = STATUS_NO_MEMORY; // <---- failed here
break;
}
if (section->SizeOfRawData) {
RtlCopyMemory(
dest,
LPBYTE(data) + section->PointerToRawData,
section->SizeOfRawData
);
}
}It does fail in the latest section, could you please, help debug this?
Metadata
Metadata
Assignees
Labels
No labels