Windows COM - how to debug a COM server
I have a com server(written in C++, ATL) that runs out of process. In one of my computers I am able to debug the server code easily just by starting the COM under the debugger, setting breakpoints and connection to the server from a client process.
On my ano开发者_Python百科ther computer this does not happen, if I start the COM server under the debugger from start, the client uses another instance of the same server and the only way to debug the server is to attch to it after the client already started it. How can this be configured ?
The problem was the fact that under the Vista and up when you start the com server elevated (so that the registry part gets in registry at the end of the build) the COM client will launch another COM server instance (at the same integrity level as he was, e.g. medium and not high)
So I had to run Visual Studio for the server as normal user (not run as admin) and had to do the COM registration from command line.
Start your processes normally. Make the debugger stop at a break point in your COM client. Launch another instance of Visual Studio (I am assuming you are running Visual Studio), and attach to the out of proc server process. In Visual Studio 2008, you do it by selecting Attach to process... in the Tools menu. Then simply select the process you want to debug, and there you go. You may want to open the source code files manually to set break points, because you are not debugging within the context of the original project.
精彩评论