Subversion Repositories Kolibri OS

Rev

Rev 111 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 111 Rev 131
1
; @RCHER - DEflate unpacker v1.0
1
; @RCHER - Deflate unpacker v2.0 beta
2
;
2
;
3
; Written in pure assembler by Ivushkin Andrey aka Willow
3
; Written in pure assembler by Ivushkin Andrey aka Willow
4
;
4
;
5
; Created: May 6, 2005
5
; Created: May 6, 2005
6
;
6
;
7
; Last changed: July 14, 2005
7
; Last changed: July 14, 2005
8
;
8
;
9
; Compile with FASM
9
; Compile with FASM
10
 
-
 
11
 
10
 
-
 
11
SYS equ meos
-
 
12
OUTBUF equ 4*1024*1024
12
SYS equ meos
13
png_imag = output+OUTBUF
-
 
14
PARAM_PTR = os_work;png_image
13
PARAM_PTR equ png_image
15
MEMINIT=next_code;output
14
DUMPFILE equ '/hd/1/out.txt'
16
DUMPFILE equ '/hd/1/out.txt'
15
 
17
 
16
SHOW_RBLOCK equ 0;1
18
SHOW_RBLOCK equ 0;1
17
SHOW_PNG_SEC equ 0;1
19
SHOW_PNG_SEC equ 0;1
18
SHOW_METH equ 0;1
20
SHOW_METH equ 0;1
19
FILE_NUM equ 0
21
FILE_NUM equ 15;8
20
MEMORY equ 0x800000
22
MEMORY equ 0x800000
21
 
23
 
22
BITS equ 16
24
BITS equ 16
23
BUFSIZE equ 32
25
BUFSIZE equ 32
24
BUFPTR equ area
26
BUFPTR equ area
25
 
27
 
26
PASSW_LEN equ 32
28
PASSW_LEN equ 32
27
NO_STOPS equ 1
29
NO_STOPS equ 1
28
SHOW_CHARS equ 0
30
SHOW_CHARS equ 0
29
BSIZE equ 512
31
BSIZE equ 512
30
INBUF equ BUFSIZE*BSIZE*2
32
INBUF equ BUFSIZE*BSIZE*2
31
OUTBUF equ 4*1024*1024
-
 
32
IGNORE_DIRS equ 0
33
IGNORE_DIRS equ 0
33
 
34
 
34
MOVE_SLINE_LEV equ 8
35
MOVE_SLINE_LEV equ 8
35
 
36
 
36
DECRYPT_MODE equ 100b
37
DECRYPT_MODE equ 100b
37
PNG_MODE equ 10b
38
PNG_MODE equ 10b
38
TAR_MODE equ 1000b
39
TAR_MODE equ 1000b
39
STAY_MODE equ 10000b
40
STAY_MODE equ 10000b
40
IPC_MODE equ 100000b
41
IPC_MODE equ 100000b
41
RAW_MODE equ 1000000b
42
RAW_MODE equ 1000000b
42
THREAD_YES equ 10000000b
43
THREAD_YES equ 10000000b
-
 
44
LIST_MODE equ 100000000b
-
 
45
MEM_MODE equ 1000000000b
-
 
46
FIND_MODE equ 10000000000b
43
 
47
 
44
if SYS eq win
48
if SYS eq win
45
format PE console
49
format PE console
46
entry start
50
entry start
47
;match =win,SYS
51
;match =win,SYS
48
;{
52
;{
49
;    include 'D:\Ivushkin\projects\fasmw\INCLUDE\win32a.inc'
53
;    include 'D:\Ivushkin\projects\fasmw\INCLUDE\win32a.inc'
50
;}
54
;}
51
else
55
else
52
use32
56
use32
53
 
57
 
54
  org    0x0
58
  org    0x0
55
 
59
 
56
  db     'MENUET01'
60
  db     'MENUET01'
57
  dd     0x01
61
  dd     0x01
58
  dd     start
62
  dd     start
59
  dd     I_END
63
  dd     I_END
60
  dd     MEMORY
64
  dd     MEMINIT
61
  dd     MEMORY-2048
65
  dd     main_stack;MEMORY-2048
62
if  PARAM_PTR eq param
66
if  PARAM_PTR eq param
63
  dd     0
67
  dd     0
64
else
68
else
65
  dd     PARAM_PTR
69
  dd     PARAM_PTR
66
end if
70
end if
67
  dd     0x0
71
  dd     0x0
68
include "lang.inc"
-
 
69
 
72
 
70
if  PARAM_PTR eq param
73
if  PARAM_PTR eq param
71
  param db 'RQ'
74
  param db 'N'
72
  db '000037'
75
  db '000015'
73
  db '/hd/1/zip/png.zip',0
76
  db '/hd/1/zip/gz/fasm-1~1.tgz',0
74
end if
77
end if
75
;match =meos,SYS
78
;match =meos,SYS
76
;{
79
;{
77
    include "macros.inc"
80
    include "macros.inc"
78
;    purge mov
81
;    purge mov
79
    include "debug.inc"
82
    include "debug.inc"
-
 
83
    include 'dump.inc'
80
;}
84
;}
81
end if
85
end if
-
 
86
 
82
 
87
include 'lang.inc'
83
language equ en
88
language equ lang
84
 
89
 
85
if SYS eq win
90
if SYS eq win
86
section '.text' code readable executable writeable
91
section '.text' code readable executable writeable
87
end if
92
end if
-
 
93
 
88
include "arcmacro.inc"
94
include "arcmacro.inc"
89
include "parser.inc"
95
include "parser.inc"
90
include "deflate.inc"
96
include "deflate.inc"
91
include "sys.inc"
97
include "sys.inc"
92
 
98
 
93
FileNum dd FILE_NUM
99
FileNum dd FILE_NUM
94
;FNAME equ '/hd/1/zip/pngsuite/s01n3p01.png'
100
;FNAME equ '/hd/1/zip/pngsuite/s01n3p01.png'
95
 
101
 
96
start:
102
start:
97
if SYS eq win
103
if SYS eq win
98
    invoke GetStdHandle, STD_OUTPUT_HANDLE
104
    invoke GetStdHandle, STD_OUTPUT_HANDLE
99
    mov  [cons],eax
105
    mov  [cons],eax
100
    invoke GetStdHandle, STD_INPUT_HANDLE
106
    invoke GetStdHandle, STD_INPUT_HANDLE
101
    mov  [cons_in],eax
107
    mov  [cons_in],eax
102
    Msg  0
108
    Msg  0
103
    Msg  1
109
    Msg  1
104
else
110
else
105
    Msg  0
111
    Msg  0
106
    Msg  1
112
    Msg  1
107
    mcall 40,10000101b
113
    mcall 40,10000101b
108
;    jmp again
114
;    jmp again
109
    CmdLine
115
    CmdLine
-
 
116
  cmdl:
-
 
117
    test [Flags],LIST_MODE
-
 
118
    jz   red
-
 
119
 
-
 
120
;    Dump [lpath],[lpath_len],os_work
-
 
121
;    ud2
110
 red:
122
 red:
111
    call draw_window
123
    call draw_window
112
    mcall 12,2
124
    mcall 12,2
113
 
125
 
114
 still:
126
 still:
115
    mcall 10
127
    mcall 10
116
    cmp  eax,1
128
    cmp  eax,1
117
    je   red
129
    je   red
118
    cmp  eax,2
130
    cmp  eax,2
119
    jne  .nokey
131
    jne  .nokey
120
    mcall 2
132
    mcall 2
121
    cmp  ah,9
133
    cmp  ah,9
122
    jz   quit
134
    jz   quit
123
    jmp  still
135
    jmp  still
124
  .nokey:
136
  .nokey:
125
    cmp  eax,3
137
    cmp  eax,3
126
    jne  still
138
    jne  still
