Hi,

I am trying to read ALL the entries of a directory sequentially.
Is there a better way?
I need to acces them one by one, and MOST important: to read them one by one, so there has to be a pointer to the file returned.
Is it possible?

mov eax,Path

Path db'r:/foo/bar',0

.continue:
invoke CreateFile, eax,GENERIC_READ,0,0,OPEN_EXISTING,0,0


invoke VirtualAlloc,0,1000h,MEM_COMMIT,PAGE_READWRITE
mov ebx,eax
invoke FindFirstFile,....
opens it, reads it and searches through it
invoke FindNext.....



tnx
Posted on 2002-10-10 08:26:53 by slop
Your method sounds good to me...
Posted on 2002-10-10 08:44:18 by JCP
Dont you need to use backslash instead of slash?

For a possible solution, look here:
http://www.asmcommunity.net/board/index.php?topic=2916&highlight=winshell
Posted on 2002-10-10 08:44:41 by bazik

Dont you need to use backslash instead of slash?


The slash works as well...
Posted on 2002-10-10 09:02:18 by JCP
Hi Readiosys,

I posted because I can?t check it now.
So it will work?

What I need is a pointer to the opened file after FidFirstFile, FindNext, so as to go checking all of them

Does FindFirstFile return a handler or a pointer to the file?


bazik, from your command clone, I see it returns a handler

invoke FindFirstFile, addr szDirBuffer, addr wfd
mov hFind, eax


So how can I turn it into a pointer.
You gotta now it, you taught me how to conver hMain to 400000h :)

[2nd EDIT]
Is there a way to CreateFile passing a handler?
(Sorry about the question, I don?t know all the APIS)

Okay I'll just Use ReadFile WriteFIle
but is there another way?

tnx
Posted on 2002-10-10 09:14:22 by slop
>bazik, from your command clone, I see it returns a handler

>So how can I turn it into a pointer.

Pointer to what? The filename? This is in the W32_FIND_DATA structure you pass to FindFirstFile.
Posted on 2002-10-10 11:06:41 by bazik
bazik,

I mean a pointer to the actual data of the file.

It can be accessed with the handler + ReadFile.

But is there a way to do it without handler?
I'm asking for a direct access to the file. :)
Posted on 2002-10-10 11:38:53 by slop
Memory file mapping : see Iczelion tutorials...
Posted on 2002-10-10 11:42:27 by JCP
Right!

Thanks a lot.
Posted on 2002-10-10 11:51:48 by slop