I have an application that is on a network Drive. I have a DLL that needs to be unregistered, updated and reregistered. I understand that the DLL will be in use so have the RestartReplace option:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; EMPSecure Update
#define MyAppName "EMPSecure"
#define MyAppVersion "2.0.1"
#define MyAppPublisher "Empyrean Security Pty Ltd"
#define MyAppURL "http://www.empyreansecurity.com"
#define MyAppExeName "EMPSecure.exe"
#define MyAppCopyright "Copyright © Empyrean Security 2012-2022"
#define MySourcePath "\\mac\Dropbox\Embarcadero\EMPSecure Update"
[Setup]
PrivilegesRequired=admin
AllowNetworkDrive=yes
AllowUNCPath=yes
AppId={{#MyAppID}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
The actual line is:
Source: "{#MySourcePath}\SFMS_ShellExt.dll"; DestDir: "{app}"; Flags: regserver restartreplace replacesameversion 64bit; Check: Is64BitInstallMode;
If I have a UNC path for the app like \\mac\Dropbox\path....
I get this error:
I have tried using a mapped network drive, but that fails in other places, but regardless, I really need to be able to use a UNC path (most users will not install using a UNC path, but some, like me, will so need to cater for that option).
I did try this: Deleting and unregistering DLL files during install using Inno Setup but the actual deletefile kept failing with Access Denied errors.
If the complete script would be useful then let me know, I just didn't want to confuse the issue with a deal of not relevant script lines.
Is there some 'trick' other than the AllowUNCPath in [Setup] that will get the restartreplace flag code to recognise the UNC path in {app}?
Thank you.
UPDATE
As advised by Martin, I have simply downloaded the file to {tmp} and converted my original batch file to pascal code. The operation unregisters the DLL in the {app} folder, copies the new DL:L from {tmp} to {app} and re-registers the DLL (because of what we do we need to kill and restart explorer, but that's not germane to the issue).
Because this is development stuff, the app folder is in my Dropbox on an iMac and the path is \mac\dropbox\etc etc. The original unregister precisely finds that path, but I get an error that says the folder not found. Here's the code which fails in the unregister statement because it cannot find the path:
[Code]
procedure RegisterShellExt();
var
ResultCode: integer;
begin
// Deregister and delete sfms_shellext.dll
if Exec(ExpandConstant('Regsvr32 /u "{app}\SFMS_ShellExt.dll"'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode) then
begin
// Successfully unregistered, copy the new dll
Log('SFMS_ShellExt.dll successfully unregistered');
sleep(5000)
Exec('taskkill /f /fi "IMAGENAME eq explorer.exe"', '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
// Overwrite if Exists
if FileCopy(ExpandConstant('"{tmp}\SFMS_ShellExt.dll"'), ExpandConstant('"{app}\SFMS_ShellExt.dll"'), False) then
begin
// Successfully copied, now register the dll
Log(ExpandConstant('SFMS_ShellExt.dll successfully copied from: {tmp} to {app}'));
if Exec(ExpandConstant('regsvr32 "{app}\SFMS_ShellExt.dll"'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode) then
begin
// Successfully copied, now register the dll
Log('SFMS_ShellExt.dll successfully re-registered');
end
else
begin
// handle deregister failure
MsgBox('Failed to re-register SFMS_ShellExt.dll, Error: ' + SysErrorMessage(ResultCode), mbError, MB_OK);
end
end
else
begin
MsgBox(ExpandConstant('Failed to copy SFMS_ShellExt.dll from {tmp} to {app}'), mbError, MB_OK);
end;
end
else
begin
// handle deregister failure
MsgBox('Failed to deregister sfms_shellext.dll, registration not attempted, Error: ' + SysErrorMessage(ResultCode) + ' File: ' + ExpandConstant('"{app}\SFMS_ShellExt.dll"'), mbError, MB_OK);
end;
// Restart explorer and continue
Exec('explorer.exe"', '', '', SW_SHOW,ewNoWait, ResultCode);
end;
So question, I have tried this with a UNC path (thought that might be the erro), but tried it also with a straight c:.... path and even though the file exists, I get a file not found error. Any ideas what I might be doing wrong??


