forked from Bioruebe/UniExtract2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UniExtract.au3
6418 lines (5424 loc) · 236 KB
/
UniExtract.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=.\Support\Icons\uniextract_exe.ico
#AutoIt3Wrapper_Outfile=.\UniExtract.exe
#AutoIt3Wrapper_Res_Comment=Compiled with AutoIt http://www.autoitscript.com/
#AutoIt3Wrapper_Res_Description=Universal Extractor
#AutoIt3Wrapper_Res_Fileversion=2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=GNU General Public License v2
#AutoIt3Wrapper_Res_Field=Author|Jared Breland <[email protected]>
#AutoIt3Wrapper_Res_Field=Homepage|http://www.legroom.net/software
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_AU3Check_Parameters=-w 4 -w 5
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/mo
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;
; ---------------------------------------------------------------------------e
;
; Universal Extractor v2.0.0
; Author: Jared Breland <[email protected]>, Version 2.0.0 by Bioruebe
; Homepage: http://www.legroom.net/mysoft
; Language: AutoIt v3.3.10.2
; License: GNU General Public License v2 (http://www.gnu.org/copyleft/gpl.html)
;
; Very Basic Script Function:
; Use Unix File Tool and TrID to determine filetype
; Use Exeinfo PE and PEiD to identify executable filetypes
; Extract known archive types
;
; ----------------------------------------------------------------------------
; Setup environment
#include <APIConstants.au3>
#include <Array.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <Crypt.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <GUIEdit.au3>
#include <GuiListBox.au3>
#include <INet.au3>
#include <Math.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>
#include <SQLite.au3>
#include <StaticConstants.au3>
#include <String.au3>
#include <WinAPI.au3>
#include <WinAPIShPath.au3>
#include <WindowsConstants.au3>
#include "HexDump.au3"
#include "Pie.au3"
Const $name = "Universal Extractor"
Const $sVersion = "2.0.0 RC 1"
Const $codename = '"Back from the grave"'
Const $title = $name & " " & $sVersion
Const $website = "https://www.legroom.net/software/uniextract"
Const $website2 = "https://bioruebe.com/dev/uniextract"
Const $websiteGithub = "https://github.com/Bioruebe/UniExtract2"
Const $sUpdateURL = "https://update.bioruebe.com/uniextract/data/"
Const $sLegacyUpdateURL = "https://update.bioruebe.com/uniextract/update2.php"
Const $sGetLinkURL = "https://update.bioruebe.com/uniextract/geturl.php?q="
Const $sSupportURL = "https://support.bioruebe.com/uniextract/upload.php"
Const $sStatsURL = "https://stat.bioruebe.com/uniextract/stats.php?a="
Const $sPrivacyPolicyURL = "https://bioruebe.com/dev/uniextract/privacypolicy"
Const $bindir = @ScriptDir & "\bin\"
Const $langdir = @ScriptDir & "\lang\"
Const $defdir = @ScriptDir & "\def\"
Const $sUpdater = @ScriptDir & '\UniExtractUpdater.exe'
Const $sUpdaterNoAdmin = @ScriptDir & '\UniExtractUpdater_NoAdmin.exe'
Const $sEnglishLangFile = @ScriptDir & '\English.ini'
Const $sRegExAscii = "(?i)(?m)^[\w\Q @!§$%&/\()=?,.-:+~'²³{[]}*#ß°^âëöäüîêôûïáéíóúàèìòù\E]+$"
;~ Const $cmd = @ComSpec & ' /d /k ' ; Keep command prompt open for debugging
Const $cmd = (FileExists(@ComSpec)? @ComSpec: @WindowsDir & '\system32\cmd.exe') & ' /d /c '
Const $HISTORY_FILE = "File History", $HISTORY_DIR = "Directory History"
Enum $OPTION_KEEP, $OPTION_DELETE, $OPTION_ASK, $OPTION_MOVE
Enum $RESULT_UNKNOWN, $RESULT_SUCCESS, $RESULT_FAILED, $RESULT_CANCELED, $RESULT_NOFREESPACE
Enum $UNICODE_NONE, $UNICODE_MOVE, $UNICODE_COPY
Enum $UPDATE_ALL, $UPDATE_HELPER, $UPDATE_MAIN
Enum $UPDATEMSG_PROMPT, $UPDATEMSG_SILENT, $UPDATEMSG_FOUND_ONLY
Const $PACKER_UPX = "UPX", $PACKER_ASPACK = "Aspack"
Const $STATUS_SYNTAX = "syntax", $STATUS_FILEINFO = "fileinfo", $STATUS_UNKNOWNEXE = "unknownexe", $STATUS_UNKNOWNEXT = "unknownext", _
$STATUS_INVALIDFILE = "invalidfile", $STATUS_INVALIDDIR = "invaliddir", $STATUS_NOTPACKED = "notpacked", $STATUS_BATCH = "batch", _
$STATUS_NOTSUPPORTED = "notsupported", $STATUS_MISSINGEXE = "missingexe", $STATUS_TIMEOUT = "timeout", $STATUS_PASSWORD = "password", _
$STATUS_MISSINGDEF = "missingdef", $STATUS_MOVEFAILED = "movefailed", $STATUS_NOFREESPACE = "nofreespace", $STATUS_MISSINGPART = "missingpart", _
$STATUS_FAILED = "failed", $STATUS_SUCCESS = "success", $STATUS_SILENT = "silent"
Const $TYPE_7Z = "7z", $TYPE_ACE = "ace", $TYPE_AI = "ai", $TYPE_ALZ = "alz", $TYPE_ARC_CONV = "arc_conv", $TYPE_AUDIO = "audio", _
$TYPE_BCM = "bcm", $TYPE_BOOTIMG = "bootimg", $TYPE_CAB = "cab", $TYPE_CHM = "chm", $TYPE_CI = "ci", $TYPE_CRAGE = "crage", _
$TYPE_CTAR = "ctar", $TYPE_DGCA = "dgca", $TYPE_DAA = "daa", $TYPE_DCP = "dcp", $TYPE_EI = "ei", $TYPE_ETHORNELL = "ethornell", _
$TYPE_ENIGMA = "enigma", $TYPE_FEAD = "fead", $TYPE_FREEARC = "freearc", $TYPE_FSB = "fsb", $TYPE_GCF = "gcf", $TYPE_GHOST = "ghost", _
$TYPE_HLP = "hlp", $TYPE_HOTFIX = "hotfix", $TYPE_IMG = "img", $TYPE_INNO = "inno", $TYPE_IS3ARC = "is3arc", $TYPE_ISCAB = "iscab", _
$TYPE_ISEXE = "isexe", $TYPE_ISZ = "isz", $TYPE_KGB = "kgb", $TYPE_LZ = "lz", $TYPE_LZO = "lzo", $TYPE_LZX = "lzx", $TYPE_MHT = "mht", _
$TYPE_MOLE = "mole", $TYPE_MSI = "msi", $TYPE_MSM = "msm", $TYPE_MSP = "msp", $TYPE_NBH = "nbh", $TYPE_NSIS = "NSIS", $TYPE_PEA = "pea", _
$TYPE_QBMS = "qbms", $TYPE_RAR = "rar", $TYPE_RGSS3 = "rgss3", $TYPE_ROBO = "robo", $TYPE_RPA = "rpa", $TYPE_SFARK = "sfark", _
$TYPE_SGB = "sgb", $TYPE_SIM = "sim", $TYPE_SIT = "sit", $TYPE_SQLITE = "sqlite", $TYPE_SUPERDAT = "superdat", $TYPE_SWF = "swf", _
$TYPE_SWFEXE = "swfexe", $TYPE_TAR = "tar", $TYPE_THINSTALL = "thinstall", $TYPE_TTARCH = "ttarch", $TYPE_UHA = "uha", _
$TYPE_UIF = "uif", $TYPE_UNITY = "unity", $TYPE_UNREAL = "unreal", $TYPE_VIDEO = "video", $TYPE_VIDEO_CONVERT = "video_convert", _
$TYPE_VISIONAIRE3 = "visionaire3", $TYPE_VSSFX = "vssfx", $TYPE_VSSFX_PATH = "vssfxpath", $TYPE_WISE = "wise", $TYPE_WIX = "wix", _
$TYPE_ZIP = "zip", $TYPE_ZOO = "zoo", $TYPE_ZPAQ = "zpaq"
Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1 + 2)
Opt("TrayIconDebug", 1)
; Preferences
Global $settingsdir = @AppDataDir & "\Bioruebe\UniExtract"
Global $batchEnabled = 0
Global $language = ""
Global $history = 1
Global $appendext = 0
Global $warnexecute = 1
Global $freeSpaceCheck = 1
Global $NoBox = 0
Global $bHideStatusBoxIfFullscreen = 1
Global $OpenOutDir = 0
Global $iDeleteOrigFile = $OPTION_KEEP
Global $Timeout = 60000 ; milliseconds
Global $updateinterval = 1 ; days
Global $lastupdate = "2010/12/05" ; last official version
Global $addassocenabled = 0
Global $addassocallusers = 0
Global $addassoc = ""
Global $ID = ""
Global $FB_ask = 0
Global $Opt_ConsoleOutput = 0
Global $Log = 0
Global $CheckGame = 1
Global $bSendStats = 1
Global $iCleanup = $OPTION_MOVE
Global $KeepOutdir = 0
Global $KeepOpen = 0
Global $silentmode = 0
Global $extract = 1
Global $checkUnicode = 1
Global $bExtractVideo = 1
Global $StoreGUIPosition = 0
Global $iTopmost = 0
Global $posx = -1, $posy = -1
Global $trayX = -1, $trayY = -1
; Global variables
Dim $file, $filename, $filenamefull, $filedir, $fileext, $initoutdir, $outdir, $filetype = "", $initdirsize
Dim $prompt, $return, $Output, $hMutex
Dim $About, $Type, $win7, $silent, $iUnicodeMode = False, $reg64 = ""
Dim $debug = "", $guimain = False, $success = $RESULT_UNKNOWN, $TBgui = 0, $isofile = 0, $exStyle = -1, $sArcTypeOverride = 0
Dim $test, $test7z, $testzip, $testie, $testinno
Dim $innofailed, $arjfailed, $7zfailed, $zipfailed, $iefailed, $isfailed, $isofailed, $tridfailed, $gamefailed, $unpackfailed, $exefailed
Dim $oldpath, $oldoutdir, $sUnicodeName, $createdir
Dim $FS_GUI = False, $idTrayStatusExt, $BatchBut
Dim $isexe = False, $Message, $run = 0, $runtitle, $DeleteOrigFileOpt[3]
Dim $gaDropFiles[1], $queueArray[0], $aTridDefinitions[0][0], $aFileDefinitions[0][0]
; Check if OS is 64 bit version
If @OSArch == "X64" Or @OSArch == "IA64" Then
Global $OSArch = "x64"
Global $reg64 = 64
Else
Global $OSArch = "x86"
EndIf
Global Const $archdir = $bindir & $OSArch & "\"
; Extractors
Const $7z = Quote($archdir & '7z.exe', True) ;x64 ;15.05
Const $7zsplit = "7ZSplit.exe" ;0.2
Const $ace = $bindir & "xace.exe" ;2.6
Const $alz = "unalz.exe" ;0.64
Const $arj = "arj.exe" ;3.10
Const $aspack = "AspackDie.exe" ;1.4.1
Const $bcm = Quote($archdir & "bcm.exe", True) ;x64 ;1.00
Const $daa = "daa2iso.exe" ;0.1.7e
Const $enigma = "EnigmaVBUnpacker.exe" ;0.44
Const $ethornell = "ethornell.exe" ;unknown
Const $exeinfope = Quote($bindir & "exeinfope.exe") ;0.0.3.7
Const $filetool = Quote($bindir & "file\bin\file.exe", True) ;5.03
Const $freearc = "unarc.exe" ;0.666
Const $fsb = "fsbext.exe" ;0.3.3
Const $gcf = $archdir & "GCFScape.exe" ;x64 ;1.8.2
Const $hlp = "helpdeco.exe" ;2.1
Const $img = "EXTRNT.EXE" ;2.10
Const $inno = "innounp.exe" ;0.45
Const $is6cab = "i6comp.exe" ;0.2
Const $isxunp = "IsXunpack.exe" ;0.99
Const $isz = "unisz.exe" ;?
Const $kgb = 'kgb\kgb2_console.exe' ;1.2.1.24
Const $lit = "clit.exe" ;1.8
Const $lzo = "lzop.exe" ;1.03
Const $lzx = "unlzx.exe" ;1.21
Const $mht = "extractMHT.exe" ;1.0
Const $mole = "demoleition.exe" ;0.5
Const $msi_msix = "MsiX.exe" ;1.0
Const $msi_jsmsix = "jsMSIx.exe" ;1.11.0704
Const $msi_lessmsi = Quote($bindir & 'lessmsi\lessmsi.exe', True) ;1.4
Const $nbh = "NBHextract.exe" ;1.0
Const $pea = Quote($bindir & "pea.exe") ;0.53/1.0
Const $peid = Quote($bindir & "peid.exe") ;0.95 2012/04/24
Const $quickbms = Quote($bindir & "quickbms.exe", True) ;0.6.4
Const $rai = "RAIU.EXE" ;0.1a
Const $rar = "unrar.exe" ;5.50
Const $rpa = "unrpa.exe" ;1.5.2
Const $sfark = "sfarkxtc.exe" ;3.0
Const $sit = Quote($bindir & "Expander.exe") ;6.0
Const $sqlite = "sqlite3.exe" ;3.10.2
Const $stix = "stix_d.exe" ;2001/06/13
Const $swf = "swfextract.exe" ;0.9.1
Const $trid = "trid.exe" ;2.10 2012/05/06
Const $ttarch = "ttarchext.exe" ;0.2.4
Const $uharc = "UNUHARC06.EXE" ;0.6b
Const $uharc04 = "UHARC04.EXE" ;0.4
Const $uharc02 = "UHARC02.EXE" ;0.2
Const $uif = "uif2iso.exe" ;0.1.7c
Const $unity = "disunity.bat" ;0.3.2
Const $unshield = "unshield.exe" ;0.5
Const $upx = "upx.exe" ;3.08w
Const $visionaire3 = "VIS3Ext.exe" ;2.2.6581.0
Const $wise_ewise = "e_wise_w.exe" ;2002/07/01
Const $wise_wun = "wun.exe" ;0.90A
Const $wix = Quote($bindir & "dark\dark.exe", True) ;3.10.3.3007
Const $zip = "unzip.exe" ;6.00
Const $zpaq = _IsWinXP("zpaqxp.exe", Quote($archdir & "zpaq.exe", True)) ;x64 ;7.07
Const $zoo = "unzoo.exe" ;4.5
; Plugins
Const $bms = "BMS.bms"
Const $dbx = "dbxplug.wcx"
Const $gaup = "gaup_pro.wcx"
Const $ie = "InstExpl.wcx"
Const $iso = "Iso.wcx"
Const $mht_plug = "MhtUnPack.wcx"
Const $msi_plug = "msi.wcx"
Const $sis = "PDunSIS.wcx"
; Other
Const $mtee = Quote($bindir & "mtee.exe")
Const $wtee = Quote($bindir & "wtee.exe")
Const $tee = @OSVersion = "WIN_10"? $wtee: $mtee
Const $mediainfo = $bindir & "MediaInfo.dll" ; 0.7.72
Const $xor = "xor.exe"
; Not included binaries
Const $arc_conv = "arc_conv.exe"
Const $bootimg = "bootimg.exe"
Const $ci = "ci-extractor.exe"
Const $crage = Quote($bindir & "crass-0.4.14.0\crage.exe", True)
Const $dcp = "dcp_unpacker.exe"
Const $dgca = "dgcac.exe"
Const $ffmpeg = Quote($archdir & "ffmpeg.exe", True) ;x64
Const $iscab = "iscab.exe"
Const $is5cab = "i5comp.exe"
Const $mpq = "mpq.wcx" & $reg64
Const $rgss3 = Quote($bindir & "RPGDecrypter.exe")
Const $sim = "sim_unpacker.exe"
Const $thinstall = Quote($bindir & "Extractor.exe", True)
Const $unreal = "umodel.exe"
; Define registry keys
Global Const $reg = "HKCU" & $reg64 & "\Software\UniExtract"
Global Const $regcurrent = "HKCU" & $reg64 & "\Software\Classes\*\shell\"
Global Const $regall = "HKCR" & $reg64 & "\*\shell\"
Global $reguser = $regcurrent
; Define context menu commands
; On top to make remove via command line parameter possible
; shell | commandline parameter | translation
Global $CM_Shells[5][3] = [ _
['uniextract_files', '', 'EXTRACT_FILES'], _
['uniextract_here', ' .', 'EXTRACT_HERE'], _
['uniextract_sub', ' /sub', 'EXTRACT_SUB'], _
['uniextract_last', ' /last', 'EXTRACT_LAST'], _
['uniextract_scan', ' /scan', 'SCAN_FILE'] _
]
ReadPrefs()
Cout("Starting " & $name & " " & $sVersion)
ParseCommandLine()
; Create tray menu items
$Tray_Statusbox = TrayCreateItem(t('PREFS_HIDE_STATUS_LABEL'))
If $NoBox Then TrayItemSetState(-1, $TRAY_CHECKED)
TrayCreateItem("")
$Tray_Exit = TrayCreateItem(t('MENU_FILE_QUIT_LABEL'))
TrayItemSetOnEvent($Tray_Statusbox, "Tray_Statusbox")
TrayItemSetOnEvent($Tray_Exit, "Tray_Exit")
TraySetToolTip($name)
TraySetClick(8)
; If no file passed, display GUI to select file and set options
If $prompt Then
; Make sure a language file exists
If Not FileExists($sEnglishLangFile) And Not FileExists($langdir) Then
If MsgBox(48+4, $title, "No language file found." & @CRLF & @CRLF & "Do you want Universal Extractor to download all missing files?") Then _
CheckUpdate($UPDATEMSG_SILENT, False, $UPDATE_HELPER)
EndIf
; Check if Universal Extractor is started the first time
If $ID = "" Or StringIsSpace($ID) Then
$ID = StringRight(String(_Crypt_EncryptData(Random(10000, 1000000), @ComputerName & Random(10000, 1000000), $CALG_AES_256)), 25)
Cout("Created User ID: " & $ID)
SavePref("ID", $ID)
GUI_FirstStart()
While $FS_GUI
Sleep(250)
WEnd
EndIf
CheckUpdate(True, True)
CreateGUI()
While 1
If Not $guimain Then ExitLoop
Sleep(100)
WEnd
EndIf
; Prevent multiple instances to avoid errors
; Only necessary when extraction starts
; Do not do this in StartExtraction, the function can be called twice
$hMutex = _Singleton($name & " " & $sVersion, 1)
If $hMutex = 0 And $extract Then
AddToBatch()
terminate($STATUS_SILENT, '', '')
EndIf
StartExtraction()
; -------------------------- Begin Custom Functions ---------------------------
; Start extraction process
Func StartExtraction()
Cout("------------------------------------------------------------")
$iUnicodeMode = False
FilenameParse($file)
; Collect file information, for log/feedback only
Local $return = Round(FileGetSize($file) / 1048576, 2)
Cout("File size: " & ($return < 1? Round(FileGetSize($file) / 1024, 2) & " KB": $return & " MB"))
Cout("Created " & FileGetTime($file, 1, 1) & ", modified " & FileGetTime($file, 0, 1))
; Set full output directory
If $outdir = '/sub' Then
$outdir = $initoutdir
ElseIf $outdir = '/last' Then
$outdir = GetLastOutdir()
ElseIf StringMid($outdir, 2, 1) <> ":" Then
If StringLeft($outdir, 1) == '\' And StringMid($outdir, 2, 1) <> '\' Then
$outdir = StringLeft($filedir, 2) & $outdir
ElseIf StringLeft($outdir, 2) <> '\\' Then
$outdir = _PathFull($filedir & '\' & $outdir)
EndIf
EndIf
Cout("Output directory: " & $outdir)
; Update history
If $history Then
WriteHist($HISTORY_FILE, $file)
WriteHist($HISTORY_DIR, $outdir)
EndIf
; Set filename as tray icon tooltip and event handler
TraySetToolTip($filenamefull)
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Tray_ShowHide")
MoveInputFileIfNecessary()
; Reset variables
$isexe = False
$exefailed = False
$tridfailed = False
$innofailed = False
$arjfailed = False
$7zfailed = False
$zipfailed = False
$iefailed = False
$isfailed = False
$gamefailed = False
$unpackfailed = False
$testinno = False
$test7z = False
$testzip = False
$testie = False
$filetype = ""
; If an extractor is specified via command line parameter, we simply use that without scanning
If $sArcTypeOverride Then Return extract($sArcTypeOverride, $sArcTypeOverride & " " & t('TERM_FILE'))
; Extract contents from known file types
; UniExtract uses four methods of detection (in order):
; 1. File extensions for special cases
; 2. Binary file analysis of files using TrID if file extension is not .exe
; 3. Binary file analysis of PE (executable) files using Exeinfo PE
; 4. Extra analysis using PeID if executable is not recognized by Exeinfo PE
; 5. Binary file analysis of files using TrID
; 6. File extensions
; First, check for file extensions that require special actions
InitialCheckExt()
; If file is an .exe, scan with Exeinfo PE and PEiD
If $fileext = "exe" Or $fileext = "dll" Then IsExe()
; Scan file with TrID, if file is not an .exe
filescan($file, $extract)
; Display file information and terminate if scan only mode
If Not $extract Then
MediaFileScan($file)
terminate($STATUS_FILEINFO, "", "")
EndIf
; Else perform additional extraction methods
CheckIso()
CheckGame()
; Use file extension if signature not recognized
CheckExt()
check7z()
; Cannot determine filetype, all checks failed - abort
_DeleteTrayMessageBox()
terminate($STATUS_UNKNOWNEXT, $file, "")
EndFunc
; Extract if exe file detected
Func IsExe()
If $exefailed Then Return
Cout("File seems to be executable")
; Just for fun
If $file = @ScriptFullPath Or $file = $sUpdater Or $file = $sUpdaterNoAdmin Then
$filetype = $name
terminate($STATUS_NOTPACKED, $file, "")
EndIf
; Check executable using Exeinfo PE
advexescan()
; Check executable using PEiD
exescan($file, 'ext', $extract) ; Userdb is much faster, so do that first
exescan($file, 'hard', $extract)
If Not $extract Then Return
; Perform additional tests if necessary
If $testinno And Not $innofailed Then checkInno()
If $testzip Then checkZip()
If $testie And Not $iefailed Then checkIE()
If $test7z Then check7z()
If Not $iefailed Then checkIE()
CheckGame()
; Make sure TrID doesn't call IsExe again
$exefailed = True
; Scan using TrID
filescan($file)
; Exit with unknown file type
terminate($STATUS_UNKNOWNEXE, $file, $filetype)
EndFunc
; Parse filename
Func FilenameParse($f)
$file = _PathFull($f)
$filedir = StringLeft($f, StringInStr($f, '\', 0, -1) - 1)
$filename = StringTrimLeft($f, StringInStr($f, '\', 0, -1))
If StringInStr($filename, '.') Then
$fileext = StringTrimLeft($filename, StringInStr($filename, '.', 0, -1))
$filename = StringTrimRight($filename, StringLen($fileext) + 1)
$initoutdir = $filedir & '\' & StringReplace($filename, ".", "_")
Else
$fileext = ''
$initoutdir = $filedir & '\' & $filename & '_' & t('TERM_UNPACKED')
EndIf
$filenamefull = $filename & "." & $fileext
;~ Cout("FilenameParse: " & @CRLF & "Raw input: " & $f & @CRLF & "FileName: " & $filename & @CRLF & "FileExt: " & $fileext & @CRLF & "FileDir: " & $filedir & @CRLF & "InitOutDir: " & $initoutdir)
EndFunc
; Parse string for environmental variables and return expanded output
Func EnvParse($string)
$arr = StringRegExp($string, "%.*%", 2)
For $i = 0 To UBound($arr) - 1
$string = StringReplace($string, $arr[$i], EnvGet(StringReplace($arr[$i], "%", "")))
Next
Return $string
EndFunc ;==>EnvParse
; Translate text
Func t($t, $aVars = 0, $lang = $language, $sDefault = 0)
$return = IniRead($lang = 'English'? $sEnglishLangFile: $langdir & '\' & $lang & '.ini', 'UniExtract', $t, '')
If $return == '' Then
Cout("Translation not found for term " & $t)
$return = IniRead($sEnglishLangFile, 'UniExtract', $t, '')
If $return = '' Then
Cout("Warning: term " & $t & " is not defined")
Return $sDefault == 0? $t: $sDefault
EndIf
EndIf
If Not StringInStr($return, "%") Then Return $return
$return = StringReplace($return, '%name', $name)
$return = StringReplace($return, '%n', @CRLF)
$return = StringReplace($return, '%t', @TAB)
If $aVars == 0 Then Return $return
If IsArray($aVars) Then
For $i = 0 To UBound($aVars) - 1
$return = StringReplace($return, '%' & $i+1, $aVars[$i])
Next
Else
$return = StringReplace($return, '%1', $aVars)
EndIf
Return $return
EndFunc
; Parse command line
Func ParseCommandLine()
If $cmdline[0] = 0 Then
$prompt = 1
Return
EndIf
Cout("Command line parameters: " & _ArrayToString($cmdline, " ", 1))
If _ArraySearch($cmdline, "/silent") > -1 Then $silentmode = True
If $cmdline[1] = "/prefs" Then
GUI_Prefs()
While $guiprefs
Sleep(250)
WEnd
terminate($STATUS_SILENT)
ElseIf $cmdline[1] = "/help" Or $cmdline[1] = "/?" Or $cmdline[1] = "-h" Or $cmdline[1] = "/h" Or $cmdline[1] = "-?" Or $cmdline[1] = "--help" Then
terminate($STATUS_SYNTAX, "", $cmdline[0] > 1)
ElseIf $cmdline[1] = "/afterupdate" Then
_AfterUpdate()
ElseIf $cmdline[1] = "/update" Then
CheckUpdate()
terminate($STATUS_SILENT)
ElseIf $cmdline[1] = "/updatehelper" Then
CheckUpdate($UPDATEMSG_SILENT, False, $UPDATE_HELPER)
$prompt = 1
ElseIf $cmdline[1] = "/plugins" Then
$prompt = 1
GUI_Plugins()
ElseIf $cmdline[1] = "/remove" Then
; Completely delete registry entries, used by uninstaller
_IsWin7()
GUI_ContextMenu_remove()
GUI_ContextMenu_fileassoc(0)
terminate($STATUS_SILENT)
ElseIf $cmdline[1] = "/batchclear" Then
GUI_Batch_Clear()
terminate($STATUS_SILENT)
Else
If Not FileExists($cmdline[1]) Then terminate($STATUS_INVALIDFILE, $cmdline[1], "")
$file = $cmdline[1]
If $cmdline[0] > 1 Then
; Scan only
If $cmdline[2] = "/scan" Then
$extract = False
$Log = False
Else ; Outdir specified
$outdir = $cmdline[2]
; When executed from context menu, opening the outdir is not wanted
$OpenOutDir = 0
EndIf
If $cmdline[0] > 2 And StringLeft($cmdline[3], 6) = "/type=" Then
$sArcTypeOverride = StringTrimLeft($cmdline[3], 6)
If StringLen($sArcTypeOverride) < 1 Then
; TODO: Display type select GUI
EndIf
EndIf
Else
$prompt = 1
EndIf
If _ArraySearch($cmdline, "/batch") > -1 Then
AddToBatch()
terminate($STATUS_SILENT, '', '')
EndIf
EndIf
EndFunc
; Read complete preferences
Func ReadPrefs()
; Select ini file
Local Const $globalIni = @ScriptDir & "\UniExtract.ini"
Local Const $userIni = $settingsdir & "\UniExtract.ini"
If FileExists($userIni) Then
Cout("Using current user's settings")
Else
; Test file permissions, e.g. when UniExtract is in program files directory,
; user settings are stored in %appdata% due to permission issues
If CanAccess($globalIni) Then
Cout("Using global settings")
Global $settingsdir = @ScriptDir
Else
Cout("Cannot write to " & $globalIni & ", using %appdata%")
FileCopy($globalIni, $userIni, 8)
EndIf
EndIf
; Setup paths
Global $prefs = $settingsdir & "\UniExtract.ini"
Global $batchQueue = $settingsdir & "\batch.queue"
Global $logdir = $settingsdir & "\log\"
Global $userDefDir = $settingsdir & "\def\"
Global $aDefDirs[] = [$userDefDir, $defdir]
Global $fileScanLogFile = $logdir & "filescan.txt"
Global Const $sPasswordFile = $settingsdir & "\passwords.txt"
LoadPref("consoleoutput", $Opt_ConsoleOutput)
LoadPref("language", $language, False)
LoadPref("batchqueue", $batchQueue, False)
If $batchQueue Then $batchQueue = _PathFull($batchQueue, $settingsdir)
LoadPref("filescanlogfile", $fileScanLogFile, False)
If Not @error Then $fileScanLogFile = _PathFull($fileScanLogFile, $settingsdir)
LoadPref("batchenabled", $batchEnabled, 0)
LoadPref("history", $history)
LoadPref("appendext", $appendext)
LoadPref("warnexecute", $warnexecute)
LoadPref("nostatusbox", $NoBox)
If Not $NoBox Then LoadPref("hidestatusboxiffullscreen", $bHideStatusBoxIfFullscreen)
LoadPref("openfolderafterextr", $OpenOutDir)
LoadPref("deletesourcefile", $iDeleteOrigFile)
LoadPref("freespacecheck", $freeSpaceCheck)
LoadPref($STATUS_TIMEOUT, $Timeout)
$Timeout *= 1000
If $Timeout < 10000 Then $Timeout = 60000
LoadPref("keepoutputdir", $KeepOutdir)
LoadPref("keepopen", $KeepOpen)
LoadPref("feedbackprompt", $FB_ask)
LoadPref("log", $Log)
LoadPref("checkgame", $CheckGame)
LoadPref("sendstats", $bSendStats)
LoadPref("extract", $extract)
LoadPref("unicodecheck", $checkUnicode)
LoadPref("extractvideotrack", $bExtractVideo)
LoadPref("silentmode", $silentmode)
LoadPref("storeguiposition", $StoreGUIPosition)
If $StoreGUIPosition Then
LoadPref("posx", $posx)
LoadPref("posy", $posy)
EndIf
LoadPref("statusposx", $trayX)
LoadPref("statusposy", $trayY)
LoadPref("addassocenabled", $addassocenabled)
LoadPref("addassoc", $addassoc, False)
LoadPref("addassocallusers", $addassocallusers)
LoadPref("topmost", $iTopmost)
If $iTopmost Then $iTopmost = $WS_EX_TOPMOST
LoadPref("updateinterval", $updateinterval)
If $updateinterval < 1 Then $updateinterval = 1
LoadPref("lastupdate", $lastupdate, False)
LoadPref("ID", $ID, False)
If Not HasTranslation($language) Then
$language = _WinAPI_GetLocaleInfo(_WinAPI_GetSystemDefaultUILanguage(), $LOCALE_SENGLANGUAGE)
If Not HasTranslation($language) Then $language = _GetOSLanguage()
If Not HasTranslation($language) Then $language = "English"
Cout("Language set to " & $language)
SavePref('language', $language)
EndIf
Cout("Program directory: " & @ScriptDir)
Cout("Finished loading preferences from file " & $prefs)
EndFunc
; Write complete preferences
Func WritePrefs()
Cout("Saving preferences")
SavePref('history', $history)
SavePref('language', $language)
SavePref('appendext', $appendext)
SavePref('warnexecute', $warnexecute)
SavePref('nostatusbox', $NoBox)
SavePref("hidestatusboxiffullscreen", $bHideStatusBoxIfFullscreen)
SavePref('openfolderafterextr', $OpenOutDir)
SavePref('deletesourcefile', $iDeleteOrigFile)
SavePref('freespacecheck', $freeSpaceCheck)
SavePref('unicodecheck', $checkUnicode)
SavePref('feedbackprompt', $FB_ask)
SavePref('consoleoutput', $Opt_ConsoleOutput)
SavePref('log', $Log)
SavePref('checkgame', $CheckGame)
SavePref('sendstats', $bSendStats)
SavePref("extractvideotrack", $bExtractVideo)
SavePref('storeguiposition', $StoreGUIPosition)
SavePref('timeout', $Timeout / 1000)
SavePref('updateinterval', $updateinterval)
SavePref("topmost", Number($iTopmost > 0))
EndFunc
; Save single preference
Func SavePref($name, $value)
IniWrite($prefs, "UniExtract Preferences", $name, $value)
Cout("Saving: " & $name & " = " & $value)
EndFunc
; Load single preference
Func LoadPref($name, ByRef $value, $int = True)
Local $return = IniRead($prefs, "UniExtract Preferences", $name, "#Error#")
If @error Or $return = "#Error#" Then
Cout("Failed to read option " & $name)
SavePref($name, $value)
Return SetError(1, "", -1)
EndIf
If $int Then
$value = Int($return)
Else
$value = $return
EndIf
Cout("Option: " & $name & " = " & $value)
EndFunc
; Read history
Func ReadHist($sSection)
Local $items
; Read from .ini file
For $i = 0 To 9
$value = IniRead($prefs, $sSection, $i, "")
If $value <> "" Then $items &= '|' & $value
Next
Return StringTrimLeft($items, 1)
EndFunc
; Write history
Func WriteHist($sSection, $new)
$histarr = StringSplit(ReadHist($sSection), '|')
IniWrite($prefs, $sSection, "0", $new)
If $histarr[1] == "" Then Return
For $i = 1 To $histarr[0]
If $i > 9 Then ExitLoop
If $histarr[$i] = $new Then
IniDelete($prefs, $sSection, String($i))
ContinueLoop
EndIf
IniWrite($prefs, $sSection, String($i), $histarr[$i])
Next
EndFunc
; Read last used directory from history and terminate if an error occurs
Func GetLastOutdir()
$return = IniRead($prefs, $HISTORY_DIR, "0", -1)
If $return <> -1 Then Return $return
MsgBox(48, $title, t('NO_HISTORY', CreateArray($file, StringReplace(t('PREFS_HISTORY_LABEL'), "&", ""))))
terminate($STATUS_SILENT)
EndFunc
; Scan file using TrID
Func filescan($f, $analyze = 1)
If $tridfailed Then Return
; Scan file using unix file tool
advfilescan($f)
_CreateTrayMessageBox(t('SCANNING_FILE', "TrID"))
Cout("Starting filescan using TrID")
If $extract Then
Local $return = ""
$hDll = DllOpen($bindir & "TrIDLib.dll")
DllCall($hDll, "int", "TrID_LoadDefsPack", "str", $bindir)
DllCall($hDll, "int", "TrID_SubmitFileA", "str", $f)
DllCall($hDll, "int", "TrID_Analyze")
Local $aReturn = DllCall($hDll, "int", "TrID_GetInfo", "int", 1, "int", 0, "str", $return)
If $aReturn[0] = 0 Then
Cout("Unknown filetype!")
Return _DeleteTrayMessageBox()
EndIf
For $i = 1 To $aReturn[0]
$aReturn = DllCall($hDll, "int", "TrID_GetInfo", "int", 2, "int", $i, "str", $return)
$filetype &= $aReturn[3] & @CRLF
If $analyze Then tridcompare($aReturn[3])
Next
RenameWithTridExtension($hDll)
Else ; Run TrID and fetch output to include additional information about the file type
$return = StringSplit(FetchStdout($trid & ' "' & $f & '"' & ($appendext ? " -ce" : "") & ($analyze ? "" : " -v"), $filedir, @SW_HIDE, 0, True, False), @CRLF)
Local $filetype_curr = ""
For $i = 1 To UBound($return) - 1
If StringInStr($return[$i], "%") Or (Not $analyze And (StringInStr($return[$i], "Related URL") Or StringInStr($return[$i], "Remarks"))) Then _
$filetype_curr &= $return[$i] & @CRLF
Next
If $filetype_curr <> "" Then
$filetype &= $filetype_curr
If $analyze Then tridcompare($filetype_curr)
EndIf
EndIf
$filetype &= @CRLF
$tridfailed = True
EndFunc
; Change file extension to the one TrID suggests if enabled in options
Func RenameWithTridExtension($hDll)
If Not $appendext Then Return False
Local $return = ""
Local $aReturn = DllCall($hDll, "int", "TrID_GetInfo", "int", 3, "int", 1, "str", $return)
$aReturn[3] = StringLower($aReturn[3])
If $aReturn[3] == "" Then Return
Local $ret = $filedir & "\" & $filename & "." & $aReturn[3]
If $ret = $file Then Return False
Cout("Changing file extension from ." & $fileext & " to ." & $aReturn[3])
If Not FileMove($file, $ret) Then Return False
FilenameParse($file)
Return True
EndFunc
; Additional file scan using unix file tool
Func advfilescan($f)
Local $filetype_curr = ""
_CreateTrayMessageBox(t('SCANNING_FILE', "Unix File Tool"))
Cout("Start filescan using unix file tool")
$filetype_curr = StringReplace(StringReplace(FetchStdout($filetool & ' "' & $f & '"', $filedir, @SW_HIDE), $f & "; ", ""), @CRLF, "")
If $filetype_curr And $filetype_curr <> "data" Then $filetype &= $filetype_curr & @CRLF & @CRLF
_DeleteTrayMessageBox()
If Not $extract Then
; Text files often lead to wrong detection, so renaming them is not a good idea
If $appendext And (StringInStr($filetype_curr, "text", 0) Or StringInStr($filetype_curr, "ASCII", 0)) Then $appendext = False
Return
EndIf
filecompare($filetype_curr)
EndFunc
; Compare unix file tool's return to supported file types
Func filecompare($filetype_curr)
Select
Case StringInStr($filetype_curr, "7 zip archive data") Or StringInStr($filetype_curr, "7-zip archive data")
extract($TYPE_7Z, '7-Zip ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "RAR archive data")
extract($TYPE_RAR, 'RAR ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "lzip compressed data")
extract($TYPE_LZ, "LZIP " & t('TERM_COMPRESSED') & " " & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "Zip archive data") And Not StringInStr($filetype_curr, "7")
extract($TYPE_ZIP, 'ZIP ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "StuffIt Archive")
extract($TYPE_SIT, 'StuffIt ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "UHarc archive data", 0)
extract($TYPE_UHA, 'UHARC ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "Symbian installation file", 0)
extract($TYPE_QBMS, 'SymbianOS ' & t('TERM_INSTALLER'), $sis)
Case StringInStr($filetype_curr, "Zoo archive data", 0)
extract($TYPE_ZOO, 'ZOO ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "MS Outlook Express DBX file", 0)
extract($TYPE_QBMS, 'Outlook Express ' & t('TERM_ARCHIVE'), $dbx)
Case StringInStr($filetype_curr, "bzip2 compressed data", 0)
extract($TYPE_7Z, 'bzip2 ' & t('TERM_COMPRESSED'), "bz2")
Case StringInStr($filetype_curr, "ASCII cpio archive", 0)
extract($TYPE_7Z, 'CPIO ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "gzip compressed", 0)
extract($TYPE_7Z, 'gzip ' & t('TERM_COMPRESSED'), "gz")
Case StringInStr($filetype_curr, "LZX compressed archive", 0)
extract($TYPE_LZX, 'LZX ' & t('TERM_COMPRESSED'))
Case StringInStr($filetype_curr, "ar archive", 0)
extract($TYPE_7Z, 'AR ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "ARJ archive", 0)
extract($TYPE_7Z, 'ARJ ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "POSIX tar archive", 0)
extract($TYPE_TAR, 'Tar ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "LHa", 0) And StringInStr($filetype_curr, "archive data", 0)
extract($TYPE_7Z, 'LZH ' & t('TERM_COMPRESSED'))
Case StringInStr($filetype_curr, "Macromedia Flash data", 0)
extract($TYPE_SWF, 'Shockwave Flash ' & t('TERM_CONTAINER'))
Case StringInStr($filetype_curr, "PowerISO Direct-Access-Archive", 0)
extract($TYPE_DAA, 'DAA/GBI ' & t('TERM_IMAGE'))
Case StringInStr($filetype_curr, "sfArk compressed Soundfont")
extract($TYPE_SFARK, 'sfArk ' & t('TERM_COMPRESSED'))
Case StringInStr($filetype_curr, "SQLite", 0)
extract($TYPE_SQLITE, 'SQLite ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "XZ compressed data")
extract($TYPE_7Z, 'XZ ' & t('TERM_COMPRESSED'), "xz")
Case StringInStr($filetype_curr, "MS Windows HtmlHelp Data")
extract($TYPE_CHM, 'Compiled HTML ' & t('TERM_HELP'))
Case StringInStr($filetype_curr, "MoPaQ", 0)
HasPlugin($mpq)
extract($TYPE_QBMS, 'MPQ ' & t('TERM_ARCHIVE'), $mpq)
Case (StringInStr($filetype_curr, "RIFF", 0) And Not StringInStr($filetype_curr, "WAVE audio", 0)) Or _
StringInStr($filetype_curr, "MPEG v", 0) Or StringInStr($filetype_curr, "MPEG sequence") Or _
StringInStr($filetype_curr, "Microsoft ASF") Or StringInStr($filetype_curr, "GIF image") Or _
StringInStr($filetype_curr, "PNG image") Or StringInStr($filetype_curr, "MNG video")
extract($TYPE_VIDEO, t('TERM_VIDEO') & ' ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "AAC,")
extract($TYPE_AUDIO, 'AAC ' & t('TERM_AUDIO') & ' ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "FLAC audio")
extract($TYPE_AUDIO, 'FLAC ' & t('TERM_AUDIO') & ' ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "Ogg data, Vorbis audio")
extract($TYPE_AUDIO, 'OGG Vorbis ' & t('TERM_AUDIO') & ' ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "Audio file", 0) Or StringInStr($filetype_curr, "Dolby Digital stream", 0)
extract($TYPE_AUDIO, t('TERM_AUDIO') & ' ' & t('TERM_FILE'))
Case StringInStr($filetype_curr, "ISO", 0) And StringInStr($filetype_curr, "filesystem", 0)
CheckIso()
Case Else
UserDefCompare($aFileDefinitions, $filetype_curr, "File")
EndSelect
; Not extractable filetypes
If StringInStr($filetype_curr, "CDF V2 document") Then Return
If (StringInStr($filetype_curr, "text") And (StringInStr($filetype_curr, "CRLF") Or _
StringInStr($filetype_curr, "long lines") Or StringInStr($filetype_curr, "ASCII")) Or _
StringInStr($filetype_curr, "batch file") Or StringInStr($filetype_curr, "XML") Or _
StringInStr($filetype_curr, "HTML") Or StringInStr($filetype_curr, "source") Or _
StringInStr($filetype_curr, "Rich ")) Or _
StringInStr($filetype_curr, "image") Or StringInStr($filetype_curr, "icon resource") Or _
(StringInStr($filetype_curr, "bitmap") And Not StringInStr($filetype_curr, "MGR bitmap")) Or _
StringInStr($filetype_curr, "WAVE audio") Or StringInStr($filetype_curr, "boot sector;") Or _
StringInStr($filetype_curr, "shortcut") Or StringInStr($filetype_curr, "empty") Or _
StringInStr($filetype_curr, "directory") Or StringInStr($filetype_curr, "BitTorrent file") Or _
StringInStr($filetype_curr, "Standard MIDI data") Or StringInStr($filetype_curr, "MSVC program database") Then _
terminate($STATUS_NOTPACKED, $file, "")
If StringInStr($filetype_curr, "MS-DOS executable") Then terminate($STATUS_NOTSUPPORTED, $file, "")
EndFunc
; Compare TrID's return to supported file types
Func tridcompare($filetype_curr)
Cout("--> " & $filetype_curr)
Select
Case StringInStr($filetype_curr, "7-Zip compressed archive")
extract($TYPE_7Z, '7-Zip ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "ACE compressed archive") Or StringInStr($filetype_curr, "ACE Self-Extracting Archive")
extract($TYPE_ACE, 'ACE ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "Android boot image")
extract($TYPE_BOOTIMG, ' Android boot ' & t('TERM_IMAGE'))
Case StringInStr($filetype_curr, "ALZip compressed archive")
CheckAlz()
Case StringInStr($filetype_curr, "LZIP compressed archive")
extract($TYPE_LZ, "LZIP " & t('TERM_COMPRESSED'))
Case StringInStr($filetype_curr, "FreeArc compressed archive")
extract($TYPE_FREEARC, 'FreeArc ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "ARJ compressed archive")
extract($TYPE_7Z, 'ARJ ' & t('TERM_ARCHIVE'))
Case StringInStr($filetype_curr, "BCM compressed file")
extract($TYPE_BCM, 'BCM ' & t('TERM_COMPRESSED'))
Case StringInStr($filetype_curr, "bzip2 compressed archive")
extract($TYPE_7Z, 'bzip2 ' & t('TERM_COMPRESSED'), "bz2")
Case StringInStr($filetype_curr, "Broken Age package")
CheckGame(False)