Re: BSTR property returns invalid strings when using multiple sinks

From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 06/29/04


Date: Mon, 28 Jun 2004 20:54:23 -0700

Looks like buffer overrun to me... In debug versions your buffers
have padding that is just not there in release.

-- 
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"aby" <aby.philip@mobiapps.com> wrote in message
news:%23$%23GJ9WXEHA.3640@TK2MSFTNGP11.phx.gbl...
> Hi
>
> I have a component implementing a proprietary protocol (say,
> Protocol.dll)and does the communciation over serial port. I have defined
ATL
> objects for each type of packet, and nearly all has a property called
> "description" which returns a BSTR.
>
> One ATL object encapsulates the serial communication. So I can set the
baud
> rate, port number etc.
>
> A connection point event is defined corresponding to each packet that may
> arrive to the PC (from the device). Say ProtocolPkt1, ProtocolPkt2,
> ProtocolPkt3 etc.
>
> Now we typically use 2 serial ports. One that does proper protocol
> communciation and another that dumps trace staements. To take care of the
> trace statements I have one event defined (LogData) in the same event
> interface described above.
>
> I have an application (say Mainwindow.exe) that uses the above component,
> connects to both the ports and has separate event sinks to handle the 2
> ports separately. The protocol data and the log data coming from the 2
ports
> are to be shown in separate windows. Whenever an event notifies that log
> data is received it is simply dumped in a window. Whenever any event
> notifying any of the protocol packets is received, the corresponding
packet
> is created from the bytes received in the event, interpreted and
displayed.
>
> Now onto the problem. When some protocol packets are received, the
> description property has to be called. When both the ports are connected
the
> log data comes fine. But when the description property of say ProtocolPkt1
> event is called, the BSTR returned is prefixed with some log string that
> came in the LogData event. Further the application displays a crash when
it
> is closed.
>
> Some more observations.
>
> 1. This does not happen when the BSTR returned is very short. Typically
only
> when the string returned is long and computed in some for loop, does this
> corruption occur.
>
> 2. This does not happen when I use the debug version of Protocol.dll.
>
> I hope I have made myself clear. If any information is required please let
> me know. Any pointers that can help me proceed would be greatly
appreaciated
>
> Thanks
>
> aby
>
>


Relevant Pages

  • BSTR property returns invalid strings when using multiple sinks
    ... I have a component implementing a proprietary protocol (say, ... Protocol.dll)and does the communciation over serial port. ... A connection point event is defined corresponding to each packet that may ... Now we typically use 2 serial ports. ...
    (microsoft.public.vc.atl)
  • Re: I am sick of windows firewall
    ... I use the AnalogX IPsec rules to supplement BlackIce ... need IPsec to stop outbound that BlackIce cannot do by ... attempts on the Windows networking ports even though BI ... supplemental packet filtering solution. ...
    (comp.security.firewalls)
  • Re: Problem with the NDIS MUX IM driver (decapsulation not working)
    ... If the higher-level protocol and the lower-level miniport have enabled some TCP task offload contract, then the decapsulated packet you are indicating may not provide the necessary task offload information. ... then temporarily disabling the NDIS task offload features of the adapter using the adapter's NCPA advanced property tab should make the behavior "better". ... I slap on my own ethernet header infront of the real ...
    (microsoft.public.development.device.drivers)
  • Re: Serial port read latency (SERIOUS - NEED HELP FAST!)
    ... In regular Windows XP, expecting a 5ms interval would normally encounter geers and cat-calls from the news group. ... Is the 5ms "window" the only termination, or are you using a protocol that defines end of text or message? ... ReadFile will complete when there is 5 ms interval between received bytes. ... > The protocol requires our embedded device to respond to a packet> within ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Sniffer Cant see cluster traffic
    ... > protocol and cluster specific multicast MAC address, ... > node specific source MAC address. ... > is a multi-cast packet or a directed packet. ... Yep and that is solely at the ethernet packet level. ...
    (comp.os.vms)

Quantcast