format PE console use32 entry start include win32a inc struct przz dw

  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
format PE console
use32
entry start
include 'win32a.inc'
struct przz
X dw 0
Y dw 0
ends
;----data----;
COL1 = 2h+8h ; öâåò1
COL2 = 1h+2h+8h ; öâåò2
str1 db "Plz enter filename(.asm) :",13,10,0
str1len = ($-str1)
str2 db "wa7er`z commentz cleaner(asm).",0
str3 db "File not found.",13,10,0
str3len = ($-str3)
BUF DB 200 dup(?)
buv db 256 dup(?) ;256 bytes for srcz
buv1 db 256 dup(?) ;256 bytes for srcz
resylt dd 0
str3len = ($-str3)
writtenc dd ?
inp dd ?
outp dd ?
prz przz <?>
hhhhh dd ? ; õýíäë äëÿ ôàéëà
strm dd ?
kolvo dd ? ; filesize
tz db ";"
kovichka db '"'
f_mode db "rt", 0
c_mode db "wt",0
ncm db "_nocomments.asm",0
pppp db 10
;----data----;
start:
invoke CharToOemA,str1,str1
invoke CharToOemA,str2,str2
invoke CharToOemA,str3,str3
invoke FreeConsole ,0
invoke AllocConsole ,0
invoke GetStdHandle ,-10
push EaX
pop [inp]
invoke GetStdHandle ,-11
push EaX
pop [outp]
mov [prz.X],150 ; âûñîòà êîíñîëè
mov [prz.Y],25 ; øèðèíà êîíñîëè
invoke SetConsoleScreenBufferSize,[outp],prz
invoke SetConsoleTitleA,str2
push 0 ; ïîçèöèÿ
push 1 ; êóðñîðà
pop [prz.X]
pop [prz.Y]
invoke SetConsoleCursorPosition,[outp],prz
invoke SetConsoleTextAttribute,[outp],COL1
invoke WriteConsoleA,[outp],str1,str1len,writtenc,NULL
invoke ReadConsoleA,[inp],BUF,200,writtenc,0
;â áóôå èìÿ ôàéëà.
mov edi, BUF
mov al, 0dh
cld
repne scasb
dec edi
mov byte[edi], 0
cinvoke fopen,BUF,f_mode
push EaX
pop [hhhhh]
cmp [hhhhh],NULL
jnz nice1
invoke WriteConsoleA,[outp],str3,str3len,writtenc,NULL
jmp ENDz
nice1:
invoke lstrcat,BUF,ncm
cinvoke fopen,eax,c_mode
push EaX
pop [strm]
;;;;;;;;; shit generated by broken mind of stosd ;;;;;;;;;;;;;;;
stdcall del_comments, [hhhhh], [strm]
cinvoke fclose, [hhhhh]
cinvoke fclose, [strm]
jmp ENDz
;;;;;;;;; end of shit ;;;;;;;;;
nice:
cinvoke feof,[hhhhh]
cmp eax,0
jnz ENDz
cinvoke fgets,buv,256,[hhhhh]
;cmp [buv],0ah
;jz kkkk
invoke lstrlen,buv
;invoke WriteConsoleA,[outp],buv,eax,writtenc,NULL
push eax
pop ecx
mov edi,buv
mov al,[tz]
cld
repne scasb
sub edi,buv
; invoke substr,buv,0,edi
xor ebx,ebx
subs:
cmp ebx,edi
jz kkkk
mov al, byte[ebx+buv]
cmp al,3bh
jz skipp
mov [buv1+ebx],al
skipp:
inc ebx
jmp subs
kkkk:
invoke lstrcat,buv1,pppp
cinvoke fputs,eax,[strm]
mov [buv1],NULL
jmp nice
;----END----;
ENDz:
MOV ECX,01FFFFFFFH
L1:
LOOP L1
call [FreeConsole]
call [ExitProcess]
proc del_comments, ptr_src_fstream, ptr_dst_fstream
local buf[100h]:BYTE
push esi
push edi
lea esi, [buf]
.nxt_str:
cinvoke fgets, esi, 100h, [ptr_src_fstream]
test eax, eax
jz .exit
mov edi, esi
cinvoke strlen, edi
mov ecx, eax
mov al, ';'
repne scasb
jecxz @f
dec edi
mov word[edi], 0Ah
@@:
cinvoke fputs, esi, [ptr_dst_fstream]
jmp .nxt_str
.exit:
pop edi
pop esi
ret
endp
data import
library kernel32,'KERNEL32.DLL',\
user32, 'USER32.DLL',\
msvcrt, 'msvcrt.dll'
import msvcrt,\
fgets, 'fgets',\
fopen, 'fopen',\
fputs, 'fputs',\
strlen, 'strlen',\
fclose, 'fclose',\
feof, 'feof'
include 'api\kernel32.inc'
include 'api\user32.inc'
end data