delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/11/06/09:04:42

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Mon, 6 Nov 2000 09:04:35 -0500
From: Jason Tishler <Jason DOT Tishler AT dothill DOT com>
To: Cygwin-Developers <cygwin-developers AT sources DOT redhat DOT com>
Subject: setup.exe cygdrive patch
Message-ID: <20001106090434.G196@dothill.com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
Organization: Dot Hill Systems Corp.

--fJTEvxt9BaY1Ejyj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

See attached for the setup.exe patch that makes the cygdrive mount mode
consistent with the mount mode selected by the user during installation.

The following is the cinstall ChangeLog:

Sun Nov  5 12:51:42 2000 Jason Tishler <jt AT dothill DOT com>

    * install.cc (do_install): Add call to set_cygdrive_flags to sync
    the mount modes.
    * mount.cc (set_cygdrive_flags): New function.
    * mount.cc (get_cygdrive_flags): Ditto.
    * mount.cc (default_cygdrive): Ditto.
    * mount.cc (set_cygdrive_flags): Ditto.
    * mount.h: Add prototype for set_cygdrive_flags.

The following is the cygwin ChangeLog:

Sun Nov  5 12:51:42 2000 Jason Tishler <jt AT dothill DOT com>

    * path.cc (mount_info::read_cygdrive_info_from_registry): Use
    CYGWIN_INFO_CYGDRIVE_PREFIX, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX,
    and CYGWIN_INFO_CYGDRIVE_FLAGS.
    * path.cc (mount_info::write_cygdrive_info_to_registry): Use
    CYGWIN_INFO_CYGDRIVE_PREFIX and CYGWIN_INFO_CYGDRIVE_FLAGS.
    * path.cc (mount_info::remove_cygdrive_info_from_registry): Ditto.
    * path.cc (mount_info::get_cygdrive_prefixes): Use
    CYGWIN_INFO_CYGDRIVE_PREFIX.
    * include/cygwin/version.h: Add CYGWIN_INFO_CYGDRIVE_FLAGS,
    CYGWIN_INFO_CYGDRIVE_PREFIX, and CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--fJTEvxt9BaY1Ejyj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="CygdriveSetup.patch"

Index: cinstall/install.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/install.cc,v
retrieving revision 2.7
diff -u -p -r2.7 install.cc
--- install.cc	2000/10/23 19:46:01	2.7
+++ install.cc	2000/11/05 18:34:32
@@ -523,6 +523,7 @@ do_install (HINSTANCE h)
   create_mount ("/", root_dir, istext, issystem);
   create_mount ("/usr/bin", concat (root_dir, "/bin", 0), istext, issystem);
   create_mount ("/usr/lib", concat (root_dir, "/lib", 0), istext, issystem);
+  set_cygdrive_flags (istext, issystem);
 
   if (errors)
     exit_msg = IDS_INSTALL_INCOMPLETE;
Index: cinstall/mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mount.cc,v
retrieving revision 2.1
diff -u -p -r2.1 mount.cc
--- mount.cc	2000/08/11 18:00:38	2.1
+++ mount.cc	2000/11/05 18:34:32
@@ -139,3 +139,90 @@ remove_mount (char *posix)
   remove1 (HKEY_LOCAL_MACHINE, posix);
   remove1 (HKEY_CURRENT_USER, posix);
 }
