changeset 666:146d342ff859

[xemacs-hg @ 2001-09-25 02:35:32 by andyp] more updates
author andyp
date Tue, 25 Sep 2001 02:35:32 +0000
parents fdefd0186b75
children 046f73d312c5
files netinstall/ChangeLog netinstall/desktop.cc netinstall/regedit.cc netinstall/regedit.h netinstall/res.rc netinstall/setup.mak netinstall/uninstall.cc
diffstat 7 files changed, 118 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/netinstall/ChangeLog	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/ChangeLog	Tue Sep 25 02:35:32 2001 +0000
@@ -1,3 +1,30 @@
+2001-09-24  Andy Piper  <andy@xemacs.org>
+
+	* desktop.cc:
+	* desktop.cc (make_link):
+	* desktop.cc (find_xemacs_exe_name):
+	* desktop.cc (remove_link):
+	* desktop.cc (start_menu):
+	* desktop.cc (desktop_icon):
+	* desktop.cc (remove_desktop_setup):
+	* desktop.cc (FROB):
+	* desktop.cc (do_desktop_setup):
+	* desktop.cc (check_startmenu):
+	* desktop.cc (do_desktop): Be more exacting about removal of
+	desktop things.
+	* regedit.cc (remove1):
+	* regedit.cc (remove_app_path):
+	* regedit.h (remove_app_path): remove more registry pieces.
+	* res.rc:
+	* setup.mak (APPVER):
+	* setup.mak (CCV):
+	* setup.mak (OBJS):
+	* setup.mak (LIBS):
+	* setup.mak (distclean):
+	* uninstall.cc:
+	* uninstall.cc (read_installed_db):
+	* uninstall.cc (uninstall_all): Cleanup.
+
 2001-09-08  Andy Piper  <andy@xemacs.org>
 
 	* Makefile.in.in (OBJS):
@@ -278,6 +305,6 @@
 
 	* all: port from cygwin setup.
 
-%%% $Id: ChangeLog,v 1.7 2001/09/09 04:37:46 andyp Exp $
-$Revision: 1.7 $
+%%% $Id: ChangeLog,v 1.8 2001/09/25 02:35:32 andyp Exp $
+$Revision: 1.8 $
 
--- a/netinstall/desktop.cc	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/desktop.cc	Tue Sep 25 02:35:32 2001 +0000
@@ -61,27 +61,31 @@
 
 static char *iconname;
 static char *batname;
+static char *uninstname;
 
 static void
-make_link (char *linkpath, char *title, char *target)
+make_link (char *linkpath, char *title, char *target, char* args)
 {
+#if 0
   char argbuf[_MAX_PATH];
+#endif
   char *fname = concat (linkpath, "/", title, ".lnk", 0);
 
   if (_access (fname, 0) == 0)
     return; /* already exists */
 
-  msg ("make_link %s, %s, %s\n", fname, title, target);
+  msg ("make_link %s, %s, %s, %s\n", fname, title, target, args);
 
   mkdir_p (0, fname);
 
-  char *exepath, *args;
-
+  char *exepath;
+#if 0
   /* If we are running Win9x, build a command line. */
   if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
     {
+#endif
       exepath = target;
-      args = "";
+#if 0
     }
   else
     {
@@ -92,9 +96,9 @@
       sprintf (argbuf, "%s %s", COMMAND9XARGS, target);
       args = argbuf;
     }
-
+#endif
   msg ("make_link_2 (%s, %s, %s, %s)", exepath, args, iconname, fname);
-  make_link_2 (exepath, args, iconname, fname);
+  make_link_2 (backslash (exepath), args, iconname, fname);
 }
 
 static char* 
@@ -108,7 +112,7 @@
 			      "\\", XEMACS_NATIVE_ARCH_NAME, 0));
 }
 
