delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/11/11:51:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
In-Reply-To: <Pine.GSO.4.61.0507111118450.7597@slinky.cs.nyu.edu>
To: cygwin AT cygwin DOT 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 DOT milanovic AT philips DOT com>
Date: Mon, 11 Jul 2005 17:49:25 +0200

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/

- Raw text -


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