This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Fwd: Update netinstaller to do uninstallation]


Several months ago, Andy took the cygwin setup code and adapted it for 
use by XEmacs.  I saw this message today on the XEmacs-nt list; perhaps 
it's interesting here?  (I'm not sure; I thought the existing cygwin 
setup.exe could do uninstallation.  It's possible Andy is just forward 
porting some of our changes into his fork, or this could be unique code 
that we might want to roll back into our version.)  Anyway, here it is, 
if anyone's interested...

--Chuck


-------- Original Message --------
Subject: Update netinstaller to do uninstallation
Date: Sat, 8 Sep 2001 21:30:07 -0700
From: "Andy Piper" <andypiper@iname.com>
To: "XEmacs Patches" <xemacs-patches@xemacs.org>
CC: "XEmacs NT List" <xemacs-nt@xemacs.org>

This patch fixes the netinstaller to allow uninstallation and registration
of standard file types with explorer.

2001-09-08  Andy Piper  <andy@xemacs.org>

	* Makefile.in.in (OBJS):
	* Makefile.in.in (all):
	* Makefile.in.in (extraclean):
	* choose.cc (base):
	* desktop.cc:
	* desktop.cc (remove_link):
	* desktop.cc (start_menu):
	* desktop.cc (desktop_icon):
	* desktop.cc (remove_desktop_setup):
	* desktop.cc (do_desktop_setup):
	* desktop.cc (load_dialog):
	* desktop.cc (save_dialog):
	* desktop.cc (do_desktop):
	* dialog.h:
	* download.cc (download_one):
	* ini.h (pinfo):
	* main.cc (WinMain):
	* nio-ie5.cc:
	* regedit.cc:
	* regedit.cc (create_xemacs_root):
	* regedit.cc (set_app_path):
	* regedit.cc (set_install_path):
	* regedit.cc (setup_explorer):
	* regedit.cc (remove_app_path):
	* regedit.cc (remove_uninstall_path):
	* regedit.h (remove_app_path):
	* reginfo.h:
	* reginfo.h (XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME):
	* reginfo.h (XEMACS_NATIVE_ARCH_NAME):
	* res.rc:
	* resource.h (IDD_UNINSTALL):
	* resource.h (IDC_TXT_TYPE):
	* root.cc:
	* root.cc (browse_cb):
	* root.cc (set_default_root):
	* splash.cc (do_splash):
	* state.h:
	* state.h (MIRROR_SITE):
	* uninstall.cc:
	* uninstall.cc (dialog_proc):
	* uninstall.cc (progress):
	* uninstall.cc (uninstall_one):
	* uninstall.cc (do_uninstall):
	* uninstall.cc (read_installed_db):
	* uninstall.cc (uninstall_all):
	* win32.h:
	* win32.h (NOCOMATTRIBUTE): Update netinstaller to support
	uninstallation and register standard file-types.

Index: netinstall/Makefile.in.in
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/Makefile.in.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in.in
--- netinstall/Makefile.in.in	2001/04/12 18:22:42	1.2
+++ netinstall/Makefile.in.in	2001/09/09 04:26:41
@@ -111,6 +111,7 @@
 	ini.o \
 	inilex.o \
 	iniparse.o \
+	init.o \
 	install.o \
 	localdir.o \
 	log.o \
@@ -135,6 +136,7 @@
 	splash.o \
 	state.o \
 	tar.o \
+	uninstall.o \
 	version.o
 
 .SUFFIXES:
@@ -151,12 +153,12 @@
 		-L$(MINGW_ZLIB_DIR) -lz -lmingw32
 	@chmod a-x $@
 
-setup.ini: setup.exe
+setup-bin.ini: setup.exe
 	V=`grep '^\$$Revision.*' $(srcdir)/ChangeLog \
 	| sed -e 's/\$$Revision:* *//' \
 	  -e 's/ *$$.*//'` ;\
 	$(XEMACS) -batch -vanilla -l ${srcdir}/../lisp/package-net.el \
-		-f package-net-batch-convert-index-to-ini . $$V
+		-f package-net-batch-generate-bin-ini . $$V
 
 install:
 	@echo; echo "Installing net setup."
@@ -207,7 +209,7 @@
  msg.h log.h find.h reginfo.h
 concat.o: concat.cc
 desktop.o: desktop.cc win32.h resource.h ini.h msg.h state.h concat.h \
- mkdir.h dialog.h version.h port.h
+ mkdir.h dialog.h version.h port.h reginfo.h
 dialog.o: dialog.cc win32.h dialog.h msg.h log.h
 diskfull.o: diskfull.cc win32.h diskfull.h
 download.o: download.cc win32.h resource.h msg.h ini.h dialog.h \
@@ -227,6 +229,10 @@
  iniparse.h \
  port.h
 install.o: install.cc win32.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
+init.o: init.cc win32.h resource.h dialog.h state.h msg.h log.h 
+uninstall.o: uninstall.cc win32.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
 localdir.o: localdir.cc win32.h dialog.h resource.h state.h msg.h \
Index: netinstall/choose.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/choose.cc,v
retrieving revision 1.2
diff -u -r1.2 choose.cc
--- netinstall/choose.cc	2001/04/12 18:22:44	1.2
+++ netinstall/choose.cc	2001/09/09 04:26:42
@@ -623,7 +623,7 @@
   return FALSE;
 }
 