-static char* 
+char* 
 find_xemacs_exe_name ()
 {
   /* Hack to support older versions. */
@@ -126,17 +130,25 @@
 static void
 remove_link (char *linkpath, char* title)
 {
-  char *fname = concat (linkpath, "/", title, ".lnk", 0);
-
-  if (_access (fname, 0) != 0)
-    return; /* doesn't exist */
-
-  msg ("remove_link %s, %s, %s\n", fname, title);
-  _unlink (fname);
+  if (title)
+    {
+      char *fname = backslash (concat (linkpath, "/", title, ".lnk", 0));
+      msg ("remove_link %s, %s\n", fname, title);
+      if (_access (fname, 0) != 0)
+	return; /* doesn't exist */
+      _unlink (fname);
+    }
+  else 
+    {
+      msg ("remove_link %s\n", linkpath);
+      if (_access (linkpath, 0) != 0)
+	return; /* doesn't exist */
+      _rmdir (linkpath);
+    }
 }
 
 static void
-start_menu (char *title, char *target, int remove)
+start_menu (char *title, char *target, int rem, char* args)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -152,16 +164,16 @@
      msg("Program directory for program link changed to: %s",path);
   }
 // end of Win95 addition
-  strcat (path, "/");
+  strcat (path, "\\");
   strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME);
-  if (remove == 0)
-    make_link (path, title, target);
+  if (rem == 0)
+    make_link (path, title, target, args);
   else
     remove_link (path, title);
 }
 
 static void
-desktop_icon (char *title, char *target, int remove)
+desktop_icon (char *title, char *target, int rem)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -178,8 +190,8 @@
      msg("Desktop directory for deskop link changed to: %s",path);
   }
 // end of Win95 addition
-  if (remove == 0)
-    make_link (path, title, target);
+  if (rem == 0)
+    make_link (path, title, target, "");
   else
     remove_link (path, title);
 }
@@ -210,15 +222,15 @@
 void
 remove_desktop_setup()
 {
-  start_menu ("XEmacs", 0, 1);
+  start_menu ("XEmacs", 0, 1, 0);
+  start_menu ("Uninstall XEmacs", 0, 1, 0);
+  start_menu (0, 0, 1, 0);
   desktop_icon ("XEmacs", 0, 1);
 
   if (xemacs_package != 0)
     {
-      int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0);
-#define FROB(exe)	  remove_app_path ((exe), \
-			issystem)
-      /*      FROB (find_xemacs_exe_name ()); */
+#define FROB(exe)	  remove_app_path (exe)
+      FROB (find_xemacs_exe_name ());
       FROB ("runemacs.exe");
       FROB ("xemacs.exe");
 #undef FROB
@@ -231,7 +243,8 @@
   save_icon ();
 
   if (root_menu && batname) {
-    start_menu ("XEmacs", batname, 0);
+    start_menu ("XEmacs", batname, 0, "");
+    start_menu ("Uninstall XEmacs", uninstname, 0, "-u");
   }
 
   if (root_desktop && batname) {
@@ -380,14 +393,14 @@
      msg ("Program directory for program link changed to: %s",path);
   }
   // end of Win95 addition
-  strcat (path, "/");
+  strcat (path, "\\");
   strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME);
-  char *fname = concat (path, "/", title, ".lnk", 0);
+  char *fname = concat (path, "\\", title, ".lnk", 0);
 
   if (_access (fname, 0) == 0)
     return 0; /* already exists */
   
-  fname = concat (path, "/", title, ".pif", 0); /* check for a pif as well */
+  fname = concat (path, "\\", title, ".pif", 0); /* check for a pif as well */
   
   if (_access (fname, 0) == 0)
     return 0; /* already exists */
@@ -459,12 +472,14 @@
   verinfo.dwOSVersionInfoSize = sizeof (verinfo);
   GetVersionEx (&verinfo);
   batname = 0;
+  uninstname = 0;
 
   if (xemacs_package != 0 && xemacs_package->type != TY_GENERIC)
     {
       batname = concat (find_xemacs_exe_path (), "\\",
 			find_xemacs_exe_name (), 
 			0);
+      uninstname = concat (find_xemacs_exe_path (), "\\", "setup.exe", 0);
       root_desktop = check_desktop ("XEmacs", batname);
       root_menu = check_startmenu ("XEmacs", batname);
       reg_c = IDC_C_TYPE;
--- a/netinstall/regedit.cc	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/regedit.cc	Tue Sep 25 02:35:32 2001 +0000
@@ -323,7 +323,10 @@
   sprintf (buf, "Software\\%s\\%s",
 	   XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME,
 	   XEMACS_INFO_XEMACS_REGISTRY_NAME);
+  RegDeleteKey (rkey, buf);
 
+  sprintf (buf, "Software\\%s",
+	   XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME);
   RegDeleteKey (rkey, buf);
 }
 
@@ -335,14 +338,14 @@
 }
 
 void
-remove_app_path (char *exe, int issystem)
+remove_app_path (char *exe)
 {
   char buf[1000];
   sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s",
 	   exe);
 
-  HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  RegDeleteKey (kr, buf);
+  RegDeleteKey (HKEY_LOCAL_MACHINE, buf);
+  RegDeleteKey (HKEY_CURRENT_USER, buf);
 }
 
 void
--- a/netinstall/regedit.h	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/regedit.h	Tue Sep 25 02:35:32 2001 +0000
@@ -25,6 +25,6 @@
 void	set_app_path (char *exe, char* path, int issystem);
 void 	set_install_path (char* path, int issystem);
 void	setup_explorer (char* file_type, char* name, char *exe);
-void	remove_app_path (char *exe, int issystem);
+void	remove_app_path (char *exe);
 void	remove_uninstall_path ();
 
--- a/netinstall/res.rc	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/res.rc	Tue Sep 25 02:35:32 2001 +0000
@@ -33,20 +33,20 @@
 CAPTION "XEmacs Setup"
 FONT 8, "MS Sans Serif"
 BEGIN
-    DEFPUSHBUTTON   "Next >",IDOK,199,176,45,15,WS_DISABLED
+    PUSHBUTTON      "Next >",IDOK,199,176,45,15,WS_DISABLED | WS_GROUP
     PUSHBUTTON      "Cancel",IDCANCEL,256,176,45,15
+    CONTROL         "Download from the Internet",IDC_SOURCE_DOWNLOAD,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,127,102,152,10
+    CONTROL         "Install from the Internet",IDC_SOURCE_NETINST,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,127,121,87,10
+    CONTROL         "Install from Local Directory",IDC_SOURCE_CWD,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,127,140,104,10
     LTEXT           "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP
     LTEXT           "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP
     LTEXT           "Setup will use the following installation method.",
                     IDC_STATIC,112,11,170,17
     LTEXT           "To exit setup click Cancel at any time.",IDC_STATIC,112,
                     32,166,17
-    CONTROL         "Download from the Internet",IDC_SOURCE_DOWNLOAD,"Button",
-                    BS_AUTORADIOBUTTON,127,102,152,10
-    CONTROL         "Install from the Internet",IDC_SOURCE_NETINST,"Button",
-                    BS_AUTORADIOBUTTON,127,121,87,10
-    CONTROL         "Install from Local Directory",IDC_SOURCE_CWD,"Button",
-                    BS_AUTORADIOBUTTON,127,140,104,10
     GROUPBOX        "Installation method",IDC_STATIC,113,84,188,77
     CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
 END
@@ -147,21 +147,21 @@
 CAPTION "XEmacs Setup"
 FONT 8, "MS Sans Serif"
 BEGIN
