[OpenAFS-win32-devel] Re: Use of the Windows Registry

Jeffrey Altman jaltman@columbia.edu
Wed, 10 Mar 2004 00:25:35 -0500


Meghadri Ghosh wrote:

> I need to check on this, but I think creating the registry key 
> redirects existing INI file API calls to afsdbmt.ini to values in the 
> registry which would be per user.
>
The documentation is rather incomplete on this functionality.    
However, after examining
other INI files which were mapped it appears you can specify the 
mappings on a per value
basis if necessary.  Unfortunately, the mappings appear to work for user 
level applications
but not for the services.  The INI files are used to convey information 
between afscreds.exe
and afsd_service.exe.  So both need to be able to look in the same 
location.  The end result
is that an architectural redesign is required so that the created 
submounts which are assigned
to a particular user can be of the form "domain.user.mount" instead of 
just "mount". 
Global mounts would simply be of the form "mount". 

What follows is the documentation on this functionality for those who 
are interested in
reading it.

Jeffrey Altman



PSS ID Number: 102889

Article Last Modified on 5/6/2003

------------------------------------------------------------------------
The information in this article applies to:

    * the operating system: Microsoft Windows NT
    * the operating system: Microsoft Windows 2000
    * the operating system: Microsoft Windows XP

------------------------------------------------------------------------
This article was previously published under Q102889
Under Microsoft Windows NT, Windows 2000, and Windows XP, .INI file 
variables are mapped into the Registry as defined in the

\HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\IniFileMapping 


mapping key. The Win32 Profile application programming interface (API) 
functions look for a mapping by looking up the filename extension 
portion of the profile file. If a match is found, then the search 
continues under that node for the specified application name. If a match 
is found, then the search continues for the variable name. If the 
variable name is not found, the value of the (NULL) variable name is a 
string that points to a node in the Registry, whose value keys are the 
variable names. If a specific mapping is found for the variable name, 
then its value points to the Registry value that contains the variable 
value.

The Profile API calls go to the Windows server to look for an actual 
.INI file, and read and write its contents, only if no mapping for 
either the application name or filename is found. If there is a mapping 
for the filename but not the application name, and there is a (NULL) 
application name, the value of the (NULL) variable will be used as the 
location in the Registry of the variable, after appending the 
application name to it.

In the string that points to a Registry node, there are several prefixes 
that change the behavior of the .INI file mapping:

   ! - This character forces all writes to go both to the Registry and
       to the .INI file on disk.
		

   # - This character causes the Registry value to be set to the value
       in the Windows 3.1 .INI file when a new user logs in for the
       first time after setup.
		

   @ - This character prevents any reads from going to the .INI file
       on disk if the requested data is not found in the Registry.
		

   USR: - This prefix stands for HKEY_CURRENT_USER, and the text after
          the prefix is relative to that key.
		

   SYS: - This prefix stands for HKEY_LOCAL_MACHINE\Software, and the
          text after the prefix is relative to that key.