-
Notifications
You must be signed in to change notification settings - Fork 1
/
WndProc.asm
1222 lines (1133 loc) · 41.4 KB
/
WndProc.asm
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
.code
db "Version 3.0 !!!"
DemoCryptBegin:
dd 'ERAS'
DemoReminder proc blabla:DWORD
nop
ret
DemoReminder endp
GetHourValue proc hnd:DWORD,ID:DWORD,pVal:DWORD,Usage:DWORD,pOpt:DWORD
LOCAL StVal[20]:BYTE
LOCAL Hour:DWORD
LOCAL Minutes:DWORD
pushad
mov edi, pVal
assume edi : ptr DAYAUTH
freed StVal,sizeof StVal
invoke GetDlgItemText,hnd,ID,addr StVal,sizeof StVal
.if eax != 0
.if Usage == GET_DURATION_VALUES
invoke ustr2dw,addr StVal
.if eax > 1440
jmp __overflow
.else
m2m dword ptr [edi].Duration, eax
.endif
.elseif Usage == GET_HOUR_VALUES
lea esi, StVal
mov ecx, 2
__recheck:
mov al, byte ptr [esi]
.if (al < 30h) || (al > 39h)
jmp __bad
.endif
inc esi
dec ecx
jnz __recheck
cmp byte ptr [esi], ':'
jnz __bad
inc esi
mov ecx, 2
__recheck2:
mov al, byte ptr [esi]
.if (al < 30h) || (al > 39h)
jmp __bad
.endif
inc esi
dec ecx
jnz __recheck2
cmp byte ptr [esi],0
jnz __bad
lea esi, StVal
mov ax, word ptr [esi]
mov dword ptr [Hour], 0
mov word ptr [Hour],ax
invoke ustr2dw,addr Hour
.if eax > 23
jmp __overflow
.endif
mov ecx, 60
mul ecx
mov dword ptr [Hour], eax
mov ax, word ptr [esi+3]
mov dword ptr [Minutes],0
mov word ptr [Minutes],ax
invoke ustr2dw,addr Minutes
.if eax > 59
jmp __bad
.endif
add dword ptr [Hour], eax
mov eax, dword ptr [Hour]
.if eax > 1439
jmp __overflow
.else
m2m dword ptr [edi].BaseHour, eax
add eax, dword ptr [edi].Duration
.if eax > 1439
jmp __overflow
.endif
.endif
.endif
.endif
mov esi, pOpt
assume esi : ptr DAYHND
m2m dword ptr [edi].AuthEd, dword ptr [esi].IsActive
assume edi : nothing
assume esi : nothing
popad
mov eax, 1
ret
__overflow:
invoke MessageBoxA,hnd,addr TooLargeValue,addr AppName,0
jmp @F
__bad:
invoke MessageBoxA,hnd,addr BadValues,addr AppName,NULL
@@:
freed IniFile.WeekAuth, sizeof WEEKAUTH
popad
mov eax, 0
ret
GetHourValue endp
SetValues proc pHnd:DWORD, pValues:DWORD, Usage:DWORD
LOCAL buf[20]:BYTE
mov edi, pValues
mov esi, pHnd
assume edi : ptr DAYAUTH
assume esi : ptr DAYHND
.if Usage == SET_VALUES_FORCE
push [edi].AuthEd
m2m [edi].AuthEd, 1
.endif
.if ([edi].AuthEd == 1)
m2m [esi].IsActive,1
mov eax, dword ptr [edi].Duration
.if eax != 0
freed buf,sizeof buf
invoke wsprintf,addr buf,addr nfilter,eax
invoke SetWindowText,[esi].DurationHnd,addr buf
.endif
mov eax, dword ptr [edi].BaseHour
.if eax != 0
freed buf,sizeof buf
xor edx, edx
mov ecx, 60
div ecx
invoke wsprintf,addr buf,addr nhfilter,eax,edx
invoke SetWindowText,[esi].HourHnd,addr buf
.endif
.else
m2m [esi].IsActive,0
.endif
.if Usage == SET_VALUES_FORCE
pop [edi].AuthEd
m2m [esi].IsActive, [edi].AuthEd
.endif
invoke SendMessage,[esi].ButtonHnd,BM_SETCHECK,[esi].IsActive,0
invoke EnableWindow,[esi].DurationHnd,[esi].IsActive
invoke EnableWindow,[esi].HourHnd,[esi].IsActive
assume esi : nothing
assume edi : nothing
ret
SetValues endp
;:::::::::: HndLoop function, a little bit complex :::::::::;
;
; pHnd designe de façon générale l'endroit où seront placées et lues les valeurs en memoire.
;
; baseID est l'ID de base des controles où effectuer les opérations.
;
; pOptional : pointeur vers la structure WeekHnd appropriée.
;
;
HndLoop proc pHnd:DWORD, baseID:DWORD, hnd:DWORD,Usage:DWORD,pOptional:DWORD
LOCAL use:DWORD
pushad
mov edi, pHnd
mov ebx, baseID
mov esi, pOptional
mov ecx, 7
@@:
push ecx
.if Usage == GET_HANDLES
invoke GetDlgItem,hnd,ebx
mov dword ptr [edi], eax
add edi, sizeof DAYHND
.elseif (Usage == GET_DURATION_VALUES) || (Usage == GET_HOUR_VALUES)
invoke GetHourValue,hnd,ebx,edi,Usage,esi
add esi, sizeof DAYHND
add edi, sizeof DAYAUTH
.if eax == 0
pop ecx
jmp __endlooperr
.endif
.elseif (Usage == DISABLE_ITEMS) || (Usage == ENABLE_ITEMS) || (Usage == DISABLE_EDITSONLY)
assume edi : ptr DAYHND
.if Usage == DISABLE_EDITSONLY
m2m use, 0
.else
m2m use, Usage
invoke EnableWindow,[edi].ButtonHnd,use
.endif
invoke EnableWindow,[edi].DurationHnd,use
invoke EnableWindow,[edi].HourHnd,use
assume edi : nothing
add edi, sizeof DAYHND
.elseif (Usage == SET_VALUES) || (Usage == SET_VALUES_FORCE)
invoke SetValues, esi, edi, Usage
add edi, sizeof DAYAUTH
add esi, sizeof DAYHND
.elseif (Usage == SET_VALUES_NULL)
assume edi : ptr DAYAUTH
assume esi : ptr DAYHND
mov [edi].Duration, 0
mov [edi].BaseHour, 0
invoke SetWindowText, [esi].DurationHnd, NULL
invoke SetWindowText, [esi].HourHnd, NULL
assume edi : nothing
assume esi : nothing
add edi, sizeof DAYAUTH
add esi, sizeof DAYHND
.endif
inc ebx
pop ecx
dec ecx
jnz @B
popad
mov eax, 1
ret
__endlooperr:
popad
xor eax, eax
ret
HndLoop endp
SwitchSingle proc pHnd:DWORD, pAuth:DWORD
pushad
mov edi, pHnd
mov esi, pAuth
assume edi : ptr DAYHND
assume esi : ptr DAYAUTH
xor dword ptr [edi].IsActive, 1
xor dword ptr [esi].AuthEd, 1
invoke EnableWindow,[edi].DurationHnd,[edi].IsActive
invoke EnableWindow,[edi].HourHnd,[edi].IsActive
assume edi : nothing
assume esi : nothing
popad
ret
SwitchSingle endp
TimeDateDlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
.if uMsg == WM_INITDIALOG
m2m hParent, lParam
invoke GetDlgItem,hDlg,1026
mov WeekHnd.Week.ButtonHnd, eax
invoke GetDlgItem,hDlg,1027
mov WeekHnd.Week.DurationHnd, eax
invoke GetDlgItem,hDlg,1028
mov WeekHnd.Week.HourHnd, eax
invoke HndLoop,addr WeekHnd.Monday.ButtonHnd,1001,hDlg,GET_HANDLES,0
invoke HndLoop,addr WeekHnd.Monday.DurationHnd,1008,hDlg,GET_HANDLES,0
invoke HndLoop,addr WeekHnd.Monday.HourHnd,1015,hDlg,GET_HANDLES,0
invoke HndLoop,addr WeekHnd.Monday.ButtonHnd,0,hDlg,DISABLE_EDITSONLY,0
invoke HndLoop,addr IniFile.WeekAuth.Monday,0,hDlg,SET_VALUES,addr WeekHnd.Monday
invoke SetValues,addr WeekHnd.Week,addr IniFile.WeekAuth.Week,NULL
.if WeekHnd.Week.IsActive == 1
invoke HndLoop,addr WeekHnd.Monday,0,hDlg,DISABLE_ITEMS,0
.endif
mov eax, 1
ret
.elseif uMsg == WM_COMMAND
mov eax, wParam
.if ax == 1026
invoke HndLoop,addr WeekHnd.Monday.ButtonHnd,0,hDlg,WeekHnd.Week.IsActive,0
.if WeekHnd.Week.IsActive == 1
invoke HndLoop,addr IniFile.WeekAuth.Monday,0,hDlg,SET_VALUES,addr WeekHnd.Monday
.endif
invoke SwitchSingle,addr WeekHnd.Week,addr IniFile.WeekAuth.Week
.elseif ax == 1029
freed IniFile.WeekAuth,sizeof WEEKAUTH
invoke GetHourValue,hDlg,1027,addr IniFile.WeekAuth.Week,GET_DURATION_VALUES,addr WeekHnd.Week
invoke GetHourValue,hDlg,1028,addr IniFile.WeekAuth.Week,GET_HOUR_VALUES,addr WeekHnd.Week
invoke HndLoop,addr IniFile.WeekAuth.Monday,1008,hDlg,GET_DURATION_VALUES,addr WeekHnd.Monday
invoke HndLoop,addr IniFile.WeekAuth.Monday,1015,hDlg,GET_HOUR_VALUES,addr WeekHnd.Monday
mov eax, sizeof MD5RESULT
add eax, CURRENT_INIDEFAULT_BETWEEN_VALUES
invoke SetFilePointer,hInit,eax,0,FILE_BEGIN
invoke WriteFile,hInit,addr IniFile.WeekAuth,sizeof WEEKAUTH,addr read, NULL
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
invoke SaveCheckSum,CHECKSUM_RSET
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
.elseif ax == 1001
invoke SwitchSingle,addr WeekHnd.Monday,addr IniFile.WeekAuth.Monday
.elseif ax == 1002
invoke SwitchSingle,addr WeekHnd.Tuesday,addr IniFile.WeekAuth.Tuesday
.elseif ax == 1003
invoke SwitchSingle,addr WeekHnd.Wednesday,addr IniFile.WeekAuth.Wednesday
.elseif ax == 1004
invoke SwitchSingle,addr WeekHnd.Thursday,addr IniFile.WeekAuth.Thursday
.elseif ax == 1005
invoke SwitchSingle,addr WeekHnd.Friday,addr IniFile.WeekAuth.Friday
.elseif ax == 1006
invoke SwitchSingle,addr WeekHnd.Saturday,addr IniFile.WeekAuth.Saturday
.elseif ax == 1007
invoke SwitchSingle,addr WeekHnd.Sunday,addr IniFile.WeekAuth.Sunday
.elseif ax == 1030
invoke EndDialog,hParent,NULL
.elseif ax == 1025
invoke GetHourValue,hDlg,1023,addr DurationSet,GET_DURATION_VALUES,addr hDurationSet
invoke GetHourValue,hDlg,1024,addr DurationSet,GET_HOUR_VALUES,addr hDurationSet
lea edi, IniFile.WeekAuth.Monday
mov ecx, 7
@@:
pushad
mcopy offset DurationSet,edi,8
popad
add edi, sizeof DAYAUTH
dec ecx
jnz @B
invoke HndLoop,addr IniFile.WeekAuth.Monday,0,hDlg,SET_VALUES_FORCE,addr WeekHnd.Monday
.elseif ax == 1022
invoke HndLoop,addr IniFile.WeekAuth.Monday,1008,hDlg,SET_VALUES_NULL,addr WeekHnd.Monday
lea edi, IniFile.WeekAuth.Week
lea esi, WeekHnd.Week
assume edi : ptr DAYAUTH
mov [edi].Duration, 0
mov [edi].BaseHour, 0
invoke SetValues, esi, edi, SET_VALUES_NULL
assume edi : nothing
.endif
.endif
xor eax, eax
ret
TimeDateDlgProc endp
DlgNewPass proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
pushad
.if uMsg == WM_COMMAND
mov eax, wParam
.if ax == 211
invoke RtlZeroMemory,addr PassPhrase,sizeof PassPhrase
invoke GetWindowText,hEditPass,addr PassPhrase,50
.if eax > 6
push eax
invoke RtlZeroMemory,addr IniFile.Md5Password,sizeof MD5RESULT
pop eax
invoke procMD5hash,addr PassPhrase,eax,addr IniFile.Md5Password
invoke SetFilePointer,hInit,0,0,FILE_BEGIN
invoke WriteFile,hInit,addr IniFile.Md5Password,sizeof MD5RESULT,addr read, NULL
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
invoke SaveCheckSum,CHECKSUM_RSET
.if eax == 1
invoke MessageBoxA,hDlg,addr szPassChanged,addr AppName,NULL
.else
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
invoke EndDialog,hDlg,NULL
.else
invoke MessageBoxA,hDlg,addr szMoreChars,addr AppName,NULL
.endif
.endif
.elseif uMsg == WM_INITDIALOG
invoke SetWindowText,hDlg,addr NewPassTitle
invoke GetDlgItem,hDlg,210
mov hEditPass, eax
invoke RtlZeroMemory,addr PassPhrase,sizeof PassPhrase
popad
mov eax, 1
ret
.elseif uMsg==WM_CLOSE
invoke EndDialog,hDlg,NULL
.endif
popad
xor eax, eax
ret
DlgNewPass endp
dd 'ERAS'
dd 10 dup(0)
DemoCryptEnd:
dd 10 dup(0)
include ACF.asm
SaveCheckSum proc Usage:DWORD
LOCAL HeaderSum:DWORD
LOCAL CheckSum:DWORD
LOCAL hKey:DWORD
LOCAL sData:DWORD
LOCAL dType:DWORD
invoke IsUserAdmin
.if eax == 0
jmp endSC
.endif
.if Usage == CHECKSUM_RSET
invoke MapFileAndCheckSum,addr pIniDir,addr HeaderSum,addr CheckSum
.if eax != CHECKSUM_SUCCESS
mov eax, 0
ret
.endif
invoke RegCreateKeyEx,HKEY_LOCAL_MACHINE,addr GKey,NULL,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,addr hKey,addr read
invoke RegSetValueEx,hKey,addr ICSum,NULL,REG_DWORD,addr CheckSum,sizeof CheckSum
invoke RegCloseKey,hKey
mov eax, 1
ret
.elseif Usage == CHECKSUM_RGET
mov CheckSum, 0
mov sData, 4h
invoke RegCreateKeyEx,HKEY_LOCAL_MACHINE,addr GKey,NULL,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,addr hKey,addr read
invoke RegQueryValueEx,hKey,addr ICSum,NULL,addr dType,addr CheckSum,addr sData
push eax
invoke RegCloseKey,hKey
pop eax
.if eax != ERROR_SUCCESS
mov eax, 0
ret
.endif
mov eax, CheckSum
ret
.elseif Usage == CHECKSUM_FGET
invoke MapFileAndCheckSum,addr pIniDir,addr HeaderSum,addr CheckSum
.if eax != CHECKSUM_SUCCESS
mov eax, 0
ret
.endif
mov eax, CheckSum
ret
.endif
ret
endSC:
mov eax, 1
ret
SaveCheckSum endp
DoUnHookAndClose proc
invoke GetProcAddress,hGDll,addr UIHStr
call eax
.if NTOs == 0
invoke UnHideMe9x
.endif
invoke ReleaseMutex, hMutex
invoke CloseHandle,hMutex
invoke RegCloseKey,Khnd
invoke FreeLibrary,addr DllPath
invoke CloseHandle,hInit
invoke ExitProcess,0
DoUnHookAndClose endp
SetDefaultsInControls proc
LOCAL val[10]:BYTE
.if NTOs == 0
m2m IniFile.IsUserPrevented, 0
invoke EnableWindow,hUserPrevented,FALSE
.endif
invoke SendMessage,hTextVisible,BM_SETCHECK,IniFile.IsTextVisible,0
invoke SendMessage,hCplPrevented,BM_SETCHECK,IniFile.IsCplPrevented,0
invoke SendMessage,hNagOff,BM_SETCHECK,IniFile.IsNagOff,0
invoke SendMessage,hUserPrevented,BM_SETCHECK,IniFile.IsUserPrevented,0
invoke SendMessage,hWinGames,BM_SETCHECK,IniFile.AreWinGamesBlocked,0
invoke SendMessage,hARestart,BM_SETCHECK,IniFile.IsAutoRestarted,0
invoke SendMessage,hUInfo,BM_SETCHECK,IniFile.IsUserInformed,0
invoke SendMessage,hNetMode,BM_SETCHECK,IniFile.IsNetwork,0
invoke EnableWindow,hIsServer,IniFile.IsNetwork
invoke EnableWindow,hIsClient,IniFile.IsNetwork
invoke SendMessage,hIsServer,BM_SETCHECK,IniFile.IsServer,0
invoke SendMessage,hIsClient,BM_SETCHECK,IniFile.IsClient,0
invoke EnableWindow,hServName,IniFile.IsNetwork
invoke SendMessage,hServName,WM_SETTEXT,0,addr IniFile.ServCompName
mov eax, 1
ret
SetDefaultsInControls endp
CreateNag proc
xor esi,esi
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
mov wc.lpfnWndProc,offset NagProc
mov wc.cbClsExtra,esi
mov wc.cbWndExtra,esi
m2m wc.hInstance,hInst
mov wc.hbrBackground,0
mov wc.lpszMenuName,esi
mov wc.lpszClassName,offset ClassName
invoke LoadIcon,hInst,200
mov hIcon,eax
m2m wc.hIcon,hIcon
m2m wc.hIconSm,hIcon
invoke LoadCursor,esi,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke GetSystemMetrics,SM_CXSCREEN
sub eax,WxDim
shr eax,1
m2m ebx,eax
invoke GetSystemMetrics,SM_CYSCREEN
sub eax,WyDim
shr eax,1
invoke CreateWindowEx,esi,addr ClassName,addr AppName,WS_POPUP or WS_SYSMENU,ebx,eax,WxDim,WyDim,esi,esi,hInst,esi
mov hWnd,eax
invoke UpdateWindow,hWnd
.while 1
xor eax,eax
invoke GetMessage,addr msg,eax,eax,eax
.break .if (!eax)
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endw
mov eax,msg.wParam
invoke ExitThread,0
ret
CreateNag endp
TabProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
pushad
.if uMsg == WM_NOTIFY
mov eax, lParam
mov eax, (NMHDR PTR [eax]).code
.if eax == TCN_SELCHANGE
mov ebx,CurrentTab
push ebx
mov eax,[SelectDlgHwnd+ebx*4]
invoke ShowWindow,eax,SW_HIDE
invoke SendMessage,hwndTab,TCM_GETCURSEL,0,0
mov CurrentTab,eax
pop ebx
cmp eax, 1
jnz @F
cmp DemoFilePresent, 1
jz @F
invoke MessageBoxA,hDlg,addr SorryDemoVersion,addr AppName,0
invoke SendMessage,hwndTab,TCM_SETCURSEL,ebx,0
mov CurrentTab, ebx
mov eax, ebx
@@:
mov ebx, dword ptr [SelectDlgHwnd+eax*4]
invoke ShowWindow,EBX,SW_SHOWDEFAULT
.endif
.elseif uMsg == WM_INITDIALOG
m2m hDlgParent,hDlg
m2m iccex.dwSize, sizeof iccex
m2m iccex.dwICC, ICC_TAB_CLASSES
invoke InitCommonControlsEx,addr iccex
invoke GetDlgItem,hDlg,1000
m2m hwndTab,eax
m2m ItemStruct.imask,TCIF_TEXT
m2m ItemStruct.lpReserved1,0
m2m ItemStruct.lpReserved2,0
m2m ItemStruct.pszText,offset TabTitle1
m2m ItemStruct.cchTextMax,sizeof TabTitle1
m2m ItemStruct.iImage,0
m2m ItemStruct.lParam,0
invoke SendMessage,hwndTab,TCM_INSERTITEM,0,addr ItemStruct
m2m ItemStruct.pszText,offset TabTitle2
m2m ItemStruct.cchTextMax,sizeof TabTitle2
invoke SendMessage,hwndTab,TCM_INSERTITEM,1,addr ItemStruct
m2m ItemStruct.pszText,offset TabTitle3
m2m ItemStruct.cchTextMax,sizeof TabTitle3
invoke SendMessage,hwndTab,TCM_INSERTITEM,2,addr ItemStruct
m2m ItemStruct.pszText,offset TabTitle4
m2m ItemStruct.cchTextMax,sizeof TabTitle4
invoke SendMessage,hwndTab,TCM_INSERTITEM,3,addr ItemStruct
m2m eax,offset SelectDlgProc
invoke CreateDialogParam,hInst,100,hwndTab,eax,hDlg
mov SelectDlgHwnd,eax
cmp DemoFilePresent, 1
jnz @F
m2m eax,offset TimeDateDlgProc
invoke CreateDialogParam,hInst,103,hwndTab,eax,hDlg
mov TimeDateDlgHwnd,eax
@@:
m2m eax,offset OptionsDlgProc
invoke CreateDialogParam,hInst,104,hwndTab,eax,hDlg
mov OptionsDlgHwnd,eax
m2m eax,offset SecDlgProc
invoke CreateDialogParam,hInst,106,hwndTab,eax,hDlg
mov SecDlgHwnd,eax
m2m CurrentTab,0
invoke ShowWindow,SelectDlgHwnd,SW_SHOW
popad
mov eax, 1
ret
.elseif uMsg==WM_CLOSE
invoke EndDialog,hDlg,NULL
.endif
popad
xor eax, eax
ret
TabProc endp
SecDlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
.if uMsg == WM_COMMAND
mov eax, wParam
.if ax == 1002
invoke RtlZeroMemory,addr SecBuf,sizeof SecBuf
invoke GetWindowText,hEditPass,addr SecBuf,480
lea edi, SecBuf
Bo:
cmp dword ptr [edi],0
jz B1
cmp byte ptr [edi], ","
jnz @F
mov byte ptr [edi], 0
@@:
inc edi
jmp Bo
B1:
sub edi, offset SecBuf
invoke AccessConfigFiles,9,addr SecBuf,edi
.elseif ax == 1003
invoke EndDialog,hParent,0
.endif
.elseif uMsg == WM_INITDIALOG
invoke GetDlgItem,hDlg,1000
mov hEditPass, eax
invoke AccessConfigFiles,8,addr SecBuf,500
lea edi, SecBuf
inc edi
Bo1:
cmp dword ptr [edi],0
jz B11
cmp byte ptr [edi], 0
jnz @F
mov byte ptr [edi], ","
@@:
inc edi
jmp Bo1
B11:
invoke SetWindowText,hEditPass,addr SecBuf
mov eax, 1
ret
.elseif uMsg==WM_CLOSE
invoke EndDialog,hDlg,NULL
.endif
xor eax, eax
ret
SecDlgProc endp
SelectDlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
pushad
.if uMsg == WM_COMMAND
mov eax, wParam
.if ax == 1003
invoke EndDialog,hParent,0
.elseif ax == 2000
invoke SendMessage,hList1,LB_GETCURSEL,0,0
mov IndexItem, eax
invoke SendMessage,hList1,LB_GETTEXT,IndexItem,ADDR Buffer
mov sBuffer,eax
invoke SendMessage,hList2,LB_ADDSTRING,NULL,addr Buffer
lea edi, PrivBuf
@@:
invoke lstrlen,edi
cmp eax, 0
jz @F
inc eax
add edi, eax
cmp dword ptr [edi], 0
jnz @B
@@:
invoke lstrcpy,edi,addr Buffer
add edi, sBuffer
sub edi, offset PrivBuf
mov sPriv, edi
.elseif ax==1002
invoke AccessConfigFiles,4,addr PrivBuf,sizeof PrivBuf
.elseif ax == 2001
invoke SendMessage,hList2,LB_GETCURSEL,0,0
mov IndexItem, eax
invoke SendMessage,hList2,LB_DELETESTRING,IndexItem,0
invoke RtlZeroMemory,addr PrivBuf,sizeof PrivBuf
invoke SendMessage,hList2,LB_GETCOUNT,0,0
mov nCount,eax
xor edi, edi
lea esi,PrivBuf
cmp eax, 0
jz nomore
@@:
invoke SendMessage,hList2,LB_GETTEXT,edi,ADDR Buffer
push eax
invoke lstrcpy,esi,addr Buffer
pop eax
add esi,eax
inc esi
inc edi
cmp edi, nCount
jnz @B
nomore:
sub esi, offset PrivBuf
mov sPriv,esi
.endif
.elseif uMsg == WM_INITDIALOG
m2m hParent, lParam
invoke GetDlgItem,hDlg,500
mov hList1, eax
invoke GetDlgItem,hDlg,501
mov hList2, eax
invoke RtlZeroMemory,addr PrivBuf,sizeof PrivBuf
invoke RtlZeroMemory,addr LaunchBuf,sizeof LaunchBuf
;-------------------------------------------------------------------------- Get our privilegied names file
invoke AccessConfigFiles,2,addr PrivBuf,sizeof PrivBuf
invoke AccessConfigFiles,1,addr LaunchBuf,sizeof LaunchBuf
lea edi, LaunchBuf
@@:
invoke lstrcpy,addr Buffer,edi
invoke lstrlen,addr Buffer
mov sBuffer,eax
cmp eax, 0
jz @F
invoke SendMessage,hList1,LB_ADDSTRING,0,addr Buffer
add edi, sBuffer
inc edi
cmp dword ptr [edi],0
jnz @B
@@:
lea edi, PrivBuf
@@:
invoke lstrcpy,addr Buffer,edi
invoke lstrlen,addr Buffer
mov sBuffer,eax
cmp eax, 0
jz @F
invoke SendMessage,hList2,LB_ADDSTRING,0,addr Buffer
add edi, sBuffer
inc edi
cmp dword ptr [edi],0
jnz @B
@@:
sub edi, offset PrivBuf
mov sPriv, edi
popad
mov eax, 1
ret
.elseif uMsg==WM_CLOSE
invoke EndDialog,hParent,0
.endif
popad
xor eax, eax
ret
SelectDlgProc endp
OptionsDlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
.if uMsg == WM_INITDIALOG
m2m hParent, lParam
invoke GetDlgItem,hDlg,1012
mov hTextVisible, eax
invoke GetDlgItem,hDlg,1006
mov hUserPrevented, eax
invoke GetDlgItem,hDlg,1007
mov hCplPrevented, eax
invoke GetDlgItem,hDlg,1008
mov hNagOff, eax
invoke GetDlgItem,hDlg,1013
mov hARestart, eax
invoke GetDlgItem,hDlg,1014
mov hUInfo, eax
invoke GetDlgItem,hDlg,1015
mov hWinGames, eax
invoke GetDlgItem,hDlg,1248
mov hLicKey, eax
invoke GetDlgItem,hDlg,1249
mov hVisitAuth,eax
invoke GetDlgItem,hDlg,1016
mov hMailAuth,eax
invoke GetDlgItem,hDlg,1017
mov hNetMode,eax
invoke GetDlgItem,hDlg,1018
mov hIsServer,eax
invoke GetDlgItem,hDlg,1019
mov hIsClient,eax
invoke GetDlgItem,hDlg,1020
mov hServName,eax
call SetDefaultsInControls
mov eax, 1
ret
.elseif uMsg == WM_COMMAND
mov eax, wParam
.if ax==1005
cmp DemoFilePresent, 1
jnz @F
invoke DialogBoxParam,hInst,105,NULL,addr DlgNewPass,NULL
jmp __dem1
@@:
invoke MessageBoxA,hDlg,addr SorryDemoVersion,addr AppName,0
__dem1:
.elseif ax == 1004
invoke EndDialog,hParent,NULL
invoke DoUnHookAndClose
.elseif ax == 1248
cmp dword ptr [DemoCryptBegin], 'ERAS'
jnz @F
invoke wsprintf,addr DemoBuf,addr szDemoLic,IniFile.DemoPass
invoke MessageBoxA,hDlg,addr DemoBuf,addr AppName,0
jmp __235
@@:
invoke DialogBoxParam,hInst,105,NULL,addr DlgLicense,NULL
__235:
.elseif ax == 1010
freed ServBuf,sizeof ServBuf
.if (IniFile.IsNetwork == 1) && (IniFile.IsClient == 1)
freed IniFile.ServCompName,40
invoke GetWindowText,hServName,addr IniFile.ServCompName, 38
invoke lstrcat,addr ServBuf,addr IniFile.ServCompName
invoke lstrcat,addr ServBuf,addr ClientPipeEnd
invoke CreateFile,addr ServBuf,GENERIC_READ or GENERIC_WRITE ,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0
.if eax == -1
invoke GetLastError
.if eax != ERROR_PIPE_BUSY
invoke MessageBoxA,hDlg,addr szServNotReady,addr AppName,0
mov dword ptr [IniFile.IsNetwork], 0
freed IniFile.ServCompName,40
call SetDefaultsInControls
jmp @F
.endif
.endif
invoke CloseHandle,eax
.endif
@@:
invoke SetFilePointer,hInit,sizeof MD5RESULT,0,FILE_BEGIN
invoke WriteFile,hInit,addr IniFile.IsTextVisible,CURRENT_INIDEFAULT_BETWEEN_VALUES,addr read, NULL
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
invoke SaveCheckSum,CHECKSUM_RSET
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
@@:
.elseif ax == 1012
xor dword ptr [IniFile.IsTextVisible], 1
.elseif ax == 1006
xor dword ptr [IniFile.IsUserPrevented], 1
.elseif ax == 1007
xor dword ptr [IniFile.IsCplPrevented], 1
.elseif ax == 1008
xor dword ptr [IniFile.IsNagOff], 1
.elseif ax == 1013
xor dword ptr [IniFile.IsAutoRestarted], 1
.if IniFile.IsAutoRestarted==0
invoke RegDeleteValue,Khnd,addr ServName
.else
invoke RegSetValueEx,Khnd,addr ServName,NULL,REG_SZ,addr value,sizeof value
.endif
.elseif ax == 1014
xor dword ptr [IniFile.IsUserInformed], 1
.elseif ax == 1015
xor dword ptr [IniFile.AreWinGamesBlocked], 1
.elseif ax == 1017
.if IniFile.IsClient == 1
freed ServBuf,sizeof ServBuf
invoke lstrcat,addr ServBuf,addr IniFile.ServCompName
invoke lstrcat,addr ServBuf,addr ClientPipeEnd
invoke CreateFile,addr ServBuf,GENERIC_READ or GENERIC_WRITE ,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0
.if eax == -1
invoke GetLastError
.if eax != ERROR_PIPE_BUSY
invoke MessageBoxA,hDlg,addr szServNotReady,addr AppName,0
mov dword ptr [IniFile.IsNetwork], 0
freed IniFile.ServCompName,40
call SetDefaultsInControls
jmp @F
.endif
.endif
invoke CloseHandle,eax
.elseif IniFile.IsServer == 1
invoke GetStartupInfo,ADDR startInfo
invoke GetAppPath,addr CmdBuf
invoke lstrcat,addr CmdBuf,addr szServProg
invoke CreateProcess,ADDR CmdBuf,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,ADDR startInfo,ADDR processInfo
invoke CloseHandle,processInfo.hThread
invoke CloseHandle,processInfo.hProcess
.endif
xor dword ptr [IniFile.IsNetwork], 1
invoke EnableWindow,hIsServer,IniFile.IsNetwork
invoke EnableWindow,hIsClient,IniFile.IsNetwork
invoke SendMessage,hIsServer,BM_SETCHECK,IniFile.IsServer,0
invoke SendMessage,hIsClient,BM_SETCHECK,IniFile.IsClient,0
invoke EnableWindow,hServName,IniFile.IsNetwork
invoke SendMessage,hServName,WM_SETTEXT,0,addr IniFile.ServCompName
@@:
.elseif ax == 1018
.if IniFile.IsServer == 0
xor dword ptr [IniFile.IsServer], 1
xor dword ptr [IniFile.IsClient], 1
invoke SendMessage,hIsClient,BM_SETCHECK,IniFile.IsClient,0
.endif
.elseif ax == 1019
.if IniFile.IsClient == 0
freed IniFile.ServCompName,40
freed ServBuf,sizeof ServBuf
invoke GetWindowText,hServName,addr IniFile.ServCompName, 38
invoke lstrcat,addr ServBuf,addr IniFile.ServCompName
invoke lstrcat,addr ServBuf,addr ClientPipeEnd
invoke CreateFile,addr ServBuf,GENERIC_READ or GENERIC_WRITE ,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0
.if eax == -1
invoke GetLastError
.if eax != ERROR_PIPE_BUSY
invoke MessageBoxA,hDlg,addr szServNotReady,addr AppName,0
mov dword ptr [IniFile.IsNetwork], 0
freed IniFile.ServCompName,40
call SetDefaultsInControls
jmp @F
.endif
.endif
invoke CloseHandle,eax
xor dword ptr [IniFile.IsServer], 1
xor dword ptr [IniFile.IsClient], 1
invoke SendMessage,hIsServer,BM_SETCHECK,IniFile.IsServer,0
@@:
.endif
.elseif ax == 1011
invoke EndDialog,hParent,NULL
.elseif ax == 1009
mcopyd IniDefault.IsTextVisible,IniFile.IsTextVisible,CURRENT_INIDEFAULT_BETWEEN_VALUES
invoke SetFilePointer,hInit,sizeof MD5RESULT,0,FILE_BEGIN
invoke WriteFile,hInit,addr IniFile.IsTextVisible,CURRENT_INIDEFAULT_BETWEEN_VALUES,addr read, NULL
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
invoke SaveCheckSum,CHECKSUM_RSET
.if eax == 0
invoke MessageBoxA,hDlg,addr szAccessError,addr AppName,NULL
.endif
call SetDefaultsInControls
.elseif ax == 1016
invoke ShellExecute,hDlg,addr lpOperation, addr lpMail, NULL, NULL, SW_SHOWNORMAL
.elseif ax == 1249
invoke ShellExecute,hDlg,addr lpOperation, addr lpPage, NULL, NULL, SW_SHOWNORMAL
.endif
.endif
xor eax, eax
ret
OptionsDlgProc endp
DlgVerif proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD, lParam:DWORD
pushad
.if uMsg == WM_COMMAND
mov eax, wParam
.if ax == 211
invoke RtlZeroMemory,addr PassPhrase,sizeof PassPhrase
invoke GetWindowText,hEditPass,addr PassPhrase,50
.if eax > 6
push eax
invoke RtlZeroMemory,addr stMD5Result,sizeof stMD5Result
pop eax
invoke procMD5hash,addr PassPhrase,eax,addr stMD5Result
mov eax, stMD5Result.dtA
cmp eax, IniFile.Md5Password.dtA
jnz @F
mov eax, stMD5Result.dtB
cmp eax, IniFile.Md5Password.dtB
jnz @F
mov eax, stMD5Result.dtC
cmp eax, IniFile.Md5Password.dtC
jnz @F