-    DEFPUSHBUTTON   "Next >",IDOK,199,176,45,15
+    PUSHBUTTON   "Next >",IDOK,199,176,45,15, WS_GROUP
     PUSHBUTTON      "< Back",IDC_BACK,154,176,45,15
     PUSHBUTTON      "Cancel",IDCANCEL,256,176,45,15
     LTEXT           "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP
     LTEXT           "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP
     LTEXT           "Setup will use the following connection method.",
-                    IDC_STATIC,112,11,170,17
+                    IDC_STATIC,112,11,170,17, NOT WS_GROUP
     LTEXT           "To exit setup click Cancel at any time.",IDC_STATIC,112,
-                    32,166,17
+                    32,166,17, NOT WS_GROUP
     CONTROL         "Use IE5 Settings",IDC_NET_IE5,"Button",
-                    BS_AUTORADIOBUTTON,128,93,69,10
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,128,93,69,10
     CONTROL         "Direct Connection",IDC_NET_DIRECT,"Button",
-                    BS_AUTORADIOBUTTON,128,109,73,10
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,128,109,73,10
     CONTROL         "Use HTTP/FTP Proxy:",IDC_NET_PROXY,"Button",
-                    BS_AUTORADIOBUTTON,128,124,88,10
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,128,124,88,10
     EDITTEXT        IDC_PROXY_HOST,128,141,80,12,ES_AUTOHSCROLL | 
                     WS_DISABLED
     LTEXT           "Proxy",IDC_STATIC,10,55,50,15,SS_CENTERIMAGE,
@@ -217,8 +217,7 @@
 END
 
 IDD_UNINSTALL DIALOG DISCARDABLE  0, 0, 311, 201
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | 
-    WS_CAPTION | WS_SYSMENU
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Uninstall XEmacs"
 FONT 8, "MS Sans Serif"
 BEGIN
@@ -515,7 +514,7 @@
     IDS_ERR_OPEN_READ       "Can't open %s for reading: %s"
     IDS_ROOT_ABSOLUTE       "The install directory must be absolute, with both a drive letter and leading slash, like C:\\Cygwin"
     IDS_DOWNLOAD_COMPLETE   "Download Complete"
-    IDS_CVSID               "\n%%% $Id: res.rc,v 1.4 2001/09/09 04:37:47 andyp Exp $\n"
+    IDS_CVSID               "\n%%% $Id: res.rc,v 1.5 2001/09/25 02:35:32 andyp Exp $\n"
     IDS_NOLOGFILE           "Cannot open log file %s for writing"
     IDS_UNINSTALL_COMPLETE  "Uninstalls complete."
     IDS_WININET             "Unable to find or load the Internet Explorer 5 DLLs"
--- a/netinstall/setup.mak	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/setup.mak	Tue Sep 25 02:35:32 2001 +0000
@@ -26,7 +26,6 @@
 
 TARGETOS=BOTH
 APPVER=4.0
-!include "c:\Program Files\Microsoft Platform SDK\Include\win32.mak"
 
 default: all
 
@@ -55,9 +54,9 @@
 VERBOSECC=0
 !endif
 !if $(VERBOSECC)
-cc=$(cc)
+CCV=$(CC)
 !else
-cc=@$(cc)
+CCV=@$(CC)
 !endif
 
 !if $(DEBUG_XEMACS)
@@ -83,6 +82,7 @@
 	$(OUTDIR)\geturl.obj \
 	$(OUTDIR)\hash.obj \
 	$(OUTDIR)\ini.obj \
+	$(OUTDIR)\init.obj \
 	$(OUTDIR)\inilex.obj \
 	$(OUTDIR)\iniparse.obj \
 	$(OUTDIR)\install.obj \
@@ -101,7 +101,6 @@
 	$(OUTDIR)\nio-http.obj \
 	$(OUTDIR)\other.obj \
 	$(OUTDIR)\postinstall.obj \
-#	$(OUTDIR)\res.obj \
 	$(OUTDIR)\root.obj \
 	$(OUTDIR)\simpsock.obj \
 	$(OUTDIR)\site.obj \
