⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zippass.pas

📁 编写
💻 PAS
字号:
unit zippass;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  UnZip32, StdCtrls, Spin, ComCtrls, Buttons, ExtCtrls, Grids;

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;
  zFileName : array[1..1] of PChar;
begin
  zFileName[1]:=PChar(subFileName);

  Set_UserFunctions(UF);
  Set_UnZipOptions(Opt, zipFileName, zipDir);

  Wiz_SingleEntryUnzip(1,    { number of file names being passed }
					   @zFileName,  { 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 + -