*/    This Routine Will Hunt Out The File_ID.DIZ from A DMS File     *
*     A Pointer To The File_Name+Path Has To Be In A0 And A Pointer  *
*     To The DMS Description Will Be Returned. The Pointer Must      *
*     Be FreeMem() After Using                                       *
*    								     *
*     A0 And D0 Are Trashed. ALL Other Registers Are Preserved      /*

		incdir		includes:
		include         includes:Libraries/Exec_lib.i
		include		includes:Libraries/Dos_Lib.i
		include		includes:Libraries/Intuition_lib.i
		include		includes:intuition/intuition.i
		
Hunt_Description:
		
		movem.l		a1-a6/d1-d7,-(sp)
		move.l		#Test_Name,d6	;For Test Reasons
		move.l		#dos_name,a1
		move.l		#0,d0		;Any Version
		CALLEXEC	OpenLibrary
		tst.l		d0
		beq		Library_Failed
		move.l		d0,_DOSBase
		move.l		#0,d0
		move.l		#int_name,a1
		CALLEXEC	OpenLibrary
		tst.l		d0
		beq		Library_Failed
		move.l		d0,_IntuitionBase
		move.l		d6,d1		;FileName
		move.l		#-1,d2		;For ACCESS_READ
		CALLDOS		Lock
		tst.l		d0
		beq		File_Not_Found	;File Not Found
		move.l		d0,d1
		CALLDOS		UnLock
		move.l          _DOSBase,a1
		CALLEXEC        CloseLibrary
		move.l          _IntuitionBase,a1
		CALLEXEC        CloseLibrary

		movem.l		(sp)+,a1-a6/d1-d7
		rts		


Library_Failed: move.l		#0,a0
		move.l		#-1,d0
		movem.l         (sp)+,a1-a6/d1-d7
		rts


File_Not_Found:
		move.l		#20,d0
		move.l		#0,d1		;MEMF_ANY
		CALLEXEC	AllocMem
		move.l		d0,a1
		move.l		a1,a5
		move.l		#20,es_StructSize(a1)
		move.l		#0,es_Flags(a1)
		move.l		#Title,es_Title(a1)
		move.l		#Problem,es_TextFormat(a1)
		move.l		#Buttons,es_GadgetFormat(a1)
		sub.l		a0,a0		;Clear it
		sub.l		a2,a2		;Clear it
		move.l		d1,a3
		CALLINT		EasyRequestArgs
		move.l		a5,a1
		move.l		#20,d0
		CALLEXEC	FreeMem		:FreeMemory
		move.l		_DOSBase,a1
		CALLEXEC	CloseLibrary
		move.l		_IntuitionBase,a1
		CALLEXEC	CloseLibrary
		movem.l         (sp)+,a1-a6/d1-d7
		rts
		
	

dos_name	dc.b	'dos.library',0
int_name	dc.b	'intuition.library',0
_DOSBase	dc.l	0
_IntuitionBase	dc.l	0


Test_Name	dc.b	'work:test.dms',0

*__________Easy Structure____________

Title		dc.b	'Hunt_DMS Problem',0
Problem		dc.b	'File %s\nNot Found.',0
Buttons		dc.b	'OK',0

		
