Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Register DLL/OCX in InnoSetup

I have a DLL and OCX pack then I've decided to make an installer.

This is what I have:

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

I've seen the regserver parametter but I'm not sure how it works (I've readed the parametter documentation), I need to know if I can simplify the things by doing only this without needing all the [RUN] section?:

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

And also If I do that then I still need to specify the "ArchitecturesInstallIn64BitMode"? for the correct registration of the first x64 dll?

UPDATE:

Maybe this is a better equivalent of the [RUN] section:

[Files]
Source: {syswow64}\*; DestDir: {syswow64}; Flags: onlyifdoesntexist regserver 32bit
Source: {sys}\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 64bit
like image 364
ElektroStudios Avatar asked Sep 04 '13 19:09

ElektroStudios


People also ask

How do I register a DLL and OCX file?

Click Start > All Programs > Accessories and right-click on "Command Prompt" and select "Run as Administrator" OR in the Search box, type CMD and when cmd.exe appears in your results, right-click on cmd.exe and select "Run as administrator" At the command prompt, enter: REGSVR32 "PATH TO THE DLL FILE"

How do I fix unable to register the DLL OCX?

The solution is to install Windows Updates. Go into the Windows Control Panel under Windows Updates, and make sure all of your Important updates are installed. After installing your Windows Updates, try re-running the installer.

How do I register an OCX file in Windows 10?

OCX files. Start your server in VGA mode. You will need to use the Regsvr.exe, Regsvr16.exe (16-bit), or Regsvr32.exe (32-bit) command to register the OCX file as system global. These commands are included in the development kit when Visual Basic or Visual FoxPro is installed.


1 Answers

The more correct approach would be:

[Files]
Source: C:\yourdlls\x86\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit
Source: C:\yourdlls\x64\*; DestDir: {sys}; Flags: onlyifdoesntexist regserver 64bit; Check: IsWin64

Note that I've changed the Source dir. That is because it is an amazingly bad idea to source files from your own Windows folder, and even worse to do so with wildcards. You're just asking for something that will completely destroy someone else's Windows installation if you attempt that.

(Also note that you should never install to {syswow64}, especially when using regserver. The lines above will have the same effect of installing into two separate folders but they will actually register things correctly, unlike what you had.)

like image 172
Miral Avatar answered Nov 08 '22 21:11

Miral