libmspack 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/i386-windows/libmspack.dll +0 -0
- data/ext/libmspack/ChangeLog +7 -0
- data/ext/libmspack/Makefile.am +1 -1
- data/ext/libmspack/mspack/cabd.c +9 -10
- data/ext/libmspack/mspack/chmd.c +2 -2
- data/ext/libmspack/mspack/kwajd.c +9 -10
- data/ext/libmspack/mspack/lzxd.c +2 -1
- data/ext/libmspack/mspack/oabd.c +1 -4
- data/ext/libmspack/mspack/readhuff.h +4 -5
- data/ext/libmspack.h +259 -0
- data/ext/x86_64-windows/libmspack.dll +0 -0
- data/lib/libmspack/mscab.rb +4 -4
- data/lib/libmspack/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c2006f7e3851c3958175cf7db8a47f31b11d013
|
4
|
+
data.tar.gz: 9f6670e7977d93010b2aefa24d0b6946c77a0ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b25e651a134cde4efa33846afcd373a0bd3acf77fd43737852860dd390ce2512669d795cfcede7c05953f16865472fb5b2fc3f6d9aff3416c51ba62365e0442
|
7
|
+
data.tar.gz: 084fdf58252c604bddadec06af9d22e1dd2a7644e6b5bd10bfd324764e7f1b93786cb5b03c905494587c0637b321e1c484bd0858fefc8aeee74fd0b441f7dc68
|
Binary file
|
data/ext/libmspack/ChangeLog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2014-04-20 Stuart Caie <kyzer@4u.net>
|
2
|
+
|
3
|
+
* readhuff.h: fixed the table overflow check, which allowed one more
|
4
|
+
code after capacity had been reached, resulting in a read of
|
5
|
+
uninitialized data inside the decoding table. Thanks to Denis Kroshin
|
6
|
+
for identifying the problem and providing a sample file.
|
7
|
+
|
1
8
|
2013-05-27 Stuart Caie <kyzer@4u.net>
|
2
9
|
|
3
10
|
* test/oabx.c: added new example command for unpacking OAB files.
|
data/ext/libmspack/Makefile.am
CHANGED
data/ext/libmspack/mspack/cabd.c
CHANGED
@@ -74,8 +74,7 @@ static int cabd_read_headers(
|
|
74
74
|
struct mspack_system *sys, struct mspack_file *fh,
|
75
75
|
struct mscabd_cabinet_p *cab, off_t offset, int quiet);
|
76
76
|
static char *cabd_read_string(
|
77
|
-
struct mspack_system *sys, struct mspack_file *fh,
|
78
|
-
struct mscabd_cabinet_p *cab, int *error);
|
77
|
+
struct mspack_system *sys, struct mspack_file *fh, int *error);
|
79
78
|
|
80
79
|
static struct mscabd_cabinet *cabd_search(
|
81
80
|
struct mscab_decompressor *base, const char *filename);
|
@@ -391,14 +390,14 @@ static int cabd_read_headers(struct mspack_system *sys,
|
|
391
390
|
|
392
391
|
/* read name and info of preceeding cabinet in set, if present */
|
393
392
|
if (cab->base.flags & cfheadPREV_CABINET) {
|
394
|
-
cab->base.prevname = cabd_read_string(sys, fh,
|
395
|
-
cab->base.previnfo = cabd_read_string(sys, fh,
|
393
|
+
cab->base.prevname = cabd_read_string(sys, fh, &x); if (x) return x;
|
394
|
+
cab->base.previnfo = cabd_read_string(sys, fh, &x); if (x) return x;
|
396
395
|
}
|
397
396
|
|
398
397
|
/* read name and info of next cabinet in set, if present */
|
399
398
|
if (cab->base.flags & cfheadNEXT_CABINET) {
|
400
|
-
cab->base.nextname = cabd_read_string(sys, fh,
|
401
|
-
cab->base.nextinfo = cabd_read_string(sys, fh,
|
399
|
+
cab->base.nextname = cabd_read_string(sys, fh, &x); if (x) return x;
|
400
|
+
cab->base.nextinfo = cabd_read_string(sys, fh, &x); if (x) return x;
|
402
401
|
}
|
403
402
|
|
404
403
|
/* read folders */
|
@@ -502,7 +501,7 @@ static int cabd_read_headers(struct mspack_system *sys,
|
|
502
501
|
file->date_y = (x >> 9) + 1980;
|
503
502
|
|
504
503
|
/* get filename */
|
505
|
-
file->filename = cabd_read_string(sys, fh,
|
504
|
+
file->filename = cabd_read_string(sys, fh, &x);
|
506
505
|
if (x) {
|
507
506
|
sys->free(file);
|
508
507
|
return x;
|
@@ -518,8 +517,7 @@ static int cabd_read_headers(struct mspack_system *sys,
|
|
518
517
|
}
|
519
518
|
|
520
519
|
static char *cabd_read_string(struct mspack_system *sys,
|
521
|
-
struct mspack_file *fh,
|
522
|
-
struct mscabd_cabinet_p *cab, int *error)
|
520
|
+
struct mspack_file *fh, int *error)
|
523
521
|
{
|
524
522
|
off_t base = sys->tell(fh);
|
525
523
|
char buf[256], *str;
|
@@ -1264,7 +1262,8 @@ static int cabd_sys_read_block(struct mspack_system *sys,
|
|
1264
1262
|
/* blocks must not be over CAB_INPUTMAX in size */
|
1265
1263
|
len = EndGetI16(&hdr[cfdata_CompressedSize]);
|
1266
1264
|
if (((d->i_end - d->i_ptr) + len) > CAB_INPUTMAX) {
|
1267
|
-
D(("block size > CAB_INPUTMAX (%ld + %d)",
|
1265
|
+
D(("block size > CAB_INPUTMAX (%ld + %d)",
|
1266
|
+
(long)(d->i_end - d->i_ptr), len))
|
1268
1267
|
return MSPACK_ERR_DATAFORMAT;
|
1269
1268
|
}
|
1270
1269
|
|
data/ext/libmspack/mspack/chmd.c
CHANGED
@@ -266,7 +266,7 @@ static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,
|
|
266
266
|
unsigned char buf[0x54], *chunk = NULL, *name, *p, *end;
|
267
267
|
struct mschmd_file *fi, *link = NULL;
|
268
268
|
off_t offset, length;
|
269
|
-
int num_entries
|
269
|
+
int num_entries;
|
270
270
|
|
271
271
|
/* initialise pointers */
|
272
272
|
chm->files = NULL;
|
@@ -686,7 +686,7 @@ static int search_chunk(struct mschmd_header *chm,
|
|
686
686
|
{
|
687
687
|
const unsigned char *start, *end, *p;
|
688
688
|
unsigned int qr_size, num_entries, qr_entries, qr_density, name_len;
|
689
|
-
unsigned int L, R, M,
|
689
|
+
unsigned int L, R, M, fname_len, entries_off, is_pmgl;
|
690
690
|
int cmp;
|
691
691
|
|
692
692
|
fname_len = strlen(filename);
|
@@ -41,7 +41,7 @@ static void lzh_free(
|
|
41
41
|
static int lzh_read_lens(
|
42
42
|
struct kwajd_stream *kwaj,
|
43
43
|
unsigned int type, unsigned int numsyms,
|
44
|
-
unsigned char *lens
|
44
|
+
unsigned char *lens);
|
45
45
|
static int lzh_read_input(
|
46
46
|
struct kwajd_stream *kwaj);
|
47
47
|
|
@@ -399,14 +399,13 @@ static int kwajd_error(struct mskwaj_decompressor *base)
|
|
399
399
|
return MSPACK_ERR_OK; \
|
400
400
|
} while (0)
|
401
401
|
|
402
|
-
#define BUILD_TREE(tbl, type)
|
403
|
-
STORE_BITS;
|
404
|
-
err = lzh_read_lens(lzh, type, MAXSYMBOLS(tbl),
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
&HUFF_LEN(tbl,0), &HUFF_TABLE(tbl,0))) \
|
402
|
+
#define BUILD_TREE(tbl, type) \
|
403
|
+
STORE_BITS; \
|
404
|
+
err = lzh_read_lens(lzh, type, MAXSYMBOLS(tbl), &HUFF_LEN(tbl,0)); \
|
405
|
+
if (err) return err; \
|
406
|
+
RESTORE_BITS; \
|
407
|
+
if (make_decode_table(MAXSYMBOLS(tbl), TABLEBITS(tbl), \
|
408
|
+
&HUFF_LEN(tbl,0), &HUFF_TABLE(tbl,0))) \
|
410
409
|
return MSPACK_ERR_DATAFORMAT;
|
411
410
|
|
412
411
|
#define WRITE_BYTE do { \
|
@@ -494,7 +493,7 @@ static void lzh_free(struct kwajd_stream *lzh)
|
|
494
493
|
|
495
494
|
static int lzh_read_lens(struct kwajd_stream *lzh,
|
496
495
|
unsigned int type, unsigned int numsyms,
|
497
|
-
unsigned char *lens
|
496
|
+
unsigned char *lens)
|
498
497
|
{
|
499
498
|
register unsigned int bit_buffer;
|
500
499
|
register int bits_left;
|
data/ext/libmspack/mspack/lzxd.c
CHANGED
@@ -811,7 +811,8 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
|
|
811
811
|
|
812
812
|
/* check that we've used all of the previous frame first */
|
813
813
|
if (lzx->o_ptr != lzx->o_end) {
|
814
|
-
D(("%ld avail bytes, new %d frame",
|
814
|
+
D(("%ld avail bytes, new %d frame",
|
815
|
+
(long)(lzx->o_end - lzx->o_ptr), frame_size))
|
815
816
|
return lzx->error = MSPACK_ERR_DECRUNCH;
|
816
817
|
}
|
817
818
|
|
data/ext/libmspack/mspack/oabd.c
CHANGED
@@ -259,7 +259,7 @@ static int oabd_decompress_incremental(struct msoab_decompressor *_self,
|
|
259
259
|
struct mspack_file *outfh = NULL;
|
260
260
|
unsigned char *buf = NULL;
|
261
261
|
unsigned char hdrbuf[patchhead_SIZEOF];
|
262
|
-
unsigned int block_max,
|
262
|
+
unsigned int block_max, target_size;
|
263
263
|
struct lzxd_stream *lzx = NULL;
|
264
264
|
struct mspack_system oabd_sys;
|
265
265
|
struct oabd_file in_ofh, out_ofh;
|
@@ -287,10 +287,7 @@ static int oabd_decompress_incremental(struct msoab_decompressor *_self,
|
|
287
287
|
}
|
288
288
|
|
289
289
|
block_max = EndGetI32(&hdrbuf[patchhead_BlockMax]);
|
290
|
-
source_size = EndGetI32(&hdrbuf[patchhead_SourceSize]);
|
291
290
|
target_size = EndGetI32(&hdrbuf[patchhead_TargetSize]);
|
292
|
-
source_crc = EndGetI32(&hdrbuf[patchhead_SourceCRC]);
|
293
|
-
target_crc = EndGetI32(&hdrbuf[patchhead_TargetCRC]);
|
294
291
|
|
295
292
|
/* We use it for reading block headers too */
|
296
293
|
if (block_max < patchblk_SIZEOF)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* This file is part of libmspack.
|
2
|
-
* (C) 2003-
|
2
|
+
* (C) 2003-2014 Stuart Caie.
|
3
3
|
*
|
4
4
|
* libmspack is free software; you can redistribute it and/or modify it under
|
5
5
|
* the terms of the GNU Lesser General Public License (LGPL) version 2.1
|
@@ -10,8 +10,7 @@
|
|
10
10
|
#ifndef MSPACK_READHUFF_H
|
11
11
|
#define MSPACK_READHUFF_H 1
|
12
12
|
|
13
|
-
/* This implements a fast Huffman tree decoding system.
|
14
|
-
*/
|
13
|
+
/* This implements a fast Huffman tree decoding system. */
|
15
14
|
|
16
15
|
#if !(defined(BITS_ORDER_MSB) || defined(BITS_ORDER_LSB))
|
17
16
|
# error "readhuff.h is used in conjunction with readbits.h, include that first"
|
@@ -140,6 +139,7 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|
140
139
|
for (bit_num = nbits+1; bit_num <= HUFF_MAXBITS; bit_num++) {
|
141
140
|
for (sym = 0; sym < nsyms; sym++) {
|
142
141
|
if (length[sym] != bit_num) continue;
|
142
|
+
if (pos >= table_mask) return 1; /* table overflow */
|
143
143
|
|
144
144
|
#ifdef BITS_ORDER_MSB
|
145
145
|
leaf = pos >> 16;
|
@@ -161,8 +161,7 @@ static int make_decode_table(unsigned int nsyms, unsigned int nbits,
|
|
161
161
|
if ((pos >> (15-fill)) & 1) leaf++;
|
162
162
|
}
|
163
163
|
table[leaf] = sym;
|
164
|
-
|
165
|
-
if ((pos += bit_mask) > table_mask) return 1; /* table overflow */
|
164
|
+
pos += bit_mask;
|
166
165
|
}
|
167
166
|
bit_mask >>= 1;
|
168
167
|
}
|
data/ext/libmspack.h
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
#ifndef LIBMSPACK_H
|
2
|
+
#define LIBMSPACK_H 1
|
3
|
+
|
4
|
+
#ifndef RBFFI_EXPORT
|
5
|
+
# ifdef __cplusplus
|
6
|
+
# define RBFFI_EXPORT extern "C"
|
7
|
+
# else
|
8
|
+
# define RBFFI_EXPORT
|
9
|
+
# endif
|
10
|
+
#endif
|
11
|
+
|
12
|
+
struct LibMsPack_MsPack_MsPackFile {
|
13
|
+
int file;
|
14
|
+
const char * name;
|
15
|
+
};
|
16
|
+
|
17
|
+
struct LibMsPack_MsPack_MsPackSystem {
|
18
|
+
struct LibMsPack_MsPack_MsPackFile * (*open)(struct LibMsPack_MsPack_MsPackSystem *, const char *, int);
|
19
|
+
void (*close)(struct LibMsPack_MsPack_MsPackFile *);
|
20
|
+
int (*read)(struct LibMsPack_MsPack_MsPackFile *, inout void *, int);
|
21
|
+
int (*write)(struct LibMsPack_MsPack_MsPackFile *, inout void *, int);
|
22
|
+
int (*seek)(struct LibMsPack_MsPack_MsPackFile *, off_t, int);
|
23
|
+
off_t (*tell)(struct LibMsPack_MsPack_MsPackFile *);
|
24
|
+
void (*message)(struct LibMsPack_MsPack_MsPackFile *, const char *, ...);
|
25
|
+
void * (*alloc)(struct LibMsPack_MsPack_MsPackFile *, size_t);
|
26
|
+
void (*free)(void *);
|
27
|
+
void (*copy)(const in void *, out void *, size_t);
|
28
|
+
void * null_ptr;
|
29
|
+
};
|
30
|
+
|
31
|
+
struct LibMsPack_MsCab_MsCabdFolder {
|
32
|
+
struct LibMsPack_MsCab_MsCabdFolder * next;
|
33
|
+
int comp_type;
|
34
|
+
unsigned int num_blocks;
|
35
|
+
};
|
36
|
+
|
37
|
+
struct LibMsPack_MsCab_MsCabdFile {
|
38
|
+
struct LibMsPack_MsCab_MsCabdFile * next;
|
39
|
+
const char * filename;
|
40
|
+
unsigned int length;
|
41
|
+
int attribs;
|
42
|
+
char time_h;
|
43
|
+
char time_m;
|
44
|
+
char time_s;
|
45
|
+
char date_d;
|
46
|
+
char date_m;
|
47
|
+
int date_y;
|
48
|
+
struct LibMsPack_MsCab_MsCabdFolder * folder;
|
49
|
+
unsigned int offset;
|
50
|
+
};
|
51
|
+
|
52
|
+
struct LibMsPack_MsCab_MsCabdCabinet {
|
53
|
+
struct LibMsPack_MsCab_MsCabdCabinet * next;
|
54
|
+
const char * filename;
|
55
|
+
off_t base_offset;
|
56
|
+
unsigned int length;
|
57
|
+
struct LibMsPack_MsCab_MsCabdCabinet * prevcab;
|
58
|
+
struct LibMsPack_MsCab_MsCabdCabinet * nextcab;
|
59
|
+
const char * prevname;
|
60
|
+
const char * nextname;
|
61
|
+
const char * previnfo;
|
62
|
+
const char * nextinfo;
|
63
|
+
struct LibMsPack_MsCab_MsCabdFile * files;
|
64
|
+
struct LibMsPack_MsCab_MsCabdFolder * folders;
|
65
|
+
unsigned short set_id;
|
66
|
+
unsigned short set_index;
|
67
|
+
unsigned short header_resv;
|
68
|
+
int flags;
|
69
|
+
};
|
70
|
+
|
71
|
+
struct LibMsPack_MsCab_MsCabCompressor {
|
72
|
+
int dummy;
|
73
|
+
};
|
74
|
+
|
75
|
+
struct LibMsPack_MsCab_MsCabDecompressor {
|
76
|
+
struct LibMsPack_MsCab_MsCabdCabinet * (*open)(struct LibMsPack_MsCab_MsCabDecompressor *, const char *);
|
77
|
+
void (*close)(struct LibMsPack_MsCab_MsCabDecompressor *, struct LibMsPack_MsCab_MsCabdCabinet *);
|
78
|
+
struct LibMsPack_MsCab_MsCabdCabinet * (*search)(struct LibMsPack_MsCab_MsCabDecompressor *, const char *);
|
79
|
+
int (*append)(struct LibMsPack_MsCab_MsCabDecompressor *, struct LibMsPack_MsCab_MsCabdCabinet *, struct LibMsPack_MsCab_MsCabdCabinet *);
|
80
|
+
int (*prepend)(struct LibMsPack_MsCab_MsCabDecompressor *, struct LibMsPack_MsCab_MsCabdCabinet *, struct LibMsPack_MsCab_MsCabdCabinet *);
|
81
|
+
int (*extract)(struct LibMsPack_MsCab_MsCabDecompressor *, struct LibMsPack_MsCab_MsCabdFile *, const char *);
|
82
|
+
int (*set_param)(struct LibMsPack_MsCab_MsCabDecompressor *, int, int);
|
83
|
+
int (*last_error)(struct LibMsPack_MsCab_MsCabDecompressor *);
|
84
|
+
};
|
85
|
+
|
86
|
+
struct LibMsPack_MsChm_MsChmcFile {
|
87
|
+
int section;
|
88
|
+
const char * filename;
|
89
|
+
const char * chm_filename;
|
90
|
+
off_t length;
|
91
|
+
};
|
92
|
+
|
93
|
+
struct LibMsPack_MsChm_MsChmdSection {
|
94
|
+
struct LibMsPack_MsChm_MsChmdHeader * chm;
|
95
|
+
unsigned int id;
|
96
|
+
};
|
97
|
+
|
98
|
+
struct LibMsPack_MsChm_MsChmdFile {
|
99
|
+
struct LibMsPack_MsChm_MsChmdFile * next;
|
100
|
+
struct LibMsPack_MsChm_MsChmdSection * section;
|
101
|
+
off_t offset;
|
102
|
+
off_t length;
|
103
|
+
const char * filename;
|
104
|
+
};
|
105
|
+
|
106
|
+
struct LibMsPack_MsChm_MsChmdSecUncompressed {
|
107
|
+
struct LibMsPack_MsChm_MsChmdSection base;
|
108
|
+
off_t offset;
|
109
|
+
};
|
110
|
+
|
111
|
+
struct LibMsPack_MsChm_MsChmdSecMscompressed {
|
112
|
+
struct LibMsPack_MsChm_MsChmdSection base;
|
113
|
+
struct LibMsPack_MsChm_MsChmdFile * content;
|
114
|
+
struct LibMsPack_MsChm_MsChmdFile * control;
|
115
|
+
struct LibMsPack_MsChm_MsChmdFile * rtable;
|
116
|
+
struct LibMsPack_MsChm_MsChmdFile * spaninfo;
|
117
|
+
};
|
118
|
+
|
119
|
+
struct LibMsPack_MsChm_MsChmdHeader {
|
120
|
+
unsigned int version;
|
121
|
+
unsigned int timestamp;
|
122
|
+
unsigned int language;
|
123
|
+
const char * filename;
|
124
|
+
off_t length;
|
125
|
+
struct LibMsPack_MsChm_MsChmdFile * files;
|
126
|
+
struct LibMsPack_MsChm_MsChmdFile * sysfiles;
|
127
|
+
struct LibMsPack_MsChm_MsChmdSecUncompressed sec0;
|
128
|
+
struct LibMsPack_MsChm_MsChmdSecMscompressed sec1;
|
129
|
+
off_t dir_offset;
|
130
|
+
unsigned int num_chunks;
|
131
|
+
unsigned int chunk_size;
|
132
|
+
unsigned int density;
|
133
|
+
unsigned int depth;
|
134
|
+
unsigned int index_root;
|
135
|
+
unsigned int first_pmgl;
|
136
|
+
unsigned int last_pmgl;
|
137
|
+
void * chunk_cache;
|
138
|
+
};
|
139
|
+
|
140
|
+
struct LibMsPack_MsChm_MsChmCompressor {
|
141
|
+
int (*generate)(struct LibMsPack_MsChm_MsChmCompressor *, struct LibMsPack_MsChm_MsChmcFile *, const char *);
|
142
|
+
int (*use_temporary_file)(struct LibMsPack_MsChm_MsChmCompressor *, int, const char *);
|
143
|
+
int (*set_param)(struct LibMsPack_MsChm_MsChmCompressor *, int, unsigned int);
|
144
|
+
int (*last_error)(struct LibMsPack_MsChm_MsChmCompressor *);
|
145
|
+
};
|
146
|
+
|
147
|
+
struct LibMsPack_MsChm_MsChmDecompressor {
|
148
|
+
struct LibMsPack_MsChm_MsChmdHeader * (*open)(struct LibMsPack_MsChm_MsChmDecompressor *, const char *);
|
149
|
+
void (*close)(struct LibMsPack_MsChm_MsChmDecompressor *, struct LibMsPack_MsChm_MsChmdHeader *);
|
150
|
+
int (*extract)(struct LibMsPack_MsChm_MsChmDecompressor *, struct LibMsPack_MsChm_MsChmdFile *, const char *);
|
151
|
+
int (*last_error)(struct LibMsPack_MsChm_MsChmDecompressor *);
|
152
|
+
struct LibMsPack_MsChm_MsChmdHeader * (*fast_open)(struct LibMsPack_MsChm_MsChmDecompressor *, const char *);
|
153
|
+
int (*fast_find)(struct LibMsPack_MsChm_MsChmDecompressor *, struct LibMsPack_MsChm_MsChmdHeader *, const char *, struct LibMsPack_MsChm_MsChmdFile *, int);
|
154
|
+
};
|
155
|
+
|
156
|
+
struct LibMsPack_MsHlp_MsHlpCompressor {
|
157
|
+
int dummy;
|
158
|
+
};
|
159
|
+
|
160
|
+
struct LibMsPack_MsHlp_MsHlpDecompressor {
|
161
|
+
int dummy;
|
162
|
+
};
|
163
|
+
|
164
|
+
struct LibMsPack_MsKwaj_MsKwajdHeader {
|
165
|
+
unsigned short comp_type;
|
166
|
+
off_t data_offset;
|
167
|
+
int headers;
|
168
|
+
off_t length;
|
169
|
+
const char * filename;
|
170
|
+
void * extra;
|
171
|
+
unsigned short extra_length;
|
172
|
+
};
|
173
|
+
|
174
|
+
struct LibMsPack_MsKwaj_MsKwajCompressor {
|
175
|
+
int (*compress)(void *, const char *, const char *, off_t);
|
176
|
+
int (*set_param)(void *, int, unsigned int);
|
177
|
+
int (*set_filename)(void *, const char *);
|
178
|
+
int (*set_extra_data)(void *, void *, unsigned int);
|
179
|
+
int (*last_error)(void *);
|
180
|
+
};
|
181
|
+
|
182
|
+
struct LibMsPack_MsKwaj_MsKwajDecompressor {
|
183
|
+
void * (*open)(void *, const char *);
|
184
|
+
void (*close)(void *, void *);
|
185
|
+
int (*extract)(void *, void *, const char *);
|
186
|
+
int (*decompress)(void *, const char *, const char *);
|
187
|
+
int (*last_error)(void *);
|
188
|
+
};
|
189
|
+
|
190
|
+
struct LibMsPack_MsLit_MsLitCompressor {
|
191
|
+
int dummy;
|
192
|
+
};
|
193
|
+
|
194
|
+
struct LibMsPack_MsLit_MsLitDecompressor {
|
195
|
+
int dummy;
|
196
|
+
};
|
197
|
+
|
198
|
+
struct LibMsPack_MsOab_MsoabCompressor {
|
199
|
+
int (*compress)(void *, const char *, const char *);
|
200
|
+
int (*compress_incremental)(void *, const char *, const char *, const char *);
|
201
|
+
};
|
202
|
+
|
203
|
+
struct LibMsPack_MsOab_MsoabDecompressor {
|
204
|
+
int (*decompress)(void *, const char *, const char *);
|
205
|
+
int (*decompress_incremental)(void *, const char *, const char *, const char *);
|
206
|
+
};
|
207
|
+
|
208
|
+
struct LibMsPack_MsSzdd_MsSzdddHeader {
|
209
|
+
int format;
|
210
|
+
off_t length;
|
211
|
+
char missing_char;
|
212
|
+
};
|
213
|
+
|
214
|
+
struct LibMsPack_MsSzdd_MsSzddCompressor {
|
215
|
+
int (*compress)(void *, const char *, const char *, off_t);
|
216
|
+
int (*set_param)(void *, int, unsigned int);
|
217
|
+
int (*last_error)(void *);
|
218
|
+
};
|
219
|
+
|
220
|
+
struct LibMsPack_MsSzdd_MsSzddDecompressor {
|
221
|
+
void * (*open)(void *, const char *);
|
222
|
+
void (*close)(void *, void *);
|
223
|
+
int (*extract)(void *, void *, const char *);
|
224
|
+
int (*decompress)(void *, const char *, const char *);
|
225
|
+
int (*last_error)(void *);
|
226
|
+
};
|
227
|
+
|
228
|
+
RBFFI_EXPORT int mspack_sys_selftest_internal(int);
|
229
|
+
RBFFI_EXPORT int mspack_version(int);
|
230
|
+
RBFFI_EXPORT struct LibMsPack_MsCab_MsCabCompressor * mspack_create_cab_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
231
|
+
RBFFI_EXPORT void mspack_destroy_cab_compressor(struct LibMsPack_MsCab_MsCabCompressor *);
|
232
|
+
RBFFI_EXPORT struct LibMsPack_MsCab_MsCabDecompressor * mspack_create_cab_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
233
|
+
RBFFI_EXPORT void mspack_destroy_cab_decompressor(struct LibMsPack_MsCab_MsCabDecompressor *);
|
234
|
+
RBFFI_EXPORT void * mspack_create_chm_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
235
|
+
RBFFI_EXPORT void mspack_destroy_chm_compressor(void *);
|
236
|
+
RBFFI_EXPORT void * mspack_create_chm_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
237
|
+
RBFFI_EXPORT void mspack_destroy_chm_decompressor(void *);
|
238
|
+
RBFFI_EXPORT struct LibMsPack_MsLit_MsLitCompressor * mspack_create_lit_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
239
|
+
RBFFI_EXPORT void mspack_destroy_lit_compressor(struct LibMsPack_MsLit_MsLitCompressor *);
|
240
|
+
RBFFI_EXPORT struct LibMsPack_MsLit_MsLitDecompressor * mspack_create_lit_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
241
|
+
RBFFI_EXPORT void mspack_destroy_lit_decompressor(struct LibMsPack_MsLit_MsLitDecompressor *);
|
242
|
+
RBFFI_EXPORT struct LibMsPack_MsHlp_MsHlpCompressor * mspack_create_hlp_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
243
|
+
RBFFI_EXPORT void mspack_destroy_hlp_compressor(struct LibMsPack_MsHlp_MsHlpCompressor *);
|
244
|
+
RBFFI_EXPORT struct LibMsPack_MsHlp_MsHlpDecompressor * mspack_create_hlp_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
245
|
+
RBFFI_EXPORT void mspack_destroy_hlp_decompressor(struct LibMsPack_MsHlp_MsHlpDecompressor *);
|
246
|
+
RBFFI_EXPORT void * mspack_create_szdd_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
247
|
+
RBFFI_EXPORT void mspack_destroy_szdd_compressor(void *);
|
248
|
+
RBFFI_EXPORT void * mspack_create_szdd_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
249
|
+
RBFFI_EXPORT void mspack_destroy_szdd_decompressor(void *);
|
250
|
+
RBFFI_EXPORT void * mspack_create_kwaj_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
251
|
+
RBFFI_EXPORT void mspack_destroy_kwaj_compressor(void *);
|
252
|
+
RBFFI_EXPORT void * mspack_create_kwaj_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
253
|
+
RBFFI_EXPORT void mspack_destroy_kwaj_decompressor(void *);
|
254
|
+
RBFFI_EXPORT void * mspack_create_oab_compressor(struct LibMsPack_MsPack_MsPackSystem *);
|
255
|
+
RBFFI_EXPORT void mspack_destroy_oab_compressor(void *);
|
256
|
+
RBFFI_EXPORT void * mspack_create_oab_decompressor(struct LibMsPack_MsPack_MsPackSystem *);
|
257
|
+
RBFFI_EXPORT void mspack_destroy_oab_decompressor(void *);
|
258
|
+
|
259
|
+
#endif /* LIBMSPACK_H */
|
Binary file
|
data/lib/libmspack/mscab.rb
CHANGED
@@ -43,14 +43,14 @@ module LibMsPack
|
|
43
43
|
# Returns the compression method used by a folder.
|
44
44
|
# @param [Fixnum] compType a MsCabdFolder.comp_type value
|
45
45
|
# @return [Fixnum] one of MSCAB_COMP_NONE, MSCAB_COMP_MSZIP, MSCAB_COMP_QUANTUM or MSCAB_COMP_LZX
|
46
|
-
def MsCabdCompMethod(compType)
|
46
|
+
def self.MsCabdCompMethod(compType)
|
47
47
|
compType & 0x0F
|
48
48
|
end
|
49
49
|
|
50
50
|
# Returns the compression level used by a folder.
|
51
51
|
# @param [Fixnum] compType a MsCabdFolder.comp_type value
|
52
52
|
# @return [Fixnum] the compression level. This is only defined by LZX and Quantum compression
|
53
|
-
def MsCabdCompLevel(compType)
|
53
|
+
def self.MsCabdCompLevel(compType)
|
54
54
|
((comp_type) >> 8) & 0x1F
|
55
55
|
end
|
56
56
|
|
@@ -94,14 +94,14 @@ module LibMsPack
|
|
94
94
|
#
|
95
95
|
# @return [Fixnum] one of MSCAB_COMP_NONE, MSCAB_COMP_MSZIP, MSCAB_COMP_QUANTUM or MSCAB_COMP_LZX
|
96
96
|
def compressionMethod
|
97
|
-
MsCabdCompMethod(comp_type)
|
97
|
+
MsCab::MsCabdCompMethod(comp_type)
|
98
98
|
end
|
99
99
|
|
100
100
|
# Returns the compression level used by a folder.
|
101
101
|
#
|
102
102
|
# @return [Fixnum] the compression level. This is only defined by LZX and Quantum compression
|
103
103
|
def compressionLevel
|
104
|
-
MsCabdCompLevel(comp_type)
|
104
|
+
MsCab::MsCabdCompLevel(comp_type)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
data/lib/libmspack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libmspack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dāvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- UNLICENSE
|
141
141
|
- ext/Rakefile
|
142
142
|
- ext/i386-windows/libmspack.dll
|
143
|
+
- ext/libmspack.h
|
143
144
|
- ext/libmspack/AUTHORS
|
144
145
|
- ext/libmspack/COPYING.LIB
|
145
146
|
- ext/libmspack/ChangeLog
|