Old 13th March 2007, 05:44   #81
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
how many entries/bytes can hold an array?

i have 2 hash arrays and after extact 361 entries with
each 32 token the script quits without warning or gpf.


Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 6th June 2007, 22:52   #82
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I have uploaded v1.4 which has a new "Subtract" function among code cleanup and utilisation.

Subtract allows you to take-away items in one array that are in another. This is useful for comparing two arrays to see which items do not match (i.e. with GetDrives or something).

Stu
Afrow UK is offline   Reply With Quote
Old 6th June 2007, 22:53   #83
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Brummelchen, sorry I missed that post. Can you create a script to reproduce this?

Stu
Afrow UK is offline   Reply With Quote
Old 7th June 2007, 21:10   #84
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I found out what was causing the crashing.
I tested the plugin with all 8 arrays filled with 10000 strings of 100 characters and everything was fine.

Uploaded v1.5

Stu
Afrow UK is offline   Reply With Quote
Old 7th June 2007, 23:43   #85
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
Thank you - i try it next build here.
meanwhile right after trouble i repalced the array
with a file list as TXT and it runs smooth. now i
need to improve zero byte files which all have same
hash - nsis itself can handle that - me not.

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 8th June 2007, 13:13   #86
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Uploaded v1.5 RC2. Fixed some parameter validation check issues for some of the functions.

Stu
Afrow UK is offline   Reply With Quote
Old 10th July 2007, 05:26   #87
Wizarth
Junior Member
 
Join Date: Jul 2007
Posts: 2
SizeOf

I tried using this plugin today, and find that the ${myArray->SizeOf} macro would cause an error. After assorted cursing and headscratching, I discovered:

Line 686 of NSISArray.nsh:
!macro Array_IndexesOf Name VarBufferLen VarItems VarIndexes

should be
!macro Array_SizeOf Name VarBufferLen VarItems VarIndexes

Note that this bug did cause the Examples/NSISArray/Sizeof.nsi to fail, and this change fixed it.
Wizarth is offline   Reply With Quote
Old 10th July 2007, 09:43   #88
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Thanks, fixed.

That probably happened when I did a Size->Indexes text replace in the script header

Stu
Afrow UK is offline   Reply With Quote
Old 22nd September 2007, 11:55   #89
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
Stu,
I am using the array plugin in both my installer and uninstaller in oder to register (during installation) and unregister (during uninstall) a large number of file extensions for my application. I am creating an array at my .onInit function and then call it inside a section of the installer and this works fine.

However if I create the array for the uninstaller in my un.onInit section and try to call it in any of my uninstall sections, the uninstaller crashes (no messages, it just dies).

After playing around with it I finally got it to work without declaring an array in the un.onInit function, but right inside an uninstall section.

Any ideas why this is happening?

Note that even the NSISArray::ArrayExists command inside an uninstall section causes a crash in the case that the array was created in the un.onInit function

Cheers,

CF
CancerFace is offline   Reply With Quote
Old 22nd September 2007, 14:10   #90
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'll need to make a script to reproduce this. If you have one, I would be grateful.

Stu
Afrow UK is offline   Reply With Quote
Old 22nd September 2007, 15:04   #91
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
I can reproduce the crash with this minimal script:
code:
SetCompressor /SOLID lzma
!include "MUI.nsh"
!include "LogicLib.nsh"

OutFile "TEST.exe"
InstallDir "$PROGRAMFILES\Test"

!define EXTENTIONS_ARRAY_LIST_A 'ext1|ext2|ext3|ext4'
!define EXTENTIONS_ARRAY_TYPE_A "TestFile"

Section -Ext
MessageBox MB_OK|MB_ICONEXCLAMATION "Starting Section"
NSISArray::ArrayExists /NOUNLOAD ExtentionsArray
Pop $0
${If} $0 <> 1
NSISArray::New /NOUNLOAD ExtentionsArray 2 2
${EndIf}
MessageBox MB_OK|MB_ICONEXCLAMATION "Starting Process"
NSISArray::WriteListC /NOUNLOAD ExtentionsArray '${EXTENTIONS_ARRAY_LIST_A}' "|"
NSISArray::Debug /NOUNLOAD ExtentionsArray
NSISArray::Clear /NOUNLOAD ExtentionsArray
SectionEnd

Section -Uninstaller
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd

