The first step,"packdll.dll" must be Exist in PWI client
Code:
"packdll.dll" 8 Export Functions
PackInitialize //Initialize all of pcks
IsFileInPack // is file in pck?
GetFileFromPack //get file from pck
ReleasePackBuf //release memery
AddFileToPack // add file to pck
PackFinalize //Finalize pcks
GetPackVersion
SetPackVersion
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
function PackInitialize:Integer;cdecl;external 'packdll.dll';
function IsFileInPack(filename:PWideChar):Integer;cdecl;external 'packdll.dll';
function GetFileFromPack(filename:PWideChar;
var ssize:integer;
var ppoo:integer):Integer;
cdecl;external 'packdll.dll';
function ReleasePackBuf(ppoo:integer):Integer;cdecl;external 'packdll.dll';
function AddFileToPack(configs:PWideChar;filename:PWideChar):Integer;cdecl;external 'packdll.dll';
function PackFinalize:Integer;cdecl;external 'packdll.dll';
function GetPackVersion:Integer;cdecl;external 'packdll.dll';
function SetPackVersion(a:integer):Integer;cdecl;external 'packdll.dll';
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
conf,temp,ttemp:WideString;
a,aa,bb,i:Integer;
begin
PackInitialize;
conf:='configs\badwords.txt';
temp:= '../config/element/tempfile.dat';
for i:=0 to 100 do begin
ttemp:=conf;
ttemp:=ttemp+inttostr(i);
AddFileToPack(PWideChar(ttemp),PWideChar(temp));
//getfilefrompack(PWideChar(conf),aa,bb) ;
//ReleasePackBuf(bb);
end;
PackFinalize ;
ShowMessage('OK');
end;
procedure TForm1.Button2Click(Sender: TObject);
var
a:Integer;
aa,bb:integer;
conf:WideString;
begin
a:=PackInitialize;
conf:='configs\item_order.txt';
getfilefrompack(PWideChar(conf),aa,bb) ;
ShowMessage(IntToHex(bb,8));
end;
end.