This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inconsistent behavior for Win32 executable: starting from bashvs. starting from cmd.exe


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]