Unable to execute Cygwin application within UDF format

Takashi Yano takashi.yano@nifty.ne.jp
Fri May 27 12:36:29 GMT 2022


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>


More information about the Cygwin mailing list