home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d07xx / d0797.lha / BBBF / Programmers / BootblockLibrary.doc next >
Text File  |  1993-01-10  |  10KB  |  288 lines

  1.  
  2.                           Bootblock.library
  3.                           version 1.0 beta
  4.  
  5.                  Released the 11th of November 1992
  6.  
  7.              Programmed by Johan Eliasson, SHI member.
  8.               Copyright ⌐ Safe Hex International 1992
  9.  
  10.  
  11. INTRODUCTION
  12. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. The Bootblock.library/brainfile is an attempt to make life a little
  14. bit easier for programmers of anti-virus utilities, diskcopy programs,
  15. directory utilities, disk packers and for whoever who wants to check the
  16. bootblock of some device, and of course for you, the user, who are dead-
  17. tired of those %$ú&%$& viruses...
  18. The library has some easy-to-use functions to read the brainfile, and to
  19. check a bootblock with it. The brainfile will be kept in memory for
  20. you by the library, so that more than one program can use it simultaneously.
  21. I know this doc is short, but take a look at my CheckDrive.c source
  22. and you will get it. If not, write me a letter!
  23.  
  24. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. LEGAL STUFF
  26. ~~~~~~~~~~~
  27. The BBBF package is freely distributable as long as all of its files are
  28. included in their original form without additions, deletions, or
  29. modifications of any kind, with the following exception:
  30. If your program uses the Bootblock.library/Bootblock.brainfile then they
  31. may be distributed along with it.
  32. If you use this library in your program you must give credit to SHI (like
  33. the note below) and the programmer in your documentation.
  34. The BBBF package may not be used in a commercial program without written
  35. permission by Safe Hex International.
  36. Only a nominal fee (maximum 6$) may be charged for the distribution of BBBF.
  37. This software is provided "AS IS" without warranty of any kind, either
  38. expressed or implied. By using the BBBF package, you agree to accept the
  39. entire risk as to the quality and performance of the program.
  40.  
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.    Some Notes About SHI
  43.     --------------------
  44.     I'm  member  of  SHI  (Safe Hex International) a world wide Amiga user-
  45.     group,  special  founded  to  get  the  Amiga more popular and to fight
  46.     against virus spreading.
  47.  
  48.     ABOUT SAFE HEX INTERNATIONAL
  49.     If you know  a virus  programmer you  can get a  reward of  $ 1000  for
  50.     supplying his name and address. The fact is that the law punishes  data
  51.     crime very severely (5 years in jail in most countries).
  52.     We are an international user group with more than 500 members, who have
  53.     started trying to stop the spreading  of viruses. Let me give you  some
  54.     example:                                                               
  55.  
  56.         1. Our motto is: "Safe Hex, who dares do anything else today?".
  57.         2. A virus bank containing all well known virus killer programmes.
  58.         3. We help people to get money back lost by virus infection.
  59.         4. We  write articles about virus problems for 9 Amiga magazines.
  60.         5. We release the newest and the best virus killers around.
  61.         6. We have more than 30 "Virus Centers" worldwide where you can get 
  62.            free virus help by phoning our "Hotlines", and of cause get the 
  63.            newest virus killers too translated in your own.... language for 
  64.            a very little cost.
  65.  
  66.     For more information contact:
  67.  
  68.         SAFE HEX INTERNATIONAL            (Please send 2 "Coupon-Response 
  69.         Erik Loevendahl Soerensen         International" and a self addres-
  70.         Snaphanevej 10                    sed envelope, if you want more
  71.         DK-4720 Praestoe                  information about SHI by letter)
  72.         Denmark                             
  73.         Phone: + 45 55 99 25 12
  74.         Fax  : + 45 55 99 34 98
  75.  
  76.  
  77. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  78. TABLE OF CONTENTS
  79.  
  80. Bootblock.library/ReadBBBF
  81. Bootblock.library/FreeBBBF
  82. Bootblock.library/CheckBoot
  83. Bootblock.library/GetBBBFInfo
  84. Bootblock.librray/ListBBBF
  85.  
  86. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. Bootblock.library/ReadBBBF
  88.  
  89.   result = ReadBBBF(name);
  90.  
  91.   long     ReadBBBF(char *);
  92.                     A0
  93.  
  94.   DESCRIPTION
  95.     Will read the Bootblock.brainfile from name, and keep it in memory
  96.     for you until you FreeBBBF() it.
  97.  
  98.   INPUTS
  99.     name = "L:Bootblock.brainfile" or wherever you want to load it from.
  100.  
  101.   RESULT
  102.     result = errorcode.
  103.     if result >  0  then result is the code returned by IoErr() in case
  104.                     of an IO error. Use Fault() to get the meaning of that.
  105.     if result =  0  then the brainfile is successfully loaded and
  106.                     everything's fine.
  107.     if result = -1  It was no brainfile...strange...
  108.                 -2  Corrupted brainfile. Someone has fiddled with it.
  109.                 -3  Already loaded by someone else!
  110.                 -4  No memory for brainfile. Free some and try again...
  111.  
  112.  
  113. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. Bootblock.library/FreeBBBF
  115.  
  116.   result = FreeBBBF();
  117.  
  118.   void     FreeBBBF(void);
  119.  
  120.  
  121.   DESCRIPTION
  122.     Will free the memory used for the brainfile, ie. unload it.
  123.     If the brainfile is not loaded the function will just return.
  124.  
  125.   INPUTS
  126.     none
  127.  
  128.   RESULT
  129.     none
  130.  
  131. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132. Bootblock.library/CheckBoot
  133.  
  134.   Boot = CheckBoot(buffer,&status);
  135.  
  136.   struct Bootblock *CheckBoot(char *,APTR);
  137.                               A0     A1
  138.  
  139.   DESCRIPTION
  140.  
  141.   INPUTS
  142.     buffer = simply the bootblock that you want to check.
  143.     status = address of an ULONG. Status will afterwards contain one 
  144.              of the following values:
  145.              -1 : Error - The brainfile is not loaded.
  146.               0 : The bootblock is unknown (send it to me!)
  147.               1 : The bootblock is a virus! Kill it!
  148.               2 : The bootblock is not bootable...
  149.  
  150.   RESULT
  151.     Boot    Bootblock struct that contains the name of the bootblock.
  152.             If status != 1 then Boot will be NULL.
  153.  
  154.   NOTES
  155.     If the bootblock is a virus, then you'll have to append ' virus!' to
  156.     the name from the Bootblock structure. It saved me quite a lot of bytes
  157.     in the brainfile. 200 ' virus!' would be 1400 bytes...
  158.     I hope you don't mind!
  159.  
  160. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  161. Bootblock.library/GetBBBFInfo
  162.  
  163. result = GetBBBFInfo(&virus,version);
  164.  
  165. long     GetBBBFInfo(USHORT *,char[30]);
  166.                      A0       A1
  167.  
  168.   DESCRIPTION
  169.  
  170.   INPUTS
  171.     virus   = will contain the number of viruses known by this brainfile.
  172.     version = string that will contain the brainfile version-string,
  173.               without the '$VER: '.
  174.  
  175.   RESULT
  176.    result   If result == -1 then the brainfile is not loaded.
  177.             If success then result will be 0.
  178.  
  179.  
  180. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  181. Bootblock.library/ListBBBF
  182.  
  183. Boot = ListBBBF()
  184.  
  185. struct Bootblock *ListBBBF(void)
  186.  
  187.   DESCRIPTION
  188.     This function returns the pointer to the first Bootblock structure.
  189.     Useful for listing all known bootblocks etc.
  190.  
  191.   INPUTS
  192.     none
  193.  
  194.   RESULT
  195.     Boot   Pointer to the first Bootblock structure, or
  196.            NULL == the brainfile is not loaded.
  197.  
  198. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199. Bootblock.library/ReadBoot
  200.  
  201. result = ReadBoot(drive,buffer);
  202.  
  203. ULONG    ReadBoot(ULONG,char *);
  204.                   D0    A0
  205.  
  206.   DESCRIPTION
  207.  
  208.     This function will read the bootblock from the desired drive,
  209.     using the trackdisk.device and CMD_READ.
  210.  
  211.   INPUTS
  212.  
  213.     drive  = drive number (0-3)
  214.  
  215.     buffer = the destination of the bootblock. Must be at least 1024
  216.              bytes. Note that it must be in chip ram if running
  217.              under kickstart V36 or below.
  218.  
  219.   RESULT
  220.  
  221.     result = either NULL = success,
  222.              or the errorcode returned by IoErr(),
  223.              Could occur during the OpenDevice() (see <exec/errors.h>
  224.              or the bootread (see <devices/trackdisk.h>)
  225.              It can also be 103 (out of memory).
  226.  
  227. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  228.  
  229. LIBRARY HISTORY
  230. ~~~~~~~~~~~~~~~
  231.  
  232. Version 0.9 beta
  233. ~~~~~~~~~~~~~~~~
  234. First version.
  235.  
  236. Version 0.91 beta
  237. ~~~~~~~~~~~~~~~~~
  238. Removed all non-virus bootblocks from the brainfile upon request from
  239. Erik Loevendahl Soerensen. Now you will only be alerted if the bootblock
  240. contains a virus, anti-virus, or any other suspicious resident program.
  241. This is for speed and so that the user won't be bothered with messages
  242. like 'This bootblock is the MegaSuperDemoLoader 32.84' all the time.
  243. The GetBBBFInfo() function is changed accordingly.
  244. I have tried to clean up this doc a bit too. There were a few obvious
  245. mistakes that I guess you spotted.
  246. BBBF now knows 171 original viruses, and a vast number of clones.
  247.  
  248. Version 0.92 beta (15.10.92)
  249. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  250. V 0.91 didn't recognize the Chameleon (little Sven) virus correctly.
  251. Instead of adding a short piece of code to deal with that, I rewrote
  252. the complete brainfile-system, so it will be easier to add new viruses
  253. to the brainfile from now on. As a result of that, the Bootblock structure
  254. has changed a bit. Also, ReadBBBF() and CheckBoot() are a little bit slower,
  255. and the brainfile is 656 bytes bigger......but a lot safer!
  256. BBBF now knows 164 original viruses, and a vast number + 7 clones.
  257.  
  258. Version 0.93 beta (05.11.92)
  259. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  260. Bug fix: If the brainfile-reading was interrupted due to lack of memory,
  261.          the already allocated memory would not be freed correctly. 
  262.  
  263. Version 1.0 (11.11.92)
  264. ~~~~~~~~~~~~~~~~~~~~~~
  265. New function - ReadBoot().
  266. I also optimized the library down to 2876 bytes!
  267.  
  268.  
  269. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  270. Well, that's all for now!
  271.  
  272. Please, I need your opinions! Even if you have no complaints nor ideas
  273. it's nice just to hear that it works... 8-)
  274. Send new viruses, ideas, threats and harddrives to:
  275.  
  276.              Johan Eliasson             Phone: +46 11 169138
  277.              BΣckgatan 6
  278.              60358 Norrk÷ping
  279.              SWEDEN
  280.  
  281. Thanks goes to Magnus Holmgren and Tommy Hallgren for helping out with my
  282. C troubles, Tommy Hallgren and Mats Erlandsson for testing!
  283. Erik Loevendahl Soerensen at SHI for all his support.
  284. John Lohmeyer, whose Interpret.library I used as a model when designing
  285. this library. Thanks guys!
  286.  
  287. END OF DOC.
  288.