Jump to content

INI files are limited to 64kb in size (or per section?)


Guest wsxedcrfv

Recommended Posts

Guest wsxedcrfv

It seems that there is a limitation in some Win-9x API that puts the max size of an INI file to 64 kb. Either that's the total size of the file, or the size of a "section" contained within the file (what defines where a "section" begins and ends?).

There are some files (like cdplayer.ini) that apparently can easily exceed this 64kb size limitation (given the CD-text info that can be contained within the file).

What exactly is the nature of this 64kb limit? What system file or resource imposes this limit?

Is there a hack or patch for win-98 that overcomes this limit?

Link to comment
Share on other sites


Reference to limitation:

http://support.microsoft.com/kb/78346

Even wikipedia lays out the structure of an INI file:

http://en.wikipedia.org/wiki/INI_file

So a "section" is the part inside the brackets [] for example:

[SectionName]
data=data
32-64k of data=the most I can put in here.

[Section2]
limit=supposedly I can put 32-64k in here too?

[Section3]
really=some more data?

Here's some more.

http://www.gmccomb.com/vault/edge/ini.html#_1_7

So this limit is in the Windows API only? If you read an INI file with AutoIT, will it have the same problems? Are XML files a viable option for win9x?

Link to comment
Share on other sites

KB78346 only makes sense if the SIGNED INT and UNSIGNED INT used for pointers are 16-bit numbers, because 64 kiB is 2^16. So, there, MS is talking about 16-bit code. And this is consistent with a 5-digit KB number. It can be true that those 16-bit pointers were carried over to 9x/ME. And it'd probably be feasible to patch them to 20-bit or more, if that's the case, but the question to tackle first is: is it the case, or, to put in other words, are those pointers really still 16-bit in 9x/ME? After all, in a much older version of KB78346, as preserved by the WayBack Machine, it's stated it applies to Win 3.xx and WfW 3.xx, and that was 1999, so Win 95 (all versions), 98 and 98SE were around at the time. And the newer version pointed by Tripredacus states the same in its "Applies To" section. In any case, to me seems clear that the above KB refers to the files themselves, and not their inner sections, as limited to 64 kiB. But, I insist, the reason for it is the use of 16-bit pointers. I think that restriction simply doesn't apply to Win 9x/ME or the NT-family OSes.
Link to comment
Share on other sites

Notepad will complain if the TXT file is larger than 64KB so perhaps these are related ? I once tried to use XP notepad but it will load all files blank (probably related to unicode)

Link to comment
Share on other sites

Guest wsxedcrfv

KB78346

And the newer version pointed by Tripredacus states the same in its "Applies To" section.

I see nothing in the "Applies to" section, other than a link to "Back to the Top".

are those pointers really still 16-bit in 9x/ME? I think that restriction simply doesn't apply to Win 9x/ME or the NT-family OSes.

To quote from the person that raised this issue on usenet:

It can be problematic, however, for most CD music players that rely on an INI file (cdplayer.ini) to store the CD text (artist, title, etc) information, since once that 64 K filesize is reached (after playing a whole bunch of different CDs), it hits that limit, and gets truncated (starting all over again, fresh, with no entries in the new INI file). I've seen that happen here (using the old MusicMatch Jukebox - a nice player for its time) The specific INI file is "cdplayer.ini", found in the \windows directory.

Or could that just be a problem with the "old MusicMatch Jukebox" program, and not any underlying win-9x API function calls?

Link to comment
Share on other sites

I didn't want to point out this quote so much in Wikipedia (it should have a citation needed tag for sure) but it may have something to do with all of this.

The use of the "INI file" has been deprecated in Windows in favor of the registry, and deprecated in .NET in favor of XML .config files.

//snip//

Starting with Windows 95, Microsoft began strongly promoting the use of Windows registry over the INI file.

I couldn't find any sort of documentation to confirm the facts about these two statements.

Link to comment
Share on other sites

KB78346

And the newer version pointed by Tripredacus states the same in its "Applies To" section.

I see nothing in the "Applies to" section, other than a link to "Back to the Top".

It's there: just click on the + sign in a box beside the bold "Applies to:", and it'll expand.

Moreover, if you had visited the second link I gave, the one to the 1999 version at the WayBack Machine, you'd have seen it without needing to expand it.

I said it, and I repeat: I really doubt 9x/ME kept those pointers as 16-bit.

