Вопрос Как сделать папку TMP системной?

Timick

Старожил
Собственно сабж. Пример подобного видел в инсталляторе Механиков. Заранее спасибо за любую помощь!)


 

Ramiro Cruzo

Новичок
@Timick, don't get what you are asking, though, that temp folder is created by Inno, first one is more of a compressed dump, then that dump is extracted into second folder, so basically, every Inno installation makes it...

Nextly, if you're asking about hidden attribute, then use this:
Код:
Source: Resources\7z.dll; DestDir: {tmp}; Flags: dontcopy;    Attribs: hidden;
Source: Resources\7z.exe; DestDir: {tmp}; Flags: dontcopy;    Attribs: hidden;
Source: Resources\arc.ini; DestDir: {tmp}; Flags: dontcopy;   Attribs: hidden;
And if you wanna make it programmatically, then in Delphi,

Код:
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
 
Сверху