comparison netinstall/regedit.cc @ 657:ce0b3f2eff35

[xemacs-hg @ 2001-09-09 04:37:41 by andyp] DDE, netinstall and cygwin file fixes
author andyp
date Sun, 09 Sep 2001 04:37:48 +0000
parents 3d3049ae1304
children 146d342ff859
comparison
equal deleted inserted replaced
656:4035041996d8 657:ce0b3f2eff35
178 // write out the package path 178 // write out the package path
179 sprintf (buf, "~\\.xemacs;%s\\site-packages;%s\\xemacs-packages", 179 sprintf (buf, "~\\.xemacs;%s\\site-packages;%s\\xemacs-packages",
180 path, path); 180 path, path);
181 RegSetValueEx (key, XEMACS_INFO_XEMACS_PACKAGE_KEY, 181 RegSetValueEx (key, XEMACS_INFO_XEMACS_PACKAGE_KEY,
182 0, REG_SZ, (BYTE *)buf, strlen (buf)+1); 182 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
183 RegCloseKey (key);
183 } 184 }
184 185
185 void 186 void
186 set_app_path (char *exe, char* path, int issystem) 187 set_app_path (char *exe, char* path, int issystem)
187 { 188 {
199 0, &key, &disposition) != ERROR_SUCCESS) 200 0, &key, &disposition) != ERROR_SUCCESS)
200 fatal ("set_app_path"); 201 fatal ("set_app_path");
201 202
202 RegSetValueEx (key, "Path", 203 RegSetValueEx (key, "Path",
203 0, REG_SZ, (BYTE *)path, strlen (path)+1); 204 0, REG_SZ, (BYTE *)path, strlen (path)+1);
205 RegCloseKey (key);
206 }
207
208 void
209 set_install_path (char* path, int issystem)
210 {
211 char buf[1000];
212 HKEY key;
213 DWORD disposition;
214
215 sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs");
216
217 HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
218 RegDeleteKey (kr, buf);
219
220 if (RegCreateKeyEx (kr, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
221 0, &key, &disposition) != ERROR_SUCCESS)
222 fatal ("set_install_path");
223
224 RegSetValueEx (key, "DisplayName",
225 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1);
226
227 sprintf (buf, "%s\\setup.exe -u", path);
228 RegSetValueEx (key, "UninstallString",
229 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
230 RegCloseKey (key);
231 }
232
233 void
234 setup_explorer (char* file_type, char* name, char *exe)
235 {
236 char buf[1000];
237 char ftype[32];
238 HKEY key;
239 DWORD disposition;
240
241 sprintf (buf, ".%s", file_type);
242 RegDeleteKey (HKEY_CLASSES_ROOT, buf);
243
244 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
245 0, &key, &disposition) != ERROR_SUCCESS)
246 fatal ("setup_explorer");
247
248 // set default key
249 sprintf (ftype, "%sfile", file_type);
250 RegSetValueEx (key, NULL,
251 0, REG_SZ, (BYTE *)ftype, strlen (ftype)+1);
252 RegCloseKey (key);
253
254 // create file type entry
255 RegDeleteKey (HKEY_CLASSES_ROOT, ftype);
256 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, ftype, 0, "XEmacs",
257 0, KEY_ALL_ACCESS,
258 0, &key, &disposition) != ERROR_SUCCESS)
259 fatal ("setup_explorer");
260 RegSetValueEx (key, NULL,
261 0, REG_SZ, (BYTE *)name, strlen (name)+1);
262 RegSetValueEx (key, "AlwaysShowExt",
263 0, REG_SZ, (BYTE *)"", strlen ("")+1);
264 RegCloseKey (key);
265
266 // make xemacs file the default icon
267 sprintf(buf, "%s\\DefaultIcon", ftype);
268 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
269 0, &key, &disposition) != ERROR_SUCCESS)
270 fatal ("setup_explorer");
271
272 sprintf(buf, "%s,1", exe);
273 RegSetValueEx (key, NULL,
274 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
275 RegCloseKey (key);
276
277 // command default key (exe)
278 sprintf(buf, "%s\\shell\\Open\\command", ftype);
279 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
280 0, &key, &disposition) != ERROR_SUCCESS)
281 fatal ("setup_explorer");
282
283 sprintf(buf, "\"%s\"", exe); // Don't need %1 because dde will open the file
284 RegSetValueEx (key, NULL,
285 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
286 RegCloseKey (key);
287
288 // ddeexec
289 sprintf(buf, "%s\\shell\\Open\\ddeexec", ftype);
290 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
291 0, &key, &disposition) != ERROR_SUCCESS)
292 fatal ("setup_explorer");
293
294 #define DDE_OPEN "Open(\"%1\")"
295 RegSetValueEx (key, NULL,
296 0, REG_SZ, (BYTE *)DDE_OPEN, strlen (DDE_OPEN)+1);
297 RegCloseKey (key);
298
299 // ddeexec application
300 sprintf(buf, "%s\\shell\\Open\\ddeexec\\application", ftype);
301 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
302 0, &key, &disposition) != ERROR_SUCCESS)
303 fatal ("setup_explorer");
304 RegSetValueEx (key, NULL,
305 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1);
306 RegCloseKey (key);
307
308 // ddeexec topic
309 sprintf(buf, "%s\\shell\\Open\\ddeexec\\topic", ftype);
310 if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
311 0, &key, &disposition) != ERROR_SUCCESS)
312 fatal ("setup_explorer");
313 RegSetValueEx (key, NULL,
314 0, REG_SZ, (BYTE *)"system", strlen ("system")+1);
315 RegCloseKey (key);
204 } 316 }
205 317
206 static void 318 static void
207 remove1 (HKEY rkey) 319 remove1 (HKEY rkey)
208 { 320 {
220 { 332 {
221 remove1 (HKEY_LOCAL_MACHINE); 333 remove1 (HKEY_LOCAL_MACHINE);
222 remove1 (HKEY_CURRENT_USER); 334 remove1 (HKEY_CURRENT_USER);
223 } 335 }
224 336
337 void
338 remove_app_path (char *exe, int issystem)
339 {
340 char buf[1000];
341 sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s",
342 exe);
343
344 HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
345 RegDeleteKey (kr, buf);
346 }
347
348 void
349 remove_uninstall_path ()
350 {
351 char buf[1000];
352 sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs");
353
354 RegDeleteKey (HKEY_LOCAL_MACHINE, buf);
355 RegDeleteKey (HKEY_CURRENT_USER, buf);
356 }