亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chm_lib.c

?? 解壓縮chm格式文件的源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
 /* $Id: chm_lib.c,v 1.19 2003/09/07 13:01:43 jedwin Exp $ *//*************************************************************************** *             chm_lib.c - CHM archive manipulation routines               * *                           -------------------                           * *                                                                         * *  author:     Jed Wing <jedwin@ugcs.caltech.edu>                         * *  version:    0.3                                                        * *  notes:      These routines are meant for the manipulation of microsoft * *              .chm (compiled html help) files, but may likely be used    * *              for the manipulation of any ITSS archive, if ever ITSS     * *              archives are used for any other purpose.                   * *                                                                         * *              Note also that the section names are statically handled.   * *              To be entirely correct, the section names should be read   * *              from the section names meta-file, and then the various     * *              content sections and the "transforms" to apply to the data * *              they contain should be inferred from the section name and  * *              the meta-files referenced using that name; however, all of * *              the files I've been able to get my hands on appear to have * *              only two sections: Uncompressed and MSCompressed.          * *              Additionally, the ITSS.DLL file included with Windows does * *              not appear to handle any different transforms than the     * *              simple LZX-transform.  Furthermore, the list of transforms * *              to apply is broken, in that only half the required space   * *              is allocated for the list.  (It appears as though the      * *              space is allocated for ASCII strings, but the strings are  * *              written as unicode.  As a result, only the first half of   * *              the string appears.)  So this is probably not too big of   * *              a deal, at least until CHM v4 (MS .lit files), which also  * *              incorporate encryption, of some description.               * *                                                                         * * switches:    CHM_MT:        compile library with thread-safety          * *                                                                         * * switches (Linux only):                                                  * *              CHM_USE_PREAD: compile library to use pread instead of     * *                             lseek/read                                  * *              CHM_USE_IO64:  compile library to support full 64-bit I/O  * *                             as is needed to properly deal with the      * *                             64-bit file offsets.                        * ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU Lesser General Public License as        * *   published by the Free Software Foundation; either version 2.1 of the  * *   License, or (at your option) any later version.                       * *                                                                         * ***************************************************************************/#include "chm_lib.h"#ifdef CHM_MT#define _REENTRANT#endif#include "lzx.h"#include <stdlib.h>#include <string.h>#include <stdio.h>
#if __sun || __sgi#include <strings.h>#endif/* RWE 6/13/2003 */#ifdef _WIN32_WCE#define FREEBUF(x) free(x)#else#define FREEBUF(x) /* do nothing */#endif
#include <malloc.h>#define strcasecmp stricmp#define strncasecmp strnicmp/* includes/defines for threading, if using them */#define CHM_ACQUIRE_LOCK(a) /* do nothing */#define CHM_RELEASE_LOCK(a) /* do nothing *///#define CHM_NULL_FD (-1)#define CHM_NULL_FD (NULL)
#define CHM_CLOSE_FILE(fd) fclose((fd))/* * defines related to tuning */#ifndef CHM_MAX_BLOCKS_CACHED#define CHM_MAX_BLOCKS_CACHED 5#endif/* * architecture specific defines * * Note: as soon as C99 is more widespread, the below defines should * probably just use the C99 sized-int types. * * The following settings will probably work for many platforms.  The sizes * don't have to be exactly correct, but the types must accommodate at least as * many bits as they specify. *//* i386, 32-bit, Windows */typedef unsigned char           UChar;typedef __int16                 Int16;typedef unsigned __int16        UInt16;typedef __int32                 Int32;typedef unsigned __int32        UInt32;typedef __int64                 Int64;typedef unsigned __int64        UInt64;/* GCC *//*
#ifdef __GNUC__
#define memcmp __builtin_memcmp
#define memcpy __builtin_memcpy
#define strlen __builtin_strlen

#elif defined(WIN32)
static int ffs(unsigned int val)
{
        int bit=1, idx=1;
        while (bit != 0  &&  (val & bit) == 0)
        {
                bit <<= 1;
                ++idx;
        }
        if (bit == 0)
                return 0;
        else
                return idx;
}

