From: Jimekus on
On Dec 8, 12:42 pm, Karl E. Peterson <k...(a)exmvps.org> wrote:
> Jimekus presented the following explanation :
>
> > I've replaced my registry entries using an ini file, but I've just
> > discovered that I can only have 254 bytes of text stored in a key, or
> > half that for unicode, so without having to use another file
> > structure, I want to find another function that supports greater
> > lengths.
>
> What causes you to assume that limitation?  I've never seen it.  At
> least not since moving to NT.  Using my INI wrapper
> (http://vb.mvps.org/samples/kpIni), I just did this:
>
>    Dim ini As CIniFile
>    Set ini = New CIniFile
>    ini.FileName = "d:\code\temp.ini"
>    ini.EntryWrite "512", String$(512, "O"), "Test"
>    Debug.Print Len(ini.EntryRead("512"))
>
> The resultant file was exactly as expected, with the 512= line being
> 516 chars long and 512 being output to the Immediate window.
>
> Disclaimer: I ran that test on Windows 7 x64.
>
> --
> [.NET: It's About Trust!]

Thanks all, I found the problem. My inherited procedure that called
the GetPrivateProfileString had a restricted buffer size. Karl's
excellent little wrapper makes use of an intelligent strategy to
dynamically expand the buffer to retrieve large entries, which in my
case only happens once per instance.
From: Karl E. Peterson on
Jimekus used his keyboard to write :
> Thanks all, I found the problem. My inherited procedure that called
> the GetPrivateProfileString had a restricted buffer size. Karl's
> excellent little wrapper makes use of an intelligent strategy to
> dynamically expand the buffer to retrieve large entries, which in my
> case only happens once per instance.

Nice. Glad you got that going.

--
[.NET: It's About Trust!]


From: Ralph on

"Karl E. Peterson" <karl(a)exmvps.org> wrote in message
news:euutWqGeKHA.2596(a)TK2MSFTNGP04.phx.gbl...
> Jimekus used his keyboard to write :
> > Thanks all, I found the problem. My inherited procedure that called
> > the GetPrivateProfileString had a restricted buffer size. Karl's
> > excellent little wrapper makes use of an intelligent strategy to
> > dynamically expand the buffer to retrieve large entries, which in my
> > case only happens once per instance.
>
> Nice. Glad you got that going.
>

I'm glad this came up. I need to reexamine my INI file 'supersitions'. <g>

-ralph


From: Jimekus on
Karl, I took the liberty of modifying your key buffer expansion
routine by doubling its size each time it was too small, instead of
just incrementing the size by the length of the default buffer.
From: Karl E. Peterson on
Jimekus laid this down on his screen :
> Karl, I took the liberty of modifying your key buffer expansion
> routine by doubling its size each time it was too small, instead of
> just incrementing the size by the length of the default buffer.

Yeah, that's another valid approach. Used to be, bytes were precious,
but today I'm not sure there's any argument to be used in that regard
if it means you're spending more cycles trying to get there. :-)

--
[.NET: It's About Trust!]