Commit 5197f0c2 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix file name handling on MS-Windows 9X.

 src/w32.c (maybe_load_unicows_dll): New function.
 src/emacs.c (main) [WINDOWSNT]: Call maybe_load_unicows_dll early
 on, to make sure we can convert file names to and from UTF-8 on
 Windows 9X.  This fixes a failure to start up because Emacs cannot
 find term/w32-win.el.  Reported by oslsachem <oslsachem@gmail.com>.
 src/w32font.c [WINDOWSNT]: Include w32.h.
 (w32_load_unicows_or_gdi32): Call maybe_load_unicows_dll, instead
 of implementing the same stuff.
 Remove now unused g_b_init_is_windows_9x.
 src/w32.h (maybe_load_unicows_dll): Add prototype.

 nt/runemacs.c (ensure_unicows_dll): Don't tell in the message box
 that "emacs -nw" can do without UNICOWS.DLL on Windows 9X.  See
 w32.c:maybe_load_unicows_dll and its callers for the reason.
parent 812a0930
2014-01-18 Eli Zaretskii <eliz@gnu.org>
* runemacs.c (ensure_unicows_dll): Don't tell in the message box
that "emacs -nw" can do without UNICOWS.DLL on Windows 9X. See
w32.c:maybe_load_unicows_dll and its callers for the reason.
2014-01-11 Claudio Bley <claudio.bley@googlemail.com>
* inc/sys/stat.h (_WSTAT_DEFINED): Define, to avoid compilation
......
......@@ -234,8 +234,6 @@ ensure_unicows_dll (void)
"Emacs cannot load the UNICOWS.DLL library.\n"
"This library is essential for using Emacs\n"
"on this system. You need to install it.\n\n"
"However, you can still use Emacs by invoking\n"
"it with the '-nw' command-line option.\n\n"
"Emacs will exit when you click OK.",
"Emacs cannot load UNICOWS.DLL",
MB_ICONERROR | MB_TASKMODAL
......
2014-01-18 Eli Zaretskii <eliz@gnu.org>
Fix file name handling on MS-Windows 9X.
* w32.c (maybe_load_unicows_dll): New function.
* emacs.c (main) [WINDOWSNT]: Call maybe_load_unicows_dll early
on, to make sure we can convert file names to and from UTF-8 on
Windows 9X. This fixes a failure to start up because Emacs cannot
find term/w32-win.el. Reported by oslsachem <oslsachem@gmail.com>.
* w32font.c [WINDOWSNT]: Include w32.h.
(w32_load_unicows_or_gdi32): Call maybe_load_unicows_dll, instead
of implementing the same stuff.
Remove now unused g_b_init_is_windows_9x.
* w32.h (maybe_load_unicows_dll): Add prototype.
2014-01-17 Eli Zaretskii <eliz@gnu.org>
* menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily
......
......@@ -749,6 +749,12 @@ main (int argc, char **argv)
early as possible. (unexw32.c calls this function as well, but
the additional call here is harmless.) */
cache_system_info ();
#ifdef WINDOWSNT
/* On Windows 9X, we have to load UNICOWS.DLL as early as possible,
to have non-stub implementations of APIs we need to convert file
names between UTF-8 and the system's ANSI codepage. */
maybe_load_unicows_dll ();
#endif
#endif
#ifdef RUN_TIME_REMAP
......
......@@ -8923,6 +8923,40 @@ shutdown_handler (DWORD type)
return FALSE;
}
/* On Windows 9X, load UNICOWS.DLL and return its handle, or die. On
NT, return a handle to GDI32.DLL. */
HANDLE
maybe_load_unicows_dll (void)
{
if (os_subtype == OS_9X)
{
HANDLE ret = LoadLibrary ("Unicows.dll");
if (ret)
return ret;
else
{
int button;
button = MessageBox (NULL,
"Emacs cannot load the UNICOWS.DLL library.\n"
"This library is essential for using Emacs\n"
"on this system. You need to install it.\n\n"
"Emacs will exit when you click OK.",
"Emacs cannot load UNICOWS.DLL",
MB_ICONERROR | MB_TASKMODAL
| MB_SETFOREGROUND | MB_OK);
switch (button)
{
case IDOK:
default:
exit (1);
}
}
}
else
return LoadLibrary ("Gdi32.dll");
}
/*
globals_of_w32 is used to initialize those global variables that
must always be initialized on startup even when the global variable
......
......@@ -163,6 +163,7 @@ extern LPBYTE w32_get_resource (char * key, LPDWORD type);
extern void release_listen_threads (void);
extern void init_ntproc (int);
extern void term_ntproc (int);
extern HANDLE maybe_load_unicows_dll (void);
extern void globals_of_w32 (void);
extern void term_timers (void);
......
......@@ -33,6 +33,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "fontset.h"
#include "font.h"
#include "w32font.h"
#ifdef WINDOWSNT
#include "w32.h"
#endif
/* Cleartype available on Windows XP, cleartype_natural from XP SP1.
The latter does not try to fit cleartype smoothed fonts into the
......@@ -144,7 +147,6 @@ struct font_callback_data
style variations if the font name is not specified. */
static void list_all_matching_fonts (struct font_callback_data *);
static BOOL g_b_init_is_w9x;
static BOOL g_b_init_get_outline_metrics_w;
static BOOL g_b_init_get_text_metrics_w;
static BOOL g_b_init_get_glyph_outline_w;
......@@ -183,45 +185,7 @@ typedef BOOL (WINAPI * GetCharWidth32W_Proc) (
static HMODULE
w32_load_unicows_or_gdi32 (void)
{
static BOOL is_9x = 0;
OSVERSIONINFO os_ver;
HMODULE ret;
if (g_b_init_is_w9x == 0)
{
g_b_init_is_w9x = 1;
ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (GetVersionEx (&os_ver))
is_9x = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
}
if (is_9x)
{
ret = LoadLibrary ("Unicows.dll");
if (!ret)
{
int button;
button = MessageBox (NULL,
"Emacs cannot load the UNICOWS.DLL library.\n"
"This library is essential for using Emacs\n"
"on this system. You need to install it.\n\n"
"However, you can still use Emacs by invoking\n"
"it with the '-nw' command-line option.\n\n"
"Emacs will exit when you click OK.",
"Emacs cannot load UNICOWS.DLL",
MB_ICONERROR | MB_TASKMODAL
| MB_SETFOREGROUND | MB_OK);
switch (button)
{
case IDOK:
default:
exit (1);
}
}
}
else
ret = LoadLibrary ("Gdi32.dll");
return ret;
return maybe_load_unicows_dll ();
}
/* The following 3 functions call the problematic "wide" APIs via
......@@ -2753,7 +2717,6 @@ versions of Windows) characters. */);
void
globals_of_w32font (void)
{
g_b_init_is_w9x = 0;
g_b_init_get_outline_metrics_w = 0;
g_b_init_get_text_metrics_w = 0;
g_b_init_get_glyph_outline_w = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment