aboutsummaryrefslogtreecommitdiff
path: root/Src/ie_plugin/WinampFactory.cpp
blob: 3d7cb68b209cec9c51c621c7da3bf41a89b4741e (plain) (blame)
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
#include "WinampFactory.h"
#include "Winamp.h"

//FileTypeRegistrar registrar;

WinampFactory::WinampFactory()
{
}

WinampFactory::~WinampFactory()
{
}

ULONG WinampFactory::AddRef()
{
	return 10;
}

ULONG WinampFactory::Release()
{
	return 10;
}

HRESULT WinampFactory::QueryInterface(REFIID riid, void ** ppAny)
{
	// IID_IUnknown is the REFIID of standard interface IUnknown
	if(riid == IID_IUnknown)
	{
		*ppAny = (IUnknown *)this;
	}
	else if(riid == IID_IClassFactory)
	{
		*ppAny = (IClassFactory *)this;
	}
	else
	{
		*ppAny = NULL;
		return E_NOINTERFACE;
	}

	((IUnknown *)(*ppAny))->AddRef();

	return S_OK;
}

HRESULT WinampFactory::LockServer(BOOL fLock)
{
	return S_OK;
}

HRESULT WinampFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppAny)
{
	if(pUnkOuter != NULL)
	{
		return CLASS_E_NOAGGREGATION;
	}

	Winamp *winamp = new Winamp;
	HRESULT hr = winamp->QueryInterface(riid, ppAny);
	if (FAILED(hr))
		delete winamp;
	return hr;


}