| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
#include "win32.h" |
|---|
| 23 |
#include <shlobj.h> |
|---|
| 24 |
|
|---|
| 25 |
#include <io.h> |
|---|
| 26 |
#include <stdio.h> |
|---|
| 27 |
#include <stdlib.h> |
|---|
| 28 |
#ifndef WIN32_NATIVE |
|---|
| 29 |
#include <unistd.h> |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
#include "resource.h" |
|---|
| 33 |
#include "ini.h" |
|---|
| 34 |
#include "msg.h" |
|---|
| 35 |
#include "state.h" |
|---|
| 36 |
#include "concat.h" |
|---|
| 37 |
#include "mkdir.h" |
|---|
| 38 |
#include "dialog.h" |
|---|
| 39 |
#include "version.h" |
|---|
| 40 |
#include "reginfo.h" |
|---|
| 41 |
#include "regedit.h" |
|---|
| 42 |
#include "port.h" |
|---|
| 43 |
#include "log.h" |
|---|
| 44 |
#include "desktop.h" |
|---|
| 45 |
|
|---|
| 46 |
extern "C" { |
|---|
| 47 |
void make_link_2 (char *exepath, char *args, char *icon, char *lname); |
|---|
| 48 |
}; |
|---|
| 49 |
|
|---|
| 50 |
static OSVERSIONINFO verinfo; |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
#define COMMAND9XARGS "/E:4096 /c" |
|---|
| 61 |
#define COMMAND9XEXE "\\command.com" |
|---|
| 62 |
|
|---|
| 63 |
static char *iconname; |
|---|
| 64 |
static char *batname; |
|---|
| 65 |
static char *uninstname; |
|---|
| 66 |
|
|---|
| 67 |
static void |
|---|
| 68 |
make_link (char *linkpath, char *title, char *target, char* args) |
|---|
| 69 |
{ |
|---|
| 70 |
#if 0 |
|---|
| 71 |
char argbuf[_MAX_PATH]; |
|---|
| 72 |
#endif |
|---|
| 73 |
char *fname = concat (linkpath, "/", title, ".lnk", 0); |
|---|
| 74 |
|
|---|
| 75 |
if (_access (fname, 0) == 0) |
|---|
| 76 |
return; |
|---|
| 77 |
|
|---|
| 78 |
msg ("make_link %s, %s, %s, %s\n", fname, title, target, args); |
|---|
| 79 |
|
|---|
| 80 |
mkdir_p (0, fname); |
|---|
| 81 |
|
|---|
| 82 |
char *exepath; |
|---|
| 83 |
#if 0 |
|---|
| 84 |
|
|---|
| 85 |
if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) |
|---|
| 86 |
{ |
|---|
| 87 |
#endif |
|---|
| 88 |
exepath = target; |
|---|
| 89 |
#if 0 |
|---|
| 90 |
} |
|---|
| 91 |
else |
|---|
| 92 |
{ |
|---|
| 93 |
char windir[MAX_PATH]; |
|---|
| 94 |
|
|---|
| 95 |
GetWindowsDirectory (windir, sizeof (windir)); |
|---|
| 96 |
exepath = concat (windir, COMMAND9XEXE, 0); |
|---|
| 97 |
sprintf (argbuf, "%s %s", COMMAND9XARGS, target); |
|---|
| 98 |
args = argbuf; |
|---|
| 99 |
} |
|---|
| 100 |
#endif |
|---|
| 101 |
msg ("make_link_2 (%s, %s, %s, %s)", exepath, args, iconname, fname); |
|---|
| 102 |
make_link_2 (backslash (exepath), args, iconname, fname); |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
static char* |
|---|
| 106 |
find_xemacs_version () |
|---|
| 107 |
{ |
|---|
| 108 |
char* v = strdup (xemacs_package->info[xemacs_package->trust].version); |
|---|
| 109 |
char* dash = strrchr (v, '-'); |
|---|
| 110 |
if (dash) |
|---|
| 111 |
*dash = 0; |
|---|
| 112 |
return v; |
|---|
| 113 |
} |
|---|
| 114 |
|
|---|
| 115 |
static char* |
|---|
| 116 |
find_xemacs_exe_path () |
|---|
| 117 |
{ |
|---|
| 118 |
if (xemacs_package->type == TY_CYGWIN) |
|---|
| 119 |
return backslash (concat (root_dir, "/bin/", XEMACS_CYGWIN_ARCH_NAME, 0)); |
|---|
| 120 |
else |
|---|
| 121 |
return backslash (concat (root_dir, "\\XEmacs-", |
|---|
| 122 |
find_xemacs_version (), |
|---|
| 123 |
"\\", XEMACS_NATIVE_ARCH_NAME, 0)); |
|---|
| 124 |
} |
|---|
| 125 |
|
|---|
| 126 |
char* |
|---|
| 127 |
find_xemacs_exe_name () |
|---|
| 128 |
{ |
|---|
| 129 |
|
|---|
| 130 |
if (strncmp (xemacs_package->info[xemacs_package->trust].version, |
|---|
| 131 |
"21.1", 4) == 0) |
|---|
| 132 |
return strdup ("runemacs.exe"); |
|---|
| 133 |
else if (xemacs_package->type == TY_CYGWIN) |
|---|
| 134 |
return backslash (concat ("xemacs-", |
|---|
| 135 |
find_xemacs_version (), |
|---|
| 136 |
".exe", 0)); |
|---|
| 137 |
else |
|---|
| 138 |
return strdup ("xemacs.exe"); |
|---|
| 139 |
} |
|---|
| 140 |
|
|---|
| 141 |
static void |
|---|
| 142 |
remove_link (char *linkpath, char* title) |
|---|
| 143 |
{ |
|---|
| 144 |
if (title) |
|---|
| 145 |
{ |
|---|
| 146 |
char *fname = backslash (concat (linkpath, "/", title, ".lnk", 0)); |
|---|
| 147 |
msg ("remove_link %s, %s\n", fname, title); |
|---|
| 148 |
if (_access (fname, 0) != 0) |
|---|
| 149 |
return; |
|---|
| 150 |
_unlink (fname); |
|---|
| 151 |
} |
|---|
| 152 |
else |
|---|
| 153 |
{ |
|---|
| 154 |
msg ("remove_link %s\n", linkpath); |
|---|
| 155 |
if (_access (linkpath, 0) != 0) |
|---|
| 156 |
return; |
|---|
| 157 |
_rmdir (linkpath); |
|---|
| 158 |
} |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
static void |
|---|
| 162 |
start_menu (char *title, char *target, int rem, char* args) |
|---|
| 163 |
{ |
|---|
| 164 |
char path[_MAX_PATH]; |
|---|
| 165 |
LPITEMIDLIST id; |
|---|
| 166 |
int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
|---|
| 167 |
SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); |
|---|
| 168 |
SHGetPathFromIDList (id, path); |
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
msg("Program directory for program link: %s",path); |
|---|
| 172 |
if ( strlen(path) == 0) { |
|---|
| 173 |
SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); |
|---|
| 174 |
SHGetPathFromIDList (id, path); |
|---|
| 175 |
msg("Program directory for program link changed to: %s",path); |
|---|
| 176 |
} |
|---|
| 177 |
|
|---|
| 178 |
strcat (path, "\\"); |
|---|
| 179 |
strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); |
|---|
| 180 |
if (rem == 0) |
|---|
| 181 |
make_link (path, title, target, args); |
|---|
| 182 |
else |
|---|
| 183 |
remove_link (path, title); |
|---|
| 184 |
} |
|---|
| 185 |
|
|---|
| 186 |
static void |
|---|
| 187 |
desktop_icon (char *title, char *target, int rem) |
|---|
| 188 |
{ |
|---|
| 189 |
char path[_MAX_PATH]; |
|---|
| 190 |
LPITEMIDLIST id; |
|---|
| 191 |
int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
|---|
| 192 |
|
|---|
| 193 |
SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_DESKTOPDIRECTORY : CSIDL_DESKTOPDIRECTORY, &id); |
|---|
| 194 |
SHGetPathFromIDList (id, path); |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
msg("Desktop directory for desktop link: %s",path); |
|---|
| 198 |
if ( strlen(path) == 0) { |
|---|
| 199 |
SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id); |
|---|
| 200 |
SHGetPathFromIDList (id, path); |
|---|
| 201 |
msg("Desktop directory for deskop link changed to: %s",path); |
|---|
| 202 |
} |
|---|
| 203 |
|
|---|
| 204 |
if (rem == 0) |
|---|
| 205 |
make_link (path, title, target, ""); |
|---|
| 206 |
else |
|---|
| 207 |
remove_link (path, title); |
|---|
| 208 |
} |
|---|
| 209 |
|
|---|
| 210 |
static void |
|---|
| 211 |
save_icon () |
|---|
| 212 |
{ |
|---|
| 213 |
iconname = backslash (concat (root_dir, XEMACS_RESOURCE_DIR, |
|---|
| 214 |
"meadow.ico", 0)); |
|---|
| 215 |
|
|---|
| 216 |
HRSRC rsrc = FindResource (NULL, "MEADOW.ICON", "FILE"); |
|---|
| 217 |
if (rsrc == NULL) |
|---|
| 218 |
{ |
|---|
| 219 |
fatal ("FindResource failed"); |
|---|
| 220 |
} |
|---|
| 221 |
HGLOBAL res = LoadResource (NULL, rsrc); |
|---|
| 222 |
char *data = (char *) LockResource (res); |
|---|
| 223 |
int len = SizeofResource (NULL, rsrc); |
|---|
| 224 |
|
|---|
| 225 |
FILE *f = fopen (iconname, "wb"); |
|---|
| 226 |
if (f) |
|---|
| 227 |
{ |
|---|
| 228 |
fwrite (data, 1, len, f); |
|---|
| 229 |
fclose (f); |
|---|
| 230 |
} |
|---|
| 231 |
} |
|---|
| 232 |
|
|---|
| 233 |
void |
|---|
| 234 |
remove_xemacs_setup() |
|---|
| 235 |
{ |
|---|
| 236 |
if (xemacs_package == 0) |
|---|
| 237 |
return; |
|---|
| 238 |
|
|---|
| 239 |
start_menu ("XEmacs", 0, 1, 0); |
|---|
| 240 |
desktop_icon ("XEmacs", 0, 1); |
|---|
| 241 |
|
|---|
| 242 |
#define FROB(exe) remove_app_path (exe) |
|---|
| 243 |
FROB (find_xemacs_exe_name ()); |
|---|
| 244 |
FROB ("runemacs.exe"); |
|---|
| 245 |
FROB ("xemacs.exe"); |
|---|
| 246 |
#undef FROB |
|---|
| 247 |
} |
|---|
| 248 |
|
|---|
| 249 |
void |
|---|
| 250 |
remove_desktop_setup() |
|---|
| 251 |
{ |
|---|
| 252 |
remove_xemacs_setup(); |
|---|
| 253 |
start_menu ("Uninstall XEmacs", 0, 1, 0); |
|---|
| 254 |
start_menu (0, 0, 1, 0); |
|---|
| 255 |
} |
|---|
| 256 |
|
|---|
| 257 |
#if 0 |
|---|
| 258 |
static void |
|---|
| 259 |
do_desktop_setup() |
|---|
| 260 |
{ |
|---|
| 261 |
save_icon (); |
|---|
| 262 |
|
|---|
| 263 |
if (root_menu && batname) { |
|---|
| 264 |
start_menu ("XEmacs", batname, 0, ""); |
|---|
| 265 |
start_menu ("Uninstall XEmacs", uninstname, 0, "-u"); |
|---|
| 266 |
} |
|---|
| 267 |
|
|---|
| 268 |
if (root_desktop && batname) { |
|---|
| 269 |
desktop_icon ("XEmacs", batname, 0); |
|---|
| 270 |
} |
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
if (xemacs_package != 0) |
|---|
| 274 |
{ |
|---|
| 275 |
int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0); |
|---|
| 276 |
if (xemacs_package->type == TY_NATIVE |
|---|
| 277 |
|| xemacs_package->type == TY_CYGWIN) |
|---|
| 278 |
{ |
|---|
| 279 |
if (xemacs_package->type == TY_NATIVE) |
|---|
| 280 |
{ |
|---|
| 281 |
#define FROB(exe) set_app_path ((exe), \ |
|---|
| 282 |
find_xemacs_exe_path (), \ |
|---|
| 283 |
issystem) |
|---|
| 284 |
FROB (find_xemacs_exe_name ()); |
|---|
| 285 |
FROB ("runemacs.exe"); |
|---|
| 286 |
FROB ("xemacs.exe"); |
|---|
| 287 |
#undef FROB |
|---|
| 288 |
} |
|---|
| 289 |
else if (xemacs_package->type == TY_CYGWIN) |
|---|
| 290 |
{ |
|---|
| 291 |
int junk; |
|---|
| 292 |
char* root = find_cygwin_root (&junk); |
|---|
| 293 |
#define FROB(exe) set_app_path ((exe), \ |
|---|
| 294 |
concat (find_xemacs_exe_path (), ";", \ |
|---|
| 295 |
root, "\\bin;", \ |
|---|
| 296 |
root, "\\usr\\bin", 0), \ |
|---|
| 297 |
issystem) |
|---|
| 298 |
FROB (find_xemacs_exe_name ()); |
|---|
| 299 |
FROB ("runemacs.exe"); |
|---|
| 300 |
FROB ("xemacs.exe"); |
|---|
| 301 |
#undef FROB |
|---|
| 302 |
} |
|---|
| 303 |
set_install_path (find_xemacs_exe_path(), issystem); |
|---|
| 304 |
} |
|---|
| 305 |
|
|---|
| 306 |
if (batname) |
|---|
| 307 |
{ |
|---|
| 308 |
if (reg_java) |
|---|
| 309 |
{ |
|---|
| 310 |
log (0, "Registering .java files"); |
|---|
| 311 |
setup_explorer ("java", "Java Source file", batname); |
|---|
| 312 |
setup_explorer ("jav", "Java Source file", batname); |
|---|
| 313 |
} |
|---|
| 314 |
if (reg_cpp) |
|---|
| 315 |
{ |
|---|
| 316 |
log (0, "Registering .cpp files"); |
|---|
| 317 |
setup_explorer ("cpp", "C++ Source file", batname); |
|---|
| 318 |
setup_explorer ("cc", "C++ Source file", batname); |
|---|
| 319 |
setup_explorer ("cxx", "C++ Source file", batname); |
|---|
| 320 |
setup_explorer ("hh", "C++ Header file", batname); |
|---|
| 321 |
setup_explorer ("hpp", "C++ Header file", batname); |
|---|
| 322 |
setup_explorer ("hxx", "C++ Header file", batname); |
|---|
| 323 |
} |
|---|
| 324 |
if (reg_c) |
|---|
| 325 |
{ |
|---|
| 326 |
log (0, "Registering .c files"); |
|---|
| 327 |
setup_explorer ("c", "C Source file", batname); |
|---|
| 328 |
setup_explorer ("h", "C Header file", batname); |
|---|
| 329 |
} |
|---|
| 330 |
if (reg_elisp) |
|---|
| 331 |
{ |
|---|
| 332 |
log (0, "Registering .el files"); |
|---|
| 333 |
setup_explorer ("el", "E-Lisp Source file", batname); |
|---|
| 334 |
} |
|---|
| 335 |
if (reg_txt) |
|---|
| 336 |
{ |
|---|
| 337 |
log (0, "Registering .txt files"); |
|---|
| 338 |
setup_explorer ("txt", "Text file", batname); |
|---|
| 339 |
} |
|---|
| 340 |
if (reg_idl) |
|---|
| 341 |
{ |
|---|
| 342 |
log (0, "Registering .idl files"); |
|---|
| 343 |
setup_explorer ("idl", "OMG IDL file", batname); |
|---|
| 344 |
} |
|---|
| 345 |
} |
|---|
| 346 |
} |
|---|
| 347 |
} |
|---|
| 348 |
#endif |
|---|
| 349 |
|
|---|
| 350 |
static int da[] = { IDC_ROOT_DESKTOP, 0 }; |
|---|
| 351 |
static int ma[] = { IDC_ROOT_MENU, 0 }; |
|---|
| 352 |
|
|---|
| 353 |
static int ct[] = { IDC_C_TYPE, 0 }; |
|---|
| 354 |
static int javat[] = { IDC_JAVA_TYPE, 0 }; |
|---|
| 355 |
static int cppt[] = { IDC_CPP_TYPE, 0 }; |
|---|
| 356 |
static int elispt[] = { IDC_ELISP_TYPE, 0 }; |
|---|
| 357 |
static int txtt[] = { IDC_TXT_TYPE, 0 }; |
|---|
| 358 |
static int idlt[] = { IDC_IDL_TYPE, 0 }; |
|---|
| 359 |
|
|---|
| 360 |
static void |
|---|
| 361 |
check_if_enable_next (HWND h) |
|---|
| 362 |
{ |
|---|
| 363 |
EnableWindow (GetDlgItem (h, IDOK), 1); |
|---|
| 364 |
} |
|---|
| 365 |
|
|---|
| 366 |
static void |
|---|
| 367 |
load_dialog (HWND h) |
|---|
| 368 |
{ |
|---|
| 369 |
rbset (h, da, root_desktop); |
|---|
| 370 |
rbset (h, ma, root_menu); |
|---|
| 371 |
rbset (h, ct, reg_c); |
|---|
| 372 |
rbset (h, javat, reg_java); |
|---|
| 373 |
rbset (h, cppt, reg_cpp); |
|---|
| 374 |
rbset (h, elispt, reg_elisp); |
|---|
| 375 |
rbset (h, txtt, reg_txt); |
|---|
| 376 |
rbset (h, idlt, reg_idl); |
|---|
| 377 |
check_if_enable_next (h); |
|---|
| 378 |
} |
|---|
| 379 |
|
|---|
| 380 |
static int check_desktop (char *title, char *target) |
|---|
| 381 |
{ |
|---|
| 382 |
#if 0 |
|---|
| 383 |
|
|---|
| 384 |
char path[_MAX_PATH]; |
|---|
| 385 |
LPITEMIDLIST id; |
|---|
| 386 |
int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
|---|
| 387 |
SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_DESKTOPDIRECTORY : CSIDL_DESKTOPDIRECTORY, &id); |
|---|
| 388 |
SHGetPathFromIDList (id, path); |
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 |
msg ("Desktop directory for desktop link: %s",path); |
|---|
| 392 |
if (strlen (path) == 0) { |
|---|
| 393 |
SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id); |
|---|
| 394 |
SHGetPathFromIDList (id, path); |
|---|
| 395 |
msg ("Desktop directory for deskop link changed to: %s",path); |
|---|
| 396 |
} |
|---|
| 397 |
|
|---|
| 398 |
char *fname = concat (path, "/", title, ".lnk", 0); |
|---|
| 399 |
|
|---|
| 400 |
if (_access (fname, 0) == 0) |
|---|
| 401 |
return 0; |
|---|
| 402 |
|
|---|
| 403 |
fname = concat (path, "/", title, ".pif", 0); |
|---|
| 404 |
|
|---|
| 405 |
if (_access (fname, 0) == 0) |
|---|
| 406 |
return 0; |
|---|
| 407 |
|
|---|
| 408 |
#endif |
|---|
| 409 |
|
|---|
| 410 |
return IDC_ROOT_DESKTOP; |
|---|
| 411 |
} |
|---|
| 412 |
|
|---|
| 413 |
static int check_startmenu (char *title, char *target) |
|---|
| 414 |
{ |
|---|
| 415 |
#if 0 |
|---|
| 416 |
|
|---|
| 417 |
char path[_MAX_PATH]; |
|---|
| 418 |
LPITEMIDLIST id; |
|---|
| 419 |
int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
|---|
| 420 |
SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); |
|---|
| 421 |
SHGetPathFromIDList (id, path); |
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
msg ("Program directory for program link: %s",path); |
|---|
| 425 |
if (strlen (path) == 0) { |
|---|
| 426 |
SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); |
|---|
| 427 |
SHGetPathFromIDList (id, path); |
|---|
| 428 |
msg ("Program directory for program link changed to: %s",path); |
|---|
| 429 |
} |
|---|
| 430 |
|
|---|
| 431 |
strcat (path, "\\"); |
|---|
| 432 |
strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); |
|---|
| 433 |
char *fname = concat (path, "\\", title, ".lnk", 0); |
|---|
| 434 |
|
|---|
| 435 |
if (_access (fname, 0) == 0) |
|---|
| 436 |
return 0; |
|---|
| 437 |
|
|---|
| 438 |
fname = concat (path, "\\", title, ".pif", 0); |
|---|
| 439 |
|
|---|
| 440 |
if (_access (fname, 0) == 0) |
|---|
| 441 |
return 0; |
|---|
| 442 |
|
|---|
| 443 |
#endif |
|---|
| 444 |
|
|---|
| 445 |
return IDC_ROOT_MENU; |
|---|
| 446 |
} |
|---|
| 447 |
|
|---|
| 448 |
static void |
|---|
| 449 |
save_dialog (HWND h) |
|---|
| 450 |
{ |
|---|
| 451 |
extern int do_install_exe; |
|---|
| 452 |
extern int do_imagemagick_exe; |
|---|
| 453 |
|
|---|
| 454 |
do_install_exe = root_desktop= rbget (h, da); |
|---|
| 455 |
do_imagemagick_exe = root_menu = rbget (h, ma); |
|---|
| 456 |
reg_c = rbget (h, ct); |
|---|
| 457 |
reg_java = rbget (h, javat); |
|---|
| 458 |
reg_cpp = rbget (h, cppt); |
|---|
| 459 |
reg_elisp = rbget (h, elispt); |
|---|
| 460 |
reg_txt = rbget (h, txtt); |
|---|
| 461 |
reg_idl = rbget (h, idlt); |
|---|
| 462 |
} |
|---|
| 463 |
|
|---|
| 464 |
static BOOL |
|---|
| 465 |
dialog_cmd (HWND h, int id, HWND hwndctl, UINT code) |
|---|
| 466 |
{ |
|---|
| 467 |
switch (id) |
|---|
| 468 |
{ |
|---|
| 469 |
|
|---|
| 470 |
case IDC_ROOT_DESKTOP: |
|---|
| 471 |
case IDC_ROOT_MENU: |
|---|
| 472 |
save_dialog (h); |
|---|
| 473 |
check_if_enable_next (h); |
|---|
| 474 |
break; |
|---|
| 475 |
|
|---|
| 476 |
case IDOK: |
|---|
| 477 |
save_dialog (h); |
|---|
| 478 |
#if 0 |
|---|
| 479 |
do_desktop_setup(); |
|---|
| 480 |
#endif |
|---|
| 481 |
NEXT (IDD_S_POSTINSTALL); |
|---|
| 482 |
break; |
|---|
| 483 |
|
|---|
| 484 |
case IDC_BACK: |
|---|
| 485 |
save_dialog (h); |
|---|
| 486 |
NEXT (IDD_CHOOSE); |
|---|
| 487 |
break; |
|---|
| 488 |
|
|---|
| 489 |
case IDCANCEL: |
|---|
| 490 |
NEXT (0); |
|---|
| 491 |
break; |
|---|
| 492 |
} |
|---|
| 493 |
return FALSE; |
|---|
| 494 |
} |
|---|
| 495 |
|
|---|
| 496 |
static BOOL CALLBACK |
|---|
| 497 |
dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) |
|---|
| 498 |
{ |
|---|
| 499 |
switch (message) |
|---|
| 500 |
{ |
|---|
| 501 |
case WM_INITDIALOG: |
|---|
| 502 |
load_dialog (h); |
|---|
| 503 |
return FALSE; |
|---|
| 504 |
case WM_COMMAND: |
|---|
| 505 |
return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); |
|---|
| 506 |
} |
|---|
| 507 |
return FALSE; |
|---|
| 508 |
} |
|---|
| 509 |
|
|---|
| 510 |
void |
|---|
| 511 |
do_desktop (HINSTANCE h) |
|---|
| 512 |
{ |
|---|
| 513 |
CoInitialize (NULL); |
|---|
| 514 |
|
|---|
| 515 |
verinfo.dwOSVersionInfoSize = sizeof (verinfo); |
|---|
| 516 |
GetVersionEx (&verinfo); |
|---|
| 517 |
batname = 0; |
|---|
| 518 |
uninstname = 0; |
|---|
| 519 |
|
|---|
| 520 |
if (xemacs_package != 0 && xemacs_package->type != TY_GENERIC) |
|---|
| 521 |
{ |
|---|
| 522 |
batname = concat (find_xemacs_exe_path (), "\\", |
|---|
| 523 |
find_xemacs_exe_name (), |
|---|
| 524 |
0); |
|---|
| 525 |
uninstname = concat (find_xemacs_exe_path (), "\\", "setup.exe", 0); |
|---|
| 526 |
root_desktop = check_desktop ("XEmacs", batname); |
|---|
| 527 |
root_menu = check_startmenu ("XEmacs", batname); |
|---|
| 528 |
reg_c = IDC_C_TYPE; |
|---|
| 529 |
reg_cpp = IDC_CPP_TYPE; |
|---|
| 530 |
reg_java = IDC_JAVA_TYPE; |
|---|
| 531 |
reg_elisp = IDC_ELISP_TYPE; |
|---|
| 532 |
reg_txt = IDC_TXT_TYPE; |
|---|
| 533 |
reg_idl = IDC_IDL_TYPE; |
|---|
| 534 |
} |
|---|
| 535 |
else |
|---|
| 536 |
{ |
|---|
| 537 |
root_desktop = 0; |
|---|
| 538 |
root_menu = 0; |
|---|
| 539 |
reg_c = 0; |
|---|
| 540 |
reg_cpp = 0; |
|---|
| 541 |
reg_java = 0; |
|---|
| 542 |
reg_elisp = 0; |
|---|
| 543 |
reg_txt = 0; |
|---|
| 544 |
reg_idl = 0; |
|---|
| 545 |
} |
|---|
| 546 |
|
|---|
| 547 |
int rv = 0; |
|---|
| 548 |
rv = DialogBox (h, MAKEINTRESOURCE (IDD_DESKTOP), 0, dialog_proc); |
|---|
| 549 |
if (rv == -1) |
|---|
| 550 |
fatal (IDS_DIALOG_FAILED); |
|---|
| 551 |
} |
|---|