flat assembler
Message board for the users of flat assembler.
Index
> DOS > Find Directories |
Author |
|
DOS386 05 Apr 2007, 19:19
Quote: but I cant find and list sub directories they dont seem to be visible Post code please I guess you have wrong attribute mask _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
05 Apr 2007, 19:19 |
|
rain_storm 05 Apr 2007, 19:34
You're right attributes set to zero and it lists them thanks it doesnt list them in the debugger I use instead only when I run the exe wtf. Does anyone know which offset of the dta can be used to find out if I'm dealing with a folder I am trying to make a process that will allow users to navigate directories and select a file from the list I wish to list all sub directories together
|
|||
05 Apr 2007, 19:34 |
|
rain_storm 05 Apr 2007, 23:22
I got it through trial n error 10h is the right attribute mask for searching for directories thanks for the pointer NTOSKRNL_VXE this had me stumped for awhile now I hate being an asm novice
|
|||
05 Apr 2007, 23:22 |
|
rain_storm 06 Apr 2007, 01:48
Here is the routine that lists the subdirectories without listing any files. And it seems to run okay on my pc the next thing on the list is to build up a navigation routine and incorporate files in the list thank god it was only a minor setback
Code: org 100h ; com file push 0B800h ; screen text buffer offset pop es ; for much faster text mov al,03h ; text mode int 10h ; do it mov ah,01h ; set cursor attributes mov cx,2B20h ; hide blinking cursor int 10h ; do it mov ah,1Ah ; set dta mov dx,dta ; new address int 21h ; do it find: ; start of find file routine mov ax,4E00h ; find first file (and set al to zero) mov dx,wildcard ; macth name with asciz string mov cx,10h ; find sub directories. int 21h ; do it or al,al ; fast error check jnz done ; if error, we're done xor di,di ; reset di to top left of screen prnt: ; set up for printing mov cx,0Ch ; 12 charictors mov si,dta+30 ; from dta (plus filename offset) mov ah,0Fh ; in black & white text: ; display all charictors on screen lodsb ; get charictor stosw ; write charictor in black & white loop text ; get more charictors add di,88h ; move to start of new line mov ax,4F00h ; find next file (and set al to zero) int 21h ; do it (cx = 0 doesnt seem to matter) or al,al ; fast error check jz prnt ; print this name too done: ; we are finished searching xor ah,ah ; wait for key press int 16h ; do it ret ; get outta here wildcard db "C:\*",0 ; file name (note that theres no extension) dta db 128 dup (0) ; dta output buffer |
|||
06 Apr 2007, 01:48 |
|
rain_storm 24 Apr 2007, 16:00
Can anyone tell me what it means if a find first / find next search returns a file named "." or ".."?
Are these volume labels or what? they are both present in every subdirectory except the root directory. I would prefer to exclude them from the list of file that are found how can I distinguish them from normal files or directories without resorting to checking the filename charictor by charictor here is a typical output screen in this case its the fasm directory the top two are what Im talking about Code: . .. CODE EXAMPLES INCLUDE SOURCE |
|||
24 Apr 2007, 16:00 |
|
HyperVista 24 Apr 2007, 17:00
I believe they represent top of the current directory and root directory.
For example, when you open a DOS shell and type "cd .." it takes you to the top of the current directory. |
|||
24 Apr 2007, 17:00 |
|
LocoDelAssembly 24 Apr 2007, 17:02
"." <- Current directory
".." <- Parent directory The same happens with the FindFirst/FindNext API functions on Windows, I don't know how to exclude those directories neither (without post processing) |
|||
24 Apr 2007, 17:02 |
|
rain_storm 24 Apr 2007, 20:25
Ah thanks guys I dont mind having them in there now that I know what they are. This was really confusing me I didnt know what they were so I thought I would ask
|
|||
24 Apr 2007, 20:25 |
|
eek 25 Apr 2007, 09:38
I can dodge them . and .. bits by just using the archive switch kinda thing
mov cx,00100000 mov cx,00100001 whatever... The 00010000 switch brings them up (I only do DOS btw) A search on "Directory attribute flags" will show you |
|||
25 Apr 2007, 09:38 |
|
Hayden 26 Apr 2007, 17:50
To look for everything except the volume label, set the hidden, system, and subdirectory bits all to 1.
Code: MOV CX, 00010110b ; file attributes ( same as dos function 43h ) Download dosref33.zip from here: http://board.flatassembler.net/topic.php?t=6950 Chapter 4 has all the info you need for theese functions. Chapter 5 has the layout for the DTA. _________________ New User.. Hayden McKay. |
|||
26 Apr 2007, 17:50 |
|
rugxulo 24 May 2007, 06:18
See my wimpy dir lister examples here.
BTW, you don't have to reset the DTA (defaults to PSP:80h) unless you need that space for cmdline opts (i.e., haven't read 'em yet). Also, HelpPC (for whatever reason) claims that the responsibility of finding specific attribs is the user's job, not the OS's (so, I dunno, maybe some old DOS didn't respect it and just returned everything). Anyone know for sure from experience? |
|||
24 May 2007, 06:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.