在InnoSetup中注册DLL/OCX

在InnoSetup中注册DLL/OCX,dll,installation,inno-setup,regsvr32,dllregistration,Dll,Installation,Inno Setup,Regsvr32,Dllregistration,我有一个DLL和OCX包,然后我决定做一个安装程序 这就是我所拥有的: ArchitecturesInstallIn64BitMode=x64 [Files] Source: {syswow64}\*; DestDir: {syswow64}; Flags: onlyifdoesntexist Source: {sys}\*; DestDir: {sys}; Flags: onlyifdoesntexist [Run] Filename: regsvr32.exe; Parameters

我有一个DLL和OCX包,然后我决定做一个安装程序

这就是我所拥有的:

ArchitecturesInstallIn64BitMode=x64

[Files]
Source: {syswow64}\*; DestDir: {syswow64}; Flags: onlyifdoesntexist
Source: {sys}\*; DestDir: {sys}; Flags: onlyifdoesntexist


[Run]

Filename: regsvr32.exe; Parameters: """{sys}\zlib1.dll"" /S"; StatusMsg: Registrando: zlib1.dll; Flags: RunHidden WaitUntilTerminated

Filename: regsvr32.exe; Parameters: """{syswow64}\actskin4.ocx"" /S"; StatusMsg: Registrando: actskin4.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Bassmod.dll"" /S"; StatusMsg: Registrando: Bassmod.dll; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\ChamaleonButton.ocx"" /S"; StatusMsg: Registrando: ChamaleonButton.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.Calendar.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.Calendar.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.Codejock.TaskPanel.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.Codejock.TaskPanel.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.CommandBars.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.CommandBars.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.Controls.Unicode.v13.2.1.ocx"" /S"; StatusMsg: Registrando: Codejock.Controls.Unicode.v13.2.1.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.Controls.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.Controls.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.DockingPane.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.DockingPane.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.Markup.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.Markup.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.PropertyGrid.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.PropertyGrid.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.ReportControl.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.ReportControl.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.ShortcutBar.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.ShortcutBar.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.SkinFramework.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.SkinFramework.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Codejock.SyntaxEdit.v13.4.0.Demo.ocx"" /S"; StatusMsg: Registrando: Codejock.SyntaxEdit.v13.4.0.Demo.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\HookMenu.ocx"" /S"; StatusMsg: Registrando: HookMenu.ocx; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\MSCOMCTL.OCX"" /S"; StatusMsg: Registrando: MSCOMCTL.OCX; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\MSCOMCTL32.OCX"" /S"; StatusMsg: Registrando: MSCOMCTL32.OCX; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\Msvbvm50.dll"" /S"; StatusMsg: Registrando: Msvbvm50.dll; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\msvcr71.dll"" /S"; StatusMsg: Registrando: msvcr71.dll; Flags: RunHidden WaitUntilTerminated
Filename: regsvr32.exe; Parameters: """{syswow64}\zlib1.dll"" /S"; StatusMsg: Registrando: zlib1.dll; Flags: RunHidden WaitUntilTerminated
我见过regserver Parameter,但我不确定它是如何工作的(我已经阅读了Parameter文档),我需要知道我是否可以通过只做这件事而不需要所有的[RUN]部分来简化事情:

[Files]
Source: {syswow64}\*; DestDir: {syswow64}; Flags: onlyifdoesntexist regserver
Source: {sys}\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver
如果我这样做了,那么我仍然需要指定“ArchitecturesInInstallin64位模式”?是否要正确注册第一个x64 dll

更新:

也许这是一个更好的[运行]部分:

[Files]
Source: {syswow64}\*; DestDir: {syswow64}; Flags: onlyifdoesntexist regserver 32bit
Source: {sys}\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 64bit

更正确的方法是:

[Files]
Source: C:\yourdlls\x86\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit
Source: C:\yourdlls\x64\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 64bit; Check: IsWin64
注意,我已经更改了源目录。这是因为从自己的Windows文件夹中获取文件是一个非常糟糕的想法,而使用通配符则更糟糕。如果你试图这样做,你所要求的东西将彻底破坏别人的Windows安装


(还请注意,您不应安装到
{syswow64}
,尤其是在使用regserver时。上面的几行代码具有与安装到两个单独文件夹相同的效果,但它们实际上会正确注册内容,这与您之前的情况不同。)

正如本手册底部的备注所述-regserver有良好的合格版本检查,因此我不认为使用OnlyIfDeesnTexist标志是合理的。sharedfile标志的使用几乎是肯定的。是的,通常在安装到
{sys}
时,您应该使用
sharedfile
,而不是仅使用
OnlyIfDeesnTextist
。我使用了与原始问题相同的标志,假设OP需要它们是有原因的,但这不应被视为一般性建议。请您详细说明“您不应安装到{syswo64}”这一注释好吗-为什么?注册COM类时以及增加共享DLL计数时,将使用用于安装的路径。前者大多无害;这可能会混淆一些希望看到System32的应用程序,但大多数应用程序不应该在意,因为System32和SysWOW64都指向同一个文件,因此它应该以任何方式正确加载(只要不混淆32/64位)。共享DLL计数是主要问题——如果某些应用程序使用System32,而另一些应用程序使用SysWOW64,则它们将有单独的计数,并且在仍然需要时,文件可能会被删除。因此,所有安装程序在注册COM组件时使用完全相同的路径名非常重要——而且由于在64位之前编写的较旧的32位应用程序存在将始终使用{sys},具有64位感知的必须执行相同的操作。(Windows本身负责确保当32位应用程序试图访问System32中的文件时,它实际上会获取SysWOW64中的文件——但这无助于注册和共享计数问题。)