PRB: Maximum String Lengths for .ini File APIs on Windows 95/98ID: Q230194
|
The Win32 functions for setting and retrieving initialization file (.ini) strings are limited to just under 32KB per read and per write on Windows 95/98. This is true for the following functions:
These functions were designed to handle small amounts of data. They were incorporated into the Win32 Application Programming Interface (API) merely for backward compatibility with 16-bit applications. Win32-based applications should store initialization information in the registry.
Large amounts of data should not be stored in an initialization file or in the registry, because .ini files and registry files are limited in size. For additional information about, please see the following article in the Microsoft Knowledge Base:
Q78346 Maximum Valid Size for REG.DAT and .INI FilesIf your application needs to save large amounts of character data, this data should be written to another file using the File I/O APIs directly. The 16-bit APIs include _lopen(), _lread(), _lwrite(), and so on. The 32-bit APIs include CreateFile(), ReadFile(), WriteFile(), and so on.
This behavior is by design.
The WritePrivateProfileStruct() and GetPrivateProfileStruct() functions can be used to set and retrieve binary data in an .ini file. The binary data is encoded to character data. Each byte of binary data maps to two bytes when encoded. The character data is then stored or retrieved from the .ini file using WritePrivateProfileString() or GetPrivateProfileString(). As a result of this encoding, the struct functions are limited to just under 16KB per read and per write on Windows 95/98. The actual maximum string size for the struct functions is 6 bytes less than 16KB. The 6 bytes are used internally in the implementation of the functions.
Additional query words:
Keywords : kbAPI kbKernBase kbSDKWin32 kbWinOS95 kbWinOS98 kbDSupport
Version : winnt:
Platform : winnt
Issue type : kbprb
Last Reviewed: June 24, 1999