View Single Post
Old 06-10-2014, 11:36 PM   #62
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi,

I ran DumpMobiHeader_v015.py on your sample files. It seems the Mobi Meta Editor does improperly trim the padding placed there by kindlegen and calibre which is what causes the problem:

Here is the original section map:
Code:
Map of Palm DB Sections
    Dec  - Hex : Description
    ---- - ----  -----------
    0000 - 0000: HEADER 6 [8736]
    0001 - 0001: Text Record 0 [866]
    0002 - 0002: 0000  [2]
    0003 - 0003: NCX Index 0 [236]
    0004 - 0004: NCX Index 1 [208]
    0005 - 0005: NCX Index CNX [8]
    0006 - 0006: Image jpeg [8956]
    0007 - 0007: RESC [4112]
    0008 - 0008: FLIS [36]
    0009 - 0009: FCIS [44]
    0010 - 000a: Source Archive 0 [1612]
    0011 - 000b: BOUNDARY [8]
    0012 - 000c: HEADER 8 [8736]
    0013 - 000d: Text Record 0 [1587]
    0014 - 000e: 00  [1]
    0015 - 000f: Fragment Index 0 [248]
    0016 - 0010: Fragment Index 1 [220]
    0017 - 0011: Fragment Index CNX [16]
    0018 - 0012: Skeleton Index 0 [244]
    0019 - 0013: Skeleton Index_Index 1 [224]
    0020 - 0014: NCX Index 0 [240]
    0021 - 0015: NCX Index 1 [212]
    0022 - 0016: NCX Index CNX [8]
    0023 - 0017: FDST [28]
    0024 - 0018: FLIS [36]
    0025 - 0019: FCIS [44]
    0026 - 001a: DATP [52]
    0027 - 001b: EOF_RECORD [4]
Notice the size of each header is 8736 bytes long. This is made up of 16 bytes of extra info at the start followed by 264 bytes (0x108) bytes of header information plus the EXTH info (264 bytes) leaving 8192 (0x2000) bytes of padding for the DRM Keys, extra metadata, etc.

Here it is again after passing through MME
Code:
Map of Palm DB Sections
    Dec  - Hex : Description
    ---- - ----  -----------
    0000 - 0000: HEADER 6 [572]
    0001 - 0001: Text Record 0 [866]
    0002 - 0002: 0000  [2]
    0003 - 0003: NCX Index 0 [236]
    0004 - 0004: NCX Index 1 [208]
    0005 - 0005: NCX Index CNX [8]
    0006 - 0006: Image jpeg [8956]
    0007 - 0007: RESC [4112]
    0008 - 0008: FLIS [36]
    0009 - 0009: FCIS [44]
    0010 - 000a: Source Archive 0 [1612]
    0011 - 000b: BOUNDARY [8]
    0012 - 000c: HEADER 8 [8736]
    0013 - 000d: Text Record 0 [1587]
    0014 - 000e: 00  [1]
    0015 - 000f: Fragment Index 0 [248]
    0016 - 0010: Fragment Index 1 [220]
    0017 - 0011: Fragment Index CNX [16]
    0018 - 0012: Skeleton Index 0 [244]
    0019 - 0013: Skeleton Index_Index 1 [224]
    0020 - 0014: NCX Index 0 [240]
    0021 - 0015: NCX Index 1 [212]
    0022 - 0016: NCX Index CNX [8]
    0023 - 0017: FDST [28]
    0024 - 0018: FLIS [36]
    0025 - 0019: FCIS [44]
    0026 - 001a: DATP [52]
    0027 - 001b: EOF_RECORD [4]
Notice that the Mobi 6 header is shrunk greatly in size to just 572 bytes (all of the extra padding is removed). Also it is clear MME does not understand how to deal with the Mobi 8 (azw3) part and ignores it.

So this is definitely an MME bug. It really needs to not remove all of the padding added to the end of the header information which is used to store the DRM Keys, and provides room for all of the extra DRM related Meta information to be added on the fly (as Amazon does).


Hope this helps,

KevinH
KevinH is online now   Reply With Quote