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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
|
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; PECRYPT32 1.02 (c) in 1998 by random and killa
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;
;changes since final release of 1.02 :
; - added the new version of the apack library.
;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Cryptor_Start:
mov edi,offset IconPointers ; points to the data stuff
mov dword ptr [IconPointi],edi
mov ecx,500
xor eax,eax
rep stosd
mov word ptr [OBJnumber],0
mov byte ptr [DontStore],1
mov dword ptr [KILLASTINKT],ebp
mov dword ptr [MONGOKILLA],esp
mov al,byte ptr [KILLH]
mov byte ptr [KILLHEAD],al
mov al,byte ptr [HOOKFUNC]
mov byte ptr [LOADEROPT],al
mov al,byte ptr [ANTIBPX]
mov byte ptr [ANTIBPXBPM],al
mov al,byte ptr [IMPORTD]
mov byte ptr [IMP_DESTROY],al
mov byte ptr [I_MERGING],al
mov al,byte ptr [ANTILOADER]
mov byte ptr [ALOADER],al
call Randomize
mov dword ptr [Impenc],eax ; random value for the new separate import encryption
mov dword ptr [IMPENC2],eax ; save it again
call Randomize
mov dword ptr [Impenc3],eax ; random value for the new separate import encryption
mov dword ptr [IMPENC4],eax ; save it again
call Randomize
mov dword ptr [Patch_Crc1+1],eax ; patch another random value into the code
call Randomize
mov dword ptr [CRC32VALUE1],eax ; save the first CRC32 Value
call Randomize
mov dword ptr [CRC32VALUE2],eax ; save the second CRC32 Value
call Randomize ; great random function,yeahh
mov dword ptr [ENCRYPTV1],eax ; random value for an encryption routine
call Randomize ; great random function,yeahh
mov dword ptr [ENCRYPTV2],eax ; random value for an encryption routine
mov al,byte ptr [ANTID] ; get the antidebugging option
mov byte ptr [AMETHOD],al ; save it as internal decrypter variable
mov al,byte ptr [VHEURISTIC] ; get the heuristic option
mov byte ptr [HEURISTIC],al ; set the internal flag
mov al,byte ptr [CRCM] ; get the crc option
mov byte ptr [CRCERROR],al ; set the internal flag
; int 3
; mov esi,offset PEText
; mov ecx,(ToAdd_END - offset PEText)
; shr ecx,2
; xor eax,eax
;EncryptStuff:
; xor eax,[esi]
; not eax
; xor eax,ecx
; add esi,4
; dec ecx
; jnz EncryptStuff
;
xor eax,eax
push eax
push eax
push 3
push eax
push eax
push 80000000h+40000000h
push offset CryptFile
call CreateFileA ; Open file with read&write access
cmp eax,-1
jnz FileFound
FilenotFound:
WriteConsole2 <offset Error1>
jmp End_OF_Crypt_Routine
FileFound:
mov dword ptr [Fhandle],eax
push 4
push 1000h
cmp byte ptr [PEText+88h],"r" ; tag verification
jz TagNotChanged
push 200h
jmp TagChanged
TagNotChanged:
push 10000 ; nacher wieder aendern ;))
TagChanged:
push 0
call VirtualAlloc
mov dword ptr [LayerBuffer],eax
or eax,eax
jnz NoAllocError
AllocError1:
WriteConsole2 <offset a_error>
jmp End_OF_Crypt_Routine
NoAllocError:
push offset HighOrderF
push dword ptr [Fhandle]
call GetFileSize
add eax,100000
mov dword ptr [FileSize],eax ; save the filesize
mov dword ptr [FileSize2],eax ; save the filesize
push 4
push 1000h
push 100000
push 0
call VirtualAlloc
mov dword ptr [MemStart5],eax
or eax,eax
jz AllocError1
push 4
push 1000h
push dword ptr [FileSize]
push 0
call VirtualAlloc
mov dword ptr [MemStart4],eax
or eax,eax
jz AllocError1
pusha
push 4
push 1000h
push (ToAdd_END - offset CRC_Block1)
push 0
call VirtualAlloc
mov dword ptr [MemStart7],eax
or eax,eax
jz AllocError1
mov ecx,(ToAdd_END - offset CRC_Block1)
mov esi,offset CRC_Block1
mov edi,dword ptr [MemStart7]
rep movsb
popa
push 4
push 1000h
push 1000000
push 0
call VirtualAlloc
mov dword ptr [TextBuffer],eax
or eax,eax
jz AllocError1
push 4
push 1000h
push 1000000
push 0
call VirtualAlloc
mov dword ptr [IconBuffer],eax
or eax,eax
jz AllocError1
WriteConsole2 <offset MemAllocated>
mov edx,offset DosHeader
mov ecx,80
call ReadFromFile
WriteConsole2 <offset String1>
mov eax,[FileSize]
mov edx,dword ptr [DosHeader+3Ch]
cmp edx,eax
jl NoFileCorruptError
WriteConsole2 <offset Baukasten35>
Call Memory_DeAlloc
jmp End_OF_Crypt_Routine
NoFileCorruptError:
call SeekFile
mov al,byte ptr [ARTOFRELOC]
mov byte ptr [ARTOFRELOC1],al
mov al,byte ptr [RESOURCECOMP]
mov byte ptr [RCOMP],al
mov edx,offset PEHeader
mov ecx,4000
call ReadFromFile
cmp word ptr [PEHeader],"EP"
jz PeFile
No_PE_File:
mov byte ptr [NoWayassi],1
WriteConsole2 <offset NotPE>
Call Memory_DeAlloc
jmp End_OF_Crypt_Routine
PeFile:
xor edx,edx
call SeekFile
mov edx,offset DosHeader
movzx eax,word ptr [DosHeader+2]
movzx ecx,word ptr [DosHeader+4]
shl ecx,9
add ecx,eax
call ReadFromFile
mov edx,dword ptr [PEHeader+80] ; get the imagebase
add edx,10000
mov dword ptr [Phillipsuckt],edx
push 4
push 1000h
push dword ptr [Phillipsuckt]
push 0
call VirtualAlloc
add eax,10000
mov dword ptr [MemStart],eax
or eax,eax
jz AllocError1
; cmp byte ptr [BACKUPMODE],0 ; are we allowed to generate a backup?
; jz DontCreateBackup ; if no, then don't generate one
mov esi,offset CryptFile
mov edi,offset BackupFile
mov ecx,128
Generate_Backup_File:
lodsb
cmp al,"."
jz EndofFileName
stosb
dec ecx
jnz Generate_Backup_File
EndofFileName:
stosb
mov al,"s"
stosb
mov ax,"va"
stosw
xor al,al
stosb
push 4
push 1000h
push dword ptr [FileSize]
push 0
call VirtualAlloc
or eax,eax
jz AllocError1
mov dword ptr [RVA_NEW],eax ; another memory buffer
mov byte ptr [Dealloc],1
xor edx,edx ; seek to the start of the file
call SeekFile
mov edx,dword ptr [RVA_NEW] ; points to the reserved memory
mov ecx,dword ptr [FileSize] ; get the filesize
sub ecx,100000 ; subtract the fake crap
call ReadFromFile ; read the whole file into memory
push 0
push 80h
push 02
push 0
push 03
push 80000000h+40000000h
push offset BackupFile
call CreateFileA
cmp eax,-1
jnz BackupGenerated
WriteConsole2 <offset Baukasten34>
Call Memory_DeAlloc
jmp End_OF_Crypt_Routine
BackupGenerated:
mov dword ptr [Fhandle2],eax
mov edx,dword ptr [RVA_NEW] ; points to the reserved memory
mov ecx,dword ptr [FileSize] ; get the filesize
sub ecx,100000 ; subtract the fake crap
push 0
push offset Howmuch
push ecx
push edx
push eax
call WriteFile
push dword ptr [Fhandle2]
Push 2
push dword ptr [FileSize] ; push the filesize (amount of allocated mem)
Push DWord Ptr [RVA_NEW] ; push the linear offset
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
mov byte ptr [Dealloc],0
call CloseHandle
WriteConsole2 <offset String0>
DontCreateBackup:
pushad
mov esi,offset PEHeader+248 ; pointer to the first obj
movzx ecx,word ptr [PEHeader+6] ; get the number of objects
ParseAllVSizes:
cmp dword ptr [esi+8],0
jnz VirtualSizeOkay
mov edx,[esi+12]
mov eax,[esi+52]
sub eax,edx
jmp NewCalculated
VirtualSizeOkay:
mov eax,[esi+8]
jmp NotTheLastObject
NewCalculated:
mov [esi+8],eax
cmp ecx,1
jnz NotTheLastObject
mov eax,dword ptr [PEHeader+80]
sub eax,[esi+12]
mov [esi+8],eax
NotTheLastObject:
movzx edi,word ptr [OBJnumber]
shl edi,2
add edi,offset VSizeTable
stosd
add esi,40
inc word ptr [OBJnumber]
dec ecx
jnz ParseAllVSizes
popad
mov eax,40
movsx ecx,word ptr [PEHeader+6] ; objcounter * objsize = lastobj
mul ecx
add eax,208
mov dword ptr [LOBJ],eax ; precalculate for the virus check ;)
add eax,offset PEHeader ;+208
mov esi,eax
mov edi,offset LastOBJ
mov ecx,40
rep movsb
push offset HighOrderF
push dword ptr [Fhandle]
call GetFileSize
mov ebx,dword ptr [LastOBJ+16]
add ebx,dword ptr [LastOBJ+20]
cmp ebx,eax
ja NoFuckingOverlay
cmp ebx,eax
jz NoFuckingOverlay
sub eax,ebx
mov dword ptr [OverlaySize],eax ; save the overlay size
mov byte ptr [OverLay],1
push 4
push 1000h
push eax
push 0
call VirtualAlloc
mov dword ptr [MemStart8],eax
or eax,eax
jz AllocError1
mov edx,dword ptr [LastOBJ+16] ; get the physical size
add edx,dword ptr [LastOBJ+20] ; get the physical offset
call SeekFile
mov ecx,dword ptr [OverlaySize]
mov edx,dword ptr [MemStart8]
call ReadFromFile
NoFuckingOverlay:
mov ecx,dword ptr [PEHeader+84] ; get the size of the headers
; sub ecx,dword ptr [DosHeader+3Ch] ; subtract the dos header
mov edi,ecx ; points now to the end of the header file
mov ebx,4000
cmp edi,ebx
ja NotNeeded
sub ebx,edi
add edi,offset PEHeader ; points to the peheader in memory
mov ecx,ebx
xor al,al
rep stosb
NotNeeded:
movzx eax,byte ptr [PEHeader+6] ; amount of object in this file
mov ecx,40 ; 40 bytes = size of every object in the header
mul ecx
add eax,208 ; add the start of the first obj
add eax,80 ; add the size of 2 objects needed for pecrypt32
mov ebx,dword ptr [PEHeader+84] ; get the peheader size
mov dword ptr [OldHSize],ebx ; save the old size of the PE Header & Dos header
sub ebx,dword ptr [DosHeader+3Ch] ; subtract the dos header size to get the PE header size
cmp ebx,eax ; compare them both
jae SpaceInTheHeader ; is there any space in the header?
AlignHeaderAgain:
mov ebx,dword ptr [PEHeader+84] ; get the peheader size
add ebx,dword ptr [PEHeader+60] ; add the file alignment value
mov dword ptr [PEHeader+84],ebx ; write the new header value
sub ebx,dword ptr [DosHeader+3Ch] ; subtract the PE header start
cmp ebx,eax ; still not enough space?
jl AlignHeaderAgain ; if yes then align again till there is enough room
mov byte ptr [NewAlign],1
SpaceInTheHeader:
mov al,byte ptr [RELOCCOMP] ; get the relocation compression value
mov byte ptr [RELOCCOMPP],al ; set the internal crypter flag
cmp dword ptr [PEHeader+128],0 ; check if there are any imports
jz NoImportsForSure ; if not, don't execute this funny routine
mov dword ptr [EsiBuffer],esi
Push 2
push dword ptr [FileSize] ; push the filesize (amount of allocated mem)
Push DWord Ptr [MemStart4] ; push the linear offset
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
push 4
push 1000h ; alignment 4096 bytes
push dword ptr [PEHeader + 80] ; allocate memory for the file
push 0
call VirtualAlloc ; allocate it
or eax,eax ; any error?
jz AllocError1 ; if yes, go to the error handler
mov dword ptr [MemStart4],eax ; new memstart4 linear offset
mov esi,offset PEHeader+248 ; points to the first PE object
movzx ecx,word ptr [PEHeader+6] ; get the amount of objects in this file
Load_PE_Object:
pusha
pusha
mov eax,dword ptr [PEHeader+128] ; get the import section rva
mov edx,[esi+12] ; get the RVA
cmp eax,edx ; compare import rva with current section rva
jl NoImportSection ; import rva smaller than the current section rva? if they then skip
add edx,[esi+16] ; add the physical size
cmp eax,edx ; compare them again
jae NoImportSection ; jump if bigger (no import section in this object)
mov dword ptr [ImpCounti],ecx ; save the current import section
NoImportSection:
popa
mov edx,[esi + 20] ; get the physical offset
or edx,edx ; physical offset == 0?
jz DontRead ; if yes, then don't read
call SeekFile ; seek to the physical offset
mov edx,[esi+12] ; get the RVA
add edx,dword ptr [MemStart4] ; add the Memory Start
mov ecx,[esi+16] ; add the physical size
or ecx,ecx ; physical size == 0?
jz DontRead ; if yes then don't read
call ReadFromFile ; read from file
DontRead:
popa
add esi,40 ; go to the next object
dec ecx
jnz Load_PE_Object
push dword ptr [Fhandle]
call CloseHandle
push 0
push 80h
push 02
push 0
push 03
push 80000000h+40000000h
push offset CryptFile
call CreateFileA
mov dword ptr [Fhandle],eax
mov eax,dword ptr [TextBuffer]
mov dword ptr [BufferPos],eax ; save the position of the textbuffer
mov esi,dword ptr [MemStart4]
add esi,dword ptr [PEHeader+128] ; add the import rva
NextMainImport_2:
mov dword ptr [SAVEDLLRVA],190331
push esi
cmp dword ptr [esi+16],0 ; check for end of the imports
jz FinishedWithImports_2 ; if end, jump
cmp dword ptr [esi],0 ; check for the 2nd import crap
jnz FirstImportStandart_2 ; if not then jump
mov edx,dword ptr [esi+12] ; get the pointer to the dll name
add edx,dword ptr [MemStart4] ; add the start of the import section
mov esi,dword ptr [esi+16] ; get the thunk table offset
add esi,dword ptr [MemStart4] ; add the start of the import section
mov edi,esi ; edi = esi = thunktable
jmp SecondImportStandart_2
FirstImportStandart_2:
mov edi,dword ptr [esi+16]
add edi,dword ptr [MemStart4] ; add the memory start
mov edx,dword ptr [esi+12]
add edx,dword ptr [MemStart4] ; add the memorystart
mov esi,dword ptr [esi]
mov dword ptr [SAVEDLLRVA],esi ; save the dll rva
add esi,dword ptr [MemStart4] ; add the fucking kewl memory start
SecondImportStandart_2:
ParseNextImport_2:
lodsd
or eax,eax
jz MainImportFinished_2
pusha
mov edi,esi
mov ecx,(offset MutateHookedApi - offset ContinueRelocationCompression) / 4
mov esi,offset ContinueRelocationCompression
mov edx,dword ptr [Impenc]
Generate_Lame_Checksum:
lodsd
xor eax,ecx
add edx,eax
not edx
rol edx,cl
dec ecx
jnz Generate_Lame_Checksum
mov dword ptr [Impenc],edx
xor dword ptr [edi-4],edx
popa
test eax,80000000h
jz Pointer2NameDir_2
push esi
push edx
push ecx
and eax,0FFFFh ; only 16bit are needed
mov esi,offset OrdinalNumba+4
call Hex2DecimalString ; converts the ordinal numbaa
mov ecx,2
mov eax,offset OrdinalNumba
Besuch:
cmp byte ptr [eax],20h
jnz Besuch2
inc eax
dec ecx
jnz Besuch
Besuch2:
pop ecx
pop edx
pop esi
jmp OrdinalImport_2
Pointer2NameDir_2:
add eax,dword ptr [MemStart4] ; add the memory start
inc eax
inc eax
OrdinalImport_2:
pusha
push eax
mov esi,edx
mov edi,dword ptr [BufferPos] ; get the buffer offset
CopyText2:
lodsb
or al,al
jz DllnameEnd
stosb
dec ecx
jnz CopyText2
DllnameEnd:
mov al,":" ; looks like DLLNAME:FUNCTIONNAME ;)
stosb
pop eax
mov ecx,20
mov esi,eax
CopyText:
lodsb
or al,al
jz FunctionNameEnd ; every rocking function is null terminated
stosb
dec ecx
jnz CopyText
FunctionNameEnd:
pusha
mov eax,edi
sub eax,dword ptr [BufferPos]
mov ecx,56
sub ecx,eax
mov al,20h
rep stosb
xor al,al
stosb
stosb
mov dword ptr [BufferPos],edi ; save the new position
popa
popa
jmp ParseNextImport_2
MainImportFinished_2:
pop esi
push eax
push esi
push edi
mov edi,edx ; pointer to the dll name
mov esi,edx ; another pointer to the dll name
mov ecx,40
EncryptDllName:
lodsb
or al,al
jz DllNameFinished
push esi
push ecx
push edi
push eax
mov ecx,(offset MutateHookedApi - offset ContinueRelocationCompression) / 4
mov esi,offset ContinueRelocationCompression
mov edx,dword ptr [Impenc3]
Generate_Lame_Checksum_1:
lodsd
xor eax,ecx
add edx,eax
not edx
rol edx,cl
dec ecx
jnz Generate_Lame_Checksum_1
mov dword ptr [Impenc3],edx
pop eax
pop edi
pop ecx
pop esi
xor al,dl
stosb
dec ecx
jnz EncryptDllName
DllNameFinished:
pop edi
pop esi
pop eax
add esi,20
CompareAgain:
mov eax,dword ptr [SAVEDLLRVA] ; get the last pointer to the named table
cmp eax,[esi] ; compare it with the current one
jnz NextMainImport_2_2_2 ; difference? then everything is okay
add esi,20 ; add 20 bytes to get to the next entry
Jmp CompareAgain ; compare again
NextMainImport_2_2_2:
pusha
mov eax,40
sub eax,ecx
mov edi,offset DLLNAMESL
movzx ebx,byte ptr [NAMECOUNTI]
add edi,ebx
stosb
popa
inc byte ptr [NAMECOUNTI]
jmp NextMainImport_2
FinishedWithImports_2:
mov byte ptr [NAMECOUNTI],0
pop esi
mov edx,dword ptr [MemStart4] ; get the PE file base address (imagebase)
add edx,dword ptr [PEHeader+40] ; add the rva
cmp dword ptr [edx+0Bh],"!DNR" ; check for the pecrypt32 signature
jnz NotPecrypted
cmp byte ptr [IMPORTD],1
jnz DisableAPIHooking
push 30h
push offset Baukasten36
push offset Baukasten38
push 0
call MessageBoxA
mov byte ptr [IMP_DESTROY],0
mov byte ptr [I_MERGING],0
mov byte ptr [IMPORTD],0
cmp byte ptr [HOOKFUNC],0 ; is the api hooking enabled?
jz NotPecrypted ; if yes check for pecrypt32 'protected' filez
jmp NotPecrypted
DisableAPIHooking:
cmp byte ptr [HOOKFUNC],0 ; is the api hooking enabled?
jz NotPecrypted ; if yes check for pecrypt32 'protected' filez
push 30h
push offset Baukasten36
push offset Baukasten362
push 0
call MessageBoxA
mov byte ptr [HOOKFUNC],0 ; disable the api hooking
mov byte ptr [LOADEROPT],0 ; disable that crap, LALALA
NotPecrypted:
xor edx,edx
call SeekFile
mov edx,offset DosHeader
movzx eax,word ptr [DosHeader+2]
movzx ecx,word ptr [DosHeader+4]
shl ecx,9
add ecx,eax
call WritetoFile
cmp byte ptr [NewAlign],1 ; do we need to align the complete file?
jnz NoNewAlign_Needed ; NAH? k, the pass that crap :)
mov edx,dword ptr [DosHeader+3Ch] ; seek to the peheader start
call SeekFile ; the PEFile (header start)
mov edx,offset PEHeader ; point to the header buffer
mov ecx,dword ptr [PEHeader+84] ; get the whole header size (dos&peheader together)
sub ecx,dword ptr [DosHeader+3Ch] ; subtract the pe header start
call WritetoFile ; write the header
mov ebx,dword ptr [PEHeader+84] ; get the new header size
sub ebx,dword ptr [OldHSize] ; subtract the old one to get the difference for alignment
mov dword ptr [OldHSize],ebx ; save the difference
NoNewAlign_Needed:
mov esi,offset PEHeader+248 ; points to the first PE object
movzx ecx,word ptr [PEHeader+6] ; get the amount of objects in this file
Resave_PE_FILE:
pusha
mov edx,[esi+12] ; get the section rva
cmp byte ptr [I_MERGING],0
jz NoImport_Merging
cmp dword ptr [esi+16],0
jnz ImportMergingPossible
mov byte ptr [I_MERGING],0
push 30h
push offset Baukasten36
push offset Baukasten372
push 0
call MessageBoxA
jmp NoImport_Merging
ImportMergingPossible:
cmp edx,dword ptr [PEHeader+128] ; compare it with the import rva
jnz NoImport_Merging ; different? then no import merging
pusha
push ecx
mov edx,[esi-40 + 20] ; get the physical offset of the last section
call SeekFile ; seek to the physical offset
pop ecx
pusha
mov eax,[esi+12]
mov edx,[esi-40+8]
add edx,[esi-40+12]
mov dword ptr [BUFFIRVA],edx
sub eax,edx
mov dword ptr [BUFFISIZE],eax
popa
mov eax,[esi+8] ; get the virtual size of the current object
add eax,[esi+12] ; add the rva
sub eax,[esi-40+12] ; subtract the rva of the last section
mov ecx,dword ptr [PEHeader+56] ; use the section aligment for the rva
xor edx,edx ; calculation
div ecx
or edx,edx
jz NoPhysicalSize_Rest_Value
inc eax
NoPhysicalSize_Rest_Value:
mul ecx
mov [esi-40+16],eax ; write the new physical size :]
mov [esi-40+8],eax ; write the new physical size :]
mov edx,[esi - 40 +12] ; get the RVA
add edx,dword ptr [MemStart4] ; add the Memory Start
mov ecx,eax ; get the virtual size (= physical size)
call WritetoFile ; write the whole object!
mov edi,[esi+40 + 20]
mov edx,[esi-40 + 20] ; get the physical offset of the last section
add edx,[esi-40 + 16] ; add the physical size
sub edx,edi
mov dword ptr [SaveTmp],edx ; save the reminder
mov word ptr [OBJnumber],0
mov esi,offset PEHeader+248 ; pointer to the first obj
movzx ecx,word ptr [PEHeader+6] ; get the number of objects
dec ecx
ParseAll_VSizes:
cmp dword ptr [esi+8],0
jnz Virtual_SizeOkay
mov edx,[esi+12]
mov eax,[esi+52]
sub eax,edx
jmp New_Calculated
Virtual_SizeOkay:
mov eax,[esi+8]
jmp Not_TheLastObject
New_Calculated:
mov [esi+8],eax
cmp ecx,1
jnz Not_TheLastObject
mov eax,dword ptr [PEHeader+80]
sub eax,[esi+12]
mov [esi+8],eax
Not_TheLastObject:
movzx edi,word ptr [OBJnumber]
shl edi,2
add edi,offset VSizeTable
stosd
add esi,40
inc word ptr [OBJnumber]
dec ecx
jnz ParseAll_VSizes
mov esi,offset PEHeader+248 ; points to the first PE object
movzx ecx,word ptr [PEHeader+6] ; get the amount of objects in this file
mov edi,esi
ParsePEheader:
mov edx,[esi+12] ; get the section rva
cmp edx,dword ptr [PEHeader+128] ; compare it with the import rva
jnz Dont_Erase_Object ; don't erase that one if thats not the import object
add esi,40
dec word ptr [PEHeader+6]
jmp DontCopyThisTime
Dont_Erase_Object:
push ecx
mov ecx,40
rep movsb
pop ecx
DontCopyThisTime:
dec ecx
jnz ParsePEheader
mov ecx,40
xor al,al
rep stosb
popa
popa
jmp Merging_finished
NoImport_Merging:
mov edx,[esi + 20] ; get the physical offset
or edx,edx ; physical offset == 0?
jz DontRead_2 ; if yes, then don't write
cmp byte ptr [NewAlign],1
jnz DontAlignThatStuff
add edx,dword ptr [OldHSize] ; add the difference
mov [esi + 20],edx ; resave the physical offset
DontAlignThatStuff:
mov edx,[esi+20] ; get it
add edx,dword ptr [SaveTmp] ; add the reminder
mov [esi+20],edx ; resave it
call SeekFile ; seek to the physical offset
mov edx,[esi+12] ; get the RVA
add edx,dword ptr [MemStart4] ; add the Memory Start
mov ecx,[esi+16] ; add the physical size
or ecx,ecx ; physical size == 0?
jz DontRead_2 ; if yes then don't write
call WritetoFile ; write the whole object!
DontRead_2:
popa
add esi,40 ; go to the next object
Merging_finished:
dec ecx
jnz Resave_PE_FILE
mov edx,dword ptr [DosHeader+3Ch] ; seek to the peheader start
call SeekFile ; the PEFile (header start)
mov edx,offset PEHeader ; point to the header buffer
mov ecx,dword ptr [PEHeader+84] ; get the whole header size (dos&peheader together)
sub ecx,dword ptr [DosHeader+3Ch] ; subtract the dos header size to get the PE header sizeeee
call WritetoFile ; write the header
NoNewAlign_Needed_2:
Push 2
push dword ptr [PEHeader+80] ; push the filesize (amount of allocated mem)
Push DWord Ptr [MemStart4] ; push the linear offset
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
push 4
push 1000h
push dword ptr [FileSize2]
push 0
call VirtualAlloc
mov dword ptr [MemStart4],eax
or eax,eax
jz AllocError1
mov esi,dword ptr [EsiBuffer] ; restore esi
NoImportsForSure:
movzx esi,word ptr [PEHeader+20]
add esi,offset PEHeader+18h
mov edi,offset CODEOBJ
mov ecx,40
rep movsb
mov ax,word ptr [PEHeader+16h] ; get the file characteristics
test ax,2000h
jz NoDllFile
mov byte ptr [EXEFLAGS],1 ; mark this file as a DLL!
NoDllFile:
mov eax,dword ptr [PEHeader+40] ; get the rva
mov dword ptr [RIGHTONE],eax ; save it
mov eax,dword ptr [CODEOBJ+12] ; get the code rva
mov dword ptr [CODEBASE],eax ; save it
mov eax,dword ptr [CODEOBJ+16] ; get the physical size
mov dword ptr [CODESIZE],eax ; save it for later use in the loader
mov eax,40
movsx ecx,word ptr [PEHeader+6] ; objcounter * objsize = lastobj
mul ecx
add eax,208
mov dword ptr [LOBJ],eax ; precalculate for the virus check ;)
add eax,offset PEHeader ;+208
mov esi,eax
mov eax,[esi+8] ; get the virtual size of the last obj
mov dword ptr [LSIZE],eax ; save it for the heuristic virus check
mov dword ptr [NewOBJPos],esi ; save the position of the last obj
add dword ptr [NewOBJPos],40 ; pointer to the new obj
push esi
mov edi,offset DData
mov ecx,6
rep cmpsb
pop esi
jnz NotDInfo
sub [NewOBJPos],40
mov byte ptr [CUTDINFO],1
sub esi,40
dec word ptr [PEHeader+6]
NotDInfo:
push esi
mov edi,offset LastOBJ
mov ecx,40
rep movsb
pop esi
fickenlan:
mov byte ptr [AddNew],1
mov byte ptr [RESEND],1
push eax
mov eax,dword ptr [esi+12]
mov dword ptr [OFSVALUE],eax
mov eax,dword ptr [esi+8]
mov dword ptr [OFSVSIZE],eax
pop eax
mov eax,dword ptr [LastOBJ+12]
add eax,dword ptr [LastOBJ+16]
mov ecx,dword ptr [PEHeader+40]
mov dword ptr [RVA],eax
mov dword ptr [PEHeader+40],eax
mov eax,dword ptr [LastOBJ+16]
add eax,dword ptr [LastOBJ+20]
mov dword ptr [PhysicalO],eax
mov esi,offset PEHeader+248
mov edi,offset OBJTABLE
mov dword ptr [TempVar],edi
mov word ptr [OBJnumber],0
Parseobj:
mov dword ptr [NewPhysS],0 ; set to zero
cmp byte ptr [KILLH],0 ; killheader option enabled?
jz NoNeedtoKillTheHeader
pusha
mov edi,esi
mov esi,offset NewOBJ
mov ecx,8
rep movsb
popa
NoNeedtoKillTheHeader:
mov eax,[esi+12] ; get the current rva
mov dword ptr [CurrentRVA],eax
mov eax,[esi+8] ; get the current virtualsize
mov dword ptr [CurrentVSIZE],eax
mov eax,[esi+36] ; get the flags of this object
mov dword ptr [CurrentFLAGS],eax
mov eax,[esi+16] ; save old physicalsize
mov dword ptr [CurrentPhysS],eax
call DisplayCounter ; displays the obj number and some other crap
mov eax,[esi+36] ; get the objflags
or eax,80000000h
mov [esi+36],eax
Cryptyes:
mov edx,dword ptr [esi+20]
mov dword ptr [SavePosition],edx
sub edx,dword ptr [Csize]
mov dword ptr [esi+20],edx
mov dword ptr [LastOBJPos],esi
push eax
push eax
mov eax,dword ptr [PEHeader+136] ; check if this obj is the resource obj
cmp eax,dword ptr [esi+12]
pop eax
jz EncryptResources ; if yes encrypt resources
mov eax,dword ptr [PEHeader+160] ; get relocation rva
mov ebx,dword ptr [esi+12] ; get the section rva
cmp eax,ebx
jl NoRelocationsFor_Sure
add ebx,[esi+8] ; get the section vsize
cmp eax,ebx
jl CheckForRelocations
NoRelocationsFor_Sure:
movzx eax,word ptr [OBJnumber] ; get the current obj number
add eax,offset SectionStates ; add the lame section state buffer
cmp byte ptr [eax],0
jz MoveObject
cmp byte ptr [eax],0
jnz Compressit
MoveObject:
cmp dword ptr [esi+20],0 ; is the physical offset = 0
jz ObjectGotIgnored
cmp dword ptr [esi+16],0 ; is the physical size = 0
jz ObjectGotIgnored
push esi
mov edx,dword ptr [SavePosition]
call SeekFile
mov edx,dword ptr [MemStart]
mov ecx,dword ptr [esi+16]
call ReadFromFile
mov edx,dword ptr [esi+20]
call SeekFile
mov ecx,dword ptr [esi+16]
mov edx,dword ptr [MemStart] ; write the encrypted obj into the file
call WritetoFile
pop esi
ObjectGotIgnored:
WriteConsole2 <offset Baukasten27>
mov byte ptr [ResourceInde],1 ; don't display the lame object statistics
jmp Dontcrypt
Compressit:
mov edi,dword ptr [TempVar]
mov eax,dword ptr [esi+12] ; get the objoffset (rva)
mov dword ptr [TempVar2],eax ; save the rva
stosd ; store it in a table
mov eax,dword ptr [esi+16] ; get the objlength
stosd ; store it in the objtable of pecrypt32
call Randomize ; great random function,yeahh
stosd ; save the random encryption value in the table
mov dword ptr [CRYPTVAR1],eax ; save it for encrypting
movzx ecx,word ptr [OBJnumber]
shl ecx,2
mov eax,[ecx+offset VSizeTable]
stosd ; save the virtual size in the objecttable
xor eax,eax
stosb ; save it
stosd ; zero the crc value
stosd ; zero the not aligned realsize of this obj
mov eax,[esi+16] ; get the original physical size
stosd ; save it
mov eax,[esi+36] ; get the flags of this section
stosd ; save them
mov dword ptr [TempVar],edi
mov byte ptr [LazyNess],1
mov edx,dword ptr [SavePosition]
call SeekFile ; seek to the pos
mov edi,dword ptr [MemStart]
mov ecx,dword ptr [esi+16]
shr ecx,2
xor eax,eax
rep stosd
mov ecx,dword ptr [esi+16] ; get the obj length for reading
mov edx,dword ptr [MemStart] ; start of the allocated memory
mov dword ptr [RealSize],ecx ; save the realsize
push ecx
call ReadFromFile ; read the obj into the allocated mem
pop ecx
CompressRelocs:
push ecx
push esi
push edi
mov esi,dword ptr [MemStart]
mov dword ptr [MemStart2],esi
mov edi,esi
CompressionON:
movzx eax,word ptr [OBJnumber] ; get the current obj number
add eax,offset SectionStates ; add the lame section state buffer
cmp byte ptr [eax],1 ; encryption for this section?
jz EncryptByte ; if yes, start with encryption
mov dword ptr [CompressBytes],ecx
mov dword ptr [OrigSize],ecx
mov dword ptr [InfoSize],ecx
CompressThem:
pusha
push 4
push 1000h
push 1024*1024
push 0
call VirtualAlloc
mov dword ptr [WorkMemory],eax
or eax,eax
jz AllocError1
popa
push ebx
push esi
push edi
mov dword ptr [SaveEESP],esp
mov eax,dword ptr [MemStart] ; points to the source data
mov edx,dword ptr [MemStart4] ; points to the destination data
mov ebx,ecx ; size of this data (physical size)
cmp byte ptr [RCompress],1 ; check for running resource compression
jz NoLameTextNeeded ; don't display the 'processing' text if resource packing
; is running
cmp byte ptr [RelocCCC],1 ; check for relocation compression
jz NoCallBackNeeded ; if running then skip this crap
WriteConsole2 <offset Spaces>
NoLameTextNeeded:
push offset PackingInfo
push dword ptr [WorkMemory] ; push the workmem
push ebx ; push the size
push edx ; push destination
push eax ; push source data
jmp callbackjuhuuu
NoCallBackNeeded:
push 0 ; no callback needed
push dword ptr [WorkMemory] ; push the workmem
push ebx ; push the size
push edx ; push destination
push eax ; push source data
callbackjuhuuu:
call _aP_pack
add esp, 5*4
mov esp,dword ptr [SaveEESP]
mov ecx,eax
pop edi
pop esi
pop ebx
mov dword ptr [CCounter],ecx
mov edi,dword ptr [MemStart]
mov esi,dword ptr [MemStart4]
rep movsb
push 2
push 1024*1024
push dword ptr [WorkMemory]
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
cmp byte ptr [RelocCCC],1 ; check for running relocation compression
jz RelocCRunning ; jump if running
cmp byte ptr [RCompress],1 ; check for resource packing
jz RelocCRunning ; skip display routine if running
WriteConsole2 <offset ReturnChars> ; display return chars
RelocCRunning:
cmp byte ptr [RCompress],1 ; check for running resource compression
jnz ResourceCRunning ; jump if running
WriteConsole2 <offset Baukasten17>
ResourceCRunning:
cmp byte ptr [RelocCCC],1
mov byte ptr [RelocCCC],0 ; disable the relocation compression flag
jz ContinueRelocationPacking ; continue the relocation packing
mov eax,dword ptr [MemStart2] ; get the memory start
mov dword ptr [MemStart],eax ; restore it
jmp weida
PackingInfo:
pusha
mov ebx,100
imul ebx
mov ebx,dword ptr [InfoSize]
xor edx,edx
div ebx
pusha
call SendMessageA, [hPrgrs], WM_USER+2, eax, 0 ;PBM_SETPOS
call UpdateWindow, [hMain]
blabla:
popa
popa
db 0C3h
weida:
pop edi
pop esi
pop ecx
mov edx,dword ptr [esi+20] ; seek to the obj start
NotCResources:
call SeekFile
mov eax,dword ptr [CCounter]
add eax,dword ptr [DirSize]
mov dword ptr [RealSize],eax ; save the new physical size
mov ecx,dword ptr [PEHeader+60] ; get the value we need for alignment
xor edx,edx
div ecx
or edx,edx
jz No__RestiValue
inc eax
No__RestiValue:
mul ecx
push dword ptr [esi+16]
mov dword ptr [esi+16],eax
mov dword ptr [OBJVSIZE],eax
mov ecx,dword ptr [OrigSize]
mov dword ptr [NewPhysS],eax ; save new physicalsize
cmp eax,ecx
jae NoCompress
mov edx,ecx
sub edx,eax
cmp edx,1024
jl NoCompress
mov dword ptr [RESOURCESIZ],eax
push eax
mov eax,[esi+8]
mov dword ptr [RESOURCEVSIZ],eax
pop eax
cmp byte ptr [RCompress],1
jz PassThisCrap
mov edi,dword ptr [TempVar]
mov byte ptr [edi-17],1
sub edi,29
stosd
PassThisCrap:
push eax
sub ecx,eax
add dword ptr [Csize],ecx
mov dword ptr [CCounter],0
mov dword ptr [CompressCounter],0
mov dword ptr [CompressBytes],0
mov dword ptr [HowMany],0
pop ecx
pop edx
jmp Compressed
NoCompress:
mov dword ptr [DirSize],0
pop dword ptr [esi+16]
mov edx,dword ptr [MemStart2]
mov dword ptr [MemStart],edx
mov dword ptr [CCounter],0
mov dword ptr [CompressCounter],0
mov dword ptr [CompressBytes],0
mov dword ptr [HowMany],0
mov edx,dword ptr [SavePosition]
call SeekFile ; seek to the pos
mov ecx,dword ptr [esi+16] ; get the obj length for reading
mov edx,dword ptr [MemStart] ; start of the allocated memory
push ecx
call ReadFromFile ; read the obj into the allocated mem
pop ecx
push ecx
push esi
push edi
mov esi,dword ptr [MemStart]
mov edi,esi
cmp byte ptr [RCompress],1 ; is the current section a resource section?
jz EncryptResources ; if yes, then use the special method :)
jmp EncryptByte
Compressed:
mov edx,dword ptr [MemStart2]
mov dword ptr [MemStart],edx
mov byte ptr [RCompress],0
mov dword ptr [DirSize],0
NoCompressedResources:
call WritetoFile
jmp lalala
EncryptByte:
shr ecx,1 ; divide size by 2 (word encryption)
@NoTlsEntry:
lodsw
xor ax,cx
not ax
xor eax,dword ptr [CRYPTVAR1]
ror ax,cl
inc dword ptr [CRYPTVAR1]
stosw
inc dword ptr [TempVar2]
dec ecx
jnz @NoTlsEntry
ImportFound:
pop edi
pop esi
pop ecx
push ecx
mov edx,dword ptr [esi+20] ; seek to the obj start
call SeekFile
pop ecx
mov edx,dword ptr [MemStart] ; write the encrypted obj into the file
call WritetoFile
jmp lalala
Dontcrypt:
lalala:
inc word ptr [OBJnumber]
add esi,40
mov ax,word ptr [PEHeader+6]
cmp byte ptr [ResourceInde],1
jz NoStatistic
call DisplayStatistic ; display statistic
NoStatistic:
mov byte ptr [ResourceInde],0
cmp byte ptr [LazyNess],0
jz DontEncryptOBJTable
pushad
mov esi,dword ptr [MemStart]
mov edi,dword ptr [TempVar]
mov ecx,dword ptr [RealSize] ; get the real size of this object
mov [edi-12],ecx
shr ecx,2
xor edx,edx
xor ebx,ebx
CalculateOBJ_CRC:
lodsd
xor edx,eax
rol edx,cl
shl edx,cl
add edx,ebx
mov ebx,eax
dec ecx
jnz CalculateOBJ_CRC
mov edi,dword ptr [TempVar]
mov [edi-16],eax ; save the crc value in the objecttable
popad
pushad
mov esi,dword ptr [TempVar]
sub esi,33 ; pointer to the first entry
mov ecx,33 ; size of all entries = 21 bytes
xor eax,eax
mov edx,dword ptr [ENCRYPTV1]
CalculateOBJCRC:
lodsb ; get a byte
xor eax,ecx ; and calculate a simple checksum
rol eax,cl ; which will be later used
add eax,edx ; to encrypt the next objecttable :)
xor edx,eax
xor edx,dword ptr [ENCRYPTV1]
inc edx ; cause i don't want that some lAmErZ
dec ecx ; change it, tralalaaaa
jnz CalculateOBJCRC
push esi
mov esi,offset ToAdd ; pointer to the loaderstart
mov ecx,offset CodeCRC_End - offset ToAdd
mov edx,dword ptr [ENCRYPTV2]
CaculateCODECRC:
mov dl,[esi]
add eax,edx
rol eax,cl
xor eax,ecx
xor eax,dword ptr [ENCRYPTV1]
inc esi
dec ecx
jnz CaculateCODECRC
pop esi
mov edx,eax
mov esi,offset PEText
mov ecx,(offset ToAdd_END - offset PEText)
ChecksumText:
lodsb
add edx,eax
rol edx,cl
xor edx,ecx
dec ecx
jnz ChecksumText
mov eax,edx
pushad
mov esi,dword ptr [TempVar]
sub esi,33 ; pointer to the last object
mov edx,dword ptr [PreviousCRC] ; get the previous crc
mov edi,esi
mov ecx,33 ; size = 21 bytes
EncryptOBJTable:
lodsb
xor eax,edx
inc edx
stosb
dec ecx
jnz EncryptOBJTable
popad
mov dword ptr [PreviousCRC],eax
popad
DontEncryptOBJTable:
mov byte ptr [LazyNess],0
cmp word ptr [OBJnumber],ax
jae allobjsdone
jmp Parseobj
CheckForRelocations:
mov eax,[esi+36]
and eax,0EFFFFFFFh
mov [esi+36],eax
pushad
mov esi,offset ResDecryptionFinished
mov ecx,(offset NoTracerRunning - offset ResDecryptionFinished)
call Randomize
mov dword ptr [ENCRYPTV3],eax
mov edx,eax
push edx
call Randomize
mov dword ptr [ENCRYPTV4],eax
pop edx
mov edi,eax
xor eax,eax
shr ecx,2
Calculate_RCRC:
lodsd
add edx,eax
xor edx,ecx
xor edi,eax
rol edi,cl
dec ecx
jnz Calculate_RCRC
xor edx,edi
mov dword ptr [ENCRYPTV5],edx
popad
mov eax,[esi+16] ;get the virtual size of the relocations
mov dword ptr [RELOCVSIZE],eax ;save them
mov eax,dword ptr [esi+12] ; get the relocation base :)
mov dword ptr [RELOCBASE],eax ; save it
mov edx,dword ptr [SavePosition]
call SeekFile ; seek to the pos of the .reloc obj
pushad
cmp byte ptr [INFOMODE],0
jnz DontDisplaythiscrap
WriteConsole2 <offset ReturnChars>
DontDisplaythiscrap:
WriteConsole2 <offset Baukasten18>
WriteConsole2 <offset Baukasten19>
popad
push esi
mov ecx,dword ptr [PEHeader+164] ; get the .reloc length for reading
mov dword ptr [RelocLength],ecx ; save the lengh of the reloc obj
mov dword ptr [RELOCLENG],ecx ; save it lalalalaa
push ecx
mov ecx,dword ptr [esi+16]
mov edx,dword ptr [MemStart] ; start of the allocated memory
call ReadFromFile ; read the whole .reloc obj
pop ecx
mov edi,dword ptr [MemStart] ; get the allocated memory
add edi,dword ptr [PEHeader+160] ; add the relocation rva
sub edi,[esi+12] ; subtract the section rva
cmp dword ptr [edi],0 ; already protected with pecrypt32
jnz @Only12bitencryption ; don't encrypt again
mov byte ptr [LOADRELOC],0
jmp Finishedrelocs
@Only12bitencryption:
cmp byte ptr [RELOCCOMP],1 ; check for relocation compression
jz CompressRelocations ; if enabled, jump
call Randomize ; great random function,yeahh
cmp byte ptr [ARTOFRELOC1],1 ; check the type of relocation encryption
jz Startwithrelocations
pushad
WriteConsole2 <offset Baukasten21>
popad
and ax,0FFFh ; only 12bit cryptvalues are allowed!
jmp GrosseTitten
Startwithrelocations:
WriteConsole2 <offset Baukasten20>
GrosseTitten:
mov word ptr [CryptValue1],ax ; save it
mov word ptr [CRYPTVALUE2],ax
xor ebx,ebx
mov esi,dword ptr [MemStart] ; esi=offset of the allocated memory
mov eax,[esi]
mov dword ptr [SAVEFIRSTRB],eax
mov dword ptr [esi],0
Continuewithreloc:
mov ecx,dword ptr [esi+4]
sub ecx,8
shr ecx,1 ; divide the length by 2
add ebx,8 ; (cause every reloc is a word)
add esi,8 ; increase the pointer
; points now to the first relocation in this
; block.
mov edi,esi
EncryptReloc:
add ebx,2
lodsw ; get the relocation
cmp byte ptr [ARTOFRELOC1],1 ; 16 bit relocation encryption?
jz Reloc16bit ; yeah? then jump
and ax,0FFFh ; cut off the fucking relocation type
jmp DontEncryptfr
Reloc16bit:
not ax
rol ax,cl
xor ax,cx
DontEncryptfr:
xor ax,word ptr [CryptValue1]
xor ax,word ptr [ENCRYPTV5]
stosw ; push it again
loop EncryptReloc
cmp ebx,dword ptr [RelocLength] ;finished with the reloc obj?
jnz Continuewithreloc ; not? then do the next reloc block
Finishedrelocs: ; finished with relocations
pop esi
mov edx,dword ptr [esi+20] ; seek to the obj start
call SeekFile
mov ecx,dword ptr [esi+16]
mov edx,dword ptr [MemStart] ; write the encrypted obj into the file
call WritetoFile
pushad
WriteConsole2 <offset Baukasten22>
popad
mov byte ptr [ResourceInde],1
jmp Dontcrypt
CompressRelocations:
pushad
WriteConsole2 <offset Baukasten25>
popad
mov esi,dword ptr [MemStart] ; esi=offset of the allocated memory
include r-relocc.inc ; call the relocation compression
mov byte ptr [ResourceInde],1
pushad
WriteConsole2 <offset Baukasten22>
popad
jmp Dontcrypt
Dontcrypt2:
push esi
mov edx,dword ptr [SavePosition]
call SeekFile
mov edx,dword ptr [MemStart]
mov ecx,dword ptr [esi+16]
call ReadFromFile
mov edx,dword ptr [esi+20]
call SeekFile
mov ecx,dword ptr [esi+16]
mov edx,dword ptr [MemStart] ; write the encrypted obj into the file
call WritetoFile
pop esi
jmp Dontcrypt
EncryptResources:
cmp byte ptr [RCOMP],2 ; is the resource processing switched off?
jz Dontcrypt2 ; if yes then don't encrypt / pack
cmp dword ptr [PEHeader+136],0
jz Dontcrypt
mov byte ptr [ResourceInde],1
mov esi,dword ptr [LastOBJPos]
push esi
cmp byte ptr [RCompress],0 ; was there any previous compression try?
jz NoPreviousCompression ; if no, don't jump
mov byte ptr [RESOURCECOMP],0 ; no resource compression anymore
mov byte ptr [RCOMP],0
mov byte ptr [AddNew],0
mov byte ptr [RESEND],0
mov byte ptr [PatchRrva],0 ; don't update the icon rvas
NoPreviousCompression:
mov eax,dword ptr [PEHeader+136]
mov dword ptr [RESOURCEOFS],eax
mov byte ptr [RCompress],0
mov edx,dword ptr [SavePosition]
call SeekFile ; seek to the pos
mov ecx,dword ptr [esi+16] ; get the obj length for reading
mov edx,dword ptr [MemStart] ; start of the allocated memory
call ReadFromFile ; read the obj into the allocated mem
Call Randomize
xchg ebx,eax
mov dword ptr [RESOURCE_ENCRYPT],ebx
mov eax,[esi+8]
mov dword ptr [RESOURCESIZ],eax
Call DisplayResourceInformation
cmp byte ptr [RESOURCECOMP],1
jz CompressResources
push esi
mov esi,dword ptr [MemStart]
mov ebp,esi
mov edi,dword ptr [RESOURCEOFS]
mov edx,ebp
mov ebx,offset ToAdd
mov byte ptr [DURCHGANG],1
call ParseSubDirectory
EncryptionFinished2:
mov byte ptr [DURCHGANG],0
pushad
WriteConsole2 <offset Baukasten17>
popad
pop esi
mov edx,dword ptr [esi+20] ; seek to the obj start
call SeekFile
mov edx,dword ptr [MemStart] ; write the encrypted obj into the file
mov ecx,dword ptr [esi+16] ; get the obj length for writing
call WritetoFile
jmp Dontcrypt
CompressResources:
push esi
mov ebp,dword ptr [MemStart]
mov esi,ebp
mov edi,dword ptr [MemStart5]
call ReadSubdirectory
jmp DetermineDirectoryEnd
ReadSubdirectory Proc
push edx
movzx ecx,word ptr [esi+14] ; get the number of ID entries (root directory)
movzx edx,word ptr [esi+12] ; get number of named entries (root directory)
add ecx,edx
pop edx
ReadSubdirectory_2:
push ecx
add esi,16 ; Image Resource Directory Format = 16 bytes
push esi
mov dword ptr [NumberofDirs],ecx ; save the number of subdirectories
ScanNext:
cmp dword ptr [NumberofDirs],0
jz ContinueDirParsing_restore_pointers
; cmp byte ptr [CheckIcon],4
; jz ScanForIconID
cmp byte ptr [CheckIcon],1 ; check if the group icon scanning is enabled
jz GroupIconScanning
cmp byte ptr [CheckIcon],2 ; check if the icon scanning is enabled
jz NormalIconScanning
cmp byte ptr [CheckIcon],6
jz VersionInfoScanning
ContinueDirParsing:
mov eax,dword ptr [esi+4] ; get data or directory offset
; (directory if 800000000h is set)
and eax,7FFFFFFFh ; pointer contains of 31 bit
test dword ptr [esi+4],80000000h ; test for directory / raw data structure
jnz SubDirectoryFound ; jump if set (subdirectory)
jmp RawStructureFound ; Raw data structure found
SubDirectoryFound:
mov esi,ebp ; get the memory offset
add esi,eax ; add the pointer to the sub directory
call ReadSubdirectory
pop esi
pop ecx
sub esi,8
or ecx,ecx
jz Retit
cmp byte ptr [CheckIcon],5
jnz NoNormalScanningEnabled
cmp ecx,1
jz FinishedwithParsing
NoNormalScanningEnabled:
dec ecx
jnz ReadSubdirectory_2
Retit:
ret
jmp ReadSubdirectory
ContinueDirParsing_restore_pointers:
cmp byte ptr [CheckIcon],6 ; is the version scanning finished?
jnz NoVersionScanning
cmp byte ptr [esi],10h
jz VersionInformationFound
mov byte ptr [CheckIcon],0
jmp VersionScanningFinished
NoVersionScanning:
cmp byte ptr [CheckIcon],2 ; check if the icon scanning is enabled
jz NormalIconScanningNotEnabled
cmp byte ptr [esi],03h
jz NormalIconFound2
mov byte ptr [CheckIcon],0
NormalIconScanningNotEnabled:
cmp byte ptr [CheckIcon],1 ; check if the group icon scanning is enabled
jnz GroupScanNotEnabled
cmp byte ptr [esi],0Eh
jz GroupIconFound
mov byte ptr [CheckIcon],0
GroupScanNotEnabled:
VersionScanningFinished:
pop esi
push esi
jmp ContinueDirParsing
VersionInfoScanning:
cmp byte ptr [esi],10h
jz VersionInformationFound
add esi,8
dec dword ptr [NumberofDirs]
jmp ScanNext
GroupIconScanning:
cmp byte ptr [esi],0Eh
jz GroupIconFound
add esi,8
dec dword ptr [NumberofDirs]
jmp ScanNext
NormalIconScanning:
cmp byte ptr [esi],03h
jz NormalIconFound2
add esi,8
dec dword ptr [NumberofDirs]
jmp ScanNext
NormalIconFound2:
mov byte ptr [CheckIcon],5
mov byte ptr [IconResult],1
jmp ContinueDirParsing
GroupIconFound:
mov byte ptr [IconResult],1
mov byte ptr [CheckIcon],3
jmp ContinueDirParsing
VersionInformationFound:
mov byte ptr [CheckVInfo],1
mov byte ptr [CheckIcon],3
jmp ContinueDirParsing
ScanForIconID:
mov eax,dword ptr [IconID]
cmp [esi],eax
jz ContinueDirParsing2
add esi,8
jmp ScanNext
ContinueDirParsing2:
mov byte ptr [CheckIcon],5
jmp ScanNext
RawStructureFound:
add eax,ebp
xchg esi,eax
mov eax,[esi] ; get the raw data offset
cmp byte ptr [CheckVInfo],1
jz VersionInfoFound
cmp byte ptr [CheckIcon],3
jz Group_Icon_Found
cmp byte ptr [CheckIcon],5
jnz DontScanForNormalIcon
push edx
mov edx,dword ptr [RESOURCESIZ] ; get the virtual size of the resources
add edx,dword ptr [RESOURCEOFS] ; add the resource rva
cmp eax,edx
pop edx
ja DontScanForNormalIcon
push eax
sub eax,[RESOURCEOFS]
add eax,ebp
cmp byte ptr [eax],28h
pop eax
jz Normal_Icon_Found
jmp DontScanForNormalIcon
DontScanForNormalIcon:
; cmp byte ptr [CheckIcon],5
; jz Normal_Icon_Found
cmp byte ptr [DontStore],0
jz DontStoreOffsets
mov dword ptr [OfsAmount],eax
stosd ; store the raw data offset into the buffer
DontStoreOffsets:
pop esi
pop ecx
ret
ReadSubdirectory endp
DetermineDirectoryEnd:
mov eax,dword ptr [OfsAmount]
mov ecx,edi ; get the current buffer position
sub ecx,dword ptr [MemStart5] ; subtract the buffer start to get the size
shr ecx,2 ; divide it by 4
mov dword ptr [OfsAmount],ecx ; store it
mov esi,dword ptr [MemStart5] ; get the offset buffer start
mov eax,[esi]
mov dword ptr [PosResult],eax ; save this as the result if only one resource entry exists
GetTheNextOffset:
push ecx
push esi
mov eax,[esi] ; get the next offset out of the buffer
mov dword ptr [OfsPos],esi ; save the current buffer position
mov esi,dword ptr [MemStart5] ; pointer to the buffer start for every offset
mov ecx,dword ptr [OfsAmount] ; get the amount of all offsets in the buffer
cmp ecx,1
jz DontContinueScanning
CompareOffsets:
cmp esi,dword ptr [OfsPos] ; compare the current pos with the offset pos
jz DontAdd ; if equal then don't add
cmp eax,[esi] ; compare the offset with another offset
jae DontAdd ; only add the small offsets
inc dword ptr [OfsResult] ; increase the offset counter
DontAdd:
add esi,4 ; set pointer to the next offset
dec ecx
jnz CompareOffsets
mov ebx,dword ptr [OfsResult] ; get the amount of offsets
cmp ebx,dword ptr [EndResult] ; compare it with the end result
jle DontAddAnew ; dont add a new one if the result amount is smaller
mov dword ptr [EndResult],ebx ; save the new end result
mov dword ptr [PosResult],eax ; save the end offset
DontAddAnew:
mov dword ptr [OfsResult],0 ; zero the offset counter
pop esi
add esi,4 ; make it point to the next entry
pop ecx
dec ecx
jnz GetTheNextOffset
jmp ScanningSuccessful
DontContinueScanning:
pop esi
pop ecx
ScanningSuccessful:
mov esi,dword ptr [MemStart]
mov edi,dword ptr [PosResult]
add edi,esi
sub edi,dword ptr [RESOURCEOFS]
mov dword ptr [MemStart],edi
mov eax,[edi] ; get the first dword after the resource directory
mov dword ptr [RESOURCEBYT],eax
sub edi,esi
pop esi
mov dword ptr [DirSize],edi
mov dword ptr [DIRSIZE],edi
mov ecx,[esi+16]
mov dword ptr [OrigSize],ecx
sub ecx,edi
mov dword ptr [InfoSize],ecx
mov dword ptr [CompressBytes],ecx
push ecx
push esi
push edi
mov esi,dword ptr [MemStart]
mov edi,esi
mov byte ptr [RCompress],1
mov byte ptr [IconResult],0
mov byte ptr [DontStore],0
Call CheckForIcons
jmp CompressThem
DamnCrap:
mov byte ptr [RCompress],1
jmp EncryptResources
CheckForIcons Proc
pushad
mov dword ptr [SaveTemp2],esp
mov byte ptr [CheckIcon],1 ; set the internal variable true
mov esi,dword ptr [MemStart2] ; points to the funny resources
mov ebp,esi
call ReadSubdirectory ; read it
ScanningFinished:
mov esp,dword ptr [SaveTemp2]
popad
ret
Group_Icon_Found:
mov edx,dword ptr [MemStart2]
mov eax,dword ptr [esi] ; get the offset of this entry
mov ecx,dword ptr [esi+4] ; get the length of this resource entry
sub eax,dword ptr [RESOURCEOFS]
add eax,edx
pushad
mov eax,[esi] ; get the rva of the first icon
mov edx,dword ptr [RESOURCESIZ] ; get the virtual size of the resources
add edx,dword ptr [RESOURCEOFS] ; add the resource rva
cmp eax,edx ; range checking
popad
ja ScanningFinished
push eax
mov eax,dword ptr [IconSize]
mov [esi],eax
pop eax
pushad
sub esi,dword ptr [MemStart2] ; calculate some crap
mov dword ptr [IconPointers],esi
add dword ptr [IconPointi],4
; mov dword ptr [SPointer1],esi ; save it
mov edx,dword ptr [SavePosition] ; get the old filepos
sub edx,dword ptr [Csize] ; subtract the packed bytes
mov dword ptr [NewRPos],edx ; save the new resource pos
popad
mov esi,eax
mov edi,dword ptr [IconBuffer] ; points to the reserved icon buffer
add edi,dword ptr [IconSize]
push edi
add dword ptr [IconSize],ecx
CopyGroupIcon:
lodsb
mov byte ptr [esi-1],0
stosb
dec ecx
jnz CopyGroupIcon
pop esi
mov byte ptr [CheckIcon],2 ; set the internal variable for the icon scanning
mov esi,dword ptr [MemStart2] ; points to the funny resources
mov ebp,esi
call ReadSubdirectory ; read it
jmp FinishedwithParsing
Normal_Icon_Found:
mov edx,ebp
mov eax,dword ptr [esi] ; get the offset of this entry
mov ecx,dword ptr [esi+4] ; get the length of this resource entry
sub eax,dword ptr [RESOURCEOFS]
add eax,edx
pushad
mov eax,[esi] ; get the rva of the first icon
mov edx,dword ptr [RESOURCESIZ] ; get the virtual size of the resources
add edx,dword ptr [RESOURCEOFS] ; add the resource rva
cmp eax,edx ; range checking
popad
ja DontStoreOffsets
push eax
mov eax,dword ptr [IconSize]
mov [esi],eax
pop eax
pushad
sub esi,dword ptr [MemStart2]
mov edi,dword ptr [IconPointi]
mov dword ptr [edi],esi
add edi,4
mov dword ptr [IconPointi],edi
; mov dword ptr [SPointer2],esi
popad
mov esi,eax
push esi
mov edi,dword ptr [IconBuffer] ; points to the allocated memory for the iconcrap
add edi,dword ptr [IconSize]
add dword ptr [IconSize],ecx
CopyNormalIcon:
lodsb
mov byte ptr [esi-1],0
stosb
dec ecx
jnz CopyNormalIcon
pop esi
jmp DontStoreOffsets
FinishedwithParsing:
mov byte ptr [CheckIcon],6 ; Enable the version information scanning
mov esi,dword ptr [MemStart2] ; points to the funny resources
mov ebp,esi
call ReadSubdirectory ; read it
mov byte ptr [CheckVInfo],0
jmp NoVersionInfoInthisFile
VersionInfoFound:
mov byte ptr [CheckVInfo],1
mov eax,dword ptr [esi] ; get the offset of this entry
mov ecx,dword ptr [esi+4] ; get the length of this resource entry
sub eax,dword ptr [RESOURCEOFS]
add eax,edx
pushad
mov eax,[esi] ; get the rva of the first icon
mov edx,dword ptr [RESOURCESIZ] ; get the virtual size of the resources
add edx,dword ptr [RESOURCEOFS] ; add the resource rva
cmp eax,edx ; range checking
popad
ja ScanningFinished
push eax
mov eax,dword ptr [IconSize]
mov [esi],eax
pop eax
pushad
sub esi,dword ptr [MemStart2]
mov dword ptr [SPointer3],esi
popad
mov esi,eax
push esi
mov edi,dword ptr [IconBuffer] ; points to the allocated memory for the iconcrap
add edi,dword ptr [IconSize]
add dword ptr [IconSize],ecx
CopyVersionInfo:
lodsb
mov byte ptr [esi-1],0
stosb
dec ecx
jnz CopyVersionInfo
pop esi
pop ecx
pop esi
NoVersionInfoInthisFile:
mov byte ptr [PatchRrva],1 ; set flag for later rva patching
jmp ScanningFinished
CheckForIcons endp
allobjsdone:
mov dword ptr [PEHeader+80],0 ; zero the imagesize value
sub esi,40
movsx ecx,word ptr [PEHeader+6] ; get the number of objects
dec ecx
mov eax,40 ; in the pefile..and multiply them by
mul ecx ; 40 (length of an obj block)
add eax,offset PEHeader+248
mov esi,eax
mov eax,[esi+8] ; get virtualsize of the last obj
add eax,[esi+12] ; add rva of the last object
mov ecx,dword ptr [PEHeader+56] ; use the section aligment for the rva
xor edx,edx ; calculation
div ecx
or edx,edx
jz NoRvaRestValue
inc eax
NoRvaRestValue:
mul ecx
mov [RVA_NEW],eax ; write the new rva into my ruling object
mov eax,[esi+20] ; get the physical offset of the last object
add eax,[esi+16] ; add the physical size = new offset of my object
mov [Offset_NEW],eax ; save the new physical offset
mov eax,(Offset ToAdd_END - Offset ToAdd) ; size of the whole PECRYPT32 loader
mov ecx,dword ptr [PEHeader+56] ; get the value we need for alignment
xor edx,edx
div ecx
or edx,edx
jz NoRestValue
inc eax
NoRestValue:
mul ecx
mov dword ptr [VirtualS_NEW],eax ; save new virtual size
mov eax,(Offset ToAdd_END - Offset ToAdd) ; size of the whole PECRYPT32 loader
mov ecx,dword ptr [PEHeader+60] ; get the value we need for alignment
xor edx,edx
div ecx
or edx,edx
jz NoRestiValue
inc eax
NoRestiValue:
mul ecx
mov dword ptr [Physical_NEW],eax ; save it as new physicalsize
chabojackson:
add eax,dword ptr [Offset_NEW] ; add the physical offset of this object
mov [PhysOffset],eax ; save it as the new offset for the icon object
mov eax,dword ptr [RVA_NEW] ; get the new calculated rva
add eax,dword ptr [VirtualS_NEW] ; add the virtual size
mov [Rva_NEW],eax ; save it as the RVA for the new icon object
cmp dword ptr [IconSize],0 ; no icons / version info in the resources?
jz No_Icon_VersionInfo
mov eax,dword ptr [IconSize] ; get the iconsize
push eax
mov ecx,dword ptr [PEHeader+56] ; get the value we need for alignment
xor edx,edx
div ecx
or edx,edx
jz No_Rest_Value
inc eax
No_Rest_Value:
mul ecx
add dword ptr [PEHeader+80],eax ; add the '.icon' section vsize to the imagesize
mov dword ptr [VSize_New],eax ; save it as new vsize for the .icon object
pop eax
mov ecx,dword ptr [PEHeader+60] ; use the file alignment to align
xor edx,edx
div ecx
or edx,edx
jz No__Rest_Value
inc eax
No__Rest_Value:
mul ecx
mov dword ptr [PhysSize_New],eax ; save it also as the new physical size
No_Icon_VersionInfo:
mov eax,dword ptr [RVA_NEW] ; get the new calculated rva
mov dword ptr [PEHeader+40],eax ; save it in the PEHEADER
add dword ptr [Dllrva],eax ; prepare the dll field
add dword ptr [ThunkRva],eax ; prepare the thunkarray
add dword ptr [Thunktable],eax
add dword ptr [Thunktable+4],eax
cmp byte ptr [PEText+91h],"k" ; tag verification
jz Tag_NotChanged
xor eax,666h
Tag_NotChanged:
add dword ptr [Thunktable+8],eax
mov dword ptr [PEHeader+168],0 ; kill the debuginfo
mov dword ptr [PEHeader+172],0
mov dword ptr [PEHeader+208],0
mov dword ptr [PEHeader+212],0
mov dword ptr [PEHeader+216],0
mov dword ptr [PEHeader+220],0
push eax
mov eax,dword ptr [PEHeader+128]
mov dword ptr [IMPORTOFS],eax ; save the rva
pop eax
push eax
add eax,offset NamehOffset - offset ToAdd
mov dword ptr [PEHeader+128],eax ; save the import table rva
mov dword ptr [PEHeader+132],offset ImportEnd - offset NamehOffset
pop eax
mov dword ptr [NEWIBASE],eax ; save it as new imagebase
add eax,dword ptr [VirtualS_NEW] ; add the virtual size of the new object
add dword ptr [PEHeader+80],eax ; write the new imagesize
pusha
movsx ecx,word ptr [PEHeader+6] ; get the number of objects
mov eax,40 ; in the pefile..and multiply them by
mul ecx ; 40 (length of an obj block)
add eax,offset PEHeader+248
inc word ptr [PEHeader+6]
mov edi,eax
mov esi,offset NewOBJ
mov ecx,40
rep movsb
cmp byte ptr [CheckVInfo],1 ; do we need a new object for the version stuff?
jz WriteNewObject ; if yes then write one
cmp byte ptr [PatchRrva],0 ; do we need a new icon object?
jz NoIconObjectNeeded
WriteNewObject:
mov esi,offset NewOBJ2
mov ecx,40
rep movsb
inc word ptr [PEHeader+6]
NoIconObjectNeeded:
popa
mov eax,dword ptr [PEHeader+52]
mov dword ptr [IMAGEBASE],eax
cmp byte ptr [LOADEROPT],0 ; api hooking enabled?
jz MenuCrapFinished ; if no , then jump
mov DialogAPI,0
call MenuStart
MenuCrapFinished:
cmp byte ptr [ANTIBPX],0
jz AntiBpxStuffDisabled
mov DialogAPI,1
lea esi,FunctionT
lea edi,TempBuffer
mov ecx,500
rep movsd
call MenuStart
lea esi,FunctionT
lea edi,FunctionT2
mov ecx,500
rep movsd
lea esi,TempBuffer
lea edi,FunctionT
mov ecx,500
rep movsd
AntiBpxStuffDisabled:
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;Encryption routine for the first antidebugging layer
;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
cmp byte ptr [COMPATIBLE],0
jz TlsSupportEnabled
mov dword ptr [PEHeader+192],0
mov dword ptr [PEHeader+196],0
TlsSupportEnabled:
mov dword ptr [PreviousCRC],0 ; zero previouscrc (will be used lAtA lAmErz)
mov ax,word ptr [PEHeader+6]
mov word ptr [OBJNUMBA],ax
mov edi,offset LayerTable ; memory to fill the layers in
mov esi,offset Layer_Table_End ; memory to encrypt/decrypt
mov ecx,(offset REALCODE_CRC_END - offset EncryptLayer3_End)
jmp SlowMte_Start
EncryptionFinished:
mov edi,offset output_data
mov esi,offset LayerTable
mov ecx,1000 / 4
rep movsd
mov edi,offset LayerTable
mov ecx,1000 / 4
mov eax,90909090h
rep stosd
cmp byte ptr [ANTID],0
jz NoFuckingAntidebugging
call Randomize
mov dword ptr [VALUE4],eax
mov dword ptr [BLASEN2],eax
call Randomize
mov dword ptr [VALUE3],eax
mov dword ptr [BLASEN],eax
call Randomize
mov dword ptr [ENCRYPTV11],eax
mov edx,eax
mov esi,offset InCPL3
mov edi,esi
mov ecx,(offset EncryptedLayer_4_Start - offset InCPL3) / 4
Encrypt_AD_Block:
push esi
push ecx
mov ecx,offset (offset InCPL3 - offset NoHeuristicAlert) / 4
mov esi,offset NoHeuristicAlert
GenerateAD_CRC:
mov eax,[esi]
xor edx,eax
xor edx,ecx
add esi,4
dec ecx
jnz GenerateAD_CRC
pop ecx
pop esi
lodsd
xor eax,edx
stosd
inc dword ptr [VALUE3]
xor edx,dword ptr [VALUE4] ; simple xor but effective ;)
xor edx,ecx
dec ecx
jnz Encrypt_AD_Block
mov eax,dword ptr [BLASEN]
mov dword ptr [VALUE3],eax
mov eax,dword ptr [BLASEN2]
mov dword ptr [VALUE4],eax
call Randomize
mov dword ptr [VALUE5],eax
mov dword ptr [BLASEN2],eax
call Randomize
mov dword ptr [VALUE6],eax
mov dword ptr [BLASEN],eax
mov edx,eax
mov esi,offset CPL0_NOT_ACTIVE
mov edi,esi
mov ecx,(offset InCPL3 - offset CPL0_NOT_ACTIVE) / 4
Encrypt_First_Antidebugging_Layer:
push esi
push ecx
mov ecx,(offset EncryptedAntiDebuggingLayer_1_End - offset HeuristicPassed) / 4
mov esi,offset HeuristicPassed
Generate_CRC_overFirst_Antidebugging_Layer_2:
mov eax,[esi]
xor edx,eax
xor edx,ecx
add esi,4
dec ecx
jnz Generate_CRC_overFirst_Antidebugging_Layer_2
pop ecx
pop esi
rol edx,cl
rol dword ptr [VALUE6],cl
xor dword ptr [VALUE5],ecx
lodsd
xor eax,edx
stosd
inc dword ptr [VALUE5]
xor dword ptr [VALUE6],ecx
xor edx,ecx
dec ecx
jnz Encrypt_First_Antidebugging_Layer
mov eax,dword ptr [BLASEN2]
mov dword ptr [VALUE5],eax
mov eax,dword ptr [BLASEN]
mov dword ptr [VALUE6],eax
NoFuckingAntidebugging:
mov esi,offset output_data
mov edi,offset LayerTable
mov ecx,1000 / 4
rep movsd
call Randomize
mov dword ptr [SaveMCRC],eax
mov dword ptr [MutateCRC1],eax
call Randomize
mov dword ptr [SaveMCRC+4],eax
mov dword ptr [MutateCRC2],eax
call Randomize
mov dword ptr [START_VALUE],eax
mov edx,eax
mov esi,offset Encrypted_Block1_End-1
mov edi,esi
mov ecx,(offset Encrypted_Block1_End - offset Encrypted_Block1) / 4
std
Decrypt_Block11:
push esi
push ecx
mov ecx,offset (CRC_Block1_End - offset CRC_Block1) / 4
mov esi,offset CRC_Block1
GenerateFirst_CRC1:
mov eax,[esi]
xor edx,eax
xor edx,ecx
add esi,4
dec ecx
jnz GenerateFirst_CRC1
pop ecx
pop esi
lodsd
xor eax,edx
stosd
inc dword ptr [MutateCRC2]
rol dword ptr [MutateCRC1],cl
xor edx,ecx
dec ecx
jnz Decrypt_Block11
cld
mov eax,dword ptr [SaveMCRC]
mov dword ptr [MutateCRC1],eax
mov eax,dword ptr [SaveMCRC+4]
mov dword ptr [MutateCRC2],eax
call Randomize
mov dword ptr [VALUE_THREAD],eax
cmp byte ptr [EXEFLAGS],1
jz Thread_Encryption_Finished
jmp Thread_Encryption_Start
Thread_Encryption_Finished:
mov edx,dword ptr [Offset_NEW]
add edx,dword ptr [Physical_NEW]
add edx,dword ptr [PhysSize_New]
push 4
push 1000h
push edx
push 0
call VirtualAlloc
mov dword ptr [MemStart6],eax
xor ecx,ecx
mov edx,dword ptr [Offset_NEW]
call SeekFile
mov edx,offset ToAdd
mov ecx,dword ptr [Physical_NEW]
call WritetoFile
mov edx,dword ptr [DosHeader+3Ch]
call SeekFile
movsx ecx,word ptr [PEHeader+6] ; get the number of objects
mov eax,40 ; in the pefile..and multiply them by
mul ecx ; 40 (length of an obj block)
add eax,248
mov edx,offset PEHeader
mov ecx,eax
call WritetoFile ; write all obj and the peheader to the file
xor edx,edx
call SeekFile
mov edx,dword ptr [MemStart6]
mov ecx,dword ptr [Offset_NEW]
add ecx,dword ptr [Physical_NEW]
add ecx,dword ptr [PhysSize_New]
Call ReadFromFile
push dword ptr [Fhandle]
call CloseHandle
cmp byte ptr [CheckVInfo],0
jz DontPatchVersionRVA
pusha
mov edx,dword ptr [MemStart6]
add edx,dword ptr [NewRPos]
mov eax,dword ptr [Rva_NEW] ; rva of the new resource object
add edx,dword ptr [SPointer3]
add [edx],eax
popa
DontPatchVersionRVA:
cmp byte ptr [PatchRrva],0 ; is the internal flag set?
jz Dont_patchrvas ; no? then don't patch
pusha
mov edx,dword ptr [MemStart6]
add edx,dword ptr [NewRPos]
push edx
mov eax,dword ptr [Rva_NEW] ; rva of the new resource object
mov esi,offset IconPointers ; points to the data stuff
ContinuePatchingRVAS:
cmp dword ptr [esi],0
jz FinishedWithPatchingRvas
mov edi,edx
add edi,[esi]
add [edi],eax
add esi,4
jmp ContinuePatchingRVAS
FinishedWithPatchingRvas:
popa
Dont_patchrvas:
push 0
push 80h
push 02
push 0
push 03
push 80000000h+40000000h
push offset CryptFile
call CreateFileA
mov dword ptr [Fhandle],eax
mov edx,dword ptr [MemStart6]
mov ecx,dword ptr [PhysicalO]
add ecx,dword ptr [Physical_NEW]
sub ecx,dword ptr [Csize]
call WritetoFile
mov edx,dword ptr [IconBuffer]
mov ecx,dword ptr [PhysSize_New]
call WritetoFile
cmp dword ptr [OverlaySize],0
jz NoDamnOverlay
mov edx,dword ptr [MemStart8]
mov ecx,dword ptr [OverlaySize]
call WritetoFile
NoDamnOverlay:
push dword ptr [Fhandle]
call CloseHandle
mov edx,dword ptr [Offset_NEW]
add edx,dword ptr [Physical_NEW]
add edx,dword ptr [PhysSize_New]
Push 2
push edx
Push DWord Ptr [MemStart6]
Call VirtualFree
or eax,eax
jne dealloc_error
cmp byte ptr [OverLay],0
jz NoFuckingOverLay
WriteConsole2 <offset OverLayEr>
NoFuckingOverLay:
cmp byte ptr [CUTDINFO],0
jz NoCuttedDebugInfo
WriteConsole2 <offset Baukasten23>
NoCuttedDebugInfo:
cmp byte ptr [COMPATIBLE],1
jz NoTLSInformationFound
cmp dword ptr [PEHeader+192],0
jz NoTLSInformationFound
WriteConsole2 <offset Baukasten32>
NoTLSInformationFound:
mov esi,dword ptr [MemStart7]
mov ecx,(ToAdd_END - offset CRC_Block1)
mov edi,offset CRC_Block1
rep movsb
mov edi,offset Fhandle
mov ecx,(offset FICK - offset Fhandle)
xor al,al
rep stosb
Call Memory_DeAlloc
jmp End_OF_Crypt_Routine
;procedure 2 write some crap in a file
;syntax: like the dos one
;yoo lame bitch, i rule like the mothaaaaffuuuuucccckiiiiing hell :)
WritetoFile proc
push 0
push offset Howmuch
push ecx
push edx
push dword ptr [Fhandle]
call WriteFile
mov eax,dword ptr [Howmuch]
xor edx,edx
xor ecx,ecx
ret
WritetoFile endp
;returns a great random value ;))
Randomize proc
push ecx
call GetTickCount
xchg eax,ecx
call GetTickCount
xor ecx,eax
call GetTickCount
xor ecx,eax
xchg eax,ecx
pop ecx
ret
Randomize endp
;Procedure 2 read crap out of a fucking lame file
;syntax: like the dos readfile function :)
;yo man this rocks like the hell
ReadFromFile proc
push 0
push offset Howmuch
push ecx
push edx
push dword ptr [Fhandle]
call ReadFile
mov eax,dword ptr [Howmuch]
xor edx,edx
xor ecx,ecx
or eax,eax
jz Errorwhilereading
ret
Errorwhilereading:
Call Memory_DeAlloc
WriteConsole2 <offset Terror1>
jmp End_OF_Crypt_Routine
ReadFromFile endp
; Procedure 2 seek in a file
; syntax: like ah=42h int 21h :)
; (i'm very lazy hehehe)
SeekFile proc
push 0
push 0
push edx ; potato reg = 0 (if potato.kind != siglinde)
push dword ptr [Fhandle] ; muhahgagagagagagagahahahahahahhahhahahaha
Call SetFilePointer
xor edx,edx
ret
SeekFile endp
Memory_Alloc Proc
push esi
push edi
push edx
push ebp
push 4
push 1000h
push eax
push 0
call VirtualAlloc
pop ebp
pop edx
pop edi
pop esi
ret
Memory_Alloc endp
Memory_DeAlloc Proc
push dword ptr [Fhandle]
call CloseHandle
cmp byte ptr [OverLay],0
jz NixOverLayDa
Push 2
push dword ptr [OverlaySize]
Push DWord Ptr [MemStart8]
Call VirtualFree
or eax,eax
jnz dealloc_error
mov byte ptr [OverLay],0
NixOverLayDa:
cmp byte ptr [Dealloc],0
jz NoPossibleMemoryLeak
Push 2
push dword ptr [FileSize] ; push the filesize (amount of allocated mem)
Push DWord Ptr [RVA_NEW] ; push the linear offset
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
NoPossibleMemoryLeak:
Push 2
push (ToAdd_END - offset CRC_Block1)
Push DWord Ptr [MemStart7]
Call VirtualFree ; free it
or eax,eax ; check for error
jnz dealloc_error ; jump on error
Push 2
push dword ptr [Phillipsuckt]
Push DWord Ptr [MemStart]
Call VirtualFree
or eax,eax
jne dealloc_error
Push 2
push 1000000
Push dword Ptr [IconBuffer]
Call VirtualFree
or eax,eax
jne dealloc_error
Push 2
push dword ptr [FileSize]
Push DWord Ptr [MemStart]
Call VirtualFree
or eax,eax
jne dealloc_error
cmp byte ptr [NoWayassi],1
jz Ficktmich
WriteConsole2 <offset MemDeallocated>
Ficktmich:
ret
dealloc_error:
WriteConsole2 <offset da_error>
jmp End_OF_Crypt_Routine
Memory_DeAlloc EndP
End_Of_Cryptor:
; include r-aplib.asm
include k-menu.inc
Include r-ieh.inc
include r-slowmte.inc ; execute the pseudo mte
include r-line.inc
End_OF_Crypt_Routine:
mov ebp,dword ptr [KILLASTINKT]
mov esp,dword ptr [MONGOKILLA]
jmp EncryptionFinishedReturn
|