Section -Un.Ext
MessageBox MB_OK|MB_ICONEXCLAMATION "Starting Section"
NSISArray::ArrayExists /NOUNLOAD unExtentionsArray
Pop $0
${If} $0 <> 1
NSISArray::New /NOUNLOAD unExtentionsArray 2 2
${EndIf}
NSISArray::Debug /NOUNLOAD unExtentionsArray
NSISArray::WriteListC /NOUNLOAD unExtentionsArray "${EXTENTIONS_ARRAY_LIST_A}" "|"
NSISArray::Clear /NOUNLOAD unExtentionsArray
SectionEnd

Function .onInit
MessageBox MB_OK|MB_ICONEXCLAMATION "Creating array in .onInit"
NSISArray::New /NOUNLOAD ExtentionsArray 2 2
MessageBox MB_OK|MB_ICONEXCLAMATION "Created array on .onInit"
FunctionEnd

Function un.onInit
MessageBox MB_OK|MB_ICONEXCLAMATION "Creating array in un.onInit"
NSISArray::New /NOUNLOAD unExtentionsArray 2 2
MessageBox MB_OK|MB_ICONEXCLAMATION "Created array in un.onInit"
FunctionEnd

Function .onGUIEnd
MessageBox MB_OK|MB_ICONEXCLAMATION "Deleting Array on .onGUIEnd"
NSISArray::Delete /NOUNLOAD ExtentionsArray
MessageBox MB_OK|MB_ICONEXCLAMATION "Deleted Array on .onGUIEnd"
NSISArray::Unload
FunctionEnd

Function un.onGUIEnd
MessageBox MB_OK|MB_ICONEXCLAMATION "Deleting Array on un.onGUIEnd"
NSISArray::Delete /NOUNLOAD unExtentionsArray
NSISArray::Unload
MessageBox MB_OK|MB_ICONEXCLAMATION "Deleted Array on un.onGUIEnd"
FunctionEnd


The install part works fine.
The uninstaller crashes when the first Array command is called (NSISArray::ArrayExists) if the array is created in un.onInit.
CF
CancerFace is offline   Reply With Quote
Old 6th October 2007, 23:21   #92
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
exactly that script dont crash here ... nsis 2.30, array 1.5rc2
winxp sp2 latest updates, vc8sp1

# ok, vista ultimate on vmware dont crash either

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 7th October 2007, 06:40   #93
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
another problem here...
PHP Code:
!include MUI.nsh
!include NSISArray.nsh

Name 
'Subtract'
OutFile 'NSISArrayExample - Subtract.exe'
ShowInstDetails show

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

