Archive: really needs to get done


really needs to get done
Hey I am having problems with my installer. I added a new page to edit a Registry file. This is before it is put into regedit. I get to this point and it stalls the installer. I was wondering if anyone can tell me how to fix this. Here is my code....

I really need this to be finished up as soon as possible so any info would be greatly apreciated. Thanks


;show regEdit gui---------------------------
Function regEdit

!insertmacro MUI_HEADER_TEXT "Edit the Registry," "read instruction below for this step."

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "RegEditing.ini"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "RegEditing.ini"

FunctionEnd
;-----------------------------------------------------

;Edit Generic NBC Reg Key------------------------------
Function leaveRegEdit

ReadINIStr $7 "$PLUGINSDIR\Regedit.ini" "Field 2" "State"
ReadINIStr $6 "$PLUGINSDIR\Regedit.ini" "Field 1" "State"

Call Regedit1
Call Regedit2

FunctionEnd
;------------------------------------------------------------

;------------------------------------------------------------
Function Regedit1

StrCpy $0 "$6" # set your custom string
StrCpy $1 "/" # set the character to insert
StrLen $2 $0 # get the length of your string to loop through it
StrCpy $3 "0" # init the loop counter
StrCpy $4 "" # init output var

loop: # begin of the loop
StrCpy $5 $0 1 $3 # copy one character of your string to a temp var (offset $3 counts up)
StrCpy $4 "$4$1$5" # add the character extracted and the one to insert everytime
IntOp $3 $3 + 1 # increase counter/offset
IntCmp $2 $3 end loop #stop the loop if end of string reached, else continue
end:
# at this stage, $4 will be "/C/o/m/p/a/n/y"

Push "/I/I/M/S" #text to be replaced
Push $4 #replace with
Push all #replace all occurrences
Push all #replace all occurrences
Push "$INSTDIR\WARN\Dashboard\NBC\Generic NBC reg keys.reg" #file to replace in
Call AdvReplaceInFile
FunctionEnd
;------------------------------------------------------------

;------------------------------------------------------------
Function Regedit2

StrCpy $0 "$7" # set your custom string
StrCpy $1 "/" # set the character to insert
StrLen $2 $0 # get the length of your string to loop through it
StrCpy $3 "0" # init the loop counter
StrCpy $4 "" # init output var

loop1: # begin of the loop
StrCpy $5 $0 1 $3 # copy one character of your string to a temp var (offset $3 counts up)
StrCpy $4 "$4$1$5" # add the character extracted and the one to insert everytime
IntOp $3 $3 + 1 # increase counter/offset
IntCmp $2 $3 end loop1 #stop the loop if end of string reached, else continue
end:
# at this stage, $4 will be "/C/o/m/p/a/n/y"

Push "/C/A/S/P/O/D" #text to be replaced
Push $4 #replace with
Push all #replace all occurrences
Push all #replace all occurrences
Push "$INSTDIR\WARN\Dashboard\NBC\Generic NBC reg keys.reg" #file to replace in
Call AdvReplaceInFile
FunctionEnd
;------------------------------------------------------


Did you notice that you have the same label in both functions? "end:" is not needed in either function. replace the references to it with a 0 (a placeholder) since you don't need them.


What do you mean Refereces? just put a "0" instead of a "end:"?


References are the places where you used the label, the IntCmp instructions. You take out the label name and put in a zero:


IntCmp $2 $3 0 loop1 #stop the loop if end of string reached, else continue
# at this stage, $4 will be "/C/o/m/p/a/n/y"

It's OK to have the lables named the same--they are in different functions, so there won't be any confusion in doing do.

But, you should extract the page file during .onInit, not in the page's display function. As you have it written, the custom page will be overwritten (set back to default) each time it's displayed becuase you're re-extracting the file at the beginning of the show function.


so would you know why it would be stalling?


Did you read the 2nd part of my post?

[edit]
Also:
change your IntCmp functions to this:


IntCmp $2 $3 end loop loop

Without the last parameter, it was stopping the loop when $2 was greater than $3 (which would have been all the time when starting the loop). With your original code, you would have had $4 = "/c" and not "/C/o/m/p/a/n/y".
[end edit]