3.2.5.2 Constructing an SoH

The SoH message is constructed by creating each of the TLVs described in section 2.2.2 and appending each TLV to the SoH message using the INapSoHConstructor interface described in [MSDN-NAPAPI]. The TLVs are created in the following order and set with values according to the following procedure. The ADM elements used in this procedure are defined in section 3.2.1.

  1. Initialization:

    1. Initialize the FirewallStatus ADM element and the NumberOfFirewallProducts ADM element by calling the GetNumberOfFirewallProducts abstract interface described in section 3.2.4.3.

    2. If the FirewallStatus ADM element is set to S_OK, initialize the FirewallProductsInformation ADM element by calling the GetFirewallProductsInformation abstract interface described in section 3.2.4.4.

    3. If the GetFirewallProductsInformation abstract interface returns a value other than S_OK, stop processing. Then set the process return code to the value that was returned by GetFirewallProductsInformation.

    4. Initialize the AntivirusStatus ADM element and the NumberOfAntivirusProducts ADM element by calling the GetNumberOfAntivirusProducts abstract interface described in section 3.2.4.5.

    5. If the AntivirusStatus ADM element is set to S_OK, initialize the AntivirusProductsInformation ADM element by calling the GetAntivirusProductsInformation abstract interface described in section 3.2.4.6.

    6. If the GetAntivirusProductsInformation abstract interface returns a value other than S_OK, free the memory allocated for FirewallProductsInformation by calling the FreeProductsInformation abstract interface (section 3.2.4.11). Then stop processing and set the process return code to the value that was returned by GetAntivirusProductsInformation.

    7. Inspect the value of the ClientVersion ADM element to identify upon which version of the operating system the client is running, and therefore, which step to perform next in the initialization process.<7>

    8. Initialize the AntispywareStatus ADM element and the NumberOfAntispywareProducts ADM element by calling the GetNumberOfAntivirusProducts abstract interface described in section 3.2.4.7.

    9. If the AntispywareStatus ADM element is set to S_OK, initialize the AntispywareProductsInformation ADM element by calling the GetAntispywareProductsInformation abstract interface described in section 3.2.4.8.

    10. If the GetAntispywareProductsInformation abstract interface returns a value other than S_OK, stop processing. Then set the process return code to the value that was returned by GetAntispywareProductsInformation.

    11. Initialize the AutomaticUpdatesStatusCode ADM element by calling the GetAutomaticUpdatesStatusCode abstract interface described in section 3.2.4.9.

    12. If the GetAutomaticUpdatesStatusCode abstract interface returns a value other than S_OK, free the memory allocated for FirewallProductsInformation and AntivirusProductsInformation by calling the FreeProductsInformation abstract interface (section 3.2.4.11) and stop processing. Then set the process return code to the value that was returned by GetAutomaticUpdatesStatusCode.

    13. Initialize the SUStatus ADM element by calling the GetSecurityUpdatesStatus abstract interface described in section 3.2.4.10.

    14. If the GetSecurityUpdatesStatus abstract interface returns a value other than S_OK, free all memory that was allocated for FirewallProductsInformation, AntivirusProductsInformation, and AntispywareProductsInformation by calling the FreeProductsInformation abstract interface (section 3.2.4.11) and stop processing. Set the process return code to the value that was returned by GetSecurityUpdatesStatus.

    15. Add 1 to the SohFlag[1] ADM element.

  2. Construct TLV 1 using the value in section 2.2.4 and the structure described in section 2.2.2.1, and append it to the SoH.

  3. Construct TLV 2 using the value of the SohFlag ADM element  and the structure described in section 2.2.2.2, and append it to the SoH.

  4. Construct TLV 3 using the value of the ClientVersion ADM element and the structure described in section 2.2.2.3, and append it to the SoH.

  5. Construct TLV 4 using the value described in section 2.2.7 for the firewall and the structure in section 2.2.2.4, and append it to the SoH.

  6. If the value of the FirewallStatus ADM element is not S_OK, construct TLV 6 using the value of the FirewallStatus ADM element and the structure described in section 2.2.2.6, and append it to the SoH.

  7. If the value of the FirewallStatus ADM element is S_OK, do the following:

    1. Set ProductIndex to 0.

    2. If ProductIndex is equal to NumberOfFirewallProducts, go to step 8.

    3. Construct TLV 5 using the value of the FirewallProductsInformation[ProductIndex].pi_productName ADM element and the structure described in section 2.2.2.5, and append it to the SoH.

    4. Construct TLV 6 using the value of the FirewallProductsInformation[ProductIndex].pi_clientStatusCode ADM element  and the structure described in section 2.2.2.6, and append it to the SoH.

    5. Increment ProductIndex by 1.

    6. Go to step 7-2.

  8. Construct TLV 7 by using the value described in section 2.2.7 for antivirus and the structure described in section 2.2.2.7, and append it to the SoH.

  9. If the value of the AntivirusStatus ADM element is not S_OK, construct TLV 9 using the value of the AntivirusStatus ADM element and the structure described in section 2.2.2.9. Append it to the SoH.

  10. If the value of the AntivirusStatus ADM element is S_OK, do the following:

    1. Set ProductIndex to 0.

    2.  If ProductIndex equals the NumberOfAntivirusProducts ADM element, go to step 11.

    3. Construct TLV 8 using the value of the AntivirusProductsInformation[ProductIndex].pi_productName ADM element and the structure described in section 2.2.2.8, and append it to the SoH.

    4. Construct TLV 9 using the value of the AntivirusProductsInformation[ProductIndex].pi_clientStatusCode ADM element and the structure described in section 2.2.2.9, and append it to the SoH.

    5. Increment ProductIndex by 1.

    6. Go to step 10-2.

  11. Inspect the value of the ClientVersion ADM element to identify upon which version of the operating system the client is running, and therefore, which step to perform next in the initialization process.<8>

  12. Construct TLV 10 using the value described in section 2.2.7 for antispyware and the structure described in section 2.2.2.10, and append it to the SoH.

  13. If the value of the AntispywareStatus ADM element is not S_OK, construct TLV 12 using the value of the AntispywareStatus ADM element and  the structure described in section 2.2.2.12, and append it to the SoH.

  14. If the value of the AntispywareStatus ADM element is S_OK, do the following:

    1. Set ProductIndex to 0.

    2. If ProductIndex equals the NumberOfAntispywareProducts ADM element, go to step 15.

    3.  Construct TLV 11 using the value of the AntispywareProductsInformation[ProductIndex].pi_productName ADM element and  the structure described in section 2.2.2.11, and append it to the SoH.

    4.  Construct TLV 12 using the value of the AntispywareProductsInformation[ProductIndex].pi_clientStatusCode ADM element and the structure described in section 2.2.2.12, and append it to the SoH.

    5.  Increment ProductIndex by 1.

    6.  Go to step 14-2.

  15. Construct TLV 13 using the value described in section 2.2.7 for automatic updates and the structure described in section 2.2.2.13, and append it to the SoH.

  16. Construct TLV 14 using the value of the AutomaticUpdatesStatusCode ADM element. Create the structure described in section 2.2.2.14, and append it to the SoH.

  17. Construct TLV 15 using the value described in section 2.2.7 for security updates and the structure described in section 2.2.2.15, and append it to the SoH.

  18. Construct TLV 16 using the value of the sus_clientStatusCode field of the SUStatus ADM element and the structure described in section 2.2.2.16, and append it to the SoH.

  19. If the value of TLV 16 is not 0x00FF0005 (S_MSSHA_NO_MISSING_UPDATES) and not 0x00FF0006 (S_MSSHA_ MISSING_UPDATES), go to step 23.

  20. Construct TLV 17 using the value of the sus_durationSinceLastSynch field of the SUStatus ADM element and the structure described in section 2.2.2.17, and append it to the SoH.

  21.  Construct TLV 18 using the value of the sus_wsusServerName field of the SUStatus ADM element and the structure described in section 2.2.2.18, and append it to the SoH.

  22.  Construct TLV 19 using the value of the sus_updatesFlag field of the SUStatus ADM element and the structure described in section 2.2.2.19, and append it to the SoH.

  23. Free allocated memory for FirewallProductsInformation, AntivirusProductsInformation, and AntispywareProductsInformation (if it was allocated) by calling the FreeProductsInformation abstract interface (see 3.2.4.11).

  24.  Return S_OK as the process exit code.

The process exit code is used by the Protocol Bindings for SoH [TNC-IF-TNCCSPBSoH] as an indication of the success or failure of the SoH construction, and the SoH protocol then acts accordingly.