-static char *
+char *
 base (char *s)
 {
   if (!s)
Index: netinstall/desktop.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/desktop.cc,v
retrieving revision 1.2
diff -u -r1.2 desktop.cc
--- netinstall/desktop.cc	2001/04/12 18:22:44	1.2
+++ netinstall/desktop.cc	2001/09/09 04:26:42
@@ -40,6 +40,7 @@
 #include "reginfo.h"
 #include "regedit.h"
 #include "port.h"
+#include "log.h"
 
 extern "C" {
   void make_link_2 (char *exepath, char *args, char *icon, char *lname);
@@ -123,8 +124,20 @@
 }
 
 static void
-start_menu (char *title, char *target)
+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);
+}
+
+static void
+start_menu (char *title, char *target, int remove)
+{
   char path[_MAX_PATH];
   LPITEMIDLIST id;
   int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0;
@@ -141,11 +154,14 @@
 // end of Win95 addition
   strcat (path, "/");
   strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME);
-  make_link (path, title, target);
+  if (remove == 0)
+    make_link (path, title, target);
+  else
+    remove_link (path, title);
 }
 
 static void
-desktop_icon (char *title, char *target)
+desktop_icon (char *title, char *target, int remove)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -162,59 +178,10 @@
      msg("Desktop directory for deskop link changed to: %s",path);
   }
 // end of Win95 addition
-  make_link (path, title, target);
-}
-
-static int
-uexists (char *path)
-{
-  char *f = concat (root_dir, path, 0);
-  int a = _access (f, 0);
-  free (f);
-  if (a == 0)
-    return 1;
-  return 0;
-}
-
-static void
-make_passwd_group ()
-{
-  if (verinfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
-    {
-      int i;
-
-      LOOP_PACKAGES
-	{
-	  if (!strcmp (package[i].name, "cygwin"))
-	    {
-	      /* mkpasswd and mkgroup are not working on 9x/ME up to 1.1.5-4 */
-	      char *border_version = canonicalize_version ("1.1.5-4");
-	      char *inst_version = canonicalize_version (pi.version);
-
-	      if (strcmp (inst_version, border_version) <= 0)
-		return;
-
-	      break;
-	    }
-	}
-    }
-
-  if (uexists ("/etc/passwd") && uexists ("/etc/group"))
-    return;
-
-  char *fname = concat (root_dir, "/etc/postinstall/passwd-grp.bat", 0);
-  mkdir_p (0, fname);
-
-  FILE *p = fopen (fname, "wb");
-  if (!p)
-    return;
-
-  if (!uexists ("/etc/passwd"))
-    fprintf (p, "bin\\mkpasswd -l > etc\\passwd\n");
-  if (!uexists ("/etc/group"))
-    fprintf (p, "bin\\mkgroup -l > etc\\group\n");
-
-  fclose (p);
+  if (remove == 0)
+    make_link (path, title, target);
+  else
+    remove_link (path, title);
 }
 
 static void
@@ -240,53 +207,115 @@
     }
 }
 
+void
+remove_desktop_setup()
+{
+  start_menu ("XEmacs", 0, 1);
+  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 ()); */
+      FROB ("runemacs.exe");
+      FROB ("xemacs.exe");
+#undef FROB
+    }
+}
+
 static void
 do_desktop_setup()
 {
   save_icon ();
 
   if (root_menu && batname) {
-    start_menu ("XEmacs", batname);
+    start_menu ("XEmacs", batname, 0);
   }
 
   if (root_desktop && batname) {
-    desktop_icon ("XEmacs", batname);
+    desktop_icon ("XEmacs", batname, 0);
   }
 
   // set regkeys for the application
   if (xemacs_package != 0)
     {
       int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0);
-      if (xemacs_package->type == TY_NATIVE)
+      if (xemacs_package->type == TY_NATIVE
+	  || xemacs_package->type == TY_CYGWIN)
 	{
+	  if (xemacs_package->type == TY_NATIVE)
+	    {
 #define FROB(exe)	  set_app_path ((exe), \
 			find_xemacs_exe_path (), \
 			issystem)
-	  FROB (find_xemacs_exe_name ());
-	  FROB ("runemacs.exe");
-	  FROB ("xemacs.exe");
+	      FROB (find_xemacs_exe_name ());
+	      FROB ("runemacs.exe");
+	      FROB ("xemacs.exe");
 #undef FROB
-	}
-      else if (xemacs_package->type == TY_CYGWIN)
-	{
-	  int junk;
-	  char* root = find_cygwin_root (&junk);
+	    }
+	  else if (xemacs_package->type == TY_CYGWIN)
+	    {
+	      int junk;
+	      char* root = find_cygwin_root (&junk);
 #define FROB(exe)	set_app_path ((exe), \
 			concat (find_xemacs_exe_path (), ";", \
 				root, "\\bin;", \
 				root, "\\usr\\bin", 0), \
 			issystem)
-	  FROB (find_xemacs_exe_name ());
-	  FROB ("runemacs.exe");
-	  FROB ("xemacs.exe");
+	      FROB (find_xemacs_exe_name ());
+	      FROB ("runemacs.exe");
+	      FROB ("xemacs.exe");
 #undef FROB
+	    }
+	  set_install_path (find_xemacs_exe_path(), issystem);
 	}
+      // Register file types
+      if (batname)
+	{
+	  if (reg_java)
+	    {
+	      log (0, "Registering .java files");
+	      setup_explorer ("java", "Java Source file", batname);
+	      setup_explorer ("jav", "Java Source file", batname);
+	    }
+	  if (reg_cpp)
+	    {
+	      log (0, "Registering .cpp files");
+	      setup_explorer ("cpp", "C++ Source file", batname);
+	      setup_explorer ("cc", "C++ Source file", batname);
+	      setup_explorer ("hh", "C++ Header file", batname);
+	    }
+	  if (reg_c)
+	    {
+	      log (0, "Registering .c files");
+	      setup_explorer ("c", "C Source file", batname);
+	      setup_explorer ("h", "C Header file", batname);
+	    }
+	  if (reg_elisp)
+	    {
+	      log (0, "Registering .el files");
+	      setup_explorer ("el", "E-Lisp Source file", batname);
+	    }
+	  if (reg_txt)
+	    {
+	      log (0, "Registering .txt files");
+	      setup_explorer ("txt", "Text file", batname);
+	    }
+	}
     }
 }
 
 static int da[] = { IDC_ROOT_DESKTOP, 0 };
 static int ma[] = { IDC_ROOT_MENU, 0 };
 
+static int ct[] = { IDC_C_TYPE, 0 };
+static int javat[] = { IDC_JAVA_TYPE, 0 };
+static int cppt[] = { IDC_CPP_TYPE, 0 };
+static int elispt[] = { IDC_ELISP_TYPE, 0 };
+static int txtt[] = { IDC_TXT_TYPE, 0 };
+
 static void
 check_if_enable_next (HWND h)
 {
@@ -298,6 +327,11 @@
 {
   rbset (h, da, root_desktop);
   rbset (h, ma, root_menu);
+  rbset (h, ct, reg_c);
+  rbset (h, javat, reg_java);
+  rbset (h, cppt, reg_cpp);
+  rbset (h, elispt, reg_elisp);
+  rbset (h, txtt, reg_txt);
   check_if_enable_next (h);
 }
 
@@ -366,6 +400,11 @@
 {
   root_desktop= rbget (h, da);
   root_menu = rbget (h, ma);
+  reg_c = rbget (h, ct);
+  reg_java = rbget (h, javat);
+  reg_cpp = rbget (h, cppt);
+  reg_elisp = rbget (h, elispt);
+  reg_txt = rbget (h, txtt);
 }
 
 static BOOL
@@ -428,11 +467,21 @@
 			0);
       root_desktop = check_desktop ("XEmacs", batname);
       root_menu = check_startmenu ("XEmacs", batname);
+      reg_c = IDC_C_TYPE;
+      reg_cpp = IDC_CPP_TYPE;
+      reg_java = IDC_JAVA_TYPE;
+      reg_elisp = IDC_ELISP_TYPE;
+      reg_txt = IDC_TXT_TYPE;
     }
   else
     {
       root_desktop = 0;
       root_menu = 0;
+      reg_c = 0;
+      reg_cpp = 0;
+      reg_java = 0;
+      reg_elisp = 0;
+      reg_txt = 0;
     }
   
   int rv = 0;
Index: netinstall/dialog.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/dialog.h,v
retrieving revision 1.2
diff -u -r1.2 dialog.h
--- netinstall/dialog.h	2001/04/12 18:22:45	1.2
+++ netinstall/dialog.h	2001/09/09 04:26:42
@@ -31,11 +31,13 @@
 D(do_download);
 D(do_fromcwd);
 D(do_ini);
+D(do_init);
 D(do_install);
 D(do_local_dir);
 D(do_net);
 D(do_other);
 D(do_postinstall);
+D(do_uninstall);
 D(do_root);
 D(do_site);
 D(do_source);
Index: netinstall/download.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/download.cc,v
retrieving revision 1.2
diff -u -r1.2 download.cc
--- netinstall/download.cc	2001/04/12 18:22:45	1.2
+++ netinstall/download.cc	2001/09/09 04:26:42
@@ -32,8 +32,6 @@
 #include "mkdir.h"
 #include "log.h"
 
