-
Notifications
You must be signed in to change notification settings - Fork 7
/
ussf.au3
1612 lines (1513 loc) · 73.3 KB
/
ussf.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
#NoTrayIcon
#include 'Constants.au3'
#include 'GUIConstants.au3'
#include 'Default.au3'
#include 'Version.au3'
#include 'GlobalVars.au3'
#include 'String.au3'
#cs - Code Help and returned codes
;################################################# Translations #################################################
If you want to translate ussf into your own language, go ahead and send me the translated strings contained by these functions:
SetMessageAndErrorContent()
SetLanguage()
;################################################## Parameters ##################################################
First parameter = The full path to file (like C:\path\to\file.exe')
Second parameter = The 'scene' name (like %cdrom%\path\to\file.exe')
The third param = The number of the cmd the final command should be passed to
The fouth param = Silent mode: 1 - show only a "Loading ..." splash; 2 - show nothing
Example: ussf.exe "C:\path\to\file.exe" "%cdrom%\path\to\file.exe"
;############################################## Detected FileTypes ##############################################
.msi => Extension .msi Header D0CF11E0A1B11AE1000000000000000000000000000000003E000300FEFF090006
.exe => Extension .exe Header 4D5A
.inf => Extension .inf
.reg => Extension .reg Header 57696E646F777320526567697374727920456469746F722056657273696F6E20352E30300D0A Or 52454745444954340D0A
;################################################ Returned Codes ################################################
16 => MSI File
15 => UPX Packed
14 => Self-Extracting WinZip archive
13 => Unknown Zip archive
12 => Unknown 7-Zip archive
11 => 7-Zip Installer package
10 => Self-Extracting ZIP archive
9 => Self-Extracting Microsoft CAB archive
8 => Self-Extracting RAR archive
7 => Wise Installer package
6 => InstallShield 2003 package
5 => Installshield AFW package
4 => Inno Setup package
3 => NSIS package
2 => Reg file
1 => Inf file
-1 => Corrupted executable file (it does not start with 4D5A)
-2 => Corrupted msi file (it does not start with D0CF11E0A1B11AE1000000000000000000000000000000003E000300FEFF090006)
-3 => Invalid reg file (not starting with the correct lines)
-4 => No program selected or program file doesn't exist
-5 => Unknown executable file
-6 => Not supported file type
-7 => The file could not be opened for reading
-8 => Valid PE file but PEiD can't detect it's header
#ce - Code Help and returned codes
Global $RegSkin = RegRead('HKCU\Software\USSF', 'Skin')
If Not @error And $RegSkin <> 'Default' And GetSkinVars($RegSkin) Then
$SkinLoadedFromRegistry = True
EndIf
Global $RegLang = RegRead('HKCU\Software\USSF', 'Language')
If Not @error And $RegLang <> 'English' Then
SetLanguage($RegLang)
$LangLoadedFromRegistry = True
Else
SetLanguage('English')
EndIf
If $CmdLine[0] <> 0 Then
If $CmdLine[1] = '/?' Or $CmdLine[1] = '-?' Or $CmdLine[1] = '/help' Or $CmdLine[1] = '-help' Or $CmdLine[1] = '/h' Or $CmdLine[1] = '-h' Then
MsgBox(64, "Universal Silent Switch Finder", $LanguageSpecificStrings[1])
Exit
ElseIf $CmdLine[0] = 3 Then
SplashTextOn('', 'Loading ...', 300, 18, -1, -1, 1, 'Arial', 10, 800)
$ShowWPIFeatures = True
$ProgramToAnalyze = $CmdLine[1]
$FileName = $CmdLine[2]
$CmdNumber = $CmdLine[3]
$FileExtension = StringRight($ProgramToAnalyze, 3)
RegWrite('HKCU\Software\WPI', 'USSF_cmd1', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd2', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd3', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd4', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd5', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd6', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd7', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd8', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd9', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd10', 'REG_SZ', 'default')
ElseIf $CmdLine[0] = 4 Then
If $CmdLine[4] = 0 Then
$ShowWPIFeatures = True
EndIf
If $CmdLine[4] = 1 Or $CmdLine[4] = 0 Then
SplashTextOn('', 'Loading ...', 300, 18, -1, -1, 1, 'Arial', 10, 800)
EndIf
$ProgramToAnalyze = $CmdLine[1]
$FileName = $CmdLine[2]
$CmdNumber = $CmdLine[3]
$FileExtension = StringRight($ProgramToAnalyze, 3)
RegWrite('HKCU\Software\WPI', 'USSF_cmd1', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd2', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd3', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd4', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd5', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd6', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd7', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd8', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd9', 'REG_SZ', 'default')
RegWrite('HKCU\Software\WPI', 'USSF_cmd10', 'REG_SZ', 'default')
If $CmdLine[4] = 1 Or $CmdLine[4] = 2 Then
$ShowWPIFeatures = False
ParseProgram($ProgramToAnalyze, $FileName, $FileExtension, 1)
SplashOff()
Exit
EndIf
Else
SplashTextOn('', 'Loading ...', 300, 18, -1, -1, 1, 'Arial', 10, 800)
$ProgramToAnalyze = $CmdLine[1]
$FileExtension = StringRight($ProgramToAnalyze, 3)
$FileName = StringTrimLeft($ProgramToAnalyze, StringInStr($ProgramToAnalyze, '\', 0, -1))
EndIf
EndIf
Opt("MustDeclareVars", 1)
If $ShowWPIFeatures Then
Global $MainGUI = GUICreate('USSF', 600, 460, -1, -1, $WS_BORDER + $WS_POPUP)
Else
Global $MainGUI = GUICreate('USSF', 600, 320, -1, -1, $WS_BORDER + $WS_POPUP)
EndIf
Global $Move_Button = GUICtrlCreateLabel('', 5, 13, 40, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
Global $Move_Button_Frame = GUICtrlCreateLabel('', 5, 10, 40, 20, $SS_BLACKFRAME)
Global $Title = GUICtrlCreateLabel('Universal Silent Switch Finder ' & $ProgramMajorVersion & '.' & $ProgramMinorVersion & '.' & $ProgramBuildVersion & '.' & $ProgramBugfixVersion, 50, 11, 500, 20, $SS_CENTER)
Global $Title_Frame = GUICtrlCreateLabel('', 50, 10, 500, 20, $SS_BLACKFRAME)
Global $Quit_Button = GUICtrlCreateLabel('', 555, 13, 40, 20, $SS_CENTER)
Global $Quit_Button_Frame = GUICtrlCreateLabel('', 555, 10, 40, 20, $SS_BLACKFRAME)
Global $General_Container = GUICtrlCreateGraphic(5, 35, 0, 0)
GUICtrlSetGraphic($General_Container, $GUI_GR_COLOR, $General_Container_Color)
GUICtrlSetGraphic($General_Container, $GUI_GR_RECT, 0, 0, 590, 240)
Global $File_Path_Label = GUICtrlCreateLabel('', 15, 42, 25, 20)
Global $File_Path_Label_Frame = GUICtrlCreateLabel('', 10, 40, 35, 20, $SS_BLACKFRAME)
Global $File_Path_Content = GUICtrlCreateEdit('', 50, 40, 500, 20, $ES_READONLY + $ES_AUTOHSCROLL + $WS_TABSTOP)
Global $File_Path_Button = GUICtrlCreateLabel('>', 555, 42, 35, 20, $SS_CENTER)
Global $File_Path_Button_Frame = GUICtrlCreateLabel('', 555, 40, 35, 20, $SS_BLACKFRAME)
Global $File_Extension_Label = GUICtrlCreateLabel('', 15, 67, 90, 20)
Global $File_Extension_Label_Frame = GUICtrlCreateLabel('', 10, 65, 100, 20, $SS_BLACKFRAME)
Global $File_Extension_Content = GUICtrlCreateEdit('', 115, 65, 435, 20, $ES_READONLY + $ES_AUTOHSCROLL + $WS_TABSTOP)
Global $File_Extension_Button = GUICtrlCreateLabel('+', 555, 67, 35, 20, $SS_CENTER)
Global $File_Extension_Button_Frame = GUICtrlCreateLabel('', 555, 65, 35, 20, $SS_BLACKFRAME)
Global $File_Type_Label = GUICtrlCreateLabel('', 15, 92, 90, 20)
Global $File_Type_Label_Frame = GUICtrlCreateLabel('', 10, 90, 100, 20, $SS_BLACKFRAME)
Global $File_Type_Content = GUICtrlCreateEdit('', 115, 90, 435, 20, $ES_READONLY + $ES_AUTOHSCROLL + $WS_TABSTOP)
Global $File_Type_Button = GUICtrlCreateLabel('+', 555, 92, 35, 20, $SS_CENTER)
Global $File_Type_Button_Frame = GUICtrlCreateLabel('', 555, 90, 35, 20, $SS_BLACKFRAME)
Global $File_Usage_Label = GUICtrlCreateLabel('', 15, 117, 90, 20)
Global $File_Usage_Label_Frame = GUICtrlCreateLabel('', 10, 115, 100, 20, $SS_BLACKFRAME)
Global $File_Usage_Content = GUICtrlCreateEdit('', 115, 115, 435, 20, $ES_AUTOHSCROLL + $WS_TABSTOP)
Global $File_Usage_Button = GUICtrlCreateLabel('+', 555, 117, 35, 20, $SS_CENTER)
Global $File_Usage_Button_Frame = GUICtrlCreateLabel('', 555, 115, 35, 20, $SS_BLACKFRAME)
Global $File_Notes_Label = GUICtrlCreateLabel('', 15, 142, 40, 20)
Global $File_Notes_Label_Frame = GUICtrlCreateLabel('', 10, 140, 50, 20, $SS_BLACKFRAME)
Global $File_Notes_Content = GUICtrlCreateEdit('', 65, 140, 525, 130, $ES_READONLY + $ES_AUTOHSCROLL + $WS_TABSTOP)
Global $Error_Label = GUICtrlCreateLabel('', 20, 207, 30, 20, $SS_CENTER)
Global $Error_Graphic_Over = GUICtrlCreateLabel('', 10, 165, 50, 105, $SS_WHITERECT)
Global $Error_Graphic = GUICtrlCreateGraphic(10, 165, 0, 0)
If $ShowWPIFeatures Then
Global $WPI_Line_Graphic = GUICtrlCreateGraphic(5, 285, 0, 0)
Global $WPI_Specific_Label = GUICtrlCreateLabel('', 110, 278, 60, 20, $SS_CENTER)
Global $WPI_Process_Status_Label = GUICtrlCreateLabel('', 10, 292, 100, 20, $SS_CENTER)
Global $WPI_Process_Status_Label_Frame = GUICtrlCreateLabel('', 10, 290, 100, 20, $SS_BLACKFRAME)
Global $WPI_Process_Status_Content = GUICtrlCreateLabel('', 115, 292, 475, 20, $SS_CENTER)
Global $WPI_Process_Status_Content_Frame = GUICtrlCreateLabel('', 115, 290, 475, 20, $SS_BLACKFRAME)
Global $WPI_cmd1_Button = GUICtrlCreateLabel('', 115, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd1_Button_Frame = GUICtrlCreateLabel('', 115, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd2_Button = GUICtrlCreateLabel('', 162, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd2_Button_Frame = GUICtrlCreateLabel('', 162, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd3_Button = GUICtrlCreateLabel('', 209, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd3_Button_Frame = GUICtrlCreateLabel('', 209, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd4_Button = GUICtrlCreateLabel('', 256, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd4_Button_Frame = GUICtrlCreateLabel('', 256, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd5_Button = GUICtrlCreateLabel('', 303, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd5_Button_Frame = GUICtrlCreateLabel('', 303, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd6_Button = GUICtrlCreateLabel('', 350, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd6_Button_Frame = GUICtrlCreateLabel('', 350, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd7_Button = GUICtrlCreateLabel('', 397, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd7_Button_Frame = GUICtrlCreateLabel('', 397, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd8_Button = GUICtrlCreateLabel('', 444, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd8_Button_Frame = GUICtrlCreateLabel('', 444, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd9_Button = GUICtrlCreateLabel('', 491, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd9_Button_Frame = GUICtrlCreateLabel('', 491, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd10_Button = GUICtrlCreateLabel('', 537, 318, 42, 20, $SS_CENTER)
Global $WPI_cmd10_Button_Frame = GUICtrlCreateLabel('', 537, 315, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd1_Exit_Button = GUICtrlCreateLabel('', 115, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd1_Exit_Button_Frame = GUICtrlCreateLabel('', 115, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd2_Exit_Button = GUICtrlCreateLabel('', 162, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd2_Exit_Button_Frame = GUICtrlCreateLabel('', 162, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd3_Exit_Button = GUICtrlCreateLabel('', 209, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd3_Exit_Button_Frame = GUICtrlCreateLabel('', 209, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd4_Exit_Button = GUICtrlCreateLabel('', 256, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd4_Exit_Button_Frame = GUICtrlCreateLabel('', 256, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd5_Exit_Button = GUICtrlCreateLabel('', 303, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd5_Exit_Button_Frame = GUICtrlCreateLabel('', 303, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd6_Exit_Button = GUICtrlCreateLabel('', 350, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd6_Exit_Button_Frame = GUICtrlCreateLabel('', 350, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd7_Exit_Button = GUICtrlCreateLabel('', 397, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd7_Exit_Button_Frame = GUICtrlCreateLabel('', 397, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd8_Exit_Button = GUICtrlCreateLabel('', 444, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd8_Exit_Button_Frame = GUICtrlCreateLabel('', 444, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd9_Exit_Button = GUICtrlCreateLabel('', 491, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd9_Exit_Button_Frame = GUICtrlCreateLabel('', 491, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmd10_Exit_Button = GUICtrlCreateLabel('', 537, 343, 42, 20, $SS_CENTER)
Global $WPI_cmd10_Exit_Button_Frame = GUICtrlCreateLabel('', 537, 340, 42, 20, $SS_BLACKFRAME)
Global $WPI_cmdx_Button = GUICtrlCreateLabel('', 115, 368, 475, 20, $SS_CENTER)
Global $WPI_cmdx_Button_Frame = GUICtrlCreateLabel('', 115, 365, 475, 20, $SS_BLACKFRAME)
Global $WPI_cmdx_Exit_Button = GUICtrlCreateLabel('', 115, 393, 475, 20, $SS_CENTER)
Global $WPI_cmdx_Exit_Button_Frame = GUICtrlCreateLabel('', 115, 390, 475, 20, $SS_BLACKFRAME)
Global $WPI_cmd_Label = GUICtrlCreateLabel('', 10, 317, 100, 20, $SS_CENTER)
Global $WPI_cmd_Label_Frame = GUICtrlCreateLabel('', 10, 315, 100, 20, $SS_BLACKFRAME)
Global $WPI_cmdx_Label = GUICtrlCreateLabel('', 10, 367, 100, 20, $SS_CENTER)
Global $WPI_cmdx_Label_Frame = GUICtrlCreateLabel('', 10, 365, 100, 20, $SS_BLACKFRAME)
Global $WPI_cmd_Exit_Label = GUICtrlCreateLabel('', 10, 342, 100, 20, $SS_CENTER)
Global $WPI_cmd_Exit_Label_Frame = GUICtrlCreateLabel('', 10, 340, 100, 20, $SS_BLACKFRAME)
Global $WPI_cmdx_Exit_Label = GUICtrlCreateLabel('', 10, 392, 100, 20, $SS_CENTER)
Global $WPI_cmdx_Exit_Label_Frame = GUICtrlCreateLabel('', 10, 390, 100, 20, $SS_BLACKFRAME)
Global $Settings_Container = GUICtrlCreateGraphic(5, 425, 0, 0)
Global $Language_Title = GUICtrlCreateLabel('', 125, 418, 55, 20, $SS_CENTER)
Global $Language_Dropdown = GUICtrlCreateCombo('English', 115, 430, 75, 20, $CBS_DROPDOWNLIST)
Global $Skin_Title = GUICtrlCreateLabel('', 215, 418, 35, 20, $SS_CENTER)
Global $Skin_Dropdown = GUICtrlCreateCombo('Default', 195, 430, 75, 20, $CBS_DROPDOWNLIST)
Global $Settings_Label = GUICtrlCreateLabel('', 10, 432, 100, 20, $SS_CENTER)
Global $Settings_Label_Frame = GUICtrlCreateLabel('', 10, 430, 100, 20, $SS_BLACKFRAME)
Global $Update_Label = GUICtrlCreateLabel($LanguageSpecificStrings[76], 515, 432, 75, 20, $SS_CENTER)
Global $Update_Label_Frame = GUICtrlCreateLabel('', 515, 430, 75, 20, $SS_BLACKFRAME)
Else
Global $Settings_Container = GUICtrlCreateGraphic(5, 285, 0, 0)
Global $Language_Title = GUICtrlCreateLabel('', 125, 278, 55, 20, $SS_CENTER)
Global $Language_Dropdown = GUICtrlCreateCombo('English', 115, 290, 75, 20, $CBS_DROPDOWNLIST)
Global $Skin_Title = GUICtrlCreateLabel('', 215, 278, 35, 20, $SS_CENTER)
Global $Skin_Dropdown = GUICtrlCreateCombo('Default', 195, 290, 75, 20, $CBS_DROPDOWNLIST)
Global $Settings_Label = GUICtrlCreateLabel('', 10, 292, 100, 20, $SS_CENTER)
Global $Settings_Label_Frame = GUICtrlCreateLabel('', 10, 290, 100, 20, $SS_BLACKFRAME)
Global $Update_Label = GUICtrlCreateLabel($LanguageSpecificStrings[76], 515, 292, 75, 20, $SS_CENTER)
Global $Update_Label_Frame = GUICtrlCreateLabel('', 515, 290, 75, 20, $SS_BLACKFRAME)
EndIf
GUICtrlSetGraphic($Error_Graphic, $GUI_GR_COLOR, $Error_Graphic_Color)
GUICtrlSetGraphic($Error_Graphic, $GUI_GR_RECT, 0, 0, 50, 105)
If $ShowWPIFeatures Then
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_COLOR, $WPI_Line_Graphic_Color)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_LINE, 100, 0)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_MOVE, 170, 0)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_LINE, 590, 0)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_LINE, 590, 130)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_LINE, 0, 130)
GUICtrlSetGraphic($WPI_Line_Graphic, $GUI_GR_LINE, 0, 0)
EndIf
GUICtrlSetGraphic($Settings_Container, $GUI_GR_COLOR, $Settings_Container_Color)
GUICtrlSetGraphic($Settings_Container, $GUI_GR_LINE, 590, 0)
GUICtrlSetGraphic($Settings_Container, $GUI_GR_LINE, 590, 30)
GUICtrlSetGraphic($Settings_Container, $GUI_GR_LINE, 0, 30)
GUICtrlSetGraphic($Settings_Container, $GUI_GR_LINE, 0, 0)
GUICtrlSetFont($Title, 13, 1000, -1, 'Arial')
GUICtrlSetFont($File_Path_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Path_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Path_Button, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Extension_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Extension_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Extension_Button, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Type_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Type_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Type_Button, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Usage_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Usage_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Usage_Button, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Notes_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($File_Notes_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($Error_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($Move_Button, 8)
GUICtrlSetFont($Quit_Button, 8)
If $ShowWPIFeatures Then
GUICtrlSetFont($WPI_Specific_Label, 8, 400, -1, 'Arial')
GUICtrlSetFont($WPI_Process_Status_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($WPI_Process_Status_Content, 10, 1000, -1, 'Arial')
GUICtrlSetFont($WPI_cmd1_Button, 8)
GUICtrlSetFont($WPI_cmd2_Button, 8)
GUICtrlSetFont($WPI_cmd3_Button, 8)
GUICtrlSetFont($WPI_cmd4_Button, 8)
GUICtrlSetFont($WPI_cmd5_Button, 8)
GUICtrlSetFont($WPI_cmd6_Button, 8)
GUICtrlSetFont($WPI_cmd7_Button, 8)
GUICtrlSetFont($WPI_cmd8_Button, 8)
GUICtrlSetFont($WPI_cmd9_Button, 8)
GUICtrlSetFont($WPI_cmd10_Button, 8)
GUICtrlSetFont($WPI_cmdx_Button, 8)
GUICtrlSetFont($WPI_cmdx_Exit_Button, 8)
GUICtrlSetFont($WPI_cmd_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($WPI_cmd_Exit_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($WPI_cmdx_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($WPI_cmdx_Exit_Label, 10, 1000, -1, 'Arial')
EndIf
GUICtrlSetFont($Language_Title, 8, 400, -1, 'Arial')
GUICtrlSetFont($Skin_Title, 8, 400, -1, 'Arial')
GUICtrlSetFont($Settings_Label, 10, 1000, -1, 'Arial')
GUICtrlSetFont($Update_Label, 10, 1000, -1, 'Arial')
GUICtrlSetColor($File_Extension_Content, $File_Extension_Content_Color)
GUICtrlSetColor($File_Type_Content, $File_Type_Content_Color)
GUICtrlSetColor($File_Usage_Content, $File_Usage_Content_Color)
GUICtrlSetColor($File_Notes_Content, $File_Notes_Content_Color)
GUICtrlSetColor($Error_Label, $Error_Label_Color)
If $ShowWPIFeatures Then
GUICtrlSetColor($WPI_Specific_Label, $WPI_Specific_Label_Color)
GUICtrlSetColor($WPI_cmd1_Button, $WPI_cmd1_Button_Color)
GUICtrlSetColor($WPI_cmd2_Button, $WPI_cmd2_Button_Color)
GUICtrlSetColor($WPI_cmd3_Button, $WPI_cmd3_Button_Color)
GUICtrlSetColor($WPI_cmd4_Button, $WPI_cmd4_Button_Color)
GUICtrlSetColor($WPI_cmd5_Button, $WPI_cmd5_Button_Color)
GUICtrlSetColor($WPI_cmd6_Button, $WPI_cmd6_Button_Color)
GUICtrlSetColor($WPI_cmd7_Button, $WPI_cmd7_Button_Color)
GUICtrlSetColor($WPI_cmd8_Button, $WPI_cmd8_Button_Color)
GUICtrlSetColor($WPI_cmd9_Button, $WPI_cmd9_Button_Color)
GUICtrlSetColor($WPI_cmd10_Button, $WPI_cmd10_Button_Color)
GUICtrlSetColor($WPI_cmd1_Exit_Button, $WPI_cmd1_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd2_Exit_Button, $WPI_cmd2_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd3_Exit_Button, $WPI_cmd3_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd4_Exit_Button, $WPI_cmd4_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd5_Exit_Button, $WPI_cmd5_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd6_Exit_Button, $WPI_cmd6_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd7_Exit_Button, $WPI_cmd7_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd8_Exit_Button, $WPI_cmd8_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd9_Exit_Button, $WPI_cmd9_Exit_Button_Color)
GUICtrlSetColor($WPI_cmd10_Exit_Button, $WPI_cmd10_Exit_Button_Color)
GUICtrlSetColor(Eval('WPI_cmd' & $CmdNumber & '_Button'), $CmdNumber_Good)
GUICtrlSetColor(Eval('WPI_cmd' & $CmdNumber & '_Exit_Button'), $CmdNumber_Exit_Good)
GUICtrlSetColor($WPI_cmdx_Button, $WPI_cmdx_Button_Color)
GUICtrlSetColor($WPI_cmdx_Exit_Button, $WPI_cmdx_Exit_Button_Color)
EndIf
GUICtrlSetColor($Language_Title, $Language_Title_Color)
GUICtrlSetColor($Skin_Title, $Skin_Title_Color)
GUICtrlSetCursor($Move_Button, 0)
GUICtrlSetCursor($Quit_Button, 0)
GUICtrlSetCursor($File_Extension_Button, 0)
GUICtrlSetCursor($File_Type_Button, 0)
GUICtrlSetCursor($File_Path_Button, 0)
GUICtrlSetCursor($File_Usage_Button, 0)
If $ShowWPIFeatures Then
GUICtrlSetCursor($WPI_cmd1_Button, 0)
GUICtrlSetCursor($WPI_cmd2_Button, 0)
GUICtrlSetCursor($WPI_cmd3_Button, 0)
GUICtrlSetCursor($WPI_cmd4_Button, 0)
GUICtrlSetCursor($WPI_cmd5_Button, 0)
GUICtrlSetCursor($WPI_cmd6_Button, 0)
GUICtrlSetCursor($WPI_cmd7_Button, 0)
GUICtrlSetCursor($WPI_cmd8_Button, 0)
GUICtrlSetCursor($WPI_cmd9_Button, 0)
GUICtrlSetCursor($WPI_cmd10_Button, 0)
GUICtrlSetCursor($WPI_cmd1_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd2_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd3_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd4_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd5_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd6_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd7_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd8_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd9_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmd10_Exit_Button, 0)
GUICtrlSetCursor($WPI_cmdx_Button, 0)
GUICtrlSetCursor($WPI_cmdx_Exit_Button, 0)
EndIf
GUICtrlSetCursor($File_Extension_Content, 2)
GUICtrlSetCursor($File_Path_Content, 2)
GUICtrlSetCursor($File_Type_Content, 2)
GUICtrlSetCursor($Update_Label, 0)
GUICtrlSetBkColor($Title, $Title_Color_Bk)
GUICtrlSetBkColor($File_Usage_Content, $File_Usage_Content_Color_Bk)
If $ShowWPIFeatures Then
GUICtrlSetBkColor($WPI_Process_Status_Content_Frame, $WPI_Process_Status_Content_Frame_Color_Bk)
EndIf
ParseLanguage($LanguageSpecificStrings)
GetSkins()
If $SkinLoadedFromRegistry Then
GUICtrlSetData($Skin_Dropdown, $RegSkin, $RegSkin)
EndIf
If $LangLoadedFromRegistry Then
GUICtrlSetData($Language_Dropdown, $RegLang, $RegLang)
EndIf
GUISetBkColor($BKColor)
SplashOff()
GUISetState()
ParseProgram($ProgramToAnalyze, $FileName, $FileExtension, 0)
If $ShowWPIFeatures Then
AttachToWPI()
EndIf
Local $Msg
Do
Sleep(10)
$Msg = GUIGetMsg()
Select
Case $Msg = $File_Path_Button
GUICtrlSetStyle($File_Path_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($File_Path_Button_Frame, $SS_BLACKFRAME)
Browse()
Case $Msg = $File_Extension_Button
GUICtrlSetStyle($File_Extension_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($File_Extension_Button_Frame, $SS_BLACKFRAME)
ClipPut(GUICtrlRead($File_Extension_Content))
Case $Msg = $File_Type_Button
GUICtrlSetStyle($File_Type_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($File_Type_Button_Frame, $SS_BLACKFRAME)
ClipPut(GUICtrlRead($File_Type_Content))
Case $Msg = $File_Usage_Button
GUICtrlSetStyle($File_Usage_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($File_Usage_Button_Frame, $SS_BLACKFRAME)
ClipPut(GUICtrlRead($File_Usage_Content))
Case $ShowWPIFeatures And $Msg = $WPI_cmdx_Button
GUICtrlSetStyle($WPI_cmdx_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmdx_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, $CmdNumber)
Case $ShowWPIFeatures And $Msg = $WPI_cmdx_Exit_Button
GUICtrlSetStyle($WPI_cmdx_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmdx_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, $CmdNumber)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd1_Button
GUICtrlSetStyle($WPI_cmd1_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd1_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 1)
Case $ShowWPIFeatures And $Msg = $WPI_cmd2_Button
GUICtrlSetStyle($WPI_cmd2_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd2_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 2)
Case $ShowWPIFeatures And $Msg = $WPI_cmd3_Button
GUICtrlSetStyle($WPI_cmd3_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd3_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 3)
Case $ShowWPIFeatures And $Msg = $WPI_cmd4_Button
GUICtrlSetStyle($WPI_cmd4_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd4_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 4)
Case $ShowWPIFeatures And $Msg = $WPI_cmd5_Button
GUICtrlSetStyle($WPI_cmd5_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd5_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 5)
Case $ShowWPIFeatures And $Msg = $WPI_cmd6_Button
GUICtrlSetStyle($WPI_cmd6_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd6_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 6)
Case $ShowWPIFeatures And $Msg = $WPI_cmd7_Button
GUICtrlSetStyle($WPI_cmd7_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd7_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 7)
Case $ShowWPIFeatures And $Msg = $WPI_cmd8_Button
GUICtrlSetStyle($WPI_cmd8_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd8_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 8)
Case $ShowWPIFeatures And $Msg = $WPI_cmd9_Button
GUICtrlSetStyle($WPI_cmd9_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd9_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 9)
Case $ShowWPIFeatures And $Msg = $WPI_cmd10_Button
GUICtrlSetStyle($WPI_cmd10_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd10_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 10)
Case $ShowWPIFeatures And $Msg = $WPI_cmd1_Exit_Button
GUICtrlSetStyle($WPI_cmd1_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd1_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 1)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd2_Exit_Button
GUICtrlSetStyle($WPI_cmd2_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd2_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 2)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd3_Exit_Button
GUICtrlSetStyle($WPI_cmd3_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd3_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 3)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd4_Exit_Button
GUICtrlSetStyle($WPI_cmd4_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd4_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 4)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd5_Exit_Button
GUICtrlSetStyle($WPI_cmd5_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd5_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 5)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd6_Exit_Button
GUICtrlSetStyle($WPI_cmd6_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd6_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 6)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd7_Exit_Button
GUICtrlSetStyle($WPI_cmd7_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd7_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 7)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd8_Exit_Button
GUICtrlSetStyle($WPI_cmd8_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd8_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 8)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd9_Exit_Button
GUICtrlSetStyle($WPI_cmd9_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd9_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 9)
ExitUSSF()
Case $ShowWPIFeatures And $Msg = $WPI_cmd10_Exit_Button
GUICtrlSetStyle($WPI_cmd10_Exit_Button_Frame, $SS_BLACKRECT)
Sleep(100)
GUICtrlSetStyle($WPI_cmd10_Exit_Button_Frame, $SS_BLACKFRAME)
SendToWPI($File_Usage_Content, 10)
ExitUSSF()
Case $Msg = $Language_Dropdown
GUISetState(@SW_DISABLE)
SplashTextOn('', $LanguageSpecificStrings[49], 300, 18, -1, -1, 1, 'Arial', 10, 800)
Local $NewLang = GUICtrlRead($Language_Dropdown)
$RegLang = RegRead('HKCU\Software\USSF', 'Skin')
If @error Or $RegLang <> $NewLang Then
RegWrite('HKCU\Software\USSF', 'Language', 'REG_SZ', $NewLang)
EndIf
SetLanguage($NewLang)
ParseLanguage($LanguageSpecificStrings)
SplashOff()
GUISetState(@SW_ENABLE)
Case $Msg = $Skin_Dropdown
GUISetState(@SW_HIDE)
SplashTextOn('', $LanguageSpecificStrings[50], 300, 18, -1, -1, 1, 'Arial', 10, 800)
Local $NewSkin = GUICtrlRead($Skin_Dropdown)
$RegSkin = RegRead('HKCU\Software\USSF', 'Skin')
If $RegSkin <> $NewSkin Then
RegWrite('HKCU\Software\USSF', 'Skin', 'REG_SZ', $NewSkin)
EndIf
If $NewSkin = 'Default' Then
$General_Container_Color = 0xCFCFCF
$Error_Graphic_Color = 0xFF0000
$WPI_Line_Graphic_Color = 0xCFCFCF
$Settings_Container_Color = 0xCFCFCF
$File_Extension_Content_Color = 0xDD0000
$File_Type_Content_Color = 0x000099
$File_Usage_Content_Color = 0x009900
$File_Notes_Content_Color = 0x7F7F7F
$Error_Label_Color = 0xFF0000
$WPI_Specific_Label_Color = 0xCFCFCF
$WPI_cmd1_Button_Color = 0xDD0000
$WPI_cmd2_Button_Color = 0xDD0000
$WPI_cmd3_Button_Color = 0xDD0000
$WPI_cmd4_Button_Color = 0xDD0000
$WPI_cmd5_Button_Color = 0xDD0000
$WPI_cmd6_Button_Color = 0xDD0000
$WPI_cmd7_Button_Color = 0xDD0000
$WPI_cmd8_Button_Color = 0xDD0000
$WPI_cmd9_Button_Color = 0xDD0000
$WPI_cmd10_Button_Color = 0xDD0000
$WPI_cmd1_Exit_Button_Color = 0xDD0000
$WPI_cmd2_Exit_Button_Color = 0xDD0000
$WPI_cmd3_Exit_Button_Color = 0xDD0000
$WPI_cmd4_Exit_Button_Color = 0xDD0000
$WPI_cmd5_Exit_Button_Color = 0xDD0000
$WPI_cmd6_Exit_Button_Color = 0xDD0000
$WPI_cmd7_Exit_Button_Color = 0xDD0000
$WPI_cmd8_Exit_Button_Color = 0xDD0000
$WPI_cmd9_Exit_Button_Color = 0xDD0000
$WPI_cmd10_Exit_Button_Color = 0xDD0000
$CmdNumber_Good = 0x009900
$CmdNumber_Exit_Good = 0x009900
$WPI_cmdx_Button_Color = 0x009900
$WPI_cmdx_Exit_Button_Color = 0x009900
$Language_Title_Color = 0xCFCFCF
$Skin_Title_Color = 0xCFCFCF
$WPI_Process_Status_Content_Bad = 0xDD0000
$WPI_Process_Status_Content_Good = 0x009900
$Title_Color_Bk = 0xF1F3F8
$File_Usage_Content_Color_Bk = 0xF1F3F8
$WPI_Process_Status_Content_Frame_Color_Bk = 0xF1F3F8
$BKColor = 0xFFFFFF
Else
GetSkinVars($NewSkin)
EndIf
RedrawSkin()
SplashOff()
GUISetState(@SW_SHOW)
Case $Msg = $Update_Label
$AbortAutoUpdate = False
GetLatestVersionNumber()
EndSelect
Until $Msg = $GUI_EVENT_CLOSE Or $Msg = $Quit_Button
ExitUSSF()
;############################################### Custom Functions ###############################################
Func ExitUSSF()
If $LaunchedByWPI Then
WinSetState('Windows Post-Install Wizard', '', @SW_ENABLE)
EndIf
Exit
EndFunc
Func ShowMessage($MessageNumber, $NoGUI)
If Not $NoGUI Then
GUICtrlSetData($File_Path_Content, $ProgramToAnalyze)
GUICtrlSetData($File_Extension_Content, $USSF_Messages[$MessageNumber][1])
GUICtrlSetData($File_Type_Content, $USSF_Messages[$MessageNumber][2])
GUICtrlSetData($File_Usage_Content, $USSF_Messages[$MessageNumber][3])
WinWaitActive('USSF')
ControlSend('USSF', '', 'Edit4', '{END}')
GUICtrlSetData($File_Notes_Content, $USSF_Messages[$MessageNumber][4])
Else
If $USSF_Messages[$MessageNumber][3] <> $USSF_Messages[1][4] Then
RegWrite('HKCU\Software\WPI', 'USSF_cmd' & $CmdNumber, 'REG_SZ', $USSF_Messages[$MessageNumber][3])
EndIf
EndIf
EndFunc
Func ParseError($ErrorNumber, $NoGUI = 0)
If Not $NoGUI Then
GUICtrlSetState($Error_Graphic_Over, $GUI_HIDE)
If $ProgramToAnalyze = '' Then
$ProgramToAnalyze = $LanguageSpecificStrings[7]
EndIf
GUICtrlSetData($File_Path_Content, $ProgramToAnalyze)
GUICtrlSetData($File_Extension_Content, $USSF_Errors[$ErrorNumber][1])
GUICtrlSetData($File_Type_Content, $USSF_Errors[$ErrorNumber][2])
GUICtrlSetData($File_Usage_Content, $USSF_Errors[$ErrorNumber][3])
GUICtrlSetData($File_Notes_Content, $USSF_Errors[$ErrorNumber][4])
EndIf
EndFunc
Func GetFileHeader($ProgramToAnalyze, $NumberOfCharsToReturn)
Local $FileHandle = FileOpen($ProgramToAnalyze, 0)
If $FileHandle = -1 Then
ParseError(7)
FileClose($FileHandle)
Return 0
Else
Local $Header
$Header = FileRead($FileHandle, $NumberOfCharsToReturn / 2)
$Header = _StringToHex($Header)
FileClose($FileHandle)
Return $Header
EndIf
EndFunc
Func TestRegFile($ProgramToAnalyze)
Local $FinalHeader
Local $Header = GetFileHeader($ProgramToAnalyze, 156)
If $Header <> 0 Then
If StringLeft($Header, 4) == 'FFFE' Then
;Original .reg file encoded in UTF-16, little-endian
$Header = StringTrimLeft($Header, 4)
For $i = 1 To StringLen($Header) Step 4
$FinalHeader = $FinalHeader & StringMid($Header, $i, 2)
Next
$Header = $FinalHeader
EndIf
If StringLeft($Header, 76) <> '57696E646F777320526567697374727920456469746F722056657273696F6E20352E30300D0A' And StringLeft($Header, 20) <> '52454745444954340D0A' Then
ParseError(3)
Return 2
EndIf
Return 1
Else
Return 0
EndIf
EndFunc
Func TestExeFile($ProgramToAnalyze, $NoGUI)
Local $IDString = PEiD($ProgramToAnalyze)
Select
Case StringInStr($IDString, "Nullsoft PiMP SFX", 0)
ShowMessage(3, $NoGUI)
Case StringInStr($IDString, "Inno Setup", 0)
ShowMessage(4, $NoGUI)
Case StringInStr($IDString, "Installshield AFW", 0)
ShowMessage(5, $NoGUI)
Case StringInStr($IDString, "InstallShield 2003", 0)
ShowMessage(6, $NoGUI)
Case StringInStr($IDString, "Wise Installer", 0) Or StringInStr($IDString, "PEncrypt 4.0", 0)
ShowMessage(7, $NoGUI)
Case StringInStr($IDString, "RAR SFX", 0)
ShowMessage(8, $NoGUI)
Case StringInStr($IDString, "CAB SFX", 0) Or StringInStr($IDString, "SPx Method", 0)
ShowMessage(9, $NoGUI)
Case StringInStr($IDString, "ZIP SFX", 0)
ShowMessage(10, $NoGUI)
Case StringInStr($IDString, "Borland Delphi", 0)
If TestInno($ProgramToAnalyze) = 1 Then
ShowMessage(4, $NoGUI)
ElseIf TestZipSFX($ProgramToAnalyze) = 1 Then
ShowMessage(10, $NoGUI)
Else
$USSF_Errors[5][4] = StringReplace($USSF_Errors[5][4], '%header%', $IDString)
ParseError(5, $NoGUI)
EndIf
Case StringInStr($IDString, "Microsoft Visual C++", 0) And Not StringInStr($IDString, "SPx Method", 0) And Test7Zip($ProgramToAnalyze) = 1
ShowMessage(11, $NoGUI)
Case StringInStr($IDString, "Not a valid PE file", 0)
If Test7Zip($ProgramToAnalyze) = 1 Then
ShowMessage(12, $NoGUI)
ElseIf TestZipSFX($ProgramToAnalyze) = 2 Then
ShowMessage(13, $NoGUI)
Else
ParseError(8, $NoGUI)
EndIf
Case StringInStr($IDString, "WinZip", 0)
ShowMessage(14, $NoGUI)
Case StringInStr($IDString, "UPX", 0)
ShowMessage(15, $NoGUI)
Case Else
If Test7Zip($ProgramToAnalyze) = 1 Then
ShowMessage(12, $NoGUI)
ElseIf TestZipSFX($ProgramToAnalyze) = 2 Then
ShowMessage(13, $NoGUI)
Else
$USSF_Errors[5][4] = StringReplace($USSF_Errors[5][4], '%header%', $IDString)
ParseError(5, $NoGUI)
EndIf
EndSelect
EndFunc
Func PEiD($ProgramToAnalyze)
Local $ExSig = RegRead("HKCU\Software\PEiD", "ExSig")
Local $LoadPlugins = RegRead("HKCU\Software\PEiD", "LoadPlugins")
Local $StayOnTop = RegRead("HKCU\Software\PEiD", "StayOnTop")
RegWrite("HKCU\Software\PEiD", "ExSig", "REG_DWORD", 0)
RegWrite("HKCU\Software\PEiD", "LoadPlugins", "REG_DWORD", 0)
RegWrite("HKCU\Software\PEiD", "StayOnTop", "REG_DWORD", 0)
If Not FileExists(@TempDir & "\PEiD.exe") Then
FileInstall("C:\Users\sadicq\Desktop\USSF\bin\PEiD.exe", @TempDir & "\PEiD.exe", 1)
EndIf
Run(@TempDir & "\PEiD.exe -hard " & '"' & $ProgramToAnalyze & '"', "", @SW_HIDE)
Local $IDString
WinWait("PEiD v0.9")
Do
$IDString = ControlGetText("PEiD v0.9", "", "Edit2")
Sleep(100)
Until $IDString <> "Scanning..." And $IDString <> ""
WinClose("PEiD v0.9")
RegWrite("HKCU\Software\PEiD", "ExSig", "REG_DWORD", $ExSig)
RegWrite("HKCU\Software\PEiD", "LoadPlugins", "REG_DWORD", $LoadPlugins)
RegWrite("HKCU\Software\PEiD", "StayOnTop", "REG_DWORD", $StayOnTop)
Return $IDString
EndFunc
Func TestInno($ProgramToAnalyze)
If Not FileExists(@TempDir & "\innounp.exe") Then
FileInstall("C:\Users\sadicq\Desktop\USSF\bin\innounp.exe", @TempDir & "\innounp.exe", 1)
EndIf
Local $PID = Run(@ComSpec & ' /c ""' & @TempDir & '\innounp.exe" "' & $ProgramToAnalyze & '""', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $Output, $OutputAux
While 1
$OutputAux = StdoutRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
While 1
$OutputAux = StdErrRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
ProcessClose($PID)
If StringInStr($Output, 'Version detected:', 0) Then
Return 1
EndIf
Return 0
EndFunc
Func TestZipSFX($ProgramToAnalyze)
If Not FileExists(@TempDir & "\unzip.exe") Then
FileInstall("C:\Users\sadicq\Desktop\USSF\bin\unzip.exe", @TempDir & "\unzip.exe", 1)
EndIf
Local $PID = Run(@ComSpec & ' /c ""' & @TempDir & '\unzip.exe" -l "' & $ProgramToAnalyze & '""', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $Output, $OutputAux
While 1
$OutputAux = StdoutRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
While 1
$OutputAux = StdErrRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
ProcessClose($PID)
If Not StringInStr($Output, 'signature not found', 0) Then
Return 1
EndIf
If StringInStr($Output, 'Length', 0) Then
Return 2
EndIf
Return 0
EndFunc
Func Test7Zip($ProgramToAnalyze)
If Not FileExists(@TempDir & "\7z.exe") Then
FileInstall("C:\Users\sadicq\Desktop\USSF\bin\7z.exe", @TempDir & "\7z.exe", 1)
EndIf
Local $PID = Run(@ComSpec & ' /c ""' & @TempDir & '\7z.exe" l "' & $ProgramToAnalyze & '""', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $Output, $OutputAux
While 1
$OutputAux = StdoutRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
While 1
$OutputAux = StdErrRead($PID)
If @error Then
ExitLoop
EndIf
$Output = $Output & $OutputAux
Wend
ProcessClose($PID)
If StringInStr($Output, 'Listing archive:', 0) Then
Return 1
EndIf
Return 0
EndFunc
Func Browse()
$ProgramToAnalyze = FileOpenDialog("Select the program to analyze", '', "Supported files (*.exe;*.msi;*.reg;*.inf)|Executable Files (*.exe)|Microsoft Installer files (*.msi)|Registry files (*.reg)|Inf files (*.inf)", 3)
$FileExtension = StringRight($ProgramToAnalyze, 3)
$FileName = StringTrimLeft($ProgramToAnalyze, StringInStr($ProgramToAnalyze, '\', 0, -1))
ParseProgram($ProgramToAnalyze, $FileName, $FileExtension, 0)
EndFunc
Func ParseProgram($ProgramToAnalyze, $FileName, $FileExtension, $NoGUI)
If Not $NoGUI Then
GUICtrlSetState($Error_Graphic_Over, $GUI_SHOW)
GUICtrlSetData($File_Path_Content, $LanguageSpecificStrings[8])
GUICtrlSetData($File_Extension_Content, $LanguageSpecificStrings[9])
GUICtrlSetData($File_Type_Content, $LanguageSpecificStrings[9])
GUICtrlSetData($File_Usage_Content, $LanguageSpecificStrings[9])
GUICtrlSetData($File_Notes_Content, $LanguageSpecificStrings[9])
EndIf
SetMessageAndErrorContent($FileName, $FileExtension, 'English')
If Not FileExists($ProgramToAnalyze) Then
ParseError(4, $NoGUI)
Else
Select
Case $FileExtension = 'msi'
Local $Aux = GetFileHeader($ProgramToAnalyze, 66)
If $Aux == 'D0CF11E0A1B11AE1000000000000000000000000000000003E000300FEFF090006' Then
ShowMessage(16, $NoGUI)
ElseIf $Aux <> 0 Then
ParseError(2, $NoGUI)
EndIf
Case $FileExtension = 'exe'
Local $Aux = GetFileHeader($ProgramToAnalyze, 4)
If $Aux == '4D5A' Then
TestExeFile($ProgramToAnalyze, $NoGUI)
ElseIf $Aux <> 0 Then
ParseError(1, $NoGUI)
EndIf
Case $FileExtension = 'inf'
ShowMessage(1, $NoGUI)
Case $FileExtension = 'reg'
If TestRegFile($ProgramToAnalyze) = 1 Then
ShowMessage(2, $NoGUI)
EndIf
Case Else
ParseError(6, $NoGUI)
EndSelect
EndIf
EndFunc
Func AttachToWPI()
If Not WinExists('Windows Post-Install Wizard') Or Not ProcessExists('mshta.exe') Or $CmdLine[0] <> 4 Then
GUICtrlSetColor($WPI_Process_Status_Content, $WPI_Process_Status_Content_Bad)
GUICtrlSetData($WPI_Process_Status_Content, $LanguageSpecificStrings[14])
GUICtrlSetState($WPI_cmd1_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd2_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd3_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd4_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd5_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd6_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd7_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd8_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd9_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd10_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd1_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd2_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd3_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd4_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd5_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd6_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd7_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd8_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd9_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmd10_Exit_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmdx_Button, $GUI_DISABLE)
GUICtrlSetState($WPI_cmdx_Exit_Button, $GUI_DISABLE)
$LaunchedByWPI = 0
Else
GUICtrlSetColor($WPI_Process_Status_Content, $WPI_Process_Status_Content_Good)
GUICtrlSetData($WPI_Process_Status_Content, $LanguageSpecificStrings[31])
While BitAND(WinGetState('Windows Post-Install Wizard'), 4)
WinSetState('Windows Post-Install Wizard', '', @SW_DISABLE)
WEnd
$LaunchedByWPI = 1
EndIf
EndFunc
Func SendToWPI($File_Usage_Content, $CmdNumber)
Local $Aux = GUICtrlRead($File_Usage_Content)
If $Aux <> $USSF_Messages[1][4] Then
RegWrite('HKCU\Software\WPI', 'USSF_cmd' & $CmdNumber, 'REG_SZ', $Aux)
EndIf
EndFunc
Func ParseLanguage(ByRef $Lang)
Local $BackupOldLang_8 = $Lang[8]
Local $BackupOldLang_9 = $Lang[9]
Local $BackupOldLang_14 = $Lang[14]
Local $BackupOldLang_31 = $Lang[31]
GUICtrlSetData($File_Path_Label, $Lang[2])
GUICtrlSetData($File_Extension_Label, $Lang[3])
GUICtrlSetData($File_Type_Label, $Lang[4])
GUICtrlSetData($File_Usage_Label, $Lang[5])
GUICtrlSetData($File_Notes_Label, $Lang[6])
If GUICtrlRead($File_Path_Content) = $BackupOldLang_8 Then
GUICtrlSetData($File_Path_Content, $Lang[8])
EndIf
If GUICtrlRead($File_Extension_Content) = $BackupOldLang_9 Then
GUICtrlSetData($File_Extension_Content, $Lang[9])
GUICtrlSetData($File_Type_Content, $Lang[9])
GUICtrlSetData($File_Usage_Content, $Lang[9])
GUICtrlSetData($File_Notes_Content, $Lang[9])
EndIf
If $ShowWPIFeatures Then
GUICtrlSetData($WPI_Specific_Label, $Lang[10])
EndIf
GUICtrlSetData($Move_Button, $Lang[11])
GUICtrlSetData($Quit_Button, $Lang[12])
If $ShowWPIFeatures Then
GUICtrlSetData($WPI_Process_Status_Label, $Lang[13])
If GUICtrlRead($WPI_Process_Status_Content) = $BackupOldLang_14 Then
GUICtrlSetData($WPI_Process_Status_Content, $Lang[14])
ElseIf GUICtrlRead($WPI_Process_Status_Content) = $BackupOldLang_31 Then
GUICtrlSetData($WPI_Process_Status_Content, $Lang[31])
EndIf
EndIf
GUICtrlSetData($Error_Label, $Lang[15])
If $ShowWPIFeatures Then
GUICtrlSetData($WPI_cmd1_Button, $Lang[16])
GUICtrlSetData($WPI_cmd2_Button, $Lang[17])
GUICtrlSetData($WPI_cmd3_Button, $Lang[18])
GUICtrlSetData($WPI_cmd4_Button, $Lang[19])
GUICtrlSetData($WPI_cmd5_Button, $Lang[20])