STORAGELAYOUT

The STORAGELAYOUT structure describes a single block of data, including its name, location, and length. To optimize a compound file, an application or layout tool passes an array of StorageLayout structures in a call to ILayoutStorage::LayoutScriptC5W1WH.

typedef struct tagSTORAGELAYOUT

    DWORD           LayoutType;

    OLECHAR*        pwcsElementName;

    LARGE_INTEGER   cOffset;

    LARGE_INTEGER   cBytes;

} STORAGELAYOUT;

 

Members

LayoutType

The type of element to be written. Values are taken from the STGTY4EGC_KM enumeration. STGTY_STREAM means read the block of data named by pwcsElementName. STGTY_STORAGE means open the storage specified in pwcsElementName. STGTY_REPEAT is used in multimedia applications to interlace audio, video, text, and other elements. An opening STGTY_REPEAT elements means that the elements that follow are to be repeated a specified number of times. The closing STGTY_REPEAT element marks the end of those elements that are to be repeated. Nested STGY_REPEAT pairs are permitted.

pwcsElementName

The name of the storage or stream. If the element is a substorage or embedded object, the fully qualified storage path must be specified; for example:RootStorageName\SubStorageName\Substream.

cOffset

Where LayoutType is STGTY_STREAM, this flag specifies the beginning offset into the steam named in pwscElementName.

Where LayoutType is STGTY_STORAGE, this flag should be set to zero.

Where LayoutType is STGTY_REPEAT, this flag should be set to zero.

cBytes

Length in bytes of the data block named in pwcsElementName.

Where LayoutType is STGTY_STREAM, cBytes specifies the number of bytes to read at offset cOffset from the stream nemaed in pwcsElementName.

Where LayoutType is STGTY_STORAGE, this flag is ignored.

Where LayoutType is STGTY_REPEAT, a positive cBytes specifies the beginning of a repeat block. STGTY_REPEAT with zero cBytes marks the end of a repeat block.

A beginning block value of STG_TOEND specifies that elements in a following block are to be repeated after each stream has been completely read.

 

An array of StorageLayout structures might appear as follows:

StorageLayout arrScript[]=

    // Read first 2k of  WordDocument  stream

    { STGTY_STREAM,L WordDocument ,{ 0,0},{ 0,2048}},

 

    //Test if  ObjectPool\88112233  storage exists

    { STGTY_STORAGE,L ObjectPool\\88112233 ,{ 0,0},{ 0,0}},

 

    //Read 2k at offset 1048 of  WordDocument  stream

    { STGTY_STREAM,L WordDocument ,{ 0,10480},{ 0,2048}},

 

    //Interlace  Audio ,  Video , and  Caption  streams

    { STGTY_REPEAT,NULL,0,STG_TOEND},

        { STGTY_STREAM,L Audio , { 0,0},{ 0,2048}},    // 2k of Audio

        { STGTY_STREAM,L Video , { 0,0},{ 0,65536}},   // 64k of Video

        { STGTY_STREAM,L Caption , { 0,0},{ 0,128}},   // 128b of text

    { STGTY_REPEAT,NULL, { 0,0},{ 0,0}}

};

 

Note  The parameters cOffest and cBytes are LARGE_INTEGER structures and they must be represented as a structure with { LARGE_INTEGER} or { DWORD lowpart, LONG highpart}.

See Also

ILayoutStorage::LayoutScript