-#define pi (package[i].info[package[i].trust])
-
 static int
 download_one (char *name, int expected_size)
 {
Index: netinstall/ini.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/ini.h,v
retrieving revision 1.2
diff -u -r1.2 ini.h
--- netinstall/ini.h	2001/04/12 18:22:47	1.2
+++ netinstall/ini.h	2001/09/09 04:26:42
@@ -73,7 +73,8 @@
 Package *new_package (char *name);
 void	ini_init (char *string);
 
-#define pi (package[i].info[package[i].trust])
+#define pinfo(p) ((p).info[(p).trust])
+#define pi pinfo(package[i])
 
 #define LOOP_PACKAGES \
   for (i=0; i<npackages; i++) \
Index: netinstall/main.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/main.cc,v
retrieving revision 1.2
diff -u -r1.2 main.cc
--- netinstall/main.cc	2001/04/12 18:22:49	1.2
+++ netinstall/main.cc	2001/09/09 04:26:42
@@ -51,21 +51,29 @@
 	 int cmd_show)
 {
   hinstance = h;
-
-  next_dialog = IDD_SPLASH;
-
-  log (LOG_TIMESTAMP, "Starting XEmacs install");
+  int pos = -1;
+  if ((pos = strcspn(command_line, "-")) >= 0
+      &&
+      command_line[pos+1] == 'u')
+    {
+      next_dialog = IDD_UNINSTALL;
+      log (LOG_TIMESTAMP, "Starting XEmacs uninstall");
+      uninstall = 1;
+    }
+  else
+    {
+      next_dialog = IDD_SPLASH;
+      log (LOG_TIMESTAMP, "Starting XEmacs install");
+    }
 
-  char cwd[_MAX_PATH];
-  GetCurrentDirectory (sizeof (cwd), cwd);
-  local_dir = strdup (cwd);
-  log (0, "Current Directory: %s", cwd);
+  do_init(h);
 
   while (next_dialog)
     {
       switch (next_dialog)
 	{
 	case IDD_SPLASH:	do_splash (h);	break;
+	case IDD_UNINSTALL:	do_uninstall (h);	break;
 	case IDD_SOURCE:	do_source (h);	break;
 	case IDD_LOCAL_DIR:	do_local_dir (h); break;
 	case IDD_ROOT:		do_root (h);	break;
Index: netinstall/nio-ie5.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/nio-ie5.cc,v
retrieving revision 1.3
diff -u -r1.3 nio-ie5.cc
--- netinstall/nio-ie5.cc	2001/04/13 09:11:35	1.3
+++ netinstall/nio-ie5.cc	2001/09/09 04:26:42
@@ -18,8 +18,6 @@
    must already have installed and configured IE5.  This module is
    called from netio.cc, which is called from geturl.cc */
 
-static char *cvsid = "\n%%% $Id: nio-ie5.cc,v 1.3 2001/04/13 09:11:35 michaels Exp $\n";
-
 #include "win32.h"
 
 #include "resource.h"
Index: netinstall/regedit.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/regedit.cc,v
retrieving revision 1.2
diff -u -r1.2 regedit.cc
--- netinstall/regedit.cc	2001/04/12 18:22:52	1.2
+++ netinstall/regedit.cc	2001/09/09 04:26:42
@@ -180,6 +180,7 @@
 	   path, path);
   RegSetValueEx (key, XEMACS_INFO_XEMACS_PACKAGE_KEY, 
 		 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
+  RegCloseKey (key);
 }
 
 void
@@ -201,8 +202,119 @@
 
   RegSetValueEx (key, "Path", 
 		 0, REG_SZ, (BYTE *)path, strlen (path)+1);
+  RegCloseKey (key);
 }
 
+void
+set_install_path (char* path, int issystem)
+{
+  char buf[1000];
+  HKEY key;
+  DWORD disposition;
+
+  sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs");
+
+  HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+  RegDeleteKey (kr, buf);
+  
+  if (RegCreateKeyEx (kr, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("set_install_path");
+
+  RegSetValueEx (key, "DisplayName", 
+		 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1);
+
+  sprintf (buf, "%s\\setup.exe -u", path);
+  RegSetValueEx (key, "UninstallString", 
+		 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
+  RegCloseKey (key);
+}
+
+void
+setup_explorer (char* file_type, char* name, char *exe)
+{
+  char buf[1000];
+  char ftype[32];
+  HKEY key;
+  DWORD disposition;
+
+  sprintf (buf, ".%s", file_type);
+  RegDeleteKey (HKEY_CLASSES_ROOT, buf);
+
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+
+  // set default key
+  sprintf (ftype, "%sfile", file_type);
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)ftype, strlen (ftype)+1);
+  RegCloseKey (key);
+
+  // create file type entry
+  RegDeleteKey (HKEY_CLASSES_ROOT, ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, ftype, 0, "XEmacs", 
+		      0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+  RegSetValueEx (key, NULL,
+		 0, REG_SZ, (BYTE *)name, strlen (name)+1);
+  RegSetValueEx (key, "AlwaysShowExt",
+		 0, REG_SZ, (BYTE *)"", strlen ("")+1);
+  RegCloseKey (key);
+
+  // make xemacs file the default icon
+  sprintf(buf, "%s\\DefaultIcon", ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+
+  sprintf(buf, "%s,1", exe);
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
+  RegCloseKey (key);
+
+  // command default key (exe)
+  sprintf(buf, "%s\\shell\\Open\\command", ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+
+  sprintf(buf, "\"%s\"", exe);	// Don't need %1 because dde will open the file
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)buf, strlen (buf)+1);
+  RegCloseKey (key);
+
+  // ddeexec
+  sprintf(buf, "%s\\shell\\Open\\ddeexec", ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+
+#define DDE_OPEN "Open(\"%1\")"
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)DDE_OPEN, strlen (DDE_OPEN)+1);
+  RegCloseKey (key);
+
+  // ddeexec application
+  sprintf(buf, "%s\\shell\\Open\\ddeexec\\application", ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)"XEmacs", strlen ("XEmacs")+1);
+  RegCloseKey (key);
+
+  // ddeexec topic
+  sprintf(buf, "%s\\shell\\Open\\ddeexec\\topic", ftype);
+  if (RegCreateKeyEx (HKEY_CLASSES_ROOT, buf, 0, "XEmacs", 0, KEY_ALL_ACCESS,
+		      0, &key, &disposition) != ERROR_SUCCESS)
+    fatal ("setup_explorer");
+  RegSetValueEx (key, NULL, 
+		 0, REG_SZ, (BYTE *)"system", strlen ("system")+1);
+  RegCloseKey (key);
+}
+
 static void
 remove1 (HKEY rkey)
 {
@@ -222,3 +334,23 @@
   remove1 (HKEY_CURRENT_USER);
 }
 
+void
+remove_app_path (char *exe, int issystem)
+{
+  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);
+}
+
+void
+remove_uninstall_path ()
+{
+  char buf[1000];
+  sprintf (buf, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XEmacs");
+
+  RegDeleteKey (HKEY_LOCAL_MACHINE, buf);
+  RegDeleteKey (HKEY_CURRENT_USER, buf);
+}
Index: netinstall/regedit.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/regedit.h,v
retrieving revision 1.2
diff -u -r1.2 regedit.h
--- netinstall/regedit.h	2001/04/12 18:22:53	1.2
+++ netinstall/regedit.h	2001/09/09 04:26:42
@@ -23,4 +23,8 @@
 void	create_xemacs_root (char *posix, int issystem, int isnative);
 void	remove_xemacs_root ();
 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_uninstall_path ();
 
Index: netinstall/reginfo.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/reginfo.h,v
retrieving revision 1.2
diff -u -r1.2 reginfo.h
--- netinstall/reginfo.h	2001/04/12 18:22:53	1.2
+++ netinstall/reginfo.h	2001/09/09 04:26:42
@@ -2,7 +2,7 @@
 
 Copyright (C) 2000 Andy Piper. */
 
-#define XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME "GNU"
+#define XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME "XEmacs"
 #define XEMACS_INFO_XEMACS_REGISTRY_NAME "XEmacs"
 /* Keys */
 #define XEMACS_INFO_XEMACS_ROOT_KEY "emacs_dir"
@@ -20,8 +20,8 @@
 #define XEMACS_PACKAGE_DIR \
   ((char*)(install_type == IDC_INSTALL_NATIVE ? "\\xemacs-packages\\" \
 				    : "/lib/xemacs/xemacs-packages/"))
-#define XEMACS_NATIVE_ARCH_NAME "i386-pc-win32"
-#define XEMACS_CYGWIN_ARCH_NAME "i686-pc-cygwin32"
+#define XEMACS_NATIVE_ARCH_NAME "i586-pc-win32"
+#define XEMACS_CYGWIN_ARCH_NAME "i686-pc-cygwin"
 
 /*
  * Installation hierarchy is:
@@ -35,8 +35,8 @@
  *				\pkginfo
  * 			\site-packages
  *			\mule-packages
- *			\XEmacs-21.2
- *				\i386-pc-win32
+ *			\XEmacs-21.4
+ *				\i586-pc-win32
  *				\etc
  *				\info
  *				\lisp
@@ -45,12 +45,12 @@
  *		/xemacs/xemacs-packages
  * 		/xemacs/site-packages
  *		/xemacs/mule-packages
- *		/xemacs-21.2
- *				/i686-pc-cygwin32
+ *		/xemacs-21.4
+ *				/i686-pc-cygwin
  *				/etc
  *				/info
  *				/lisp
- * /usr/local/bin/i686-pc-cygwin32
+ * /usr/local/bin/i686-pc-cygwin
  */
 
  
Index: netinstall/res.rc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/res.rc,v
retrieving revision 1.3
diff -u -r1.3 res.rc
--- netinstall/res.rc	2001/04/13 09:11:35	1.3
+++ netinstall/res.rc	2001/09/09 04:26:42
@@ -142,7 +142,7 @@
     CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
 END
 
-IDD_NET DIALOG 0, 0, 311, 201
+IDD_NET DIALOG DISCARDABLE  0, 0, 311, 201
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "XEmacs Setup"
 FONT 8, "MS Sans Serif"
@@ -216,6 +216,31 @@
     CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
 END
 
+IDD_UNINSTALL DIALOG DISCARDABLE  0, 0, 311, 201
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | 
+    WS_CAPTION | WS_SYSMENU
+CAPTION "Uninstall XEmacs"
+FONT 8, "MS Sans Serif"
+BEGIN
+    PUSHBUTTON      "Cancel",IDCANCEL,199,176,45,15
+    DEFPUSHBUTTON   "Uninstall",IDOK,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           "Uninstalling Packages",IDC_STATIC,112,10,170,17
+    LTEXT           "(PKG)",IDC_UNINS_PKG,112,26,170,11
+    LTEXT           "(FILE)",IDC_UNINS_FILE,112,41,166,11
+    CONTROL         "Progress1",IDC_UNINS_DISKFULL,"msctls_progress32",
+                    WS_BORDER,123,143,165,10
+    CONTROL         "Progress1",IDC_UNINS_IPROGRESS,"msctls_progress32",
+                    WS_BORDER,125,106,163,10
+    CONTROL         "Progress1",IDC_UNINS_PPROGRESS,"msctls_progress32",
+                    WS_BORDER,125,67,163,10
+    GROUPBOX        "Disk",IDC_STATIC,112,130,186,31
+    GROUPBOX        "Package",IDC_STATIC,112,54,186,31
+    GROUPBOX        "Total",IDC_STATIC,112,93,186,31
+    CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
+END
+
 IDD_PROXY_AUTH DIALOG DISCARDABLE  0, 0, 215, 95
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "XEmacs Setup"
@@ -250,7 +275,7 @@
     PUSHBUTTON      "Cancel",IDCANCEL,165,75,45,15
 END
 
-IDD_SPLASH DIALOG 0, 0, 311, 201
+IDD_SPLASH DIALOG DISCARDABLE  0, 0, 311, 201
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "XEmacs Setup"
 FONT 8, "MS Sans Serif"
@@ -301,16 +326,27 @@
     DEFPUSHBUTTON   "Finish",IDOK,199,176,45,15
     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 has now finished. To create desktop shortcuts, please select from the following options.",
                     IDC_STATIC,112,11,170,17
     LTEXT           "To complete setup click Finish.",IDC_STATIC,112,32,166,
                     17
     CONTROL         "Create Desktop Icon",IDC_ROOT_DESKTOP,"Button",
-                    BS_AUTOCHECKBOX,113,76,100,8
+                    BS_AUTOCHECKBOX,113,50,100,8
     CONTROL         "Add to Start Menu",IDC_ROOT_MENU,"Button",
-                    BS_AUTOCHECKBOX,113,97,100,8
+                    BS_AUTOCHECKBOX,113,66,100,8
+    CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
+    CONTROL         "Text",IDC_TXT_TYPE,"Button",BS_AUTOCHECKBOX,209,101,38,
+                    8
+    CONTROL         "Java",IDC_JAVA_TYPE,"Button",BS_AUTOCHECKBOX,113,100,50,
+                    8
+    CONTROL         "C",IDC_C_TYPE,"Button",BS_AUTOCHECKBOX,113,116,41,8
+    CONTROL         "C++",IDC_CPP_TYPE,"Button",BS_AUTOCHECKBOX,113,133,38,8
+    CONTROL         "E-Lisp",IDC_ELISP_TYPE,"Button",BS_AUTOCHECKBOX,113,148,
+                    38,8
+    LTEXT           "Register XEmacs for these file types:",IDC_STATIC,113,
+                    84,166,13
+    LTEXT           "",IDC_STATIC,10,169,291,1,SS_SUNKEN | NOT WS_GROUP
+    LTEXT           "",IDC_STATIC,10,10,87,151,SS_SUNKEN | NOT WS_GROUP
     CONTROL         "GNU",IDC_STATIC,"Static",SS_BITMAP,19,36,69,62
 END
 
@@ -433,6 +469,7 @@
     IDD_DESKTOP, DIALOG
     BEGIN
         VERTGUIDE, 113
+        VERTGUIDE, 209
     END
 END
 #endif    // APSTUDIO_INVOKED
@@ -449,7 +486,7 @@
 IDB_CHECK_YES           BITMAP  DISCARDABLE     "check-yes.bmp"
 IDB_CHECK_NO            BITMAP  DISCARDABLE     "check-no.bmp"
 IDB_CHECK_NA            BITMAP  DISCARDABLE     "check-na.bmp"
-GNU                 BITMAP  DISCARDABLE     "gnu.bmp"
+GNU                     BITMAP  DISCARDABLE     "gnu.bmp"
 IDB_GNU                 BITMAP  DISCARDABLE     "gnu.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
Index: netinstall/resource.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/resource.h,v
retrieving revision 1.2
diff -u -r1.2 resource.h
--- netinstall/resource.h	2001/04/12 18:22:53	1.2
+++ netinstall/resource.h	2001/09/09 04:26:43
@@ -54,6 +54,7 @@
 #define IDB_CHECK_NO                    124
 #define IDB_CHECK_NA                    125
 #define IDB_GNU                         126
+#define IDD_UNINSTALL                   127
 #define IDC_SOURCE_DOWNLOAD             1000
 #define IDC_SOURCE_NETINST              1001
 #define IDC_SOURCE_CWD                  1002
@@ -94,9 +95,20 @@
 #define IDC_ROOT_DESKTOP                1041
 #define IDC_ROOT_MENU                   1042
 #define IDC_LOCAL_DIR_BROWSE            1043
+#define IDC_TXT_TYPE                    1043
 #define IDC_LOCAL_DIR                   1044
+#define IDC_JAVA_TYPE                   1044
 #define IDC_INSTALL_NATIVE              1045
+#define IDC_C_TYPE                      1045
 #define IDC_INSTALL_CYGWIN              1046
+#define IDC_CPP_TYPE                    1046
+#define IDC_UNINS_PKG                   1047
+#define IDC_ELISP_TYPE                  1047
+#define IDC_UNINS_FILE                  1048
+#define IDC_UNINS_DISKFULL              1049
+#define IDC_UNINS_IPROGRESS             1050
+#define IDC_UNINS_PPROGRESS             1051
+#define IDC_UNINS_ACTION                1052
 #define IDC_STATIC                      -1
 
 // Next default values for new objects
Index: netinstall/root.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/root.cc,v
retrieving revision 1.2
diff -u -r1.2 root.cc
--- netinstall/root.cc	2001/04/12 18:22:54	1.2
+++ netinstall/root.cc	2001/09/09 04:26:43
@@ -137,32 +137,6 @@
     }
 }
 
