flat assembler
Message board for the users of flat assembler.
Index
> Windows > find files with subdirectory |
Author |
|
vid 10 Mar 2011, 08:51
You are not checking return values from SetCurrentDirectory, or checking for errors on Find APIs (seems you are always assuming ERROR_FILE_NOT_FOUND). Doing this (aside from being a good practice) could help solving your problem.
|
|||
10 Mar 2011, 08:51 |
|
pe3epb 10 Mar 2011, 14:30
thinks,
i've preferred another way Code: include 'win32ax.inc' .data buf rb 500h filepath db 'c:\temp',0 allfiles db '\*.*',0 cudir db '.',0 updir db '..',0 wfd WIN32_FIND_DATA ;hfile dd ? .code start: invoke lstrcat, buf, filepath invoke lstrcat, buf, allfiles call find_files invoke ExitProcess,0 proc find_files locals hfile dd ? endl invoke FindFirstFile,buf,wfd cmp eax,INVALID_HANDLE_VALUE je exit mov [hfile], eax check: test [wfd.dwFileAttributes],FILE_ATTRIBUTE_DIRECTORY jz found invoke lstrcmp, cudir, wfd.cFileName test eax,eax je next invoke lstrcmp, updir, wfd.cFileName test eax,eax je next invoke lstrlen, buf sub eax,3 push eax mov byte [buf+eax],0 invoke lstrcat, buf, wfd.cFileName invoke lstrlen, buf mov dword [buf+eax],'\*.*' mov byte [buf+eax+4],0 call find_files pop eax mov dword [buf+eax-1],'\*.*' mov byte [buf+eax+3],0 jmp next found: invoke MessageBox,0,wfd.cFileName,0,MB_OK next: invoke FindNextFile,[hfile],wfd test eax,eax jne check invoke FindClose, [hfile] exit: ret endp .end start SOLVED _________________ Best regards |
|||
10 Mar 2011, 14:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.