[OpenAFS-devel] Windows client - moving afsdsbmt.ini to the registry?

Scott D. Williams sdw@email.unc.edu
Mon, 03 Mar 2003 18:59:38 -0500


Hi James,
Nice job stomping the memory leak, btw.

There is an interesting/useful feature of Windows (NT, 2000 & XP) WRT .ini 
files and the registry...

Since the Windows OpenAFS client code uses the api calls:

GetPrivateProfileString() & SetPrivateProfileString()

to get and set values in the submount file 'afssbmt.ini',  it is easy to 
redirect .ini file data to/from a specifiable region(s) of the registry. 
This requires no change to the binary, just some registry mods. 
Furthermore, the granularity is at the 'section' level, not the file level. 
The submount file contains two sections:
[AFS Submounts] and [AFS Mappings].

This means that 'mappings' section might be redirected to 
HKEY_CURRENT_USER, while the 'submounts' list could be shared. I have done 
only limited investigation with this idea; I have redirected 'afsdsbmt.ini' 
reads and writes to the registry on my machine. However, it's **not a 
shared system**, so it only demonstrates the basic premise, at best.

For more information go to this page and scroll down to the 5th paragraph 
of the "Remarks" section:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getprivateprofilestring.asp

It begins:

"Windows Server 2003, Windows XP/2000/NT:
Calls to private profile functions may be mapped to the registry instead of 
to the specified initialization files. This mapping occurs when the 
initialization file and section are specified in the registry under the 
following keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping"

On my system, it's set up like this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\IniFileMapping\afsdsbmt.ini]
"AFS Mappings"="USR:Software\\OpenAFS\\mappings"
"AFS Submounts"="SYS:TransarcCorporation\\AFSClient\\submounts"

The prefixes 'USR:' and 'SYS:' are explained in the link above.

--Scott