-static void
-read_mount_table ()
-{
-  int isnative, issystem;
-  root_dir = find_root_location (&issystem, &isnative);
-  if (root_dir)
-    {
-      if (isnative)
-	install_type = IDC_INSTALL_NATIVE;
-      else
-	install_type = IDC_INSTALL_CYGWIN;
-
-      if (issystem)
-	root_scope = IDC_ROOT_SYSTEM;
-      else
-	root_scope = IDC_ROOT_USER;
-      root_dir_default = 0;
-    }
-  else
-    {
-      change_default_root (IDC_INSTALL_NATIVE);
-      root_scope = (is_admin()) ? IDC_ROOT_SYSTEM : IDC_ROOT_USER;
-      root_dir_default = 1;
-    }
-}
-
 static int CALLBACK
 browse_cb (HWND h, UINT m, LPARAM lp, LPARAM data)
 {
@@ -317,11 +291,21 @@
   return FALSE;
 }
 
+static void
+set_default_root ()
+{
+  change_default_root (IDC_INSTALL_NATIVE);
+  root_scope = (is_admin()) ? IDC_ROOT_SYSTEM : IDC_ROOT_USER;
+  root_dir_default = 1;
+}
+
 void
 do_root (HINSTANCE h)
 {
   int rv = 0;
-  read_mount_table ();
+  // init will have read a previous root
+  if (!root_dir)
+    set_default_root ();
 
   rv = DialogBox (h, MAKEINTRESOURCE (IDD_ROOT), 0, dialog_proc);
   if (rv == -1)
Index: netinstall/splash.cc
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/splash.cc,v
retrieving revision 1.2
diff -u -r1.2 splash.cc
--- netinstall/splash.cc	2001/04/12 18:22:55	1.2
+++ netinstall/splash.cc	2001/09/09 04:26:43
@@ -68,7 +68,6 @@
 do_splash (HINSTANCE h)
 {
   int rv = 0;
-  HANDLE gnu = LoadImage (h, MAKEINTRESOURCE (IDB_GNU), IMAGE_BITMAP, 0, 0, 0);
   rv = DialogBox (h, MAKEINTRESOURCE (IDD_SPLASH), 0, dialog_proc);
   if (rv == -1)
     fatal (IDS_DIALOG_FAILED);
Index: netinstall/state.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/state.h,v
retrieving revision 1.2
diff -u -r1.2 state.h
--- netinstall/state.h	2001/04/12 18:22:55	1.2
+++ netinstall/state.h	2001/09/09 04:26:43
@@ -29,6 +29,12 @@
 extern int   root_menu;
 extern int   root_desktop;
 
+extern int   reg_c;
+extern int   reg_cpp;
+extern int   reg_java;
+extern int   reg_elisp;
+extern int   reg_txt;
+	
 extern int	net_method;
 extern char *	net_proxy_host;
 extern int	net_proxy_port;
@@ -42,5 +48,6 @@
 extern char *	other_url;
 
 extern int	trust_level;
+extern int	uninstall;
 
 #define MIRROR_SITE (mirror_site ? mirror_site : other_url)
Index: netinstall/uninstall.cc
===================================================================
RCS file: uninstall.cc
diff -N uninstall.cc
--- /dev/null	Sat Sep  8 20:45:56 2001
+++ uninstall.cc	Sat Sep  8 21:26:43 2001
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2000, Red Hat, Inc.
+ *
+ *     This program is free software; you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation; either version 2 of the License, or
+ *     (at your option) any later version.
+ *
+ *     A copy of the GNU General Public License can be found at
+ *     http://www.gnu.org/
+ *
+ * Written by DJ Delorie <dj@cygnus.com>
+ *
+ */
+
+/* The purpose of this file is to intall all the packages selected in
+   the install list (in ini.h).  Note that we use a separate thread to
+   maintain the progress dialog, so we avoid the complexity of
+   handling two tasks in one thread.  We also create or update all the
+   files in /etc/setup and create the mount points. */
+
+#include <io.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#ifndef WIN32_NATIVE
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <zlib.h>
+
+#include "win32.h"
+#include "commctrl.h"
+
+#include "resource.h"
+#include "ini.h"
+#include "dialog.h"
+#include "concat.h"
+#include "geturl.h"
+#include "mkdir.h"
+#include "state.h"
+#include "tar.h"
+#include "diskfull.h"
+#include "msg.h"
+#include "regedit.h"
+#include "reginfo.h"
+#include "log.h"
+#include "hash.h"
+
+#include "port.h"
+
+#define XM_DONE (WM_USER + 101)
+
+static HWND unins_dialog = 0;
+static HWND unins_action = 0;
+static HWND unins_pkgname = 0;
+static HWND unins_filename = 0;
+static HWND unins_pprogress = 0;
+static HWND unins_iprogress = 0;
+static HWND unins_diskfull = 0;
+static HANDLE init_event;
+
+static int package_bytes = 0;
+static int uninstall_started = 0;
+
+extern char * map_filename (char *fn, int type);
+void remove_desktop_setup ();
+static void start_uninstall ();
+
+char *
+base (char *s);
+
+static BOOL
+dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
+{
+  switch (id)
+    {
+    case IDCANCEL:
+      exit_setup (1);
+    case IDOK:
+      if (uninstall_started == 0) {
+	uninstall_started = 1;
+	start_uninstall();
+      }
+      else
+	exit_setup(0);
+      break;
+    }
+  return FALSE;
+}
+
+static BOOL CALLBACK
+dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
+{
+  switch (message)
+    {
+    case WM_INITDIALOG:
+      unins_dialog = h;
+      unins_action = GetDlgItem (h, IDC_UNINS_ACTION);
+      unins_pkgname = GetDlgItem (h, IDC_UNINS_PKG);
+      unins_filename = GetDlgItem (h, IDC_UNINS_FILE);
+      unins_pprogress = GetDlgItem (h, IDC_UNINS_PPROGRESS);
+      unins_iprogress = GetDlgItem (h, IDC_UNINS_IPROGRESS);
+      unins_diskfull = GetDlgItem (h, IDC_UNINS_DISKFULL);
+      SendMessage (unins_pprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
+      SendMessage (unins_iprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
+      SendMessage (unins_diskfull, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
+      SetWindowText (unins_pkgname, "");
+      SetWindowText (unins_filename, "");
+      SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) 0, 0);
+      SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) 0, 0);
+      SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) 0, 0);
+      return FALSE;
+
+    case XM_DONE:
+      {
+	SetWindowText (GetDlgItem (h, IDOK), "Ok");
+	LONG style = GetWindowLong (GetDlgItem (h, IDCANCEL),
+				    GWL_STYLE);
+	SetWindowLong (GetDlgItem (h, IDCANCEL),
+		       GWL_STYLE, style & WS_DISABLED);
+      }
+      return FALSE;
+      
+    case WM_COMMAND:
+      return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
+    }
+  return DefWindowProc (h, message, wParam, lParam);
+}
+
+static DWORD WINAPI uninstall_all (void *);
+
+static void
+start_uninstall ()
+{
+  DWORD tid;
+  HANDLE thread;
+  init_event = CreateEvent (0, 0, 0, 0);
+  thread = CreateThread (0, 0, uninstall_all, 0, 0, &tid);
+  WaitForSingleObject (init_event, 10000);
+  CloseHandle (init_event);
+}
+
+static void
+progress (int bytes, int num)
+{
+  int perc;
+  log (0, "%d bytes", bytes);
+  if (package_bytes > 100)
+    {
+      perc = (bytes * 100) / package_bytes;
+      SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) perc, 0);
+    }
+
+  if (npackages > 0)
+    {
+      perc = (num * 100) / npackages;
+      SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) perc, 0);
+    }
+}
+
+static int num_installs, num_uninstalls;
+
+static void
+uninstall_one (char *name, int type, int num)
+{
+  hash dirs;
+  char line[_MAX_PATH];
+  char* fname = (type == TY_GENERIC ? 
+		 concat (root_dir, XEMACS_PACKAGE_DIR, "pkginfo/MANIFEST.",
+			 name,  0) :
+		 concat (root_dir, XEMACS_SETUP_DIR, "MANIFEST.", name,  0));
+
+  FILE* lst = fopen (fname, "rb");
+  int pos = 0;
+
+  if (lst)
+    {
+      fseek (lst, 0, SEEK_END);
+      package_bytes = ftell (lst);
+      fseek (lst, 0, SEEK_SET);
+  
+      SetWindowText (unins_pkgname, name);
+      SetWindowText (unins_action, "Uninstalling...");
+      log (0, "uninstalling %s", name);
+
+      while (fgets (line, sizeof (line), lst))
+	{
+	  progress (pos, num);
+	  pos += strlen(line);
+	  if (line[strlen(line)-1] == '\n')
+	    line[strlen(line)-1] = 0;
+
+	  dirs.add_subdirs (line);
+
+	  char *d = map_filename (line, type);
+	  DWORD dw = GetFileAttributes (d);
+	  if (dw != 0xffffffff && !(dw & FILE_ATTRIBUTE_DIRECTORY))
+	    {
+	      log (LOG_BABBLE, "unlink %s", d);
+	      DeleteFile (d);
+	    }
+	}
+      fclose (lst);
+      remove (fname);
+
+      dirs.reverse_sort ();
+      char *subdir = 0;
+      while ((subdir = dirs.enumerate (subdir)) != 0)
+	{
+	  char *d = map_filename (subdir, type);
+	  if (RemoveDirectory (d))
+	    log (LOG_BABBLE, "rmdir %s", d);
+	}
+      num_uninstalls ++;
+    }
+}
+
+void
+do_uninstall (HINSTANCE h)
+{
+  num_installs = 0, num_uninstalls = 0;
+
+  next_dialog = 0;		// we're done after this
+
+  if (!root_dir)
+    fatal ("no installation found");
+
+  int rv = DialogBox (h, MAKEINTRESOURCE (IDD_UNINSTALL), 0, dialog_proc);
+  if (rv == -1)
+    fatal (IDS_DIALOG_FAILED);
+}
+
+static void
+read_installed_db ()
+{
+  if (!root_dir)
+    return;
+
+  char line[1000], pkg[1000], inst[1000], src[1000];
+  int instsz, srcsz;
+
+  FILE *db = fopen (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0), "rt");
+  if (!db)
+    return;
+
+  while (fgets (line, 1000, db))
+    {
+      src[0] = 0;
+      srcsz = 0;
+      sscanf (line, "%s %s %d %s %d", pkg, inst, &instsz, src, &srcsz);
+
+      log (0, "read %s", pkg);
+      Package* np = new_package(strdup(pkg));
+      pinfo(*np).install = inst;
+      pinfo(*np).install_size = instsz;
+      // pick up versoin
+      char *v, *d;
+      for (v=base (inst); *v; v++)
+	if (*v == '-' && isdigit(v[1]))
+	  {
+	    v++;
+	    break;
+	  }
+      if (!v)
+	v = inst;
+      for (d=v; *d; d++)
+	if (strncmp (d, ".tar", 4) == 0
+	    || strncmp (d, "-pkg", 4) == 0)
+	  {
+	    *d = 0;
+	    break;
+	  }
+      if (v[0])
+	pinfo(*np).version = strdup (v);
+      else
+	pinfo(*np).version = "0";
+      // Crude but effective
+      if (pkg != 0)
+	if (strncmp ("xemacs-i686", pkg, 11) == 0
+	    || (strncmp ("xemacs-i586", pkg, 11) == 0))
+	  np->type = install_type;
+    }
+  fclose (db);
+}
+
+static DWORD WINAPI
+uninstall_all (void *)
+{
+  int i;
+  SetEvent (init_event);
+
+  int df = diskfull (root_dir);
+  SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) df, 0);
+
+  read_installed_db();
+
+  log (0, "There are %d packages\n", npackages);
+  for (i=0; i<npackages; i++)
+    {
+      log (0, "uninstalling %s\n", package[i].name);
+      uninstall_one (package[i].name, package[i].type, i);
+    }
+
+  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 (sdbn);
+  remove (odbn);
+
+  remove_xemacs_root();
+  remove_uninstall_path();
+
+  if (num_installs == 0)
+    {
+      //      exit_msg = IDS_UNINSTALL_COMPLETE;
+      return FALSE;
+    }
+
+  return FALSE;
+}
Index: netinstall/win32.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/netinstall/win32.h,v
retrieving revision 1.2
diff -u -r1.2 win32.h
--- netinstall/win32.h	2001/04/12 18:22:56	1.2
+++ netinstall/win32.h	2001/09/09 04:26:43
@@ -21,24 +21,14 @@
 #ifndef _MINI_WIN32_
 #define _MINI_WIN32_
 
-#define _UNION_NAME(x)
-#define _STRUCT_NAME(x)
 #define NOCOMATTRIBUTE
 
 #include <stdarg.h>
-#ifdef WIN32_NATIVE
-/* MSVC is barking with the list above, something else is missing, so
-   I'm using <windows.h> and lean-n-mean. FP, 2000-23-12 */
+
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#endif
-#include <windef.h>
-#include <basetyps.h>
-#include <winbase.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <wininet.h>
-#include <winreg.h>
 
+#include <wininet.h>
 #include <windowsx.h>
 
 /* Cope with native win32 & mingw differences.  Written by F. Popineau


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]