[Bug 2905] Kings Quest 8 crashes while loading a saved game
wine-bugs at winehq.org
wine-bugs at winehq.org
Fri May 2 03:25:59 CDT 2014
http://bugs.winehq.org/show_bug.cgi?id=2905
Nico Bendlin <nicode at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nicode at gmx.net
--- Comment #26 from Nico Bendlin <nicode at gmx.net> ---
Loading a saved game worked after hooking the API in a run-time patch:
/************************************************************************/
/* Make sure UnmapViewOfFile is only called for the view's base address */
/* (the game has a global cleanup function for StreamIO objects that is */
/* using a dynamic_cast<MemRWStream *> to unmap file views - BUT during */
/* savegame loading MemRWStream objects are created for sub-chunks, and */
/* therefore the game depends on the Windows 9x API behavior of failing */
/* for addresses that are not the base address of a mapped file view... */
/* Windows XP and newer provide an AppCompat shim "KingsQuestMask" that */
/* hooks MapViewOfFile/UnmapViewOfFile and maintains an address list to */
/* make sure that only previously mapped views are unmapped by the API) */
/************************************************************************/
BOOL WINAPI KERNEL32_UnmapViewOfFile(LPCVOID lpBaseAddress)
{
MEMORY_BASIC_INFORMATION MemInfo;
if (lpBaseAddress && VirtualQuery(lpBaseAddress,
&MemInfo, sizeof(MEMORY_BASIC_INFORMATION))) {
if ((lpBaseAddress != MemInfo.BaseAddress) ||
(lpBaseAddress != MemInfo.AllocationBase)) {
SetLastError(ERROR_INVALID_ADDRESS);
return FALSE;
}
}
return UnmapViewOfFile(lpBaseAddress);
}
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list