ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

chm_lib.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *             chm_lib.h - CHM archive manipulation routines               *
00003  *                           -------------------                           *
00004  *                                                                         *
00005  *  author:     Jed Wing <jedwin@ugcs.caltech.edu>                         *
00006  *  version:    0.3                                                        *
00007  *  notes:      These routines are meant for the manipulation of microsoft *
00008  *              .chm (compiled html help) files, but may likely be used    *
00009  *              for the manipulation of any ITSS archive, if ever ITSS     *
00010  *              archives are used for any other purpose.                   *
00011  *                                                                         *
00012  *              Note also that the section names are statically handled.   *
00013  *              To be entirely correct, the section names should be read   *
00014  *              from the section names meta-file, and then the various     *
00015  *              content sections and the "transforms" to apply to the data *
00016  *              they contain should be inferred from the section name and  *
00017  *              the meta-files referenced using that name; however, all of *
00018  *              the files I've been able to get my hands on appear to have *
00019  *              only two sections: Uncompressed and MSCompressed.          *
00020  *              Additionally, the ITSS.DLL file included with Windows does *
00021  *              not appear to handle any different transforms than the     *
00022  *              simple LZX-transform.  Furthermore, the list of transforms *
00023  *              to apply is broken, in that only half the required space   *
00024  *              is allocated for the list.  (It appears as though the      *
00025  *              space is allocated for ASCII strings, but the strings are  *
00026  *              written as unicode.  As a result, only the first half of   *
00027  *              the string appears.)  So this is probably not too big of   *
00028  *              a deal, at least until CHM v4 (MS .lit files), which also  *
00029  *              incorporate encryption, of some description.               *
00030  ***************************************************************************/
00031 
00032 /***************************************************************************
00033  *
00034  * This library is free software; you can redistribute it and/or
00035  * modify it under the terms of the GNU Lesser General Public
00036  * License as published by the Free Software Foundation; either
00037  * version 2.1 of the License, or (at your option) any later version.
00038  *
00039  * This library is distributed in the hope that it will be useful,
00040  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00041  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00042  * Lesser General Public License for more details.
00043  *
00044  * You should have received a copy of the GNU Lesser General Public
00045  * License along with this library; if not, write to the Free Software
00046  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00047  *
00048  ***************************************************************************/
00049 
00050 #ifndef INCLUDED_CHMLIB_H
00051 #define INCLUDED_CHMLIB_H
00052 
00053 typedef ULONGLONG LONGUINT64;
00054 typedef LONGLONG  LONGINT64;
00055 
00056 /* the two available spaces in a CHM file                      */
00057 /* N.B.: The format supports arbitrarily many spaces, but only */
00058 /*       two appear to be used at present.                     */
00059 #define CHM_UNCOMPRESSED (0)
00060 #define CHM_COMPRESSED   (1)
00061 
00062 /* structure representing an ITS (CHM) file stream             */
00063 struct chmFile;
00064 
00065 /* structure representing an element from an ITS file stream   */
00066 #define CHM_MAX_PATHLEN  (256)
00067 struct chmUnitInfo
00068 {
00069     LONGUINT64         start;
00070     LONGUINT64         length;
00071     int                space;
00072     WCHAR              path[CHM_MAX_PATHLEN+1];
00073 };
00074 
00075 struct chmFile* chm_openW(const WCHAR *filename) DECLSPEC_HIDDEN;
00076 struct chmFile *chm_dup(struct chmFile *oldHandle) DECLSPEC_HIDDEN;
00077 
00078 /* close an ITS archive */
00079 void chm_close(struct chmFile *h) DECLSPEC_HIDDEN;
00080 
00081 /* resolve a particular object from the archive */
00082 #define CHM_RESOLVE_SUCCESS (0)
00083 #define CHM_RESOLVE_FAILURE (1)
00084 int chm_resolve_object(struct chmFile *h,
00085                        const WCHAR *objPath,
00086                        struct chmUnitInfo *ui) DECLSPEC_HIDDEN;
00087 
00088 /* retrieve part of an object from the archive */
00089 LONGINT64 chm_retrieve_object(struct chmFile *h,
00090                               struct chmUnitInfo *ui,
00091                               unsigned char *buf,
00092                               LONGUINT64 addr,
00093                               LONGINT64 len) DECLSPEC_HIDDEN;
00094 
00095 /* enumerate the objects in the .chm archive */
00096 typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
00097                               struct chmUnitInfo *ui,
00098                               void *context);
00099 #define CHM_ENUMERATE_NORMAL    (1)
00100 #define CHM_ENUMERATE_META      (2)
00101 #define CHM_ENUMERATE_SPECIAL   (4)
00102 #define CHM_ENUMERATE_FILES     (8)
00103 #define CHM_ENUMERATE_DIRS      (16)
00104 #define CHM_ENUMERATE_ALL       (31)
00105 #define CHM_ENUMERATOR_FAILURE  (0)
00106 #define CHM_ENUMERATOR_CONTINUE (1)
00107 #define CHM_ENUMERATOR_SUCCESS  (2)
00108 int chm_enumerate_dir(struct chmFile *h,
00109                       const WCHAR *prefix,
00110                       int what,
00111                       CHM_ENUMERATOR e,
00112                       void *context) DECLSPEC_HIDDEN;
00113 
00114 #endif /* INCLUDED_CHMLIB_H */

Generated on Sat May 26 2012 04:22:43 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.