OK i want to list all subdirectories and do something inside them. But when i find for directories . and .. directories appears, is there simple way to avoid this problem ??
Posted on 2004-04-29 15:36:05 by AceEmbler
not that I know of - just ignore those entries (but make sure to only ignore '.' and '..', file and directories can start with a dot or two with no problems).
Posted on 2004-04-29 15:42:21 by f0dder
These are:
(.) current directory
(..) parent of current directory

Unix heritage. Not a problem, they are useful indeed for relative addresses.
Posted on 2004-04-29 15:52:25 by pelaillo
I cant create directory with . in the begining, ofcourse i know what this directories are but i just don want to complicate my loop so i thought there is easiest way to avoid this ones. Something like FILE_ATTRIBUTE_SYSTEM || FILE_ATRIBUTE_DIRECTORY <== that's a pity that i cant do it like that :P





mov ecx,[WFD.dwFileAttributes]
and ecx,FILE_ATTRIBUTE_DIRECTORY
xor eax,eax
mov al,byte ptr [WFD.cFileName]
.IF (ecx==FILE_ATTRIBUTE_DIRECTORY) && (eax!=dword ptr '.')
Posted on 2004-04-29 16:04:11 by AceEmbler
no no no, that code won't do. You can't make ".directory" from the windows shell, but try opening cmd.exe and "md .test1" and "md ..test2"... you will see.
Posted on 2004-04-29 17:18:28 by f0dder
you are right. That's realy stupid.Well actually the folders im going to edit dont have . in name so this code is enought for me.
Posted on 2004-04-29 19:11:02 by AceEmbler
hehe okay - as long as you support dot-dirs in any release code :)
Posted on 2004-04-29 19:55:20 by f0dder
Yeah, the . and .. are a pain in the *** :)

You can do it like this:

mov ecx,[WFD.dwFileAttributes]

test ecx,FILE_ATTRIBUTE_DIRECTORY
jz >.NOGOOD
mov eax,[WFD.cFileName]
and eax,0FFFFFFh
cmp eax,2E2Eh
je >.NOGOOD
cmp eax,2Eh
je >.NOGOOD


Don't use .IF much anymore but I geuss it would be like..

mov ecx,[WFD.dwFileAttributes]

mov eax,DWORD PTR [WFD.cFileName]
and eax,0FFFFFFh
.IF (ecx&FILE_ATTRIBUTE_DIRECTORY) && (eax!=2E2Eh) && (eax!=2Eh)


BTW, no need for the extra AND ECX,FILE_ATTRIBUTE_DIRECTORY

MASM will encode .IF (ecx&FILE_ATTRIBUTE_DIRECTORY) as :

test ecx,FILE_ATTRIBUTE_DIRECTORY
jz .ENDIF
Posted on 2004-04-29 20:35:54 by donkey

MASM will encode .IF (ecx&FILE_ATTRIBUTE_DIRECTORY) as :

test ecx,FILE_ATTRIBUTE_DIRECTORY
jz .ENDIF


good to know... always done that manually thinking masm couldn't handle that :)
Posted on 2004-04-29 20:52:29 by JimmyClif