All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
// PluginAdapterV1.cpp : Implementation of cPluginAdapterV1
|
|
#include "stdafx.h"
|
|
#include "Inject.h"
|
|
#include "PluginAdapterV1.h"
|
|
|
|
#include "Manager.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// cPluginAdapterV1
|
|
|
|
STDMETHODIMP cPluginAdapterV1::Initialize(IPluginSite2 *pSite2)
|
|
{
|
|
// First retreive the Inject service
|
|
CComPtr< IDecal > pDecal;
|
|
pSite2->get_Decal ( &pDecal );
|
|
|
|
CComPtr< IInjectService > pInject;
|
|
HRESULT hRes = pDecal->get_Object ( _bstr_t ( _T( "services\\DecalPlugins.InjectService" ) ),
|
|
__uuidof ( IInjectService ), reinterpret_cast< LPVOID * > ( &pInject ) );
|
|
|
|
if ( FAILED ( hRes ) )
|
|
return hRes;
|
|
|
|
// Try to initialize our plugin
|
|
CComPtr< IPlugin > pPlugin;
|
|
hRes = m_pUnkPlugin->QueryInterface ( &pPlugin );
|
|
if ( FAILED ( hRes ) )
|
|
return hRes;
|
|
|
|
CComPtr< IPluginSite > pSite;
|
|
pInject->get_Site ( &pSite );
|
|
|
|
try
|
|
{
|
|
pPlugin->Initialize ( pSite, 0 );
|
|
}
|
|
catch ( ... )
|
|
{
|
|
return E_FAIL;
|
|
}
|
|
|
|
pInject->InitPlugin ( m_pUnkPlugin );
|
|
|
|
// Store the site if everything is OK
|
|
m_pSite2 = pSite2;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP cPluginAdapterV1::Terminate()
|
|
{
|
|
CComPtr< IPlugin > pPlugin;
|
|
|
|
if ( SUCCEEDED ( m_pUnkPlugin->QueryInterface ( &pPlugin ) ) )
|
|
pPlugin->Terminate ();
|
|
|
|
m_pUnkPlugin.Release ();
|
|
m_pSite2.Release ();
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP cPluginAdapterV1::CreateInstance(IDecalEnum *pEnum, REFIID riid, LPVOID *ppvItf)
|
|
{
|
|
CLSID clsidV1;
|
|
HRESULT hRes = pEnum->get_ComClass ( &clsidV1 );
|
|
if ( FAILED( hRes ) )
|
|
return hRes;
|
|
|
|
hRes = ::CoCreateInstance ( clsidV1, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, reinterpret_cast< LPVOID * > ( &m_pUnkPlugin ) );
|
|
if ( FAILED ( hRes ) )
|
|
return hRes;
|
|
|
|
return static_cast< IDecalSurrogate * > ( this )->QueryInterface ( riid, ppvItf );
|
|
}
|