mmclibrary-announce Mailing List for MMC .NET Library
Brought to you by:
imjimmurphy,
kachalkov
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Peter B. <Pet...@ag...> - 2005-06-09 05:32:27
|
I've noticed that ComStream will keep reading forever (eg, if used with "XmlDocument.Load"). Replace the "Read" function in the ComStream class with the following code: =0D /// <summary> /// Reads a sequence of bytes from the current stream and advances the position within the stream=0D /// by the number of bytes read. /// </summary> /// <param name=3D"buffer">An array of bytes. When this method returns, the buffer contains the specified=0D /// byte array with the values between offset and (offset + count- 1) replaced by the bytes read from the=0D /// current source.</param> /// <param name=3D"offset">The zero-based byte offset in buffer at which to begin storing the data read=0D /// from the current stream.</param> /// <param name=3D"count">The maximum number of bytes to be read from the current stream.</param> /// <returns></returns> public override int Read([In,Out] byte[] buffer, int offset, int count)=0D { byte[] buf =3D new byte[count]; System.IntPtr lenPtr =3D Marshal.AllocCoTaskMem( 4 ); this.comStream.Read(buf, count, lenPtr); int len =3D Marshal.ReadInt32( lenPtr ); Marshal.FreeCoTaskMem( lenPtr ); m_readCount +=3D len; =0D System.Diagnostics.Debug.WriteLine("Read: " + m_readCount + " bytes of the requested: " + count + " bytes"); Array.Copy( buf, buffer, len ); return len; } =0D PS: Who should I be emailing about such bugs in the future? ********************************************************************** This email contains information which is confidential and the copyright of AGM IT Pty Ltd. If you are not the intended recipient of this email, please delete and destroy all copies and telephone AGM IT on=0D +612 9714 6700 immediately. ********************************************************************** |