Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 14:07:12 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: handle_to_fn question Message-ID: <20020604180712.GB1586@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <9929150115 DOT 20020604182833 AT syntrex DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9929150115.20020604182833@syntrex.com> User-Agent: Mutt/1.3.23.1i On Tue, Jun 04, 2002 at 06:28:33PM +0200, Pavel Tsekov wrote: >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; It's easy enough to test your theories by running this in a debugger. Have you done so? cgf -- 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/