127
    mcall 17
139
    mcall 17
128
    cmp  ah,1
140
    cmp  ah,1
129
    jne  still
141
    jne  still
130
    mcall 23,30
142
    mcall 23,30
131
    cmp  eax,3
143
    cmp  eax,3
132
    jne  .noquit
144
    jne  .noquit
133
    call KillViewer
145
    call KillViewer
134
    mcall -1
146
    mcall -1
135
  .noquit:
147
  .noquit:
136
    mcall 17
148
    mcall 17
-
 
149
    mcall 64,1,MEMINIT
137
    QueryFile
150
    QueryFile
138
    and  [FileNum],0
151
    mov  [FileNum],FILE_NUM
139
    test eax,eax
152
    test eax,eax
140
    jnz  still
153
    jnz  still
141
end if
154
end if
142
again:
155
again:
-
 
156
;    Dump Flags,4,os_work
-
 
157
    mov  [fat_],fat
143
    Newline
158
    Newline
144
    xor  eax,eax
159
    xor  eax,eax
145
;    and  [Flags],STAY_MODE
160
;    and  [Flags],STAY_MODE
146
    and  [CRC32],eax
161
    and  [CRC32],eax
147
    and  [IDATsize],eax
162
    and  [IDATsize],eax
148
    mov  [Adler32],1
163
    mov  [Adler32],1
149
    call OpenFile
164
    call OpenFile
150
    test ebx,ebx
165
    test ebx,ebx
151
    jnz   .sizeok2
166
    jnz   .sizeok2
152
  .sizebad2:
167
  .sizebad2:
153
    Msg  14
168
    Msg  14
154
    jmp  quit
169
    jmp  quit
155
  .sizeok2:
170
  .sizeok2:
-
 
171
    call KillViewer
-
 
172
    xor  eax,eax
-
 
173
    mov  ecx,(child_stack-fat)/4
-
 
174
    mov  edi,fat
-
 
175
    rep  stosd
156
    mov  [filesize],ebx
176
    mov  [filesize],ebx
157
    test [Flags],RAW_MODE
177
    test [Flags],RAW_MODE
158
    jz   .norawm
178
    jz   .norawm
159
    mov  eax,[arc_base]
179
    mov  eax,[arc_base]
160
    xor  ebx,ebx
180
    xor  ebx,ebx
161
    call FileSeek
181
    call FileSeek
162
    jmp  .sizeok
182
    jmp  .sizeok
163
  .norawm:
183
  .norawm:
164
    call SfxParse
184
    call SfxParse
165
 
185
 
166
    call ZipParse
186
    call ZipParse
167
    cmp  edx,52
187
    cmp  edx,52
168
    je   .notzip
188
    je   .notzip
169
    mov  ecx,[FileNum]
189
    mov  ecx,[FileNum]
170
    call ZipFindN
190
    call ZipFindN
171
    cmp  edx,4
191
    cmp  edx,4
172
    je   quit
192
    je   quit
173
    test [Flags],DECRYPT_MODE
193
    test [Flags],DECRYPT_MODE
174
    jz   .nopass
194
    jz   .nopass
175
    call ZipDecrypt
195
    call ZipDecrypt
176
    push esi
196
    push esi
177
    mov  ecx,31
197
    mov  ecx,31
178
  ._:
198
  ._:
179
    mov  al,[esi]
199
    mov  al,[esi]
180
    push eax
200
    push eax
181
    call decrypt_byte
201
    call decrypt_byte
182
    xor  al,byte[esp]
202
    xor  al,byte[esp]
183
    add  esp,4
203
    add  esp,4
184
    call UKeys
204
    call UKeys
185
    mov  [esi],al
205
    mov  [esi],al
186
    inc  esi
206
    inc  esi
187
    loop ._
207
    loop ._
188
    pop  esi
208
    pop  esi
189
    ud2
209
    ud2
190
  .nopass:
210
  .nopass:
191
    cmp  [unp_size],0