#endif
*/
static int ffs(unsigned int val)
{
        int bit=1, idx=1;
        while (bit != 0  &&  (val & bit) == 0)
        {
                bit <<= 1;
                ++idx;
        }
        if (bit == 0)
                return 0;
        else
                return idx;
}
/* utilities for unmarshalling data */static int _unmarshal_char_array(unsigned char **pData,                                 unsigned long *pLenRemain,                                 char *dest,                                 int count){    if (count <= 0  ||  (unsigned int)count > *pLenRemain)        return 0;    memcpy(dest, (*pData), count);    *pData += count;    *pLenRemain -= count;    return 1;}static int _unmarshal_uchar_array(unsigned char **pData,                                  unsigned long *pLenRemain,                                  unsigned char *dest,                                  int count){        if (count <= 0  ||  (unsigned int)count > *pLenRemain)        return 0;    memcpy(dest, (*pData), count);    *pData += count;    *pLenRemain -= count;    return 1;}static int _unmarshal_int16(unsigned char **pData,                            unsigned long *pLenRemain,                            Int16 *dest){    if (2 > *pLenRemain)        return 0;    *dest = (*pData)[0] | (*pData)[1]<<8;    *pData += 2;    *pLenRemain -= 2;    return 1;}static int _unmarshal_uint16(unsigned char **pData,                             unsigned long *pLenRemain,                             UInt16 *dest){    if (2 > *pLenRemain)        return 0;    *dest = (*pData)[0] | (*pData)[1]<<8;    *pData += 2;    *pLenRemain -= 2;    return 1;}static int _unmarshal_int32(unsigned char **pData,                            unsigned long *pLenRemain,                            Int32 *dest){    if (4 > *pLenRemain)        return 0;    *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24;    *pData += 4;    *pLenRemain -= 4;    return 1;}static int _unmarshal_uint32(unsigned char **pData,                             unsigned long *pLenRemain,                             UInt32 *dest){    if (4 > *pLenRemain)        return 0;    *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24;    *pData += 4;    *pLenRemain -= 4;    return 1;}static int _unmarshal_int64(unsigned char **pData,                            unsigned long *pLenRemain,                            Int64 *dest){    Int64 temp;    int i;    if (8 > *pLenRemain)        return 0;    temp=0;    for(i=8; i>0; i--)    {        temp <<= 8;        temp |= (*pData)[i-1];    }    *dest = temp;    *pData += 8;    *pLenRemain -= 8;    return 1;}static int _unmarshal_uint64(unsigned char **pData,                             unsigned long *pLenRemain,                             UInt64 *dest){    UInt64 temp;    int i;    if (8 > *pLenRemain)        return 0;    temp=0;    for(i=8; i>0; i--)    {        temp <<= 8;        temp |= (*pData)[i-1];    }    *dest = temp;    *pData += 8;    *pLenRemain -= 8;    return 1;}static int _unmarshal_uuid(unsigned char **pData,                           unsigned long *pDataLen,                           unsigned char *dest){    return _unmarshal_uchar_array(pData, pDataLen, dest, 16);}/* names of sections essential to decompression */static const char _CHMU_RESET_TABLE[] =        "::DataSpace/Storage/MSCompressed/Transform/"        "{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/"        "InstanceData/ResetTable";static const char _CHMU_LZXC_CONTROLDATA[] =        "::DataSpace/Storage/MSCompressed/ControlData";static const char _CHMU_CONTENT[] =        "::DataSpace/Storage/MSCompressed/Content";static const char _CHMU_SPANINFO[] =        "::DataSpace/Storage/MSCompressed/SpanInfo";/* * structures local to this module *//* structure of ITSF headers */#define _CHM_ITSF_V2_LEN (0x58)#define _CHM_ITSF_V3_LEN (0x60)struct chmItsfHeader{    char        signature[4];           /*  0 (ITSF) */    Int32       version;                /*  4 */    Int32       header_len;             /*  8 */    Int32       unknown_000c;           /*  c */    UInt32      last_modified;          /* 10 */    UInt32      lang_id;                /* 14 */    UChar       dir_uuid[16];           /* 18 */    UChar       stream_uuid[16];        /* 28 */    UInt64      unknown_offset;         /* 38 */    UInt64      unknown_len;            /* 40 */    UInt64      dir_offset;             /* 48 */    UInt64      dir_len;                /* 50 */    UInt64      data_offset;            /* 58 (Not present before V3) */}; /* __attribute__ ((aligned (1))); */static int _unmarshal_itsf_header(unsigned char **pData,                                  unsigned long *pDataLen,                                  struct chmItsfHeader *dest){    /* we only know how to deal with the 0x58 and 0x60 byte structures */    if (*pDataLen != _CHM_ITSF_V2_LEN  &&  *pDataLen != _CHM_ITSF_V3_LEN)        return 0;    /* unmarshal common fields */    _unmarshal_char_array(pData, pDataLen,  dest->signature, 4);    _unmarshal_int32     (pData, pDataLen, &dest->version);    _unmarshal_int32     (pData, pDataLen, &dest->header_len);    _unmarshal_int32     (pData, pDataLen, &dest->unknown_000c);    _unmarshal_uint32    (pData, pDataLen, &dest->last_modified);    _unmarshal_uint32    (pData, pDataLen, &dest->lang_id);    _unmarshal_uuid      (pData, pDataLen,  dest->dir_uuid);    _unmarshal_uuid      (pData, pDataLen,  dest->stream_uuid);    _unmarshal_uint64    (pData, pDataLen, &dest->unknown_offset);    _unmarshal_uint64    (pData, pDataLen, &dest->unknown_len);    _unmarshal_uint64    (pData, pDataLen, &dest->dir_offset);    _unmarshal_uint64    (pData, pDataLen, &dest->dir_len);    /* error check the data */    /* XXX: should also check UUIDs, probably, though with a version 3 file,     * current MS tools do not seem to use them.     */    if (memcmp(dest->signature, "ITSF", 4) != 0)        return 0;    if (dest->version == 2)    {        if (dest->header_len < _CHM_ITSF_V2_LEN)            return 0;    }    else if (dest->version == 3)    {        if (dest->header_len < _CHM_ITSF_V3_LEN)            return 0;    }    else        return 0;    /* now, if we have a V3 structure, unmarshal the rest.     * otherwise, compute it     */    if (dest->version == 3)    {        if (*pDataLen != 0)            _unmarshal_uint64(pData, pDataLen, &dest->data_offset);        else            return 0;    }    else        dest->data_offset = dest->dir_offset + dest->dir_len;    return 1;}/* structure of ITSP headers */#define _CHM_ITSP_V1_LEN (0x54)struct chmItspHeader{    char        signature[4];           /*  0 (ITSP) */    Int32       version;                /*  4 */    Int32       header_len;             /*  8 */    Int32       unknown_000c;           /*  c */    UInt32      block_len;              /* 10 */    Int32       blockidx_intvl;         /* 14 */    Int32       index_depth;            /* 18 */    Int32       index_root;             /* 1c */    Int32       index_head;             /* 20 */    Int32       unknown_0024;           /* 24 */    UInt32      num_blocks;             /* 28 */    Int32       unknown_002c;           /* 2c */    UInt32      lang_id;                /* 30 */    UChar       system_uuid[16];        /* 34 */    UChar       unknown_0044[16];       /* 44 */}; /* __attribute__ ((aligned (1))); */static int _unmarshal_itsp_header(unsigned char **pData,                                  unsigned long *pDataLen,                                  struct chmItspHeader *dest){    /* we only know how to deal with a 0x54 byte structures */    if (*pDataLen != _CHM_ITSP_V1_LEN)        return 0;    /* unmarshal fields */    _unmarshal_char_array(pData, pDataLen,  dest->signature, 4);    _unmarshal_int32     (pData, pDataLen, &dest->version);    _unmarshal_int32     (pData, pDataLen, &dest->header_len);    _unmarshal_int32     (pData, pDataLen, &dest->unknown_000c);    _unmarshal_uint32    (pData, pDataLen, &dest->block_len);    _unmarshal_int32     (pData, pDataLen, &dest->blockidx_intvl);    _unmarshal_int32     (pData, pDataLen, &dest->index_depth);    _unmarshal_int32     (pData, pDataLen, &dest->index_root);    _unmarshal_int32     (pData, pDataLen, &dest->index_head);    _unmarshal_int32     (pData, pDataLen, &dest->unknown_0024);    _unmarshal_uint32    (pData, pDataLen, &dest->num_blocks);    _unmarshal_int32     (pData, pDataLen, &dest->unknown_002c);    _unmarshal_uint32    (pData, pDataLen, &dest->lang_id);    _unmarshal_uuid      (pData, pDataLen,  dest->system_uuid);    _unmarshal_uchar_array(pData, pDataLen, dest->unknown_0044, 16);    /* error check the data */    if (memcmp(dest->signature, "ITSP", 4) != 0)        return 0;    if (dest->version != 1)        return 0;    if (dest->header_len != _CHM_ITSP_V1_LEN)        return 0;    return 1;}/* structure of PMGL headers */static const char _chm_pmgl_marker[4] = "PMGL";#define _CHM_PMGL_LEN (0x14)struct chmPmglHeader{    char        signature[4];           /*  0 (PMGL) */    UInt32      free_space;             /*  4 */    UInt32      unknown_0008;           /*  8 */    Int32       block_prev;             /*  c */    Int32       block_next;             /* 10 */}; /* __attribute__ ((aligned (1))); */static int _unmarshal_pmgl_header(unsigned char **pData,                                  unsigned long *pDataLen,                                  struct chmPmglHeader *dest){    /* we only know how to deal with a 0x14 byte structures */    if (*pDataLen != _CHM_PMGL_LEN)        return 0;    /* unmarshal fields */    _unmarshal_char_array(pData, pDataLen,  dest->signature, 4);    _unmarshal_uint32    (pData, pDataLen, &dest->free_space);    _unmarshal_uint32    (pData, pDataLen, &dest->unknown_0008);    _unmarshal_int32     (pData, pDataLen, &dest->block_prev);    _unmarshal_int32     (pData, pDataLen, &dest->block_next);    /* check structure */    if (memcmp(dest->signature, _chm_pmgl_marker, 4) != 0)        return 0;    return 1;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲女同一区二区| 大白屁股一区二区视频| 激情综合网激情| 99久久精品免费| 91.xcao| 亚洲天天做日日做天天谢日日欢 | 欧美偷拍一区二区| 国产欧美一区二区精品久导航| 亚洲精品日韩一| 成人永久aaa| 亚洲精品一区二区三区99| 亚洲国产成人av好男人在线观看| 国产成人午夜电影网| 欧美精品在欧美一区二区少妇| 成人免费一区二区三区视频| 老鸭窝一区二区久久精品| 在线一区二区三区四区五区| 国产欧美一区二区精品婷婷| 久久成人综合网| 欧美日韩电影在线播放| 亚洲精品视频免费观看| 成人性视频网站| 欧美国产国产综合| 东方aⅴ免费观看久久av| 精品欧美一区二区在线观看| 日韩专区在线视频| 欧美日韩亚洲国产综合| 亚洲国产日产av| 91电影在线观看| 自拍偷拍国产亚洲| 91在线观看一区二区| 国产视频在线观看一区二区三区 | 成人av中文字幕| 久久男人中文字幕资源站| 日韩福利电影在线观看| 欧美高清www午色夜在线视频| 亚洲中国最大av网站| 在线精品国精品国产尤物884a| ●精品国产综合乱码久久久久| 国产大陆a不卡| 夜夜揉揉日日人人青青一国产精品| 欧美亚洲综合色| 成人免费视频一区二区| 91精品啪在线观看国产60岁| 日韩视频在线永久播放| 美女视频黄久久| 精品91自产拍在线观看一区| 日韩电影网1区2区| 欧美videossexotv100| 狠狠色丁香婷综合久久| 2020国产精品久久精品美国| 国产乱淫av一区二区三区| 中文字幕成人av| 在线视频你懂得一区二区三区| 亚洲一区二区影院| 在线不卡的av| 裸体一区二区三区| 精品国产乱码久久久久久老虎| 国产麻豆91精品| 亚洲人成网站在线| 欧美一区二区三区小说| 国产乱子伦一区二区三区国色天香 | 欧美久久久久久久久中文字幕| 午夜精品国产更新| 久久综合久久综合九色| 99re热这里只有精品视频| 五月天一区二区| 国产亚洲一区二区三区| 99久久精品国产观看| 日韩精品久久理论片| 国产午夜精品福利| 欧美日韩第一区日日骚| 国产精品18久久久久久久网站| 亚洲激情五月婷婷| 久久综合丝袜日本网| 欧美制服丝袜第一页| 国产一区二区三区久久久| 一区二区久久久| 337p日本欧洲亚洲大胆精品| 欧美亚洲高清一区| 国产不卡在线一区| 日韩精品亚洲一区二区三区免费| 亚洲国产精品高清| 日韩免费电影网站| 欧美日免费三级在线| 成人午夜在线播放| 麻豆精品一区二区| 一区二区三区中文在线观看| 久久精子c满五个校花| 欧美一区二区三区公司| 国产91综合网| 国产一区二区三区免费在线观看| 亚洲丰满少妇videoshd| 一区二区中文字幕在线| 久久久久久亚洲综合| 欧美一级精品大片| 欧美日韩一区二区电影| 在线中文字幕不卡| 91视频你懂的| aaa欧美色吧激情视频| 国产精品影视在线观看| 麻豆精品新av中文字幕| 天堂蜜桃91精品| 亚洲已满18点击进入久久| 亚洲图片激情小说| 中文字幕日韩精品一区| 国产精品麻豆一区二区| 中文av一区特黄| 久久综合久久综合亚洲| 久久综合视频网| 精品美女被调教视频大全网站| 欧美一二三四在线| 欧美大片在线观看一区二区| 日韩一区二区三区免费观看| 3atv一区二区三区| 69精品人人人人| 91精品国产品国语在线不卡| 欧美日产在线观看| 91精品国产综合久久精品麻豆| 欧美无砖专区一中文字| 欧美精品日韩一区| 日韩一区二区高清| 久久你懂得1024| 中文字幕一区二区三区不卡在线 | 欧美一卡二卡三卡四卡| 91精品国产麻豆| 欧美成人精品1314www| 久久你懂得1024| 国产精品天干天干在观线| 亚洲色图丝袜美腿| 午夜精品成人在线| 国内精品写真在线观看| 国产91富婆露脸刺激对白| 成人av在线一区二区| 91福利区一区二区三区| 欧美日韩精品一区二区三区蜜桃 | 蜜臀va亚洲va欧美va天堂| 激情综合色播五月| 成人网在线播放| 91久久精品一区二区二区| 欧美色图天堂网| 日韩精品一区二区三区视频在线观看 | 麻豆国产91在线播放| 国产精品白丝jk黑袜喷水| 99久久国产综合色|国产精品| 91成人国产精品| 日韩欧美中文字幕制服| 欧美激情综合五月色丁香小说| 国产精品少妇自拍| 亚洲最色的网站| 激情都市一区二区| 91在线云播放| 日韩午夜激情视频| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲成人先锋电影| 高清不卡一二三区| 69久久夜色精品国产69蝌蚪网| 国产午夜三级一区二区三| 亚洲一区视频在线| 成人午夜伦理影院| 日韩一级免费观看| 亚洲另类中文字| 国产一区二区成人久久免费影院| 色婷婷国产精品综合在线观看| 日韩亚洲国产中文字幕欧美| 亚洲欧美日韩在线播放| 国产一区二区三区精品视频| 欧亚洲嫩模精品一区三区| 久久综合久久综合久久| 午夜国产不卡在线观看视频| 成人爽a毛片一区二区免费| 欧美日本在线看| 亚洲欧美日韩一区| 国产99一区视频免费| 日韩欧美一区二区免费| 亚洲国产婷婷综合在线精品| 成人黄色777网| 久久精品亚洲乱码伦伦中文| 日本欧美加勒比视频| 欧美日韩一区在线| 亚洲欧美日韩人成在线播放| 粉嫩蜜臀av国产精品网站| 日韩三级电影网址| 丝袜亚洲精品中文字幕一区| 色综合久久综合| 国产精品免费久久| 国产不卡视频在线观看| 日韩美女天天操| 免费久久99精品国产| 欧美亚洲国产一区二区三区| 亚洲免费在线看| 91女神在线视频| 亚洲特级片在线| 一本大道久久a久久综合| 中文字幕一区二区三区四区不卡| 国产成人亚洲综合a∨猫咪| 久久众筹精品私拍模特| 韩国精品久久久| 国产欧美综合在线观看第十页| 激情欧美日韩一区二区|