From f7b090ae2a08b6cb6b95cdf41ff22e62f5c519dd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 19 May 2005 14:23:27 +0000 Subject: [PATCH] Fail more gracefully if 16-bit support is missing. --- programs/winevdm/Makefile.in | 2 +- programs/winevdm/winevdm.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/programs/winevdm/Makefile.in b/programs/winevdm/Makefile.in index cd19759810e..47d8f22cd18 100644 --- a/programs/winevdm/Makefile.in +++ b/programs/winevdm/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = winevdm.exe APPMODE = -mconsole -IMPORTS = winedos user32 kernel32 +IMPORTS = user32 kernel32 C_SRCS = \ winevdm.c diff --git a/programs/winevdm/winevdm.c b/programs/winevdm/winevdm.c index baf3a67b7a3..2801601bdbf 100644 --- a/programs/winevdm/winevdm.c +++ b/programs/winevdm/winevdm.c @@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winevdm); -extern void WINAPI wine_load_dos_exe( LPCSTR filename, LPCSTR cmdline ); +static void (WINAPI *wine_load_dos_exe)( LPCSTR filename, LPCSTR cmdline ); /*** PIF file structures ***/ @@ -384,6 +384,7 @@ int main( int argc, char *argv[] ) STARTUPINFOA info; char *cmdline, *appname, **first_arg; char *p; + HMODULE winedos; if (!argv[1]) usage(); @@ -396,13 +397,20 @@ int main( int argc, char *argv[] ) { if (!SearchPathA( NULL, argv[1], ".exe", sizeof(buffer), buffer, NULL )) { - WINE_MESSAGE( "winevdm: can't exec '%s': file not found\n", argv[1] ); + WINE_MESSAGE( "winevdm: unable to exec '%s': file not found\n", argv[1] ); ExitProcess(1); } appname = buffer; first_arg = argv + 1; } + 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] ); + ExitProcess(1); + } + if (*first_arg) first_arg++; /* skip program name */ cmdline = build_command_line( first_arg );