Новый участник
Сообщения: 41
Благодарности: 0
|
Профиль
|
Отправить PM
| Цитировать
Господа, есть тут кто-нибудь, кто разбирается в Unicode-версии Inno Setup?
Или возможно ли отключить жёсткую проверку синтаксиса?
Установил Inno Setup с поддержкой Unicode, чтобы корректно отображалось название языков.
При компиляции появляются ошибки, а в обычной версии компиляция скрипта проходит без каких-либо проблем.
Что делать с этой строкой "record..."?
Сам скрипт
Код: 
#include "botva2.iss"
#include "BASS_Module.iss"
#define GDFExe "{app}\Prog.exe"
#define GDFBinary "{app}\GDF.dll"
[Setup]
SourceDir=.
OutputDir=Setup
AppName=MyProg
AppVersion=1.0
AppPublisher=EmuGames
AppCopyright=EmuGames
AppPublisherURL=
AppSupportURL=
AppUpdatesURL=
DefaultDirName={pf64}\MyProg™
DefaultGroupName=\MyProg™
AllowNoIcons=yes
InfoBeforeFile=\System requirements.txt
InfoAfterFile=\Recommendation.txt
OutputBaseFilename=setup
WizardImageFile=\picture.bmp
WizardSmallImageFile=\small picture.bmp
SetupIconFile=\icon.ico
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=none
CompressionThreads=4
DiskSpanning=yes
DiskSliceSize=2100000000
SlicesPerDisk=1
RestartIfNeededByRun=no
ShowUndisplayableLanguages=yes
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
Name: english; MessagesFile: compiler:Languages\English.isl
Name: french; MessagesFile: compiler:Languages\French.isl
Name: german; MessagesFile: compiler:Languages\German.isl
Name: spanish; MessagesFile: compiler:Languages\Spanish.isl
Name: italian; MessagesFile: compiler:Languages\Italian.isl
[Messages]
SelectLanguageTitle=MyProg
SelectLanguageLabel=Please select a language. Выберите язык установки.
[LangOptions]
russian.LanguageName=Русский / Russian
english.LanguageName=Английский / English
french.LanguageName=Французский / French
german.LanguageName=Немецкий / German
spanish.LanguageName=Испанский / Spanish
italian.LanguageName=Итальянский / Italian
[Tasks]
Name: desktopicon; Description: Создать ярлык на рабочем столе; GroupDescription: Ярлыки:
Name: pin; Description: Закрепить ярлык на панели задач; GroupDescription: Ярлыки:; Flags: unchecked
Name: DirectX; Description: Обновить DirectX; GroupDescription: Дополнительное программное обеспечение:; Flags: checkablealone
Name: Redist; Description: Установить Microsoft Visual C++ 2010 Redist; GroupDescription: Дополнительное программное обеспечение:; Flags: checkablealone
Name: desktopicon; Description: Русский | Английский | Multi6; GroupDescription: Язык интерфейса:; Flags: exclusive
[Files]
Source: include/GDF.dll; DestDir: {app};
Source: include/GameuxInstallHelper.dll; DestDir: {localappdata}; Flags: overwritereadonly
Source: CallbackCtrl.dll; DestDir: {tmp}; Flags: dontcopy
Source: BASS.dll; DestDir: {tmp}; Flags: dontcopy
Source: innocallback.dll; Flags: dontcopy
Source: botva2.dll; DestDir: {tmp}; Flags: dontcopy
Source: Bass_Files\*; DestDir: {tmp}; Flags: dontcopy
Source: OST.mp3; DestDir: {tmp}; Flags: dontcopy
Source: "\MyProg™.png"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "\miniature.png"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "\miniature-2.png"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "\Pakovano\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension;
[Icons]
Name: "{userdesktop}\MyProg"; Filename: "{app}\MyProg.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\MyProg"; Filename: "{app}\MyProg.exe";
Name: "{group}\{cm:UninstallProgram,MyProg}"; Filename: "{uninstallexe}"
[Run]
Description: {cm:LaunchProgram, MyProg}; Filename: {app}\MyProg.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent
Filename: {src}\Soft\DirectX®\DXSETUP.exe; Parameters: /silent; Tasks: DirectX; StatusMsg: Обновление DirectX...
Filename: {src}\Soft\Vcredist\Vcredist_2010 (x64+x86).exe; Parameters: /q; Tasks: Redist; StatusMsg: Установка Microsoft Visual С++ 2010 Redistributable...
[UninstallDelete]
Type: filesandordirs; Name: "{app}";
Type: filesandordirs; Name: "{localappdata}\Spoon";
Type: filesandordirs; Name: "{localappdata}\VirtualStore";
[Сode]
type TGUID = record Data1: Cardinal; Data2, Data3: Word; Data4: array [0..8] of Char; end;
const PlayTask = 0;
SupportTask = 1;
var GameuxGUID: TGUID;
function GenerateGUID(var GUID: TGUID): Cardinal; external 'GenerateGUID@files:GameuxInstallHelper.dll stdcall setuponly';
function AddToGameExplorer(Binary: String; Path: String; InstallType: Integer; var GUID: TGUID): Cardinal; external 'AddToGameExplorerA@files:GameuxInstallHelper.dll stdcall setuponly';
function CreateTask(InstallType: Integer; var GUID: TGUID; TaskType: Integer; TaskNumber: Integer; TaskName: String; Binary: String; Parameters: String): Cardinal; external 'CreateTaskA@files:GameuxInstallHelper.dll stdcall setuponly';
function RetrieveGUIDForApplication(Binary: String; var GUID: TGUID): Cardinal; external 'RetrieveGUIDForApplicationA@{localappdata}\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveFromGameExplorer(var GUID: TGUID): Cardinal; external 'RemoveFromGameExplorer@{localappdata}\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveTasks(var GUID: TGUID): Cardinal; external 'RemoveTasks@{localappdata}\GameuxInstallHelper.dll stdcall uninstallonly';
function IntToHex(Int: Cardinal; Digits: Integer): String; var i, Digit: Integer; ch: Byte;
begin
result:='';
for i:=0 to Digits-1 do
begin
digit:=Int mod 16;
Int:=Int div 16;
if digit<0 then
digit:=digit+16;
ch:=Ord('0')+digit;
if digit>9 then
ch:=ch+7;
result:=chr(ch)+result;
end;
end;
function GetGUID(GGUID: TGUID): String; var i: Integer;
begin
result:='{'+IntToHex(GGUID.Data1, 8)+'-'+IntToHex(GGUID.Data2, 4)+'-'+IntToHex(GGUID.Data3, 4)+'-'+IntToHex(Ord(GGUID.Data4[0]), 2)+IntToHex(Ord(GGUID.Data4[1]), 2)+'-';
for i:=2 to 7 do result:=result+IntToHex(Ord(GGUID.Data4[i]), 2); result:=result+'}';
end;
procedure GDFInstall(Binary, MainExe: String);
begin
GenerateGUID(GameuxGUID);
AddToGameExplorer(ExpandConstant(Binary), ExpandConstant('{app}'), 3, GameuxGUID);
CreateTask(3, GameuxGUID, PlayTask, 0, 'Play', ExpandConstant(MainExe), '');
end;
procedure win7fix;
var regGDF: Cardinal;
var GUXPath: string;
begin
GUXPath := 'Software\Microsoft\Windows\CurrentVersion\GameUX\Games\' + GetGUID(GameuxGUID);
if isWin64 then
begin
if RegQueryDWordValue(HKLM64, GUXPath, 'IsSigned', regGDF) then
if regGDF=0 then
if RegDeleteValue(HKLM64, GUXPath, 'IsSigned') then
RegWriteDWordValue(HKLM64, GUXPath, 'IsSigned', 1);
end
else
begin
if RegQueryDWordValue(HKLM, GUXPath, 'IsSigned', regGDF) then
if regGDF=0 then
if RegDeleteValue(HKLM, GUXPath, 'IsSigned') then
RegWriteDWordValue(HKLM, GUXPath, 'IsSigned', 1);
end;
end;
type
TPBProc = function (h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
TimeLeftLabel : TLabel;
PBOldProc : Longint;
eTime, sTime : DWORD;
var
BASS_Initialized: Boolean;
const
AW_BLEND = $00080000;
AW_HIDE = $00010000;
const
LOAD_LIBRARY_AS_DATAFILE = $2;
#define A = (Defined UNICODE) ? "W" : "A"
function AnimateWindow(hWnd: HWND; dwTime: DWORD; dwFlags: DWORD): Boolean;
external 'AnimateWindow@user32 stdcall';
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;
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;
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
var
PercentsTimer: LongWord;
PercentsLabel: TLabel;
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
function CallBackProc(P:TPBProc;ParamCount:integer):LongWord; external 'wrapcallbackaddr@files:CallbackCtrl.dll stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external 'CallWindowProcA@user32.dll stdcall';
function GetTickCount: DWORD; external 'GetTickCount@kernel32.dll stdcall';
function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload';
function LongintToStringTime(t:Longint):string;
var
h,m,s:integer;
begin
h:=t div 3600;
t:=t-h*3600;
m:=t div 60;
s:=t-m*60;
Result:='';
if h>0 then Result:=Result+IntToStr(h)+' ч. ';
if (m>0) or (h>0) then Result:=Result+IntToStr(m)+' мин. ';
if (m>0) or (h>0) or (s>0) then Result:=Result+IntToStr(s)+' сек.';
end;
function PBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
lt:Longint;
dt,at,pr,i1,i2:Extended;
p:string;
tc:DWORD;
begin
Result:=CallWindowProc(PBOldProc,h,Msg,wParam,lParam);
if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then begin
i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
tc:=GetTickCount;
if (tc-eTime)>=1000 then begin //???????????? ????? ?????????? ?? ????? ????????? ?? ????, ??? ??? ? 1 ???????
dt:=(tc-sTime)/1000;
at:=i2*dt/i1;
lt:=Round(at-dt)
TimeLeftLabel.Caption:='Осталось - '+LongintToStringTime(lt);
eTime:=tc;
end;
pr:=i1*100/i2;
p:=' - ['+Format('%f',[pr])+'%]';
StringChange(p,',','.');
end;
end;
procedure AllCancel;
begin
SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBOldProc);
TimeLeftLabel.Free;
end;
function InitializeSetup:boolean;
begin
if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll');
Result:=True;
end;
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.1n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
Procedure PercentsProc(h, msg, idevent, dwTime: Longword);
Begin
with WizardForm.ProgressGauge do
begin
PercentsLabel.Caption:= 'Выполнено ' + NumToStr((Position*100)/Max) + ' %';
end;
End;
const
Indent=25;
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall delayload';
function ssInitialize(hParent:HWND;ssTimeShow:integer;FadeOut:boolean;StretchMode:integer;BkgColor:DWORD):boolean; external 'ssInitialize@files:isgsg.dll stdcall delayload';
procedure ssDeInitialize; external 'ssDeInitialize@files:isgsg.dll stdcall delayload';
procedure ssSetBkgImage(FileName:PChar); external 'ssSetBkgImage@files:isgsg.dll stdcall delayload';
procedure ssAddImage(FileName:PChar); external 'ssAddImage@files:isgsg.dll stdcall delayload';
procedure ssStartShow; external 'ssStartShow@files:isgsg.dll stdcall delayload';
procedure ssStopShow; external 'ssStopShow@files:isgsg.dll stdcall delayload';
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload';
procedure RunListClickCheck(Sender: TObject);
var
i:integer;
begin
if WizardForm.RunList.Checked[WizardForm.RunList.ItemIndex] then begin
for i:=0 to WizardForm.RunList.Items.Count-1 do
WizardForm.RunList.Checked[i]:=False;
WizardForm.RunList.Checked[WizardForm.RunList.ItemIndex]:=True;
end;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('Bass.dll');
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('volmax.png');
ExtractTemporaryFile('volmin.png');
ExtractTemporaryFile('volpb.png');
ExtractTemporaryFile('voldote.png');
ExtractTemporaryFile('OST.mp3');
ExtractTemporaryFile('MusicButton.png');
ExtractTemporaryFile('miniature.png');
ExtractTemporaryFile('miniature-2.png');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\miniature.png',4000,4000,2000,0,255,False,$FFFFFF,10);
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\miniature-2.png',4000,4000,2000,0,255,False,$FFFFFF,10);
ssInitialize(GetWindowLong(MainForm.Handle,-8),5,True,1,$FF000000);
WizardForm.RunList.OnClickCheck:=@RunListClickCheck;
BASS_Init('{tmp}\OST.mp3')
BASS_CreateMediaPlayer(WizardForm, '{tmp}\volmax.png', '{tmp}\volmin.png', '{tmp}\volpb.png', '{tmp}\voldote.png', 20, 325)
BASS_Initialized := True;
ExtractTemporaryFile('MyProg™.png');
ssSetBkgImage(ExpandConstant('{tmp}')+'\MyProg™.png');
WizardForm.TypesCombo.ItemIndex:=0;
PercentsLabel:= TLabel.Create(WizardForm);
with PercentsLabel do
begin
Left:= WizardForm.ProgressGauge.Left;
Top:= WizardForm.ProgressGauge.Top + WizardForm.ProgressGauge.Height + ScaleY(10);
Width:= WizardForm.StatusLabel.Width;
Height:= WizardForm.StatusLabel.Height;
AutoSize:= False;
Transparent := True;
Parent:= WizardForm.InstallingPage;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (CurStep = ssPostInstall) and Version.NTPlatform and (Version.Major > 5) then begin
GDFInstall('{#GDFBinary}', '{#GDFExe}');
win7fix;
end;
begin
case CurStep of
ssInstall: begin
TimeLeftLabel:=TLabel.Create(nil);
with TimeLeftLabel do begin
Parent:=WizardForm.InstallingPage;
AutoSize:=True;
SetBounds(WizardForm.ProgressGauge.Left + ScaleX(250),WizardForm.ProgressGauge.Top + ScaleY(30),ScaleY(80),ScaleY(21));
end;
sTime:=GetTickCount;
eTime:=sTime;
PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,CallBackProc(@PBProc,4));
end;
ssPostInstall: AllCancel;
end;
begin
if CurStep=ssInstall then begin
PercentsTimer:= SetTimer(0, 0, 100, WrapTimerProc(@PercentsProc, 4));
ExtractTemporaryFile('MyProg™.png');
ssAddImage(ExpandConstant('{tmp}')+'\MyProg™.png');
end;
if CurStep=ssPostInstall then ssStopShow;
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpFinished: end
if IsTaskSelected('Pin') then
PinToTaskbar(ExpandConstant('{app}\MyProg.exe'), True);
if CurPageID=wpInstalling then begin;
WizardForm.MainPanel.Visible:=False;
WizardForm.Bevel1.Visible:=False;
WizardForm.Width:=ScaleX(395);
WizardForm.Height:=ScaleY(142);
WizardForm.Left:=ScaleX(GetSystemMetrics(0)-WizardForm.Width-Indent);
WizardForm.Top:=ScaleY(GetSystemMetrics(1)-WizardForm.Height-Indent);
WizardForm.InnerNotebook.Left:=ScaleX(10);
WizardForm.InnerNotebook.Top:=ScaleY(10);
WizardForm.InnerNotebook.Width:=ScaleX(370);
WizardForm.StatusLabel.Left:=ScaleX(0);
WizardForm.StatusLabel.Top:=ScaleY(0);
WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left:=ScaleX(0);
WizardForm.FileNameLabel.Top:=ScaleY(20);
WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top:=ScaleY(40);
WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left:=ScaleX(154);
WizardForm.CancelButton.Top:=ScaleY(80);
end;
if (CurPageID=wpFinished) or (CurPageID=wpInfoAfter) then begin
WizardForm.RunList.Checked[0]:=True;
if WizardForm.Width<>502 then begin
WizardForm.Visible:=False;
WizardForm.Width:=ScaleX(502);
WizardForm.Height:=ScaleY(392);
WizardForm.Left:=(GetSystemMetrics(0)-WizardForm.Width) div 2;
WizardForm.Top:=(GetSystemMetrics(1)-WizardForm.Height) div 2;
WizardForm.MainPanel.Visible:=True;
WizardForm.Bevel1.Visible:=True;
WizardForm.InnerNotebook.Left:=ScaleX(40);
WizardForm.InnerNotebook.Top:=ScaleY(72);
WizardForm.InnerNotebook.Width:=ScaleX(417);
WizardForm.Visible:=True;
end;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID=wpFinished then
begin
if WizardForm.RunList.Checked[0] then
Result := True;
end;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_OKCANCEL) = IDOK then
begin
Confirm := False;
AnimateWindow(WizardForm.Handle, 2500, AW_BLEND or AW_HIDE);
Cancel := True;
end else
Cancel := False;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Binary: String;
GUID: TGUID;
begin
if CurUninstallStep=usUninstall then
begin
Binary:=ExpandConstant('{#GDFBinary}');
RetrieveGUIDForApplication(Binary, GUID);
RemoveFromGameExplorer(GUID);
RemoveTasks(GUID);
UnloadDll(ExpandConstant('{localappdata}\GameuxInstallHelper.dll'));
end;
begin
if (CurUninstallStep=usUninstall) then
begin
case CurUninstallStep of
usUninstall: begin
PinToTaskbar(ExpandConstant('{app}\MyProg.exe'), False);
end;
end;
end;
end;
end;
procedure DeinitializeSetup();
begin
if BASS_Initialized then
begin
KillTimer(0, PercentsTimer);
ssDeInitialize;
BASS_DeInit;
gdipShutdown
end;
end;
Буду очень благодарен за помощь.
|