[PATCH] regtool: Ignore /proc/registry{,32,64}/ prefix, with forward or backslashes, allowing path completion

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Sun Nov 10 16:17:00 GMT 2019


---
 winsup/utils/regtool.cc | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
index a44d90768..ddb1304cd 100644
--- a/winsup/utils/regtool.cc
+++ b/winsup/utils/regtool.cc
@@ -167,7 +167,9 @@ usage (FILE *where = stderr)
       "  users    HKU   HKEY_USERS\n"
       "\n"
       "If the keyname starts with a forward slash ('/'), the forward slash is used\n"
-      "as separator and the backslash can be used as escape character.\n");
+      "as separator and the backslash can be used as escape character.\n"
+      "If the keyname starts with /proc/registry{,32,64}/, using forward or backward\n"
+      "slashes, allowing path completion, that part of the prefix is ignored.\n");
       fprintf (where, ""
       "Example:\n"
       "%s list '/machine/SOFTWARE/Classes/MIME/Database/Content Type/audio\\/wav'\n\n", prog_name);
@@ -350,6 +352,15 @@ find_key (int howmanyparts, REGSAM access, int option = 0)
       *h = 0;
       n = e;
     }
+  else if (strncmp ("\\proc\\registry", n, strlen ("\\proc\\registry")) == 0)
+    {
+      /* skip /proc/registry{,32,64}/ prefix */
+      n += strlen ("\\proc\\registry"); 
+      if (strncmp ("64", n, strlen ("64")) == 0)
+        n += strlen ("64"); 
+      else if (strncmp ("32", n, strlen ("32")) == 0)
+        n += strlen ("32"); 
+    }
   while (*n != '\\')
     n++;
   *n++ = 0;
-- 
2.21.0



More information about the Cygwin-patches mailing list