locked
Getting status of the Windows Security Center via WscGetSecurityProviderHealth RRS feed

  • Question

  • Hi everybody,

    I want to check the status of the Windows Security Center in my application. I don't want to change anything or so, I just want the status if everything is ok or something is wrong.

    I found this articel: http://msdn.microsoft.com/en-us/library/bb432506(VS.85).aspx
    and this one: http://msdn.microsoft.com/en-us/library/bb432509(VS.85).aspx

    So far I don't hav any idea. I tried it like that:

    Public

     

    Declare Function WscGetSecurityProviderHealth Lib "Wscapi" ()

    Public Const WSC_SECURITY_PROVIDER_ALL = (Do i have to sum all numbers here, as the all has no specific number)


    As you see I'm not very far, but this is way to complicated. I hope one of you can help me try to finish this, or help me findeing another way to check the status of WSC.

    Thank you

    Sunday, April 5, 2009 11:45 AM

Answers

  • Check this way, use or to combine them

     Declare Function WscGetSecurityProviderHealth Lib "Wscapi" (ByVal InValue As Integer, ByRef outValue As Integer) As Integer
        Public Enum _WSC_SECURITY_PROVIDER
            WSC_SECURITY_PROVIDER_FIREWALL = 1
            WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS = 2
            WSC_SECURITY_PROVIDER_ANTIVIRUS = 4
            WSC_SECURITY_PROVIDER_ANTISPYWARE = 8
            WSC_SECURITY_PROVIDER_INTERNET_SETTINGS = 16
            WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL = 32
            WSC_SECURITY_PROVIDER_SERVICE = 64
            WSC_SECURITY_PROVIDER_NONE = 0
            WSC_SECURITY_PROVIDER_ALL = WSC_SECURITY_PROVIDER_FIREWALL Or WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS Or WSC_SECURITY_PROVIDER_ANTIVIRUS Or _
            WSC_SECURITY_PROVIDER_ANTISPYWARE Or WSC_SECURITY_PROVIDER_INTERNET_SETTINGS Or WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL Or _
            WSC_SECURITY_PROVIDER_SERVICE Or WSC_SECURITY_PROVIDER_NONE
        End Enum

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim res As Integer
            WscGetSecurityProviderHealth(_WSC_SECURITY_PROVIDER.WSC_SECURITY_PROVIDER_ALL, res)
            MessageBox.Show("No of All Issues: " & res.ToString)
        End Sub

    Arjun Paudel
    • Marked as answer by donald2603 Sunday, April 5, 2009 2:17 PM
    Sunday, April 5, 2009 2:00 PM

All replies

  • Check this way, use or to combine them

     Declare Function WscGetSecurityProviderHealth Lib "Wscapi" (ByVal InValue As Integer, ByRef outValue As Integer) As Integer
        Public Enum _WSC_SECURITY_PROVIDER
            WSC_SECURITY_PROVIDER_FIREWALL = 1
            WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS = 2
            WSC_SECURITY_PROVIDER_ANTIVIRUS = 4
            WSC_SECURITY_PROVIDER_ANTISPYWARE = 8
            WSC_SECURITY_PROVIDER_INTERNET_SETTINGS = 16
            WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL = 32
            WSC_SECURITY_PROVIDER_SERVICE = 64
            WSC_SECURITY_PROVIDER_NONE = 0
            WSC_SECURITY_PROVIDER_ALL = WSC_SECURITY_PROVIDER_FIREWALL Or WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS Or WSC_SECURITY_PROVIDER_ANTIVIRUS Or _
            WSC_SECURITY_PROVIDER_ANTISPYWARE Or WSC_SECURITY_PROVIDER_INTERNET_SETTINGS Or WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL Or _
            WSC_SECURITY_PROVIDER_SERVICE Or WSC_SECURITY_PROVIDER_NONE
        End Enum

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim res As Integer
            WscGetSecurityProviderHealth(_WSC_SECURITY_PROVIDER.WSC_SECURITY_PROVIDER_ALL, res)
            MessageBox.Show("No of All Issues: " & res.ToString)
        End Sub

    Arjun Paudel
    • Marked as answer by donald2603 Sunday, April 5, 2009 2:17 PM
    Sunday, April 5, 2009 2:00 PM
  • The Function returns 0 for everything ok and 2 for something is wrong there.

    Thanks alot for your answere.

    Helped alot!


    Ohh, is this function only working with Vista or with the security center in Windows XP too? I guess Windows 7 will be very close to the vista versions security center.



    Regards

    Dennis
    • Edited by donald2603 Sunday, April 5, 2009 2:24 PM Adding further questions
    Sunday, April 5, 2009 2:19 PM