- NSIS Discussion
- Stack size limit
Archive: Stack size limit
bSecRes
4th August 2003 15:34 UTC
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"
kichik
4th August 2003 15:37 UTC
What's the value of ${NSIS_MAX_STRLEN}?
bSecRes
4th August 2003 15:51 UTC
8192 and I'm actually only seeing 1019 characters on stack.
kichik
4th August 2003 20:19 UTC
You are using the latest CVS version right? From what date?
Afrow UK
4th August 2003 20:23 UTC
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
bSecRes
4th August 2003 21:35 UTC
Mon Aug 4 05:51:34
This is on a W2K server.
kichik
4th August 2003 21:46 UTC
Works for me... Can you try the attached example (compiled version and a version you compile yourself) and also attach your test case?
bSecRes
5th August 2003 00:07 UTC
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.
Andrew Francis
7th August 2003 18:43 UTC
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).
bSecRes
7th August 2003 19:20 UTC
I loaded the project in MS VC++ 6 and did a build all. Thanks for helping out though. Dumpstate is invaluable.
Andrew Francis
10th August 2003 16:57 UTC
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.
bSecRes
12th August 2003 23:09 UTC
Sorry for the slow reply, it works great! Thanks a ton, this is an essential tool.
Sunjammer
13th August 2003 00:23 UTC
I've updated the archive copy of dumpstate to 0.2.