chm的文件格式不知大家是否知道?
http://www.speakeasy.org/~russotto/chm/chmformat.html
我想读出chm文件的内容,请问如何操作呢?

解决方案 »

  1.   

    既然已经知道文件的结构,那就好办了,用TFILESTREAM或者内存映射文件的方式都可以
    我一般都用后者:fileopen,fileseek, fileread,fileclose
      

  2.   

    关键遇到了问题:
    0000: char[4]  'PMGL'
    0004: DWORD    Length of free space and/or quickref area at end of
                   directory chunk 
    0008: DWORD    Always 0. 
    000C: DWORD    Chunk number of previous listing chunk when reading
                   directory in sequence (-1 if this is the first listing chunk)
    0010: DWORD    Chunk number of next listing chunk when reading
                   directory in sequence (-1 if this is the last listing chunk)
    0014: Directory listing entries (to quickref area)  Sorted by
          filename; the sort is case-insensitive.The quickref area is written backwards from the end of the chunk. One quickref entry exists for every n entries in the file, where n is calculated as 1 + (1 << quickref density). So for density = 2, n = 5. Chunklen-0002: WORD     Number of entries in the chunk
    Chunklen-0004: WORD     Offset of entry n from entry 0
    Chunklen-0008: WORD     Offset of entry 2n from entry 0
    Chunklen-000C: WORD     Offset of entry 3n from entry 0
    ...The format of a directory listing entry is as follows       ENCINT: length of name
          BYTEs: name  (UTF-8 encoded)
          ENCINT: content section
          ENCINT: offset
          ENCINT: length不知道这时如何解决?
      

  3.   

    0000: char[4]  'PMGL'
    fileseek(aHnd, 0, 0);
    fileread(aHnd, Buf, 4);
    buf -> 'PMGL'
      

  4.   

    主要到了这里:
    0014: Directory listing entries (to quickref area)  Sorted by
          filename; the sort is case-insensitive.
    如何解决????