The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ChillyWilly on February 14, 2010, 06:40:42 AM

Title: Folder Listing
Post by: ChillyWilly on February 14, 2010, 06:40:42 AM
using icz code trying to figure out if there is a NOTZERO? for the test opcode
basically i want to get a list of folders in a directory and skip . and ..
right now the code lists files , how use test to check to see if attribute is a folder then list in msg box


FindFolders proc uses edi
  LOCAL finddata:WIN32_FIND_DATA
  LOCAL FHandle:DWORD

  invoke FindFirstFile,CTEXT("c:\test\*.*"),addr finddata
  .if eax!=INVALID_HANDLE_VALUE
    mov FHandle,eax
    xor edi,edi
    .while eax!=0
      test finddata.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY
      .if ZERO? ;;;;;;;;;;;;;;;;;;;;;;;;is there a NOTZERO?
      invoke lstrcmp,addr finddata.cFileName,CTEXT(".")
      cmp eax,0
      jz skip
      invoke lstrcmp,addr finddata.cFileName,CTEXT("..")
      cmp eax,0
      jz skip
      invoke MessageBox,0,addr finddata.cFileName,0,0
         inc edi
      .endif
      invoke FindNextFile,FHandle,addr finddata
    .endw
    invoke FindClose,FHandle
  .endif
  ret
FindFolders endp

Title: Re: Folder Listing
Post by: donkey on February 14, 2010, 07:06:15 AM
The exclamation point is used as the NOT operator so...

!ZERO?
Title: Re: Folder Listing
Post by: ChillyWilly on February 14, 2010, 07:33:38 AM
lol why didnt i think of that  :U