+
+static void
+set_cygdrive_flags (HKEY key, int istext, DWORD cygdrive_flags)
+{
+  int cur_istext = (cygdrive_flags & MOUNT_BINARY) ? 0 : 1;
+  if (cur_istext != istext)
+    {
+      if (!istext)
+	cygdrive_flags |= MOUNT_BINARY;
+      else
+	cygdrive_flags &= ~MOUNT_BINARY;
+      RegSetValueEx (key, CYGWIN_INFO_CYGDRIVE_FLAGS, 0, REG_DWORD,
+		     (BYTE *)&cygdrive_flags, sizeof (cygdrive_flags));
+    }
+}
+
+static LONG
+get_cygdrive_flags (HKEY key, DWORD *cygdrive_flags)
+{
+  DWORD retvallen = sizeof(*cygdrive_flags);
+  LONG status = RegQueryValueEx (key, CYGWIN_INFO_CYGDRIVE_FLAGS, 0, 0,
+				 (BYTE *)cygdrive_flags, &retvallen);
+  return status;
+}
+
+static DWORD
+default_cygdrive(HKEY key)
+{
+  RegSetValueEx (key, CYGWIN_INFO_CYGDRIVE_PREFIX, 0, REG_SZ,
+		 (BYTE *)CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX,
+		 strlen (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX) + 1);
+  DWORD cygdrive_flags = MOUNT_AUTO;
+  RegSetValueEx (key, CYGWIN_INFO_CYGDRIVE_FLAGS, 0, REG_DWORD,
+		 (BYTE *)&cygdrive_flags, sizeof (cygdrive_flags));
+  return cygdrive_flags;
+}
+
+void
+set_cygdrive_flags (int istext, int issystem)
+{
+  int found_system = 0;
+
+  char buf[1000];
+  sprintf (buf, "Software\\%s\\%s\\%s",
+	   CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
+	   CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
+	   CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
+
+  if (issystem)
+    {
+      HKEY key;
+      DWORD disposition;
+      LONG status = RegCreateKeyEx (HKEY_LOCAL_MACHINE, buf, 0, 0, 0,
+      				    KEY_ALL_ACCESS, 0, &key, &disposition);
+      if (status == ERROR_SUCCESS)
+	{
+	  DWORD cygdrive_flags = 0;
+	  status = get_cygdrive_flags (key, &cygdrive_flags);
+	  if (status == ERROR_SUCCESS)
+	    {
+	      set_cygdrive_flags (key, istext, cygdrive_flags);
+	      found_system = 1;
+	    }
+	  RegCloseKey(key);
+	}
+    }
+
+  HKEY key;
+  DWORD disposition;
+  LONG status = RegCreateKeyEx (HKEY_CURRENT_USER, buf, 0, 0, 0, KEY_ALL_ACCESS,
+				0, &key, &disposition);
+  if (status != ERROR_SUCCESS)
+    fatal ("set_cygdrive_flags");
+
+  DWORD cygdrive_flags = 0;
+  status = get_cygdrive_flags (key, &cygdrive_flags);
+  if (status == ERROR_FILE_NOT_FOUND && !found_system)
+    {
+      cygdrive_flags = default_cygdrive(key);
+      status = ERROR_SUCCESS;
+    }
+
+  if (status == ERROR_SUCCESS)
+    set_cygdrive_flags (key, istext, cygdrive_flags);
+
+  RegCloseKey(key);
+}
Index: cinstall/mount.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mount.h,v
retrieving revision 2.0
diff -u -p -r2.0 mount.h
--- mount.h	2000/08/08 00:27:54	2.0
+++ mount.h	2000/11/05 18:34:32
@@ -23,3 +23,8 @@ char *	find_root_mount (int *istext, int
 
 void	create_mount (char *posix, char *win32, int istext, int issystem);
 void	remove_mount (char *posix);
+
+/* Sets the cygdrive flags.  Used to make the automounted drives' binary/text
+mode consistent with the standard Cygwin mounts. */
+
+void set_cygdrive_flags (int istext, int issystem);
Index: cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.77
diff -u -p -r1.77 path.cc
--- path.cc	2000/11/02 02:15:02	1.77
+++ path.cc	2000/11/05 18:34:50
@@ -1502,7 +1502,8 @@ mount_info::read_cygdrive_info_from_regi
   /* reg_key for user path prefix in HKEY_CURRENT_USER. */
   reg_key r;
 
-  if (r.get_string ("cygdrive prefix", cygdrive, sizeof (cygdrive), "") != 0)
+  if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive),
+      "") != 0)
     {
       /* Didn't find the user path prefix so check the system path prefix. */
 
@@ -1513,17 +1514,19 @@ mount_info::read_cygdrive_info_from_regi
 		 CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
 		 NULL);
 
