WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WIL Extenders
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Updating extenders on the fly

 Keywords:  replace 

Question:

I would like to automatically update old extenders at a customers site. I find that if I make a LARGE exe contining the new version of an extender, the new version does not replace the old version.

Answer:

There are several possible solutions.

One easy solution is to simply add the extender file(s) into the "Other Files" section instead of the "Extenders" section of the compiler options

Another method is to detect the error, delete the old file, and restart the program to attempt to extract the extender dll again. Possibly something like this code...

;This code assumes a LARGE exe build with the correct extender included
;And assumes the extender is not chared with other users or other scripts
;running.

; Script is currently in a "NOT COMPLETELY DEBUGGED status

MinExtenderVerRequired=44015     ; Minimum good extender version number
ExtenderName="wwimg44i.dll"      ; Extender name

LastError()                      ; Clear any previous error information
ErrorMode(@OFF)                  ; temporarily disable error handling
   flag=AddExtender(ExtenderName,MinExtenderVerRequired)
ErrorMode(@CANCEL)
If flag==0                       ; Did addextender fail?
   err=LastError()               ; get last error number
   If err == 1654                ; extender version number error
      fn=FileLocate(Extendername); find full path to the file
      ErrorMode(@OFF)
         flag2=FileDelete(fn)    ; attempt to delete the file
      ErrorMode(@CANCEL)
      If flag2==0                ; uh-oh, delete failed
         Message("Error 8801","Could not delete old extender.  Possibly in use.")
         Exit
      EndIf
      passedparams=""            ; try rto recover passed parameter string, if any
      For x=1 To param0
         If x==1 Then passedparams=StrCat('"',param1,'"')
         Else passedparams=StrCat(passedparams," ",'"',param%x%,'"')
      Next
      exe=IntControl(1004,0,0,0,0); get original exe name
      Run(exe,passedparams)       ; run exe with parameters.  Hope for the best...
      Exit
  Else
      Message("Error 8802",StrCat("AddExtender load error ",err))
      Exit
  EndIf
EndIf      

Article ID:   W16786
File Created: 2007:07:03:14:26:16
Last Updated: 2007:07:03:14:26:16