Renat Tlebaldziyeu

Outlook Security Manager deployment: self-registration in a Visual Studio setup project, part 3

We continue to look at the various ways of deploying your applications that use Outlook Security Manager. But first off, I advise that you read through Part 1: Outlook Security Manager 2010 deployment:.net, ActiveX and VCL basics

As I showed in part 2, you can register secman.dll or secman64.dll using regsvr32. Alternatively you can use the vsdrfCOMSelfReg option of your installer. According to Microsoft, “Self-registration is the standard means through which a server module can package its own registry operations, both registration and unregistration, into the module itself.”

Step-by-step instructions:

1. Add two files, secman.dll and secman64.dll, to your setup project.
2. Open the Launch Conditions Editor of our setup project.
3. Right-click the Search Target Machine folder and add two launch conditions of the Registry Search type:

Getting the Outlook version (OLVER):

Getting the Outlook version (OLVER):

Getting the Outlook bitness (OLBIT):

Getting the Outlook bitness (OLBIT):

4. Why do we need two search objects, we could create just one, which would check the Bitness registry value in HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Office\14.0\Outlook? Unfortunately, Outlook 2010 Beta doesn’t add this value to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\, and this is the registry key to which 32-bit applications are re-directed on a 64-bit machine instead of HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Office\14.0\Outlook. The release version of Outlook 2010 doesn’t have this bug. As a result, on an x64 PC you will get an empty string for Outlook 2010 x64 Beta and “x64″ for Outlook 2010 x64 Release.

So, here is what we have: the OLVER value is “Outlook.Application.14″ for Outlook 2010. And the OLBIT value is “x64″ (or “”) for Outlook 2010 x64 and “x86″ for Outlook 2010 x86.

5. Now we can write down the rules for the secman.dll and secman64.dll files, considering the conditions above. Let’s go to the File System Editor of the setup project, where we set the value of the Register property for the above files to “vsdrfCOMSelfReg” and set the Condition property as follows:

For secman.dll it is equal to (OLVER <> “Outlook.Application.14″) or ((OLVER=”Outlook.Application.14″) and (OLBIT = “x86″)):

Setting the Register and Condition properties for secman.dll

For secman64.dll it is ((OLVER = “Outlook.Application.14″) and ((OLBIT = “”) or (OLBIT = “x64″))):

Setting the Register and Condition properties for secman64.dll

Thus, for Outlook 2010 64-bit, secman64.dll will be extracted and registered, for all other Outlook versions, it will be secman.dll.

6. Set the SharedLegacyFile property to True for secman.dll and secman64.dll. According to SharedLegacy Property description on MSDN:When an installed file is marked as a shared legacy file, Windows Installer keeps reference count information about any legacy copy of the file (installed by a prior setup) it finds on the target computer. By maintaining a correct reference count for existing legacy files, the installer can determine whether to delete legacy files when it uninstalls the application.That is, our setup project will not remove and unregister Security Manager files if they are used by some other software.

If you use the ActiveX edition of Outlook Security Manager, you can also use a similar method for registering osmax.ocx and osmax64.ocx.

Note. Administrative permissions are required to register COM dlls.

You may also be interested in:

Outlook Security Manager deployment:.net, ActiveX and VCL basics, part 1
Outlook Security Manager deployment: bitness and regsvr32 utility, part 2
Outlook Security Manager deployment: compiling a standalone application with "AnyCPU", part 4

8 Comments

  • https://secure.gravatar.com/avatar/794bf06f1a6a588eeef8ee043bc67e1e?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Mike VE says:

    Thanks for this very useful series of articles. Just for the record when I used copy and paste to the Condition formulae into Visual Studio I got an “Invalid character” error. It went away when I changed the double quotation marks to singles.

  • https://secure.gravatar.com/avatar/df4ae910014fe7db75da024711298240?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Fabricio P says:

    Thanks and indeed a very useful article. If I may add you forgot to cover the steps for creating the custom “Outlook Security Manager” folder inside the “File System on Target Machine” screen. For example: Which “DefaultLocation” option is better to use?

    By default there are only 3 folders inside “File System on Target Machine”: “Application Folder”, “User’s Desktop” & “User’s Programs Menu”.

  • https://secure.gravatar.com/avatar/2b5f678d89ebaaeea57974c6c441ce69?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Renat Tlebaldziyeu (Add-in Express Team) says:

    Thank you for the suggestion, Fabricio.

    You should place secman.dll or secman64.dll as shared dll into a shared location, we recommend this folder – “[Common Files Folder]\Outlook Security Manager”.
    To add this folder inside “File System on Target Machine” please do the following steps:
    1. Right click on the File System on Target Machine to open the context menu.
    2. In the context menu select Add Special Folder – Common Files Folder.
    3. Now you can see the Common Files Folder in the File System tree.
    4. Add a new subfolder to the Common Files Folder.
    5. Rename a new folder to “Outlook Security Manager”.

  • https://secure.gravatar.com/avatar/31b872278d7b220af17467afc1b6af18?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G domke consulting says:

    Thank you very much for this article, which helped me a lot in designing my installer. Currently I must block the installation of my ADX add-in in an Office 14 / 64 bit environment, and the conditions you propose was just what I needed.

  • https://secure.gravatar.com/avatar/df4ae910014fe7db75da024711298240?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Fabricio Pérez says:

    Could this article be updated now that Outlook 2013 is out? Thanks in advance.

  • https://secure.gravatar.com/avatar/29957f26ad2d8ba527fd9cc8cfa7b2e0?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Andrei Smolin (Add-in Express Team) says:

    Hello Fabricio,

    Thank you for the suggestion, we will think about it.

    Actually, this would require replacing “Outlook 2010″ with “Outlook 2010-2013″. Also, Outlook 2010 version is 14, while Outlook 2013 is version 15. That is, every key “…\SOFTWARE\Microsoft\Office\14.0\…” will become “…\SOFTWARE\Microsoft\Office\15.0\…” etc. Similarly, “Outlook.Application.14″ needs to be replaced with “Outlook.Application.15″.

  • https://secure.gravatar.com/avatar/ffad3d9e68e90d4a1d28dc5954f26f4e?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Andrew Hunot says:

    Could this article be updated now that Outlook 2013 AND Outlook 2016 are out?

    Many thanks

    Andrew

  • https://secure.gravatar.com/avatar/29957f26ad2d8ba527fd9cc8cfa7b2e0?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G Andrei Smolin (Add-in Express Team) says:

    Hello Andrew,

    I don’t think updating the article is required because Security Manager version 8 allows deploying the files with no registration.

Post a comment

Have any questions? Ask us right now!