summaryrefslogtreecommitdiff
path: root/Shutdown/ShutdownSite.cpp
blob: 45dcdd91a2cbe46deda2cbce30d0250066982f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ShutdownSite.cpp: implementation of the CShutdownSite class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ShutdownSite.h"

_COM_SMARTPTR_TYPEDEF(INightSecErrorFix, __uuidof(INightSecErrorFix));

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CShutdownSite::CShutdownSite()
{

}

CShutdownSite::~CShutdownSite()
{

}

void CShutdownSite::SetSite()
{
	IUnknown* pUnk = NULL;
	IObjectWithSitePtr pWithSite;

	IUnknown* pUnkMe = GetUnknown();

	for(int nCnt = 0; nCnt < g_aComponents.size(); nCnt++)
	{
		if(SUCCEEDED(pUnk = g_aComponents[nCnt]->GetUnknown()) && pUnk != NULL)
		{
			pWithSite = pUnk;
			if(pWithSite != NULL)
				pWithSite->SetSite(pUnkMe);

			pUnk->Release();
		}	
	}

}

void CShutdownSite::ClearSite()
{
	IUnknown* pUnk = NULL;
	IObjectWithSitePtr pWithSite;

	for(int nCnt = 0; nCnt < g_aComponents.size(); nCnt++)
	{
		if(SUCCEEDED(pUnk = g_aComponents[nCnt]->GetUnknown()) && pUnk != NULL)
		{
			pWithSite = pUnk;
			if(pWithSite != NULL)
				pWithSite->SetSite(NULL);

			pUnk->Release();
		}	
	}
}


STDMETHODIMP CShutdownSite::AddError(/*[in]*/ IUnknown* pUnk)
{
	INightSecErrorPtr pErr = pUnk;

	if(pErr)
		return m_log.AddItem(pErr) ? S_OK : E_FAIL;

	return E_NOINTERFACE;
}

STDMETHODIMP CShutdownSite::HasErrors(/*[out, retval]*/ BOOL* pbRet)
{
	*pbRet = m_log.HasErrors() ? TRUE : FALSE;
	return S_OK;
}