winedos: Handle memory reservation errors more gracefully.
This commit is contained in:
parent
f02ef19fdb
commit
16e8633ee5
|
@ -506,14 +506,13 @@ BOOL DOSMEM_MapDosLayout(void)
|
|||
unsigned short sel;
|
||||
LDT_ENTRY entry;
|
||||
|
||||
if (DOSMEM_dosmem)
|
||||
if (DOSMEM_dosmem || !VirtualProtect( NULL, DOSMEM_SIZE, PAGE_EXECUTE_READWRITE, NULL ))
|
||||
{
|
||||
ERR( "Needs access to the first megabyte for DOS mode\n" );
|
||||
ERR( "Need full access to the first megabyte for DOS mode\n" );
|
||||
ExitProcess(1);
|
||||
}
|
||||
MESSAGE( "Warning: unprotecting memory to allow real-mode calls.\n"
|
||||
" NULL pointer accesses will no longer be caught.\n" );
|
||||
VirtualProtect( NULL, DOSMEM_SIZE, PAGE_EXECUTE_READWRITE, NULL );
|
||||
/* copy the BIOS and ISR area down */
|
||||
memcpy( DOSMEM_dosmem, DOSMEM_sysmem, 0x400 + 0x100 );
|
||||
DOSMEM_sysmem = DOSMEM_dosmem;
|
||||
|
|
|
@ -383,6 +383,7 @@ int main( int argc, char *argv[] )
|
|||
char *cmdline, *appname, **first_arg;
|
||||
char *p;
|
||||
HMODULE winedos;
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
|
||||
if (!argv[1]) usage();
|
||||
|
||||
|
@ -405,7 +406,12 @@ int main( int argc, char *argv[] )
|
|||
if (!(winedos = LoadLibraryA( "winedos.dll" )) ||
|
||||
!(wine_load_dos_exe = (void *)GetProcAddress( winedos, "wine_load_dos_exe" )))
|
||||
{
|
||||
WINE_MESSAGE( "winevdm: unable to exec '%s': 16-bit support missing\n", argv[1] );
|
||||
WINE_MESSAGE( "winevdm: unable to exec '%s': DOS support unavailable\n", appname );
|
||||
ExitProcess(1);
|
||||
}
|
||||
if (!VirtualQuery( NULL, &mem_info, sizeof(mem_info) ) || mem_info.State == MEM_FREE)
|
||||
{
|
||||
WINE_MESSAGE( "winevdm: unable to exec '%s': DOS memory range unavailable\n", appname );
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue