1

first time using WiX.

I have a small program with only 2 files, Tool.exe and manual.pdf. I need to distribute this with a simple installer and have followed the WiX toolset tutorial and the Getting Started is pretty much all I need to start with.

I have successfully installed my product with shortcuts, I can uninstall from App/feature and file association works.

The problem: If I start the program from a associated file it starts fine but if I start the program with the installed Main.exe or its shortcuts I get a "Fatal error! Failed to execute script Main". But it works if I run it as an Administrator. This is not needed when I'm using the original Main.exe (the one i put in the installation package) before installing it with .msi and that's how i want it.

I have googled a lot but can't find a solution.

How can I fix this?

//Svalan

Svalan
  • 33
  • 4
  • I doubt that this has anything to do with the installer itself. Perhaps its success depends on the folder permissions to the "working directory". Trying running with ProcMon from Microsoft to see what's failing and what the difference is between launch methods. The application should take more control over its needs and methods of serving the user, IMO; The installer should not have to make up for such deficiecies, if that's the problem. – Tom Blodget Jun 20 '19 at 01:11
  • I think you're right, if I move the Main.exe from C:\Program Files (x86)\Folder I can start it without admin and I can run other .exe file from that location so I guess there must be something in the application that gets blocked. I have never used ProcMon but I'll give it a try. – Svalan Jun 20 '19 at 06:12
  • @TomBlodget, well I Found a few errors, see Comment in Steins answer. – Svalan Jun 20 '19 at 07:29

2 Answers2

1

Thanks for help, you pointed in the right direction.

The problem was that the Installer created folders with only admin rights. When main.exe tried to create logfile.log it got denied. By giving the mainfolder permission to all users on installation the program got permission to create its own files. Something like this: Wix: How to set permissions for folder and all sub folders

    <!--Create access for all users to mainfolder and all subfolders/files -->
    <DirectoryRef Id="INSTALLDIR">
        <Component Id="INSTALLDIR_perm" Guid="MY_GUID" Permanent="yes">
            <CreateFolder>
                <!--Everyone gets full permissions to the folder-->
                <util:PermissionEx User="Everyone" GenericAll="yes" />
            </CreateFolder>
        </Component>  
    </DirectoryRef> 
Svalan
  • 33
  • 4
  • Oh, added the comment below before I saw this. Yes, same thing I wrote in the comment. Just add permissions if you need to, ideally eliminate the requirement for this in the binary by changing the source - if you have it. The WinSock2 write permission is not acceptable security-wise. Hopefully that won't cause the application to crash. – Stein Åsmul Jun 20 '19 at 10:51
  • I would downvote this answer except for the fact the question is about how to make an installer for a badly designed program. But I will still suggest that the program at the least write logs to a subfolder and give users write permissions to that instead. (Hopefully, the logs won't contain information that is inappropriate for everyone to see. In that case, do it one step better and write per-user logs in a [per-user location](https://learn.microsoft.com/en-us/windows/desktop/shell/csidl).) – Tom Blodget Jun 20 '19 at 12:08
0

WiX Learning Curve - Learning Resources.


Do you do something in the executable that requires admin rights? Are you saying that you can run from the desktop but not from the installed folder? Is this some Python stuff?

You probably just have a lacking ACL permission or something.

Some application launch debugging ideas:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Actually I'm not sure, I'm not the one who created the Main program and haven't really learned it all yet. But I have talked to the creator and it should not need or use admin rights but still I have as you suspected that the program itself may cause this. And yes the program is made in Python. No I can't start from the install folder unless i grant it Admin access. – Svalan Jun 19 '19 at 14:29
  • I am heading out for a bit, I would search Python communities for this - must be a known issue. – Stein Åsmul Jun 19 '19 at 14:43
  • Well if I filter for Access Denied I get 2 errors. RegOpenKey: HKLM\System\CurrentControlSet\Services\WinSock2\Parameters CreateFile: C:\Program Files (x86)\Servicetool\logfile.log What to do about the regkey I have no idea and the application needs to create new files while running and its in a folder that requires admin rights to do so... I guess I don't know what to do about that either :) – Svalan Jun 20 '19 at 07:28
  • Very familiar permissions issue. The application should be updated to eliminate the problem. You can test on a virtual: set full rights for everyone on the installation folder first and launch as a standard user (just log in twice as admin and regular user obviously so you can jump from one to the other - don't launch with admin first! Just change permissions). The WinSock2 write access you have to eliminate. – Stein Åsmul Jun 20 '19 at 10:50