Admin user always prehend initial user - inno-setup

Using an InnoSetup script (that seems to work fine under XP/Vista), i've a strange behavior under Seven RC:
here is the [Files] section:
[Files]
Source: *.ico; DestDir: {app}\bin; Flags: ignoreversion
Source: dist\*.*; DestDir: {app}\bin; Flags: ignoreversion
Source: catalog\*.*; DestDir: {userappdata}\JetWorksheet\catalog; Flags: recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
Source: wizards\*.*; DestDir: {userappdata}\JetWorksheet\wizards; Flags: recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
Source: images\*.*; DestDir: {userdocs}\JetWorksheet\images; Flags: recursesubdirs createallsubdirs
Source: wordlists\*.*; DestDir: {userdocs}\JetWorksheet\wordlists; Flags: recursesubdirs createallsubdirs
The problem is:
In place of using the {userappdata} of the user that started the setup, all the data goes to the "Admin" directories...
I'm surely missing somethings...

You should either use PrivilegesRequired=lowest so your Setup doesnt elevate, or you should place the default user files in a common directory during installation, and then have your application copy them to the user area on startup.

Related

InnoSetup: failed to remove temporary directory?

I have a function 'VerifySerialNumber' in SerialNumber.dll which depends on msvcr120.dll and msvcp120.dll:
function VerifySerialNumber(serialNumber:String):integer;
external 'VerifySerialNumber#files:SerialNumber.dll,msvcr120.dll,msvcp120.dll cdecl loadwithalteredsearchpath';
In [Files] section:
Source: "{tmp}\msvcp120.dll"; DestDir: {app}\Plugin; Flags: ignoreversion
Source: "{tmp}\msvcr120.dll"; DestDir: {app}\Plugin; Flags: ignoreversion
Source: "{tmp}\SerialNumber.dll"; DestDir: {app}\Plugin; Flags: ignoreversion
The problem is that the install log show "Failed to remove temporary directory: C:\Users\ADMINI~1\AppData\Local\Temp\is-SKE12.tmp" when the install finised. And there are two files, the msvcr120.dll and msvcp120.dll file, remained in the is-SKE12.tmp folder.
Any advice?

Inno Setup Make dirs and files read only

I'm new user in Inno Setup. My problem is that I have some folders and one file. I want to make a setup package to install all of them. Here is my code
[Files]
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "C:\POS CAD Standard"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "D:\POS CAD Standard\acad.lsp"; DestDir: "{userappdata}\Autodesk\AutoCAD 2014\R19.1\enu\support"; Flags: ignoreversion
[Dirs]
Name: "C:\POS CAD Standard"; Attribs:readonly hidden system; Permissions: users-readexec;Flags:
[Icons]
Name: "{group}\{cm:UninstallProgram,POS CAD Standard}"; Filename: "{uninstallexe}"
It works fine, but when I'm trying to setup to another PC my source file is not found, and I want to make some files (not folder) to be read only.
Use Attribs: readonly parameter.
It is supported both in the [Files] and [Dirs] sections.
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; \
Flags: ignoreversion recursesubdirs createallsubdirs; Attribs: readonly
Note that I've used the {sd} constant instead of hardcoding the C: drive (what is a bad practice).

Copying hidden files in Inno Setup

