diff options
| author | Eli Zaretskii | 2014-01-18 13:46:22 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-01-18 13:46:22 +0200 |
| commit | 5197f0c2fee01c473b4876f6a49e784250f63640 (patch) | |
| tree | 31e0bf2968e74fbde5da7f1e0e13cdcd6e0c07ea /src | |
| parent | 812a093042a860768b002b988789c53d31127bb6 (diff) | |
| download | emacs-5197f0c2fee01c473b4876f6a49e784250f63640.tar.gz emacs-5197f0c2fee01c473b4876f6a49e784250f63640.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/emacs.c | 6 | ||||
| -rw-r--r-- | src/w32.c | 34 | ||||
| -rw-r--r-- | src/w32.h | 1 | ||||
| -rw-r--r-- | src/w32font.c | 45 |
5 files changed, 62 insertions, 41 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d7a1d1f08f6..82a5d68b923 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2014-01-18 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | Fix file name handling on MS-Windows 9X. | ||
| 4 | * w32.c (maybe_load_unicows_dll): New function. | ||
| 5 | |||
| 6 | * emacs.c (main) [WINDOWSNT]: Call maybe_load_unicows_dll early | ||
| 7 | on, to make sure we can convert file names to and from UTF-8 on | ||
| 8 | Windows 9X. This fixes a failure to start up because Emacs cannot | ||
| 9 | find term/w32-win.el. Reported by oslsachem <oslsachem@gmail.com>. | ||
| 10 | |||
| 11 | * w32font.c [WINDOWSNT]: Include w32.h. | ||
| 12 | (w32_load_unicows_or_gdi32): Call maybe_load_unicows_dll, instead | ||
| 13 | of implementing the same stuff. | ||
| 14 | Remove now unused g_b_init_is_windows_9x. | ||
| 15 | |||
| 16 | * w32.h (maybe_load_unicows_dll): Add prototype. | ||
| 17 | |||
| 1 | 2014-01-17 Eli Zaretskii <eliz@gnu.org> | 18 | 2014-01-17 Eli Zaretskii <eliz@gnu.org> |
| 2 | 19 | ||
| 3 | * menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily | 20 | * menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily |
diff --git a/src/emacs.c b/src/emacs.c index ac9f79b6ebf..af01e8431a5 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -749,6 +749,12 @@ main (int argc, char **argv) | |||
| 749 | early as possible. (unexw32.c calls this function as well, but | 749 | early as possible. (unexw32.c calls this function as well, but |
| 750 | the additional call here is harmless.) */ | 750 | the additional call here is harmless.) */ |
| 751 | cache_system_info (); | 751 | cache_system_info (); |
| 752 | #ifdef WINDOWSNT | ||
| 753 | /* On Windows 9X, we have to load UNICOWS.DLL as early as possible, | ||
| 754 | to have non-stub implementations of APIs we need to convert file | ||
| 755 | names between UTF-8 and the system's ANSI codepage. */ | ||
| 756 | maybe_load_unicows_dll (); | ||
| 757 | #endif | ||
| 752 | #endif | 758 | #endif |
| 753 | 759 | ||
| 754 | #ifdef RUN_TIME_REMAP | 760 | #ifdef RUN_TIME_REMAP |
| @@ -8923,6 +8923,40 @@ shutdown_handler (DWORD type) | |||
| 8923 | return FALSE; | 8923 | return FALSE; |
| 8924 | } | 8924 | } |
| 8925 | 8925 | ||
| 8926 | /* On Windows 9X, load UNICOWS.DLL and return its handle, or die. On | ||
| 8927 | NT, return a handle to GDI32.DLL. */ | ||
| 8928 | HANDLE | ||
| 8929 | maybe_load_unicows_dll (void) | ||
| 8930 | { | ||
| 8931 | if (os_subtype == OS_9X) | ||
| 8932 | { | ||
| 8933 | HANDLE ret = LoadLibrary ("Unicows.dll"); | ||
| 8934 | if (ret) | ||
| 8935 | return ret; | ||
| 8936 | else | ||
| 8937 | { | ||
| 8938 | int button; | ||
| 8939 | |||
| 8940 | button = MessageBox (NULL, | ||
| 8941 | "Emacs cannot load the UNICOWS.DLL library.\n" | ||
| 8942 | "This library is essential for using Emacs\n" | ||
| 8943 | "on this system. You need to install it.\n\n" | ||
| 8944 | "Emacs will exit when you click OK.", | ||
| 8945 | "Emacs cannot load UNICOWS.DLL", | ||
| 8946 | MB_ICONERROR | MB_TASKMODAL | ||
| 8947 | | MB_SETFOREGROUND | MB_OK); | ||
| 8948 | switch (button) | ||
| 8949 | { | ||
| 8950 | case IDOK: | ||
| 8951 | default: | ||
| 8952 | exit (1); | ||
| 8953 | } | ||
| 8954 | } | ||
| 8955 | } | ||
| 8956 | else | ||
| 8957 | return LoadLibrary ("Gdi32.dll"); | ||
| 8958 | } | ||
| 8959 | |||
| 8926 | /* | 8960 | /* |
| 8927 | globals_of_w32 is used to initialize those global variables that | 8961 | globals_of_w32 is used to initialize those global variables that |
| 8928 | must always be initialized on startup even when the global variable | 8962 | must always be initialized on startup even when the global variable |
| @@ -163,6 +163,7 @@ extern LPBYTE w32_get_resource (char * key, LPDWORD type); | |||
| 163 | extern void release_listen_threads (void); | 163 | extern void release_listen_threads (void); |
| 164 | extern void init_ntproc (int); | 164 | extern void init_ntproc (int); |
| 165 | extern void term_ntproc (int); | 165 | extern void term_ntproc (int); |
| 166 | extern HANDLE maybe_load_unicows_dll (void); | ||
| 166 | extern void globals_of_w32 (void); | 167 | extern void globals_of_w32 (void); |
| 167 | 168 | ||
| 168 | extern void term_timers (void); | 169 | extern void term_timers (void); |
diff --git a/src/w32font.c b/src/w32font.c index a3f7ea4afe4..c56da910920 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -33,6 +33,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 33 | #include "fontset.h" | 33 | #include "fontset.h" |
| 34 | #include "font.h" | 34 | #include "font.h" |
| 35 | #include "w32font.h" | 35 | #include "w32font.h" |
| 36 | #ifdef WINDOWSNT | ||
| 37 | #include "w32.h" | ||
| 38 | #endif | ||
| 36 | 39 | ||
| 37 | /* Cleartype available on Windows XP, cleartype_natural from XP SP1. | 40 | /* Cleartype available on Windows XP, cleartype_natural from XP SP1. |
| 38 | The latter does not try to fit cleartype smoothed fonts into the | 41 | The latter does not try to fit cleartype smoothed fonts into the |
| @@ -144,7 +147,6 @@ struct font_callback_data | |||
| 144 | style variations if the font name is not specified. */ | 147 | style variations if the font name is not specified. */ |
| 145 | static void list_all_matching_fonts (struct font_callback_data *); | 148 | static void list_all_matching_fonts (struct font_callback_data *); |
| 146 | 149 | ||
| 147 | static BOOL g_b_init_is_w9x; | ||
| 148 | static BOOL g_b_init_get_outline_metrics_w; | 150 | static BOOL g_b_init_get_outline_metrics_w; |
| 149 | static BOOL g_b_init_get_text_metrics_w; | 151 | static BOOL g_b_init_get_text_metrics_w; |
| 150 | static BOOL g_b_init_get_glyph_outline_w; | 152 | static BOOL g_b_init_get_glyph_outline_w; |
| @@ -183,45 +185,7 @@ typedef BOOL (WINAPI * GetCharWidth32W_Proc) ( | |||
| 183 | static HMODULE | 185 | static HMODULE |
| 184 | w32_load_unicows_or_gdi32 (void) | 186 | w32_load_unicows_or_gdi32 (void) |
| 185 | { | 187 | { |
| 186 | static BOOL is_9x = 0; | 188 | return maybe_load_unicows_dll (); |
| 187 | OSVERSIONINFO os_ver; | ||
| 188 | HMODULE ret; | ||
| 189 | if (g_b_init_is_w9x == 0) | ||
| 190 | { | ||
| 191 | g_b_init_is_w9x = 1; | ||
| 192 | ZeroMemory (&os_ver, sizeof (OSVERSIONINFO)); | ||
| 193 | os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); | ||
| 194 | if (GetVersionEx (&os_ver)) | ||
| 195 | is_9x = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); | ||
| 196 | } | ||
| 197 | if (is_9x) | ||
| 198 | { | ||
| 199 | ret = LoadLibrary ("Unicows.dll"); | ||
| 200 | if (!ret) | ||
| 201 | { | ||
| 202 | int button; | ||
| 203 | |||
| 204 | button = MessageBox (NULL, | ||
| 205 | "Emacs cannot load the UNICOWS.DLL library.\n" | ||
| 206 | "This library is essential for using Emacs\n" | ||
| 207 | "on this system. You need to install it.\n\n" | ||
| 208 | "However, you can still use Emacs by invoking\n" | ||
| 209 | "it with the '-nw' command-line option.\n\n" | ||
| 210 | "Emacs will exit when you click OK.", | ||
| 211 | "Emacs cannot load UNICOWS.DLL", | ||
| 212 | MB_ICONERROR | MB_TASKMODAL | ||
| 213 | | MB_SETFOREGROUND | MB_OK); | ||
| 214 | switch (button) | ||
| 215 | { | ||
| 216 | case IDOK: | ||
| 217 | default: | ||
| 218 | exit (1); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } | ||
| 222 | else | ||
| 223 | ret = LoadLibrary ("Gdi32.dll"); | ||
| 224 | return ret; | ||
| 225 | } | 189 | } |
| 226 | 190 | ||
| 227 | /* The following 3 functions call the problematic "wide" APIs via | 191 | /* The following 3 functions call the problematic "wide" APIs via |
| @@ -2753,7 +2717,6 @@ versions of Windows) characters. */); | |||
| 2753 | void | 2717 | void |
| 2754 | globals_of_w32font (void) | 2718 | globals_of_w32font (void) |
| 2755 | { | 2719 | { |
| 2756 | g_b_init_is_w9x = 0; | ||
| 2757 | g_b_init_get_outline_metrics_w = 0; | 2720 | g_b_init_get_outline_metrics_w = 0; |
| 2758 | g_b_init_get_text_metrics_w = 0; | 2721 | g_b_init_get_text_metrics_w = 0; |
| 2759 | g_b_init_get_glyph_outline_w = 0; | 2722 | g_b_init_get_glyph_outline_w = 0; |