Investigating a GSCookie Corruption

GSCookie helps in finding buffer overrun cases on the stack and terminates the application when this is detected. In the .NET environment this would happen when calling into a native function when the function overrides the buffer on the stack corrupting the GSCookie put in place. Here is a similar case. I have a sample…

0

Troubleshooting MFC state related issues

In this article we will be talking about MFC Module state and Thread state , and how do we troubleshoot issues related to Module state mismatch. Why MFC dll does needs a module-specific state? Well reason is MFC is a shared dll, it needs to be shared between various modules (dlls\exe) that are linked with…

4

The Cup-Stacker Prince (Multi-threading Made Easy, and a little bit strange)

Computers are not intuitive; they can predict the future perhaps, but they cannot paint magic doors through the boundaries of traditional logic – at least not yet. Imagine, if you will, a cup-stacking champion during his or her early life. How does one begin stacking cups? Very carefully, as the saying goes. At first, a…

0

P/Invoke Marshal.StructuretoPtr

In this blog I am going to talk about Marshal.StructuretoPtr , especially its last parameter fDeleteOld. Although its msdn description is pretty concise but I have seen it to be a source of confusion a lot of times. Following is what it says: fDeleteOld Type: System..::.Booleantrue to have the Marshal..::.DestroyStructure method called on the ptr…

7

.NET-BroadcastEventWindow causing BOOTUP_EXCEPTION_COMPLUS during application shutdown

This is one of the interesting scenario in which an unmanaged application built with Non-Microsoft technology was crashing during application shutdown with BOOTUP_EXCEPTION_COMPLUS exception (c0020001). This unmanaged application happened to be using unmanaged dll (built with Microsoft compiler) which in turn used IJW (a.k.a. C++ Interop) to interact with windows forms and create some ActiveX…

2

FAQ: MS09-035 ATL Security Update For Visual Studio 2003/2005 SP1/2008 RTM/2008 SP1

1.        How do I know which dll/control needs to be rebuilt? Please check the guidelines to understand if your dll/control could be affected or not. Installing the Visual Studio ATL Security patch and rebuilding the binaries alone will not mitigate the vulnerability. You may need to make code changes as given in the document.  …

2

How to handle chevron button using CToolBarCtrl object?

Most of the developers work with CToolBarCtrl but they get stuck when it comes to display chevron button. This article is all about how to get chevron button displayed on CToolBarCtrl control while resizing its content window.   There is a good MSDN article on handling chevrons but no good sample implementation on it. I wrote a small…


VC++ Intellisense

Internal Mechanism Internally the Visual Studio IDE interacts with editor and the language parsers to create a list of tokens that are updated frequently. In this process the background threads continuously update the Intellisense database. The priority of threads change automatically to make sure that the database is updated as and when user writes the…

0

Floating point exception in managed code results in Access Violation crash

  Suppose you are calling some native code from your managed code, and you observe an Access Violation crash soon after returning from the native code inside your managed code. if you run the application inside the Visual Studio debugger you will see the following exceptions in the output window if IDE.   First-chance exception…

0

Troubleshooting PInvoke Related Issues

I am back with some more PInvoke Stuff.  Recently I was working on a PInvoke issue which I found interesting.  I have a C++ dll which has a function whose signature is int TestFunc(IN_STRUCT in_Params, RET_STRUCT * pret_Par).  I wanted to call this function from C#.  Function has two arguments.  First argument is input structure…

12