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
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 "rb+", 0
c_mode db "at",0
ncm db "_nocomments.asm",0
pppp db 0dh,0ah
;----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]
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:
inc ebx
mov [buv1+ebx],0dh
inc ebx
mov [buv1+ebx],0ah
cinvoke fputs,buv1,[strm]
mov [buv1],NULL
jmp nice
;----END----;
ENDz:
MOV ECX,01FFFFFFFH
L1:
LOOP L1
call [FreeConsole]
call [ExitProcess]
data import
library kernel32,'KERNEL32.DLL',\
user32, 'USER32.DLL',\
msvcrt, 'msvcrt.dll'
import msvcrt,\
fgets, 'fgets',\
fopen, 'fopen',\
fputs, 'fputs',\
feof, 'feof'
include 'api\kernel32.inc'
include 'api\user32.inc'
end data