hooway wrote: > We are making a PKCS11 token dll for CMS server. But we met some problems. > and cause windows shut down. We want to debug our dll to find the reason. > But how to do it under CMS server. It's always working as a NT Service. Is > there any method to force it working not in Service mode.
I don't know if there is a way to make CMS not run in service mode, but you can still attach to an NT service in order to debug your code. As long as you are logged in as a user with sufficient local priviledges (ie. administrator), you can bring up the task manager, select the process, click mouse button 2, and select debug. Then you can use the debugger as you normally would, except you can't restart the program from the debugger if you stop it - you'll have to wait for the service to restart, and reatach, using the above procedure I described. You will still be able to save your breakpoints though. If the problem in your module happens on initialization, you will probably want to add some sort of sleep loop into your code so that you can attach and interrupt it by reassigning the value of a variable. You could also call DebugBreak in your init code, which will cause a pop-up dialog to come up on the machine, and let you attach to the process. Then just skip the "Int 3" call and debug your code after it.