211
    cmp  [unp_size],0
192
    jne  .sizeok
212
    jne  .sizeok
193
  .sizebadq:
213
  .sizebadq:
194
    Msg  13
214
    Msg  13
195
    jmp  quit
215
    jmp  quit
196
  .notzip:
216
  .notzip:
197
    call GzipParse
217
    call GzipParse
198
    test edx,edx
218
    test edx,edx
199
    jne   .notgzip
219
    jne   .notgzip
200
    jmp  .sizeok
220
    jmp  .sizeok
201
  .notgzip:
221
  .notgzip:
202
    call PngParse
222
    call PngParse
203
    test edx,edx
223
    test edx,edx
204
    jz  .sizeok1
224
    jz  .sizeok1
205
    cmp  edx,21
225
    cmp  edx,21
206
    je   .sizebad
226
    je   .sizebad
207
    test [Flags],RAW_MODE
227
    test [Flags],RAW_MODE
208
    jne  .sizeok
228
    jne  .sizeok
209
    Msg  40
229
    Msg  40
210
    jmp  exit
230
    jmp  exit
211
  .sizebad:
231
  .sizebad:
212
    Msg  17
232
    Msg  17
213
    jmp  exit
233
    jmp  exit
214
  .sizeok1:
234
  .sizeok1:
215
  if ~ SYS eq win
235
  if ~ SYS eq win
216
    call KillViewer
-
 
217
  end if
236
  end if
-
 
237
    Msg  39          ; unpacking PNG
-
 
238
    mov  ecx,[unp_size]
-
 
239
    add  ecx,output
-
 
240
    mov  [png_],ecx
-
 
241
    mov  eax,[PNG_info.Width]
-
 
242
    imul eax,[PNG_info.Height]
-
 
243
    lea  eax,[eax+eax*2]
-
 
244
    add  ecx,eax
-
 
245
;    dps  'Mem='
-
 
246
;    dpd  ecx
-
 
247
    mcall 64,1
-
 
248
    test eax,eax
-
 
249
    jz   .ok
218
    Msg  39
250
    Msg  41
-
 
251
    jmp  exit
-
 
252
  .ok:
219
    mov  edi,[outp]
253
    mov  edi,[outp]
220
    call Deflate.blkbegin
254
    call Deflate.blkbegin
221
    jmp  .defl_end
255
    jmp  .defl_end
222
  .sizeok:
256
  .sizeok:
-
 
257
    mov  ecx,[unp_size]
-
 
258
    dpd  ecx
-
 
259
    add  ecx,output
-
 
260
;    mov  [png_],ecx
-
 
261
    mcall 64,1
-
 
262
    test eax,eax
-
 
263
    jz   .ok2
-
 
264
    Msg  41
-
 
265
    jmp  exit
-
 
266
  .ok2:
223
    call Deflate                ; <===========
267
    call Deflate                ; <===========
224
  .defl_end:
268
  .defl_end:
225
    test [bits],7
269
    test [bits],7
226
    jnz  .esi_ok
270
    jnz  .esi_ok
227
    dec  esi
271
    dec  esi
228
  .esi_ok:
272
  .esi_ok:
229
    push dword[esi] ; <- Adler !!!
273
    push dword[esi] ; <- Adler !!!
230
    mov  esi,output
274
    mov  esi,output
231
    sub  edi,esi
275
    sub  edi,esi
232
    mov  ecx,edi
276
    mov  ecx,edi
233
    mov  [outfile.size],ecx
277
    mov  [outfile.size],ecx
234
    test [Flags],RAW_MODE
278
    test [Flags],RAW_MODE
235
    jnz  .skipAdler
279
    jnz  .skipAdler
236
    test [Flags],PNG_MODE
280
    test [Flags],PNG_MODE
237
    jnz  .skipCRC
281
    jnz  .skipCRC
238
    push esi ecx
282
    push esi ecx
239
    call UCRC
283
    call UCRC
240
    Msg  11
