Archive: Stack size limit


I used #define NSIS_MAX_STRLEN 8192 in config.h and compiled with MS VC++. When I !insertmacro MUI_INSTALLOPTIONS_Read, only 1024 characters are on stack. Is there something in installoptions I need to change as well?

Edit:
Opening the ini file shows the whole string (>1024) is in the state field... this is a listbox.
Edit again: listitems not state, actual line is:
!insertmacro MUI_INSTALLOPTIONS_Read $R6 "Myini.ini" "Field $R0" "ListItems"


What's the value of ${NSIS_MAX_STRLEN}?


8192 and I'm actually only seeing 1019 characters on stack.


You are using the latest CVS version right? From what date?


I will try out my makensis copy once I have a response from other topic.
I also have a custom page with a ListBox control which I can test on.

This may help:

Function TestStrLen
Push $R0
Push $R1
StrCpy $R0 ""
loop:
StrCpy $R0 "$R0|a"
StrLen $R1 $R0
StrCmp $R1 8192 0 loop
WriteINIStr "$TEMP\ddayupdates\dialog.du" "Field 3" "ListItems" "$R0"
ReadINIStr $R1 "$TEMP\ddayupdates\dialog.du" "Field 3" "ListItems"
StrCmp $R1 $R0 0 +3
StrCpy $R0 "test success"
Goto exit
StrLen $R1 $R0
StrCpy $R0 "test fail: only $R1 strlen"
exit:
Pop $R1
Exch $R0
FunctionEnd


If $R0 is "test success" then the str of 8192 strlen was copied and retreaved from the ini file successfully.
Else, "test fail: only $R1 strlen" with $R1 being the strlewn of retreaved str.

Btw, on Win9x there are apparently limitations to strlen in the file?

-Stu

Mon Aug 4 05:51:34
This is on a W2K server.


Works for me... Can you try the attached example (compiled version and a version you compile yourself) and also attach your test case?


Argh. The reason it appeared that the value was getting chopped was because of dumpstate. Dumpstate is compiled at 1024 -5 apparently. The reason why the later values in my list were not being removed is because the values had invisible EOL characters appeneded to them that caused the StrStr match to fail. Thanks for the help anyway. Gosh this was hard to troubleshoot.

I'm attaching my sample script anyway; comments welcome.


Gah, sorry if it's Dumpstate's fault.

Dumpstate is passed the maximum string length by NSIS, and barely uses it - Dumpstate just uses the NSIS buffers except when editing a string, where it will throw loud error messages at you if things get too long.

But it sounds like there's a bug in there somewhere. I'll take a look as soon as I get the time (probably in about a day).

Unless: is it possible that you've recompiled makensis but not the exehead stub, in which case the stock exehead will tell Dumpstate that maximum string length is 1024? (Somewhat doubtful, as I expect you'd end up crashing somewhere if this was the case).


I loaded the project in MS VC++ 6 and did a build all. Thanks for helping out though. Dumpstate is invaluable.


Ok, think I've got it nailed. Turns out the problem is wsprintf (the sprintf built into kernel32.dll) not being able to write out more than about 1024 bytes. Of course, I figured this out after I restructured things to build the copy-to-clipboard string from the original data, rather than just reading everything out of the listbox - I thought the listbox was truncating stuff.

Anyway, give this a go. Once I've actually tested it properly I'll update the dumpstate homepage and the NSIS archive.


Sorry for the slow reply, it works great! Thanks a ton, this is an essential tool.


I've updated the archive copy of dumpstate to 0.2.