Changes between Initial Version and Version 1 of OpenVPNMSICA


Ignore:
Timestamp:
02/24/19 18:45:11 (5 years ago)
Author:
rozmansi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenVPNMSICA

    v1 v1  
     1{{{
     2#!rst
     3OpenVPN MSI CA Developer Documentation
     4======================================
     5
     6This document describes some basic overview of *openvpnmsica.dll* for developers.
     7
     8Consider the *openvpnmsica.dll* as a collection of functions (aka "Custom Actions") the MSI installer calls to perform tasks that are not implemented by stock MSI actions.
     9
     10Some functions are completely stand-alone.
     11
     12- ``FindSystemInfo()`` and ``FindTAPInterfaces()`` are sequenced in the MSI package to execute early. They perform some tests MSI is too limited to do itself and set various MSI properties accordingly. Later, those MSI properties are used to form conditions in MSI. Like which version of the driver to install, should *OpenVPNServ* feature be selected to install or not, etc.
     13- The ``CloseOpenVPNGUI()`` and ``StartOpenVPNGUI()`` do just what they say immediately when called.
     14
     15Then there are other functions that form an ``<evaluation, execute, commit, rollback>`` tuple. The ``<EvaluateTAPInterfaces(), ProcessDeferredAction(), ProcessDeferredAction(), ProcessDeferredAction()>`` is an example of those. They are sequenced in the MSI package like this:
     16
     171. ``EvaluateTAPInterfaces()`` executes in the first pass. It runs in the current user context and it doesn't touch user's computer in any way. Well, it just prepares a list of TAP-interface-related operations to be executed and saves it in a temporary file. The list contains operations like: *"install TAP interface X"*, *"delete TAP interface X"*, *"rename TAP interface X to Y"*, *"delete file X"*, etc. Operations are implemented in *msica_op.h* and *msica_op.c*.
     18
     192. ``ProcessDeferredAction()`` runs in the so-called deferred MSI execution pass run by Windows Installer service as the *SYSTEM* user. It loads the list of operations from the temporary file and executes them one by one.
     20
     21   Let's look at a sample operation *"delete file X"*. Normally, this operation does not really delete the file X. It renames it to Y instead, while adding *"delete file Y"* operation to a separate commit list tail, and inserting *"move file Y to X"* to a rollback list head. Unless MSI rollback is explicitly disabled - in this case, it just deletes the file immediately and doesn't touch commit/rollback lists.
     22
     23   After all operations on the list are executed, the newly created commit and rollback operation lists are saved to separate temporary files.
     24
     253. After the installation succeeds, the MSI calls all deferred commit actions: This time, the ``ProcessDeferredAction()`` is called with the commit list filename as the action parameter.
     26
     27   Should the installation fail, the MSI calls all deferred rollback actions in reverse order: This time, the ``ProcessDeferredAction()`` would be called with the rollback list filename as the action parameter.
     28
     29Since execution, commit and rollback list files are of the same syntax, the same ``ProcessDeferredAction()`` function is reused. The only detail worth noting is that when ``ProcessDeferredAction()`` detects it is run in the commit/rollback pass it disables the MSI rollback: this makes all sequenced operations execute immediately and no longer bother with commit/rollback lists.
     30}}}