284
    Msg  11
241
    mov  eax,[CRC32]
285
    mov  eax,[CRC32]
242
    mov  edx,36
286
    mov  edx,36
243
    cmp  eax,[CRC_check]
287
    cmp  eax,[CRC_check]
244
    je   .crcok
288
    je   .crcok
245
    dec  edx
289
    dec  edx
246
  .crcok:
290
  .crcok:
247
    Msg  edx
291
    Msg  edx
248
  if  SYS eq win
292
  if  SYS eq win
249
  else
293
  else
250
    dph  eax
294
    dph  eax
251
  end if
295
  end if
252
    pop  ecx esi
296
    pop  ecx esi
253
    jmp  .skipAdler
297
    jmp  .skipAdler
254
  .skipCRC:
298
  .skipCRC:
-
 
299
;    dps  'Out='
-
 
300
;    dpd  ecx
255
    call UAdler
301
    call UAdler
256
    Msg  10
302
    Msg  10
257
    mov  eax,[Adler32]
303
    mov  eax,[Adler32]
258
    bswap eax   ; <- calculated Adler !!!
304
    bswap eax   ; <- calculated Adler !!!
259
    mov  edx,36
305
    mov  edx,36
260
    cmp  eax,[esp]
306
    cmp  eax,[esp]
261
    je   .adlok
307
    je   .adlok
262
    dec  edx
308
    dec  edx
263
  .adlok:
309
  .adlok:
264
    Msg  edx
310
    Msg  edx
265
  if  SYS eq win
311
  if  SYS eq win
266
  else
312
  else
267
    dph  eax
313
    dph  eax
268
  end if
314
  end if
269
  .skipAdler:
315
  .skipAdler:
270
    pop  eax
316
    pop  eax
271
    Newline
317
    Newline
272
  .nomoreIDAT:
318
  .nomoreIDAT:
273
    mov  ebx,output
319
    mov  ebx,output
274
if SYS eq win
320
if SYS eq win
275
    Msg 37
321
    Msg 37
276
    invoke CloseHandle, [hnd]
322
    invoke CloseHandle, [hnd]
277
 
323
 
278
    invoke CreateFile,dumpfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \
324
    invoke CreateFile,dumpfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \
279
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
325
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
280
    mov  [hnd],eax
326
    mov  [hnd],eax
281
    invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL
327
    invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL
282
    invoke CloseHandle, [hnd]
328
    invoke CloseHandle, [hnd]
283
else
329
else
284
    test [Flags],PNG_MODE
330
    test [Flags],PNG_MODE
285
    jnz  .nosave
331
    jnz  .nosave
-
 
332
    test [Flags],LIST_MODE
-
 
333
    jnz  quit
-
 
334
 
286
    test [Flags],TAR_MODE
335
    test [Flags],TAR_MODE
287
    jnz  .nomsg
336
    jnz  .nomsg
288
    Msg 37
337
    Msg 37
289
  .nomsg:
338
  .nomsg:
290
    mov  [outfile.out],ebx
339
    mov  [outfile.out],ebx
291
    mcall 58,outfile
340
    mcall 58,outfile
-
 
341
;       dps  'Before Quit1'
-
 
342
;    ud2
292
    test [Flags],TAR_MODE
343
    test [Flags],TAR_MODE
293
    jnz  .nosave
344
    jz   exit.pad
294
    call StartPad
345
;    call StartPad
295
  .nosave:
346
  .nosave:
296
end if
347
end if
297
    test  [Flags],PNG_MODE
348
    test  [Flags],PNG_MODE
298
    jz   NoPng
349
    jz   NoPng
299
      xor  eax,eax
350
      xor  eax,eax
300
      mov  edi,filters
351
      mov  edi,filters
301
      mov  ecx,6
352
      mov  ecx,6
302
      rep  stosd
353
      rep  stosd
303
      mov  edi,png_image
354
      mov  edi,[png_]
304
      mov  esi,output
