GCabCabinet

GCabCabinet — Cabinet archive file operations

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

  GCabCabinet
#define GCAB_ERROR
enum GCabError

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.

If path is NULL then the files are decompressed to memory blobs stored on each GCabFile.

Parameters

cabinet

a GCabCabinet

 

path

the path to extract files.

[allow-none]

file_callback

an optional 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 optional 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 none]


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 on error.

Since: 0.5


gcab_cabinet_get_size ()

guint32
gcab_cabinet_get_size (GCabCabinet *cabinet);

Get the size of the compressed cabinet file.

Parameters

cabinet

a GCabCabinet

 

Returns

size in bytes

Since: 1.0

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.

 

GCAB_ERROR_NOT_SUPPORTED

Action or format is not supported

 

GCAB_ERROR_INVALID_DATA

Data stream was invalid

 

See Also

GCabFolder