include	clib.inc
include	dos.inc
include	fblk.inc

PPROC	fballocwf, wfblk:dword, flag:word
	les	bx,wfblk
	push	es
	mov	ax,bx
	add	ax,wf_name
	push	ax
	mov	cx,es:[bx.wf_datemodified]
	mov	dx,es:[bx.wf_timemodified]
	mov	ax,flag
	or	al,es:[bx]
	and	al,_A_FATTRIB
	test	al,_A_SUBDIR
	jz	@F
	mov	cx,es:[bx.wf_datecreate]
	mov	dx,es:[bx.wf_timecreate]
    @@:
    	push	dx
	push	cx
	pushm   es:[bx.wf_sizeax]
	push	ax
	call	fballoc
	jz	@F
	test	cl,_A_SUBDIR
	jz	@F
	cmp	word ptr es:[bx.fb_name],'..'
	jne	@F
	cmp	byte ptr es:[bx.fb_name+2],0
	jne	@F
	or	es:[bx.fb_flag],_A_UPDIR
    @@:
	ret
PEND	fballocwf

	END