@@ -109,6 +108,7 @@
 	$(OUTDIR)\splash.obj \
 	$(OUTDIR)\state.obj \
 	$(OUTDIR)\tar.obj \
+	$(OUTDIR)\uninstall.obj \
 	$(OUTDIR)\version.obj
 
 #
@@ -126,9 +126,9 @@
 
 # nmake rule
 .cc{$(OUTDIR)}.obj:
-	$(cc) /TP $(cflags) $(cdebug) $(cvarsmt) $(defines) -Fo$@ $<
+	$(CC) /TP $(cflags) $(cdebug) $(cvarsmt) $(defines) -Fo$@ $<
 .c{$(OUTDIR)}.obj:
-	$(cc) $(cflags) $(cdebug) $(cvarsmt) $(defines) -Fo$@ $<
+	$(CC) $(cflags) $(cdebug) $(cvarsmt) $(defines) -Fo$@ $<
 
 #
 # Main target
@@ -169,8 +169,9 @@
 # DO NOT DELETE
 
 $(OUTDIR)/autoload.obj: autoload.c win32.h 
-$(OUTDIR)/inilex.obj: inilex.c win32.h  ini.h iniparse.h \
-	
+$(OUTDIR)/inilex.obj: inilex.c win32.h  ini.h iniparse.h
+$(OUTDIR)/init.obj: win32.h  dialog.h resource.h \
+	state.h ini.h concat.h msg.h log.h find.h reginfo.h
 $(OUTDIR)/iniparse.obj: iniparse.c ini.h iniparse.h port.h
 $(OUTDIR)/inilex.obj: inilex.c win32.h  ini.h iniparse.h
 $(OUTDIR)/mklink2.obj: mklink2.c win32.h 
@@ -237,6 +238,10 @@
 $(OUTDIR)/splash.obj: splash.cc win32.h  dialog.h resource.h msg.h \
 	version.h
 $(OUTDIR)/state.obj: state.cc state.h
+$(OUTDIR)/uninstall.obj: install.cc win32.h  \
+	$(ZLIBDIR)/zlib.h $(ZLIBDIR)/zconf.h \
+	resource.h ini.h dialog.h concat.h geturl.h mkdir.h state.h tar.h \
+	diskfull.h msg.h regedit.h reginfo.h log.h hash.h port.h
 $(OUTDIR)/tar.obj: tar.cc win32.h  \
 	$(ZLIBDIR)/zlib.h $(ZLIBDIR)/zconf.h \
 	tar.h mkdir.h log.h port.h
--- a/netinstall/uninstall.cc	Thu Sep 20 06:31:11 2001 +0000
+++ b/netinstall/uninstall.cc	Tue Sep 25 02:35:32 2001 +0000
@@ -68,6 +68,7 @@
 extern char * map_filename (char *fn, int type);
 void remove_desktop_setup ();
 static void start_uninstall ();
+extern char* find_xemacs_exe_name();
 
 char *
 base (char *s);
@@ -281,7 +282,10 @@
       if (pkg != 0)
 	if (strncmp ("xemacs-i686", pkg, 11) == 0
 	    || (strncmp ("xemacs-i586", pkg, 11) == 0))
-	  np->type = install_type;
+	  {
+	    np->type = install_type;
+	    xemacs_package = np;
+	  }
     }
   fclose (db);
 }
@@ -306,13 +310,10 @@
 
   PostMessage (unins_dialog, XM_DONE, 0, 0);
 
-  remove_desktop_setup();
-  char *odbn = concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0);
-  char *sdbn = concat (root_dir, XEMACS_SETUP_DIR, "installed.db.old", 0);
+  remove (concat (root_dir, XEMACS_SETUP_DIR, "installed.db.old", 0));
+  remove (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0));
 
-  remove (sdbn);
-  remove (odbn);
-
+  remove_desktop_setup();
   remove_xemacs_root();
   remove_uninstall_path();