📄 zippass.pas
字号:
{
模块名称:解压ZIP文件
使用方法:无
返回值: 无
}
unit ZipPass;
interface
uses Windows, UnZip32;
procedure Set_UnZipOptions(var O: TDCL; Filename, ZipDir : string);
procedure Set_UserFunctions(var Z: TUserFunctions);
function DllPrnt(Buffer: PChar; Size: ULONG): integer; stdcall;
function DllPassword(P: PChar; N: Integer; M, Name: PChar): integer; stdcall;
function DllService(CurFile: PChar; Size: ULONG): integer; stdcall;
function DllReplace(FileName: PChar): integer; stdcall;
procedure DllMessage(UnCompSize : ULONG;
CompSize : ULONG;
Factor : UINT;
Month : UINT;
Day : UINT;
Year : UINT;
Hour : UINT;
Minute : UINT;
C : Char;
FileName : PChar;
MethBuf : PChar;
CRC : ULONG;
Crypt : Char); stdcall;
procedure UnZipFile(zipFileName, subFileName, zipDir : string);
implementation
function DllPrnt(Buffer: PChar; Size: ULONG): integer;
begin
Result := Size;
end;
function DllPassword(P: PChar; N: Integer; M, Name: PChar): integer;
begin
Result := 1;
end;
function DllService(CurFile: PChar; Size: ULONG): integer;
begin
Result := 0;
end;
function DllReplace(FileName: PChar): integer;
begin
Result := 1;
end;
procedure DllMessage(UnCompSize : ULONG;
CompSize : ULONG;
Factor : UINT;
Month : UINT;
Day : UINT;
Year : UINT;
Hour : UINT;
Minute : UINT;
C : Char;
FileName : PChar;
MethBuf : PChar;
CRC : ULONG;
Crypt : Char);
begin
//
end;
procedure Set_UserFunctions(var Z : TUserFunctions);
begin
with Z do
begin
@Print := @DllPrnt;
@Sound := nil;
@Replace := @DllReplace;
@Password := @DllPassword;
@SendApplicationMessage := @DllMessage;
@ServCallBk := @DllService;
end;
end;
procedure Set_UnZipOptions(var O: TDCL; Filename, ZipDir : string);
begin
with O do
begin
ExtractOnlyNewer := 0;
SpaceToUnderscore := 0;
PromptToOverwrite := 0;
fQuiet := 0;
nCFlag := 0;
nTFlag := 0;
nVFlag := 0;
nUFlag := 0;
nZFlag := 0;
nDFlag := 1; //带路径解压
nOFlag := 1; //覆盖已存在文件
nAFlag := 0;
nZIFlag := 0;
C_flag := 0;
fPrivilege := 1;
lpszZipFN := PChar(FileName);
lpszExtractDir := PChar(ZipDir);
end;
end;
procedure UnZipFile(zipFileName, subFileName, zipDir : string);
var UF : TUserFunctions;
Opt : TDCL;
charFileName : array[1 .. 1] of PChar;
begin
charFileName[1] := PChar(subFileName);
Set_UserFunctions(UF);
Set_UnZipOptions(Opt, zipFileName, zipDir);
Wiz_SingleEntryUnzip(1, { number of file names being passed }
@charFileName, { file names to be unarchived }
0, { number of "file names to be excluded from processing" being passed }
nil, { file names to be excluded from the unarchiving process }
Opt, { pointer to a structure with the flags for setting the various options }
UF); { pointer to a structure that contains pointers to user functions }
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -