annotate netinstall/regedit.cc @ 450:98528da0b7fc r21-2-40

Import from CVS: tag r21-2-40
author cvs
date Mon, 13 Aug 2007 11:39:20 +0200
parents 3078fd1074e8
children 3d3049ae1304
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
1 /*
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
2 * Copyright (c) 2000, Red Hat, Inc.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
3 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
7 * (at your option) any later version.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
8 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
9 * A copy of the GNU General Public License can be found at
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
10 * http://www.gnu.org/
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
11 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
12 * Written by DJ Delorie <dj@cygnus.com>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
13 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
14 */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
15
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
16 /* Manipulate the registry for XEmacs. */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
17
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
18 #include "win32.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
19
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
20 #include <stdio.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
21 #if defined(CYGWIN) || defined(MINGW)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
22 #include <cygwin/version.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
23 #include <sys/mount.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
24 #endif
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
25
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
26 #include "reginfo.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
27 #include "regedit.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
28 #include "msg.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
29 #include "resource.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
30 #include "dialog.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
31
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
32 static char *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
33 find_cygwin_mount (HKEY rkey, int *istext)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
34 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
35 char buf[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
36 char *retval = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
37 HKEY key;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
38 DWORD retvallen = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 DWORD flags = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
40 DWORD type;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
41
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
42 #if defined(CYGWIN) || defined(MINGW)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
43 sprintf (buf, "Software\\%s\\%s\\%s\\/",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
45 CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
46 CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
47
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
48 if (RegOpenKeyEx (rkey, buf, 0, KEY_READ, &key) != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
49 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 if (RegQueryValueEx (key, "native", 0, &type, 0, &retvallen)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52 == ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
53 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
54 retval = new char[retvallen+1];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 if (RegQueryValueEx (key, "native", 0, &type, (BYTE *)retval, &retvallen)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56 != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58 delete retval;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59 retval = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 retvallen = sizeof (flags);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64 RegQueryValueEx (key, "flags", 0, &type, (BYTE *)&flags, &retvallen);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66 RegCloseKey (key);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
68 if (retval)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
69 *istext = (flags & MOUNT_BINARY) ? 0 : 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
70 return retval;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
71 #else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
72 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
73 #endif
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
76 static char *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
77 find_xemacs_root (HKEY rkey, int* isnative)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
78 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
79 char buf[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
80 char *retval = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
81 HKEY key;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
82 DWORD retvallen = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
83 DWORD type;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
84 DWORD itype;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
85
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
86 sprintf (buf, "Software\\%s\\%s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
87 XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
88 XEMACS_INFO_XEMACS_REGISTRY_NAME);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
89
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
90 if (RegOpenKeyEx (rkey, buf, 0, KEY_READ, &key) != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
91 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
92
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
93 if (RegQueryValueEx (key, XEMACS_INFO_XEMACS_ROOT_KEY,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
94 0, &type, 0, &retvallen) == ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
95 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
96 retval = new char[retvallen+1];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
97 if (RegQueryValueEx (key, XEMACS_INFO_XEMACS_ROOT_KEY,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
98 0, &type, (BYTE *)retval, &retvallen)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
99 != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
100 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
101 delete retval;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
102 retval = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
103 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
104 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
105
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
106 retvallen = sizeof (itype);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
107 RegQueryValueEx (key, XEMACS_INFO_XEMACS_ROOT_TYPE,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
108 0, &type, (BYTE *)&itype, &retvallen);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
109
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
110 if (itype == 1)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
111 *isnative = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
112 else
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
113 *isnative = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
114
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
115 RegCloseKey (key);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
116
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
117 return retval;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
118 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
119
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
120 char *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
121 find_root_location (int *issystem, int *isnative)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
122 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
123 char *rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
124 if ((rv = find_xemacs_root (HKEY_CURRENT_USER, isnative)))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
125 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
126 *issystem = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
127 return rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
128 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
129 else if ((rv = find_xemacs_root (HKEY_LOCAL_MACHINE, isnative)))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
130 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
131 *issystem = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
132 return rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
133 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
134 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
135 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
136
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
137 char *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
138 find_cygwin_root (int *issystem)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
139 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
140 char *rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
141 int istext;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
142 if ((rv = find_cygwin_mount (HKEY_CURRENT_USER, &istext)))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
143 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
144 *issystem = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
145 return rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
146 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
147 else if ((rv = find_cygwin_mount (HKEY_LOCAL_MACHINE, &istext)))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
148 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
149 *issystem = 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
150 return rv;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
151 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
152 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
153 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
154
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
155 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
156 create_xemacs_root (char *path, int issystem, int isnative)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
157 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
158 char buf[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
159 HKEY key;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
160 DWORD disposition;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
161 DWORD itype = isnative ? 1 : 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
162
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
163 remove_xemacs_root ();
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
164
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
165 sprintf (buf, "Software\\%s\\%s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
166 XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
167 XEMACS_INFO_XEMACS_REGISTRY_NAME);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
168
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
169 HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
170 if (RegCreateKeyEx (kr, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
171 0, &key, &disposition) != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
172 fatal ("create_xemacs_root");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
173
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
174 RegSetValueEx (key, XEMACS_INFO_XEMACS_ROOT_KEY,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
175 0, REG_SZ, (BYTE *)path, strlen (path)+1);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
176 RegSetValueEx (key, XEMACS_INFO_XEMACS_ROOT_TYPE,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
177 0, REG_DWORD, (BYTE *)&itype, sizeof (itype));
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
178 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
179
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
180 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
181 set_app_path (char *exe, char* path, int issystem)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
182 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
183 char buf[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
184 HKEY key;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
185 DWORD disposition;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
186
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
187 sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
188 exe);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
189
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
190 HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
191 RegDeleteKey (kr, buf);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
192
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
193 if (RegCreateKeyEx (kr, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
194 0, &key, &disposition) != ERROR_SUCCESS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
195 fatal ("set_app_path");
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
196
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
197 RegSetValueEx (key, "Path",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
198 0, REG_SZ, (BYTE *)path, strlen (path)+1);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
199 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
200
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
201 static void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
202 remove1 (HKEY rkey)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
203 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
204 char buf[1000];
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
205
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
206 sprintf (buf, "Software\\%s\\%s",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
207 XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME,
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
208 XEMACS_INFO_XEMACS_REGISTRY_NAME);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
209
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
210 RegDeleteKey (rkey, buf);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
211 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
212
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
213 void
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
214 remove_xemacs_root ()
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
215 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
216 remove1 (HKEY_LOCAL_MACHINE);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
217 remove1 (HKEY_CURRENT_USER);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
218 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
219