MS OLE2: GSF Reference Manual

## MS OLE2

MS OLE2

## Functions

GsfInfile * | gsf_infile_msole_new ()
gboolean | gsf_infile_msole_get_class_id ()
GsfOutfile * | gsf_outfile_msole_new ()
GsfOutfile * | gsf_outfile_msole_new_full ()
gboolean | gsf_outfile_msole_set_class_id ()
GError * | gsf_msole_metadata_read ()
gboolean | gsf_msole_metadata_write ()
GIConv | gsf_msole_iconv_open_codepages_for_export ()
GIConv | gsf_msole_iconv_open_codepage_for_import ()
GIConv | gsf_msole_iconv_open_for_export ()
GIConv | gsf_msole_iconv_open_codepage_for_export ()
GIConv | gsf_msole_iconv_open_for_import ()
int | gsf_msole_iconv_win_codepage ()
guint | gsf_msole_codepage_to_lid ()
int | gsf_msole_lid_to_codepage ()
gchar * | gsf_msole_lid_to_codepage_str ()
guint | gsf_msole_lid_for_language ()
char const * | gsf_msole_language_for_lid ()
GByteArray * | gsf_msole_inflate ()

## Properties

guint | big-block-size | Read / Write / Construct Only
GsfOutput * | sink | Read / Write / Construct Only
guint | small-block-size | Read / Write / Construct Only

## Types and Values

| GsfInfileMSOle
| GsfOutfileMSOle

## Object Hierarchy

        GObject
        ├── GsfInput
        │   ╰── GsfInfile
        │       ╰── GsfInfileMSOle
        ╰── GsfOutput
            ╰── GsfOutfile
                ╰── GsfOutfileMSOle

## Description

## Functions

### gsf_infile_msole_new ()

    GsfInfile *
    gsf_infile_msole_new (GsfInput *source,
                          GError **err);

Opens the root directory of an MS OLE file.

This adds a reference to `source`.

#### Parameters

source | GsfInput |
err | optional place to store an error |

#### Returns

the new ole file handler

### gsf_infile_msole_get_class_id ()

    gboolean
    gsf_infile_msole_get_class_id (GsfInfileMSOle const *ole,
                                   guint8 *res);

Retrieves the 16 byte indentifier (often a GUID in MS Windows apps) stored within the directory associated with `ole` and stores it in `res` .

#### Parameters

ole | a GsfInfileMSOle |
res | 16 byte identifier (often a GUID in MS Windows apps) |

#### Returns

TRUE on success

### gsf_outfile_msole_new ()

    GsfOutfile *
    gsf_outfile_msole_new (GsfOutput *sink);

Creates the root directory of an MS OLE file and manages the addition of children.

This adds a reference to `sink`.

#### Parameters

sink | a GsfOutput to hold the OLE2 file |

#### Returns

the new ole file handler.

### gsf_outfile_msole_new_full ()

    GsfOutfile *
    gsf_outfile_msole_new_full (GsfOutput *sink,
                                guint bb_size,
                                guint sb_size);

Creates the root directory of an MS OLE file and manages the addition of children.

This adds a reference to `sink`.

#### Parameters

sink | a GsfOutput to hold the OLE2 file. |
bb_size | size of large blocks. |
sb_size | size of small blocks. |

#### Returns

the new ole file handler.

### gsf_outfile_msole_set_class_id ()

    gboolean
    gsf_outfile_msole_set_class_id (GsfOutfileMSOle *ole,
                                    guint8 const *clsid);

Write `clsid` to the directory associated with `ole` .

#### Parameters

ole | a GsfOutfileMSOle |
clsid | Identifier (often a GUID in MS Windows apps). | [array fixed-size=16]

#### Returns

`TRUE` on success.

### gsf_msole_metadata_read ()

    GError *
    gsf_msole_metadata_read (GsfInput *in,
                             GsfDocMetaData *accum);

`gsf_msole_metadata_read` has been deprecated since version 1.14.24 and should not be used in newly-written code.

, use gsf_doc_meta_data_read_from_msole

Read a stream formated as a set of MS OLE properties from `in` and store the results in `accum` .

[skip]

#### Parameters

in | GsfInput |
accum | GsfDocMetaData |

#### Returns

A GError if there was an error.

[transfer full]

### gsf_msole_metadata_write ()

    gboolean
    gsf_msole_metadata_write (GsfOutput *out,
                              GsfDocMetaData const *meta_data,
                              gboolean doc_not_component);

`gsf_msole_metadata_write` has been deprecated since version 1.14.24 and should not be used in newly-written code.

, use gsf_doc_meta_data_write_to_msole

