Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
In-Reply-To: <Pine.GSO.4.61.0507111118450.7597@slinky.cs.nyu.edu>
To: cygwin@cygwin.com
Subject: Re: Inconsistent behavior for Win32 executable: starting from 	bashvs. starting   from cmd.exe
MIME-Version: 1.0
Message-ID: <OF7858FAF2.9A67AE6E-ONC125703B.00557A98-C125703B.0057219A@philips.com>
From: Ljubomir Milanovic <ljubomir.milanovic@philips.com>
Date: Mon, 11 Jul 2005 17:49:25 +0200
Content-Type: text/plain; charset="US-ASCII"

Igor Pechtchanski wrote on 11.07.2005 17:25:34:

> On Mon, 11 Jul 2005, Ljubomir Milanovic wrote:
> 
> >
> >         DWORD cbBuff = 2048;    // Size of Buffer
> >         TCHAR szBuff[2048];     // Buffer to receive information
> >
> >         UNIVERSAL_NAME_INFO *puni = (UNIVERSAL_NAME_INFO *)&szBuff; // 
Pointers to head of buffer
> 
> Would
> 
> UNIVERSAL_NAME_INFO szBuff;
> UNIVERSAL_NAME_INFO *puni = &szBuff;
> 
> work better?  I'm not familiar with UNIVERSAL_NAME_INFO, but the above
> assumes it's no larger than 2k in size.
> 

The original example code is taken from MSDN library, and I think 
WNetGetUniversalName
requires buffer because UNIVERSAL_NAME_INFO has char* member, and 
WNetGetUn... uses
memory from buffer as space for this char*.
However, original code works from cmd.exe and from MS VS debugger too, but 
from bash not.

Your code results in error code 234 = ERROR_MORE_DATA = "More data is 
available",
which is probably windows way of saying that buffer is too small. And 
started from
bash it results in the "old" error 487 = ERROR_INVALID_ADDRESS = "Attempt 
to access invalid address."
indicating that buffer address is somehow illegal.

Bye,
Ljubo

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

