FindClose


, FindFirstFile FindNextFile.

BOOL FindClose(

HANDLE hFindFile //

);

. .

Ideal

p586

model flat

extrn ExitProcess:proc

extrn FindFirstFileA:proc

extrn FindNextFileA :proc

extrn FindClose :proc

extrn MessageBoxA:proc

extrn puts:proc

include win.inc

dataseg

FileName db '*.*', 0

FindFileData WIN32_FIND_DATA<>

d1 dd ?

msg db 'Error!!!', 0

tit db '',0

eol db 13,10,0

codeseg

begin:

lea eax, [ FindFileData]

push eax

push offset FileName

call FindFirstFileA

cmp eax, INVALID_HANDLE_VALUE

je short error

mov [d1], eax

lea ebx, [FindFileData.cFileName]

push ebx

call puts

push offset eol

call puts

for1:

lea ebx, [FindFileData]

push ebx

push [d1]

call FindNextFileA

test eax, eax

je short break;

lea ebx, [FindFileData.cFileName]

push ebx

call puts

push offset eol

call puts

jmp for1

break:

push [d1]

call FindClose

jmp short ok

error:

ok:

call ExitProcess

end begin

(win.inc)

MB_OK equ 0

STD_INPUT_HANDLE equ -10

STD_OUTPUT_HANDLE equ 11

STD_ERROR_HANDLE equ -12

CREATE_NEW equ 1

CREATE_ALWAYS equ 2

OPEN_EXISTING equ 3

OPEN_ALWAYS equ 4

TRUNCATE_EXISTING equ 5

GENERIC_READ equ 80000000h

GENERIC_WRITE equ 40000000h

GENERIC_EXECUTE equ 20000000h

GENERIC_ALL equ 10000000h

INVALID_HANDLE_VALUE equ (-1)

ideal

macro ShowMessage str1, tit, button

push button

push tit

push str1

push 0

call MessageBoxA

endm

macro skip address