Sunday, December 19, 2004

INI File Redirection When Running Non-Admin

INI File Redirection When Running Non-Admin

"One of the things that I've noticed running non-admin is all the apps that work, but not always correctly. Two interesting ones that you may not have noticed are the Windows Calculator (calc.exe) and Character Map (charmap.exe).

... is that both apps persist their state information into the WIN.INI file. Yes, you heard me right, the Windows INI file. This is leftover from the old days of Windows 3.x. Since INI files are located in your Windows installation directory (typically C:\WINDOWS), the app can't write to them because your non-admin account doesn't have write privileges for files in that folder.

But thanks to the wonderful folks on the nonadmin alias (an internal list for discussing non-admin issues and techniques), I now know of a way around this problem. It turns our that since Windows NT, when the registry was introduced, we have had the ability to redirect INI files into the registry. (See Knowledge Base Article 102889 for the details of how this works.)

So, armed with this information, you can redirect those two apps into your HKEY_USERS registry hive with the following entry. (To use this copy-paste it into Notepad, save it with a .reg extension, and double click on it. You will have to be Admin to make this change!!!!)

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\win.ini]
'SciCalc'='USR:Software\\Microsoft\\SciCalc'
'MSUCE'='#USR:Software\\Microsoft\\CharMap'

..."


I have this feeling that I might need this information someday...

No comments: