Check architecture of library to load.

This commit is contained in:
Joachim Bauch
2014-09-21 17:33:18 +02:00
parent b8125d0a65
commit 2d504b533e
+9
View File
@@ -370,6 +370,15 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data,
return NULL;
}
#ifdef _WIN64
if (old_header->FileHeader.Machine == IMAGE_FILE_MACHINE_I386) {
#else
if (old_header->FileHeader.Machine != IMAGE_FILE_MACHINE_I386) {
#endif
SetLastError(ERROR_BAD_EXE_FORMAT);
return NULL;
}
// reserve memory for image of library
// XXX: is it correct to commit the complete memory region at once?
// calling DllEntry raises an exception if we don't...