Ïðîãðàììèðîâàíèå íà Àññåìáëåðå


Ôóíêöèÿ 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


localààà l1, l2
ifidn <di>, <address>
regàààààà equààààà esi
else
regàààààà equààààà edi
endif
pushàààà reg
movàààà reg, address
l2:
cmpàààà [byte ptr reg], ' '
jneàààààà l1
incàààààà reg
jmpààààà l2
l1:
movàààà address, reg
popààààà reg
endm
MAX_PATHààà equààààà 260
masm
WIN32_FIND_DATA struc
dwFileAttributes ddàààà ?
ftCreationTimeààààààààààà ddààààààà ?,?
ftLastAccessTime ddààà ?,?
ftLastWriteTimeà ddàààà ?,?
nFileSizeHighà ddààààààà ?
nFileSizeLowàà ddààààààà ?
dwResààààààààààààà ddààààààà 0,0
cFileName dbà (MAX_PATH) dup (?)
cAlternateFileName db 14 dup (?)
ends
+ñ¨ðªøªõ òýøüðýøõ, ¢ªþ ôû  ¨ðñþªv ¸þ ¸ª¨ºúªº¨þù ÿõ¨õúû¦¢õý ¨õöøü ª¨ðý¸û ¡øø.

Ñîäåðæàíèå ðàçäåëà