git-svn: trunk@3211
aCaB authored on 2007/09/09 21:32:29... | ... |
@@ -29,7 +29,6 @@ |
29 | 29 |
#include <unistd.h> |
30 | 30 |
#endif |
31 | 31 |
|
32 |
-#include "nulsft.h" |
|
33 | 32 |
#include "others.h" |
34 | 33 |
#include "cltypes.h" |
35 | 34 |
#include "nsis_bzlib.h" |
... | ... |
@@ -52,6 +51,32 @@ enum { |
52 | 52 |
COMP_NOCOMP |
53 | 53 |
}; |
54 | 54 |
|
55 |
+struct nsis_st { |
|
56 |
+ int ifd; |
|
57 |
+ int ofd; |
|
58 |
+ off_t off; |
|
59 |
+ char *dir; |
|
60 |
+ uint32_t asz; |
|
61 |
+ uint32_t hsz; |
|
62 |
+ uint32_t fno; |
|
63 |
+ struct { |
|
64 |
+ uint32_t avail_in; |
|
65 |
+ unsigned char *next_in; |
|
66 |
+ uint32_t avail_out; |
|
67 |
+ unsigned char *next_out; |
|
68 |
+ } nsis; |
|
69 |
+ nsis_bzstream bz; |
|
70 |
+ lzma_stream lz; |
|
71 |
+ nsis_z_stream z; |
|
72 |
+ unsigned char *freeme; |
|
73 |
+ uint8_t comp; |
|
74 |
+ uint8_t solid; |
|
75 |
+ uint8_t freecomp; |
|
76 |
+ uint8_t eof; |
|
77 |
+ char ofn[1024]; |
|
78 |
+}; |
|
79 |
+ |
|
80 |
+ |
|
55 | 81 |
#define LINESTR(x) #x |
56 | 82 |
#define LINESTR2(x) LINESTR(x) |
57 | 83 |
#define __AT__ " at "__FILE__":"LINESTR2(__LINE__) |
... | ... |
@@ -372,7 +397,7 @@ static int nsis_unpack_next(struct nsis_st *n, cli_ctx *ctx) { |
372 | 372 |
|
373 | 373 |
} |
374 | 374 |
|
375 |
-static uint8_t detcomp(const char *b) { |
|
375 |
+static uint8_t nsis_detcomp(const char *b) { |
|
376 | 376 |
if (*b=='1') return COMP_BZIP2; |
377 | 377 |
if ((cli_readint32(b)&~0x80000000)==0x5d) return COMP_LZMA; |
378 | 378 |
return COMP_ZLIB; |
... | ... |
@@ -410,11 +435,11 @@ static int nsis_headers(struct nsis_st *n, cli_ctx *ctx) { |
410 | 410 |
int32_t nextsz; |
411 | 411 |
if (cli_readn(n->ifd, buf+4, 4)!=4) return CL_EIO; |
412 | 412 |
nextsz=cli_readint32(buf+4); |
413 |
- if (!i) n->comp = detcomp(buf+4); |
|
413 |
+ if (!i) n->comp = nsis_detcomp(buf+4); |
|
414 | 414 |
if (nextsz&0x80000000) { |
415 | 415 |
nextsz&=~0x80000000; |
416 | 416 |
if (cli_readn(n->ifd, buf+4, 4)!=4) return CL_EIO; |
417 |
- comps[detcomp(buf+4)]++; |
|
417 |
+ comps[nsis_detcomp(buf+4)]++; |
|
418 | 418 |
nextsz-=4; |
419 | 419 |
pos+=4; |
420 | 420 |
} |
... | ... |
@@ -473,6 +498,8 @@ int cli_scannulsft(int desc, cli_ctx *ctx, off_t offset) { |
473 | 473 |
return CL_ETMPDIR; |
474 | 474 |
} |
475 | 475 |
|
476 |
+ if(cli_leavetemps_flag) cli_dbgmsg("NSIS: Extracting files to %s\n", nsist.dir); |
|
477 |
+ |
|
476 | 478 |
ctx->arec++; |
477 | 479 |
|
478 | 480 |
do { |
... | ... |
@@ -19,37 +19,6 @@ |
19 | 19 |
#ifndef __NSIS_H |
20 | 20 |
#define __NSIS_H |
21 | 21 |
|
22 |
-#include "cltypes.h" |
|
23 |
-#include "nsis_bzlib.h" |
|
24 |
-#include "LZMADecode.h" |
|
25 |
-#include "nsis_zlib.h" |
|
26 | 22 |
#include "others.h" |
27 |
- |
|
28 |
-struct nsis_st { |
|
29 |
- int ifd; |
|
30 |
- int ofd; |
|
31 |
- off_t off; |
|
32 |
- char *dir; |
|
33 |
- uint32_t asz; |
|
34 |
- uint32_t hsz; |
|
35 |
- uint32_t fno; |
|
36 |
- struct { |
|
37 |
- uint32_t avail_in; |
|
38 |
- unsigned char *next_in; |
|
39 |
- uint32_t avail_out; |
|
40 |
- unsigned char *next_out; |
|
41 |
- } nsis; |
|
42 |
- nsis_bzstream bz; |
|
43 |
- lzma_stream lz; |
|
44 |
- nsis_z_stream z; |
|
45 |
- unsigned char *freeme; |
|
46 |
- uint8_t comp; |
|
47 |
- uint8_t solid; |
|
48 |
- uint8_t freecomp; |
|
49 |
- uint8_t eof; |
|
50 |
- char ofn[1024]; |
|
51 |
-}; |
|
52 |
- |
|
53 |
-int cli_nsis_unpack(struct nsis_st *, cli_ctx *); |
|
54 |
-void cli_nsis_free(struct nsis_st *); |
|
23 |
+int cli_scannulsft(int desc, cli_ctx *ctx, off_t offset); |
|
55 | 24 |
#endif |
... | ... |
@@ -85,6 +85,7 @@ |
85 | 85 |
#include "cab.h" |
86 | 86 |
#include "rtf.h" |
87 | 87 |
#include "unarj.h" |
88 |
+#include "nulsft.h" |
|
88 | 89 |
|
89 | 90 |
#ifdef HAVE_ZLIB_H |
90 | 91 |
#include <zlib.h> |
... | ... |
@@ -103,7 +104,6 @@ |
103 | 103 |
#define MAX_MAIL_RECURSION 15 |
104 | 104 |
|
105 | 105 |
|
106 |
-int cli_scannulsft(int desc, cli_ctx *ctx, off_t offset); /* FIXME */ |
|
107 | 106 |
static int cli_scanfile(const char *filename, cli_ctx *ctx); |
108 | 107 |
|
109 | 108 |
static int cli_unrar_scanmetadata(int desc, rar_metadata_t *metadata, cli_ctx *ctx, unsigned int files, uint32_t* sfx_check) |