This is the mail archive of the mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(patch) reg_key copy construction bug

The following fix is hopefully obvious. Think of what happens when you 
pass a copy of a (open) reg_key to a function -- it calls the destructor 
on the way back, and so the does the original and RegClose crashes trying.

The current implementation of reg_key is dangerous in that it blindly
allows a copy construction;  it should really disable copying by using
a private copy. However that'll break the subkey generation, so it'll 
take a bit of rework.

The current code should always crash in mount_info::from_registry ()
when Cygwin1.dll starts up.

Against ss-1999-04-27.

Thu Apr 29 13:55:57 1999  Mumit Khan  <>

	* shared.h (read_mounts): Change prototype to accept a reference
	to reg_key, not a copy.
	* (read_mounts): Likewise.

--- shared.h.~1	Thu Apr 29 13:51:51 1999
+++ shared.h	Thu Apr 29 13:52:13 1999
@@ -335,7 +335,7 @@ public:
   void sort ();
-  void read_mounts (reg_key r);
+  void read_mounts (reg_key& r);
   void read_v1_mounts (reg_key r, const int which);
   void mount_slash ();
   void to_registry ();
---	Thu Apr 29 13:55:20 1999
+++	Thu Apr 29 13:52:19 1999
@@ -1158,7 +1158,7 @@ mount_info::binary_win32_path_p (const c
    key. */
-mount_info::read_mounts (reg_key r)
+mount_info::read_mounts (reg_key& r)
   HKEY key = r.get_key ();
   LONG err;