@@ -252,7 +252,7 @@ Const $zpaq = Quote($archdir & "zpaq.exe", True)
252
252
Const $zoo = " unzoo.exe"
253
253
254
254
; Exractor plugins
255
- Const $bms = " BMS.bms"
255
+ Const $bms = @TempDir & " \ BMS.bms"
256
256
Const $dbx = " dbxplug.wcx"
257
257
Const $gaup = " gaup_pro.wcx"
258
258
Const $ie = " InstExpl.wcx"
@@ -2212,6 +2212,28 @@ Func extract($arctype, $arcdisp = 0, $additionalParameters = "", $returnSuccess
2212
2212
_Run($7z & ' x "' & $outdir & ' \' & $filename & ' "' , $outdir )
2213
2213
FileDelete ($outdir & ' \' & $filename )
2214
2214
EndIf
2215
+ ElseIf StringInStr ($sFileType , " SFX" ) Then
2216
+ Cout(" Trying to extract sfx script" )
2217
+ _CreateTrayMessageBox(t(' SCANNING_FILE' , " 7z SFX Archives splitter" ))
2218
+
2219
+ Run (_MakeCommand($7zsplit & ' "' & $file & ' "' ), $outdir , @SW_HIDE )
2220
+ WinWait (" 7z SFX Archives splitter" )
2221
+ ControlClick (" 7z SFX Archives splitter" , " " , " Button8" )
2222
+ ControlClick (" 7z SFX Archives splitter" , " " , " Button1" )
2223
+ $TimerStart = TimerInit ()
2224
+
2225
+ Do
2226
+ Sleep (100 )
2227
+ If WinExists (" 7z SFX Archives splitter warning" ) Then WinClose (" 7z SFX Archives splitter warning" )
2228
+ $TimerDiff = TimerDiff ($TimerStart )
2229
+ If $TimerDiff > $Timeout Then ExitLoop
2230
+ Until FileExists ($filedir & " \" & $filename & " .txt" ) Or WinExists (" 7z SFX Archives splitter error" )
2231
+
2232
+ ProcessClose (" 7ZSplit.exe" )
2233
+ _DeleteTrayMessageBox()
2234
+
2235
+ Local $sPath = $filedir & " \" & $filename & " .txt"
2236
+ If FileExists ($sPath ) Then _FileMove($sPath , $outdir & " \" & $filename & " _SFX-Script.txt" )
2215
2237
EndIf
2216
2238
2217
2239
Case $TYPE_ACE
@@ -2817,8 +2839,9 @@ Func extract($arctype, $arcdisp = 0, $additionalParameters = "", $returnSuccess
2817
2839
FileDelete ($bindir & " rnd" )
2818
2840
2819
2841
Case $TYPE_QBMS
2820
- _Run($quickbms & ' "' & $bindir & $additionalParameters & ' " "' & $file & ' " "' & $outdir & ' "' , $outdir , @SW_MINIMIZE , True , False )
2821
- If FileExists ($bindir & $bms ) Then FileDelete ($bindir & $bms )
2842
+ Local $sPlugin = $additionalParameters ? $bindir & $additionalParameters : $bms
2843
+ _Run($quickbms & ' "' & $sPlugin & ' " "' & $file & ' " "' & $outdir & ' "' , $outdir , @SW_MINIMIZE , True , False )
2844
+ If FileExists ($bms ) Then FileDelete ($bms )
2822
2845
2823
2846
If $additionalParameters == $ie Then
2824
2847
Local $aCleanup [] = [" [NSIS].nsi" , " [LICENSE].*" , " $PLUGINSDIR" , " $TEMP" , " uninstall.exe" , " [LICENSE]" ]
@@ -3234,29 +3257,6 @@ Func extract($arctype, $arcdisp = 0, $additionalParameters = "", $returnSuccess
3234
3257
3235
3258
Switch $success
3236
3259
Case $RESULT_SUCCESS
3237
- ; Special actions for 7zip extraction
3238
- If $arctype == $TYPE_7Z And ($fileext = " exe" Or StringInStr ($sFileType , " SFX" )) Then
3239
- ; Check if sfx archive and extract sfx script using 7ZSplit if possible
3240
- _CreateTrayMessageBox(t(' SCANNING_FILE' , " 7z SFX Archives splitter" ))
3241
- Cout(" Trying to extract sfx script" )
3242
- Run (_MakeCommand($7zsplit & ' "' & $file & ' "' ), $outdir , @SW_HIDE )
3243
- WinWait (" 7z SFX Archives splitter" )
3244
- ControlClick (" 7z SFX Archives splitter" , " " , " Button8" )
3245
- ControlClick (" 7z SFX Archives splitter" , " " , " Button1" )
3246
- $TimerStart = TimerInit ()
3247
- Do
3248
- Sleep (100 )
3249
- If WinExists (" 7z SFX Archives splitter warning" ) Then WinClose (" 7z SFX Archives splitter warning" )
3250
- $TimerDiff = TimerDiff ($TimerStart )
3251
- If $TimerDiff > $Timeout Then ExitLoop
3252
- Until FileExists ($filedir & " \" & $filename & " .txt" ) Or WinExists (" 7z SFX Archives splitter error" )
3253
- ; Force close all messages
3254
- ProcessClose (" 7ZSplit.exe" )
3255
-
3256
- ; Move sfx script to outdir
3257
- If FileExists ($filedir & " \" & $filename & " .txt" ) Then _FileMove($filedir & " \" & $filename & " .txt" , $outdir & " \sfx_script_" & $filename & " .txt" )
3258
- _DeleteTrayMessageBox()
3259
- EndIf
3260
3260
3261
3261
Case $RESULT_NOFREESPACE
3262
3262
terminate($STATUS_NOFREESPACE )
@@ -3369,19 +3369,18 @@ Func BmsExtract($sName, $hDB = 0)
3369
3369
If $hDB Then
3370
3370
Local $aReturn [0 ], $iRows , $iColumns
3371
3371
_SQLite_GetTable($hDB , Cout(" SELECT s.Script FROM Scripts s, Names n WHERE s.SID = n.NID AND Name = '" & $sName & " '" ), $aReturn , $iRows , $iColumns )
3372
- ; ~ _ArrayDisplay($aReturn)
3373
3372
3374
3373
; Write script to file and execute it
3375
- $bmsScript = FileOpen ($bindir & $bms , $FO_OVERWRITE )
3376
- FileWrite ($bmsScript , $aReturn [2 ])
3377
- FileClose ($bmsScript )
3378
- $return = FetchStdout($quickbms & ' -l "' & $bindir & $ bms & ' " "' & $file & ' "' , $filedir , @SW_HIDE , - 1 )
3374
+ $hFile = FileOpen ($bms , $FO_OVERWRITE )
3375
+ FileWrite ($hFile , $aReturn [2 ])
3376
+ FileClose ($hFile )
3377
+ $return = FetchStdout($quickbms & ' -l "' & $bms & ' " "' & $file & ' "' , $filedir , @SW_HIDE , - 1 )
3379
3378
3380
3379
If Not StringInStr ($return , " 0 files found" ) And Not StringInStr ($return , " Error" ) And Not StringInStr ($return , " invalid" ) _
3381
3380
And Not StringInStr ($return , " expected: " ) And $return <> " " Then
3382
3381
_SQLite_Close($hDB )
3383
3382
_SQLite_Shutdown()
3384
- extract($TYPE_QBMS , $sName & " " & t(' TERM_PACKAGE' ), $bms )
3383
+ extract($TYPE_QBMS , $sName & " " & t(' TERM_PACKAGE' ))
3385
3384
EndIf
3386
3385
EndIf
3387
3386
@@ -3391,10 +3390,16 @@ EndFunc
3391
3390
; Start SQLite and open a database
3392
3391
Func OpenDB($sName )
3393
3392
_SQLite_Startup()
3394
- If @error Then Return Cout(" [ERROR] SQLite startup failed with code " & @error )
3393
+ If @error Then
3394
+ Cout(" Error: SQLite startup failed with code " & @error )
3395
+ Return False
3396
+ EndIf
3395
3397
3396
- $hDB = _SQLite_Open($bindir & $sName , $SQLITE_OPEN_READONLY )
3397
- If @error Then Return Cout(" [ERROR] Failed to open database " & $sName )
3398
+ Local $hDB = _SQLite_Open($bindir & $sName , $SQLITE_OPEN_READONLY )
3399
+ If @error Then
3400
+ Cout(" Error: Failed to open database " & $sName )
3401
+ Return False
3402
+ EndIf
3398
3403
3399
3404
Return $hDB
3400
3405
EndFunc
0 commit comments