5
#include "NsisHandler.h"
5
#include "../../../../C/CpuArch.h"
7
#include "Common/StringConvert.h"
7
#include "Common/ComTry.h"
8
8
#include "Common/IntToString.h"
9
9
#include "Common/NewHandler.h"
10
#include "Common/ComTry.h"
12
11
#include "Windows/PropVariant.h"
13
#include "../../Common/StreamUtils.h"
14
15
#include "../Common/ItemNameUtils.h"
15
#include "../../Common/StreamUtils.h"
17
#include "NsisHandler.h"
19
#define Get32(p) GetUi32(p)
17
21
using namespace NWindows;
33
37
static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
35
STATPROPSTG kProps[] =
39
STATPROPSTG kProps[] =
37
41
{ NULL, kpidPath, VT_BSTR},
38
{ NULL, kpidIsFolder, VT_BOOL},
39
42
{ NULL, kpidSize, VT_UI8},
40
{ NULL, kpidPackedSize, VT_UI8},
41
{ NULL, kpidLastWriteTime, VT_FILETIME},
43
{ NULL, kpidPackSize, VT_UI8},
44
{ NULL, kpidMTime, VT_FILETIME},
42
45
{ NULL, kpidMethod, VT_BSTR},
43
46
{ NULL, kpidSolid, VT_BOOL}
46
STATPROPSTG kArcProps[] =
49
STATPROPSTG kArcProps[] =
48
51
{ NULL, kpidMethod, VT_BSTR},
49
52
{ NULL, kpidSolid, VT_BOOL}
69
72
if (item.DictionarySize > dict)
70
73
dict = item.DictionarySize;
72
prop = GetMethod(filter, dict);
75
prop = GetMethod(filter, dict);
75
78
case kpidSolid: prop = _archive.IsSolid; break;
238
if (_archive.IsUnicode)
239
s = item.GetReducedNameU();
241
s = MultiByteToUnicodeString(item.GetReducedNameA(), CP_ACP);
242
s = NItemName::WinNameToOSName(s);
231
UString s = NItemName::WinNameToOSName(item.GetReducedName(_archive.IsUnicode));
243
232
if (!s.IsEmpty())
244
233
prop = (const wchar_t *)s;
254
240
prop = (UInt64)size;
260
246
if (GetCompressedSize(index, size))
261
247
prop = (UInt64)size;
264
case kpidLastWriteTime:
266
if (item.DateTime.dwHighDateTime > 0x01000000 &&
267
item.DateTime.dwHighDateTime < 0xFF000000)
268
prop = item.DateTime;
273
prop = GetMethod(item.UseFilter, item.DictionarySize);
277
prop = _archive.IsSolid;
252
if (item.MTime.dwHighDateTime > 0x01000000 &&
253
item.MTime.dwHighDateTime < 0xFF000000)
257
case kpidMethod: prop = GetMethod(item.UseFilter, item.DictionarySize); break;
258
case kpidSolid: prop = _archive.IsSolid; break;
281
261
prop.Detach(value);
335
315
_inStream, _archive.Method, _archive.FilterFlag, useFilter));
319
const UInt32 kBufferLength = 1 << 16;
320
byteBuf.SetCapacity(kBufferLength);
321
Byte *buffer = byteBuf;
338
323
bool dataError = false;
339
324
for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
405
387
if (streamPos == pos)
407
390
size_t processedSize = 4;
408
RINOK(_archive.Decoder.Read(buffer, &processedSize));
391
RINOK(_archive.Decoder.Read(buffer2, &processedSize));
409
392
if (processedSize != 4)
411
394
streamPos += processedSize;
412
fullSize = GetUInt32FromMemLE(buffer);
395
fullSize = Get32(buffer2);
413
396
sizeIsKnown = true;
414
397
needDecompress = true;
424
407
RINOK(_archive.Decoder.Init(
425
408
EXTERNAL_CODECS_VARS
426
409
_inStream, _archive.Method, _archive.FilterFlag, useFilter));
427
fullSize = GetUInt32FromMemLE(buffer);
410
// fullSize = Get32(buffer); // It's bug !!!
411
// Test it: what is exact fullSize?
412
fullSize = 0xFFFFFFFF;
430
415
fullSize = item.Size;
462
447
UInt64 completed;
463
448
if (_archive.IsSolid)
449
completed = currentTotalSize + offset;
464
451
completed = streamPos;
466
completed = currentTotalSize + offset;
467
452
RINOK(extractCallback->SetCompleted(&completed));
469
454
RINOK(WriteStream(realOutStream, buffer, processedSize));
493
478
realOutStream.Release();
494
RINOK(extractCallback->SetOperationResult(dataError ?
479
RINOK(extractCallback->SetOperationResult(dataError ?
495
480
NArchive::NExtract::NOperationResult::kDataError :
496
481
NArchive::NExtract::NOperationResult::kOK));