home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d919 / bbbf.lha / BBBF / FileVirLib / RL.Doc < prev    next >
Text File  |  1993-10-04  |  15KB  |  432 lines

  1. ****************************************************************************
  2. *                    REMOVELINK.LIBRARY VERSION 32-25 DOC                  *
  3. *                                                                          *
  4. *                                                                          *
  5. *                            Update 24-08-93                               *
  6. *                                                                          *
  7. *                 Copyright © Safe Hex International 1993                  *
  8. *                                                                          *
  9. ****************************************************************************
  10.  
  11.  
  12.  
  13. Welcome to this release version of this library. I hope it's a library
  14. you can use in your virus killer or whatever you are doing. This library
  15. purpose is to help a viruskiller programmer or another file utility to find 
  16. virus infected files. 
  17.  
  18. This library is copyrighted by SHI and may NOT be used in commercial
  19. programs without a written permission from SHI. All the SHI members and
  20. shareware programmers can of course use this library for free. Remember to 
  21. send your address and program to SHI, to get a written premission.
  22.  
  23.  
  24. Please  add  the "Wanted-Viruses.txt" (a list containing wanted viruses for
  25. update),  and  remember  to credit the author (Johan Öhman) and SHI in your
  26. program as stated in the following:
  27.  
  28.  
  29. Here is a little message about SHI:
  30. ----------------------------------------------------------------------------
  31.  
  32. ABOUT SAFE HEX INTERNATIONAL
  33. If  you   know  a  virus  programmer  you  can  get  a reward of $ 1000 for
  34. supplying  his  name  and  address.  The fact is that the law punishes data 
  35. crime very severely. (5 years in jail in most countries).
  36.  
  37. We  are an international group with more than 500 members  who have started 
  38. trying to stop the spread of virus. Let me give you some example:
  39.  
  40.         1. Our motto is: "Safe Hex", who dares do anything else today?".
  41.         2. A virus bank containing more than 1800 Amiga and PC viruses for
  42.            supporting good shareware antivirus programs.
  43.         3. We help people to get money back lost by virus infection.
  44.         4. We write articles about virus problems for about 20 computer 
  45.            magazines worldwide.
  46.         5. We release the newest and the best virus killers around from 
  47.            about 25 wellknown programmers worldwide.
  48.         6. We have more than 35 PC and Amiga "Virus Centers" worldwide 
  49.            where you can get free virus help by phoning our "Hotline", and 
  50.            the newest killers translated in your own language at very 
  51.            little cost.
  52.  
  53. For more information contact:
  54.  
  55.         SAFE HEX INTERNATIONAL            (Please send 2 "Coupon-Response 
  56.         Erik Loevendahl Soerensen         International" and a self addres-
  57.         Snaphanevej 10                    sed envelope, if you want infor-
  58.         DK-4720 Praestoe                  mation about SHI by letter).
  59.         Denmark                             
  60.         Phone: + 45 55 99 25 12
  61.         Fax  : + 45 55 99 34 98
  62.  
  63. ----------------------------------------------------------------------------
  64.  
  65.  
  66. BASIC NEEDS:    Some wierd kind of documentation for programmers
  67.  
  68.         (Knowledge of MC68000 code is needed,plus
  69.         basic knowledge of 'C' to understand this fully...)
  70.  
  71.         (C) Copyright SHI,
  72.         written by Johan Öhman 1993
  73.  
  74.  
  75.     For 'removelink.library' version 32.000 and higher 
  76.         (first public release of the library)
  77.  
  78. Legal:    
  79.     THIS PACKAGE SHOULD CONTAIN:
  80.  
  81.     RL.doc            (this file)
  82.     Removelink.i        (assembler include file)
  83.     Removelink_lib.i    (assembler include file)
  84.     TestProg1.s        (assembler test prog)
  85.     TestProg2.s        (assembler test prog)
  86.     removelink.library    (the library itself)        
  87.     WantedViruses        (a list containing wanted viruses)
  88.  
  89.  
  90.     * All parts are of this package are written by Johan Öhman,
  91.       and are therefor legal properties of the autor.
  92.       The contents are copyright Safe Hex Internatioal
  93.       No profit may be made of these products,
  94.       unless you have a written permission from the autor himself.
  95.       (A small amount like 5 US$ is OK, for copycharges and like)
  96.  
  97.       The only exception to this, are public domain disks like the
  98.       Fred Fish collection.
  99.  
  100.  
  101.     "RemoveLink library ...
  102.     What the f..k is that ?
  103.     I have a lot'a libraries, as I can't programme, or
  104.     understand any of ...
  105.     I don't need this one ..."
  106.     
  107. This was my personal expericence of many libraries, so my goal was
  108. to write a library that was relatively simple to use, not to big,
  109. and most important; usefull.
  110.  
  111. That is what RL is, and what it does it very important today,
  112. when our Amigas are attacked by viruses from all corners of the world,
  113. that is - Removing viruses from disk (files/sectors) and from memory.
  114.  
  115. My second reason was that many disk/file handeling programmes could easly
  116. be expanded and get viruskillerfeatures, which by my means would 
  117. decrease the spreading of viruses very much, or at least (more pessemisticly)
  118. don't help spreading.
  119.  
  120. This is the first stabil version (32.000) and won't change to much now.
  121. All the most important things are covered in this version.
  122. Older versions won't be compatible with ver 32+, but those are very
  123. buggy, so don't use these.
  124. From ver 32 all libraries will be backwards compatible, so you can
  125. use older libraries (but remember, the newer library, the safer Amiga).
  126.  
  127. Very important:
  128.     This is a LINK/FILE removing library.
  129.     No other (like bootblock-type) viruses are covered whatsoever...
  130.     (For bootblocks; use the library written by Johan Eliasson).
  131.  
  132. Now to the programming of the library:
  133.  
  134. -    Opening of the library is made like any other disk-based
  135.     library.
  136.  
  137. *
  138. start:    ...
  139.     ...
  140.     ...
  141.     move.l    SysBase,a6
  142.     moveq    #32,d0
  143.     CallExec    OpenLibrary
  144.     move.l    d0,RLBase
  145.  
  146.  
  147. -    The first thing you should do when you use the library (after
  148.     opening) is to allocate some memory by using the 'AllocRLTableMem'
  149.     function.
  150.     I strongly recomend you to use this function, or else your 
  151.     programme won't work when using future versions of RL.lib.
  152.  
  153.     CallRL    AllocRLTableMem
  154.     move.l    d0,RL_StructPtr
  155.  
  156. -    This function is the only function which will return
  157.     a result into a register.
  158.     If you there's not enough memory, NULL will be returned instead
  159.     (Happens rarely, due to the low number of bytes required)
  160.  
  161. *    move.l    RL_StructPtr,a0
  162.     CallRL    KillMemVirus
  163.  
  164. -    Is a good continuation, which will remove any of the covered viruses
  165.     from memory.
  166.     Please notice that the RL_StructPtr MUST be in reg. A0 whenever
  167.     you call any function in the library.
  168.  
  169.     Let's suppose you had the 'CCCP' virus in memory a structure would
  170.     be initialized within the RL_Struct, looking like this:
  171.  
  172.     RemoveLinkStruct:
  173.     (struct*)    FileInfection
  174.     (struct*)    MemoryInfection=
  175.             {
  176.     >>>        APTR     NULL    (No more memory-infection)
  177. ==========>>>        CHAR*    'CCCP'    (a pointer to the 'CCCP' string)
  178. ===========>>>>        ULONG     -1    (This virus has no copycount)
  179. ==========>>>
  180.     >>>        }
  181.  
  182.     ...    (and a lot of more data)
  183.  
  184. -    Please notice that most of the fields are read-only,
  185.     (all except for RL_BufferPtr,RL_BufferLen and RL_SectorOffset)
  186.     ie. should only be READ, not altered.
  187.  
  188.  
  189.     ... Well, our virus is dead, but we suspect that the virus has
  190.     infected some files on the disk.
  191.     We find out by random that the file 'PowerPacker2.2a'
  192.     is infected.
  193.     What to do ?
  194.     Let's assume the file is loaded at $50000 (=0x050000)
  195.     and contains 46500 bytes
  196.  
  197.  
  198. *    move.l    RL_StructPtr,a0
  199.     move.l    #$0050000,RL_BufferPtr(a0)
  200.     move.l    #0046500,RL_BufferLen(a0)
  201.     CallRL    RemoveVirus
  202.  
  203. -    Voila - The file will be stripped from the virus
  204.     (The _LVOGetName works almost thesame.
  205.      The difference is that _LVOGetName will not alter any
  206.      parts of the file, or RL_Structure)
  207.  
  208.     If you wanto to print the name, that is possible too:
  209.  
  210. *    move.l    RL_StructPtr,a0
  211.     move.l    RL_FileInfection(a0),a0    
  212.                 ;-Get into the structure which
  213.                 ;has been created by the function above
  214.  
  215.     move.l    FI_VirusName(a0),-(sp)    ;FI_ as in FileInfection[Node]
  216.                     ;and we have the name of the virus on
  217.                     ;the stack
  218.     jsr    _printf
  219.     addq.w    #4,Sp            ;Return the stack
  220.  
  221. -    The name will then be printed into you CLI-window or standard
  222.     output window.
  223.  
  224.     Please notice that I just READ the fields, not alter them.
  225.  
  226.     One important thing about the FI_ / MI_ fields:
  227.     After allocation (_LVOAllocRLTableMem) those are set to zero,
  228.     and they won't change until you use a function which changes
  229.     them for you.
  230.     After every functioncall the corresponding structure will be 
  231.     set to zero if there were no infection, or pointing at a sub-
  232.     structure on infection.
  233.  
  234.     This was ment to be used like a status-check for infection,
  235.     ie.    If you for instance load an infected file and use
  236.         the _LVORemoveVirus (a FILE-based function) the
  237.         RL_>>>File<<<Infection will be pointing at the name
  238.         etc. of the virus.
  239.         Else if our file was NOT infected, the RL_FileInfection field
  240.         will be NULL.
  241.         Therefor we can check for FILE-infection by checking if the
  242.         RL_>>>File<<<Infection field.
  243.  
  244.  
  245.  
  246.  
  247. Section2:
  248.  
  249. -    We have talked about memoryinfections and fileinfections,
  250.     but not SECTOR-INFECTIONS.
  251.  
  252.     The sector-infection is nothing but a infection of a data-sector
  253.     of the disk. 
  254.     The infection is usually made by the 'SADDAM' virus (or any of
  255.     the many SADDAM clones), and the purpuse is that the virus
  256.     has to be in memory for the disk-reading routines to read and decode
  257.     the sectors properly.
  258.     The library can handle those too.
  259.     A number of special fields are dedicated to this;
  260.     When reading a 'SADDAM' file, a special flag will be set in the
  261.     RL_Structure. The RL_NeedsRepair flag, and as the name of the field
  262.     shows, the disk (probably) needs to be repaired.
  263.  
  264.     Then you initiallize a trackdisk - supporting programme
  265.     and want to use the library.
  266.  
  267. *    move.l    #CMD_READ,IO_COMMAND(a1)
  268.     move.l    #$50000,IO_BUFFER(a1)
  269.     move.l    #512,IO_LEN(a1)
  270.     move.l    OFFSET,IO_OFFSET(a1)
  271.     CallExec    DoIO
  272.  
  273.     ;And now we have read the specified sector.
  274.     ;Now we want to decode it.
  275.     ;We have to init the
  276.  
  277.     move.l    RL_Structure,a0
  278.     move.l    OFFSET,RL_SectorOffset(a0)
  279.  
  280.                 ;This field has to be init. too, or else
  281.                 ;the function won't be able to decode the
  282.                 ;datablock in order.
  283.     
  284.     move.l    #$50000,RL_BufferPtr(a0)
  285.                 ;Where in memory
  286.     move.l    #>>>512<<<<,RL_BufferLen(a0)
  287.                  ;Important:
  288.                  ;the library can't handle more than 512 bytes
  289.                  ;a time. The Length-field has to be 512.
  290.     CallRL    DeCodeDataBlock
  291.  
  292. -    The specified datablock will now be decoded,
  293.     and if the datablock was infected the 'RL_SectorInfec' field will be
  294.     <>NULL.
  295.     A name pointer is available through 'RL_SectorVName' too.
  296.  
  297. Last:
  298.     When you want to see all the viruses as the library can handle,
  299.     you can get them through the 'RL_VirusList' field, which is
  300.     init. when you use _LVOAllocRLTableMem ...
  301.  
  302.     The structure is as following:
  303.  
  304.     *NextStruct    (NULL if none)
  305.     *VirusName
  306.     
  307.     and the prefix to those is 'VL' as in 'VirusList'.
  308.     The second assembler example shows this list.
  309.  
  310. -------------------------------------------------------------------------------
  311.  
  312. FunctionName:    _LVOAllocRLTableMem
  313. FunctionOffset:    -30
  314. Description:    Allocates and initializes memory for use by other functions
  315.         in the library.
  316.  
  317. Reply Reg:    d0, a pointer to the allocated area...
  318.  
  319. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  320.  
  321. FunctionName:    _LVOFreeRLTableMem
  322. FunctionOffset:    -36
  323. Description:    Free the initialized memory and sub-structures.
  324.  
  325. Calling reg:    A0    (RL-mem pointer)
  326.  
  327. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  328.  
  329. FunctionName:    _LVOGetFileVirusName
  330. FunctionOffset:    -42
  331. Description:    Gets the name and other info from the file you've previously
  332.         loaded, without altering the file.
  333.  
  334. Calling reg:    A0    (RL-mem pointer)
  335.  
  336. Other References:        See _LVORemoveFileVirus
  337.  
  338. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  339.  
  340. FunctionName:    _LVORemoveFileVirus
  341. FunctionOffset:    -48
  342. Description:    Strips the file you've previously loaded, from linkviruses
  343.         and sets up a node (the FileInfection-node).
  344.  
  345.         From that node can you get virusname/infectiontimes/
  346.         copycount ('CC' - not in lib. ver 32.000).
  347.  
  348.  
  349. Calling reg:    A0    (RL-mem pointer)
  350.  
  351. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  352.  
  353. FunctionName:    _LVODeCodeDataBlock
  354. FunctionOffset:    -54
  355. Description:    Decodes ONE infected sector-data-block.
  356.         Returns: virusname/if infected/.
  357.  
  358. Calling reg:    A0    (RL-mem pointer)
  359.  
  360. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  361.  
  362. FunctionName:    _LVOGetFileVirusName
  363. FunctionOffset:    -42
  364. Description:    Strips the file you've previously loaded, from linkviruses
  365.         and sets up a node (the FileInfection-node).
  366.  
  367.         From that node can you get virusname/infectiontimes/
  368.         copycount (not in lib. ver 32.000).
  369.  
  370. Calling reg:    A0    (RL-mem pointer)
  371.  
  372. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  373.  
  374. FunctionName:    _LVOGetMemName
  375. FunctionOffset:    -60
  376. Description:    Gets the name of the virus which has infected memory.
  377.         Sets up a 'MemoryInfection' structure.
  378.  
  379. Calling reg:    A0    (RL-mem pointer)
  380.  
  381. Other references:    See _LVOKillMemVirus
  382.  
  383. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  384.  
  385. FunctionName:    _LVOKillMemVirus
  386.  
  387. FunctionOffset:    -66
  388. Description:    Removes the virus which infected memory.
  389.         Info on the virus is available through the 'MemoryInfection'
  390.         field.
  391.  
  392. Calling reg:    A0    (RL-mem pointer)
  393.  
  394. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  395.  
  396. Others:
  397.  
  398.     When examining a file the 
  399.     'RL_BufferPtr' field must point at the start of the file, and
  400.     'RL_BufferLen' field must be the length of the file, which was read.
  401.  
  402.     When examining a sector additionally the
  403.     'RL_SectorOffset'    field must be thesame as the field 
  404.                 'io_offset' in the 'IOStdReq'-structure.
  405.     and
  406.     'RL_BufferPtr' field must be pointing at the memorylocation where the
  407.             read sector is.
  408.     'RL_BufferLen' field MUST BE 512, or else the sector wont be decoded.
  409.  
  410.     When examining memory (using _LVOGetMemName/_LVOKillMemVirus)
  411.     you don't have to/should not initialize any of the structures above.
  412.  
  413.  
  414.  
  415. I really hope you can use this library.  If you find any grammatical errors
  416. in  this  doc file, feel free to correct them, and send them to me.  And of
  417. course  any  new  viruses.  Please see in the "Wanted-Viruses.Txt" for more
  418. info!  Thank you very much,
  419.  
  420.  
  421.  
  422.  
  423.     WE NEED YOUR HELP TO GET THIS LIBRARY EVEN BETTER, THANK YOU VERY MUCH!
  424.  
  425.  
  426.  
  427. Johan Öhman                Member of the SHI Anti Virus Group.                
  428. Geografigränd 6A
  429. S-90732 Umeå                                                    
  430. Sweden
  431.  
  432. Phone: + 46 90 193 274