How to detect if a virusscanner and/or firewall is installed? (And a few other security-related Q's.)

后端 未结 2 1153
离开以前
离开以前 2020-12-15 12:50

I have an application and I\'m trying to make sure it\'s running in a secure environment. First of all, I check if Windows is genuine, which makes it more likely that the us

2条回答
  •  佛祖请我去吃肉
    2020-12-15 13:41

    Since I was looking for a C++ and not .NET depended way, I mixed between this answer and MSDN example: Getting WMI Data from the Local Computer.

    The commands that need to be changed in order to get the AV name are:

    • _bstr_t(L"ROOT\\CIMV2") to _bstr_t(L"ROOT\\SecurityCenter2"). Keep in mind that SecurityCenter2 is for Win 7, Vista SP2 and beyond according to this. Below Vista SP2, you need to use SecurityCenter.
    • bstr_t("SELECT * FROM Win32_OperatingSystem") to bstr_t("SELECT * FROM AntivirusProduct")
    • hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0); to hr = pclsObj->Get(L"displayName", 0, &vtProp, 0, 0);.

    This changed code has been checked and fully working.

    For a simpler method you can always iterate over this algorithm and look for your AV by name.

提交回复
热议问题