[RFA] Fix cygwin compilation failure due to nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing

Corinna Vinschen vinschen@redhat.com
Wed Dec 18 19:18:00 GMT 2013


On Dec 18 20:18, Eli Zaretskii wrote:
> > Date: Wed, 18 Dec 2013 18:31:55 +0100
> > From: Corinna Vinschen <vinschen@redhat.com>
> > 
> > > So lifting the 260-char limit means both go to Unicode _and_ use the
> > > \\?\ format of file names, is that right?
> > 
> > Right.
> > 
> > > If so, it probably means
> > > that CRT functions that accept wchar_t arrays as file names (_wfopen
> > > etc.) cannot be used with such long file names, and one needs to call
> > > the Win32 APIs directly.  Correct?
> > 
> > I don't know, but I doubt it.  The filenames in case of calling the
> > _wfopen functions are probably sent directly to the underlying WIn32
> > functions.
> 
> I don't think they can do that, because it would mean that relative
> file names, "../foo", etc. are forbidden for _wfopen.  The CRT
> functions must go through file-name normalization, so unless they
> detect \\?\ file names up front and refrain from any processing, the
> long file names will not work, because the normalization routines are
> where these limitations live, AFAIK.

There's a lot of theory here.  Did you actually *try* it?  I just
did:

===========================================
#include <stdio.h>
#include <errno.h>

int main(void)
{
  FILE *fp;

  fp = _wfopen (L"\\\\?\\C:\\Windows\\System32\\ntdll.dll", L"r");
  if (!fp)
    printf ("_wfopen w/ long pathname fails, errno = %d\n", errno);
  else
    {
      printf ("_wfopen w/ long pathname works\n");
      fclose(fp);
    }
   return 0;
}
===========================================


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20131218/0f09a919/attachment.sig>


More information about the Gdb-patches mailing list