${Array} "TestArray1" 1 256
${ArrayFuncWriteList
${ArrayFuncSubtract
${ArrayFuncDebug
${Array} "TestArray2" 1 256
${ArrayFuncWriteList
${ArrayFuncDebug

Section
  
${TestArray1->Init}
  ${
TestArray2->Init}

  ${
TestArray1->WriteList"'we1234.tmp' 'we3456.tmp' 'we5432.tmp'"
  
${TestArray2->WriteList"'we1234.tmp' 'we3456.tmp'"
  
${TestArray1->Debug}

  
DetailPrint 'Subtracting TestArray2 from TestArray1...'
  
${TestArray1->SubtractTestArray2
  
${TestArray2->Delete}
  ${
TestArray1->Debug}
  ${
TestArray1->Delete}
SectionEnd 
result is 'we3456.tmp' - can't obviously...

# array 1.5rc2, nsis 2.30

btw docs have typo
Quote:
1.6.27 ${myArray->Subtract} myArray2

Takes away items in myArray2 that are also in myArray. Items are matched case sensitively.

For a compilable NSIS script example, see Examples\NSISArray\Subtract.nsi.
underlined say wrong direction - it takes content in (2) from (1) away - like example do

Might better: "takes away items in (2) from (1)"

#fix
for my problem i have to add a fake entry (like "---") to both arrays - then it works.

Greets, Brummelchen

Last edited by Brummelchen; 7th October 2007 at 08:13.
Brummelchen is offline   Reply With Quote
Old 7th October 2007, 10:25   #94
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
@Brummelchen
the script works for me as well. The uninstaller that is generated however is the one that crashes. Both on XP/SP2 and 2000/SP4 with nsis 2.31 and array 1.5 RC6. On different PCs as well.
CF
CancerFace is offline   Reply With Quote
Old 7th October 2007, 13:29   #95
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Back from holiday now. Will attempt to fix these problems today if I have time.

Stu
Afrow UK is offline   Reply With Quote
Old 7th October 2007, 17:44   #96
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
>> The uninstaller that is generated however is the one that crashes.

how do i get the uninstaller from that script?
might this line help me to understand

WriteUninstaller "$exedir\uninstall.exe"

>> array 1.5 RC6.

Where to get?

i am currently working on a special supporting program again
which need arrays... ok, there are many other ways but array
will fit them fastest ^^ (snapshot before & after)

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 7th October 2007, 17:53   #97
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Run the installer exe and it will generate uninstall.exe in the same folder.

Stu
Afrow UK is offline   Reply With Quote
Old 7th October 2007, 19:17   #98
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
ok, confirmed with 15rc2 - i now found the uninstaller here.
for my blame i did not investigate more time yesterday about that.
au_.exe crashes

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 7th October 2007, 19:46   #99
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
Quote:
Where to get?
I got it from here

CF
CancerFace is offline   Reply With Quote
Old 7th October 2007, 20:13   #100
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
oh, i see - thats same i have - but i got it from here
http://nsis.sourceforge.net/Array_plug-in
(there is no such info, only mentioned as 1.5 in html doc)

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 7th October 2007, 20:43   #101
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
There is a deeper problem here - possible bug with WriteList. I don't have a build machine available right now so I'll continue tomorrow.

Stu
Afrow UK is offline   Reply With Quote
Old 12th October 2007, 18:05   #102
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
CancerFace, I found that the crash that you were experiencing was because your array name was too long. The new build has 32 bytes allocated for array names (as opposed to 16).

Brummelchen, fixed Subtract.

I also found a memory leak in the Delete function which is now fixed.

http://nsis.sf.net/File:NSISArray.zip

Stu
Afrow UK is offline   Reply With Quote
Old 12th October 2007, 18:23   #103
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
thank you

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 12th October 2007, 18:53   #104
CancerFace
Senior Member
 
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
Groovy!
Thanks Stu!


CF
CancerFace is offline   Reply With Quote
Old 17th October 2007, 06:34   #105
congtak
Junior Member
 
Join Date: Oct 2007
Posts: 12
Lightbulb

Hi, I think there is a possible bug in the {Array->ReadtoStack} function
when I do ${TestArray->ReadtoStack} 0 -1
and TestArray only has one element in it, nothing gets copied to the stack.

To test this I change the ReadToStack.nsi
${TestArray->WriteList} "'zero'"
${TestArray->ReadtoStack} 0 -1
Pop $R0
$R0 is empty.

Thank you
congtak is offline   Reply With Quote
Old 18th October 2007, 20:33   #106
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
This was indeed a bug. Thanks, fixed.
http://nsis.sf.net/File:NSISArray.zip

Stu
Afrow UK is offline   Reply With Quote
Old 18th October 2007, 23:02   #107
congtak
Junior Member
 
Join Date: Oct 2007
Posts: 12
Thumbs up

cool
congtak is offline   Reply With Quote
Old 13th February 2008, 08:36   #108
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
${myArray->Concat} $Var ""

returns empty string - is the connecting character mandatory?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 13th February 2008, 17:20   #109
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I've never tried that but yes it shouldn't be. I will look at it soon, thanks.

Stu
Afrow UK is offline   Reply With Quote
Old 13th February 2008, 17:28   #110
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
i have another problem, pls have a look here - it blows the memory and make it crash
PHP Code:
Function anagram_sort
  Pop  $R9 
;source
  Push $R5
  Push $R6
  Push $R7
  Push $R8

  
;insert seperater
  StrCpy $R6 
""
  
StrCpy $R7 "0"
  
loop1:
  
StrCpy $R8 $R9 1 $R7
  StrCmp $R8 
"" loop1_done
    StrCpy $R6 
"$R6$R8|"
    
IntOp $R7 $R7 1
    
Goto loop1
  loop1_done
:
  
StrCpy $R9 $R6 -1
  
;messagebox mb_ok "'$R9'"

  
${anagram->Init}
  ${
anagram->Clear}
  ;
write array
  ${
anagram->WriteListC$R9 "|"
  
;sort array
  ${
anagram->Sort""
  
;read array
  
StrCpy $R9 ""
  
${anagram->ReadtoStack-1
  Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
Pop $R5
  StrCpy $R9 
"$R9$R5"
  
${anagram->Delete}

  
Push $R9
  Push 
"|"
  
Push ""
    
Call StrRep
  Pop $R9

  
;messagebox mb_ok "'$R9'"
  
Pop  $R8
  Pop  $R7
  Pop  $R6
  Pop  $R5
  Push $R9
FunctionEnd 
The code works on 429mbyte with 4meg lines each 9 byte (11 with LF).
The crash is around 2.7mbyte above line 256.400.
(simple character sort)

The Math script instead with bubble sort is working here now for hours.

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 21st May 2008, 10:07   #111
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Can you produce a fully working script to reproduce the problem?

Stu
Afrow UK is offline   Reply With Quote
Old 25th August 2008, 17:19   #112
Ilitirit
Junior Member
 
Join Date: Nov 2001
Posts: 27
How do I add an empty string to an array?

I tried
${Array->Write} $0 ""

but it doesn't add the element.
Ilitirit is offline   Reply With Quote
Old 12th March 2009, 07:22   #113
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
NSISArray::SearchI seems to modify the array elements. Would it be possible to just temporarily convert them to lower case when comparing?

Edit: Something like this might possibly work. I haven't tried it, or even compiled it...
code:
// Function: Search for string inside string
BOOL my_strstr(TCHAR *s1, int len_s1, TCHAR *s2, int len_s2, BOOL bCaseSensitive)
{
int i = 0, j = 0;

for (;;)
{
if (s2[j] == '\0')
return TRUE;
if (s1[i] == '\0')
return FALSE;
if (s1[i] == s2[j] ||
(!bCaseSensitive && LOWORD(CharLower(s1[i])) == LOWORD(CharLower(s2[j]))))
{
i++;
j++;
}
else
{
i = i - j + 1;
j = 0;
}
}
return FALSE;
}


Last edited by TobbeSweden; 12th March 2009 at 07:50.
TobbeSweden is offline   Reply With Quote
Old 12th March 2009, 16:56   #114
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
I've got an array declared in the global scope with ${Array}. I call init on it in .onInit. After that I can use it in the installer.

Trying to use it in the uninstaller I get an error about the array not existing. Trying to init it in un.onInit I get an error about calling init on the array twice :S

What should I do? Do I really have to make two arrays, one for install and one for uninstall?
TobbeSweden is offline   Reply With Quote
Old 12th March 2009, 19:44   #115
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Quote:
Originally posted by TobbeSweden
Do I really have to make two arrays, one for install and one for uninstall?
In short: yes.
Animaether is offline   Reply With Quote
Old 12th March 2009, 19:57   #116
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
Ok. Too bad.
TobbeSweden is offline   Reply With Quote
Old 12th March 2009, 21:13   #117
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
Here's another problem I'm having. SizeOf doesn't work...

This code:
code:

${whereprofilesarray->SizeOf} $3 $4 $5
MessageBox MB_OK "EnumerateUsers.nsh(${__LINE__}): $3 = $4 = $5 Will show debug next"
${whereprofilesarray->Debug}

NSISArray::ErrorStyle /NOUNLOAD 2

${whereprofilesarray->SizeOf} $3 $4 $5
MessageBox MB_OK "EnumerateUsers.nsh(${__LINE__}): $3 = $4 = $5 Will show debug next"
${whereprofilesarray->Debug}



Gives me these message boxes:
code:

---------------------------
Program Installation
---------------------------
EnumerateUsers.nsh(34.32): 1024 = 5 = 1 Will show debug next
---------------------------
OK
---------------------------


---------------------------
Program Installation
---------------------------
EnumerateUsers.nsh(34.38): 5 = 1 = Will show debug next
---------------------------
OK
---------------------------



As you can see in the second message box the SizeOf return values are wrong. The last return value (blank in this case) seems to vary depending on what's on the stack...

The Debug output looks correct.
TobbeSweden is offline   Reply With Quote
Old 15th March 2009, 17:24   #118
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
This particular problem goes away if I remove 'NSISArray::ErrorStyle /NOUNLOAD 2' and use '${ArrayErrorStyle} MsgBox' instead.

I'm using scripts from the wiki that uses the direct plugin calls (NSISArray::*) for portability and in my own code I use the header wrappers because I find them easier to work with.

Is this the real source of my problems? Is it a known fact that you can't mix the header file macros with direct NSISArray:: calls?
TobbeSweden is offline   Reply With Quote
Old 16th March 2009, 14:10   #119
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'm back home in 2 weeks. I will have a look at these bugs then.

Stu
Afrow UK is offline   Reply With Quote
Old 16th March 2009, 17:00   #120
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
I've "solved" it by replacing all NSISArray:: calls with their header macro alternatives. Everything seems to work as it should now
TobbeSweden is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump