Re: BSTR property returns invalid strings when using multiple sinks
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 06/29/04
- Next message: Miki Peric: "Re: MyProject's .c and .h file (ATL)"
- Previous message: Alexander Nickolov: "Re: ATL3 vs ATL7"
- In reply to: aby: "BSTR property returns invalid strings when using multiple sinks"
- Messages sorted by: [ date ] [ thread ]
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 > >
- Next message: Miki Peric: "Re: MyProject's .c and .h file (ATL)"
- Previous message: Alexander Nickolov: "Re: ATL3 vs ATL7"
- In reply to: aby: "BSTR property returns invalid strings when using multiple sinks"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|