; MemScan code for Slayer - detects 'hidden' tasks
; 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.01 last updated 03/01/99 (Luke)

.find_hidden_tasks	stmfd		r13!,{r14}

			adr		r0,filter_name
			adr		r1,hidden_task_filter
			mov		r2,#42
			mov		r3,#0	;all tasks
			mov		r4,#0	;all events
			swi		Filter_RegisterPostFilter

			ldmfd		r13!,{pc}


.hidden_task_filter	stmfd		r13!,{r0-r12,r14}
			mov		r0,#5	;read task handle
			swi		Wimp_ReadSysInfo
			teq		r0,#0
			ldmeqfd		r13!,{r0-r12,pc}

			mov		r4,r0	;keep task handle
			swine		XTaskManager_TaskNameFromHandle
;if there is no error then it is listed and can be ignored
			ldmvcfd		r13!,{r0-r12,pc}

			;this one's hidden - kill it
			mov		r0,r4	;task handle
			adr		r1,task
			swi		Wimp_CloseDown

			ldmfd		r13!,{r0-r12,pc}

.task			dcb		"TASK"

.filter_name		dcb		"Slayer Virus detection",0
			align