355
      mov  esi,output
305
;//
356
;//
306
      mov  [outp],edi
357
      mov  [outp],edi
307
;//
358
;//
308
      call PngFilter
359
      call PngFilter
309
      call FiltStats
360
      call FiltStats
310
      mov  [outfile.size],edi
361
      mov  [outfile.size],edi
311
      mov  ebx,[outp];png_image
362
      mov  ebx,[outp];png_image
312
if  SYS eq win
363
if  SYS eq win
313
exit:
364
  exit:
314
    Msg  12
365
    Msg  12
315
    invoke CreateFile,outfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \
366
    invoke CreateFile,outfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \
316
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
367
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
317
    mov  [hnd],eax
368
    mov  [hnd],eax
318
    invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL
369
    invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL
319
    invoke CloseHandle, [hnd]
370
    invoke CloseHandle, [hnd]
320
	call  RunViewer
371
       call  RunViewer
321
   	and  [arc_base],0
372
       and  [arc_base],0
322
    and  [Flags],STAY_MODE
373
    and  [Flags],STAY_MODE
323
	
-
 
-
 
374
;       dps  'Before Quit2'
324
quit:	
375
  quit:    
325
    QueryFile
376
    QueryFile
326
    test eax,eax
377
    test eax,eax
327
    jnz  again
378
    jnz  again
328
    invoke ExitProcess,0
379
    invoke ExitProcess,0
329
else
380
else
330
exit:
381
  exit:
331
    mov  [outfile.out],ebx
382
    mov  [outfile.out],ebx
332
    test [Flags],TAR_MODE
383
    test [Flags],TAR_MODE
333
    jz   .notar
384
    jz   .notar
334
    Msg  37
385
    Msg  37
-
 
386
    test [Flags],LIST_MODE
-
 
387
    jne  quit
335
    mcall 58,outfile
388
    mcall 58,outfile
-
 
389
  .pad:
336
    call StartPad
390
    call StartPad
337
 .notar:
391
  .notar:
338
    Msg  12
392
    Msg  12
339
   	call  RunViewer
393
       call  RunViewer
340
   	and  [arc_base],0
394
       and  [arc_base],0
341
    and  [Flags],STAY_MODE
395
    and  [Flags],STAY_MODE
342
quit:
396
quit:
343
    test [Flags],STAY_MODE
397
    test [Flags],STAY_MODE
344
    jnz  red
398
    jnz  red
345
    mcall -1
399
    mcall -1
346
end if
400
end if
347
 
401
 
348
NoPng:
402
NoPng:
349
    test  [Flags],TAR_MODE
403
    test  [Flags],TAR_MODE
350
  if SYS eq win
404
  if SYS eq win
351
    jz  quit
405
    jz  quit
352
  else
406
  else
353
    jz    still
407
    jz    still
354
  end if
408
  end if
-
 
409
;    Dump output,255,os_work
-
 
410
;    ud2
355
    mov   ecx,dumpf_len
411
;    mov   ecx,dumpf_len
356
    mov   esi,dumpfile
412
;    mov   esi,dumpfile
357
    mov   edi,filename
413
;    mov   edi,filename
358
    rep   movsb
414
;    rep   movsb
359
    call  OpenFile
415
;    call  OpenFile
360
    test  ebx,ebx
416
;    test  ebx,ebx
361
    jz    again.sizebadq
417
;    jz    again.sizebadq
362
    call  TarParse
418
    call  TarParse
363
    mov   ecx,[FileNum]
419
    mov   ecx,[FileNum]
364
    call  TarFindN
420
    call  TarFindN
-
 
421
;    dpd   [outfile.size]
365
    cmp   [outfile.size],0
422
    cmp   [outfile.size],0
366
    jz    again.sizebadq
423
    jz    again.sizebadq
367
    mov   ebx,esi
424
    mov   ebx,esi
368
    jmp   exit
425
    jmp   exit
369
 
426
 
