Plugin Install Write to System Folders

I am writing an installer application for my plugin and I need to be able to copy the download plugin.dll to the system plugin folder.

C:\Program Files\Steinberg\VSTPlugins

However when the application attempts this it fails because it cannot write to a folder inside Windows program files.

I know it is possible to do this somehow because other plugin installers I have used in the past can write the plugin.dll to this folder.

If I call file.hasWriteAccess() it returns true.

But if I call: Result result = file.create();

result.wasOk() returns false.
result.getErrorMessage() returns “Access is denied.”

Is there a way to do this using the JUCE File class?

Is there a reason you are writing an installer yourself and not using something like InnoSetup?

You need admin privileges to write into the folder. You can either relaunch your app as admin or always make it run as admin with a manifest. Here are instructions for adding a manifest: https://docs.microsoft.com/en-us/previous-versions/bb756929(v=msdn.10)?redirectedfrom=MSDN I’m not sure anything in the juce build process supports manifests.

If you want to relaunch as admin, I have a class that handles it: https://github.com/FigBug/Gin/blob/master/modules/gin/utilities/gin_elevatedfilecopy.h

1 Like

Perfect. That worked.

I don’t think I will need the manifest. I will just place in the instructions that the user should launch the install application as administrator.

Thanks!