Updating Cached Private Profiles (.INI Files) (68827)
The information in this article applies to:
- Microsoft Windows Software Development Kit (SDK) 3.0
- Microsoft Windows Software Development Kit (SDK) 3.1
This article was previously published under Q68827 SUMMARY
Under Windows version 3.1, the first time a private profile (.INI file) is
accessed, the system will call the GetFileTime() API and store this value.
The WriteProfileString() API will then call the GetFileTime() API and
compare the return value to the stored value. If the two values match, the
file is considered valid for two seconds. The function makes the changes
and writes the new contents to disk. If the two values do not match, the
profile is reread into a buffer and the change is made. The same principle
holds true for reading values from a private profile.
The reasoning behind the two second limit is that most applications read
private profiles in a burst, at application startup, and write in a burst,
at application shutdown. The penalty of one read in a twenty read sequence
is considered acceptable, given the benefits.
In Windows version 3.0, an application that has a private profile will not
respond to changes made to that private profile by a text editor. When a
text editor updates a private profile, the file on disk is modified.
However, GetPrivateProfileString() and GetPrivateProfileInt() do not read
from the disk file, instead the functions read from a copy of the file in a
cache. WritePrivateProfileString() will update the appropriate sections in
both the cached file and the disk file, however, the functions will not
reload the disk file into the cache unless the entire cache is invalidated.
The information included below discusses how to force a private profile to
be recached from a disk file.
Modification Type: | Major | Last Reviewed: | 10/30/2003 |
---|
Keywords: | kb16bitonly KB68827 |
---|
|