3.3.5.2 Constructing an SoHR from an SoH
The SoHR message is constructed by creating each of the TLVs described in section 2.2.3 and appending each TLV to the SoHR message using the INapSoHConstructor interface described in [MSDN-NAPAPI]. The TLVs are created in the following order, with values set as follows.
Initialization: Set SOH_TLV_Index to 4.
If the SoH has fewer than 4 TLVs, stop processing and abandon the SoH.
Construct SoHR TLV 1 using the value described in section 2.2.4 and the structure described in section 2.2.3.1, and append it to the SoHR.
Construct SoHR TLV 2 using the value described in section 2.2.7 for the firewall and the structure described in section 2.2.3.2, and append it to the SoHR.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class TLV (that is, if TLV_Type is not 8) or if the health class value is not 0 (for firewall), stop processing and abandon the SoH.
If the firewall is not required, as defined by the Firewall ADM element specified in section 3.3.1, set ComplianceCode to S_OK and go to step 21.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class status TLV (that is, if TLV_Type is 11), do the following:
If the health class status is not set to 0xC0FF0002 (E_MSSHAV_PRODUCT_NOT_INSTALLED), 0xC0FF0003 (E_MSSHAV_WSC_SERVICE_DOWN), or 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), stop processing and abandon the SoH.
Construct SoHR TLV 3 using the value of the health class status and the structure described in section 2.2.3.3, and append it to the SoHR.
Construct SoHR TLV 4 using the structure described in section 2.2.3.4, and append it to the SoHR.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
Go to step 23.
Set ComplianceCode to E_MSSHV_THIRD_PARTY_PRODUCT_NOT_ENABLED (0xC0FF0047).
If the SoH TLV pointed to by SOH_TLV_Index is not a product name TLV (that is, if TLV_Type is not 10), stop processing and abandon the SoH.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class status TLV (that is, if TLV_Type is not 11), stop processing and abandon the SoH.
If the value of the health class status is 1, 5, 9, or 13, set ComplianceCode to S_OK and go to step 21.
If the value of the health class status is 4, set ComplianceCode to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001).
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class TLV (that is, if TLV_Type is 8), decrement SOH_TLV_Index by 1 and go to step 21.
Go to step 11.
Construct SoHR TLV 3 using the value of ComplianceCode and the structure described in section 2.2.3.3, and append it to the SoHR.
Advance SOH_TLV_Index to point to the next TLV of health class type (that is, point to the next TLV with TLV_Type of 8). If there is no such TLV, stop processing and abandon the SoH.
Construct SoHR TLV 5 using the value described in section 2.2.7 for antivirus and the structure described in section 2.2.3.5, and append it to the SoHR.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class TLV (that is, if TLV_Type is not 8), or if the health class value is not equal to 1 (for antivirus), stop processing and abandon the SoH.
If antivirus is not required, as defined by the AntiVirusRealTime ADM element specified in section 3.3.1, set ComplianceCode1 and ComplianceCode2 to S_OK and go to step 47.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class status TLV (that is, if TLV_Type is 11), do the following:
If the health class status is not set to either 0xC0FF0002 (E_MSSHAV_PRODUCT_NOT_INSTALLED), 0xC0FF0003 (E_MSSHAV_WSC_SERVICE_DOWN), or 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), stop processing and abandon the SoH.
Construct SoHR TLV 6 by setting Antivirus_ComplianceCode_1 to the health code status and Antivirus_ComplianceCode_2 to S_OK; use the structure described in section 2.2.3.6. Append it to the SoHR.
Construct SoHR TLV 7 by creating the structure described in section 2.2.3.7. Append it to the SoHR.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
Go to step 49.
Set ComplianceCode1 to E_MSSHV_THIRD_PARTY_PRODUCT_NOT_ENABLED (0xC0FF0047) and set ComplianceCode2 to E_MSSHV_THIRD_PARTY_PRODUCT_NOT_UPTODATE (0xC0FF0048).
If the SoH TLV pointed to by SOH_TLV_Index is not a product name TLV (that is, if TLV_Type is not set to 10), stop processing and abandon the SoH.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class status TLV (that is, if TLV_Type is not set to 11), stop processing and abandon the SoH.
If the value of the health class status is 3, 7, 11, or 15, set ComplianceCode1 and ComplianceCode2 to S_OK and go to step 47.
If the value of the health class status is set to 4, do the following:
Set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001).
If the antivirus is required to be up to date, as defined by the AntiVirusUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004). Else set ComplianceCode2 to S_OK.
If the value of the health class status is either 5 or 13, do the following.
Set ComplianceCode1 to S_OK.
If antivirus is required to be up to date, as defined by the AntiVirusUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004). Else set ComplianceCode2 to S_OK.
If the value of the health class status is 6, set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001) and set ComplianceCode2 to S_OK.
If the value of the health class status is 13, set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004) and set ComplianceCode2 to S_OK.
If the value of the health class status is 0 and antivirus is not required to be up to date (as defined by the AntiVirusUptoDate ADM element specified in section 3.3.1), set ComplianceCode2 to S_OK.
If the value of the health class status is either 1 or 9, do the following:
Set ComplianceCode1 to S_OK.
If antivirus is not required to be up to date, as defined by the AntiVirusUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to S_OK.
If the value of the health class status is 2, set ComplianceCode2 to S_OK.
If both ComplianceCode1 and ComplianceCode2 are set to S_OK, go to step 47.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class TLV (that is, if TLV_Type is 8), decrement SOH_TLV_Index by 1 and go to step 47.
Go to step 30.
Construct SoHR TLV 6 by setting Antivirus_ComplianceCode_1 to ComplianceCode1 and Antivirus_ComplianceCode_2 to ComplianceCode2; use the structure described in section 2.2.3.6. Append it to the SoHR.
Advance SOH_TLV_Index to point to the next TLV of health class type (that is, advance it to point to the next TLV with TLV_Type set to 8). If there is no such TLV, stop processing and abandon the SoH.
Inspect the value of SoH TLV 3 to identify upon which version of the operating system the client is running, and therefore, which step to perform next in the initialization process.<14>
Construct SoHR TLV 8 by using the value described in section 2.2.7 for antispyware and the structure described in section 2.2.3.8, and append it to the SoHR.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class TLV (that is, if TLV_Type is not 8), or if the health class value is not equal to 2 (for antispyware), stop processing and abandon the SoH.
If antispyware is not required, as defined by the AntiSpywareScanEnabled ADM element specified in section 3.3.1, set ComplianceCode1 and ComplianceCode2 to S_OK and go to step 74.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class status TLV (that is, if TLV_Type is 11), do the following:
If the health class status is not set to 0xC0FF0002 (E_MSSHAV_PRODUCT_NOT_INSTALLED), 0xC0FF0003 (E_MSSHAV_WSC_SERVICE_DOWN), or 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), stop processing and abandon the SoH.
Construct SoHR TLV 9 with Antispyware_ComplianceCode_1 set to the value of the health class status and with Antispyware_ComplianceCode_2 set to S_OK; use the structure described in section 2.2.3.9. Append it to the SoHR.
Construct SoHR TLV 10 by creating the structure described in section 2.2.3.10, and append it to the SoHR.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
Go to step 76.
Set ComplianceCode1 to E_MSSHV_THIRD_PARTY_PRODUCT_NOT_ENABLED (0xC0FF0047) and set ComplianceCode2 to E_MSSHV_THIRD_PARTY_PRODUCT_NOT_UPTODATE (0xC0FF0048).
If the SoH TLV pointed to by SOH_TLV_Index is not a product name TLV (that is, if TLV_Type is not 10), stop processing and abandon the SoH.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class status TLV (that is, if TLV_Type is not 11), stop processing and abandon the SoH.
If the value of the health class status is set to 3, 7, 11, or 15, set ComplianceCode1 and ComplianceCode2 to S_OK and go to step 74.
If the value of the health class status is set to 4, do the following:
Set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001)
If antivirus is required to be up to date, as defined by the AntiSpywareUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004). Else set ComplianceCode2 to S_OK.
If the value of the health class status is either 5 or 13, do the following:
Set ComplianceCode1 to S_OK.
If antivirus is required to be up to date, as defined by the AntiSpywareUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004), else set ComplianceCode2 to S_OK.
If the value of the health class status is 6, set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001) and set ComplianceCode2 to S_OK.
If the value of the health class status is 13, set ComplianceCode1 to E_MSSHV_PRODUCT_NOT_UPTODATE (0xC0FF0004) and set ComplianceCode2 to S_OK.
If the value of the health class status is 0 and the antivirus is not required to be up to date as defined by the AntiSpywareUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to S_OK.
If the value of the health class status is set to either 1 or 9, do the following:
Set ComplianceCode1 to S_OK.
If antivirus is not required to be up to date, as defined by the AntiSpywareUptoDate ADM element specified in section 3.3.1, set ComplianceCode2 to S_OK.
If the value of the health class status is set to 2, set ComplianceCode1 to S_OK.
If both ComplianceCode1 and ComplianceCode2 are set to S_OK, go to step 74.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is a health class TLV (that is, if TLV_Type is 8), decrement TLV_SOH_Index by 1 and go to step 74.
Go to step 57.
Construct SoHR TLV 9 by setting Antispyware_ComplianceCode_1 to ComplianceCode1 and Antispyware_ComplianceCode_2 to ComplianceCode2; use the structure described in section 2.2.3.9. Append it to the SoHR.
Advance SOH_TLV_Index to point to the next TLV of health class type (that is, advance to the next TLV with TLV_Type set to 8). If there is no such TLV, stop processing and abandon the SoH.
Construct SoHR TLV 11 using the value described in section 2.2.7 for automatic updates and the structure described in section 2.2.3.11, and append it to the SoHR.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class TLV (that is, if TLV_Type is not 8), or if the health class value is not equal to 3 (for automatic updates), stop processing and abandon the SoH.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class status TLV (that is, if TLV_Type is not 11), stop processing and abandon the SoH.
If automatic updates are not required, as defined by the AutoUpdate ADM element specified in section 3.3.1, go to step 87.
If health class status is not equal to 1, 5, 0xC0FF0003 (E_MSSHAV_WSC_SERVICE_DOWN), or 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), go to step 87.
If health class status equals 0xC0FF0003 (E_MSSHAV_WSC_SERVICE_DOWN) or 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), set ComplianceCode to the value of the health class status, else set ComplianceCode to E_MSSHV_PRODUCT_NOT_ENABLED (0xC0FF0001).
Construct SoHR TLV 12 by using the value of ComplianceCode and the structure described in section 2.2.3.12, and append it to the SoHR.
If health class status equals 0x00FF0008 (E_MSSHAV_WSC_SERVICE_NOT_STARTED_SINCE_BOOT), construct SoHR TLV 13 by creating the structure described in section 2.2.3.13 and append it to the SoHR.
Go to step 88.
Construct SoHR TLV 12 by using the value S_OK and the structure described in section 2.2.3.12, and append it to the SoHR.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, stop processing and abandon the SoH.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class TLV (that is, if TLV_Type is not 8), or if the health class value is not equal to 4 (for security updates), stop processing and abandon the SoH.
Construct SoHR TLV 14 using the value described in section 2.2.7 for security updates and the structure described in section 2.2.3.14, and append it to the SoHR.
Set ComplianceCode1 and ComplianceCode2 to S_OK.
If security updates are not required, as defined by the EnforceUpdates ADM element specified in section 3.3.1, go to step 114.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
If the SoH TLV pointed to by SOH_TLV_Index is not a health class status TLV (that is, if TLV_Type is not 11), set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
Set HealthStatus to the value of the health class status TLV.
If HealthStatus is not equal to 0x00FF0006 (S_MSSHA_MISSING_UPDATES) or 0x00FF0005 (S_MSSHA_NO_MISSING_UPDATES), set ComplianceCode1 to HealthStatus and go to step 114.
Increment SOH_TLV_Index by 1.
If the number of SoH TLVs is less than the value of SOH_TLV_Index, set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
If the SoH TLV pointed to by SOH_TLV_Index is not a vendor-specific TLV (that is, TLV_Type is not 7), set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
Set DurationSinceLastSync to the value stored in the SoH TLV pointed to by SOH_TLV_Index.
Increment SOH_TLV_Index by 2 (the WSUSServerName TLV is skipped).
If the number of SoH TLVs is less than the value of SOH_TLV_Index, set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
If the SoH TLV pointed to by SOH_TLV_Index is not a vendor-specific TLV (that is, TLV_Type is not 7), set ComplianceCode1 to E_MSSHV_WUS_SHC_FAILURE and go to step 114.
Set MinSeverityRating to the value stored in the SoH TLV pointed to by SOH_TLV_Index.
Inspect the value of SoH TLV 3 to identify upon which version of the operating system the client is running, and therefore, which step to perform next in the initialization process.<15>
If bit 16 (0x00010000) is set in MinSeverityRating, do the following:
If querying Windows Software Updates Services is not allowed as specified by the WSUSAllowed ADM element specified in section 3.3.1, do the following:
If querying Windows Update is not allowed as specified by the WUAllowed ADM element specified in section 3.3.1, set ComplianceCode1 to E_MSSHAV_BAD_UPDATE_SOURCE_MU. Else set ComplianceCode1 to E_MSSHAV_BAD_UPDATE_SOURCE_WUMU.
Go to step 114.
If bit 14 (0x00004000) is set in MinSeverityRating, do the following:
If querying Microsoft Windows Update is not allowed as specified by the WUAllowed ADM element specified in section 3.3.1, do the following:
If querying Windows Software Updates Services is not allowed as specified by the WSUSAllowed ADM element specified in section 3.3.1, set ComplianceCode1 to E_MSSHAV_BAD_UPDATE_SOURCE_MUWSUS, else set ComplianceCode1 to E_MSSHAV_BAD_UPDATE_SOURCE_MU.
Go to step 114.
If bits 17, 16, and 14 (0x00034000) are all clear in MinSeverityRating, set ComplianceCode1 to E_MSSHAV_NO_UPDATE_SOURCE and go to step 114.
If DurationSinceLastSync is greater than the value in the MaxDurationSinceLastSync ADM element specified in section 3.3.1, set ComplianceCode1 to E_MSSHV_SYNC_AND_INSTALL_UPDATES.
If HealthStatus is equal to S_MSSHA_MISSING_UPDATES and (MinSeverityRating & 0xFF0) is greater than the value in the MinimumSeverityRating ADM element specified in section 3.3.1, set ComplianceCode1 to E_MSSHV_SYNC_AND_INSTALL_UPDATES.
If ComplianceCode1 is not equal to S_OK, set ComplianceCode2 to the value stored in the MinimumSeverityRating ADM element specified in section 3.3.1.
Construct SoHR TLV 15 by setting Security_Updates_ComplianceCode_1 to ComplianceCode1 and Security_Updates_ComplianceCode_2 to ComplianceCode2; use the structure described in section 2.2.3.15. Append it to the SoHR.
If the steps described above lead to stopped processing and the SoH is abandoned, no SoHR is sent to the client. The SoHR is only sent to the client if the processing of the SoH is successful and the SoHR is successfully constructed.