This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

handle_to_fn question


Hello, there! :)

I may be wrong but this code from handle_to_fn seems wrong to me:

static char *
handle_to_fn (HANDLE h, char *posix_fn)
{
  OBJECT_NAME_INFORMATION *ntfn;
  char fnbuf[32768];

  memset (fnbuf, 0, sizeof (fnbuf));
  ntfn = (OBJECT_NAME_INFORMATION *) fnbuf;
  
  // If I'm right for the case below this should read sizeof (fnbuf) -
  // sizeof (OBJECT_NAME_INFORMATION).
  ntfn->Name.MaximumLength = sizeof (fnbuf);

  // I think that the right hand of the assignment is incorrect and it should be
  // (WCHAR *) (ntfn + 1). Now it seems like ntfn->Name.Buffer will be
  // assigned the addres of ntfn->Name.MaximumLength.
  ntfn->Name.Buffer = (WCHAR *) ntfn + 1;
  

  DWORD res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf), NUL
L);


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]