Search code examples
windowsvisual-c++wsc

Can't register application in Windows Security Centre


I have code:

//interface

MIDL_INTERFACE("XXXXXX-XXXX-XXX-XXXX-XXXXXXXXXXX")
IWscAVStatus : public IWscSecurityProductStatus
{
public:
    virtual HRESULT STDMETHODCALLTYPE UpdateStatus( 
        /* [in] */ WSC_SECURITY_PRODUCT_STATE eProductState,
        /* [in] */ BOOL fProductUptoDate) = 0;

};
ATL::CComPtr<IWscAVStatus>  m_pAvStatus;

//Init
ATL::CComPtr<IUnknown>     pUnknown;
HRESULT hr = pUnknown.CoCreateInstance(__uuidof(WscIsv), NULL, CLSCTX_INPROC_SERVER);
ATL::CComQIPtr<IWscAVStatus>  pAvStatus(pUnknown);
m_pAvStatus = pAvStatus;
...
//Register
auto hr = m_pAvStatus->Register(CComBSTR(m_Path), CComBSTR(WSC_AV_DISPLAY), FALSE, TRUE);
m_avRegistered = SUCCEEDED(hr); //Always false

Could you please help me? I can't find any information about how to register application (and make it right) in Windows Security Center. It doesn't work and I can't understand why. I would be very grateful for any information about it.


Solution

  • It was my mistake. This code is good, but in other the part of code I have to set variable as need. Thanks