Ветеран
Сообщения: 862
Благодарности: 102
|
Профиль
|
Отправить PM
| Цитировать
nik1967, я просто для проверки работает ли эта команда убрал проверку и сработало. а файл с настройками лежит в папке \Output радом с инсталлятором
Скрытый текст
Код: 
; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!
#define MyAppName "USB Safely Remove"
#define MyAppVersion "5.3.8.1233"
#define Exe "USBSafelyRemove.exe"
#include "WinTB.iss"
#include "botva2.iss"
[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} RePack by Pilot
SetupIconFile=ico.ico
Compression=lzma2/Ultra64
InternalCompressLevel=Ultra64
SolidCompression=true
ShowLanguageDialog=yes
UninstallDisplayIcon={uninstallexe}
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
DisableReadyPage=true
AppID={#MyAppName}
VersionInfoDescription={#MyAppName} RePack by Pilot
AppCopyright=Pilot © 2015
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Pilot © 2015
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
DisableProgramGroupPage=yes
InfoBeforeFile=Info.rtf
DisableWelcomePage=true
RestartIfNeededByRun=false
[Languages]
Name: "R"; MessagesFile: "Russian.isl"
Name: "E"; MessagesFile: "English.isl"
Name: "U"; MessagesFile: "Ukrainian.isl"
[Types]
Name: full; Description: Полная установка; Flags: iscustom
[Tasks]
Name: ic; Description: {cm:AdditionalIcons}; Components: USBSR\I;
Name: ic\desktop; Description: {cm:CreateDesktopIcon}; Components: USBSR\I;
Name: ic\group; Description: {cm:CreateStartMenuIcon}; Components: USBSR\I;
Name: ic\quicklaunch; Description: {cm:CreateQuickLaunchIcon}; OnlyBelowVersion: 0,6.1; Components: USBSR\I; Flags: unchecked
Name: ic\taskbar; Description: {cm:PinTaskbarIcon}; MinVersion: 0.0,6.1.7600; Components: USBSR\I; Flags: unchecked
Name: ic\startmenu; Description: {cm:PinStartMenuIcon}; MinVersion: 0.0,6.1.7600; Components: USBSR\I; Flags: unchecked
[Components]
Name: USBSR; Description: {#MyAppName}; Flags: fixed disablenouninstallwarning; Types: full;
Name: USBSR\I; Description: Установить {#MyAppName}; Flags: exclusive disablenouninstallwarning
[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: bat.exe; Flags: dontcopy;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов
Source: {app}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: x64\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64;
Source: x86\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not IsWin64;
[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#Exe}; Components: USBSR\I; Tasks: ic\group;
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; Components: USBSR\I; Tasks: ic\group;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#Exe}; Components: USBSR\I; Tasks: ic\desktop;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#Exe}; Components: USBSR\I; Tasks: ic\quicklaunch;
[Run]
Filename: {app}\USBSRService.exe; Parameters: "/install /silent"; Flags: RunHidden;
Filename: {app}\USBSafelyRemove.exe; Parameters: "/loadsettings ""{src}\USBSafelyRemoveSettings.opt"""; Check: FileExists('{src}\USBSafelyRemoveSettings.opt');
Filename: "http://repackbypilot.blogspot.com"; Description: Посетить сайт автора.; Flags: shellexec nowait postinstall skipifsilent unchecked
[Registry]
Root: HKCU; Subkey: Software\Microsoft\Windows\CurrentVersion\Run; ValueName: USB Safely Remove; ValueData: {app}\{#Exe} /startup; MinVersion: 0.0,5.0; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\{#Exe}; ValueType: String; ValueData: DisableNXShowUI; MinVersion: 0.0,5.0; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\NoExecuteState; ValueName: LastNoExecuteRadioButtonState; ValueType: Dword; ValueData: "$36BD"; MinVersion: 0.0,5.0; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\{#Exe}; ValueType: String; ValueData: DisableNXShowUI; MinVersion: 0.0,5.0; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; SubKey: Software\SafelyRemove\Options; ValueType: string; ValueName: LangFileName; ValueData: Russian; Languages: R; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; SubKey: Software\SafelyRemove\Options; ValueType: string; ValueName: LangFileName; ValueData: English; Languages: E; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; SubKey: Software\SafelyRemove\Options; ValueType: string; ValueName: LangFileName; ValueData: Ukrainian; Languages: U; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Software\SafelyRemove\Main; ValueName: FirstRunDT; MinVersion: 0.0,5.0; Flags: deletevalue
Root: HKCU; Subkey: Software\SafelyRemove\Main; ValueName: RunCount; MinVersion: 0.0,5.0; Flags: deletevalue
Root: HKCU; Subkey: Software\SafelyRemove\Stat; ValueName: StatString; MinVersion: 0.0,5.0; Flags: deletevalue
Root: HKCU; Subkey: Software\SafelyRemove\Main; ValueName: TotalRunSeconds; MinVersion: 0.0,5.0; Flags: deletevalue
Root: HKCU; Subkey: Software\SafelyRemove\Main; ValueName: FirstRunDTRaw; MinVersion: 0.0,5.0; Flags: deletevalue
[UninstallRun]
Filename: sc.exe; Parameters: "stop USBSafelyRemoveService"; Flags: RunHidden;
Filename: taskkill; Parameters: "/f /im USBSafelyRemove.exe"; Flags: RunHidden;
Filename: taskkill; Parameters: "/f /im USBSRService.exe"; Flags: RunHidden;
Filename: {app}\USBSRService.exe; Parameters: "/uninstall /silent"; Flags: RunHidden;
[Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
#define A = (Defined UNICODE) ? "W" : "A"
const
///////////////////////////////////Относится к лого и изображениям мастера
RT_RCDATA = 10;
LOAD_LIBRARY_AS_DATAFILE = $2;
var
///////////////////////////////////Лого и изображения
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
///////////////////////////////////////////
iInitialize: Boolean;
///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
finally
lResStream.Free;
Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
end;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm:=False;
end;
function InitializeSetup(): Boolean;
var ResultCode:integer;
begin
ExtractTemporaryFile('bat.exe')
if FileExists (ExpandConstant('{tmp}\bat.exe')) then
Exec(ExpandConstant('{tmp}\bat.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
result:=true;
end;
procedure InitializeWizard;
begin
with WizardForm do
begin
///////////////////////////////////Логотип и изображения мастера
iInitialize := True;
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') then
begin
///////////////////////////////////Изображения
bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
WizardBitmapImage2.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(FinishedPage.Handle);
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);
DiskSpaceLabel.Hide;
ComponentsDiskSpaceLabel.Hide;
////////////////////////////////////////////
///////////////////////////////////Логотип
lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35), True, True);
ImgApplyChanges(WizardForm.Handle);
end;
///////////////////////////////////WinTB
ExtractTemporaryFile('WinTB.dll');
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);
//////////////////////////////////////
with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35));
end;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID =wpSelectComponents)then
Result:= True;
end;
function LoadLibraryEx(lpFileName: String; hFile: THandle; dwFlags: DWORD): THandle; external 'LoadLibraryEx{#A}@kernel32.dll stdcall';
function LoadString(hInstance: THandle; uID: SmallInt; var lpBuffer: Char; nBufferMax: Integer): Integer; external 'LoadString{#A}@user32.dll stdcall';
function SHGetNewLinkInfo(pszLinkTo, pszDir: String; var pszName: Char; var pfMustCopy: Longint; uFlags: UINT): BOOL; external 'SHGetNewLinkInfo{#A}@shell32.dll stdcall';
function PinToTaskbar(const szFilename: String; IsPin: Boolean): Boolean;
// szFilename : full path to executable file
// IsPin......: False - unpin from TaskBar, True - pin to TaskBar
var
hInst: THandle;
buf: array [0..255] of Char;
i, res: Integer;
strLnk, strVerb: String;
objShell, colVerbs: Variant;
begin
Result := False;
if (GetWindowsVersion < $06010000) or not FileExists(szFilename) then Exit; { below Windows 7 }
{ String resources }
if IsPin then
begin
if SHGetNewLinkInfo(szFilename, ExpandConstant('{tmp}'), buf[0], res, 0) then
begin
while buf[Length(strLnk)] <> #0 do Insert(buf[Length(strLnk)], strLnk, Length(strLnk)+1);
if FileExists(ExpandConstant('{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\') + ExtractFileName(strLnk)) then Exit;
end;
res := 5386; { Pin to Tas&kbar }
end else res := 5387; { Unpin from Tas&kbar }
{ Load string resource }
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
if hInst <> 0 then
try
for i := 0 to LoadString(hInst, res, buf[0], 255)-1 do Insert(buf[i], strVerb, i+1);
try
objShell := CreateOleObject('Shell.Application');
colVerbs := objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).Verbs;
for i := 1 to colVerbs.Count do if CompareText(colVerbs.Item[i].Name, strVerb) = 0 then
begin
colVerbs.Item[i].DoIt;
Result := True;
Break;
end;
except
Exit;
end;
finally
FreeDLL(hInst);
end;
end;
/////////////////////////////////////////////////////////////////////////
function PinToStartMenu(const szFilename: String; IsPin: Boolean): Boolean;
// szFilename : full path to exe- or lnk-file
// IsPin......: False - unpin from StartMenu, True - pin to StartMenu
var
hInst: THandle;
buf: array [0..259] of Char;
i, res: Integer;
strLnk, strVerb: String;
objShell, colVerbs: Variant;
begin
Result := False;
if not FileExists(szFilename) then Exit;
if GetWindowsVersion > $06020000 then Exit; { Window 8 and above }
{ Windows 7 }
if (GetWindowsVersion >= $06010000) and boolean(SHGetNewLinkInfo(szFilename, ExpandConstant('{tmp}'), buf[0], res, 0)) then
begin
while buf[Length(strLnk)] <> #0 do Insert(buf[Length(strLnk)], strLnk, Length(strLnk)+1);
if FileExists(ExpandConstant('{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\') + ExtractFileName(strLnk)) then Exit;
end;
{ String resources }
if IsPin then
res := 5381 { Pin to Start Men&u }
else
res := 5382; { Unpin from Start Men&u }
{ Load string resource }
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
if hInst <> 0 then
try
for i := 0 to LoadString(hInst, res, buf[0], 255)-1 do Insert(buf[i], strVerb, i+1);
try
objShell := CreateOleObject('Shell.Application');
{ below Windows 7 }
if GetWindowsVersion < $06010000 then
begin
objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).InvokeVerb(strVerb);
Result := True;
end;
{ Windows 7 }
if GetWindowsVersion >= $06010000 then
begin
colVerbs := objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).Verbs;
for i := 1 to colVerbs.Count do if CompareText(colVerbs.Item[i].Name, strVerb) = 0 then
begin
colVerbs.Item[i].DoIt;
Result := True;
Break;
end;
end;
except
Exit;
end;
finally
FreeDLL(hInst);
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpFinished:
begin
if IsTaskSelected('ic\taskbar') then
PinToTaskbar(ExpandConstant('{app}\{#Exe}'), True);
if IsTaskSelected('ic\startmenu') then
PinToStartMenu(ExpandConstant('{app}\{#Exe}'), True);
end;
wpSelectTasks:
if IsComponentSelected('USBSR\I') then
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
end;
end;
procedure DeinitializeSetup();
begin
if iInitialize then
begin
gdipShutdown;
TaskBarDestroy;
end;
end;
procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
///////////////////////////////////Логотип и изображения мастера
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
begin
///////////////////////////////////Изображения
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);
///////////////////////////////////Логотип
lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;
with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35));
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
instPath: string;
begin
case CurUninstallStep of
usUninstall:
begin
PinToTaskbar(ExpandConstant('{app}\{#Exe}'), False);
PinToStartMenu(ExpandConstant('{app}\{#Exe}'), False);
end;
end;
end;
procedure DeinitializeUninstall();
begin
if iInitialize then gdipShutdown;
end;
[UninstallDelete]
Name: {app}; Type: filesandordirs;
[Messages]
BeveledLabel=RePack by Pilot
|