DOSMEM_Init VirtualProtect fails

vkxzjq6lg at cswebmail.com vkxzjq6lg at cswebmail.com
Mon Dec 9 18:07:30 CST 2002


To further my porting work, I've patched my copy of DOSMEM.C like this:

    else if (dos_init && !already_mapped)
    {
        if (DOSMEM_dosmem)
        {
            ERR( "Needs access to the first megabyte for DOS mode\n" );
            ExitProcess(1);
        }
        MESSAGE( "Warning: unprotecting the first 64KB of memory to allow real-mode
calls.\n"
                 "         NULL pointer accesses will no longer be caught.\n" );

	/* James Day added the if/FIXME/return false around this VirtualProtect
	   because OzWin on my AMD K6-3 gave this result:
wine --debugmsg +dosmem ozwin2
fixme:toolhelp:InterruptRegister16 (0000, 0x26f00ba), stub.
Warning: unprotecting the first 64KB of memory to allow real-mode calls.
         NULL pointer accesses will no longer be caught.
fixme:dosmem:DOSMEM_Init Failed to unprotect first 64KB of memory. init=1, done=1, mapped=0
fixme:toolhelp:InterruptUnRegister16 (0000), stub.
	*/
        if ( ! VirtualProtect( NULL, 0x10000, PAGE_EXECUTE_READWRITE, NULL ) )
	{
	    FIXME("Failed to unprotect first 64KB of memory. init=%d, done=%d, mapped=%d\n",
	    			(int)dos_init, already_done, already_mapped);
	    return FALSE;
	}
        /* copy the BIOS and ISR area down */
        memcpy( DOSMEM_dosmem, DOSMEM_sysmem, 0x400 + 0x100 );

NtProtectVirtualMemory is returning STATUS_INVALID_PARAMETER to VirtualProtectEx and
DOSMEM_Init wasn't handling this failure gracefully - the memcpy was tripping the debugger
and falling flat, taking the application with it.

Anyone got any better ideas? Want more information on what's happening, like which of the
STATUS_INVALID_PARAMETER cases is happening?

Lindows 3.0 OS (Debian plus bits), Wine 20021125 compiled here with only this change. Not
running as root. 128MB of RAM.

___________________________________________________
The ALL NEW CS2000 from CompuServe
 Better!  Faster! More Powerful!
 250 FREE hours! Sign-on Now!
 http://www.compuserve.com/trycsrv/cs2000/webmail/







More information about the wine-devel mailing list