|
@@ -91,16 +91,11 @@ type
|
|
FLastReportedCurrentPath: String;
|
|
FLastReportedCurrentPath: String;
|
|
FProgress, FProgressMax, FLastReportedProgress, FLastReportedProgressMax: UInt64;
|
|
FProgress, FProgressMax, FLastReportedProgress, FLastReportedProgressMax: UInt64;
|
|
FOpRes: TNOperationResult;
|
|
FOpRes: TNOperationResult;
|
|
- procedure GetProperty(const index: UInt32; const propID: PROPID;
|
|
|
|
- const allowedTypes: TVarTypeSet; out value: OleVariant;
|
|
|
|
- out valueIsEmpty: Boolean); overload;
|
|
|
|
- procedure GetProperty(index: UInt32; propID: PROPID; out value: String;
|
|
|
|
- out valueIsEmpty: Boolean); overload;
|
|
|
|
- procedure GetProperty(index: UInt32; propID: PROPID; out value: UInt32;
|
|
|
|
- out valueIsEmpty: Boolean); overload;
|
|
|
|
- procedure GetProperty(index: UInt32; propID: PROPID; out value: Boolean;
|
|
|
|
- out valueIsEmpty: Boolean); overload;
|
|
|
|
- procedure GetProperty(index: UInt32; propID: PROPID; out value: Boolean); overload;
|
|
|
|
|
|
+ function GetProperty(const index: UInt32; const propID: PROPID;
|
|
|
|
+ const allowedTypes: TVarTypeSet; out value: OleVariant): Boolean; overload;
|
|
|
|
+ function GetProperty(index: UInt32; propID: PROPID; out value: String): Boolean; overload;
|
|
|
|
+ function GetProperty(index: UInt32; propID: PROPID; out value: UInt32): Boolean; overload;
|
|
|
|
+ function GetProperty(index: UInt32; propID: PROPID; out value: Boolean): Boolean; overload;
|
|
protected
|
|
protected
|
|
{ IProgress }
|
|
{ IProgress }
|
|
function SetTotal(total: UInt64): HRESULT; stdcall;
|
|
function SetTotal(total: UInt64): HRESULT; stdcall;
|
|
@@ -278,49 +273,43 @@ begin
|
|
Result := S_OK;
|
|
Result := S_OK;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TArchiveExtractCallback.GetProperty(const index: UInt32;
|
|
|
|
- const propID: PROPID; const allowedTypes: TVarTypeSet; out value: OleVariant;
|
|
|
|
- out valueIsEmpty: Boolean);
|
|
|
|
|
|
+function TArchiveExtractCallback.GetProperty(const index: UInt32;
|
|
|
|
+ const propID: PROPID; const allowedTypes: TVarTypeSet; out value: OleVariant): Boolean;
|
|
|
|
+{ Raises an exception on error but otherwise always sets value, returning True if
|
|
|
|
+ it's not empty }
|
|
begin
|
|
begin
|
|
var Res := FInArchive.GetProperty(index, propID, value);
|
|
var Res := FInArchive.GetProperty(index, propID, value);
|
|
if Res <> S_OK then
|
|
if Res <> S_OK then
|
|
OleError(Res);
|
|
OleError(Res);
|
|
- valueIsEmpty := VarIsEmpty(value);
|
|
|
|
- if not valueIsEmpty and not (VarType(value) in allowedTypes) then
|
|
|
|
|
|
+ Result := not VarIsEmpty(Value);
|
|
|
|
+ if Result and not (VarType(value) in allowedTypes) then
|
|
OleError(E_FAIL);
|
|
OleError(E_FAIL);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
- out value: String; out valueIsEmpty: Boolean);
|
|
|
|
|
|
+function TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
+ out value: String): Boolean;
|
|
begin
|
|
begin
|
|
var varValue: OleVariant;
|
|
var varValue: OleVariant;
|
|
- GetProperty(index, propID, [varOleStr], varValue, valueIsEmpty);
|
|
|
|
|
|
+ Result := GetProperty(index, propID, [varOleStr], varValue);
|
|
value := varValue;
|
|
value := varValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
- out value: Cardinal; out valueIsEmpty: Boolean);
|
|
|
|
|
|
+function TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
+ out value: Cardinal): Boolean;
|
|
begin
|
|
begin
|
|
var varValue: OleVariant;
|
|
var varValue: OleVariant;
|
|
- GetProperty(index, propID, [varUInt32], varValue, valueIsEmpty);
|
|
|
|
|
|
+ Result := GetProperty(index, propID, [varUInt32], varValue);
|
|
value := varValue;
|
|
value := varValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
- out value: Boolean; out valueIsEmpty: Boolean);
|
|
|
|
|
|
+function TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
+ out value: Boolean): Boolean;
|
|
begin
|
|
begin
|
|
var varValue: OleVariant;
|
|
var varValue: OleVariant;
|
|
- GetProperty(index, propID, [varBoolean], varValue, valueIsEmpty);
|
|
|
|
|
|
+ Result := GetProperty(index, propID, [varBoolean], varValue);
|
|
value := varValue;
|
|
value := varValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TArchiveExtractCallback.GetProperty(index: UInt32; propID: PROPID;
|
|
|
|
- out value: Boolean);
|
|
|
|
-begin
|
|
|
|
- var valueIsEmpty: Boolean;
|
|
|
|
- GetProperty(index, propID, value, valueIsEmpty);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TArchiveExtractCallback.GetStream(index: UInt32;
|
|
function TArchiveExtractCallback.GetStream(index: UInt32;
|
|
out outStream: ISequentialOutStream; askExtractMode: Int32): HRESULT;
|
|
out outStream: ISequentialOutStream; askExtractMode: Int32): HRESULT;
|
|
begin
|
|
begin
|
|
@@ -328,9 +317,7 @@ begin
|
|
FCurrent := Default(TCurrent);
|
|
FCurrent := Default(TCurrent);
|
|
if askExtractMode = kExtract then begin
|
|
if askExtractMode = kExtract then begin
|
|
var Path: String;
|
|
var Path: String;
|
|
- var IsEmpty: Boolean;
|
|
|
|
- GetProperty(index, kpidPath, Path, IsEmpty);
|
|
|
|
- if IsEmpty then
|
|
|
|
|
|
+ if not GetProperty(index, kpidPath, Path) then
|
|
Path := PathChangeExt(FExtractedArchiveName, '');
|
|
Path := PathChangeExt(FExtractedArchiveName, '');
|
|
var IsDir: Boolean;
|
|
var IsDir: Boolean;
|
|
GetProperty(index, kpidIsDir, IsDir);
|
|
GetProperty(index, kpidIsDir, IsDir);
|
|
@@ -344,8 +331,7 @@ begin
|
|
outStream := nil;
|
|
outStream := nil;
|
|
end else begin
|
|
end else begin
|
|
var Attrib: DWORD;
|
|
var Attrib: DWORD;
|
|
- GetProperty(index, kpidAttrib, Attrib, IsEmpty);
|
|
|
|
- if not IsEmpty then
|
|
|
|
|
|
+ if GetProperty(index, kpidAttrib, Attrib) then
|
|
FCurrent.SetAttrib(Attrib);
|
|
FCurrent.SetAttrib(Attrib);
|
|
if not FFullPaths then
|
|
if not FFullPaths then
|
|
Path := PathExtractName(Path);
|
|
Path := PathExtractName(Path);
|