; MemScan removal code for Slayer (library with detection code)
; Slayer - a desktop anti-virus for RISC OS
; Copyright (C) 1996 - 2000 Kiwi Software (UK)
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
;
; info@kiwisoft.co.uk
; -------------------------------------------------------------------------


; Version 0.02 last updated 3/9/98 (Luke)

.remove_extend		;r3 contains pointer to module code
			mov		r0,#&E24F30CC        ;ADR  R3,&2C
			str		r0,[r3,#&F0]
			mov		r0,#&EF000050	;SWI  OS_ExitAndDie
			str		r0,[r3,#&F4]

;we have to set up our own exit handler
			mov		r0,#11	;exit
			adr		r1,remove_extend2
			mov		r2,#0
			mov		r3,#0
			swi		XOS_ChangeEnvironment

			;store old handler addresses
			stmfd		r13!,{r1-r3,r14}

.remove_extend2		;return exit handler to original
			ldmfd		r13!,{r1-r3,r14}
			mov		r0,#11
			swi		XOS_ChangeEnvironment
			addvc		r10,r10,#1
			mov		pc,r14

.remove_sysutils	mov		r0, #4
			adr		r1, sysutils_name_string
			swi		XOS_Module
			mov		pc, r14

.remove_jester		;r3 contains pointer to module code
			mov		r0,#0
			str		r0,[r3,#8]
			str		r0,[r3,#&C]
			str		r0,[r3,#&90]
			ldr		r0,[r3,#&124]
			ldr		r1,[r3,#&784]
			swi		XOS_RemoveTickerEvent
			addvc		r10,r10,#1
			mov		pc,r14

.remove_module		mov		r0,#8
			ldr		r1,[r3,#8]
			add		r1,r1,#&C8
			mov		r2,#0
			swi		XOS_Release
			addvc		r10,r10,#1

			mov		r0,#7
			mov		r1,r4
			swi		XOS_Module

			mov		pc,r14

.remove_wimptask	mov		r0,r7
			ldr		r1,task
			swi		XWimp_CloseDown
			addvc		r10,r10,#1
			mov		pc,r14

.task			dcb		"TASK"
			align