370
if ~ SYS eq win
427
if ~ SYS eq win
371
draw_window:
428
draw_window:
372
    mcall 12,1
429
    mcall 12,1
373
    mov  ebx,15
430
    mov  ebx,15
374
    mov  ecx,ebx
431
    mov  ecx,ebx
375
    mov  edx,0x0e26830
432
    mov  edx,0x0e26830
376
    mov  edi,edx
433
    mov  edi,edx
377
    mcall 0,,,,0x1f2a870
434
    mcall 0,,,,0x1f2a870
378
    mcall 8,,,1+1 shl 30
435
    mcall 8,,,1+1 shl 30
379
    mcall 4,<6,5>,0x10d0d0d0,msgs+5,1
436
    mcall 4,<6,5>,0x10d0d0d0,msgs+5,1
380
    mcall ,<5,5>,0x10202020
437
    mcall ,<5,5>,0x10202020
381
    ret
438
    ret
382
end if
439
end if
383
 
440
 
384
include 'data.inc'
441
include 'data.inc'
385
 
442
 
386
if SYS eq win
443
if SYS eq win
387
section '.idata' import data readable writeable
444
section '.idata' import data readable writeable
388
 
445
 
389
  library kernel,'KERNEL32.DLL',\
446
  library kernel,'KERNEL32.DLL',\
390
          comdlg,'COMDLG32.DLL',\
447
          comdlg,'COMDLG32.DLL',\
391
          user,'USER32.DLL'
448
          user,'USER32.DLL'
392
 
449
 
393
  import kernel,\
450
  import kernel,\
394
     CreateFile,'CreateFileA',\
451
     CreateFile,'CreateFileA',\
395
     GetFileSize,'GetFileSize',\
452
     GetFileSize,'GetFileSize',\
396
     ReadFile,'ReadFile',\
453
     ReadFile,'ReadFile',\
397
     WriteFile,'WriteFile',\
454
     WriteFile,'WriteFile',\
398
     SetFilePointer,'SetFilePointer',\
455
     SetFilePointer,'SetFilePointer',\
399
     CloseHandle,'CloseHandle',\
456
     CloseHandle,'CloseHandle',\
400
   	 GetStdHandle,'GetStdHandle',\
457
        GetStdHandle,'GetStdHandle',\
401
   	 WriteConsole,'WriteConsoleA',\
458
        WriteConsole,'WriteConsoleA',\
402
   	 ReadConsole,'ReadConsoleA',\
459
        ReadConsole,'ReadConsoleA',\
403
   	 CreateProcess,'CreateProcessA',\
460
        CreateProcess,'CreateProcessA',\
404
   	 WritePrivateProfileString,'WritePrivateProfileStringA',\	
461
        WritePrivateProfileString,'WritePrivateProfileStringA',\    
405
   	 ExitProcess,'ExitProcess'
462
        ExitProcess,'ExitProcess'
406
 
463
 
407
  import comdlg,\
464
  import comdlg,\
408
     GetOpenFileName,'GetOpenFileNameA'
465
     GetOpenFileName,'GetOpenFileNameA'
409
 
466
 
410
  import user,\
467
  import user,\
411
   	 wsprintf,'wsprintfA',\
468
        wsprintf,'wsprintfA',\
412
   	 SendMessage,'SendMessageA',\
469
        SendMessage,'SendMessageA',\
413
   	 FindWindowEx,'FindWindowExA',\
470
        FindWindowEx,'FindWindowExA',\
414
  	  WaitForInputIdle,'WaitForInputIdle'
471
        WaitForInputIdle,'WaitForInputIdle'
415
	
472
    
416
 
473
 
417
section '.reloc' fixups data readable discardable
474
section '.reloc' fixups data readable discardable
418
end if
475
end if
419
 
476
 
420
if ~ SYS in 
477
if ~ SYS in 
421
    error "Please specify SYS: meos OR win"
478
    error "Please specify SYS: meos OR win"
422
end if
479
end if
423
>
480
>