; patches Examine() so the fileinfoblock has "standard" protection bits...

	INCLUDE "exec/memory.i"

JLIB	MACRO
	XREF	_LVO\1
	jsr	_LVO\1(a6)
	ENDM

_LVOExamine	EQU	-102

	SECTION code,code

	movem.l	a4-a5,-(sp)
	move.l	(4).w,a6
	lea	dosname(pc),a1
	moveq	#37,d0
	JLIB	OpenLibrary
	move.l	d0,a5
	beq	quit
	moveq	#(end-start),d0
	move.l	#MEMF_PUBLIC!MEMF_CLEAR,d1
	JLIB	AllocMem
	move.l	d0,a4
	bne	gotmem
	moveq	#103,d1
	bra	qfault
gotmem:	move.l	a4,a1
	lea	start(pc),a0
	moveq	#(end-start),d0
	JLIB	CopyMem
	move.l	-100(a5),2(a4)
	move.l	a4,-100(a5)
	move.l	#patched,d1
	exg	a5,a6
	JLIB	PutStr
	exg	a5,a6
	bra	qdos
qfault:	move.l	#notpatched,d2
	exg	a5,a6
	JLIB	PrintFault
	exg	a5,a6
qdos:	move.l	a5,a1
	JLIB	CloseLibrary
quit:	movem.l	(sp)+,a4-a5
	rts

start:	jsr	$F80000		; guru/reset if we've been bad
	exg	d2,a0
	andi.l	#$00FF,116(a0)
	exg	d2,a0
	rts
	dc.b	0,"$VER: ExamPatch 1.0 (6.12.93)",0
	dc.b	"Don't kill me - I just fix MultiUserFileSystem!",0
	ds.l	0
end:

dosname:	dc.b	"dos.library",0
notpatched:	dc.b	"Examine() not patched",0
patched:	dc.b	"Examine() patched successfully.",10,0

	END
