Replacing Calc with Calculator Plus

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

Comments (11)

  1. bolts says:

    You didn’t mention it explicitly, but for those trying this, name the string "debugger" if you add it manually.

  2. Shawn says:

    Good point, I meant to include that in the explanation. Thanks.


  3. fredo says:

    Ok for calc, but it’s not the principal application I’m using.

    What about VS? It is pratically impossible to build and debug an ASP application with VS without beeing admin. Yes, I know there is a lot of papers explaining how to do with a normal account (even in MSDN), except that the solution they provide does not work.

    When I post in forum for that problem, I’ve never meet someone successully with that either. So it does not seem to be so obvious.

    I even meet a PC where it was impossible to make ASP running in debug mode without giving it system privileges in machine.config ????

    VS has a real problem with account privileges, at least something is not clear.

    But just for my curiosity, why I should be admin to debug and not just be in the debugger group? If should be admin as well, what is the interest of the debuger group?

    thank you

  4. Or, there’s ProgLauncher. Seems a lot simpler. I use this for my NotePad replacement needs, and it works great.

  5. Hmm, cool trick. The only problem I have is that the original file is passed as a command line argument. So changing notepad to notepad2 using this registry setting ends up opening the exe each time.

    And yea, I can I can replace things in dllcache and then overwrite them I know… but I don’t like doing that (unless it’s critical, like fixing the SP2 tcpip.sys).

  6. Shawn says:

    OK, one at a time here 🙂

    Fredo — I don’t do much web development myself, so I’m not sure how to get VS.Net to work properly as a normal user. I would check out Aaron Margosis’ blog (, since Aaron tends to have a lot of information about normal user scenarios.

    About ProgLauncher. This defeats one of my goals from the post. I did not want to replace the calc.exe binary itself. Sine CalcPlus.exe is a lightweight app, if I wanted to do that, I would simply replace calc.exe with CalcPlus.exe.

    Michael — yep, the original argument gets passed as a command line parameter so that the debugger knows what to debug. In this case, since we’re not a debugger per se, it’s not very useful. I’m not sure if there’s some way to modify the command line passed to the debugger.


  7. Matteo says:

    Great FIX. May I write about this on my blog? My intention is to translate some of your post. Naturally i write about you, including the url of your work.

    Are you agree?

  8. Sure — go ahead.


  9. David S says:

    FYI calc.exe was fixed in Feb 2005 to use HKCU. See, sometimes Windows bugs do get fixed 🙂