aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-11-04 23:59:16 +0200
committerEli Zaretskii2011-11-04 23:59:16 +0200
commitfc5f9b45f6f90e798a454c7b768e8d02c9cb61c2 (patch)
treed12d7b3addc2ded52173f92f30badb319e119e91
parenta58c13ed78ff7fff3e77348c98ecc0d987eda52c (diff)
downloademacs-fc5f9b45f6f90e798a454c7b768e8d02c9cb61c2.tar.gz
emacs-fc5f9b45f6f90e798a454c7b768e8d02c9cb61c2.zip
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.
-rw-r--r--nt/ChangeLog8
-rw-r--r--nt/runemacs.c44
2 files changed, 52 insertions, 0 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 64b9577e362..55535c460fe 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,11 @@
12011-11-04 Eli Zaretskii <eliz@gnu.org>
2
3 * runemacs.c (ensure_unicows_dll): New function, tries to load
4 UNICOWS.DLL on Windows 9X.
5 (WinMain): If ensure_unicows_dll fails to find UNICOWS.DLL,
6 display a dialog to the effect that Emacs cannot be started.
7 (Bug#8562)
8
12011-10-28 Eli Zaretskii <eliz@gnu.org> 92011-10-28 Eli Zaretskii <eliz@gnu.org>
2 10
3 * README.W32: Mention UNICOWS.DLL as prerequisite for running 11 * README.W32: Mention UNICOWS.DLL as prerequisite for running
diff --git a/nt/runemacs.c b/nt/runemacs.c
index 07e24f745f8..47b8f54bb02 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -45,6 +45,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include <malloc.h> 45#include <malloc.h>
46 46
47static void set_user_model_id (void); 47static void set_user_model_id (void);
48static int ensure_unicows_dll (void);
48 49
49int WINAPI 50int WINAPI
50WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 51WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
@@ -59,6 +60,9 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
59 char *p; 60 char *p;
60 char modname[MAX_PATH]; 61 char modname[MAX_PATH];
61 62
63 if (!ensure_unicows_dll ())
64 goto error;
65
62 set_user_model_id (); 66 set_user_model_id ();
63 67
64 if (!GetModuleFileName (NULL, modname, MAX_PATH)) 68 if (!GetModuleFileName (NULL, modname, MAX_PATH))
@@ -203,3 +207,43 @@ set_user_model_id (void)
203 } 207 }
204} 208}
205 209
210static int
211ensure_unicows_dll (void)
212{
213 OSVERSIONINFO os_ver;
214 HMODULE h;
215
216 ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
217 os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
218 if (!GetVersionEx (&os_ver))
219 return 0;
220
221 if (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
222 {
223 h = LoadLibrary ("Unicows.dll");
224 if (!h)
225 {
226 int button;
227
228 button = MessageBox (NULL,
229 "Emacs cannot load the UNICOWS.DLL library.\n"
230 "This library is essential for using Emacs\n"
231 "on this system. You need to install it.\n\n"
232 "However, you can still use Emacs by invoking\n"
233 "it with the '-nw' command-line option.\n\n"
234 "Emacs will exit when you click OK.",
235 "Emacs cannot load UNICOWS.DLL",
236 MB_ICONERROR | MB_TASKMODAL
237 | MB_SETFOREGROUND | MB_OK);
238 switch (button)
239 {
240 case IDOK:
241 default:
242 return 0;
243 }
244 }
245 FreeLibrary (h);
246 return 1;
247 }
248 return 1;
249}