How to use copy hidden external files in Inno Setup? Not to make a file hidden, but to work with hidden files. Because for now: the hidden files are being ignored
Any help? Thanks )
[Files]
Source: "{src}\folder\*"; DestDir: "{app}"; \
Flags: skipifsourcedoesntexist external ignoreversion recursesubdirs createallsubdirs;
When you select files in [Files] section entry using a wildcard, Inno Setup installer explicitly skips hidden files.
You cannot do anything about it.
See RecurseExternalCopyFiles function in Projects\Install.pas, particularly this part:
if SourceIsWildcard then begin
if FindData.dwFileAttributes and FILE_ATTRIBUTE_HIDDEN <> 0 then
Continue; { <-- Skip hidden files, comment by #MartinPrikryl }
FileName := FindData.cFileName;
end
else
FileName := SearchWildcard; { use the case specified in the script }
(This is for external files, as that's what you use. But for compile-time files, it's the same. See BuildFileList in Compile.pas).
All you can do, is to implement the installation in [Code] script yourself, instead of using the [Files] section.
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
Log('Installing files');
DirectoryCopy(ExpandConstant('{src}\folder'), ExpandConstant('{app}'));
end;
end;
For implementation of DirectoryCopy, see my answer to question Inno Setup: copy folder, subfolders and files recursively in Code section.
For compile-time files (without external flag), you can generate list of [Files] entries using a preprocessor function FindFirst.
the answer is You CAN
make windows display hidden files just for you to be able to see them
with your files hidden as you want them inside the folder.
when adding source folder and files step just add the folder (this wildcard *) normally, Inno setup won't add the hidden files. so add them separately.
after you finsih all steps don't run the script and edit the code..
go to [Files] section:
[Files]
Source: "H:\tmp\sweetInstaller\installer.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\tmp\sweetInstaller\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "H:\tmp\sweetInstaller\hidden_file1.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\tmp\sweetInstaller\hidden_file2.bat"; DestDir: "{app}"; Flags: ignoreversion
AND insert Attribs: hidden; next to files you wish to hide just before Flags:
[Files]
Source: "H:\tmp\sweetInstaller\installer.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\tmp\sweetInstaller\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "H:\tmp\sweetInstaller\hidden_file1.txt"; DestDir: "{app}"; Attribs: hidden; Flags: ignoreversion
Source: "H:\tmp\sweetInstaller\hidden_file2.bat"; DestDir: "{app}"; Attribs: hidden; Flags: ignoreversion
then you can run the script from the little green play button at the top bar to compile. and you're done ;)

Two choices for separate added folders

I am trying to extract content via Inno Setup, however I would like the user to pick between two options, each a different "folder" to extract somewhere. How do I go about doing this? I'm not even sure where to start on InnoSetup help.
[Files]
Source: "C:\Users\jorda_000\x64"; DestDir: "{appdata}\Roaming\.mhks"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\jorda_000\x32"; DestDir: "{appdata}\Roaming\.mhks"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
This is what I have in the script for files after adding them. Basically, they pick either 64-Bit or 32-Bit and it updates files in the program folder folder.
Nevermind. I didn't fully understand the "Components" section of Inno Setup.
Added.
[Components]
Name: "main"; Description: "64-bit"; Types: full compact custom;
Name: "alt"; Description: "32-bit"; Types: full compact custom;
This will create 2 option in Components page.If User choose one then other one can not be installed.
Here is the sample script:
[Files]
Source: "C:\Users\jorda_000\x64"; DestDir: "{appdata}\Roaming\.mhks"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: sixfour
Source: "C:\Users\jorda_000\x32"; DestDir: "{appdata}\Roaming\.mhks"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: threetwo
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Components]
Name: "threetwo"; Description: "Main(32 bit)"; Types: custom; Flags: exclusive
Name: "sixfour"; Description: "Main(64 bit)"; Types: custom; Flags: exclusive
[Types]
Name: "custom"; Description: "Custom"; Flags: iscustom

Exclude files working not as expected?

I want to exclude 2 folders by default, unless a component is checked. I don't have all the files individually listed in the [Files] section, as some of them might be added/removed in the future, but there are 2 folders that I need to control.
Here's the code I have:
Source: "source\*"; DestDir: {app}; Excludes: "\plugins\api,\plugins\shared memory"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "source\plugins\api\*"; DestDir: {app}; Flags: recursesubdirs createallsubdirs;
Source: "source\plugins\shared memory\*"; DestDir: {app}; Components: plugins_api; Flags: recursesubdirs createallsubdirs;
What I want:
Those subfolders (api and shared memory) should only be copied if
plugins_api is selected.
If the component plugins_api is not
checked, they should not be copied.
I'd rather avoid including
every file in the .iss file. It is not an option.
What I get with this code:
If the component is not checked, the folders are not copied. Ok.
If the component was checked, the folders are not copied. Not ok.
So it seems the exclude in the first line affects the other 2 lines. How can I avoid this?
2 points:
1) You only have the Components entry on one of the special folders.
2) The special folders, as you have them will be installing their contents direct into the {app} folder.
If you follow the folders in use:
Source: "source\plugins\api\*"; DestDir: {app};
Put contents of source\plugins\api\ in {app}
I expect you want something like:
Source: "source\plugins\api\*"; DestDir: {app}\plugins\api\; Components: plugins_api; Flags: recursesubdirs createallsubdirs;
Source: "source\plugins\shared memory\*"; DestDir: {app}\plugins\shared memory\; Components: plugins_api; Flags: recursesubdirs createallsubdirs;

Resources