emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106286: Last part of fix for bug #85


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106286: Last part of fix for bug #8562 with Emacs on Windows 9X.
Date: Fri, 04 Nov 2011 23:59:16 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106286
fixes bug(s): http://debbugs.gnu.org/8562
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2011-11-04 23:59:16 +0200
message:
  Last part of fix for bug #8562 with Emacs on Windows 9X.
  
   nt/runemacs.c (ensure_unicows_dll): New function, tries to load
   UNICOWS.DLL on Windows 9X.
   (WinMain): If ensure_unicows_dll fails to find UNICOWS.DLL,
   display a dialog to the effect that Emacs cannot be started.
modified:
  nt/ChangeLog
  nt/runemacs.c
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2011-10-28 15:03:13 +0000
+++ b/nt/ChangeLog      2011-11-04 21:59:16 +0000
@@ -1,3 +1,11 @@
+2011-11-04  Eli Zaretskii  <address@hidden>
+
+       * runemacs.c (ensure_unicows_dll): New function, tries to load
+       UNICOWS.DLL on Windows 9X.
+       (WinMain): If ensure_unicows_dll fails to find UNICOWS.DLL,
+       display a dialog to the effect that Emacs cannot be started.
+       (Bug#8562)
+
 2011-10-28  Eli Zaretskii  <address@hidden>
 
        * README.W32: Mention UNICOWS.DLL as prerequisite for running

=== modified file 'nt/runemacs.c'
--- a/nt/runemacs.c     2011-01-26 08:36:39 +0000
+++ b/nt/runemacs.c     2011-11-04 21:59:16 +0000
@@ -45,6 +45,7 @@
 #include <malloc.h>
 
 static void set_user_model_id (void);
+static int ensure_unicows_dll (void);
 
 int WINAPI
 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
@@ -59,6 +60,9 @@
   char *p;
   char modname[MAX_PATH];
 
+  if (!ensure_unicows_dll ())
+    goto error;
+
   set_user_model_id ();
 
   if (!GetModuleFileName (NULL, modname, MAX_PATH))
@@ -203,3 +207,43 @@
     }
 }
 
+static int
+ensure_unicows_dll (void)
+{
+  OSVERSIONINFO os_ver;
+  HMODULE h;
+
+  ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
+  os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+  if (!GetVersionEx (&os_ver))
+    return 0;
+
+  if (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+    {
+      h = LoadLibrary ("Unicows.dll");
+      if (!h)
+       {
+         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:
+               return 0;
+           }
+       }
+      FreeLibrary (h);
+      return 1;
+    }
+  return 1;
+}


reply via email to

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