delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/04/13:29:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 4 Jun 2002 18:28:33 +0200
From: Pavel Tsekov <ptsekov AT syntrex DOT com>
Reply-To: Pavel Tsekov <cygwin AT cygwin DOT com>
Organization: Syntrex, Inc.
X-Priority: 3 (Normal)
Message-ID: <9929150115.20020604182833@syntrex.com>
To: cygwin AT cygwin DOT com
Subject: handle_to_fn question
MIME-Version: 1.0

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019