I’m still catching up with requests to talk about stuff – here’s one that came in back in June (and just came again today from somebody else):
“MoveIniToRegistry clearly requires parameters, but there's no documentation defining what these are. (Presumably this fix will apply an IniFileMapping?)”
I haven’t doc’d this shim yet, so here’s the quick and dirty docs on it.
First of all, it doesn’t apply an IniFileMapping. That’d be kind of cool, but that’s something you’d want to do to an installer ideally, since you only need to do it once.
Instead, it intercepts calls to CreateFileA, OpenFile, WriteFile, and CloseHandle. You feed the shim with the name of the files you’re going for, and it ensures that writes happen to both the original file AND to the registry location.
That’s pretty important. The return value from the API is *not* changed by applying this shim. Rather, you still write to the original location, but you also write to a registry location.
For an example, let’s look at Barbie Sticker Designer. Now, this is a program I consider business critical, and I spend the majority of my working days using it. I find it to be a lot less stressful to use than Outlook. How is this shim configured? If we look at it using Compatibility Administrator, you can see the command line used:
%windir%System.ini * SCRNSAVE.EXE HKEY_CURRENT_USER “Control PanelDesktop” SCRNSAVE.EXE REG_SZ
The generic argument list is:
IniFile [IniSection] IniKeyName RegBaseKey RegKeyPath RegValue RegValueType
Hopefully that makes the purpose of this shim more clear. It’s still going to write to system.ini (and that writing will drive the return value of the API you are calling), but it’s also going to write the screensaver information to the registry, which is where the system actually looks these days. So, it’s not fixing a permissions issue, it’s fixing an implementation detail (we moved where screensaver configuration is). If we’ve moved something else from an INI to a registry key and don’t already have a fix for it, then you could use this to fix it up as well.
If you were hoping for an easy way to apply an IniFileMapping, well, sorry about that. That’s the problem with these shims – they sometimes have these incredibly tempting sounding names, yet in the end what they actually solve isn’t always what you expected them to solve. I’m trying to get things documented in the order of what’s most useful to you, but keep calling things out to me because I may not always know, and we’ll find out!