[skip]

#### Parameters

out | GsfOutput |
meta_data | GsfDocMetaData |
doc_not_component | a kludge to differentiate DocumentSummary from Summary |

#### Returns

`TRUE` on success;

### gsf_msole_iconv_open_codepages_for_export ()

    GIConv
    gsf_msole_iconv_open_codepages_for_export
                                   (int codepage_to,
                                    char const *from);

NOTE: skipped since GIConv is not exported to introspection.

[skip]

#### Parameters

codepage_to | the target code page. |
from | the source encoding. |

#### Returns

an iconv converter to go from utf8 -> to our best guess at a useful windows codepage.

### gsf_msole_iconv_open_codepage_for_import ()

    GIConv
    gsf_msole_iconv_open_codepage_for_import
                                   (char const *to,
                                    int codepage);

NOTE: skipped since GIConv is not exported to introspection.

[skip]

#### Parameters

to | the target encoding. |
codepage | the source code page. |

#### Returns

an iconv converter for `codepage` -> utf8.

### gsf_msole_iconv_open_for_export ()

    GIConv
    gsf_msole_iconv_open_for_export (void);

NOTE: skipped since GIConv is not exported to introspection.

[skip]

#### Returns

an iconv convert to go from utf8 -> to our best guess at a useful windows codepage.

### gsf_msole_iconv_open_codepage_for_export ()

    GIConv
    gsf_msole_iconv_open_codepage_for_export
                                   (int codepage_to);

NOTE: skipped since GIConv is not exported to introspection.

[skip]

#### Parameters

codepage_to | the target code page. |

#### Returns

an iconv converter to go from utf8 -> to our best guess at a useful windows codepage.

### gsf_msole_iconv_open_for_import ()

    GIConv
    gsf_msole_iconv_open_for_import (int codepage);

NOTE: skipped since GIConv is not exported to introspection.

[skip]

#### Parameters

codepage | the source code page. |

#### Returns

an iconv converter for single byte encodings `codepage` -> utf8. Attempt to handle the semantics of a specification for multibyte encodings since this is only supposed to be used for single bytes.

### gsf_msole_iconv_win_codepage ()

    int
    gsf_msole_iconv_win_codepage (void);

#### Returns

our best guess at the applicable windows code page based on an environment variable or the current locale.

### gsf_msole_codepage_to_lid ()

    guint
    gsf_msole_codepage_to_lid (int codepage);

### gsf_msole_lid_to_codepage ()

    int
    gsf_msole_lid_to_codepage (guint lid);

#### Parameters

lid | numerical language id |

#### Returns

our best guess at the codepage for the given language id

### gsf_msole_lid_to_codepage_str ()

    gchar *
    gsf_msole_lid_to_codepage_str (guint lid);

#### Parameters

lid | numerical language id |

#### Returns

the Iconv codepage string for the given LID.

[transfer full]

### gsf_msole_lid_for_language ()

    guint
    gsf_msole_lid_for_language (char const *lang);

#### Parameters

lang | Language id, i.e., locale name. | [allow-none]

#### Returns

the LID (Language Identifier) for the input language. If lang is `NULL`, return 0x0400 ("-none-"), and not 0x0000 ("no proofing")

### gsf_msole_language_for_lid ()

    char const *
    gsf_msole_language_for_lid (guint lid);

#### Parameters

lid | numerical language id |

#### Returns

the xx_YY style string (can be just xx or xxx) for the given LID. If the LID is not found, is set to 0x0400, or is set to 0x0000, will return "-none-".

[transfer none]

### gsf_msole_inflate ()

    GByteArray *
    gsf_msole_inflate (GsfInput *input,
                       gsf_off_t offset);

Decompresses an LZ compressed stream.

#### Parameters

input | stream to read from |
offset | offset into it for start byte of compresse stream |

#### Returns

A GByteArray that the caller is responsible for freeing.

[transfer full]

## Types and Values

### GsfInfileMSOle

    typedef struct _GsfInfileMSOle GsfInfileMSOle;

### GsfOutfileMSOle

    typedef struct _GsfOutfileMSOle GsfOutfileMSOle;

## Property Details

### The `“big-block-size”` property

      “big-block-size”           guint

The size of the OLE's big blocks.

Flags: Read / Write / Construct Only

Allowed values: [128,4096]

Default value: 512

### The `“sink”` property

      “sink”                     GsfOutput *

The destination for writes.

Flags: Read / Write / Construct Only

### The `“small-block-size”` property

      “small-block-size”         guint

The size of the OLE's small blocks.

Flags: Read / Write / Construct Only

Allowed values: [8,4096]

Default value: 64