bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8562: Emacs 23.1 and later don't work in windows 98


From: Eli Zaretskii
Subject: bug#8562: Emacs 23.1 and later don't work in windows 98
Date: Fri, 04 Nov 2011 13:42:11 +0200

> Date: Sun, 30 Oct 2011 00:24:31 +0200
> From: oslsachem <address@hidden>
> Cc: address@hidden
> 
> - I have commented out the message box code (w32font.c:197) and
> replaced it with just 'exit(1)':
> After this change, runemacs.exe launches emacs.exe and now this
> process ends instead of staying in the background.
> 
> - I have changed the value of start.wShowWindow to SW_SHOW (runemacs.c:148):
> After this change, the unicows.dll error dialog window is shown (with
> a console window behind it, which actually defeats the purpose of
> runemacs.exe to begin with)
> 
> 
> >From this I guess that:
> - the messagebox is actually hidden even though it is waiting for
> input from the user.
> - the visibility of the messagebox is linked to the visibility of the
> console window created for the process from which it is called ( Even
> though this behaviour can't be reproduced in windows XP)

Maybe.  But since we are in a pretest, I opted for a safer solution:
add a similar test to runemacs.  The patch is below; please try
applying it to the current trunk of Emacs 24.  If it works, I will
commit it.

Thanks.

=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2011-11-04 11:36:25 +0000
+++ b/nt/ChangeLog      2011-11-04 11:41:29 +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-11-04 11:36:25 +0000
+++ b/nt/runemacs.c     2011-11-04 11:41:29 +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]