On my home machine, and one of my office machines I log in as a normal user, and only elevate to an account with admin status when installing software, or doing other maintenance. Needless to say, doing that creates problems with various programs that were written to always assume that the user has administrative access to the machine. One of the more surprising programs that has this problem is Windows Calculator.
Good old calc.exe keeps a machine-wide setting to determine if it’s in scientific or standard mode. Not only does it have this as a machine-wide setting, but it doesn’t even store it in HKLM, instead keeping the setting in win.ini. (Check out SciCalc\layout in win.ini to see for yourself). Obviously normal users don’t have write access to win.ini, so any change they make to the calculator setting will not get saved. This is aside from the fact that having a per-machine setting leaves computers with multiple users to fight over which setting gets saved.
My solution? Calculator Plus. Calculator Plus stores its settings in HKCU\Software\Microsoft\CalcPlus, allowing for non-admins to save settings, and for different users to have different sets of settings. Additionally, it is more fully featured than standard calculator.
After installing Calculator Plus, I’d like to use it every time some application on my computer tries to launch calc. Generally, this either is done from the quick launch menu, from the command line, from the start menu, or by using the calc button on my keyboard. The most obvious way to accomplish this is to change all of my shortcuts to point to CalcPlus rather than calc. However, that would get tedious quickly. Another way to do this is to simply copy CalcPlus.exe over the existing calc.exe. This would work, but I generally try to stay away from solutions that involve replacing Windows files, even if they are as trivial as calc.
What I ended up doing is taking advantage of Windows’ Image File Execution Options. Windows allows you to specify a debugger for an application, which will always be launched when the application is launched. This allows you to debug applications that aren’t easy to start up on your own. However, since Windows will launch the debugger, and its up to the debugger to launch the actual application, you can use this feature to “replace” one program with another. (This is exactly how Process Explorer implements its “Replace Task Manager” feature).
Setting up a debugger for calc can be done in two ways. If you’ve installed the Debugging Tools for Windows , you can run gflags, and on the image file tab specify “C:\Program Files\Microsoft Calc Plus\CalcPlus.exe” as the debugger for the calc.exe image. If you don’t have the debuggers installed, then another option is to add the registry key yourself. Under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options, add a new key named calc.exe. Under the calc.exe key, add a string value named debugger which has a value of the full path to CalcPlus.exe (remembering quotes if necessary).
Once that’s setup, I now have a calc applet that has more features than the standard one, and plays well when running as non-admin as well.
Updated 4:59pm: Added the name of the registry value for the image debugger