U32 wvGetFIDCL(FIDCL *afidcl, wvStream *fd) { afidcl->dgid = read_32ubit(fd); afidcl->cspidCur = read_32ubit(fd); wvTrace(("dgid %d cspidCur %d\n", afidcl->dgid, afidcl->cspidCur)); return 8; }
U32 wvGetFSP(FSP *fsp, wvStream *fd) { fsp->spid = read_32ubit(fd); wvTrace(("SPID is %x\n", fsp->spid)); fsp->grfPersistent = read_32ubit(fd); return 8; }
U32 wvGetFDG(FDG *afdg, wvStream *fd) { afdg->csp = read_32ubit(fd); afdg->spidCur = read_32ubit(fd); wvTrace( ("there are %d shapes here, the last is %x\n", afdg->csp, afdg->spidCur)); return 8; }
U32 wvGetFSPGR(FSPGR *item, wvStream *fd) { /* It is supposed to be a RECT, but its only 4 long so... */ item->rcgBounds.left = read_32ubit(fd); item->rcgBounds.right = read_32ubit(fd); item->rcgBounds.top = read_32ubit(fd); item->rcgBounds.bottom = read_32ubit(fd); return 16; }
void wvGetFONTSIGNATURE(FONTSIGNATURE *fs, wvStream *fd) { int i; for (i = 0; i < 4; i++) fs->fsUsb[i] = read_32ubit(fd); for (i = 0; i < 2; i++) fs->fsCsb[i] = read_32ubit(fd); }
U32 wvGetFDGG(FDGG *afdgg, wvStream *fd) { afdgg->spidMax = read_32ubit(fd); afdgg->cidcl = read_32ubit(fd); afdgg->cspSaved = read_32ubit(fd); afdgg->cdgSaved = read_32ubit(fd); wvTrace( ("spidMax %d cidcl %d cspSaved %d cdgSaved %d\n", afdgg->spidMax, afdgg->cidcl, afdgg->cspSaved, afdgg->cdgSaved)); return 16; }
U32 twvGetFOPTE (FOPTE * afopte, wvStream * infd) { U32 ret = 0; U16 dtemp; dtemp = read_16ubit (infd); #ifdef PURIFY afopte->pid = 0; afopte->fBid = 0; afopte->fComplex = 0; #endif afopte->pid = (dtemp & 0x3fff); afopte->fBid = ((dtemp & 0x4000) >> 14); afopte->fComplex = ((dtemp & 0x8000) >> 15); afopte->op = read_32ubit (infd); if (afopte->fComplex) { wvTrace (("1 complex len is %d (%x)\n", afopte->op, afopte->op)); ret = afopte->op; } #if 0 else if (afopte->fBid) wvTrace ( ("great including graphic number %d %d\n", afopte->op, afopte->op)); #endif wvTrace ( ("orig %x,pid is %x, val is %x\n", dtemp, afopte->pid, afopte->op)); return (ret); }
int wvGetFRD_PLCF(FRD **frd, U32 **pos, int *nofrd, U32 offset, U32 len, wvStream *fd) { int i; if (len == 0) { *frd = NULL; *pos = NULL; *nofrd = 0; } else { *nofrd = (len - 4) / 6; *pos = (U32 *)wvMalloc((*nofrd + 1) * sizeof(U32)); if (*pos == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", (*nofrd + 1) * sizeof(U32))); return 1; } *frd = (FRD *)wvMalloc(*nofrd * sizeof(FRD)); if (*frd == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", *nofrd * sizeof(FRD))); wvFree(pos); return 1; } wvStream_goto(fd, offset); for (i = 0; i < *nofrd + 1; i++) (*pos)[i] = read_32ubit(fd); for (i = 0; i < *nofrd; i++) wvGetFRD(&((*frd)[i]), fd); } return 0; }
/* this function retrieves a generic PLCF; this is useful since it means we do not have to add specific functions for retrieving various simple PLCFs (for instance the PLCFs that store information about footnotes, endnotes and annotations are just simple arrays of U32s) plcf - a pointer to a pointer where we should allocate the structure the caller needs to free these using wvFree() once not needed offset - an offset in the stream fd where the PLCF starts len - a length in bytes (!!!) of the PLCF fd - the stream from which to read the PLCF */ int wvGetPLCF (void ** plcf, U32 offset, U32 len, wvStream * fd) { U32 i, i32, i8; if (len == 0) { *plcf = NULL; } else { *plcf = wvMalloc (len); if (*plcf == NULL) { wvError (("NO MEM 1, failed to alloc %d bytes\n",len)); return (1); } wvStream_goto (fd, offset); i32 = len / 4; i8 = len % 4; for (i = 0; i < i32; i++) ((U32*)(*plcf))[i] = read_32ubit (fd); for (i = i32*4; i < i32*4 + i8; i++) ((U8*)(*plcf))[i] = read_8ubit (fd); } return (0); }
int wvGetEmpty_PLCF (U32 ** cps, U32 * nocps, U32 offset, U32 len, wvStream * fd) { U32 i; if (len == 0) { *cps = NULL; *nocps = 0; } else { *nocps = len / 4; *cps = (U32 *) malloc (*nocps * sizeof (U32)); if (*cps == NULL) { wvError ( ("NO MEM 3, failed to alloc %d bytes\n", *nocps * sizeof (U32))); return (1); } wvStream_goto (fd, offset); for (i = 0; i < *nocps; i++) (*cps)[i] = read_32ubit (fd); } return (0); }
void wvGetPGD(wvVersion ver, PGD *item, wvStream *fd) { U16 temp16; temp16 = read_16ubit(fd); item->fContinue = temp16 & 0x0001; item->fUnk = (temp16 & 0x0002) >> 1; item->fRight = (temp16 & 0x0004) >> 2; item->fPgnRestart = (temp16 & 0x0008) >> 3; item->fEmptyPage = (temp16 & 0x0010) >> 4; item->fAllFtn = (temp16 & 0x0020) >> 5; item->fColOnly = (temp16 & 0x0040) >> 6; item->fTableBreaks = (temp16 & 0x0080) >> 7; item->fMarked = (temp16 & 0x0100) >> 8; item->fColumnBreaks = (temp16 & 0x0200) >> 9; item->fTableHeader = (temp16 & 0x0400) >> 10; item->fNewPage = (temp16 & 0x0800) >> 11; item->bkc = (temp16 & 0xF000) >> 12; item->lnn = read_16ubit(fd); item->pgn = read_16ubit(fd); if (ver == WORD8) item->dym = (S32)read_32ubit(fd); else item->dym = 0; }
U32 twvGetFBSE (FBSE * afbse, wvStream * infd) { int i; afbse->btWin32 = read_8ubit (infd); afbse->btMacOS = read_8ubit (infd); for (i = 0; i < 16; i++) afbse->rgbUid[i] = read_8ubit (infd); afbse->tag = read_16ubit (infd); afbse->size = read_32ubit (infd); afbse->cRef = read_32ubit (infd); afbse->foDelay = read_32ubit (infd); afbse->usage = read_8ubit (infd); afbse->cbName = read_8ubit (infd); afbse->unused2 = read_8ubit (infd); afbse->unused3 = read_8ubit (infd); return (36); }
void wvGetBTE (BTE * bte, wvStream * fd) { U32 temp32 = read_32ubit (fd); #ifdef PURIFY wvInitBTE (bte); #endif bte->pn = temp32 & 0x003fffffL; bte->unused = (temp32 & 0xffc00000L) >> 22; }
U32 wvGetFBSE(FBSE *afbse, wvStream *fd) { int i; afbse->btWin32 = read_8ubit(fd); afbse->btMacOS = read_8ubit(fd); for (i = 0; i < 16; i++) afbse->rgbUid[i] = read_8ubit(fd); afbse->tag = read_16ubit(fd); afbse->size = read_32ubit(fd); afbse->cRef = read_32ubit(fd); afbse->foDelay = read_32ubit(fd); wvTrace(("location is %x, size is %d\n", afbse->foDelay, afbse->size)); afbse->usage = read_8ubit(fd); afbse->cbName = read_8ubit(fd); wvTrace(("name len is %d\n", afbse->cbName)); afbse->unused2 = read_8ubit(fd); afbse->unused3 = read_8ubit(fd); return 36; }
void wvGetWKB(WKB *item, wvStream *fd) { U16 temp16; item->fn = (S16)read_16ubit(fd); item->grfwkb = read_16ubit(fd); item->lvl = (S16)read_16ubit(fd); temp16 = read_16ubit(fd); item->fnpt = temp16 & 0x000F; item->fnpd = (temp16 & 0xFFF0) >> 4; item->doc = (S32)read_32ubit(fd); }
U32 wvGetSplitMenuColors(SplitMenuColors *splitmenucolors, MSOFBH *amsofbh, wvStream *fd) { U32 i = 0; splitmenucolors->noofcolors = amsofbh->cbLength / 4; if (splitmenucolors->noofcolors) { splitmenucolors->colors = (U32 *)wvMalloc(sizeof(U32) * splitmenucolors->noofcolors); for (i = 0; i < splitmenucolors->noofcolors; i++) splitmenucolors->colors[i] = read_32ubit(fd); } return i * 4; }
U32 dread_32ubit (wvStream * in, U8 ** list) { U8 *temp; U32 ret; if (in != NULL) return (read_32ubit (in)); else { temp = *list; (*list) += 4; ret = sread_32ubit (temp); return (ret); } }
int wvGetBTE_PLCF6 (BTE ** bte, U32 ** pos, U32 * nobte, U32 offset, U32 len, wvStream * fd) { U32 i; if (len == 0) { *bte = NULL; *pos = NULL; *nobte = 0; } else { wvTrace (("offset is %x, len is %d\n", offset, len)); *nobte = (len - 4) / (cb6BTE + 4); wvTrace (("no of bte is %d at %x\n", *nobte, offset)); *pos = (U32 *) wvMalloc ((*nobte + 1) * sizeof (U32)); if (*pos == NULL) { wvError ( ("NO MEM 1, failed to alloc %d bytes\n", (*nobte + 1) * sizeof (U32))); return (1); } *bte = (BTE *) wvMalloc (*nobte * sizeof (BTE)); if (*bte == NULL) { wvError ( ("NO MEM 1, failed to alloc %d bytes\n", *nobte * sizeof (BTE))); wvFree (pos); return (1); } wvStream_goto (fd, offset); for (i = 0; i <= *nobte; i++) { (*pos)[i] = read_32ubit (fd); wvTrace (("pos is %x\n", (*pos)[i])); } for (i = 0; i < *nobte; i++) { wvInitBTE (&((*bte)[i])); (*bte)[i].pn = read_16ubit (fd); } } return (0); }
U32 wvGetMSOFBH(MSOFBH *amsofbh, wvStream *fd) { U16 dtemp = 0; dtemp = read_16ubit(fd); #ifdef PURIFY amsofbh->ver = 0; amsofbh->inst = 0; #endif amsofbh->ver = dtemp & 0x000F; amsofbh->inst = dtemp >> 4; amsofbh->fbt = read_16ubit(fd); amsofbh->cbLength = read_32ubit(fd); return 8; }
int wvGetBKD_PLCF (BKD ** bkd, U32 ** pos, U32 * nobkd, U32 offset, U32 len, wvStream * fd) { U32 i; if (len == 0) { *bkd = NULL; *pos = NULL; *nobkd = 0; } else { *nobkd = (len - 4) / (cbBKD + 4); *pos = (U32 *) wvMalloc ((*nobkd + 1) * sizeof (U32)); if (*pos == NULL) { wvError ( ("NO MEM 1, failed to alloc %d bytes\n", (*nobkd + 1) * sizeof (U32))); return (1); } *bkd = (BKD *) wvMalloc (*nobkd * sizeof (BKD)); if (*bkd == NULL) { wvError ( ("NO MEM 1, failed to alloc %d bytes\n", *nobkd * sizeof (BKD))); wvFree (pos); return (1); } wvStream_goto (fd, offset); for (i = 0; i < *nobkd + 1; i++) { (*pos)[i] = read_32ubit (fd); } for (i = 0; i < *nobkd; i++) { wvGetBKD (&((*bkd)[i]), fd); } } return (0); }
int wvGetBTE_PLCF(BTE **bte, U32 **pos, U32 *nobte, U32 offset, U32 len, wvStream *fd) { U32 i; if (len == 0) { *bte = NULL; *pos = NULL; *nobte = 0; } else { *nobte = (len - 4) / (cbBTE + 4); wvTrace(("no of bte is %d at %x\n", *nobte, offset)); *pos = (U32 *)wvMalloc((*nobte + 1) * sizeof(U32)); if (*pos == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", (*nobte + 1) * sizeof(U32))); return 1; } *bte = (BTE *)wvMalloc(*nobte * sizeof(BTE)); if (*bte == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", *nobte * sizeof(BTE))); wvFree(*pos); return 1; } wvStream_goto(fd, offset); for (i = 0; i <= *nobte; i++) (*pos)[i] = read_32ubit(fd); for (i = 0; i < *nobte; i++) wvGetBTE(&((*bte)[i]), fd); } return 0; }
void wvGetASUMY(ASUMY *item, wvStream *fd) { item->lLevel = (S32)read_32ubit(fd); }
int wvGetBKL_PLCF(BKL **bkl, U32 **pos, U32 *nobkl, U32 bkloffset, U32 bkllen, U32 bkfoffset, U32 bkflen, wvStream *fd) { BKF *bkf; U32 *posf, nobkf; U32 i, j; if ((bkllen == 0) || (bkflen == 0)) { *bkl = NULL; *pos = NULL; *nobkl = 0; } else { /* the plcbkl table contains offsets only, bkl has to be calculated from bkf */ *nobkl = (bkllen - 4) / (/*cbBKL +*/ 4); *pos = (U32 *)wvMalloc((*nobkl + 1) * sizeof(U32)); if (*pos == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", (*nobkl + 1) * sizeof(U32))); return 1; } *nobkl = (*nobkl ? *nobkl : 1); *bkl = (BKL *)wvMalloc(*nobkl * sizeof(BKL)); if (*bkl == NULL) { wvError( ("NO MEM 1, failed to alloc %d bytes\n", *nobkl * sizeof(BKL))); wvFree(*pos); return 1; } wvStream_goto(fd, bkloffset); for (i = 0; i <= *nobkl; i++) (*pos)[i] = read_32ubit(fd); /* now we have to reconstruct the bkl table; we have to get the bkf records, and then search them to find one that matches the index we are processing */ if (wvGetBKF_PLCF(&bkf, &posf, &nobkf, bkfoffset, bkflen, fd)) { wvError( ("call to wvGetBKF_PLCF failed\n")); wvFree(*pos); wvFree(*bkl); return 1; } for (i = 0; i < *nobkl; i++) { for (j = 0; j < nobkf; j++) if (bkf[j].ibkl == i) break; if (j == nobkf) { wvError( ("unmatched closing bookmark\n")); wvFree(*pos); wvFree(*bkl); wvFree(bkf); wvFree(posf); return 1; } (*bkl)[i].ibkf = (U16)j; } wvFree(bkf); wvFree(posf); } return 0; }
void wvGetFIB6 (FIB * item, wvStream * fd) { U16 temp16; U8 temp8; item->wIdent = read_16ubit (fd); item->nFib = read_16ubit (fd); item->nProduct = read_16ubit (fd); item->lid = read_16ubit (fd); wvTrace (("lid is %x\n", item->lid)); item->pnNext = (S16) read_16ubit (fd); temp16 = read_16ubit (fd); item->fDot = (temp16 & 0x0001); item->fGlsy = (temp16 & 0x0002) >> 1; item->fComplex = (temp16 & 0x0004) >> 2; item->fHasPic = (temp16 & 0x0008) >> 3; item->cQuickSaves = (temp16 & 0x00F0) >> 4; item->fEncrypted = (temp16 & 0x0100) >> 8; item->fWhichTblStm = 0; /* word 6 files only have one table stream */ item->fReadOnlyRecommended = (temp16 & 0x0400) >> 10; item->fWriteReservation = (temp16 & 0x0800) >> 11; item->fExtChar = (temp16 & 0x1000) >> 12; wvTrace (("fExtChar is %d\n", item->fExtChar)); item->fLoadOverride = 0; item->fFarEast = 0; item->fCrypto = 0; item->nFibBack = read_16ubit (fd); item->lKey = read_32ubit (fd); item->envr = read_8ubit (fd); temp8 = read_8ubit (fd); item->fMac = 0; item->fEmptySpecial = 0; item->fLoadOverridePage = 0; item->fFutureSavedUndo = 0; item->fWord97Saved = 0; item->fSpare0 = 0; item->chse = read_16ubit (fd); item->chsTables = read_16ubit (fd); item->fcMin = read_32ubit (fd); item->fcMac = read_32ubit (fd); item->csw = 14; item->wMagicCreated = 0xCA0; /*this is the unique id of the creater, so its me :-) */ item->cbMac = read_32ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); read_16ubit (fd); item->ccpText = read_32ubit (fd); item->ccpFtn = (S32) read_32ubit (fd); item->ccpHdr = (S32) read_32ubit (fd); item->ccpMcr = (S32) read_32ubit (fd); item->ccpAtn = (S32) read_32ubit (fd); item->ccpEdn = (S32) read_32ubit (fd); item->ccpTxbx = (S32) read_32ubit (fd); item->ccpHdrTxbx = (S32) read_32ubit (fd); read_32ubit (fd); item->fcStshfOrig = (S32) read_32ubit (fd); item->lcbStshfOrig = read_32ubit (fd); item->fcStshf = (S32) read_32ubit (fd); item->lcbStshf = read_32ubit (fd); item->fcPlcffndRef = (S32) read_32ubit (fd); item->lcbPlcffndRef = read_32ubit (fd); item->fcPlcffndTxt = (S32) read_32ubit (fd); item->lcbPlcffndTxt = read_32ubit (fd); item->fcPlcfandRef = (S32) read_32ubit (fd); item->lcbPlcfandRef = read_32ubit (fd); item->fcPlcfandTxt = (S32) read_32ubit (fd); item->lcbPlcfandTxt = read_32ubit (fd); item->fcPlcfsed = (S32) read_32ubit (fd); item->lcbPlcfsed = read_32ubit (fd); item->fcPlcpad = (S32) read_32ubit (fd); item->lcbPlcpad = read_32ubit (fd); item->fcPlcfphe = (S32) read_32ubit (fd); item->lcbPlcfphe = read_32ubit (fd); item->fcSttbfglsy = (S32) read_32ubit (fd); item->lcbSttbfglsy = read_32ubit (fd); item->fcPlcfglsy = (S32) read_32ubit (fd); item->lcbPlcfglsy = read_32ubit (fd); item->fcPlcfhdd = (S32) read_32ubit (fd); item->lcbPlcfhdd = read_32ubit (fd); item->fcPlcfbteChpx = (S32) read_32ubit (fd); item->lcbPlcfbteChpx = read_32ubit (fd); item->fcPlcfbtePapx = (S32) read_32ubit (fd); item->lcbPlcfbtePapx = read_32ubit (fd); item->fcPlcfsea = (S32) read_32ubit (fd); item->lcbPlcfsea = read_32ubit (fd); item->fcSttbfffn = (S32) read_32ubit (fd); item->lcbSttbfffn = read_32ubit (fd); item->fcPlcffldMom = (S32) read_32ubit (fd); item->lcbPlcffldMom = read_32ubit (fd); item->fcPlcffldHdr = (S32) read_32ubit (fd); item->lcbPlcffldHdr = read_32ubit (fd); item->fcPlcffldFtn = (S32) read_32ubit (fd); item->lcbPlcffldFtn = read_32ubit (fd); item->fcPlcffldAtn = (S32) read_32ubit (fd); item->lcbPlcffldAtn = read_32ubit (fd); item->fcPlcffldMcr = (S32) read_32ubit (fd); item->lcbPlcffldMcr = read_32ubit (fd); item->fcSttbfbkmk = (S32) read_32ubit (fd); item->lcbSttbfbkmk = read_32ubit (fd); item->fcPlcfbkf = (S32) read_32ubit (fd); item->lcbPlcfbkf = read_32ubit (fd); item->fcPlcfbkl = (S32) read_32ubit (fd); item->lcbPlcfbkl = read_32ubit (fd); item->fcCmds = (S32) read_32ubit (fd); item->lcbCmds = read_32ubit (fd); item->fcPlcmcr = (S32) read_32ubit (fd); item->lcbPlcmcr = read_32ubit (fd); item->fcSttbfmcr = (S32) read_32ubit (fd); item->lcbSttbfmcr = read_32ubit (fd); item->fcPrDrvr = (S32) read_32ubit (fd); item->lcbPrDrvr = read_32ubit (fd); item->fcPrEnvPort = (S32) read_32ubit (fd); item->lcbPrEnvPort = read_32ubit (fd); item->fcPrEnvLand = (S32) read_32ubit (fd); item->lcbPrEnvLand = read_32ubit (fd); item->fcWss = (S32) read_32ubit (fd); item->lcbWss = read_32ubit (fd); item->fcDop = (S32) read_32ubit (fd); item->lcbDop = read_32ubit (fd); item->fcSttbfAssoc = (S32) read_32ubit (fd); item->lcbSttbfAssoc = read_32ubit (fd); item->fcClx = (S32) read_32ubit (fd); item->lcbClx = read_32ubit (fd); item->fcPlcfpgdFtn = (S32) read_32ubit (fd); item->lcbPlcfpgdFtn = read_32ubit (fd); item->fcAutosaveSource = (S32) read_32ubit (fd); item->lcbAutosaveSource = read_32ubit (fd); item->fcGrpXstAtnOwners = (S32) read_32ubit (fd); item->lcbGrpXstAtnOwners = read_32ubit (fd); item->fcSttbfAtnbkmk = (S32) read_32ubit (fd); item->lcbSttbfAtnbkmk = read_32ubit (fd); read_16ubit (fd); item->pnChpFirst = (S32) read_16ubit (fd); item->pnPapFirst = (S32) read_16ubit (fd); item->cpnBteChp = (S32) read_16ubit (fd); item->cpnBtePap = (S32) read_16ubit (fd); item->fcPlcdoaMom = (S32) read_32ubit (fd); item->lcbPlcdoaMom = read_32ubit (fd); item->fcPlcdoaHdr = (S32) read_32ubit (fd); item->lcbPlcdoaHdr = read_32ubit (fd); read_32ubit (fd); read_32ubit (fd); read_32ubit (fd); read_32ubit (fd); item->fcPlcfAtnbkf = (S32) read_32ubit (fd); item->lcbPlcfAtnbkf = read_32ubit (fd); item->fcPlcfAtnbkl = (S32) read_32ubit (fd); item->lcbPlcfAtnbkl = read_32ubit (fd); item->fcPms = (S32) read_32ubit (fd); item->lcbPms = read_32ubit (fd); item->fcFormFldSttbs = (S32) read_32ubit (fd); item->lcbFormFldSttbs = read_32ubit (fd); item->fcPlcfendRef = (S32) read_32ubit (fd); item->lcbPlcfendRef = read_32ubit (fd); item->fcPlcfendTxt = (S32) read_32ubit (fd); item->lcbPlcfendTxt = read_32ubit (fd); item->fcPlcffldEdn = (S32) read_32ubit (fd); item->lcbPlcffldEdn = read_32ubit (fd); item->fcPlcfpgdEdn = (S32) read_32ubit (fd); item->lcbPlcfpgdEdn = read_32ubit (fd); read_32ubit (fd); read_32ubit (fd); item->fcSttbfRMark = (S32) read_32ubit (fd); item->lcbSttbfRMark = read_32ubit (fd); item->fcSttbCaption = (S32) read_32ubit (fd); item->lcbSttbCaption = read_32ubit (fd); item->fcSttbAutoCaption = (S32) read_32ubit (fd); item->lcbSttbAutoCaption = read_32ubit (fd); item->fcPlcfwkb = (S32) read_32ubit (fd); item->lcbPlcfwkb = read_32ubit (fd); read_32ubit (fd); read_32ubit (fd); item->fcPlcftxbxTxt = (S32) read_32ubit (fd); item->lcbPlcftxbxTxt = read_32ubit (fd); item->fcPlcffldTxbx = (S32) read_32ubit (fd); item->lcbPlcffldTxbx = read_32ubit (fd); item->fcPlcfhdrtxbxTxt = (S32) read_32ubit (fd); item->lcbPlcfhdrtxbxTxt = read_32ubit (fd); item->fcPlcffldHdrTxbx = (S32) read_32ubit (fd); item->lcbPlcffldHdrTxbx = read_32ubit (fd); item->fcStwUser = (S32) read_32ubit (fd); item->lcbStwUser = read_32ubit (fd); item->fcSttbttmbd = (S32) read_32ubit (fd); item->cbSttbttmbd = read_32ubit (fd); item->fcUnused = (S32) read_32ubit (fd); item->lcbUnused = read_32ubit (fd); item->fcPgdMother = (S32) read_32ubit (fd); item->lcbPgdMother = read_32ubit (fd); item->fcBkdMother = (S32) read_32ubit (fd); item->lcbBkdMother = read_32ubit (fd); item->fcPgdFtn = (S32) read_32ubit (fd); item->lcbPgdFtn = read_32ubit (fd); item->fcBkdFtn = (S32) read_32ubit (fd); item->lcbBkdFtn = read_32ubit (fd); item->fcPgdEdn = (S32) read_32ubit (fd); item->lcbPgdEdn = read_32ubit (fd); item->fcBkdEdn = (S32) read_32ubit (fd); item->lcbBkdEdn = read_32ubit (fd); item->fcSttbfIntlFld = (S32) read_32ubit (fd); item->lcbSttbfIntlFld = read_32ubit (fd); item->fcRouteSlip = (S32) read_32ubit (fd); item->lcbRouteSlip = read_32ubit (fd); item->fcSttbSavedBy = (S32) read_32ubit (fd); item->lcbSttbSavedBy = read_32ubit (fd); item->fcSttbFnm = (S32) read_32ubit (fd); item->lcbSttbFnm = read_32ubit (fd); }
void wvGetFIB (FIB * item, wvStream * fd) { U16 temp16; U8 temp8; item->fEncrypted = 0; wvStream_goto (fd, 0); #ifdef PURIFY wvInitFIB (item); #endif item->wIdent = read_16ubit (fd); item->nFib = read_16ubit (fd); if ((wvQuerySupported (item, NULL) == WORD2)) { wvInitFIB (item); wvStream_offset (fd, -4); wvGetFIB2 (item, fd); return; } if ((wvQuerySupported (item, NULL) == WORD5) || (wvQuerySupported (item, NULL) == WORD6) || (wvQuerySupported (item, NULL) == WORD7)) { wvInitFIB (item); wvStream_offset (fd, -4); wvGetFIB6 (item, fd); return; } item->nProduct = read_16ubit (fd); item->lid = read_16ubit (fd); wvTrace (("lid is %x\n", item->lid)); item->pnNext = (S16) read_16ubit (fd); temp16 = read_16ubit (fd); item->fDot = (temp16 & 0x0001); item->fGlsy = (temp16 & 0x0002) >> 1; item->fComplex = (temp16 & 0x0004) >> 2; item->fHasPic = (temp16 & 0x0008) >> 3; item->cQuickSaves = (temp16 & 0x00F0) >> 4; item->fEncrypted = (temp16 & 0x0100) >> 8; item->fWhichTblStm = (temp16 & 0x0200) >> 9; item->fReadOnlyRecommended = (temp16 & 0x0400) >> 10; item->fWriteReservation = (temp16 & 0x0800) >> 11; item->fExtChar = (temp16 & 0x1000) >> 12; wvTrace (("fExtChar is %d\n", item->fExtChar)); item->fLoadOverride = (temp16 & 0x2000) >> 13; item->fFarEast = (temp16 & 0x4000) >> 14; item->fCrypto = (temp16 & 0x8000) >> 15; item->nFibBack = read_16ubit (fd); item->lKey = read_32ubit (fd); item->envr = read_8ubit (fd); temp8 = read_8ubit (fd); item->fMac = (temp8 & 0x01); item->fEmptySpecial = (temp8 & 0x02) >> 1; item->fLoadOverridePage = (temp8 & 0x04) >> 2; item->fFutureSavedUndo = (temp8 & 0x08) >> 3; item->fWord97Saved = (temp8 & 0x10) >> 4; item->fSpare0 = (temp8 & 0xFE) >> 5; item->chse = read_16ubit (fd); item->chsTables = read_16ubit (fd); item->fcMin = read_32ubit (fd); item->fcMac = read_32ubit (fd); item->csw = read_16ubit (fd); item->wMagicCreated = read_16ubit (fd); item->wMagicRevised = read_16ubit (fd); item->wMagicCreatedPrivate = read_16ubit (fd); item->wMagicRevisedPrivate = read_16ubit (fd); item->pnFbpChpFirst_W6 = (S16) read_16ubit (fd); item->pnChpFirst_W6 = (S16) read_16ubit (fd); item->cpnBteChp_W6 = (S16) read_16ubit (fd); item->pnFbpPapFirst_W6 = (S16) read_16ubit (fd); item->pnPapFirst_W6 = (S16) read_16ubit (fd); item->cpnBtePap_W6 = (S16) read_16ubit (fd); item->pnFbpLvcFirst_W6 = (S16) read_16ubit (fd); item->pnLvcFirst_W6 = (S16) read_16ubit (fd); item->cpnBteLvc_W6 = (S16) read_16ubit (fd); item->lidFE = (S16) read_16ubit (fd); item->clw = read_16ubit (fd); item->cbMac = (S32) read_32ubit (fd); item->lProductCreated = read_32ubit (fd); item->lProductRevised = read_32ubit (fd); item->ccpText = read_32ubit (fd); item->ccpFtn = (S32) read_32ubit (fd); item->ccpHdr = (S32) read_32ubit (fd); item->ccpMcr = (S32) read_32ubit (fd); item->ccpAtn = (S32) read_32ubit (fd); item->ccpEdn = (S32) read_32ubit (fd); item->ccpTxbx = (S32) read_32ubit (fd); item->ccpHdrTxbx = (S32) read_32ubit (fd); item->pnFbpChpFirst = (S32) read_32ubit (fd); item->pnChpFirst = (S32) read_32ubit (fd); item->cpnBteChp = (S32) read_32ubit (fd); item->pnFbpPapFirst = (S32) read_32ubit (fd); item->pnPapFirst = (S32) read_32ubit (fd); item->cpnBtePap = (S32) read_32ubit (fd); item->pnFbpLvcFirst = (S32) read_32ubit (fd); item->pnLvcFirst = (S32) read_32ubit (fd); item->cpnBteLvc = (S32) read_32ubit (fd); item->fcIslandFirst = (S32) read_32ubit (fd); item->fcIslandLim = (S32) read_32ubit (fd); item->cfclcb = read_16ubit (fd); item->fcStshfOrig = (S32) read_32ubit (fd); item->lcbStshfOrig = read_32ubit (fd); item->fcStshf = (S32) read_32ubit (fd); item->lcbStshf = read_32ubit (fd); item->fcPlcffndRef = (S32) read_32ubit (fd); item->lcbPlcffndRef = read_32ubit (fd); item->fcPlcffndTxt = (S32) read_32ubit (fd); item->lcbPlcffndTxt = read_32ubit (fd); item->fcPlcfandRef = (S32) read_32ubit (fd); item->lcbPlcfandRef = read_32ubit (fd); item->fcPlcfandTxt = (S32) read_32ubit (fd); item->lcbPlcfandTxt = read_32ubit (fd); item->fcPlcfsed = (S32) read_32ubit (fd); item->lcbPlcfsed = read_32ubit (fd); item->fcPlcpad = (S32) read_32ubit (fd); item->lcbPlcpad = read_32ubit (fd); item->fcPlcfphe = (S32) read_32ubit (fd); item->lcbPlcfphe = read_32ubit (fd); item->fcSttbfglsy = (S32) read_32ubit (fd); item->lcbSttbfglsy = read_32ubit (fd); item->fcPlcfglsy = (S32) read_32ubit (fd); item->lcbPlcfglsy = read_32ubit (fd); item->fcPlcfhdd = (S32) read_32ubit (fd); item->lcbPlcfhdd = read_32ubit (fd); item->fcPlcfbteChpx = (S32) read_32ubit (fd); item->lcbPlcfbteChpx = read_32ubit (fd); item->fcPlcfbtePapx = (S32) read_32ubit (fd); item->lcbPlcfbtePapx = read_32ubit (fd); item->fcPlcfsea = (S32) read_32ubit (fd); item->lcbPlcfsea = read_32ubit (fd); item->fcSttbfffn = (S32) read_32ubit (fd); item->lcbSttbfffn = read_32ubit (fd); item->fcPlcffldMom = (S32) read_32ubit (fd); item->lcbPlcffldMom = read_32ubit (fd); item->fcPlcffldHdr = (S32) read_32ubit (fd); item->lcbPlcffldHdr = read_32ubit (fd); item->fcPlcffldFtn = (S32) read_32ubit (fd); item->lcbPlcffldFtn = read_32ubit (fd); item->fcPlcffldAtn = (S32) read_32ubit (fd); item->lcbPlcffldAtn = read_32ubit (fd); item->fcPlcffldMcr = (S32) read_32ubit (fd); item->lcbPlcffldMcr = read_32ubit (fd); item->fcSttbfbkmk = (S32) read_32ubit (fd); item->lcbSttbfbkmk = read_32ubit (fd); item->fcPlcfbkf = (S32) read_32ubit (fd); item->lcbPlcfbkf = read_32ubit (fd); item->fcPlcfbkl = (S32) read_32ubit (fd); item->lcbPlcfbkl = read_32ubit (fd); item->fcCmds = (S32) read_32ubit (fd); item->lcbCmds = read_32ubit (fd); item->fcPlcmcr = (S32) read_32ubit (fd); item->lcbPlcmcr = read_32ubit (fd); item->fcSttbfmcr = (S32) read_32ubit (fd); item->lcbSttbfmcr = read_32ubit (fd); item->fcPrDrvr = (S32) read_32ubit (fd); item->lcbPrDrvr = read_32ubit (fd); item->fcPrEnvPort = (S32) read_32ubit (fd); item->lcbPrEnvPort = read_32ubit (fd); item->fcPrEnvLand = (S32) read_32ubit (fd); item->lcbPrEnvLand = read_32ubit (fd); item->fcWss = (S32) read_32ubit (fd); item->lcbWss = read_32ubit (fd); item->fcDop = (S32) read_32ubit (fd); item->lcbDop = read_32ubit (fd); item->fcSttbfAssoc = (S32) read_32ubit (fd); item->lcbSttbfAssoc = read_32ubit (fd); item->fcClx = (S32) read_32ubit (fd); item->lcbClx = read_32ubit (fd); item->fcPlcfpgdFtn = (S32) read_32ubit (fd); item->lcbPlcfpgdFtn = read_32ubit (fd); item->fcAutosaveSource = (S32) read_32ubit (fd); item->lcbAutosaveSource = read_32ubit (fd); item->fcGrpXstAtnOwners = (S32) read_32ubit (fd); item->lcbGrpXstAtnOwners = read_32ubit (fd); item->fcSttbfAtnbkmk = (S32) read_32ubit (fd); item->lcbSttbfAtnbkmk = read_32ubit (fd); item->fcPlcdoaMom = (S32) read_32ubit (fd); item->lcbPlcdoaMom = read_32ubit (fd); item->fcPlcdoaHdr = (S32) read_32ubit (fd); item->lcbPlcdoaHdr = read_32ubit (fd); item->fcPlcspaMom = (S32) read_32ubit (fd); item->lcbPlcspaMom = read_32ubit (fd); item->fcPlcspaHdr = (S32) read_32ubit (fd); item->lcbPlcspaHdr = read_32ubit (fd); item->fcPlcfAtnbkf = (S32) read_32ubit (fd); item->lcbPlcfAtnbkf = read_32ubit (fd); item->fcPlcfAtnbkl = (S32) read_32ubit (fd); item->lcbPlcfAtnbkl = read_32ubit (fd); item->fcPms = (S32) read_32ubit (fd); item->lcbPms = read_32ubit (fd); item->fcFormFldSttbs = (S32) read_32ubit (fd); item->lcbFormFldSttbs = read_32ubit (fd); item->fcPlcfendRef = (S32) read_32ubit (fd); item->lcbPlcfendRef = read_32ubit (fd); item->fcPlcfendTxt = (S32) read_32ubit (fd); item->lcbPlcfendTxt = read_32ubit (fd); item->fcPlcffldEdn = (S32) read_32ubit (fd); item->lcbPlcffldEdn = read_32ubit (fd); item->fcPlcfpgdEdn = (S32) read_32ubit (fd); item->lcbPlcfpgdEdn = read_32ubit (fd); item->fcDggInfo = (S32) read_32ubit (fd); item->lcbDggInfo = read_32ubit (fd); item->fcSttbfRMark = (S32) read_32ubit (fd); item->lcbSttbfRMark = read_32ubit (fd); item->fcSttbCaption = (S32) read_32ubit (fd); item->lcbSttbCaption = read_32ubit (fd); item->fcSttbAutoCaption = (S32) read_32ubit (fd); item->lcbSttbAutoCaption = read_32ubit (fd); item->fcPlcfwkb = (S32) read_32ubit (fd); item->lcbPlcfwkb = read_32ubit (fd); item->fcPlcfspl = (S32) read_32ubit (fd); item->lcbPlcfspl = read_32ubit (fd); item->fcPlcftxbxTxt = (S32) read_32ubit (fd); item->lcbPlcftxbxTxt = read_32ubit (fd); item->fcPlcffldTxbx = (S32) read_32ubit (fd); item->lcbPlcffldTxbx = read_32ubit (fd); item->fcPlcfhdrtxbxTxt = (S32) read_32ubit (fd); item->lcbPlcfhdrtxbxTxt = read_32ubit (fd); item->fcPlcffldHdrTxbx = (S32) read_32ubit (fd); item->lcbPlcffldHdrTxbx = read_32ubit (fd); item->fcStwUser = (S32) read_32ubit (fd); item->lcbStwUser = read_32ubit (fd); item->fcSttbttmbd = (S32) read_32ubit (fd); item->cbSttbttmbd = read_32ubit (fd); item->fcUnused = (S32) read_32ubit (fd); item->lcbUnused = read_32ubit (fd); item->fcPgdMother = (S32) read_32ubit (fd); item->lcbPgdMother = read_32ubit (fd); item->fcBkdMother = (S32) read_32ubit (fd); item->lcbBkdMother = read_32ubit (fd); item->fcPgdFtn = (S32) read_32ubit (fd); item->lcbPgdFtn = read_32ubit (fd); item->fcBkdFtn = (S32) read_32ubit (fd); item->lcbBkdFtn = read_32ubit (fd); item->fcPgdEdn = (S32) read_32ubit (fd); item->lcbPgdEdn = read_32ubit (fd); item->fcBkdEdn = (S32) read_32ubit (fd); item->lcbBkdEdn = read_32ubit (fd); item->fcSttbfIntlFld = (S32) read_32ubit (fd); item->lcbSttbfIntlFld = read_32ubit (fd); item->fcRouteSlip = (S32) read_32ubit (fd); item->lcbRouteSlip = read_32ubit (fd); item->fcSttbSavedBy = (S32) read_32ubit (fd); item->lcbSttbSavedBy = read_32ubit (fd); item->fcSttbFnm = (S32) read_32ubit (fd); item->lcbSttbFnm = read_32ubit (fd); item->fcPlcfLst = (S32) read_32ubit (fd); item->lcbPlcfLst = read_32ubit (fd); item->fcPlfLfo = (S32) read_32ubit (fd); item->lcbPlfLfo = read_32ubit (fd); item->fcPlcftxbxBkd = (S32) read_32ubit (fd); item->lcbPlcftxbxBkd = read_32ubit (fd); item->fcPlcftxbxHdrBkd = (S32) read_32ubit (fd); item->lcbPlcftxbxHdrBkd = read_32ubit (fd); item->fcDocUndo = (S32) read_32ubit (fd); item->lcbDocUndo = read_32ubit (fd); item->fcRgbuse = (S32) read_32ubit (fd); item->lcbRgbuse = read_32ubit (fd); item->fcUsp = (S32) read_32ubit (fd); item->lcbUsp = read_32ubit (fd); item->fcUskf = (S32) read_32ubit (fd); item->lcbUskf = read_32ubit (fd); item->fcPlcupcRgbuse = (S32) read_32ubit (fd); item->lcbPlcupcRgbuse = read_32ubit (fd); item->fcPlcupcUsp = (S32) read_32ubit (fd); item->lcbPlcupcUsp = read_32ubit (fd); item->fcSttbGlsyStyle = (S32) read_32ubit (fd); item->lcbSttbGlsyStyle = read_32ubit (fd); item->fcPlgosl = (S32) read_32ubit (fd); item->lcbPlgosl = read_32ubit (fd); item->fcPlcocx = (S32) read_32ubit (fd); item->lcbPlcocx = read_32ubit (fd); item->fcPlcfbteLvc = (S32) read_32ubit (fd); item->lcbPlcfbteLvc = read_32ubit (fd); wvGetFILETIME (&(item->ftModified), fd); item->fcPlcflvc = (S32) read_32ubit (fd); item->lcbPlcflvc = read_32ubit (fd); item->fcPlcasumy = (S32) read_32ubit (fd); item->lcbPlcasumy = read_32ubit (fd); item->fcPlcfgram = (S32) read_32ubit (fd); item->lcbPlcfgram = read_32ubit (fd); item->fcSttbListNames = (S32) read_32ubit (fd); item->lcbSttbListNames = read_32ubit (fd); item->fcSttbfUssr = (S32) read_32ubit (fd); item->lcbSttbfUssr = read_32ubit (fd); }
void wvGetFIB2 (FIB * item, wvStream * fd) { U16 temp16 = 0; item->wIdent = read_16ubit (fd); item->nFib = read_16ubit (fd); item->nProduct = read_16ubit (fd); item->lid = read_16ubit (fd); wvTrace (("lid is %x\n", item->lid)); item->pnNext = (S16) read_16ubit (fd); temp16 = read_16ubit (fd); item->fDot = (temp16 & 0x0001); item->fGlsy = (temp16 & 0x0002) >> 1; item->fComplex = (temp16 & 0x0004) >> 2; item->fHasPic = (temp16 & 0x0008) >> 3; item->cQuickSaves = (temp16 & 0x00F0) >> 4; item->fEncrypted = (temp16 & 0x0100) >> 8; item->fWhichTblStm = 0; /* Unused from here on */ item->fReadOnlyRecommended = 0; item->fWriteReservation = 0; item->fExtChar = 0; item->fLoadOverride = 0; item->fFarEast = 0; item->fCrypto = 0; item->nFibBack = read_16ubit (fd); wvTrace (("nFibBack is %d\n", item->nFibBack)); item->Spare = read_32ubit (fd); /* A spare for W2 */ item->rgwSpare0[0] = read_16ubit (fd); item->rgwSpare0[1] = read_16ubit (fd); item->rgwSpare0[2] = read_16ubit (fd); item->fcMin = read_32ubit (fd); /* These appear correct MV 29.8.2000 */ item->fcMac = read_32ubit (fd); wvTrace (("fc from %d to %d\n", item->fcMin, item->fcMac)); item->cbMac = read_32ubit (fd); /* Last byte file position plus one. */ item->fcSpare0 = read_32ubit (fd); item->fcSpare1 = read_32ubit (fd); item->fcSpare2 = read_32ubit (fd); item->fcSpare3 = read_32ubit (fd); item->ccpText = read_32ubit (fd); wvTrace (("length %d == %d\n", item->fcMac - item->fcMin, item->ccpText)); item->ccpFtn = (S32) read_32ubit (fd); item->ccpHdr = (S32) read_32ubit (fd); item->ccpMcr = (S32) read_32ubit (fd); item->ccpAtn = (S32) read_32ubit (fd); item->ccpSpare0 = (S32) read_32ubit (fd); item->ccpSpare1 = (S32) read_32ubit (fd); item->ccpSpare2 = (S32) read_32ubit (fd); item->ccpSpare3 = (S32) read_32ubit (fd); item->fcStshfOrig = read_32ubit (fd); item->lcbStshfOrig = (S32) read_16ubit (fd); item->fcStshf = read_32ubit (fd); item->lcbStshf = (S32) read_16ubit (fd); item->fcPlcffndRef = read_32ubit (fd); item->lcbPlcffndRef = (S32) read_16ubit (fd); item->fcPlcffndTxt = read_32ubit (fd); item->lcbPlcffndTxt = (S32) read_16ubit (fd); item->fcPlcfandRef = read_32ubit (fd); item->lcbPlcfandRef = (S32) read_16ubit (fd); item->fcPlcfandTxt = read_32ubit (fd); item->lcbPlcfandTxt = (S32) read_16ubit (fd); item->fcPlcfsed = read_32ubit (fd); item->lcbPlcfsed = (S32) read_16ubit (fd); item->fcPlcfpgd = read_32ubit (fd); item->cbPlcfpgd = read_16ubit (fd); item->fcPlcfphe = read_32ubit (fd); item->lcbPlcfphe = (S32) read_16ubit (fd); item->fcPlcfglsy = read_32ubit (fd); item->lcbPlcfglsy = (S32) read_16ubit (fd); item->fcPlcfhdd = read_32ubit (fd); item->lcbPlcfhdd = (S32) read_16ubit (fd); item->fcPlcfbteChpx = read_32ubit (fd); item->lcbPlcfbteChpx = (S32) read_16ubit (fd); item->fcPlcfbtePapx = read_32ubit (fd); item->lcbPlcfbtePapx = (S32) read_16ubit (fd); item->fcPlcfsea = read_32ubit (fd); item->lcbPlcfsea = (S32) read_16ubit (fd); item->fcSttbfffn = read_32ubit (fd); item->lcbSttbfffn = (S32) read_16ubit (fd); item->fcPlcffldMom = read_32ubit (fd); item->lcbPlcffldMom = (S32) read_16ubit (fd); item->fcPlcffldHdr = read_32ubit (fd); item->lcbPlcffldHdr = (S32) read_16ubit (fd); item->fcPlcffldFtn = read_32ubit (fd); item->lcbPlcffldFtn = (S32) read_16ubit (fd); item->fcPlcffldAtn = read_32ubit (fd); item->lcbPlcffldAtn = (S32) read_16ubit (fd); item->fcPlcffldMcr = read_32ubit (fd); item->lcbPlcffldMcr = (S32) read_16ubit (fd); item->fcSttbfbkmk = read_32ubit (fd); item->lcbSttbfbkmk = (S32) read_16ubit (fd); item->fcPlcfbkf = read_32ubit (fd); item->lcbPlcfbkf = (S32) read_16ubit (fd); item->fcPlcfbkl = read_32ubit (fd); item->lcbPlcfbkl = (S32) read_16ubit (fd); item->fcCmds = read_32ubit (fd); item->lcbCmds = (S32) read_16ubit (fd); item->fcPlcmcr = read_32ubit (fd); item->lcbPlcmcr = (S32) read_16ubit (fd); item->fcSttbfmcr = read_32ubit (fd); item->lcbSttbfmcr = (S32) read_16ubit (fd); item->fcPrDrvr = read_32ubit (fd); item->lcbPrDrvr = (S32) read_16ubit (fd); item->fcPrEnvPort = read_32ubit (fd); item->lcbPrEnvPort = (S32) read_16ubit (fd); item->fcPrEnvLand = read_32ubit (fd); item->lcbPrEnvLand = (S32) read_16ubit (fd); item->fcWss = read_32ubit (fd); item->lcbWss = (S32) read_16ubit (fd); item->fcDop = read_32ubit (fd); item->lcbDop = (S32) read_16ubit (fd); item->fcSttbfAssoc = read_32ubit (fd); item->lcbSttbfAssoc = (S32) read_16ubit (fd); item->fcClx = read_32ubit (fd); item->lcbClx = (S32) read_16ubit (fd); item->fcPlcfpgdFtn = read_32ubit (fd); item->lcbPlcfpgdFtn = (S32) read_16ubit (fd); item->fcAutosaveSource = read_32ubit (fd); item->lcbAutosaveSource = (S32) read_16ubit (fd); item->fcSpare5 = read_32ubit (fd); item->cbSpare5 = read_16ubit (fd); item->fcSpare6 = read_32ubit (fd); item->cbSpare6 = read_16ubit (fd); item->wSpare4 = read_16ubit (fd); item->pnChpFirst = read_16ubit (fd); item->pnPapFirst = read_16ubit (fd); item->cpnBteChp = read_16ubit (fd); item->cpnBtePap = read_16ubit (fd); }
U32 wvGetMetafile(MetaFileBlip *amf, MSOFBH *amsofbh, wvStream *fd) { char extra = 0; U32 i, count; wvStream *stm = 0; char *buf, *p; for (i = 0; i < 16; i++) amf->m_rgbUid[i] = read_8ubit(fd); count = 16; amf->m_rgbUidPrimary[0] = 0; switch (amsofbh->fbt - msofbtBlipFirst) { case msoblipEMF: wvTrace(("msoblipEMF\n")); /* sprintf(buffer,"%s-wv-%d.emf",aimage,no++); */ if (amsofbh->inst ^ msobiEMF) extra = 1; break; case msoblipWMF: wvTrace(("msoblipWMF\n")); /* sprintf(buffer,"%s-wv-%d.wmf",aimage,no++); */ if (amsofbh->inst ^ msobiWMF) extra = 1; break; case msoblipPICT: wvTrace(("msoblipPICT\n")); /* sprintf(buffer,"%s-wv-%d.pict",aimage,no++); */ if (amsofbh->inst ^ msobiPICT) extra = 1; break; } if (extra) { for (i = 0; i < 16; i++) amf->m_rgbUidPrimary[i] = read_8ubit(fd); count += 16; } amf->m_cb = read_32ubit(fd); amf->m_rcBounds.bottom = read_32ubit(fd); amf->m_rcBounds.top = read_32ubit(fd); amf->m_rcBounds.right = read_32ubit(fd); amf->m_rcBounds.left = read_32ubit(fd); amf->m_ptSize.y = read_32ubit(fd); amf->m_ptSize.x = read_32ubit(fd); amf->m_cbSave = read_32ubit(fd); amf->m_fCompression = read_8ubit(fd); amf->m_fFilter = read_8ubit(fd); amf->m_pvBits = NULL; count += 34; buf = malloc(amsofbh->cbLength); p = buf; for (i = count; i < amsofbh->cbLength; i++) *p++ = read_8ubit(fd); count += i; wvStream_memory_create(&stm, buf, amsofbh->cbLength); amf->m_pvBits = stm; return count; }
U32 wvEatOldGraphicHeader (wvStream * fd, U32 len) { U32 X, entry, count = 0, test; U16 pad; test = read_32ubit (fd); /*0x00090001 */ if (test != 0x00090001L){ wvError (("Old Graphic\n")); return -1; } count += 4; test = read_16ubit (fd); /*0x0300 */ if (test != 0x0300){ wvError (("Old Graphic\n")); return -1; } count += 2; read_32ubit (fd); /*changes */ count += 4; test = read_16ubit (fd); /*0x0000 */ if (test != 0x00000000L){ wvError (("Old Graphic\n")); return -1; } count += 2; X = read_32ubit (fd); /*changes, lets call this X */ wvError (("X is %x\n", X)); count += 4; test = read_16ubit (fd); /*0x0000 */ if (test != 0x00000000L){ wvError (("Old Graphic\n")); return -1; } count += 2; /* while ( entry != X) */ do { entry = read_32ubit (fd); count += 4; wvTrace ( ("Entry is %x, %x, count is %d\n", entry, wvStream_tell (fd), count)); switch (entry) { case 3: read_16ubit (fd); count += 2; wvTrace ( ("suspect that we are finished, count %d, len %d\n", count, len)); break; default: { U32 lene2 = entry - 2; U32 i; wvTrace ( ("lene2 is %d, predict end of %x\n", len, wvStream_tell (fd) + (entry - 2) * 2)); /* RIES ([email protected]) prolly a dirty patch because I check count everytime it's incremnented against lene2. This seems twork very well I tried it on around 15.000 word documents and it seems to work! */ for (i = 0; i < lene2; i++) { if ( (count + 1) >= len) return (count); test = read_16ubit (fd); if ((i == 0) && ((test == 0x0f43) || (test == 0x0b41))) { wvTrace ( ("Found a Bitmap, Will strip header and return with bitmap data\n")); count += 2; if ( (count + 1) >= len) return (count); pad = test; test = read_32ubit (fd); /*0x00cc0020 */ if (test != 0x00cc0020) wvTrace (("Old Graphic\n")); count += 4; if ( (count + 1) >= len) return (count); if (pad == 0x0f43) { test = read_16ubit (fd); /*0x0000 */ if (test != 0x0000) wvTrace (("Old Graphic\n")); count += 2; if ( (count + 1) >= len) return (count); } read_16ubit (fd); /*width */ count += 2; if ( (count + 1) >= len) return (count); read_16ubit (fd); /*height */ count += 2; if ( (count + 1) >= len) return (count); test = read_32ubit (fd); /*0x00000000L */ if (test != 0x00000000L) wvTrace (("Old Graphic\n")); count += 4; if ( (count + 1) >= len) return (count); read_16ubit (fd); /*width */ count += 2; if ( (count + 1) >= len) return (count); read_16ubit (fd); /*height */ count += 2; if ( (count + 1) >= len) return (count); test = read_32ubit (fd); /*0x00000000L */ if (test != 0x00000000L) wvTrace (("Old Graphic\n")); count += 4; return (count); } count += 2; if ( (count + 1) >= len) return (count); } } break; } } while (count + 1 < len); wvTrace (("Entry is %x %x, %d\n", entry, wvStream_tell (fd), count)); return (count); }
U32 wvGetClientTextbox(ClientTextbox *item, MSOFBH *amsofbh, wvStream *fd) { item->textid = (U32 *)wvMalloc(amsofbh->cbLength); *item->textid = read_32ubit(fd); return amsofbh->cbLength; }
/* return value: 1 == success 0 == failure */ int wvGetPICF (wvVersion ver, PICF * apicf, wvStream * fd) { U8 temp; U32 i; U8 *buf,*p; size_t size; long pos = wvStream_tell (fd); apicf->lcb = read_32ubit (fd); apicf->cbHeader = read_16ubit (fd); wvTrace (("size of pic is %x (%d)\n", apicf->cbHeader, apicf->cbHeader)); apicf->mfp_mm = (S16) read_16ubit (fd); wvTrace (("mm type is %d\n", apicf->mfp_mm)); apicf->mfp_xExt = (S16) read_16ubit (fd); apicf->mfp_yExt = (S16) read_16ubit (fd); apicf->mfp_hMF = (S16) read_16ubit (fd); if (apicf->mfp_mm == 99) wvGetBITMAP (&(apicf->obj.bitmap), fd); else wvGetrc (&(apicf->obj.arc), fd); apicf->dxaGoal = (S16) read_16ubit (fd); apicf->dyaGoal = (S16) read_16ubit (fd); apicf->mx = read_16ubit (fd); apicf->my = read_16ubit (fd); apicf->dxaCropLeft = (S16) read_16ubit (fd); apicf->dyaCropTop = (S16) read_16ubit (fd); apicf->dxaCropRight = (S16) read_16ubit (fd); apicf->dyaCropBottom = (S16) read_16ubit (fd); temp = read_8ubit (fd); apicf->brcl = temp & 0x0F; apicf->fFrameEmpty = (temp & 0x10) >> 4; apicf->fBitmap = (temp & 0x20) >> 5; wvTrace (("bitmap is %d\n", apicf->fBitmap)); apicf->fDrawHatch = (temp & 0x40) >> 6; apicf->fError = (temp & 0x80) >> 7; apicf->bpp = read_8ubit (fd); wvGetBRC (ver, &(apicf->brcTop), fd); wvGetBRC (ver, &(apicf->brcLeft), fd); wvGetBRC (ver, &(apicf->brcBottom), fd); wvGetBRC (ver, &(apicf->brcRight), fd); apicf->dxaOrigin = (S16) read_16ubit (fd); apicf->dyaOrigin = (S16) read_16ubit (fd); if (ver == WORD8) apicf->cProps = (S16) read_16ubit (fd); else apicf->cProps = 0; pos = wvStream_tell (fd) - pos; for (i = pos; i < apicf->cbHeader; i++) read_8ubit (fd); wvTrace (("pos is finally %x\n", wvStream_tell (fd))); wvTrace (("len of data is %d\n", apicf->lcb - apicf->cbHeader)); wvTrace ( ("ends at %x\n", wvStream_tell (fd) + apicf->lcb - apicf->cbHeader)); i = 0; if (apicf->mfp_mm < 90){ MSOFBH bse_pic_amsofbh; size_t lHeaderSize; size_t lWordStructsSize; U8 *pHeader; U8 *pWordStructs; U32 len; U32 j; U8 bmp_header[40]; U32 header_len; U32 colors_used; U16 bpp; pWordStructs = pHeader = 0; wvTrace (("test\n")); len = apicf->lcb - apicf->cbHeader; /*[email protected] store*/ pos = wvStream_tell (fd); i = wvEatOldGraphicHeader (fd, len); if(i!=-1)/*Found BMP */ { wvTrace (("len is %d, header len guess is %d\n", len, i)); if (i + 2 >= len) { wvTrace (("all read ok methinks\n")); apicf->rgb = NULL; return 1; } len -= i; pos = wvStream_tell (fd); for(j=0;j< sizeof(bmp_header);j++) bmp_header[j] = read_8ubit (fd); bpp = bmp_header[14] + (bmp_header[15] << 8); if ( bpp < 9) { colors_used = bmp_header[32] + (bmp_header[33] << 8) + (bmp_header[34] << 16) + (bmp_header[35] << 24); } else { colors_used = 0; } wvStream_goto(fd,pos); header_len = 14 + 40 + 4 * colors_used; /*Get Blip Header Size*/ lHeaderSize = PutWord8BitmapHeader(apicf, 0, len + i-14, header_len); pHeader = malloc(lHeaderSize); /*Write Blip Header*/ PutWord8BitmapHeader(apicf, pHeader, len, header_len); /*Set Type of FBSE Header*/ bse_pic_amsofbh.ver = 0; bse_pic_amsofbh.inst = msobiDIB; bse_pic_amsofbh.fbt = msofbtBlipFirst + msoblipDIB;/*msoblipJPEG msoblipPNG*/ bse_pic_amsofbh.cbLength = lHeaderSize+len; }else{/*must be WMF*/ /*Get Blip Header Size*/ lHeaderSize = PutWord8MetafileHeader(apicf, 0); pHeader = malloc(lHeaderSize); /*Write Blip Header*/ PutWord8MetafileHeader(apicf, pHeader); /*Set Type of FBSE Header*/ bse_pic_amsofbh.ver = 0; bse_pic_amsofbh.inst = msobiWMF; bse_pic_amsofbh.fbt = msofbtBlipFirst + msoblipWMF; bse_pic_amsofbh.cbLength = lHeaderSize+len; i = 0; wvStream_goto(fd,pos); } lWordStructsSize = PutWord8Structs(&bse_pic_amsofbh, 0,0); pWordStructs = malloc(lWordStructsSize); PutWord8Structs(&bse_pic_amsofbh, pWordStructs, lWordStructsSize); size = lHeaderSize + lWordStructsSize + apicf->lcb - apicf->cbHeader; p = buf = malloc(size); if(!p) { free(pWordStructs); free(pHeader); return 0; } memcpy(p, pWordStructs, lWordStructsSize); p+= lWordStructsSize; memcpy(p, pHeader, lHeaderSize); p+=lHeaderSize; free(pWordStructs); free(pHeader); } else{ size = apicf->lcb - apicf->cbHeader; p = buf = malloc(size); } #if 0 for (; i < apicf->lcb - apicf->cbHeader; i++) *p++ = read_8ubit (fd); #endif U32 length = apicf->lcb - apicf->cbHeader - i; if (fd->kind == GSF_STREAM) { gsf_input_read (GSF_INPUT (fd->stream.gsf_stream), length, p); p += length; } else if (fd->kind == FILE_STREAM) { fread(p, sizeof(guint8), length, fd->stream.file_stream); p += length; } else { memorystream_read(fd->stream.memory_stream, p, length); p += length; } /* f = fopen("test.dat","wb"); fwrite(buf, 1,size, f); fclose(f); */ wvStream_memory_create(&apicf->rgb, (char*)buf, size); return 1; }