GCab Reference Manual: GCabCabinet

## GCabCabinet GCabCabinet — Cabinet archive file operations |

## Stability Level

Stable, unless otherwise indicated

## Functions

GCabCabinet * | gcab_cabinet_new ()
gboolean | gcab_cabinet_load ()
gboolean | gcab_cabinet_extract ()
gboolean | gcab_cabinet_extract_simple ()
GPtrArray * | gcab_cabinet_get_folders ()
gboolean | gcab_cabinet_add_folder ()
gboolean | gcab_cabinet_write ()
gboolean | gcab_cabinet_write_simple ()
const GByteArray * | gcab_cabinet_get_signature ()

## Properties

GByteArray * | reserved | Read / Write
GByteArray * | signature | Read / Write

## Types and Values

| GCabCabinet
#define | GCAB_ERROR
enum | GCabError

## Object Hierarchy

        GObject
        ╰── GCabCabinet

## Includes

    #include <libgcab.h>

## Description

A GCabCabinet is a handle to a Cabinet archive. It allows examining, extracting and creation of archives.

## Functions

### gcab_cabinet_new ()

    GCabCabinet *
    gcab_cabinet_new (void);

Create a new GCabCabinet object to read or create a Cabinet archive.

#### Returns

a new GCabCabinet

### gcab_cabinet_load ()

    gboolean
    gcab_cabinet_load (GCabCabinet *cabinet,
                       GInputStream *stream,
                       GCancellable *cancellable,
                       GError **error);

Load a cabinet archive.

#### Parameters

cabinet | a GCabCabinet |
stream | a GInputStream |
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success

### gcab_cabinet_extract ()

    gboolean
    gcab_cabinet_extract (GCabCabinet *cabinet,
                          GFile *path,
                          GCabFileCallback file_callback,
                          GFileProgressCallback progress_callback,
                          gpointer user_data,
                          GCancellable *cancellable,
                          GError **error);

Extract files to given path.

#### Parameters

cabinet | a GCabCabinet |
path | the path to extract files |
file_callback | an optionnal GCabFile callback, return `FALSE` to filter out or skip files. | [allow-none][scope call][closure user_data]
progress_callback | a progress callback. | [allow-none][scope call][closure user_data]
user_data | callback data. | [closure]
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success.

### gcab_cabinet_extract_simple ()

    gboolean
    gcab_cabinet_extract_simple (GCabCabinet *cabinet,
                                 GFile *path,
                                 GCabFileCallback file_callback,
                                 gpointer user_data,
                                 GCancellable *cancellable,
                                 GError **error);

Extract files to given path.

#### Parameters

cabinet | a GCabCabinet |
path | the path to extract files |
file_callback | an optionnal GCabFile callback, return `FALSE` to filter out or skip files. | [allow-none][scope call][closure user_data]
user_data | callback data. | [closure]
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success.

### gcab_cabinet_get_folders ()

    GPtrArray *
    gcab_cabinet_get_folders (GCabCabinet *cabinet);

Get the Cabinet folders within the `cabinet` . Note that Cabinet folders are not like filesystem path, they are group of files sharing some layout parameters.

#### Parameters

cabinet | a GCabCabinet |

#### Returns

an array of GCabFolder.

[element-type GCabFolder][transfer full]

### gcab_cabinet_add_folder ()

    gboolean
    gcab_cabinet_add_folder (GCabCabinet *cabinet,
                             GCabFolder *folder,
                             GError **error);

Add `folder` to `cabinet` .

#### Parameters

cabinet | a GCabCabinet |
folder | a GCabFolder |
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success.

### gcab_cabinet_write ()

    gboolean
    gcab_cabinet_write (GCabCabinet *cabinet,
                        GOutputStream *stream,
                        GCabFileCallback file_callback,
                        GFileProgressCallback progress_callback,
                        gpointer user_data,
                        GCancellable *cancellable,
                        GError **error);

Save `cabinet` to the output stream `out` . `out` must be a GSeekable.

#### Parameters

cabinet | a GCabCabinet |
stream | a GOutputStream also GSeekable |
file_callback | report current file being saved. | [allow-none][scope call][closure user_data]
progress_callback | report saving progress. | [allow-none][scope call][closure user_data]
user_data | user data to pass to callbacks. | [closure]
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success.

### gcab_cabinet_write_simple ()

    gboolean
    gcab_cabinet_write_simple (GCabCabinet *cabinet,
                               GOutputStream *stream,
                               GCabFileCallback file_callback,
                               gpointer user_data,
                               GCancellable *cancellable,
                               GError **error);

Save `cabinet` to the output stream `out` . `out` must be a GSeekable.

#### Parameters

cabinet | a GCabCabinet |
stream | a GOutputStream also GSeekable |
file_callback | report current file being saved. | [allow-none][scope call][closure user_data]
user_data | user data to pass to callbacks. | [closure]
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

`TRUE` on success.

### gcab_cabinet_get_signature ()

    const GByteArray *
    gcab_cabinet_get_signature (GCabCabinet *cabinet,
                                GCancellable *cancellable,
                                GError **error);

Lookup the cabinet authenticode signature if any.

#### Parameters

cabinet | a GCabCabinet |
cancellable | optional GCancellable object, `NULL` to ignore. | [allow-none]
error | GError to set on error, or `NULL`. | [allow-none]

#### Returns

the array containing the PKCS#7 signed data or `NULL` if none found or error.

Since 0.5

## Types and Values

### GCabCabinet

    typedef struct _GCabCabinet GCabCabinet;

An opaque object holding a Cabinet file reference.

### GCAB_ERROR

    #define GCAB_ERROR gcab_error_quark ()

Error domain for the GCab library. See GError for more information on error domains.

### enum GCabError

The various errors triggered by the GCab functions.

#### Members

GCAB_ERROR_FORMAT | The given file is not of Cabinet format. |
GCAB_ERROR_FAILED | General function failure. |

## Property Details

### The `“reserved”` property

      “reserved”                 GByteArray *

Reserved.

Flags: Read / Write

### The `“signature”` property

      “signature”                GByteArray *

Signature.

Flags: Read / Write

## See Also

GCabFolder