public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Unable to execute Cygwin application within UDF format
Date: Fri, 27 May 2022 21:36:29 +0900	[thread overview]
Message-ID: <20220527213629.64893e46789e0e6f7244b0fd@nifty.ne.jp> (raw)
In-Reply-To: <20220527212813.9bdc5d02d5da3172103bbbce@nifty.ne.jp>

On Fri, 27 May 2022 21:28:13 +0900
Takashi Yano wrote:
> On Fri, 27 May 2022 19:51:23 +0900
> Takashi Yano wrote:
> > diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
> > index 01b49468e..c4031b919 100644
> > --- a/winsup/cygwin/cygheap.cc
> > +++ b/winsup/cygwin/cygheap.cc
> > @@ -183,6 +183,8 @@ init_cygheap::init_installation_root ()
> >  	  if (p)
> >  	    p = wcschr (p + 1, L'\\');  /* Skip share name */
> >  	}
> > +      else
> > +	p = installation_root_buf + 4; /* 4 is the length of "\\\\?\\" */
> >      }
> >    installation_root_buf[1] = L'?';
> >    RtlInitEmptyUnicodeString (&installation_key, installation_key_buf,
> 
> I think the following patch makes more sense.
> 
> diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
> index 01b49468e..5623c9f5f 100644
> --- a/winsup/cygwin/cygheap.cc
> +++ b/winsup/cygwin/cygheap.cc
> @@ -183,6 +183,11 @@ init_cygheap::init_installation_root ()
>  	  if (p)
>  	    p = wcschr (p + 1, L'\\');  /* Skip share name */
>  	}
> +      else if (!wcsncmp (p + 2, L"?\\", 2))
> +	{
> +	  len = 4;
> +	  p = installation_root_buf + 4;
> +	}
>      }
>    installation_root_buf[1] = L'?';
>    RtlInitEmptyUnicodeString (&installation_key, installation_key_buf,

Ah, wcsncmp() check is redundant here. So it is better:

diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 01b49468e..34c9e2bc7 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -183,6 +183,11 @@ init_cygheap::init_installation_root ()
 	  if (p)
 	    p = wcschr (p + 1, L'\\');  /* Skip share name */
 	}
+      else
+	{
+	  len = 4;
+	  p = installation_root_buf + 4;
+	}
     }
   installation_root_buf[1] = L'?';
   RtlInitEmptyUnicodeString (&installation_key, installation_key_buf,


-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  reply	other threads:[~2022-05-27 12:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  3:36 Sam Lin
2022-05-27  4:31 ` Takashi Yano
2022-05-27  8:43   ` Takashi Yano
2022-05-27  8:47   ` Sam Lin
2022-05-27  9:18     ` Takashi Yano
2022-05-27 10:51       ` Takashi Yano
2022-05-27 12:28         ` Takashi Yano
2022-05-27 12:36           ` Takashi Yano [this message]
2022-05-28 13:22             ` Ken Brown
2022-05-28 14:25               ` Takashi Yano
2022-05-27 17:41       ` Sam Edge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527213629.64893e46789e0e6f7244b0fd@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).