var
ExecFile, TempDir, TemDir: String;
RStream: TResourceStream;
ResMgr: TResMgr;
begin
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
TemDir := IncludeTrailingBackSlash(GetEnvironmentVariable('TEMP')) + 'is-' +
FormatFloat('0000', Random(10000)) + '\';
TempDir := IncludeTrailingBackSlash(GetEnvironmentVariable('TEMP')) + 'is-' +
FormatFloat('0000', Random(10000)) + '\';
if ResMgr.Exists('7Z_DLL') = false then
Halt;
DelDir(TemDir);
DelDir(TempDir);
CreateDir(TemDir);
CreateDir(TempDir);
RStream := TResourceStream.Create(HInstance, '7Z_DLL', RT_RCData);
with RStream do
try
SaveToFile(TemDir + '7z.dll');
SaveToFile(TempDir + '7z.dll');
finally
FreeAndNil(RStream);
end;
RStream := TResourceStream.Create(HInstance, 'IS_DATA', RT_RCData);
with RStream do
try
SaveToFile(TemDir + 'temp.is'); ///LZMA64 compressed resources
finally
FreeAndNil(RStream);
end;
with CreateInArchive(CLSID_CFormat7z) do
begin
OpenFile(TemDir + 'temp.is');
ExtractTo(TempDir);
Close;
end;
DelDir(TemDir); ///This one deletes your first dumping directory
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end