Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Stack size limit (http://forums.winamp.com/showthread.php?t=144694)

bSecRes 4th August 2003 14:34

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 14:37

What's the value of ${NSIS_MAX_STRLEN}?

bSecRes 4th August 2003 14:51

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

kichik 4th August 2003 19:19

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

Afrow UK 4th August 2003 19:23

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:
code:
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 20:35

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

kichik 4th August 2003 20:46

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

bSecRes 4th August 2003 23:07

1 Attachment(s)
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 17:43

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 18:20

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 15:57

1 Attachment(s)
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 22:09

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

Sunjammer 12th August 2003 23:23

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


All times are GMT. The time now is 18:07.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.