]> git.stg.codes - stg.git/blob - include/lp2_blocks.h
Уменьшена зависимость между заголовочными файлами путем использования
[stg.git] / include / lp2_blocks.h
1 #define setPBlockStart(qwer) asm("subb $0x20,l_"#qwer"SC1\n"\
2 "l_"#qwer"SC1:  .byte 0x80\n"\
3 "               addb $0x20,l_"#qwer"SC1\n"\
4 " jmp l_"#qwer"Decryptor\n\t"\
5  ".string \"m_TCodeStart\"\n\t"\
6   "    l_"#qwer"TCodeStart: nop\n\t")
7
8
9 #define setPBlockEnd(qwer) asm("                jmp l_"#qwer"Cryptor\n"\
10 "               .string \"m_TCodeEnd\"\n"\
11 "               nop\n"\
12 "               nop\n"\
13 "               nop\n"\
14 "               nop\n"\
15 "       .string \"m_PCodeEP\"\n"\
16 "l_"#qwer"Cryptor:      movl d_"#qwer"Length,%edx\n"\
17 "               subl $4,%edx \n"\
18 "l_"#qwer"Cryptor_l1:  movl $28,%eax\n"\
19 "l_"#qwer"Cryptor_l2:  movl $d_"#qwer"Password,%ebx\n"\
20 "               movl (%eax,%ebx),%ecx\n"\
21 "               movl d_"#qwer"Start_Adr,%ebx\n"\
22 "               xorl %ecx,(%ebx,%edx)\n"\
23 "               rorl %cl,(%ebx,%edx)\n"\
24 "               subl $4,%edx\n"\
25 "               js   l_"#qwer"Cryptor_ex1\n"\
26 "               subl $4,%eax\n"\
27 "               js   l_"#qwer"Cryptor_l1\n"\
28 "               jmp l_"#qwer"Cryptor_l2\n"\
29 "l_"#qwer"Cryptor_ex1: jmp l_"#qwer"Exit\n"\
30 "l_"#qwer"Decryptor:   movl d_"#qwer"Length,%edx\n"\
31 "               subl $4,%edx \n"\
32 "l_"#qwer"Decryptor_l1:movl $28,%eax\n"\
33 "l_"#qwer"Decryptor_l2:movl $d_"#qwer"Password,%ebx\n"\
34 "               movl (%eax,%ebx),%ecx\n"\
35 "               movl d_"#qwer"Start_Adr,%ebx\n"\
36 "               roll %cl,(%ebx,%edx)\n"\
37 "               xorl %ecx,(%ebx,%edx)\n"\
38 "               subl $4,%edx\n"\
39 "               js l_"#qwer"Decryptor_ex1\n"\
40 "               subl $4,%eax\n"\
41 "               js l_"#qwer"Decryptor_l1\n"\
42 "               jmp l_"#qwer"Decryptor_l2\n"\
43 "l_"#qwer"Decryptor_ex1:jmp l_"#qwer"TCodeStart\n"\
44 "d_"#qwer"Start_Adr:    .string \"m_TCodeStartAdr\"\n"\
45 "d_"#qwer"Length:       .string \"m_TCodeLength\"\n"\
46 "d_"#qwer"Password:.string \"m_TCodePass\"\n"\
47 "           .string  \"_trfgfgfgfdfgfdfgfdfg\"\n"\
48 "       .string \"m_PCodeRet\"\n"\
49 "l_"#qwer"Exit: addb $0x19,l_"#qwer"SC2\n"\
50 "l_"#qwer"SC2:  .byte 0x48\n"\
51 "               subb $0x19,l_"#qwer"SC2\n")
52
53 #define DecryptROData \
54 asm(\
55 "                       .string \"m_ROEP\"\n"\
56 "                       subb $0x20,l_ro_SC1\n"\
57 "l_ro_SC1:              .byte 0x80\n"\
58 "                       addb $0x20,l_ro_SC1\n"\
59 "l_ro_Decryptor:        movl d_ro_Length,%edx\n"\
60 "                       subl $4,%edx \n"\
61 "l_ro_Decryptor_l1:     movl $28,%eax\n"\
62 "l_ro_Decryptor_l2:     movl $d_ro_Password,%ebx\n"\
63 "                       movl (%eax,%ebx),%ecx\n"\
64 "                       movl d_ro_Start_Adr,%ebx\n"\
65 "                       roll %cl,(%ebx,%edx)\n"\
66 "                       subl $4,%edx\n"\
67 "                       js l_ro_Exit\n"\
68 "                       subl $4,%eax\n"\
69 "                       js l_ro_Decryptor_l1\n"\
70 "                       jmp l_ro_Decryptor_l2\n"\
71 "d_ro_Start_Adr:        .string \"m_ROStartAdr\"\n"\
72 "d_ro_Length:           .string \"m_ROLength\"\n"\
73 "d_ro_ExitAdr:          .string \"m_ROExitAdr\"\n"\
74 "d_ro_Password:         .string \"m_ROPass\"\n"\
75 "                       .string  \"_trfgfgfgfdfgfdfgfdfg____\"\n"\
76 "l_ro_Exit:             .byte 0x61\n"\
77 "                       push d_ro_ExitAdr\n"\
78 "                       ret\n")
79
80
81
82