aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2008-02-11 15:36:20 +0000
committerJason Rumney2008-02-11 15:36:20 +0000
commitf1cefe09d6df020ae8514956ddd75035c469ea7e (patch)
tree85dd3e6ee9094cb8902f21f8f24fc79be6e636d3
parentbc92622e5d4a15f7aa3a20054df170b751be99ad (diff)
downloademacs-f1cefe09d6df020ae8514956ddd75035c469ea7e.tar.gz
emacs-f1cefe09d6df020ae8514956ddd75035c469ea7e.zip
(add_registry): Add an App Paths registry key.
Look for GTK and add it to the DLL search path for Emacs if found.
-rw-r--r--nt/ChangeLog5
-rw-r--r--nt/addpm.c54
2 files changed, 59 insertions, 0 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index cc5ecd34878..9ed90a97eec 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,8 @@
12008-02-11 Jason Rumney <jasonr@gnu.org>
2
3 * addpm.c (add_registry): Add an App Paths registry key.
4 Look for GTK and add it to the DLL search path for Emacs if found.
5
12008-02-05 Juanma Barranquero <lekktu@gmail.com> 62008-02-05 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * configure.bat: In help, use generic names for the image libraries. 8 * configure.bat: In help, use generic names for the image libraries.
diff --git a/nt/addpm.c b/nt/addpm.c
index 270ef6d15a7..297fc4c5e81 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -46,6 +46,9 @@ DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
46 CF_TEXT, XTYP_EXECUTE, 30000, NULL) 46 CF_TEXT, XTYP_EXECUTE, 30000, NULL)
47 47
48#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 48#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
49#define REG_GTK "SOFTWARE\\GTK\\2.0"
50#define REG_APP_PATH \
51 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\emacs.exe"
49 52
50static struct entry 53static struct entry
51{ 54{
@@ -73,6 +76,57 @@ add_registry (path)
73 HKEY hrootkey = NULL; 76 HKEY hrootkey = NULL;
74 int i; 77 int i;
75 BOOL ok = TRUE; 78 BOOL ok = TRUE;
79 DWORD size;
80
81 /* Record the location of Emacs to the App Paths key if we have
82 sufficient permissions to do so. This helps Windows find emacs quickly
83 if the user types emacs.exe in the "Run Program" dialog without having
84 emacs on their path. Some applications also use the same registry key
85 to discover the installation directory for programs they are looking for.
86 Multiple installations cannot be handled by this method, but it does not
87 affect the general operation of other installations of Emacs, and we
88 are blindly overwriting the Start Menu entries already.
89 */
90 if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, REG_APP_PATH, 0, "",
91 REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
92 &hrootkey, NULL) == ERROR_SUCCESS)
93 {
94 int len;
95 char *emacs_path;
96 HKEY gtk_key = NULL;
97
98 len = strlen (path) + 15; /* \bin\emacs.exe + terminator. */
99 emacs_path = alloca (len);
100 sprintf (emacs_path, "%s\\bin\\emacs.exe", path);
101
102 RegSetValueEx (hrootkey, NULL, 0, REG_SZ, emacs_path, len);
103
104 /* Look for a GTK installation. If found, add it to the library search
105 path for Emacs so that the image libraries it provides are available
106 to Emacs regardless of whether it is in the path or not. */
107 if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, REG_GTK, REG_OPTION_NON_VOLATILE,
108 KEY_READ, &gtk_key) == ERROR_SUCCESS)
109 {
110 if (RegQueryValueEx (gtk_key, "DllPath", NULL, NULL,
111 NULL, &size) == ERROR_SUCCESS)
112 {
113 char *gtk_path = (char *) alloca (size);
114 if (RegQueryValueEx (gtk_key, "DllPath", NULL, NULL,
115 gtk_path, &size) == ERROR_SUCCESS)
116 {
117 /* Make sure the emacs bin directory continues to be searched
118 first by including it as well. */
119 char *dll_paths;
120 len = strlen (path) + 5 + size;
121 dll_paths = (char *) alloca (size + strlen (path) + 1);
122 sprintf (dll_paths, "%s\\bin;%s", path, gtk_path);
123 RegSetValueEx (hrootkey, "Path", 0, REG_SZ, dll_paths, len);
124 }
125 }
126 RegCloseKey (gtk_key);
127 }
128 RegCloseKey (hrootkey);
129 }
76 130
77 /* Previous versions relied on registry settings, but we do not need 131 /* Previous versions relied on registry settings, but we do not need
78 them any more. If registry settings are installed from a previous 132 them any more. If registry settings are installed from a previous