Fix SectionAlignment

Some dlls do not use Native SectionAlignment, instead use SectionAlignment from PE.
This commit is contained in:
HotKeyIt
2019-03-15 01:18:40 +01:00
committed by Simon Rozman
parent 08a59f2922
commit 47a9ee83db
+2 -3
View File
@@ -654,9 +654,8 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data, size_t size,
}
}
GetNativeSystemInfo(&sysInfo);
alignedImageSize = AlignValueUp(old_header->OptionalHeader.SizeOfImage, sysInfo.dwPageSize);
if (alignedImageSize != AlignValueUp(lastSectionEnd, sysInfo.dwPageSize)) {
alignedImageSize = AlignValueUp(old_header->OptionalHeader.SizeOfImage, old_header->OptionalHeader.SectionAlignment);
if (alignedImageSize != AlignValueUp(lastSectionEnd, old_header->OptionalHeader.SectionAlignment)) {
SetLastError(ERROR_BAD_EXE_FORMAT);
return NULL;
}