I Tried get the size of a directory but i can?t do it.
I use:

invoke CreateFileA, ADDR Directory,GENERIC_READ,NULL,NULL,\
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL

; invoke GetLastError

invoke GetFileSize , eax, NULL

CreateFileA Returns >> -1 (Invalid handle)
GetLastError Retruns >> 5 (Access Denied)

Can Anybody help me.
Thanks.
Posted on 2002-02-06 11:42:38 by TheMorlok
You can not consider the directory as a file (at least under Windows).

You have to call FindFirstFile, recursively FindNextFile (to browse sub-directories), and closing the search handle by FindClose.

I advise you to search the forum... If I remember well, somebody posted a code for doing this...
Posted on 2002-02-06 11:49:54 by JCP
But in the Win32 Programmer?s Reference the CreateFile function says:

The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object:

? files
? pipes
? mailslots
? communications resources
? disk devices (Windows NT only)
? consoles
? directories (open only) <<<<<<<<<<<<<< Here

Is not correct ?

Thank you for your post.
Posted on 2002-02-06 12:00:21 by TheMorlok
I have no idea of what you can do using CreateFile with directories... it may open it... but it may be all you can do...

I've always heard of the Find*File method to retrieve directory size... if somebody has a better solution, I would be happy to know it. ;)
Posted on 2002-02-06 12:17:25 by JCP