@RLoew: if and when you have the time, would you kindly check the internals of one of the APIs mentioned in KB78346, just to settle this question once and for all? Thanks a lot in advance.

Link to comment
Share on other sites

@RLoew: if and when you have the time, would you kindly check the internals of one of the APIs mentioned in KB78346, just to settle this question once and for all? Thanks a lot in advance.

The Windows 9x MSDN Library Documentation does not mention any limit.

I traced the GetPrivateProfileString API Call. It definitely thunks down to 16-Bit Code.

Running the GetPrivateProfileString API Call with a Destination Buffer size >64K Fails.

Link to comment
Share on other sites

That settles it!

Thanks whole a lot for the swift reply, RLoew! :thumbup

And I stand corrected. MS could have used 32-bit pointers, but they preferred to keep the 16-bit. Go figure!

One possible explanation to that is they did it to force people away from .INI files, as mentioned above by Tripredacus.

Another one, more probable IMO, is they just couldn't care less about a deprecated feature, even if undocumented.

Link to comment
Share on other sites

Guest wsxedcrfv

Do we know if this 64kb issue applies to the size of the .ini file, or to the size of any section inside the ini file?

Also, can it be confirmed that this 64kb issue also applies to win-ME?

Link to comment
Share on other sites

Yes. KB78346 states it applies to the file size, nothing is said about sections.

And yes, if it applies to 98, it sure applies to ME. This type of feature didn't change between them.

It may, however, not apply to Win 2k, XP and later versions...

The way to test it is to create a, say, 70 kiB cdplayer.ini and test it in the conditions Bill in Co. gave.

Link to comment
Share on other sites

Well, I can confirm that INF files in W95 through W98ME are limited to 64K. On W2K onward (not sure about NT4), they are not.

I don't know anything specific about INI files, but see no reason why these would have a different limit. As regards the Notepad limitation, this may or may not be related (anyway, it always asks to use Wordpad for files exceeding 64K).

Joe.

Link to comment
Share on other sites

Guest wsxedcrfv

Yes. KB78346 states it applies to the file size, nothing is said about sections.

I've got a handful of ini files on my win-98 systems that exceed 64kb in size. Some of these are CorelDraw 9 files (brushes.ini), Spybot Search & Destroy (online.ini), some unknown windows file in /system32 (perf32.ini), MS Office 2000 (reprint.ini), and some Opera files (dialog.ini, standard_menu.ini).

I still suspect that the 64kb limit is not the size of the file, but the size of a section inside the file. Web-searches indicate there is speculation (perhaps groundless) that win-ME does not have this 64kb limitation.

Perhaps KB78346 is referring to file-size for win-3.x only.

I haven't yet looked closely at any of the following. The "applies to" section mentions applications from MS Office 97, 2000, XP (2002), 2003, 2007 in use with Windows 95, 98, ME, 2000, XP and Vista:

http://support.microsoft.com/kb/140754

http://support.microsoft.com/kb/223019

http://support.microsoft.com/kb/223021

http://support.microsoft.com/kb/224149

http://support.microsoft.com/kb/224169

http://support.microsoft.com/kb/234623

They contain info about cause of errors similar to this one:

http://support.microsoft.com/kb/235242

Link to comment
Share on other sites

Guest wsxedcrfv

I see nothing in the "Applies to" section, other than a link to "Back to the Top".

It's there: just click on the + sign in a box beside the bold "Applies to:", and it'll expand.

Hmmm. I see nothing but white space to the right of "Applies to" on all KB articles I view on my two win-98 systems, both using firefox 2.0.0.20. Nothing at all to indicate there is something click-able in that area. I see no "+" sign.

If I mouse over that area (including mousing over the words "Applies to") the mouse arrow turns into a hand with index finger pointing up. This area extends all the way to the right where the divider line ends on the right margin. The address bar at the bottom of the firefox window does NOT display any link when mousing over that area. When I click on that area, the "Applies to" list opens up and the list drops down, and I see them. If I click the area again, the list rolls up. There is nothing visual to indicate that the words "Applies to" is a clickable link. The words are printed in black, in bold.

When viewing a KB article using IE6, the "Applies to" section seems to open automatically, and again I see no "+" sign. When I mouse over the area to the right of "applies to", the mouse arrow remains an arrow. I can't seem to be able to close or roll-up the "Applies to" list.

Edited by wsxedcrfv
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...