Ken Coleman <[EMAIL PROTECTED]> writes:
> The problem appears to be using the VirtualFree() function with the
> MEM_DECOMMIT flag on a section of memory that hasn't been allocated by
> VirtualAlloc(). I have no idea why AOE2 is doing this (it may be
> related to another bug or something), but it's definitely legal under
> Windows.
Does this help?
Index: memory/virtual.c
===================================================================
RCS file: /opt/cvs-commit/wine/memory/virtual.c,v
retrieving revision 1.55
diff -u -r1.55 virtual.c
--- memory/virtual.c 2001/01/05 04:08:08 1.55
+++ memory/virtual.c 2001/01/09 21:10:51
@@ -56,6 +56,7 @@
/* Per-view flags */
#define VFLAG_SYSTEM 0x01
+#define VFLAG_VALLOC 0x02 /* allocated by VirtualAlloc */
/* Conversion from VPROT_* to Win32 flags */
static const BYTE VIRTUAL_Win32Flags[16] =
@@ -139,10 +140,13 @@
UINT addr = view->base;
BYTE prot = view->prot[0];
- DPRINTF( "View: %08x - %08x%s",
- view->base, view->base + view->size - 1,
- (view->flags & VFLAG_SYSTEM) ? " (system)" : "" );
- if (view->mapping)
+ DPRINTF( "View: %08x - %08x",
+ view->base, view->base + view->size - 1 );
+ if (view->flags & VFLAG_SYSTEM)
+ DPRINTF( " (system)\n" );
+ else if (view->flags & VFLAG_VALLOC)
+ DPRINTF( " (valloc)\n" );
+ else if (view->mapping)
DPRINTF( " %d\n", view->mapping );
else
DPRINTF( " (anonymous)\n");
@@ -791,8 +795,9 @@
SetLastError( ERROR_INVALID_ADDRESS );
return NULL;
}
- if (!(view = VIRTUAL_CreateView( ptr, size, (type & MEM_SYSTEM) ?
- VFLAG_SYSTEM : 0, vprot, 0 )))
+ if (!(view = VIRTUAL_CreateView( ptr, size,
+ VFLAG_VALLOC | ((type & MEM_SYSTEM) ?
+VFLAG_SYSTEM : 0),
+ vprot, 0 )))
{
munmap( (void *)ptr, size );
SetLastError( ERROR_OUTOFMEMORY );
@@ -859,7 +864,8 @@
base = ROUND_ADDR( addr );
if (!(view = VIRTUAL_FindView( base )) ||
- (base + size > view->base + view->size))
+ (base + size > view->base + view->size) ||
+ !(view->flags & VFLAG_VALLOC))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
--
Alexandre Julliard
[EMAIL PROTECTED]