-    if (r2.get_string ("cygdrive prefix", cygdrive, sizeof (cygdrive), "") != 0)
+    if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive),
+	"") != 0)
       {
 	/* Didn't find either so write the default to the registry and use it.
 	   NOTE: We are writing and using the user path prefix.  */
-	write_cygdrive_info_to_registry ("/cygdrive", MOUNT_AUTO);
+	write_cygdrive_info_to_registry (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX,
+					 MOUNT_AUTO);
       }
     else
       {
 	/* Fetch system cygdrive_flags from registry; returns MOUNT_AUTO on
 	   error. */
-	cygdrive_flags = r2.get_int ("cygdrive flags", MOUNT_AUTO);
+	cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
 	slashify (cygdrive, cygdrive, 1);
 	cygdrive_len = strlen(cygdrive);
       }
@@ -1532,7 +1535,7 @@ mount_info::read_cygdrive_info_from_regi
     {
       /* Fetch user cygdrive_flags from registry; returns MOUNT_AUTO on
 	 error. */
-      cygdrive_flags = r.get_int ("cygdrive flags", MOUNT_AUTO);
+      cygdrive_flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
       slashify (cygdrive, cygdrive, 1);
       cygdrive_len = strlen(cygdrive);
     }
@@ -1571,13 +1574,13 @@ mount_info::write_cygdrive_info_to_regis
   nofinalslash (cygdrive_prefix, hold_cygdrive_prefix);
 
   int res;
-  res = r.set_string ("cygdrive prefix", hold_cygdrive_prefix);
+  res = r.set_string (CYGWIN_INFO_CYGDRIVE_PREFIX, hold_cygdrive_prefix);
   if (res != ERROR_SUCCESS)
     {
       __seterrno_from_win_error (res);
       return -1;
     }
-  r.set_int ("cygdrive flags", flags);
+  r.set_int (CYGWIN_INFO_CYGDRIVE_FLAGS, flags);
 
   /* This also needs to go in the in-memory copy of "cygdrive", but only if
      appropriate:
@@ -1609,8 +1612,8 @@ mount_info::remove_cygdrive_info_from_re
 	     NULL);
 
   /* Delete cygdrive prefix and flags. */
-  int res = r.killvalue ("cygdrive prefix");
-  int res2 = r.killvalue ("cygdrive flags");
+  int res = r.killvalue (CYGWIN_INFO_CYGDRIVE_PREFIX);
+  int res2 = r.killvalue (CYGWIN_INFO_CYGDRIVE_FLAGS);
 
   /* Reinitialize the cygdrive path prefix to reflect to removal from the
      registry. */
@@ -1624,7 +1627,7 @@ mount_info::get_cygdrive_prefixes (char 
 {
   /* Get the user path prefix from HKEY_CURRENT_USER. */
   reg_key r;
-  int res = r.get_string ("cygdrive prefix", user, MAX_PATH, "");
+  int res = r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, user, MAX_PATH, "");
 
   /* Get the system path prefix from HKEY_LOCAL_MACHINE. */
   reg_key r2 (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
@@ -1632,7 +1635,7 @@ mount_info::get_cygdrive_prefixes (char 
 	      CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
 	      CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
 	      NULL);
-  int res2 = r2.get_string ("cygdrive prefix", system, MAX_PATH, "");
+  int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, "");
 
   return (res != ERROR_SUCCESS) ? res : res2;
 }
Index: cygwin/include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.19
diff -u -p -r1.19 version.h
--- version.h	2000/10/30 01:53:02	1.19
+++ version.h	2000/11/05 18:34:56
@@ -156,6 +156,9 @@ details. */
 #define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin"
 #define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options"
 #define CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME "mounts v2"
+#define CYGWIN_INFO_CYGDRIVE_FLAGS "cygdrive flags"
+#define CYGWIN_INFO_CYGDRIVE_PREFIX "cygdrive prefix"
+#define CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX "/cygdrive"
 
      /* In addition to the above version number strings, the build
 	process adds some strings that may be useful in

--fJTEvxt9BaY1Ejyj--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019