Windows COM - how to debug a COM server

假如想象 提交于 2019-12-11 10:15:42

问题


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 another 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 ?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/7045722/windows-com-how-to-debug-a-com-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!