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 In-Reply-To: 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: From: Ljubomir Milanovic 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/