home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09964.iso / disktool / cabrsckt.exe / FCI_INT.H next >
C/C++ Source or Header  |  1996-07-31  |  14KB  |  450 lines

  1. /***    fci_int.h - File Compression Interface definitions
  2.  *
  3.  *      Microsoft Confidential
  4.  *      Copyright (C) Microsoft Corporation 1993-1996
  5.  *      All Rights Reserved.
  6.  */
  7.  
  8. #ifndef INCLUDED_FCI
  9. #define INCLUDED_FCI 1
  10.  
  11. //** Specify structure packing explicitly for clients of FCI
  12. #pragma pack(4)
  13.  
  14.  
  15. /***    FCIERROR - Error codes returned in erf.erfOper field
  16.  *
  17.  */
  18. typedef enum {
  19. FCIERR_NONE,                // No error
  20.  
  21. FCIERR_OPEN_SRC,            // Failure opening file to be stored in cabinet
  22.                             //  erf.erfTyp has C run-time *errno* value
  23.  
  24. FCIERR_READ_SRC,            // Failure reading file to be stored in cabinet
  25.                             //  erf.erfTyp has C run-time *errno* value
  26.  
  27. FCIERR_ALLOC_FAIL,          // Out of memory in FCI
  28.  
  29. FCIERR_TEMP_FILE,           // Could not create a temporary file
  30.                             //  erf.erfTyp has C run-time *errno* value
  31.  
  32. FCIERR_BAD_COMPR_TYPE,      // Unknown compression type
  33.  
  34. FCIERR_CAB_FILE,            // Could not create cabinet file
  35.                             //  erf.erfTyp has C run-time *errno* value
  36.  
  37. FCIERR_USER_ABORT,          // Client requested abort
  38.  
  39. FCIERR_MCI_FAIL,            // Failure compressing data
  40.  
  41. #ifndef REMOVE_CHICAGO_M6_HACK
  42. FCIERR_M6_HACK_INCOMPRESSIBLE, // Data was incompressible
  43. #endif
  44. } FCIERROR;
  45.  
  46.  
  47. /***    HFCI - Handle to an FCI Context
  48.  *
  49.  */
  50. typedef void * HFCI;
  51.  
  52.  
  53. /***    CCAB - Current Cabinet
  54.  *
  55.  *  This structure is used for passing in the cabinet parameters to FCI,
  56.  *  and is passed back on certain FCI callbacks to provide cabinet
  57.  *  information to the client.
  58.  */
  59. typedef struct {
  60. // longs first
  61.     ULONG  cb;                  // size available for cabinet on this media
  62.     ULONG  cbFolderThresh;      // Thresshold for forcing a new Folder
  63.  
  64. // then ints
  65.     UINT   cbReserveCFHeader;   // Space to reserve in CFHEADER
  66.     UINT   cbReserveCFFolder;   // Space to reserve in CFFOLDER
  67.     UINT   cbReserveCFData;     // Space to reserve in CFDATA
  68.     int    iCab;                // sequential numbers for cabinets
  69.     int    iDisk;               // Disk number
  70. #ifndef REMOVE_CHICAGO_M6_HACK
  71.     int    fFailOnIncompressible; // TRUE => Fail if a block is incompressible
  72. #endif
  73.  
  74. //  then shorts
  75.     USHORT setID;               // Cabinet set ID
  76.  
  77. // then chars
  78.     char   szDisk[CB_MAX_DISK_NAME];    // current disk name
  79.     char   szCab[CB_MAX_CABINET_NAME];  // current cabinet name
  80.     char   szCabPath[CB_MAX_CAB_PATH];  // path for creating cabinet
  81. } CCAB; /* ccab */
  82. typedef CCAB *PCCAB; /* pccab */
  83.  
  84.  
  85. /***    FNFCIGETNEXTCABINET - Callback used to request new cabinet info
  86.  *
  87.  *  Entry:
  88.  *      pccab     - Points to copy of old ccab structure to modify
  89.  *      cbPrevCab - Estimate of size of previous cabinet
  90.  *      pv        - Has the caller's context pointer
  91.  *
  92.  *  Exit-Success:
  93.  *      returns TRUE;
  94.  *
  95.  *  Exit-Failure:
  96.  *      returns FALSE;
  97.  */
  98. typedef BOOL (DIAMONDAPI *PFNFCIGETNEXTCABINET)(PCCAB  pccab,
  99.                                                 ULONG  cbPrevCab,
  100.                                                 void  *pv); /* pfnfcignc */
  101.  
  102. #define FNFCIGETNEXTCABINET(fn) BOOL DIAMONDAPI fn(PCCAB  pccab,     \
  103.                                                    ULONG  cbPrevCab, \
  104.                                                    void  *pv)
  105.  
  106.  
  107. /***    FNFCIFILEPLACED - Notify FCI client that file was placed
  108.  *
  109.  *  Entry:
  110.  *      pccab         - cabinet structure to fill in, with copy of previous one
  111.  *      pszFile       - name of file, from cabinet
  112.  *      cbFile        - length of file
  113.  *      fContinuation - true if this is a later segment of a continued file
  114.  *      pv            - the context of the client
  115.  *
  116.  *  Exit-Success:
  117.  *      return value anything but -1
  118.  *
  119.  *  Exit-Failure:
  120.  *      return value -1 zakP_FILpoin ccahn
  121.  *hn
  122.  M valre:
  123.  * N     //FNFCIGETNEXTC TRUT)(PCCAB  pccab,
  124.  hat file w                                ULONG  cbPrevCab,
  125.         ];  /*om cabi                   ULONG  cbPrevCab,
  126.             
  127.  *                       ULONG  cbPrevCab,
  128.               a later segme                   ULONG  cbPrevCab,
  129.          CurreFNFCIGETNEXTCAfpET(fn) BOOL DIAMONDAhat file wccab, TRU\
  130.                                                       ULONG  cbPrevCab, \
  131.       ];  /*om cabi                              ULONG  cbPrevCab, \
  132.           
  133.  *                                   ULONG  cbPrevCab, \
  134.             a later segme                        ULONG  cbPrevCab, \
  135.        CurreFNFNotify FCI clienCDAPI openINFO - Op    ourceile    getM6_He/R_AB/attribs        - cabinet structureszN   c --OVE_CleteAB; /*s oneeX_CAB_Ptructure6_He
  136.  *
  137. -   cef structhn
  138.  *hFAT-styleM6_HeieldB_PtructureR_ABO *
  139. -   cef structhn
  140.  *hFAT-styleMR_ABOeldB_Ptructureattribs
  141. -   cef structhn
  142.  *hFAT-styleMattributesntext of the client--OV     -Success: return value anything but -1
  143.  *Rn
  144.  *hn
  145.  M is
  146.  *  h
  147. type
  148.  * p           inet return value -1 zakP_FILpoin ccaRn
  149.  *hn
  150.  M is   retFCIGETNEXTC TRUT)(PCCAB  pccab,
  151.  PI openINFO)(];  // *eszN                      void  *pv); /* pfnfcignc */abinet *e6_He                   void  *pv); /* pfnfcignc */abinet *eR_AB                   void  *pv); /* pfnfcignc */abinet *eattribs                   void  *pv); /* pfnfcignc */EPLACEe FNFCIGETNEXTCABoiET(fn) BOOL DIAMONDAPI openINFOccab, TRU\
  152.            ];  // *eszN                            ULONG  cbPrevCab, \
  153.        abinet *e6_He                           ULONG  cbPrevCab, \
  154.        abinet *eR_AB                           ULONG  cbPrevCab, \
  155.        abinet *eattribs                        ULONG  cbPrevCab, \
  156.        EPLACEe FNF                     ULONG  cbfy FCI client tSTATUS - Status/
  157.     chaS pv   inform        - cabinet structurGETNStatus == status     ifOVE_CHICAGO_Mf
  158.  
  159. //  n* N  f  cbResstructurevCab, \
  160.       ]b1 =aS pv ofOVE_CHICA to 
  161. //esstructurevCab, \
  162.       ]b2 =aS pv ofOunVE_CHICA to 
  163. //esstt structurGETNStatus == status   cbRendifddGO_Mff  cbR * N - length of file
  164. evCab, \
  165.       ]b1 =aAmoupv    f  cbR copi *
  166.  *th copy oo faresstructurevCab, \
  167.       ]b2 =aTotal   pv    f  cbResstt structurGETNStatus == status
  168.     chandiwri
  169. typout     _CleteA length of file
  170. evCab, \
  171.       ]b1 =ainet
  172.  *d*th copy o pv try:    p   - naly of file
  173. evCab, \
  174.               acks tos onXTCAGetNext
  175.     ch().esstructurevCab, \
  176.       ]b2 =aActual th copy o pvesstructurevCab, \
  177.     NOTE:aRn
  178.  *hn
  179.  M isdesi    
  180.  *  Eno pv             of file
  181. evCab, \
  182.               .d in  ue6_He *
  183.  *maximum th copy o pvesstructurevCab, \
  184.     in ccahnmait
  185.   uAGO_Mtinuen
  186.  M.sing inallow fil*      retructurevCab, \
  187.     in ccas ogener_HeimultiCle           {
  188. AX_C,CI cahavvesstructurevCab, \
  189.     in ccain  limit*
  190.  *o pv correcpack--s:
  191.  *        n doesstructurevCab, \
  192.     in ccaclus
  193.  *   pv roundGO_Mo
  194.  *  and is p  pv!esstructurevCab, \
  195.     in ccaT
  196.  *      sh     ei * rthn
  197.  *hcb2,    roundhcb2esstructurevCab, \
  198.     in ccaupas osome larg rtxit-Faildthn
  199.  *htry:.urn value anything but -1
  200.  *Rn
  201.  *sailure:
  202.  o * rttryn -1;but -1
  203.  *NOTE:aSee status
  204.     cha    stly alahn
  205.  *hn
  206.  Ms! return value -1 zakP_FILpoin ccaRn
  207.  *s  as osignalatry:in  sh          ;define INCOOL DIAstatus          0r   szAddnitionon c  cbR c inform  COOL DIAstatus   cbR    1r   szAddni  cbR * N
  208.     chac inform  COOL DIAstatus
  209.     cha  2r   szWri *  ut     _Cleted*th copy c inform  CIGETNEXTC    T)(PCCAB  pccab,
  210.  STATUS)(pace toGETNStatus                   void  *pv); /* pfnfcignc         1                   void  *pv); /* pfnfcignc         2                   void  *pv); /* pfnfcigncdefine FNFCIGETNEXTCAsET(fn) BOOL DIAMONDASTATUSccab,    \
  211.            pace toGETNStatus                        ULONG  cbPrevCab, \
  212.             1                               ULONG  cbPrevCab, \
  213.             2                               ULONG  cbPrevCab, \
  214.    EPLACED - Notify FCI client tGETt crhat cabinet inf,*  Entrys             //AX_CAB_P     - cabinet structureszT   N   c- BuffbR * Nreceive   _CleteA      //AX_CAB_P       ]bT   N   c - S pv     szT   N   cbuffbR return value anything but -1
  215.  *
  216.  *  E     return value -1 zakP_FILpoin ccahn
  217.  *hNDAPI                         //,    buffbR * o smnet return vaNot_FILpoin ccaIt isconceiv    Utry:tinuefuncf strmayahn
  218.  *haoneeX_CAB_Ptructurtry: e
  219.  alinety exist by
  220.  *  R_ABOit is p  ed.d iortinuILpoin ccahnasme  
  221.  *  Exit sh     make severalMatt    to mod     B_Ptructurt           //s before giv
  222.   up.*PFNFCIGETNEXTCABINET)(PCCAB  pccab,
  223.     t crhat )(];  /* szT   N                      void  *pv); /* pfnfcignc */
  224.  TRUE ]bT   N   FCIGETNEXTCABtfET(fn) BOOL DIAMONDAPI t crhat ccab,     \
  225.            ];  /* szT   N                           void  *pv)
  226.  
  227.  
  228. /***    FNFCI TRUE ]bT   N   Fodes returned in C      --OV       et
  229.  * it-Succ( et p   CAB,CI t p   FOL)B_P     - cabinet structureerft
  230.  *
  231.  of previouwheiouweahn
  232.  *heer field
  233. t structureEXTCAfpE withet infoto
  234. typed*  Exit of eventual dtry: true i
  235. t structureEXat
  236.  *
  237.  E,     allocef strfuncf str  inform    ructureEXTt
  238.  *
  239.  E,     freerfuncf str  inform    ructureEXTCABtfE-rt      //AX_CAogener_Horr  inform    ructure ccab struc *     
  240.  *th copy/AX_CABINE &   pv of previo return vaNot_g but -1(1)aT
  241.  alloc/freer  informatmustahnmaithn
  242. id throughoutB_Ptructurtre lifecess:
  243.  *it-Suc,aupas oI calncludGO_Mtier  inas B_PtructurFCIDtryroy.urn va(2)aT
  244.  eerft *      in t        :
  245.  *iE,         it-Succ(HCI),B_PtructurI caanyheer fs     -sub
  246.     int
  247.  *  ins aren t        :
  248. B_Ptructurerfttry:    pcks to      *tinu**  in. return value anything but -1
  249.  *Rn
  250.  *s non-NULL h
  251. typedef void * it-Suc. return value -1 zakP_FILpoin ccaRn
  252.  *sNULL, eerftne
  253.  to  .*PFNFCI
  254.  *
  255. \
  256.         in C     (PERF
  257. /***    FNFCIeerf                   void  *pv)ab,
  258.  hat file wureEXTCAfp                   void  *pv)ab,emory*    FNFCIefna                   void  *pv)ab,REE *    FNFCIefnf                   void  *pv)ab,
  259.  GETt crhat ceEXTCABtf                   void  *pv)a       *    FNFCIe cca                  void  *pv)binet
  260.  *
  261.  * 
  262.  Addition-zAddnaMAX_CA        ff  cbR/cs used for passicabinet structurhTCAlient
  263.  *
  264.  
  265.  * it-Succh
  266. typt structureszSourceition-zN   cbFile      fdtos on  cbResstructurom cabiN   c n-zN   cs ost     n* Nf  cbR/cs used for       Executet
  267.  *
  268.  laCI,dic/
  269. typexecutetonpextract    ructureEX_prog    tructrog    t  inform    ructureEXTCABnc
  270.  *
  271.  GetNext
  272.     cht  inform    ructureEXTCAsnt
  273.  *
  274.  Status   inform    ructureEXTCABoi
  275.  *
  276.  Op  Info   inform    ructurGETNs
  277.  *
  278.  *
  279.  TETN ofOVE_CHICA structusv     tinuef context of the client
  280.  *
  281.   *     
  282.  *thExit-Su     nalaccess: return value anything but -1
  283.  *ure:
  284.  *     returns FALSE;
  285.  */
  286. typedef BOOL (DIAMONDAPI,heer fine
  287.  to  ypedef Bypedef BTinued f
  288.  *maitrfuncf str
  289.  *
  290.  *fdtof co(s) * N - length of file   serie***          .  Iss:
  291.  *szCabPale   ca
  292.  ss:
  293.  *szCabP of filef  cbR/cs used * Noverflows:
  294.  AX_CAimag
  295.  *szCabPly be:
  296.  * ilt,B_Ptruct *  and is p e
  297.  b    rmin
  298.  *d,CI caa:
  299.  *      p/AX_CABINE  e
  300. B_Ptructb  prE_CtrameterviaN - linform. aT
  301.  eendGO_Mf  cbR  e
  302.  b   rimmb     file ss:
  303.  d} FCIhich
  304. FCIEalinety beenogener_He     :
  305.   Conshed*th copy.*PFNFCI     \
  306.         
  307.  Additio(
  308.  *
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326. hTCA                   void  *pv);];  //               *eszSourceitio                   void  *pv);];  //               *eszcabiN                      void  *pv);      b, \
  327.            Execute                   void  *pv);ab,
  328.                ureEXTCABnc                   void  *pv);ab,
  329.  STATUS     FNFCIefnfcis                   void  *pv);ab,
  330.     openINFO ctureEXTCABoi                   void  *pv);Tressab, \
  331.     in ccasETNs
  332.  *
  333.                     void  *pv);EPLACEe              *ev                  void  *pv))bin   ULONG  cbfy
  334.  *
  335.  * 
  336.  Flush
  337.     cht-ns
  338.  leteA 
  339.  *szCabPaand is puncbR conof preion for passing in e
  340.  ca
  341.  A 
  342.  *szCabPaand is p(assum FCI,t is        y)as B_Ptrube ga * r *
  343.  ge * rtI cawritetructAX_C. for passicabinet structurhTCAlient
  344.  
  345.  
  346.  * it-Suc for       GetNext
  347.   
  348.  Tresssiblinet GetNext
  349.   as oget       -ef str
  350. typ;esstructurevCab, \
  351.     NDAPIsiblDon'ht  in GetNext
  352.   aunl
  353.  *tinue        of file
  354. evCab, \
  355.           ile verflows.    ructureEXTCABnc
  356.  withet infofuncf strs oget       -ef str          / ructureEXTCAsnt
  357.  withet infofuncf stretersrog    trepor
  358. tyntext of the client
  359.  -*thExit-Su     nalaccess:       informa return value anything but -1
  360.  *
  361.  *  EeldE     return value -1 zakP_FILpoin ccahn
  362.  *heldENDAPI,heer fiof previoune
  363.  to  ypedFCI     \
  364.         
  365.  Flush
  366.     ch(
  367.  *
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385. hTCA                   void  *pv);*pv);      b, \
  386.            GetNext
  387.                      void  *pv);*pv);ab,
  388.                ureEXTCABnc                   void  *pv);*pv);ab,
  389.  STATUS     FNFCIefnfcis                   void  *pv);*pv);EPLACEe              *ev                  void  *pv)  *pv)binet                                                                  
  390.  *
  391.  * 
  392.  Flushi  cbR -ns
  393.  leteA 
  394.  *szCabPaf  cbR uncbR conof preion for passing in e
  395.  intseA 
  396.    rmin
  397.   strofA 
  398.  *szCabPaf  cbR,CIhich
  399. mayaoResstrumaya     a
  400.  Aonee   m              //s         _Cleted. for passicabinet structurhTCAlient
  401.  
  402.  
  403.  * it-Suc for      GetNext
  404.   a withet infofuncf strs oget       -ef str          / ructureEXtrog    twithet infofuncf stretersrog    trepor
  405. tyntext of the client
  406.  -*thExit-Su     nalaccess:       informa return value anything but -1
  407.  *
  408.  *  EeldE     return value -1 zakP_FILpoin ccahn
  409.  *heldENDAPI,heer fiof previoune
  410.  to  ypedFCI     \
  411.         
  412.  Flushi  cbR(
  413.  *
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431. hTCA                   void  *pv);*pv)ab,
  432.                ureEXTCABnc                   void  *pv);*pv)ab,
  433.  STATUS     FNFCIefnfcis                   void  *pv);*pv)EPLACEe              *ev                  void  *pv)  *p)binet                                                                  
  434.  *
  435.  * 
  436.  Dtryroy - Dtryroy a 
  437.  * it-SuccI cadeleteA    rue i
  438. t st passicabinet structurhTCAl
  439.  
  440.  * it-Suc forurn value anything but -1
  441.  *
  442.  *  EeldE     return value -1 zakP_FILpoin ccahn
  443.  *heldENDAPI,heer fiof previoune
  444.  to  ypedFCI     \
  445.         
  446.  Dtryroy (
  447.  *
  448. hTCA)bin   ULONG  cb                                                      
  449.  plicReverd * Ndefaultr clients of FCI
  450.