; Module Checking 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
; -------------------------------------------------------------------------


; altered by Luke; added new strain of module virus (19/10/98)
; created by Luke (1/10/98)

;look for size-header = 956 or 1040

			funcName "module_check"

.module_check		ldr	r0,bufferTopOfFile_4
			sub	r1,filelength,r0
			teq	r1,#956		;module 1
			;ldreq	r0,bufferBottomOfFile_23 ; test code for optimisation
			teqne	r1,#1040	;module 2
			;ldreq	r0,bufferBottomOfFile_107 ; test code for optimi
			movne	pc,r14

			teq	r1,#956
			ldreq	r0,bufferBottomOfFile_23
			ldrne	r0,bufferBottomOfFile_107

			;okay could be module, grab something and check it

			teq	r0, #&968B9E8D
			;ldr	r1,module_check_word
 			;teq	r0,r1
 			movne	pc,r14

			;grab the generation
			ldr	r0,bufferBottomOfFile_3
			str	r0,generation_block

 			mov	r0,#module
 			ldmfd	r13!,{pc}	;found virus: unstack and
 						;return to caller

.module_check_word
			dcd	&968B9E8D


