Inno Setup: Run regsvr32 with a specific working directory

https://stackoverflow.com/questions/36332189/inno-setup-run-regsvr32-with-a-specific-working-directory

You cannot. The regsvr32.exe that Inno Setup runs internally to (un)register DLLs is explicitly run from a system directory (typically the C:\Windows\System32).


Your workaround is the best way.

Just add an equivalent [UninstallRun] entry to unregister the DLL:

[UninstallRun]
Filename: "{sys}\regsvr32.exe"; Parameters: "/u /s Awkward.dll"; WorkingDir: "{app}"; \
    Flags: runhidden;

Or even better, fix the DLL not to rely on a working directory. You can use the LOAD_WITH_ALTERED_SEARCH_PATH flag for the LoadLibraryEx.

See also Dynamic-Link Library Search Order.

answered Mar 31 '16 at 11:42

Martin Prikryl

posted on 2021-01-25 15:41  liujx2019  阅读(208)  评论(0编辑  收藏  举报

导航