Mail Archives: cygwin/2005/07/11/11:51:58
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 -