home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / util / libs / pplib / doc / pplib.doc
Text File  |  1993-12-21  |  23KB  |  679 lines

  1. TABLE OF CONTENTS
  2.  
  3. powerpacker.library/ppAllocCrunchInfo
  4. powerpacker.library/ppCalcChecksum
  5. powerpacker.library/ppCalcPasskey
  6. powerpacker.library/ppCrunchBuffer
  7. powerpacker.library/ppCrunchBufferDest
  8. powerpacker.library/ppDecrunchBuffer
  9. powerpacker.library/ppDecrypt
  10. powerpacker.library/ppEnterPassword
  11. powerpacker.library/ppErrorMessage
  12. powerpacker.library/ppFreeCrunchInfo
  13. powerpacker.library/ppGetPassword
  14. powerpacker.library/ppLoadData
  15. powerpacker.library/ppWriteDataHeader
  16. powerpacker.library/ppAllocCrunchInfo   powerpacker.library/ppAllocCrunchInfo
  17.  
  18.   NAME  ppAllocCrunchInfo()  (V35)
  19.  
  20.     crunchinfo = ppAllocCrunchInfo (efficiency, speedup, function, userdata);
  21.  
  22.     APTR ppAllocCrunchInfo (ULONG, ULONG, BOOL (*)(), APTR);
  23.     D0                      D0     D1     A0          A1
  24.  
  25.   DESCRIPTION
  26.     Allocate all the necessary memory needed to crunch a buffer. This
  27.     function must be called before using ppCrunchBuffer.  You must pass
  28.     the crunching efficiency and the size of the speedup buffer.
  29.  
  30.     You can pass a callback function to be called during crunching. Use this
  31.     type of function:
  32.  
  33.     BOOL __stdargs myFunction (ULONG lensofar, ULONG crunlen,
  34.                                ULONG totlen, APTR userdata);
  35.  
  36.     If you do not wish to use this feature pass a NULL. The function can be
  37.     used for two things:
  38.  
  39.       o to display the percentage crunched and gain so far.
  40.       o to allow the user to abort crunching.
  41.  
  42.     Your function will be passed four arguments (on the stack, normal C
  43.     conventions):
  44.  
  45.       lensofar - length of part crunched so far.
  46.       crunlen  - crunched length of lensofar.
  47.       totlen   - total length of buffer.
  48.       userdata - the userdata you provided to ppAllocCrunchInfo().
  49.  
  50.     If your function returns a non-zero value the crunching will continue,
  51.     returning zero will abort crunching.
  52.  
  53.     SAS/C users shouldn't forget __saveds if they compiled their program with
  54.     the small data model and wish to use global data in their function.
  55.     If you write your function in assembly please preserve all registers.
  56.  
  57.     Example:
  58.  
  59.     BOOL __stdargs __saveds myfunc (ULONG sofar, ULONG crunlen,
  60.                                     ULONG totlen, APTR userdata)
  61.     {
  62.        struct IntuiMessage *msg;
  63.        UWORD code;
  64.  
  65.        if (sofar) {
  66.           sprintf (buff, "%ld%% crunched. (%ld%% gain)   ",
  67.              (sofar * 100) / totlen, 100 - (100 * crunlen) / sofar);
  68.           PrtMsg (buff, BLACK|AT_START);
  69.           }
  70.        while (msg = (struct IntuiMessage *)GetMsg (win->UserPort)) {
  71.           code = msg->Code;
  72.           ReplyMsg ((struct Message *)msg);
  73.           if (code == 0x3 /* CTRL-C */) return (FALSE);
  74.           }
  75.        return (TRUE);
  76.     }
  77.  
  78.     Finally note that you may scratch the A4 register.  This is made possible
  79.     to help people who wish to use 'userdata' to pass A4 (C data pointer).
  80.  
  81.   INPUTS
  82.     efficiency - the efficiency of the crunching. One of the
  83.                  following (defined in "libraries/ppbase.[hi]"):
  84.                     CRUN_FAST
  85.                     CRUN_MEDIOCRE
  86.                     CRUN_GOOD
  87.                     CRUN_VERYGOOD
  88.                     CRUN_BEST
  89.     speedup    - size of speedup buffer to be used. One of the
  90.                  following (defined in "libraries/ppbase.[hi]"):
  91.                     SPEEDUP_BUFFSMALL  - from 3K (fast) to 33K (best)
  92.                     SPEEDUP_BUFFMEDIUM - from 5K (fast) to 65K (best)
  93.                     SPEEDUP_BUFFLARGE  - from 196K (fast) to 256K (best)
  94.     function   - callback function to be called every so often during
  95.                  crunching. Can be used to display percentage crunched
  96.                  so far and to abort crunching.
  97.     userdata   - anything you wish. Will be passed to your callback function.
  98.  
  99.   RESULT
  100.     crunchinfo - pointer to private crunchinfo structure to be passed to
  101.                  ppCrunchBuffer (use ppFreeCrunchInfo to deallocate).
  102.  
  103.   NOTE
  104.     'crunchinfo' may be re-used to crunch several buffers.
  105.  
  106.   BUGS
  107.     none known
  108.  
  109.   SEE ALSO
  110.     ppFreeCrunchInfo(), ppCrunchBuffer()
  111.  
  112. powerpacker.library/ppCalcChecksum         powerpacker.library/ppCalcChecksum
  113.  
  114.   NAME  ppCalcChecksum()
  115.  
  116.     sum = ppCalcChecksum (string);
  117.  
  118.     ULONG ppCalcChecksum (char *);
  119.     D0:16                 A0
  120.  
  121.   DESCRIPTION
  122.     This function calculates a 16 bit checksum of a given string of
  123.     characters.
  124.  
  125.   INPUTS
  126.     string - pointer to a null terminated character string.
  127.  
  128.   RESULT
  129.     sum - checksum of 'string'.
  130.  
  131.   NOTE
  132.     Function used to check if a password is correct.
  133.     Upper 16 bits of checksum are 0.
  134.  
  135.   BUGS
  136.     none
  137.  
  138.   SEE ALSO
  139.     ppLoadData()
  140.     ppDecrunchBuffer()
  141.     ppDecrypt()
  142.     ppCalcPasskey()
  143.  
  144. powerpacker.library/ppCalcPasskey           powerpacker.library/ppCalcPasskey
  145.  
  146.   NAME  ppCalcPasskey()
  147.  
  148.     key = ppCalcPasskey (password);
  149.  
  150.     ULONG ppCalcPasskey (char *);
  151.     D0                   A0
  152.  
  153.   DESCRIPTION
  154.     This function calculates the 32 bit key associated with the given
  155.     password to encrypt/decrypt crunched files with.
  156.  
  157.   INPUTS
  158.     string - pointer to a null terminated character string.
  159.  
  160.   RESULT
  161.     key - passkey corresponding to the given password.
  162.  
  163.   NOTE
  164.     Function used to decrypt encrypted files.
  165.  
  166.   BUGS
  167.     none
  168.  
  169.   SEE ALSO
  170.     ppDecrunchBuffer()
  171.     ppDecrypt()
  172.     ppCalcChecksum()
  173.  
  174. powerpacker.library/ppCrunchBuffer         powerpacker.library/ppCrunchBuffer
  175.  
  176.   NAME  ppCrunchBuffer()  (V35)
  177.  
  178.     crunchedlen = ppCrunchBuffer (crunchinfo, buffer, len);
  179.  
  180.     ULONG ppCrunchBuffer (APTR, UBYTE *, ULONG);
  181.     D0                    A0    A1       D0
  182.  
  183.   DESCRIPTION
  184.     Crunch the buffer pointed to by 'buffer' and of length (in bytes) 'len'.
  185.     'crunchinfo' must have been previously allocated by ppAllocCrunchInfo().
  186.  
  187.     During crunching your callback function will be called (if you have
  188.     provided one).  See the autodoc for ppAllocCrunchInfo() for more
  189.     information.
  190.  
  191.     The value returned is the length of the crunched buffer.  If you wish to
  192.     save this crunched buffer as a PowerPacker data file you should first
  193.     write the data header using ppWriteDataHeader() en then write the
  194.     crunched buffer.
  195.  
  196.   INPUTS
  197.     crunchinfo  - pointer to private crunchinfo structure returned by
  198.                   ppAllocCrunchInfo().
  199.     buffer      - pointer to buffer to be crunched.
  200.     len         - length of buffer to be crunched.
  201.  
  202.   RESULT
  203.     crunchedlen - length of crunched buffer. In case of an error
  204.                   'crunchedlen' may also equal PP_CRUNCHABORTED or
  205.                   PP_BUFFEROVERFLOW.  Be sure to check this!
  206.  
  207.   NOTE
  208.     Be sure you know what you are doing when you intend to use this function.
  209.     You can easily crash your Amiga by passing wrong arguments or by writing 
  210.     a faulty callback function.
  211.  
  212.   BUGS
  213.     none known
  214.  
  215.   SEE ALSO
  216.     ppCrunchBufferDest(), ppAllocCrunchInfo(), ppFreeCrunchInfo()
  217.  
  218. powerpacker.library/ppCrunchBufferDest powerpacker.library/ppCrunchBufferDest
  219.  
  220.   NAME  ppCrunchBufferDest()  (V36)
  221.  
  222.     crunchedlen = ppCrunchBufferDest (crunchinfo, buffer, dest, len);
  223.  
  224.     ULONG ppCrunchBufferDest (APTR, UBYTE *, UBYTE *, ULONG);
  225.     D0                        A0    A1       A2       D0
  226.  
  227.   DESCRIPTION
  228.     Crunch the buffer pointed to by 'buffer' and of length (in bytes) 'len'.
  229.     'crunchinfo' must have been previously allocated by ppAllocCrunchInfo().
  230.     The buffer will be crunched to the destination buffer you must provide.
  231.     The destination buffer must be at least as large as the original buffer.
  232.  
  233.     During crunching your callback function will be called (if you have
  234.     provided one).  See the autodoc for ppAllocCrunchInfo() for more
  235.     information.
  236.  
  237.     The value returned is the length of the crunched buffer.  If you wish to
  238.     save this crunched buffer as a PowerPacker data file you should first
  239.     write the data header using ppWriteDataHeader() en then write the
  240.     crunched destination buffer.
  241.  
  242.   INPUTS
  243.     crunchinfo  - pointer to private crunchinfo structure returned by
  244.                   ppAllocCrunchInfo().
  245.     buffer      - pointer to buffer to be crunched.
  246.     dest        - pointer to buffer to store crunched data in.
  247.     len         - length of buffer to be crunched.
  248.  
  249.   RESULT
  250.     crunchedlen - length of crunched buffer. In case of an error
  251.                   'crunchedlen' may also equal PP_CRUNCHABORTED or
  252.                   PP_BUFFEROVERFLOW.  Be sure to check this!
  253.  
  254.   NOTE
  255.     Be sure you know what you are doing when you intend to use this function.
  256.     You can easily crash your Amiga by passing wrong arguments or by writing 
  257.     a faulty callback function.
  258.  
  259.   BUGS
  260.     none known
  261.  
  262.   SEE ALSO
  263.     ppCrunchBuffer(), ppAllocCrunchInfo(), ppFreeCrunchInfo()
  264.  
  265. powerpacker.library/ppDecrunchBuffer     powerpacker.library/ppDecrunchBuffer
  266.  
  267.   NAME  ppDecrunchBuffer()
  268.  
  269.     ppDecrunchBuffer (endcrun, decrbuff, effptr, col);
  270.  
  271.     void ppDecrunchBuffer (UBYTE *, UBYTE *, ULONG *, ULONG);
  272.                            A0       A1       A2       D0
  273.  
  274.   DESCRIPTION
  275.     Function to decrunch from one memory location to another. The address of
  276.     the destination can be as close as 8 bytes after the start address of
  277.     the source, so you can decrunch a file with almost no memory overhead.
  278.  
  279.     If you wish to call this function you need to know the format of a
  280.     crunched file:
  281.  
  282.         1 longword identifier           'PP20' or 'PX20'
  283.        [1 word checksum (if 'PX20')     $ssss]
  284.         1 longword efficiency           $eeeeeeee
  285.         X longwords crunched file       $cccccccc,$cccccccc,...
  286.         1 longword decrunch info        'decrlen' << 8 | '8 bits other info'
  287.  
  288.     The following procedure must be followed to decrunch a file:
  289.  
  290.     First you must read 'decrunch info' to find the length of the decrunched
  291.     file, then you must allocate memory to decrunch it in (shift 'decrunch
  292.     info' right 8 bits and add a safety margin (8 bytes) to get the length
  293.     of this memory block).  If the file is encrypted ('PX20') you must call
  294.     ppDecrypt to decrypt the crunched part before calling ppDecrunchBuffer.
  295.  
  296.     So:
  297.     - read identifier.
  298.     - if PX20, read checksum (16 bits, not 32!).
  299.     - read efficiency.
  300.     - read the longword of decrunch info at the end of the file.
  301.     - calculate 'decrlen'.
  302.     - allocate 'decrlen' + 8 (safety margin) bytes.
  303.     - load 'crunched file' and 'decrunch info' at start of allocated memory.
  304.     - if PX20, prompt for a password (check result of ppGetPassword()!).
  305.     - if PX20, calculate the passkey (use ppCalcPasskey).
  306.     - if PX20, call ppDecrypt to decrypt 'crunched file' only.
  307.       (NOT 'decrunch info'!)
  308.     - and finally call ppDecrunchBuffer() with 'endcrun' pointing right after
  309.       'decrunch info', 'decrbuff' pointing 8 bytes after where you loaded the
  310.       file and 'effptr' pointing to the 'efficieny' longword.
  311.  
  312.     If this seems complicated that is probably because it is :-) ppLoadData
  313.     was written to make things simpler and should suffice in most cases.
  314.  
  315.     WARNING: 'effptr' is a POINTER to the efficiency longword read, NOT the
  316.              efficiency longword itself!
  317.  
  318.   INPUTS
  319.     endcrun  - pointer just after the last byte of the crunched block.
  320.     decrbuff - pointer to beginning of memory to decrunch to (this must be
  321.                at least 8 bytes behind the start of the crunched file).
  322.     effptr   - pointer to (!) efficiency table.
  323.     col      - decrunching effect (DECR_COL0, DECR_COL1, DECR_POINTER,
  324.                DECR_SCROLL, DECR_NONE).  See also ppLoadData().
  325.  
  326.   RESULT
  327.     none
  328.  
  329.   NOTE
  330.     This function is used by ppLoadData() and will probably not be used very
  331.     often on its own.
  332.  
  333.   BUGS
  334.     none known
  335.  
  336.   SEE ALSO
  337.     ppLoadData()
  338.     ppDecrypt()
  339.     ppCalcPasskey()
  340.     ppCalcChecksum()
  341.     ppGetPassword()
  342.  
  343. powerpacker.library/ppDecrypt                   powerpacker.library/ppDecrypt
  344.  
  345.   NAME  ppDecrypt()
  346.  
  347.     ppDecrypt (buffer, len, key)
  348.  
  349.     void ppDecrypt (UBYTE *, ULONG, ULONG);
  350.                     A0       D0     D1
  351.  
  352.   DESCRIPTION
  353.     This function will decrypt a memory region with a given passkey. It
  354.     must be called before calling ppDecrunchBuffer() (if the file was
  355.     encrypted).
  356.  
  357.     This function can also be used to encrypt files.
  358.  
  359.   INPUTS
  360.     buffer - start address of memory region to decrypt (word alligned !).
  361.     len    - length in bytes of memory region to decrypt (rounded up to the
  362.              next multiple of 4).
  363.     key    - key of password as returned by ppCalcPasskey().
  364.  
  365.   RESULT
  366.     none
  367.  
  368.   NOTE
  369.     If you call this function before calling ppDecrunchBuffer make sure you
  370.     decrypt the correct memory region, don't decrypt the last longword !
  371.  
  372.   BUGS
  373.     none
  374.  
  375.   SEE ALSO
  376.     ppDecrunchBuffer()
  377.     ppCalcChecksum()
  378.     ppCalcPasskey()
  379.     ppLoadData()
  380.  
  381. powerpacker.library/ppEnterPassword       powerpacker.library/ppEnterPassword
  382.  
  383.   NAME  ppEnterPassword()  (V35)
  384.  
  385.     bool = ppEnterPassword (screen, buffer);
  386.  
  387.     BOOL ppEnterPassword (struct Screen *, char *);
  388.     D0                    A0               A1
  389.  
  390.   DESCRIPTION
  391.     reqtools.library _MUST_ be available!
  392.  
  393.     Opens a small requester to prompt the user for a password. The password
  394.     will not be visible when typed. Returns when the user has succesfully
  395.     entered a password AND a verification.
  396.  
  397.     When buffer already holds a string on entry, a 'Last' gadget will appear
  398.     in the requester so the user may re-enter his last password without
  399.     retyping it. It is up to you to support this feature. If you do not wish
  400.     to support this make sure buffer holds an empty string (buffer[0] = 0).
  401.  
  402.   INPUTS
  403.     screen - screen where the requester should appear or NULL.
  404.     buffer - buffer to hold the password. Must be at least 17 bytes big!
  405.  
  406.   RESULT
  407.     bool - TRUE if a password was entered (can be found in buffer), FALSE
  408.            if user aborted the requester.
  409.  
  410.   NOTE
  411.     The contents of the buffer will NOT change if the requester is aborted.
  412.  
  413.     Automatically adjusts the requester to the screen's font.
  414.  
  415.     ppEnterPassword() checks the pr_WindowPtr of your process to find the
  416.     screen to put the requester on (if screen == NULL).
  417.  
  418.   BUGS
  419.     none known
  420.  
  421.   SEE ALSO
  422.  
  423. powerpacker.library/ppErrorMessage         powerpacker.library/ppErrorMessage
  424.  
  425.   NAME  ppErrorMessage()  (V35)
  426.  
  427.     message = ppErrorMessage (errorcode);
  428.  
  429.     char *ppErrorMessage (ULONG);
  430.     D0                    D0
  431.  
  432.   DESCRIPTION
  433.     Returns a pointer to a null-terminated string holding a descriptive
  434.     error message for the supplied error code.
  435.  
  436.     Currently only works for error codes returned by ppLoadData().
  437.  
  438.   INPUTS
  439.     errorcode - error code returned by ppLoadData().
  440.  
  441.   RESULT
  442.     message - pointer to error message (null terminated string) associated
  443.               with error code.
  444.  
  445.   BUGS
  446.     none known
  447.  
  448.   SEE ALSO
  449.     ppLoadData()
  450.  
  451. powerpacker.library/ppFreeCrunchInfo     powerpacker.library/ppFreeCrunchInfo
  452.  
  453.   NAME  ppFreeCrunchInfo()  (V35)
  454.  
  455.     ppFreeCrunchInfo (crunchinfo);
  456.  
  457.     void ppFreeCrunchInfo (APTR);
  458.                            A0
  459.  
  460.   DESCRIPTION
  461.     Free all memory associated with the private crunchinfo structure
  462.     returned by ppAllocCrunchInfo().
  463.  
  464.   INPUTS
  465.     crunchinfo - pointer to private crunchinfo structure.
  466.  
  467.   RESULT
  468.     none
  469.  
  470.   NOTE
  471.     crunchinfo may be NULL, no action will be taken.
  472.  
  473.   BUGS
  474.     none known
  475.  
  476.   SEE ALSO
  477.     ppAllocCrunchInfo(), ppCrunchBuffer()
  478.  
  479. powerpacker.library/ppGetPassword           powerpacker.library/ppGetPassword
  480.  
  481.   NAME  ppGetPassword()
  482.  
  483.     bool = ppGetPassword (screen, buffer, maxlen, checksum);
  484.  
  485.     BOOL ppGetPassword (struct Screen *, UBYTE *, ULONG, ULONG);
  486.     D0                  A0               A1       D0     D1:16
  487.  
  488.   DESCRIPTION
  489.     reqtools.library _MUST_ be available!
  490.  
  491.     Opens a small requester to prompt the user for a password. Returns when
  492.     the user enters a password with a checksum equal to 'checksum' or when
  493.     he has failed to enter a correct password (three chances). The password
  494.     will not be visible when typed.
  495.  
  496.   INPUTS
  497.     screen   - screen where the requester should appear.
  498.     buffer   - buffer to hold correct password. Must at least 17 bytes big!
  499.     maxlen   - maximum length of password, should always be 16.
  500.     checksum - checksum of password we are looking for.
  501.  
  502.   RESULT
  503.     bool - TRUE when the correct password was entered (can be found in
  504.            buffer), FALSE when no correct password was given after three
  505.            attempts.
  506.  
  507.   NOTE
  508.     New for V35: The contents of the buffer will NOT change if the requester
  509.                  is aborted.
  510.  
  511.     This function will be used by ppLoadData() to prompt for a password when
  512.     you called it with 'func' equal to NULL.
  513.  
  514.     Automatically adjusts the requester to the screen's font.
  515.  
  516.     ppGetPassword() checks the pr_WindowPtr of your process to find the
  517.     screen to put the requester on (if screen == NULL).
  518.  
  519.   BUGS
  520.     none known
  521.  
  522.   SEE ALSO
  523.     ppLoadData()
  524.     ppDecrunchBuffer()
  525.  
  526. powerpacker.library/ppLoadData                 powerpacker.library/ppLoadData
  527.  
  528.   NAME  ppLoadData()
  529.  
  530.     error = ppLoadData (filename, col, memtype, &buffer, &len, func);
  531.  
  532.     ULONG ppLoadData (char *, ULONG, ULONG, UBYTE **, ULONG *, BOOL (*)());
  533.     D0                A0      D0     D1     A1        A2       A3
  534.  
  535.   DESCRIPTION
  536.     This function loads a file in memory. The memory necessary to load the
  537.     file will be allocated by this function. Files crunched with PowerPacker
  538.     will be decrunched, plain files will simply be loaded. If the file can't
  539.     be opened ".pp" will be appended before trying again. The address of the
  540.     loaded file will be stored in 'buffer', the length in 'len'. You must
  541.     free this memory yourself (see NOTE) !
  542.  
  543.     The 'func' argument is the address of a function to be called when
  544.     ppLoadData() needs a password to decrypt an encrypted file. If you do
  545.     not want to load encrypted files call with func equal to -1, if you want
  546.     ppLoadData() to use ppGetPassword(), call with func equal to NULL.
  547.  
  548.     If you wish to use your own password prompting function you must call
  549.     ppLoadData() with func equal to the address of this type of function:
  550.  
  551.         BOOL __stdargs myFunction (UBYTE *password, ULONG checksum);
  552.  
  553.     On entry 'password' points to a buffer to hold up to 16 characters and a
  554.     terminating zero (so 17 bytes in all), 'checksum' is the checksum of the
  555.     password we are looking for. Your function must prompt for a string and
  556.     compare the checksum with 'checksum' (use ppCalcChecksum() for this). If
  557.     they are equal you must store the string in 'password' (in C you can use
  558.     'strcpy') and return TRUE, if not you should give the user a few more
  559.     chances (usually three in all) and return FALSE if no correct password
  560.     was entered.
  561.  
  562.     The two arguments are pushed on the stack according to C convention, so
  563.     if you write your function in assembly you will find the arguments on the
  564.     stack, the pointer to the buffer at 4(a7) and the checksum at 8(a7)
  565.     (longwords!). Assembly functions must preserve all registers !
  566.  
  567.     SAS/C users shouldn't forget __saveds if they compiled their program with
  568.     the small data model and wish to use global data in their function.
  569.  
  570.   INPUTS
  571.     filename - pointer to a null terminated pathname of the file to load.
  572.     col      - the effect to be used during decrunching. One of the
  573.                following (defined in "libraries/ppbase.[hi]"):
  574.                    DECR_COL0    - flash color 0
  575.                    DECR_COL1    - flash color 1
  576.                    DECR_POINTER - flash mouse pointer
  577.                    DECR_SCROLL  - weird stuff :-)
  578.                    DECR_NONE    - no decrunching effect
  579.     memtype  - type of memory to allocate (see AllocMem()).
  580.     &buffer  - address of (!) variable to hold memory location of loaded
  581.                file.
  582.     &len     - address of (!) variable to hold length of loaded file.
  583.     func     - function to be called to prompt the user for a password,
  584.                NULL for the the default password prompt and -1 for no
  585.                password prompt.
  586.  
  587.   RESULT
  588.     error - 0 if all went ok, if not one of the following error codes will
  589.             be returned (defined in "libraries/ppbase.(h|i)"):
  590.                 PP_OPENERR   - unable to open file.
  591.                 PP_READERR   - read error.
  592.                 PP_NOMEMORY  - not enough memory to load file.
  593.                 PP_CRYPTED   - file is encrypted (only when 'func' == -1).
  594.                 PP_PASSERR   - incorrect password, 'func()' returned FALSE.
  595.                 PP_EMPTYFILE - file is empty, there is nothing to load.
  596.                 PP_UNKNOWNPP - crunched by unknown version of PowerPacker.
  597.  
  598.   NOTE
  599.     Do not forget to free the memory allocated by this function !
  600.     Use "FreeMem (buffer, len);" before quitting your program, but only if
  601.     ppLoadData() didn't return an error.
  602.  
  603.     After calling 'func()' ppLoadData() doesn't check the checksum again,
  604.     only the returned boolean. Therefore it is VERY important that your
  605.     function is correct and only returns TRUE when the entered password has
  606.     the correct checksum !
  607.     Don't forget to copy your string to the memory pointed to by 'password'
  608.     before leaving 'func()' ! This password is needed to decrypt the file !!
  609.     Note that 'password' is a C string and must be null terminated !
  610.  
  611.     In case you call ppLoadData() with 'func' equal to NULL (use automatic
  612.     password prompting) the pr_WindowPtr of your Process will be used to
  613.     find the screen to open the password requester on. If pr_WindowPtr
  614.     equals 0 or -1 the WorkBench screen will be used, otherwise the screen
  615.     of the pr_WindowPtr window will be used. Only a process can call
  616.     ppLoadData() (it uses DOS) so pr_WindowPtr exists. Set it like this:
  617.  
  618.         struct Window *yourwindow;
  619.         struct Process *proc;
  620.         APTR oldwinptr;
  621.  
  622.         /* Open your screen and window... */
  623.  
  624.         ...
  625.  
  626.         /* set pr_WindowPtr */
  627.         proc = (struct Process *)FindTask (NULL);
  628.         oldwinptr = proc->pr_WindowPtr;
  629.         proc->pr_WindowPtr = (APTR)yourwindow;
  630.  
  631.         ...
  632.  
  633.         /* restore before quitting (VERY IMPORTANT !!) */
  634.         proc->pr_WindowPtr = oldwinptr;
  635.         exit (0);
  636.  
  637.   BUGS
  638.     none known
  639.  
  640.   SEE ALSO
  641.     exec.library/AllocMem(), exec.library/FreeMem(), ppCalcChecksum(),
  642.     ppErrorMessage(), ppGetPassword()
  643.  
  644. powerpacker.library/ppWriteDataHeader   powerpacker.library/ppWriteDataHeader
  645.  
  646.   NAME  ppWriteDataHeader()  (V35)
  647.  
  648.     success = ppWriteDataHeader (lock, efficiency, crypt, checksum);
  649.  
  650.     ULONG ppWriteDataHeader (BPTR, ULONG, BOOL, ULONG);
  651.     D0                       D0    D1     D2    D3:16
  652.  
  653.   DESCRIPTION
  654.     Use this function to write the PowerPacker data header at the
  655.     beginning of a file.
  656.  
  657.     If you write the data header for an encrypted file remember you must
  658.     have encrypted the file first using the ppDecrypt() function.  Remember
  659.     not to encrypt the last longword!
  660.  
  661.   INPUTS
  662.     lock       - BCPL pointer to a DOS file handle.
  663.     efficiency - efficiency used to crunch the buffer.
  664.                  See ppAllocCrunchInfo(). (CRUN_FAST, ... ,CRUN_BEST)
  665.     crypt      - TRUE for a header of an encrypted file, FALSE otherwise.
  666.     checksum   - (if crypt = TRUE) checksum of password used to encrypt.
  667.  
  668.   RESULT
  669.     success - TRUE on success, FALSE if a write error occured.
  670.  
  671.   NOTE
  672.  
  673.   BUGS
  674.     none known
  675.  
  676.   SEE ALSO
  677.     ppAllocCrunchInfo(), ppDecrypt()
  678.  
  679.