home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d533 / vtest.lha / VTest / VTest.doc < prev    next >
Text File  |  1991-08-26  |  9KB  |  231 lines

  1. #--------------------------------------------------------------------------
  2.  
  3. VTest.doc                                                          10.08.91
  4.                                 VTest.doc
  5.                     
  6.                                     by 
  7.  
  8.                               Frank Enderle
  9.  
  10.                           Emmendingen / GERMANY
  11.  
  12. VERSION 1.0                                     COPYRIGHT 1991 BY F.ENDERLE
  13.  
  14. #--------------------------------------------------------------------------
  15.  
  16. ***************************************************************************
  17.  
  18.                             I M P O R T A N T
  19.                         --------------------------
  20.  
  21. You can feel free to use this routine in your own programs. Feel also free
  22. to modify the routine. Use it as an example how to test  the  vectors.  If 
  23. you use this routine iin your own program please remark my name.
  24.  
  25. ***************************************************************************
  26.  
  27. Starting:
  28.  
  29.  To Test the routine please load a resident program (Guardian , Whiskey)
  30.  and start the program example.
  31.  
  32.  
  33. NOTE: Compilation
  34.  
  35.   Compile with Aztec 3.6a:
  36.  
  37.         CC VTest.c +l -s
  38.         CC Example.c +l -s  
  39.         LN Example VTest -lc32
  40.  
  41.  
  42. Program description:
  43.  
  44. FUNCTION            DESCRIBTION
  45.  
  46. CheckVecs()         (NO PARAMETER)
  47.  
  48.                     This function checks if the vectors are all set to de-
  49.                     fault. If not it will jump to Fuction Virus().
  50.  
  51.                     If you don't copy SysBase into ExecBase, ExecBase will
  52.                     point to Adress 0. The result will be wrong results.
  53.  
  54.                     ColdCapture (Offset 42 / $2A) :
  55.                      ColdCapture is not so often used. It is very uncom-
  56.                      fortable. The stack is not correctly initialized
  57.                      so you can't use the stack for your program. The
  58.                      return address is saved in a5. The default is
  59.                      $00000000.
  60.                     
  61.                     CoolCapture (Offset 46 / $2E) :
  62.                      This vector could point to a routine which will be
  63.                      called by a reset. The difference to ColdCapture:
  64.                      CoolCapture is raised later than ColdCapture.                  
  65.                      The default is $00000000.
  66.                         
  67.                     WarmCapture (Offset 50 / $32) :
  68.                      WarmCapture is only used if the DOS couldn't be
  69.                      initialized. So it is of no use for normal program-
  70.                      ing. The default is $00000000.
  71.  
  72.                     KickMemPtr  (Offset 546 / $222) :
  73.                      This points to a MemList structure. After a reset
  74.                      the memory of this structure is allocated again.
  75.  
  76.                     KickTagPtr  (Offset 550 / $226) :
  77.                      Pointer to a Resident Table. This Table will be
  78.                      inserted to the Resident Table of Exec. (So it
  79.                      will be executed by the next reset).
  80.     
  81.                     GetDoIO() (internal function) :
  82.                      This function returns the address where the offset of
  83.                      DoIO() points to. If the address is less as $F00000
  84.                      it points to ram. DoIO() is often altered by a virus.
  85.           
  86.                     GetSendIO() (internal function):
  87.                      Returns the address where SendIO() points to. See
  88.                      GetDoIO().
  89.  
  90.                     GetSumKick() (internal function):
  91.                      Returns the address where SendIO() points to. This
  92.                      vector is used by some Viruscheckers like e.g. 
  93.                      Whiskey.
  94.  
  95.                     After testing all this Vectors CheckVecs() returns
  96.                     whether the returnvalue of Virus() or NULL.
  97.  
  98. ---------------------------------------------------------------------------
  99.  
  100. Virus()             (NO PARAMETER)
  101.                     The main routine: Window handling, Gadget handling
  102.  
  103.                     First of all open all needed stuff. (OpenAll())
  104.                     Draw boxes and texts in window.     (SetUpWindow())
  105.                     Print the Vectors.                  (SetUpData())
  106.                     Now wait for the Message            (Wait())
  107.                     Classify Message. If GADGETUP classify Gadget ID.
  108.                      CLRVECS: 
  109.                       Clear all Vectors and calc the new CheckSum.
  110.                      HARDRESET:
  111.                       Do a really hard reset by destroying ChkBase (Offset
  112.                       38). The computer thinks that something goes wrong,
  113.                       and by the next Reset the ExecBase will be fully
  114.                       reorganized. All resident programms will be destro-
  115.                       yed. (ColdReset())
  116.                       I think the Hardreset would not work under KICK 2.0.
  117.                      QUIT:
  118.                       Close all the stuff before was opened. (CloseAll())
  119.                      default: 
  120.                       An illegal message by Gadgetup returns ILLEGALMSG.
  121.  
  122. ---------------------------------------------------------------------------
  123.  
  124. SetUpData()         (NO PARAMETER)
  125.                     Print all Vectors in the Window.
  126.  
  127. ---------------------------------------------------------------------------
  128.  
  129. CheckDoIO()         (NO PARAMETER)
  130.                     Checks if DoIO() points to ram or rom. In case pointing
  131.                     to ram CheckDoIO() prints *** ALTERED *** in window el-
  132.                     se it prints unset in the window. Also it prints the
  133.                     Address DoIO() points to.
  134.  
  135. ---------------------------------------------------------------------------
  136.  
  137. CheckSendIO()       (NO PARAMETER)
  138.                     See CheckDoIO().
  139.  
  140. ---------------------------------------------------------------------------
  141.  
  142. CheckSumKick()      (NO PARAMETER)
  143.                     See CheckDoIO().
  144.  
  145. ---------------------------------------------------------------------------
  146.  
  147. Check(Vec, Line)    (Vec = Pointer to Vector, Line = X offset of printout)
  148. ULONG Vec;          Prints out the vector at an specified X Offset. Y Off-
  149. SHORT Line;         set is always the same. See also CheckDoIO();
  150.  
  151. ---------------------------------------------------------------------------
  152.  
  153. SetUpWindow()       (NO PARAMETER)
  154.                     This function prints only texts and Boxes in the 
  155.                     window. It simply sets up the Graphic.
  156.  
  157. ---------------------------------------------------------------------------
  158.  
  159. OpenAll()           (NO PARAMETER)
  160.                     Opens Intuition, Graphics, the Window, topaz 80 and
  161.                     sets up the font in the window. (So always topaz 80
  162.                     is used)
  163.  
  164. ---------------------------------------------------------------------------
  165.  
  166. CloseAll()          (NO PARAMTER)
  167.                     Closes all the things we opened before in OpenAll()
  168.  
  169. ---------------------------------------------------------------------------
  170.  
  171. Box(Win,x1,y1,x2,y2) Win    = Pointer to Window structure
  172. struct Window *Win;  x1,x2  = Offset for left, top edge
  173. SHORT x1,x2,y1,y2;   x2,y2  = Offset for right, bottom edge
  174.  
  175.                     The function draws a box with shadow in the RastPort
  176.                     of the window Win.
  177.  
  178. ---------------------------------------------------------------------------
  179.  
  180. Print(Win,msg,x,y,c) Win    = Pointer to Window structure
  181. struct Window *Win;  msg    = Pointer to string
  182. STRPTR msg;          x,y    = Offset in the window
  183. SHORT  x,y;          c      = Centering (0 = OFF / 1 = ON)
  184. BOOL   c;
  185.                     The function prints a Text (msg) into the RastPort of
  186.                     the Window (Win). x and y specify the left, top edge 
  187.                     of the first character. c decides between centering 
  188.                     on or off.
  189.  
  190. ---------------------------------------------------------------------------
  191.  
  192. GetDoIO()           (NO PARAMETER)
  193.                     movem.l a1-a6,-(a7)   copy the register we use to stack
  194.                     move.l  _SysBase,a6   
  195.                     lea     _LVODoIO(a6),a1  get offset of DoIO()
  196.                     lea     2(a1),a2      get the address (I want not the
  197.                                           opcode for jmp)
  198.                     move.l  (a2),d0       copy address to d0
  199.                     move.l  (a7)+,a1-a6   restore registers
  200.                     rts                   jump back
  201.  
  202. ---------------------------------------------------------------------------
  203.  
  204. GetSendIO()         (NO PARAMETER)
  205.                     See GetDoIO()
  206.  
  207. ---------------------------------------------------------------------------
  208.  
  209. GetSumKick()        (NO PARAMETER)
  210.                     See GetDoIO()
  211.  
  212. ---------------------------------------------------------------------------
  213.  
  214. CheckSum()          (NO PARAMETER)
  215.                     Calc new checksum
  216.  
  217. ---------------------------------------------------------------------------
  218.  
  219. ColdReset()         (NO PARAMETER)
  220.                     Do a Hard Reset
  221.  
  222. ---------------------------------------------------------------------------
  223.  
  224. I could not guarantee for the correctness of this description.
  225.  
  226.                         AMIGA MAKES ALL POSSIBLE
  227.  
  228. Have fun
  229.  
  230. -Frank
  231.