reactos/dll/directx/bdaplgin/bdaplgin.cpp
Amine Khaldi a00acb2a1b Sync with trunk head
svn path=/branches/header-work/; revision=46021
2010-03-09 00:19:55 +00:00

110 lines
1.9 KiB
C++

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS BDA Proxy
* FILE: dll/directx/bdaplgin/classfactory.cpp
* PURPOSE: ClassFactory interface
*
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/
#include "precomp.h"
const GUID CBDADeviceControl_GUID = {STATIC_KSMETHODSETID_BdaChangeSync};
const GUID CBDAPinControl_GUID = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}};
static INTERFACE_TABLE InterfaceTable[] =
{
{&CBDADeviceControl_GUID, CBDADeviceControl_fnConstructor},
{&CBDAPinControl_GUID, CBDAPinControl_fnConstructor},
{NULL, NULL}
};
extern "C"
BOOL
WINAPI
DllMain(
HINSTANCE hInstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
CoInitialize(NULL);
#ifdef BDAPLGIN_TRACE
OutputDebugStringW(L"BDAPLGIN::DllMain()\n");
#endif
DisableThreadLibraryCalls(hInstDLL);
break;
default:
break;
}
return TRUE;
}
extern "C"
KSDDKAPI
HRESULT
WINAPI
DllUnregisterServer(void)
{
return S_OK;
}
extern "C"
KSDDKAPI
HRESULT
WINAPI
DllRegisterServer(void)
{
return S_OK;
}
KSDDKAPI
HRESULT
WINAPI
DllGetClassObject(
REFCLSID rclsid,
REFIID riid,
LPVOID *ppv)
{
UINT i;
HRESULT hres = E_OUTOFMEMORY;
IClassFactory * pcf = NULL;
if (!ppv)
return E_INVALIDARG;
*ppv = NULL;
for (i = 0; InterfaceTable[i].riid; i++)
{
if (IsEqualIID(*InterfaceTable[i].riid, rclsid))
{
pcf = CClassFactory_fnConstructor(InterfaceTable[i].lpfnCI, NULL, NULL);
break;
}
}
if (!pcf)
{
return CLASS_E_CLASSNOTAVAILABLE;
}
hres = pcf->QueryInterface(riid, ppv);
pcf->Release();
return hres;
}
KSDDKAPI
HRESULT
WINAPI
DllCanUnloadNow(void)
{
return S_OK;
}