FIX: Crash when no free space in the temp directory

This commit is contained in:
Alexander Koblov 2019-07-21 10:47:17 +00:00
commit 7d088a6a4e
6 changed files with 52 additions and 11 deletions

View file

@ -158,6 +158,11 @@ begin
begin
Arc.Free;
ArchiveData.OpenResult := GetArchiveError(E);
if (ArchiveData.OpenResult = E_UNKNOWN) then
begin
ArchiveData.OpenResult := E_HANDLED;
gStartupInfo.MessageBox(PAnsiChar(E.Message), nil, MB_OK or MB_ICONERROR);
end;
end;
end;
end;

View file

@ -40,7 +40,7 @@ uses
const
AB_VMSPageSize = 4096; {must be a power of two}
AB_VMSMaxPages = 2048; {makes 8MB with the above value}
AB_VMSMaxPages = 16384; {makes 64MB with the above value}
type
PvmsPage = ^TvmsPage;
@ -418,6 +418,7 @@ begin
except
if CreatedNewPage then
Dispose(Page);
raise;
end;{try..except}
end;
{--------}

View file

@ -2343,6 +2343,15 @@ Index: AbVMStrm.pas
===================================================================
--- AbVMStrm.pas (revision 512)
+++ AbVMStrm.pas (working copy)
@@ -40,7 +40,7 @@
const
AB_VMSPageSize = 4096; {must be a power of two}
- AB_VMSMaxPages = 2048; {makes 8MB with the above value}
+ AB_VMSMaxPages = 16384; {makes 64MB with the above value}
type
PvmsPage = ^TvmsPage;
@@ -109,7 +109,8 @@
{$ENDIF}
SysUtils,
@ -2350,10 +2359,18 @@ Index: AbVMStrm.pas
- AbUtils;
+ AbUtils,
+ DCOSUtils;
const
LastLRUValue = $7FFFFFFF;
@@ -429,10 +430,10 @@
@@ -417,6 +418,7 @@
except
if CreatedNewPage then
Dispose(Page);
+ raise;
end;{try..except}
end;
{--------}
@@ -429,10 +431,10 @@
begin
if (vmsSwapHandle = 0) then begin
vmsSwapFileName := AbCreateTempFile(vmsSwapFileDir);
@ -2363,10 +2380,10 @@ Index: AbVMStrm.pas
vmsSwapHandle := 0;
- DeleteFile(vmsSwapFileName);
+ mbDeleteFile(vmsSwapFileName);
raise EAbVMSErrorOpenSwap.Create( vmsSwapFileName );
raise EAbVMSErrorOpenSwap.Create( vmsSwapFileName );
end;
vmsSwapFileSize := 0;
@@ -443,7 +444,7 @@
@@ -443,7 +445,7 @@
begin
if (vmsSwapHandle <> 0) then begin
FileClose(vmsSwapHandle);

View file

@ -53,7 +53,8 @@ uses
uWfxPluginFileSource,
uArchiveFileSourceUtil,
uFileSourceOperationMessageBoxesUI,
uFileProperty, URIParser;
uFileProperty, URIParser,
WcxPlugin, uWcxModule;
procedure ChooseFile(aFileView: TFileView; aFileSource: IFileSource;
aFile: TFile);
@ -271,6 +272,8 @@ begin
except
on E: Exception do
begin
if (E is EWcxModuleException) and (EWcxModuleException(E).ErrorCode = E_HANDLED) then
Exit(True);
if not bForce then
begin
msgError(E.Message + LineEnding + aFile.FullPath);

View file

@ -425,7 +425,7 @@ begin
if mbFileExists(anArchiveFileName) then
begin
if not ReadArchive then
raise EFileSourceException.Create(GetErrorMsg(FOpenResult));
raise EWcxModuleException.Create(FOpenResult);
end;
CreateConnections;
@ -449,7 +449,7 @@ begin
if mbFileExists(anArchiveFileName) then
begin
if not ReadArchive(anArchiveHandle) then
raise Exception.Create(GetErrorMsg(FOpenResult));
raise EWcxModuleException.Create(FOpenResult);
end;
CreateConnections;

View file

@ -28,12 +28,19 @@ unit uWCXmodule;
interface
uses
LCLType, Classes, Dialogs, LazUTF8Classes, dynlibs,
LCLType, Classes, Dialogs, LazUTF8Classes, dynlibs, SysUtils,
uWCXprototypes, WcxPlugin, Extension, DCClassesUtf8, DCBasicTypes, DCXmlConfig;
Type
TWCXOperation = (OP_EXTRACT, OP_PACK, OP_DELETE);
{ EWcxModuleException }
EWcxModuleException = class(EOSError)
public
constructor Create(AErrorCode: Integer);
end;
{ TWCXHeaderData }
{ Handles THeaderData and THeaderDataEx }
@ -175,7 +182,7 @@ implementation
uses
//Lazarus, Free-Pascal, etc.
StrUtils, SysUtils, LazUTF8, FileUtil,
SysConst, StrUtils, LazUTF8, FileUtil,
//DC
uDCUtils, uComponentsSignature, uGlobsPaths, uLng, uOSUtils, DCOSUtils,
@ -184,6 +191,14 @@ uses
const
WcxIniFileName = 'wcx.ini';
{ EWcxModuleException }
constructor EWcxModuleException.Create(AErrorCode: Integer);
begin
ErrorCode:= AErrorCode;
inherited Create(GetErrorMsg(ErrorCode));
end;
constructor TWcxModule.Create;
begin
FModuleHandle := 0;
@ -498,7 +513,7 @@ begin
E_NO_FILES : Result := rsMsgErrNoFiles;
E_TOO_MANY_FILES : Result := rsMsgErrTooManyFiles;
E_NOT_SUPPORTED : Result := rsMsgErrNotSupported;
else Result := IntToStr(iErrorMsg);
else Result := Format(SUnknownErrorCode, [iErrorMsg]);
end;
end;