How to stop misbehaving programs
Senior App Dev Manager, Linkai Yu shares a little tip to tame a misbehaving process with the help of Gflags.exe.
Recently, I encountered a machine experiencing significant performance degradation even after reboots. Using Task Manager, I identified a process that was constantly consuming high amount of CPU. I tried “End Task” in Task Manager, but nothing happens. I then tried to uninstall it from Control Panel/Uninstall Program, but it’s not visible. I also tried to attach a debugger to it but got “Access Denied” error.
At this point, you could start combing through services, startup apps, and scheduled tasks to see how this process is getting launched in order to disable it, but here’s a trick you might not know: I stopped it with the help of Gflags.
GFlags (or the Global Flags Editor) enables and disables advanced debugging and troubleshooting features in Windows. You may be familiar with Gflags if you have had to isolate heap corruption issues or spent time developing Windows drivers. It’s also pretty handy to block the start of an application through debugging if it won’t respond any other way.
Here are the steps on how to stop it from bootstrap:
- Start Gflags.exe (part of the debugging tools for windows)
- Set Image File to the problem app (example: rogue_app.exe)
- Select Debugger, type cdb.exe
- Click Apply, and then close Gflags.
Reboot the machine. This tells the OS to start the program by debugger which actually pauses it as soon as the program is loaded. At that point, shutting down cdb.exe will shut down the problem application. Then you can delete its files.
To undo the setting, simply unselect the debugger check box and click Apply button.
If you want to make sure a certain program does not get to run automatically, you can leave this setting on the machine.
Note of caution: Please make sure you are not setting this on Windows system components or on security components as that could leave your system vulnerable to attacks. This techniques is only for advanced users.
Premier Support for Developers provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality. Contact your Application Development Manager (ADM) or email us to learn more about what we can do for you.