- debug output disabled by default

- tries to allocate memory at arbitrary address if specified ImageBase is invalid or cannot be allocated
This commit is contained in:
Joachim Bauch
2004-10-20 20:32:18 +00:00
parent 37fc1b6e82
commit e32c546536
+7 -2
View File
@@ -24,8 +24,6 @@
// disable warnings about pointer <-> DWORD conversions
#pragma warning( disable : 4311 4312 )
#define DEBUG_OUTPUT 1
#include <Windows.h>
#include <winnt.h>
#ifdef DEBUG_OUTPUT
@@ -300,6 +298,13 @@ HMEMORYMODULE MemoryLoadLibrary(const void *data, const size_t size)
MEM_RESERVE,
PAGE_READWRITE);
if (code == NULL)
// try to allocate memory at arbitrary position
code = (unsigned char *)VirtualAlloc(NULL,
old_header->OptionalHeader.SizeOfImage,
MEM_RESERVE,
PAGE_READWRITE);
if (code == NULL)
{
#if DEBUG_OUTPUT