emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116064: Fix file name handling on MS-Windows 9X.


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r116064: Fix file name handling on MS-Windows 9X.
Date: Sat, 18 Jan 2014 11:47:21 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116064
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-01-18 13:46:22 +0200
message:
  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 <address@hidden>.
   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.
modified:
  nt/ChangeLog                   changelog-20091113204419-o5vbwnq5f7feedwu-1545
  nt/runemacs.c                  runemacs.c-20091113204419-o5vbwnq5f7feedwu-980
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/emacs.c                    emacs.c-20091113204419-o5vbwnq5f7feedwu-241
  src/w32.c                      w32.c-20091113204419-o5vbwnq5f7feedwu-808
  src/w32.h                      w32.h-20091113204419-o5vbwnq5f7feedwu-809
  src/w32font.c                  w32font.c-20091113204419-o5vbwnq5f7feedwu-8545
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2014-01-16 08:34:43 +0000
+++ b/nt/ChangeLog      2014-01-18 11:46:22 +0000
@@ -1,3 +1,9 @@
+2014-01-18  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * inc/sys/stat.h (_WSTAT_DEFINED): Define, to avoid compilation

=== modified file 'nt/runemacs.c'
--- a/nt/runemacs.c     2014-01-01 07:43:34 +0000
+++ b/nt/runemacs.c     2014-01-18 11:46:22 +0000
@@ -234,8 +234,6 @@
                               "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

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-18 01:51:38 +0000
+++ b/src/ChangeLog     2014-01-18 11:46:22 +0000
@@ -1,3 +1,20 @@
+2014-01-18  Eli Zaretskii  <address@hidden>
+
+       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 <address@hidden>.
+
+       * 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  <address@hidden>
 
        * menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2014-01-01 07:43:34 +0000
+++ b/src/emacs.c       2014-01-18 11:46:22 +0000
@@ -749,6 +749,12 @@
      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

=== modified file 'src/w32.c'
--- a/src/w32.c 2014-01-01 07:43:34 +0000
+++ b/src/w32.c 2014-01-18 11:46:22 +0000
@@ -8923,6 +8923,40 @@
   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

=== modified file 'src/w32.h'
--- a/src/w32.h 2014-01-01 07:43:34 +0000
+++ b/src/w32.h 2014-01-18 11:46:22 +0000
@@ -163,6 +163,7 @@
 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);

=== modified file 'src/w32font.c'
--- a/src/w32font.c     2014-01-01 07:43:34 +0000
+++ b/src/w32font.c     2014-01-18 11:46:22 +0000
@@ -33,6 +33,9 @@
 #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 @@
    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 @@
 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 @@
 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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]