include	clib.inc
include	dos.inc
include	wsub.inc
include	disk.inc

PPROC wssetflag, wsub:dword
	push	di
	les	bx,wsub
	les	bx,es:[bx.ws_flag]
	mov	di,es:[bx]
	and	di,not _W_NETWORK
	mov	es:[bx],di
	add	bx,wp_path
	mov	ax,es:[bx]
	cmp	ah,':'
	jne	wssetflag_net?
	mov	ah,0
	sub	al,'A'
	push	ax
	call	_disk_type
	les	bx,wsub
	cmp	ax,_DISK_FLOPPY
	jne	wssetflag_net
	or	di,_W_FLOPPY
	jmp	wssetflag_set
    wssetflag_net:
	cmp	ax,_DISK_NETWORK
	jne	wssetflag_sub
	or	di,_W_NETWORK
	mov	ax,3
	jmp	wssetflag_cd
    wssetflag_sub:
	cmp	ax,_DISK_SUBST
	jne	wssetflag_loc
	mov	ax,2
    wssetflag_cd:
  ifdef __LFN__
	push	ax
	pushm	wsub
	call	wscdroom
	pop	ax
  endif
	jmp	wssetflag_set
    wssetflag_loc:
	and	ax,1
	jmp	wssetflag_end
    wssetflag_net?:
	mov	al,0
	cmp	ah,'\'
	jne	wssetflag_loc
	mov	ax,3
	or	di,_W_NETWORK
    wssetflag_set:
	les	bx,wsub	; @v2.18
	les	bx,es:[bx.ws_flag]
	mov	es:[bx],di
    wssetflag_end:
	pop	di
	ret
PEND wssetflag

ifdef __LFN__

_TEXT	SEGMENT

wscdroom PROC PASCAL, wsub:dword
local	vol[32]:byte
	xor	ax,ax
	cmp	al,_ifsmgr
	jz	wscdroom_end
	les	bx,wsub
	pushm	es:[bx.ws_path]
	push	ss
	lea	ax,vol
	push	ax
	call	wvolinfo
	test	ax,ax
	jnz	wscdroom_end
	cmp	vol,al
	je	wscdroom_cdroom
	cmp	word ptr vol,'DC'
	jne	wscdroom_end
	cmp	word ptr vol+2,'SF'
	jne	wscdroom_end
    wscdroom_cdroom:
	or	di,_W_CDROOM
    wscdroom_end:
	ret
wscdroom ENDP

_TEXT	ENDS

endif
	END
