0

innoセットアップを使用しているすべてのユーザーのユーザー/マイドキュメントにセットアップを追加したかったのですが、うまくいきません。

ここで、iis ファイルを提供します。前もって感謝します。私を助けてください。

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Testing"
#define MyAppVersion "1.0"
#define MyAppPublisher "Test"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "testing.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{200DC169-9647-4295-91B4-B1D1D8482B82}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;DefaultDirName={userdocs}\test
DefaultDirName={code:DefDirRoot}\test
DisableDirPage=yes
DefaultGroupName=test
DisableProgramGroupPage=yes
AllowNoIcons=yes
LicenseFile=C:\Users\abc\Desktop\final product\licence.txt
OutputDir=C:\Users\abc\Documents\test
OutputBaseFilename=VL-PI Setup
SetupIconFile=C:\Users\abc\Downloads\clientcommentsveryimp\CORRECTIONS_TO_INSTALLER_BUGS\CORRECTIONS_TO_INSTALLER_BUGS\Icon\icon.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Dirs]
Name: "{app}\Graphics"
Name: "{app}\lib"

[Files]
Source: "C:\test work\agriculture project requirments\jre-6u2-windows-i586-p.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall;
Source: "D:\final product\30-01-2013\test.exe"; DestDir: "{app}"; Flags: ignoreversion;
Source: "C:\Users\test\Desktop\final product\Graphics\*"; DestDir: "{app}\Graphics"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\test\Desktop\final product\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\VL-PI"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:uninstallProgram,VL-PI}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}";check:InitializeSetup; Flags: nowait postinstall skipifsilent

[Code]
function Install_JavaFrameWork() : Boolean;
var
  hWnd: Integer;
  ResultCode: Integer;
  dotnetRedistPath: string;
  outVar : string;
begin

  dotnetRedistPath:= ExpandConstant('{tmp}\jre-6u2-windows-i586-p.exe');

try
  if Exec(dotnetRedistPath,'', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
  begin
     // ResultCode contains the exit code
     case ResultCode of
     // 1641 The requested operation completed successfully. The system will be restarted so the changes can take effect.
     // 3010 The requested operation is successful. Changes will not be effective until the system is rebooted. 
1641:
     begin
        Result := true;
     end
     3010, 0:
     begin
        Result := false;
     end else // -> case default
     begin
        Result := true;
     end
  end;

  end else
  begin
     //handle failure if necessary; ResultCode contains the error code
     Result := false;
  end;
  except
  ShowExceptionMessage;
  end;
end;


function InitializeSetup(): Boolean;
var
 ErrorCode: Integer;
 JavaInstalled : Boolean;
 Result1 : Boolean;
 Versions: TArrayOfString;
 I: Integer;
begin
 if RegGetSubkeyNames(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', Versions) then
 begin
  for I := 0 to GetArrayLength(Versions)-1 do
   if JavaInstalled = true then
   begin
    //do nothing
   end else
   begin
if ( Versions[I][2]='.' ) and ( ( StrToInt(Versions[I][1]) > 1 ) or ( ( StrToInt(Versions[I][1]) = 1 ) and (
 StrToInt(Versions[I][3]) >= 6 ) ) ) then
    begin
     JavaInstalled := true;
    end else
    begin
     JavaInstalled := false;
    end;
   end;
 end else
 begin
  JavaInstalled := false;
 end;

 //JavaInstalled := RegKeyExists(HKLM,'SOFTWARE\JavaSoft\Java Runtime Environment\1.9');
 if JavaInstalled then begin
  Result := true;
 end 
 else begin
    if FileExists(ExpandConstant('{tmp}\jre-6u2-windows-i586-p.exe')) then
    begin 
    Log('File exists');

Result1 := MsgBox('This program requires Java Runtime Environment version 1.6 or newer.Do you want to install it  now?',
   mbConfirmation, MB_YESNO) = idYes;
      if Result1 = false then begin
         Result:=true;
       end 
       else begin
          Install_JavaFrameWork;
           Result:=true;
       end;
  end else 
   begin 
    Result:=true;
    end;
end;
end;
4

1 に答える 1

2

管理者のセットアップでは、ユーザーのプロファイルへの書き込みを試みてはいけません。ユーザーが期待どおりのユーザーであることが保証されていないか、そのマシンからアクセスできるかどうかさえ保証されていないためです。

現在使用してPrivilegesRequired=noneいるため、ユーザーは切り替わりませんが、一部のユーザーの Java をインストールできなくなります。PrivilegesRequired=admin通常のインストールまたはPrivilegesRequired=lowestユーザー固有のインストールに使用する必要があります。

于 2013-01-31T10:18:30.310 に答える