Initial commit: Complete open-source Decal rebuild

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>
This commit is contained in:
erik 2026-02-08 18:27:56 +01:00
commit d1442e3747
1382 changed files with 170725 additions and 0 deletions

2618
Native/Decal/ACHooks.cpp Normal file

File diff suppressed because it is too large Load diff

355
Native/Decal/ACHooks.h Normal file
View file

@ -0,0 +1,355 @@
// ACHooks.h: Definition of the ACHooks class
#ifndef __ACHOOKS_H_
#define __ACHOOKS_H_
#include "resource.h" // main symbols
#include "Decal.h"
#include "DecalManager.h"
#include "DecalCP.h"
// the public key to unencrypt xmls
#include "..\include\DecalKey.h"
// .NET vs VC6.0 Compiler Config
#if _MSC_VER > 1200 // .NET
#import "..\Include\Inject.tlb"
#define IPSite DecalPlugins::IPluginSite
#else // Not .Net
#include "..\inject\Inject.h"
#define IPSite IPluginSite
#endif
struct sMemoryLocation
{
std::string Name;
long Location;
};
// qString struct for internal client strings - this is all cynica_l's work
struct qString
{
void **vTable;
char *Data;
long MaximumLength;
};
struct qSkill {
long vTable;
enum eTrainLevel Trained;
int TotalXP;
int FreePoints;
int Clicks;
int unk1;
int unk2; /* float? percent of total? */
float unk3;
};
struct qVital {
long vTable;
int Clicks;
int unk1;
int TotalXP;
int unk2;
};
struct qAttribute {
long vTable;
int Clicks;
int Start;
int TotalXP;
};
struct qPointerList
{
qPointerList *dd[1];
};
extern "C" bool DispatchChatMessage( char *pText, long *pdwColor );
extern "C" bool DispatchChatText( char *pText );
/////////////////////////////////////////////////////////////////////////////
// ACHooks
class ATL_NO_VTABLE cACHooks :
public CComObjectRoot,
public CComCoClass<cACHooks,&CLSID_ACHooks>,
public IConnectionPointContainerImpl<cACHooks>,
public IDispatchImpl<IACHooks, &IID_IACHooks, &LIBID_Decal>,
public CProxyIACHooksEvents< cACHooks >
{
public:
cACHooks();
~cACHooks();
DECLARE_REGISTRY_RESOURCEID(IDR_ACHooks)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cACHooks)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IACHooks)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cACHooks)
CONNECTION_POINT_ENTRY(DIID_IACHooksEvents)
END_CONNECTION_POINT_MAP()
private:
long* GetCs(long offs=0) ;
void DecryptXML( const char *szPath, std::string &szXML );
long m_Hooks ;
typedef std::map< std::string, sMemoryLocation > LocMap;
LocMap m_mLocationList;
bool m_bDecalRef;
bool m_bIdQueueRef;
bool m_bMismatch;
bool m_bPrevSelect;
long m_lPrevSelect[2];
bool m_bCurrentSelect;
long m_lCurrentSelect[2];
bool m_bChatMessageAddy;
long m_lChatMessageAddy;
bool m_bMouse;
long m_lMouse[4];
bool m_bCastSpell;
long m_lCastSpell;
bool m_bMoveItem;
long m_lMoveItem;
bool m_bSelectItem;
long m_lSelectItem;
bool m_bUseItem;
long m_lUseItem;
bool m_bAllYourBase;
long m_lAllYourBase;
bool m_bSetCombatState;
long m_lSetCombatState;
bool m_bCombatStateOffset;
long m_lCombatStateOffset;
bool m_bChatState;
long m_lChatState;
bool m_bRequestID;
long m_lRequestID;
bool m_bStackCount;
long m_lStackCount;
bool m_bTestFormula;
long m_lTestFormula;
long m_lTestFormulaVTable;
bool m_bVendorID;
long m_lVendorID;
bool m_bBusyState;
long m_lBusyState;
bool m_bBusyStateID;
long m_lBusyStateID;
bool m_bPointerState;
long m_lPointerState;
bool m_bMoveItemEx;
long m_lMoveItemEx;
bool m_bArea3DWidth;
long *m_lpArea3DWidth;
bool m_bArea3DHeight;
long *m_lpArea3DHeight;
bool m_bObjectFromGuid;
long m_lObjectFromGuid;
long m_lObjectFromGuidClass;
bool m_bFaceHeading;
long m_lMovementThingyParent;
long m_lMovementThingyOffset;
long m_lFaceHeading;
bool m_bSetAutorun;
long m_lSetAutorun;
bool m_bInternalStringConstructor;
bool m_bInternalStringDestructor;
bool m_bSendMessageToID;
bool m_bSendMessageToName;
bool m_bSendMessageToMask;
bool m_bLocalChatText;
bool m_bLocalChatEmote;
long m_lInternalStringConstructor;
long m_lInternalStringDestructor;
long m_lSendMessageToID;
long m_lSendMessageToName;
long m_lSendMessageToMask;
long m_lLocalChatText;
long m_lLocalChatEmote;
long m_lVitalBase;
bool m_bGetVital;
long m_lGetVital;
bool m_bGetAttribute;
long m_lGetAttribute;
bool m_bGetSkill;
long m_lGetSkill;
bool m_bLogout;
long m_lLogout;
bool m_bSecureTrade_Add;
long m_lSecureTrade_Add;
bool m_bSecureTrade_Add_Off1;
long m_lSecureTrade_Add_Off1;
bool m_bSecureTrade_Add_Off2;
long m_lSecureTrade_Add_Off2;
bool m_bGetSkillInfo;
long m_lGetSkillInfo, m_lGetSkillInfo_vT;
bool m_bGetAttributeInfo;
long m_lGetAttributeInfo, m_lGetAttributeInfo_vT;
bool m_bGetVitalInfo;
long m_lGetVitalInfo, m_lGetVitalInfo_vT;
bool m_bChatColor;
long m_lChatColor;
bool m_bSelectItemHook;
long m_lSelectItemHook;
bool m_bUstAddItem_Useable;
long m_lUstAddItem;
long m_lUstAddItem_Off1;
long m_lUstAddItem_Off2;
bool m_bRequestShortcircuit;
long m_lRequestShortcircuit1;
long m_lRequestShortcircuit2;
long m_lRequestShortcircuit3;
bool m_bToolTextHook;
long m_lToolTextHJ;
bool m_bToolText2Hook;
long m_lToolText2HJ;
long m_lIdleLoc;
bool m_bIdleLoc;
long m_lSlashDay;
bool m_bSlashDay;
unsigned int m_HooksEx[1];
unsigned int m_HookCount;
CComPtr< IDecal > m_pDecal;
public:
static cACHooks* s_pACHooks;
void InternalObjectDestroyed( DWORD dwGuid );
void InternalSelectItem( DWORD dwID );
void InternalShortcircuit( DWORD dwID );
bool InternalChatText( char *szText );
bool InternalChatMessage( char *szText, long lColor );
void InternalToolText( char *szText, VARIANT_BOOL bError );
void InternalToolTextAppend( char *szText, VARIANT_BOOL bError );
void SetHookEx(enum eAvailableHooksEx HookID);
CComPtr< IKitchenSink > m_pIdQueue;
STDMETHOD(MoveItemEx)(long lObjectID, long lDestinationID);
STDMETHOD(get_PointerState)(long *pVal);
STDMETHOD(get_BusyStateID)(long *pVal);
STDMETHOD(get_BusyState)(long *pVal);
STDMETHOD(get_VendorID)(long *pVal);
STDMETHOD(get_SelectedStackCount)(long lStackCount, long *pVal);
STDMETHOD(put_SelectedStackCount)(long lStackCount, long newVal);
STDMETHOD(GetFellowStats)(long lCharID);
STDMETHOD(UseItemEx)(long UseThis, long OnThis);
STDMETHOD(get_ChatState)(VARIANT_BOOL *pVal);
STDMETHOD(get_CombatState)(long *pVal);
STDMETHOD(SetCombatState)(long pVal);
STDMETHOD(UseItem)(long lObjectID, long lUseState);
STDMETHOD(UseItemRaw)(long lObjectID, long lUseState, long lUseMethod);
STDMETHOD(UseFociSpell)(long UseThis, long OnThis);
STDMETHOD(SelectItem)(long lObjectID);
STDMETHOD(MoveItem)(long lObjectID, long lPackID, long lSlot, VARIANT_BOOL bStack);
STDMETHOD(CastSpell)(long lSpellID, long lObjectID);
STDMETHOD(SetCursorPosition)(long lX, long lY);
STDMETHOD(RawChatOut)(BSTR szText, long lColor);
STDMETHOD(ChatOut)(BSTR szText, long lColor);
STDMETHOD(get_PreviousSelection)(long *pVal);
STDMETHOD(put_PreviousSelection)(long newVal);
STDMETHOD(get_CurrentSelection)(long *pVal);
STDMETHOD(put_CurrentSelection)(long newVal);
STDMETHOD(QueryMemLoc)(BSTR bstrName, long *pVal);
STDMETHOD(get_Heading)(double *pVal);
STDMETHOD(get_Landblock)(long *pVal);
STDMETHOD(get_LocationX)(double *pVal);
STDMETHOD(get_LocationY)(double *pVal);
STDMETHOD(get_LocationZ)(double *pVal);
STDMETHOD(DropItem)(long lObjectID);
STDMETHOD(get_HooksAvail)(long *pVal) ;
STDMETHOD(FaceHeading)(float fHeading, VARIANT_BOOL bUnknown, VARIANT_BOOL *pRetval);
STDMETHOD(get_Area3DWidth)(long *pVal);
STDMETHOD(get_Area3DHeight)(long *pVal);
STDMETHOD(ItemIsKnown)(long lGUID, VARIANT_BOOL* pRetval) ;
STDMETHOD(SendTell)(long lPlayerID, BSTR Message);
STDMETHOD(SendTellEx)(BSTR Name, BSTR Message);
STDMETHOD(SetAutorun)(VARIANT_BOOL bOnOff) ;
STDMETHOD(get_Vital)(long Vital, long* pVal);
STDMETHOD(get_Attribute)(long Attribute, long* pVal);
STDMETHOD(get_Skill)(long Skill, long* pVal);
STDMETHOD(LocalChatText)(BSTR Text);
STDMETHOD(LocalChatEmote)(BSTR EmoteText);
STDMETHOD(get_HooksAvailEx)(enum eAvailableHooksEx HookID, VARIANT_BOOL* pVal);
STDMETHOD(Logout)();
STDMETHOD(ToolText)(BSTR Text, VARIANT_BOOL bError);
STDMETHOD(ToolTextAppend)(BSTR Text, VARIANT_BOOL bError);
STDMETHOD(SetIdleTime)( double dIdleTimeout );
STDMETHOD(SetDecal)(IUnknown *pDecal);
STDMETHOD(SecureTrade_Add)(long ItemID, VARIANT_BOOL *pVal);
STDMETHOD(get_SkillTrainLevel)( eSkill SkillID, eTrainLevel *pVal );
STDMETHOD(get_SkillTotalXP)( eSkill SkillID, int *pVal );
STDMETHOD(get_SkillFreePoints)( eSkill SkillID, int *pVal );
STDMETHOD(get_SkillClicks)( eSkill SkillID, int *pVal );
STDMETHOD(get_AttributeClicks)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_AttributeTotalXP)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_AttributeStart)( eAttribute AttributeID, int *pVal );
STDMETHOD(get_VitalClicks)( eVital VitalID, int *pVal );
STDMETHOD(get_VitalTotalXP)( eVital VitalID, int *pVal );
HRESULT GetSkillInfo(eSkill SkillID, struct qSkill *Skill);
HRESULT GetAttributeInfo(eAttribute AttributeID, struct qAttribute *Attribute);
HRESULT GetVitalInfo(eVital VitalID, struct qVital *Vital);
STDMETHOD(RequestID)(long lObjectID);
STDMETHOD(IDQueueAdd)(long lObjectID);
STDMETHOD(SetIDFilter)(IKitchenSink* pIDFilter);
STDMETHOD(UstAddItem)(long lObjectID);
STDMETHOD(SendMessageByMask)(LONG lMask, BSTR szMessage);
STDMETHOD(SetDay)(VARIANT_BOOL bDay);
};
#endif // __ACHOOKS_H_

23
Native/Decal/ACHooks.rgs Normal file
View file

@ -0,0 +1,23 @@
HKCR
{
Decal.ACHooks.1 = s 'ACHooks Class'
{
CLSID = s '{CB8875CD-ABC2-42AD-8175-8908706EED37}'
}
Decal.ACHooks = s 'ACHooks Class'
{
CLSID = s '{CB8875CD-ABC2-42AD-8175-8908706EED37}'
}
NoRemove CLSID
{
ForceRemove {CB8875CD-ABC2-42AD-8175-8908706EED37} = s 'ACHooks Class'
{
ProgID = s 'Decal.ACHooks.1'
VersionIndependentProgID = s 'Decal.ACHooks'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'both'
}
}
}
}

View file

@ -0,0 +1,194 @@
// ActiveXSurrogate.cpp : Implementation of cActiveXSurrogate
#include "stdafx.h"
#include "Decal.h"
#include "ActiveXSurrogate.h"
// Duplicated from Inject.h to prevent circular dependency
class IPluginSite;
class __declspec(uuid("{BA3E677F-8E44-4829-982E-58BBBC5C5F9B}")) IPlugin
: public IUnknown
{
public:
STDMETHOD(Initialize)(IPluginSite *pSite, long) = 0;
STDMETHOD(Terminate)() = 0;
STDMETHOD(get_FriendlyName)(BSTR *pstrName) = 0;
};
/////////////////////////////////////////////////////////////////////////////
// cActiveXSurrogate
typedef HRESULT (__stdcall *pfnDllRegisterServer)();
typedef HRESULT (__stdcall *pfnDllUnregisterServer)();
STDMETHODIMP cActiveXSurrogate::Register(BSTR strFilename)
{
USES_CONVERSION;
LPCTSTR szFilename = OLE2T( strFilename );
// First, register the library
HMODULE hLib = ::LoadLibrary( szFilename );
if( hLib == NULL )
return E_FAIL;
pfnDllRegisterServer pfnReg = reinterpret_cast< pfnDllRegisterServer >( ::GetProcAddress( hLib, _T( "DllRegisterServer" ) ) );
HRESULT hRes = E_FAIL;
if( pfnReg != NULL )
hRes = pfnReg();
::FreeLibrary( hLib );
if( FAILED( hRes ) )
return hRes;
// Next open up the type library and look for suitable classes, they have
// to be creatable - then we make one and see if it implements IPlugin2
CComPtr< ITypeLib > pTypeLib;
hRes = ::LoadTypeLib( strFilename, &pTypeLib );
if( FAILED( hRes ) )
return hRes;
UINT nTypeInfoCount = pTypeLib->GetTypeInfoCount();
int nFound = 0;
for( UINT i = 0; i < nTypeInfoCount; ++ i )
{
TYPEKIND tk;
pTypeLib->GetTypeInfoType( i, &tk );
if( tk != TKIND_COCLASS )
// Only coclasses
continue;
CComPtr< ITypeInfo > pClass1;
pTypeLib->GetTypeInfo( i, &pClass1 );
TYPEATTR *pta;
pClass1->GetTypeAttr( &pta );
if( pta->wTypeFlags & TYPEFLAG_FCANCREATE )
{
// Create an instance of the plugin and see if it implements IPlugin
CComPtr< IUnknown > pUnkPlugin;
HRESULT hRes = pClass1->CreateInstance ( NULL, IID_IUnknown, reinterpret_cast< LPVOID * > ( &pUnkPlugin ) );
if ( SUCCEEDED ( hRes ) )
{
// Check for the IPlugin2 interface
CComPtr< IPlugin2 > pPlugin2;
if ( SUCCEEDED ( pUnkPlugin->QueryInterface ( &pPlugin2 ) ) )
{
// This is a plugin (anything that implements IPlugin2 is a plugin afterall, make the registry key
LPCSTR szCLSID;
LPOLESTR strCLSID;
::StringFromCLSID( pta->guid, &strCLSID );
szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
TCHAR szRegKey[ 255 ];
::_tcscat ( ::_tcscpy ( szRegKey, _T( "Software\\Decal\\Plugins\\" ) ), szCLSID );
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, szRegKey );
CComBSTR strDescription;
pClass1->GetDocumentation( MEMBERID_NIL, NULL, &strDescription, NULL, NULL );
key.SetStringValue( NULL, OLE2T( strDescription ) );
key.SetStringValue( _T("File"), szFilename );
key.SetDWORDValue( _T( "Enabled" ), 1 );
key.SetStringValue( _T("Uninstall"), _T( "{7559F22F-C56F-4621-AE08-9C354D799D4B}" ) );
++ nFound;
}
else
{
CComPtr< IPlugin > pPlugin;
if ( SUCCEEDED( pUnkPlugin->QueryInterface ( &pPlugin ) ) )
{
// This is a V1 plugin - same registration, but use a surrogate
LPCSTR szCLSID;
LPOLESTR strCLSID;
::StringFromCLSID( pta->guid, &strCLSID );
szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
TCHAR szRegKey[ 255 ];
::_tcscat ( ::_tcscpy ( szRegKey, _T( "Software\\Decal\\Plugins\\" ) ), szCLSID );
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, szRegKey );
CComBSTR strDescription;
pPlugin->get_FriendlyName( &strDescription );
// Friendly name
key.SetStringValue( NULL, OLE2T( strDescription ) );
// File for uninstalling
key.SetStringValue( _T( "File" ), szFilename );
// Enabled by default
key.SetDWORDValue( _T( "Enabled" ), 1 );
// This object uninstalls
key.SetStringValue( _T("Uninstall"), _T( "{7559F22F-C56F-4621-AE08-9C354D799D4B}" ));
// The V1 surrogate
key.SetStringValue( _T( "Surrogate" ), _T( "{3D837F6E-B5CA-4604-885F-7AB45FCFA62A}" ) );
++ nFound;
}
}
}
}
pClass1->ReleaseTypeAttr( pta );
}
return ( nFound > 0 ) ? S_OK : E_FAIL;
}
STDMETHODIMP cActiveXSurrogate::Uninstall()
{
USES_CONVERSION;
TCHAR szParent[ 255 ];
::_tcscat ( ::_tcscpy ( szParent, _T( "Software\\Decal\\Plugins\\" ) ), OLE2T( m_strGroup ) );
RegKey rk;
if( rk.Open( HKEY_LOCAL_MACHINE, szParent ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
LPOLESTR strCLSID;
::StringFromCLSID( m_clsid, &strCLSID );
LPTSTR szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
if( rk.RecurseDeleteKey( szCLSID ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
// Load the library and call DLL unreg server
LPCTSTR szFilename = OLE2T( m_strFile );
// First, register the library
HMODULE hLib = ::LoadLibrary( szFilename );
if( hLib == NULL )
return E_FAIL;
pfnDllUnregisterServer pfnReg = reinterpret_cast< pfnDllUnregisterServer >( ::GetProcAddress( hLib, _T( "DllUnregisterServer" ) ) );
HRESULT hRes = E_FAIL;
if( pfnReg != NULL )
hRes = pfnReg();
::FreeLibrary( hLib );
// Just call this to make sure the library isn't locked so the user
// can delete it after this point.
::CoFreeUnusedLibraries();
return hRes;
}

View file

@ -0,0 +1,84 @@
// ActiveXSurrogate.h : Declaration of the cActiveXSurrogate
#ifndef __ACTIVEXSURROGATE_H_
#define __ACTIVEXSURROGATE_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cActiveXSurrogate
class ATL_NO_VTABLE cActiveXSurrogate :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cActiveXSurrogate, &CLSID_ActiveXSurrogate>,
public IDecalFileSurrogate,
public IDecalUninstall
{
public:
cActiveXSurrogate()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_ACTIVEXSURROGATE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cActiveXSurrogate)
COM_INTERFACE_ENTRY(IDecalFileSurrogate)
COM_INTERFACE_ENTRY(IDecalUninstall)
END_COM_MAP()
CComBSTR m_strFile;
CComBSTR m_strGroup;
CLSID m_clsid;
public:
// IDecalFileSurrogate
STDMETHOD(get_Extension)( BSTR *pVal )
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = T2BSTR( _T( "dll" ) );
return S_OK;
}
STDMETHOD(get_Description)( BSTR *pVal )
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = T2BSTR( _T( "ActiveX Plugin" ) );
return S_OK;
}
STDMETHOD(Register)(BSTR strFilename);
// IDecalUninstall
STDMETHOD(Prepare)( IDecalEnum *pEnum )
{
// Get the class
pEnum->get_ComClass( &m_clsid );
// Get the file
static _bstr_t _strFile( _T( "File" ) );
CComVariant vFile;
pEnum->get_Property( _strFile, &vFile );
m_strFile = vFile.bstrVal;
// Get the group
pEnum->get_Group( &m_strGroup );
return S_OK;
}
STDMETHOD(Uninstall)();
};
#endif //__ACTIVEXSURROGATE_H_

View file

@ -0,0 +1,44 @@
HKCR
{
Decal.ActiveXSurrogate.1 = s 'ActiveXSurrogate Class'
{
CLSID = s '{7559F22F-C56F-4621-AE08-9C354D799D4B}'
}
Decal.ActiveXSurrogate = s 'ActiveXSurrogate Class'
{
CLSID = s '{7559F22F-C56F-4621-AE08-9C354D799D4B}'
CurVer = s 'Decal.ActiveXSurrogate.1'
}
NoRemove CLSID
{
ForceRemove {7559F22F-C56F-4621-AE08-9C354D799D4B} = s 'ActiveXSurrogate Class'
{
ProgID = s 'Decal.ActiveXSurrogate.1'
VersionIndependentProgID = s 'Decal.ActiveXSurrogate'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}
HKLM
{
NoRemove SOFTWARE
{
NoRemove Decal
{
NoRemove Surrogates
{
ForceRemove {7559F22F-C56F-4621-AE08-9C354D799D4B} = s 'ActiveX Plugin Surrogate'
{
val Enabled = d '1'
val Extension = s 'dll'
val Description = s 'ActiveX Surrogate'
}
}
}
}
}

79
Native/Decal/Decal.cpp Normal file
View file

@ -0,0 +1,79 @@
// Decal.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f Decalps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include <Decal.h>
#include <Decal_i.c>
#include "DecalManager.h"
#include "SurrogateRemove.h"
#include "ActiveXSurrogate.h"
#include "DecalRes.h"
#include "ACHooks.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Decal, cDecal)
OBJECT_ENTRY(CLSID_SurrogateRemove, cSurrogateRemove)
OBJECT_ENTRY(CLSID_ActiveXSurrogate, cActiveXSurrogate)
OBJECT_ENTRY(CLSID_DecalRes, cDecalRes)
OBJECT_ENTRY(CLSID_ACHooks, cACHooks)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_Decal);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
_Module.Term();
}
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}

9
Native/Decal/Decal.def Normal file
View file

@ -0,0 +1,9 @@
; Decal.def : Declares the module parameters.
LIBRARY "Decal.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

263
Native/Decal/Decal.dsp Normal file
View file

@ -0,0 +1,263 @@
# Microsoft Developer Studio Project File - Name="Decal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=Decal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Decal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Decal.mak" CFG="Decal - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Decal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Decal - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Decal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib version.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\..\Debug
TargetPath=\Decal\source\Debug\Decal.dll
InputPath=\Decal\source\Debug\Decal.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "Decal - Win32 Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinSize"
# PROP BASE Intermediate_Dir "ReleaseMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "ReleaseMinSize"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /Zi /Oa /Og /Oi /Os /Oy /Ob1 /Gf /Gy /I "..\Include" /D "_MBCS" /D "_ATL_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /c
# ADD MTL /nologo /I "..\Include" /Oicf
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib version.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcmt.lib" /pdbtype:sept /libpath:"..\Release"
# Begin Custom Build - Performing registration
OutDir=.\..\Release
TargetPath=\Decal\source\Release\Decal.dll
InputPath=\Decal\source\Release\Decal.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ENDIF
# Begin Target
# Name "Decal - Win32 Debug"
# Name "Decal - Win32 Release MinSize"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ACHooks.cpp
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.cpp
# End Source File
# Begin Source File
SOURCE=.\Decal.cpp
# End Source File
# Begin Source File
SOURCE=.\Decal.def
# End Source File
# Begin Source File
SOURCE=..\Include\Decal.idl
!IF "$(CFG)" == "Decal - Win32 Debug"
# ADD MTL /nologo /tlb "Decal.tlb" /h "..\Include\Decal.h" /iid "..\Include\Decal_i.c" /Oicf
!ELSEIF "$(CFG)" == "Decal - Win32 Release MinSize"
# ADD MTL /tlb "Decal.tlb" /h "..\Include\Decal.h" /iid "..\Include\Decal_i.c" /Oicf
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\Decal.rc
# End Source File
# Begin Source File
SOURCE=.\DecalEnum.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalManager.cpp
# End Source File
# Begin Source File
SOURCE=.\DecalRes.cpp
# End Source File
# Begin Source File
SOURCE=.\PluginSite.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ACHooks.h
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.h
# End Source File
# Begin Source File
SOURCE=..\Include\ApiHook.h
# End Source File
# Begin Source File
SOURCE=.\DecalCP.h
# End Source File
# Begin Source File
SOURCE=.\DecalEnum.h
# End Source File
# Begin Source File
SOURCE=..\Include\DecalImpl.h
# End Source File
# Begin Source File
SOURCE=.\DecalManager.h
# End Source File
# Begin Source File
SOURCE=.\DecalRes.h
# End Source File
# Begin Source File
SOURCE=.\DecalVersion.h
# End Source File
# Begin Source File
SOURCE=.\PluginSite.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\ACHooks.rgs
# End Source File
# Begin Source File
SOURCE=.\ActiveXSurrogate.rgs
# End Source File
# Begin Source File
SOURCE=.\Decal.rgs
# End Source File
# Begin Source File
SOURCE=.\DecalNode.rgs
# End Source File
# Begin Source File
SOURCE=.\DecalRes.rgs
# End Source File
# Begin Source File
SOURCE=.\PluginAdapterV1.rgs
# End Source File
# Begin Source File
SOURCE=.\SurrogateRemove.rgs
# End Source File
# End Group
# End Target
# End Project

157
Native/Decal/Decal.rc Normal file
View file

@ -0,0 +1,157 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "..\Include\DecalVersion.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""Decal.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Decal Module"
VALUE "FileVersion", DECAL_VERSION_STRING
VALUE "InternalName", "Decal"
VALUE "LegalCopyright", "Copyright 2001-2002"
VALUE "OriginalFilename", "Decal.DLL"
VALUE "ProductName", "Decal Module"
VALUE "ProductVersion", DECAL_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ACHooks REGISTRY "ACHooks.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "Decal"
IDS_ACHOOKS_DESC "ACHooks Class"
END
STRINGTABLE
BEGIN
IDE_INDEXOUTOFRANGE "The provided index is below 0 or greater than the number of items in the list."
IDE_BADINDEXTYPE "Index type must be an integer or a string."
IDE_CLASSNOTFOUND "The CLSID could not be found in the registry"
IDE_CLASSKEYNOTFOUND "The requested class key could not be found in the registry."
IDE_GROUPKEYNOTOPEN "Could not open group registry key."
IDE_INVALIDSUBKEYS "Could not count the number of subkeys."
IDE_BADITERATOR "The enumeration is before the beginning or after the end."
IDE_MOVEUPTOP "Cannot move up the top entry."
IDE_MOVEDOWNBOTTOM "Cannot move bottom item down."
IDE_SURROGATEDISABLED "The surrogate for this object is disabled, the object cannot be created."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_DECAL REGISTRY "Decal.rgs"
IDR_SURROGATEREMOVE REGISTRY "SurrogateRemove.rgs"
IDR_ACTIVEXSURROGATE REGISTRY "ActiveXSurrogate.rgs"
IDR_DECALRES REGISTRY "DecalRes.rgs"
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "Decal.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

25
Native/Decal/Decal.rgs Normal file
View file

@ -0,0 +1,25 @@
HKCR
{
Decal.Decal.1 = s 'Decal Class'
{
CLSID = s '{4557D5A1-00DB-48F6-ACB3-4FEF30E2F358}'
}
Decal.Decal = s 'Decal Class'
{
CLSID = s '{4557D5A1-00DB-48F6-ACB3-4FEF30E2F358}'
CurVer = s 'Decal.Decal.1'
}
NoRemove CLSID
{
ForceRemove {4557D5A1-00DB-48F6-ACB3-4FEF30E2F358} = s 'Decal Class'
{
ProgID = s 'Decal.Decal.1'
VersionIndependentProgID = s 'Decal.Decal'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

987
Native/Decal/Decal.vcproj Normal file
View file

@ -0,0 +1,987 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Decal"
SccProjectName=""
SccLocalPath=""
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/Decal.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Debug/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Debug/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Debug/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Debug/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release MinSize|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\ReleaseMinSize"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseMinSize/"
ObjectFile=".\ReleaseMinSize/"
ProgramDataBaseFileName=".\ReleaseMinSize/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Release/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Unicode Release MinSize|Win32"
OutputDirectory=".\ReleaseUMinSize"
IntermediateDirectory=".\ReleaseUMinSize"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="2"
ATLMinimizesCRunTimeLibraryUsage="TRUE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseUMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseUMinSize/"
ObjectFile=".\ReleaseUMinSize/"
ProgramDataBaseFileName=".\ReleaseUMinSize/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib libctiny.lib"
OutputFile=".\ReleaseUMinSize/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\ReleaseUMinSize/Decal.pdb"
SubSystem="2"
ImportLibrary=".\ReleaseUMinSize/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\ReleaseUMinSize/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Unicode Debug|Win32"
OutputDirectory=".\DebugU"
IntermediateDirectory=".\DebugU"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\DebugU/Decal.pch"
AssemblerListingLocation=".\DebugU/"
ObjectFile=".\DebugU/"
ProgramDataBaseFileName=".\DebugU/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\DebugU/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\DebugU/Decal.pdb"
SubSystem="2"
ImportLibrary=".\DebugU/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\DebugU/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release MinDependency|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\ReleaseMinSize/Decal.pch"
AssemblerListingLocation=".\ReleaseMinDependency/"
ObjectFile=".\ReleaseMinDependency/"
ProgramDataBaseFileName=".\ReleaseMinDependency/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Release/Decal.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Release"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\Decal.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/Decal.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/Decal.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/Decal.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="ACHooks.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="ActiveXSurrogate.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.def">
</File>
<File
RelativePath="..\Include\Decal.idl">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories=""
TargetEnvironment="1"
TypeLibraryName="Decal.tlb"
HeaderFileName="..\Include\Decal.h"
InterfaceIdentifierFileName="..\Include\Decal_i.c"/>
</FileConfiguration>
</File>
<File
RelativePath="Decal.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;$(NoInherit)"
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;$(NoInherit)"
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalEnum.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalManager.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="DecalRes.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="PluginSite.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="SurrogateRemove.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Release MinSize|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_UNICODE;_ATL_DLL;_ATL_MIN_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
ExceptionHandling="TRUE"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Unicode Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_UNICODE;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release MinDependency|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_MBCS;_ATL_DLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="ACHooks.h">
</File>
<File
RelativePath="ActiveXSurrogate.h">
</File>
<File
RelativePath="..\Include\ApiHook.h">
</File>
<File
RelativePath="DecalCP.h">
</File>
<File
RelativePath="DecalEnum.h">
</File>
<File
RelativePath="..\Include\DecalImpl.h">
</File>
<File
RelativePath="..\Include\DecalKey.h">
</File>
<File
RelativePath="DecalManager.h">
</File>
<File
RelativePath="DecalRes.h">
</File>
<File
RelativePath="..\Include\DecalVersion.h">
</File>
<File
RelativePath="PluginSite.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="SurrogateRemove.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="ACHooks.rgs">
</File>
<File
RelativePath="ActiveXSurrogate.rgs">
</File>
<File
RelativePath="Decal.rgs">
</File>
<File
RelativePath="DecalNode.rgs">
</File>
<File
RelativePath="DecalRes.rgs">
</File>
<File
RelativePath="PluginAdapterV1.rgs">
</File>
<File
RelativePath="SurrogateRemove.rgs">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

202
Native/Decal/DecalCP.h Normal file
View file

@ -0,0 +1,202 @@
#ifndef _DECALCP_H_
#define _DECALCP_H_
template <class T>
class CProxyIACHooksEvents : public IConnectionPointImpl<T, &DIID_IACHooksEvents, CComDynamicUnkArray>
{
public:
HRESULT Fire_ObjectDestroyed(LONG guid)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = guid;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
VARIANT_BOOL Fire_OnChatBoxMessage(BSTR bstrText, LONG lColor)
{
VARIANT_BOOL bEatProc = VARIANT_FALSE;
VARIANT_BOOL bEatLocal = VARIANT_FALSE;
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = reinterpret_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bEatLocal;
CComVariant avarParams[3];
avarParams[2] = bstrText;
avarParams[1] = lColor;
avarParams[0] = vt;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 3, 0 };
hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
if( bEatLocal == VARIANT_TRUE )
bEatProc = VARIANT_TRUE;
}
}
return bEatProc;
}
VARIANT_BOOL Fire_OnCommandLineText( BSTR bstrText )
{
VARIANT_BOOL bEatProc = VARIANT_FALSE;
VARIANT_BOOL bEatLocal = VARIANT_FALSE;
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = reinterpret_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bEatLocal;
CComVariant avarParams[2];
avarParams[1] = bstrText;
avarParams[0] = vt;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 2, 0 };
hr = pConnection->Invoke(3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
if( bEatLocal == VARIANT_TRUE )
bEatProc = VARIANT_TRUE;
}
}
return bEatProc;
}
HRESULT Fire_OnSelectItem(LONG guid)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = guid;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
void Fire_OnToolText(BSTR bstrText, VARIANT_BOOL bError)
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bError;
pvars[1] = bstrText;
pvars[0] = vt;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
void Fire_OnToolTextAppend(BSTR bstrText, VARIANT_BOOL bError)
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
// operator= doesn't accept VARIANT_BOOL *
VARIANT vt;
::VariantInit(&vt);
vt.vt = VT_BYREF | VT_BOOL;
vt.pboolVal = &bError;
pvars[1] = bstrText;
pvars[0] = vt;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
};
#endif

519
Native/Decal/DecalEnum.cpp Normal file
View file

@ -0,0 +1,519 @@
// DecalEnum.cpp : Implementation of cDecalEnum
#include "stdafx.h"
#include "Decal.h"
#include "DecalEnum.h"
/////////////////////////////////////////////////////////////////////////////
// cDecalEnum
cDecalEnum::~cDecalEnum()
{
// Write out the order if there were changes
if ( !m_bOrderChanged )
return;
USES_CONVERSION;
std::string strOrder;
strOrder.reserve ( m_keys.size () );
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
strOrder += i->m_letter;
// Compile the new order from the
RegKey hkGroup;
if( hkGroup.Create( HKEY_LOCAL_MACHINE, m_strGroupKey.c_str() ) != ERROR_SUCCESS )
{
_ASSERTE ( FALSE );
return;
}
hkGroup.SetStringValue (_T("Order"), strOrder.c_str ());
}
bool cDecalEnum::Initialize( IDecal *pDecal, BSTR strKey )
{
_ASSERTE( pDecal != NULL );
USES_CONVERSION;
m_strGroupKey = "SOFTWARE\\Decal\\";
m_strGroupKey += OLE2A( strKey );
m_strGroup = strKey;
m_pDecal = pDecal;
m_nIndex = -1;
m_bOrderChanged = false;
return true;
}
HRESULT cDecalEnum::Advance( REFCLSID clsid )
{
// Assign a dummy letter
cKeyEntry ke;
ke.m_clsid = clsid;
ke.m_letter = _T( 'A' );
m_keys.reserve ( 1 );
m_keys.push_back ( ke );
return openKeyAt ( 0 );
}
HRESULT cDecalEnum::Begin()
{
USES_CONVERSION;
// Load and sort the list
RegKey hkGroup;
if( hkGroup.Create( HKEY_LOCAL_MACHINE, m_strGroupKey.c_str() ) != ERROR_SUCCESS )
return Error ( IDE_GROUPKEYNOTOPEN );
// Load the order string and prepare a new item string
std::string strIdentifiers( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,./;'[]-=`<>?:{}|_+`!@#$%^&*()" );
DWORD nMaxOrder = strIdentifiers.length ();
LPTSTR szOrder = reinterpret_cast< LPTSTR > ( _alloca ( sizeof ( TCHAR ) * nMaxOrder ) );
// Count the number of subkeys
DWORD dwSubkeys;
if ( ::RegQueryInfoKey ( hkGroup, NULL, NULL, NULL, &dwSubkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) != ERROR_SUCCESS )
return Error ( IDE_INVALIDSUBKEYS );
m_keys.reserve ( dwSubkeys );
LPTSTR szEndOrder;
// Load an existing order
if ( hkGroup.QueryStringValue (_T("Order"), szOrder, &nMaxOrder) == ERROR_SUCCESS )
{
szEndOrder = szOrder + ( nMaxOrder - 1 );
// Sort and merge the differences
std::string strOrder ( szOrder, szEndOrder );
std::sort ( strOrder.begin (), strOrder.end () );
std::string strMerged;
strMerged.reserve ( strIdentifiers.length () - ( nMaxOrder - 1 ) );
std::set_difference ( strIdentifiers.begin (), strIdentifiers.end (), strOrder.begin (), strOrder.end (), std::inserter ( strMerged, strMerged.end() ) );
// Reset the identifiers to exclude the currently used ones
strIdentifiers.swap ( strMerged );
}
else
{
szOrder[ 0 ] = _T( '\0' );
szEndOrder = szOrder;
}
std::string::iterator iNextID = strIdentifiers.begin ();
// Now we walk through the subkeys and insert in order
TCHAR szCLSID[ 64 ];
for ( int i = 0; ::RegEnumKey ( hkGroup, i, szCLSID, sizeof ( szCLSID ) ) == ERROR_SUCCESS; ++ i )
{
CLSID clsid;
HRESULT hRes = ::CLSIDFromString ( T2OLE ( szCLSID ), &clsid );
if ( FAILED ( hRes ) )
// Skip non-CLSID keys
continue;
RegKey hkItem;
if ( hkItem.Open ( hkGroup, szCLSID ) != ERROR_SUCCESS )
continue;
// Attempt to read the sequence indicator
TCHAR szSequence[ 4 ];
DWORD dwSequence = sizeof ( szSequence );
cKeyEntry ke;
ke.m_clsid = clsid;
if ( hkItem.QueryStringValue ( _T( "Order" ), szSequence, &dwSequence ) == ERROR_SUCCESS )
{
_ASSERTE ( szSequence[ 1 ] == _T( '\0' ) );
ke.m_letter = *szSequence;
insertKey ( ke, szOrder, szEndOrder );
continue;
}
// There's no sequence current, add on to the end
_ASSERTE ( iNextID != strIdentifiers.end () );
ke.m_letter = *( iNextID ++ );
m_keys.push_back ( ke );
TCHAR szVal[ 2 ] = { ke.m_letter, _T( '\0' ) };
hkItem.SetStringValue ( _T( "Order" ), szVal );
// The sequence is changed by adding items
m_bOrderChanged = true;
}
return S_OK;
}
void cDecalEnum::insertKey ( cKeyEntry &ke, TCHAR *szOrder, TCHAR *szEndOrder )
{
// Insert the item in the correct order into the list - first
// find the sequence number in the list
for ( TCHAR *szOrderIndex = szOrder; szOrderIndex != szEndOrder; ++ szOrderIndex )
if ( *szOrderIndex == ke.m_letter )
break;
if ( szOrderIndex == szEndOrder )
{
// This item is last, don't search for anything after
m_keys.push_back ( ke );
return;
}
// We have an insert, search for the member to insert before
for ( szOrderIndex = szOrderIndex + 1; szOrderIndex != szEndOrder; ++ szOrderIndex )
{
// Search for a matchinf item in the array
for ( cKeyList::iterator j = m_keys.begin(); j != m_keys.end(); ++ j )
{
if ( j->m_letter == *szOrderIndex )
{
m_keys.insert ( j, ke );
return;
}
}
}
// The next entry most likely hasn't been loaded yet - just append
m_keys.push_back ( ke );
}
HRESULT cDecalEnum::openKeyAt ( int nIndex )
{
USES_CONVERSION;
if ( m_key.m_hKey != NULL )
m_key.Close ();
LPOLESTR strClsid;
::StringFromCLSID( m_keys[ nIndex ].m_clsid, &strClsid );
LPCTSTR szClsid = OLE2T( strClsid );
::CoTaskMemFree( strClsid );
std::string strItemKey = m_strGroupKey + _T( "\\" );
strItemKey += szClsid;
if ( m_key.Open ( HKEY_LOCAL_MACHINE, strItemKey.c_str () ) != ERROR_SUCCESS )
return Error ( IDE_CLASSKEYNOTFOUND );
m_nIndex = nIndex;
return S_OK;
}
STDMETHODIMP cDecalEnum::get_FriendlyName(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( NULL, szName, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
*pVal = T2BSTR( szName );
return S_OK;
}
STDMETHODIMP cDecalEnum::get_ComClass(CLSID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
*pVal = m_keys[ m_nIndex ].m_clsid;
return S_OK;
}
STDMETHODIMP cDecalEnum::get_Enabled(VARIANT_BOOL *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
DWORD dwEnabled;
if( m_key.QueryDWORDValue( _T("Enabled"), dwEnabled ) != ERROR_SUCCESS )
// Plugins are enabled when this value is ommitted
dwEnabled = TRUE;
*pVal = ( dwEnabled ) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP cDecalEnum::put_Enabled(VARIANT_BOOL newVal)
{
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
if( m_key.SetDWORDValue( _T( "Enabled" ), ( ( newVal ) ? 1 : 0 ) ) != ERROR_SUCCESS )
return E_FAIL;
return S_OK;
}
STDMETHODIMP cDecalEnum::CreateInstance(REFIID iid, LPVOID *ppvItf)
{
CLSID clsidSurrogate;
if( FAILED( get_SurrogateClass( &clsidSurrogate ) ) )
{
_ASSERT( FALSE );
return E_FAIL;
}
if( clsidSurrogate == GUID_NULL )
{
// Create the object without a surrogate
CLSID clsidObject;
HRESULT hRes = get_ComClass( &clsidObject );
if( FAILED( hRes ) )
return hRes;
return ::CoCreateInstance( clsidObject, NULL, CLSCTX_INPROC_SERVER, iid, ppvItf );
}
// Create the surrogate object
CComPtr< IDecalEnum > pEnum;
static _bstr_t _strSurrogates ( _T( "Surrogates" ) );
HRESULT hRes = m_pDecal->get_Configuration ( _strSurrogates, clsidSurrogate, &pEnum );
if ( !SUCCEEDED ( hRes ) )
return hRes;
VARIANT_BOOL bEnabled;
hRes = pEnum->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
if ( !bEnabled )
return Error ( IDE_SURROGATEDISABLED );
CComPtr< IDecalSurrogate > pSurrogate;
hRes = pEnum->CreateInstance ( IID_IDecalSurrogate, reinterpret_cast< LPVOID * > ( &pSurrogate ) );
if( FAILED( hRes ) )
return hRes;
return pSurrogate->CreateInstance( this, iid, ppvItf );
}
STDMETHODIMP cDecalEnum::Next()
{
if ( m_nIndex == m_keys.size () - 1 )
{
// End of iteration
if ( m_key.m_hKey != NULL )
m_key.Close ();
return S_FALSE;
}
return openKeyAt ( m_nIndex + 1 );
}
STDMETHODIMP cDecalEnum::get_SurrogateClass(CLSID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH + 1 ];
DWORD dwSize = MAX_PATH + 1;
if( m_key.QueryStringValue( _T("Surrogate"), szName, &dwSize ) != ERROR_SUCCESS )
{
// If the surrogate is not found, return the NULL guid
*pVal = GUID_NULL;
return S_OK;
}
return ::CLSIDFromString( T2OLE( szName ), pVal );
}
STDMETHODIMP cDecalEnum::get_ResourcePath(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
TCHAR szName[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( NULL, szName, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
*pVal = T2BSTR( szName );
return S_OK;
}
STDMETHODIMP cDecalEnum::get_Property(BSTR Name, VARIANT *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
USES_CONVERSION;
LPCTSTR szValueName = OLE2T( Name );
// Get some info about the property
DWORD dwDataType;
if( ::RegQueryValueEx( m_key.m_hKey, szValueName, NULL, &dwDataType, NULL, NULL ) != ERROR_SUCCESS )
// We'll assume there's no value
return E_INVALIDARG;
switch( dwDataType )
{
case REG_DWORD:
{
DWORD dwValue;
if( m_key.QueryDWORDValue( szValueName, dwValue ) != ERROR_SUCCESS )
return E_FAIL;
pVal->vt = VT_I4;
pVal->lVal = dwValue;
return S_OK;
}
break;
case REG_EXPAND_SZ:
case REG_SZ:
{
TCHAR szValue[ MAX_PATH ];
DWORD dwSize = MAX_PATH;
if( m_key.QueryStringValue( szValueName, szValue, &dwSize ) != ERROR_SUCCESS )
return E_FAIL;
pVal->vt = VT_BSTR;
pVal->bstrVal = T2BSTR( szValue );
return S_OK;
}
break;
}
return E_INVALIDARG;
}
STDMETHODIMP cDecalEnum::get_Group(BSTR *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
*pVal = OLE2BSTR( m_strGroup );
return S_OK;
}
STDMETHODIMP cDecalEnum::Skip (REFCLSID clsid)
{
// Search our loaded list for the clsid
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
{
if ( clsid == i->m_clsid )
return openKeyAt ( i - m_keys.begin() );
}
return Error ( IDE_CLASSNOTFOUND );
}
STDMETHODIMP cDecalEnum::MoveBefore(REFCLSID clsidBefore)
{
if( m_key.m_hKey == NULL )
{
_ASSERT( FALSE );
return Error ( IDE_BADITERATOR );
}
// Find the entry we're inserting before
for ( cKeyList::iterator i = m_keys.begin (); i != m_keys.end(); ++ i )
{
if ( i->m_clsid == clsidBefore )
break;
}
if ( i == m_keys.end () )
return Error ( IDE_CLASSNOTFOUND );
int nFoundIndex = i - m_keys.begin ();
if ( nFoundIndex == m_nIndex )
// No op
return S_FALSE;
if ( nFoundIndex > m_nIndex )
-- nFoundIndex;
cKeyEntry eRemoved = m_keys[ m_nIndex ];
m_keys.erase ( m_keys.begin () + m_nIndex );
m_keys.insert ( m_keys.begin () + nFoundIndex, eRemoved );
// Reset so we're still on the same item
m_nIndex = nFoundIndex;
m_bOrderChanged = true;
return S_OK;
}

76
Native/Decal/DecalEnum.h Normal file
View file

@ -0,0 +1,76 @@
// DecalEnum.h : Declaration of the cDecalEnum
#ifndef __DECALENUM_H_
#define __DECALENUM_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cDecalEnum
class ATL_NO_VTABLE cDecalEnum :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecalEnum, &CLSID_DecalEnum>,
public IDecalEnum
{
public:
cDecalEnum()
: m_nIndex( -1 )
{
}
~cDecalEnum();
DECLARE_REGISTRY_RESOURCEID(IDR_DECALENUM)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecalEnum)
COM_INTERFACE_ENTRY(IDecalEnum)
END_COM_MAP()
bool Initialize( IDecal *pDecal, BSTR strKey );
// Skip to a single key - next will terminate iteration
HRESULT Advance( REFCLSID clsid );
// Load an ordered list of keys
HRESULT Begin();
struct cKeyEntry
{
CLSID m_clsid;
TCHAR m_letter;
};
void insertKey ( cKeyEntry &ke, TCHAR *szOrder, TCHAR *szEndOrder );
HRESULT openKeyAt ( int nIndex );
typedef std::vector< cKeyEntry > cKeyList;
cKeyList m_keys;
int m_nIndex;
_bstr_t m_strGroup;
std::string m_strGroupKey;
RegKey m_key;
bool m_bOrderChanged;
// This member is purely for holdinga reference to the main decal object
// and keep this object from being orphaned
CComPtr< IDecal > m_pDecal;
// IDecalEnum
public:
STDMETHOD(MoveBefore)(REFCLSID clsidBefore);
STDMETHOD(get_Group)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(get_Property)(BSTR Name, /*[out, retval]*/ VARIANT *pVal);
STDMETHOD(get_ResourcePath)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(get_SurrogateClass)(/*[out, retval]*/ CLSID *pVal);
STDMETHOD(Next)();
STDMETHOD(CreateInstance)(REFIID iid, /*[out, retval, iid_is(iid)]*/ LPVOID *ppvItf);
STDMETHOD(get_Enabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_Enabled)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_ComClass)(/*[out, retval]*/ CLSID *pVal);
STDMETHOD(get_FriendlyName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(Skip)(REFCLSID clsid);
};
#endif //__DECALENUM_H_

View file

@ -0,0 +1,636 @@
// DecalManager.cpp : Implementation of cDecal
#include "stdafx.h"
#include "Decal.h"
#include "DecalManager.h"
#include "DecalEnum.h"
#include "PluginSite.h"
/////////////////////////////////////////////////////////////////////////////
// cDecal
HRESULT cDecal::convertToken( std::string &strToken, std::string &strOut )
{
USES_CONVERSION;
struct cPathRegistry
{
LPCTSTR szToken,
szKey,
szValue;
};
static cPathRegistry _paths[] = {
{ _T( "ac" ), _T( "SOFTWARE\\Microsoft\\Microsoft Games\\Asheron's Call\\1.00" ), _T( "Portal Dat" ) },
{ _T( "decal" ), _T( "SOFTWARE\\Decal\\Agent" ), _T( "AgentPath" ) } },
*_end_paths = _paths + sizeof( _paths ) / sizeof( cPathRegistry );
// There are two types of tokens, ones that contain a colon (object relative)
// and the other kind, which just gets looked up in the registry
int nColon = strToken.find_first_of( _T( ':' ) );
if( nColon == std::string::npos )
{
// Take the whole token string and look it up
for( cPathRegistry *pPath = _paths; pPath != _end_paths; ++ pPath )
{
if( strToken.compare( pPath->szToken ) != 0 )
continue;
// Found the path now look it up in the registry
DWORD dwCount = MAX_PATH;
TCHAR szBuffer[ MAX_PATH ];
RegKey key;
key.Open( HKEY_LOCAL_MACHINE, pPath->szKey );
key.QueryStringValue (pPath->szValue, szBuffer, &dwCount);
strOut += T2A( szBuffer );
return S_OK;
}
// Token not found
_ASSERT( FALSE );
return E_INVALIDARG;
}
// Attempt to convert the CLSID
LPOLESTR strCLSID = A2OLE( strToken.substr( nColon + 1 ).c_str() );
HRESULT hRes;
CLSID clsid;
if( strCLSID[ 0 ] == OLESTR( '{' ) )
hRes = ::CLSIDFromString( strCLSID, &clsid );
else
hRes = ::CLSIDFromProgID( strCLSID, &clsid );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
CComPtr< IDecalEnum > pEnum;
if( get_Configuration( _bstr_t( strToken.substr( 0, nColon ).c_str() ), clsid, &pEnum ) != S_OK )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
CComBSTR strResourcePath;
if( FAILED( pEnum->get_ResourcePath( &strResourcePath ) ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
strOut += OLE2A( strResourcePath );
return S_OK;
}
STDMETHODIMP cDecal::InitGraphics( IUnknown *pDirectDraw, IUnknown *pD3DDevice )
{
m_pD = static_cast< IDirectDraw4 * >( pDirectDraw );
m_pD3D = static_cast< IDirect3DDevice3 * >( pD3DDevice );
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->ChangeDirectX();
}
return S_OK;
}
STDMETHODIMP cDecal::get_DirectDraw(REFIID iid, VOID * * ppvItf)
{
return m_pD->QueryInterface( iid, ppvItf );
}
STDMETHODIMP cDecal::get_D3DDevice(REFIID iid, VOID * * ppvItf)
{
return m_pD3D->QueryInterface( iid, ppvItf );
}
STDMETHODIMP cDecal::get_HWND(LONG * pVal)
{
if (pVal == NULL)
return E_POINTER;
*pVal = reinterpret_cast< long >( m_hWnd );
return S_OK;
}
STDMETHODIMP cDecal::put_HWND( LONG newVal )
{
HWND newWnd = reinterpret_cast< HWND >( newVal );
if( newWnd != m_hWnd )
{
m_hWnd = newWnd;
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->ChangeHWND();
}
}
return S_OK;
}
STDMETHODIMP cDecal::get_Focus(VARIANT_BOOL * pVal)
{
if (pVal == NULL)
return E_POINTER;
*pVal = m_bFocus;
return S_OK;
}
STDMETHODIMP cDecal::put_Focus( VARIANT_BOOL newVal )
{
m_bFocus = newVal;
return S_OK;
}
STDMETHODIMP cDecal::get_ScreenSize(long *pWidth, long *pHeight)
{
if (pWidth == NULL || pHeight == NULL)
return E_POINTER;
RECT rc;
::GetClientRect( m_hWnd, &rc );
*pWidth = rc.right - rc.left;
*pHeight = rc.bottom - rc.top;
return S_OK;
}
STDMETHODIMP cDecal::MapPath(BSTR pPath, BSTR * pMapped)
{
USES_CONVERSION;
if (pMapped == NULL)
{
_ASSERT( FALSE );
return E_POINTER;
}
std::string str( OLE2A( pPath ) ),
strOut;
// If the base implementation, iterate over the %% pairs and make substitutions
// where appropriate
int nIterate = 0;
for( ;; )
{
int nStart = str.find_first_of( _T( '%' ), nIterate );
if( nStart == std::string::npos )
{
strOut += str.substr( nIterate );
break;
}
int nEnd = str.find_first_of( _T( '%' ), nStart + 1 );
HRESULT hRes = convertToken( str.substr( nStart + 1, nEnd - ( nStart + 1 ) ), strOut );
if( FAILED( hRes ) )
return hRes;
if( nEnd == std::string::npos )
{
// Unterminated '%'
_ASSERT( FALSE );
return E_INVALIDARG;
}
nIterate = nEnd + 1;
if( nIterate == str.length() )
{
// The string ended in a token, break now
break;
}
}
// We're done - convert the string
*pMapped = A2BSTR( strOut.c_str() );
return S_OK;
}
STDMETHODIMP cDecal::StartPlugins()
{
if( !m_bServicesStarted )
{
HRESULT hRes = StartServices();
if( FAILED( hRes ) )
return hRes;
}
if( m_bPluginsStarted )
return S_FALSE;
// Walk through the list of services and send the plugin start notification
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
i->m_p->BeforePlugins();
}
CComPtr< IDecalEnum > pEnumPlugins;
get_Configuration( _bstr_t( "Plugins" ), GUID_NULL, &pEnumPlugins );
while( pEnumPlugins->Next() == S_OK )
{
VARIANT_BOOL bEnabled;
pEnumPlugins->get_Enabled( &bEnabled );
if( !bEnabled )
continue;
cPlugin plugin;
pEnumPlugins->get_ComClass( &plugin.m_clsid );
// Attempt to make an instance of the plugin
CComPtr< IPlugin2 > pPlugin;
HRESULT hRes = pEnumPlugins->CreateInstance( __uuidof( IPlugin2 ), reinterpret_cast< void ** >( &pPlugin ) );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
continue;
}
CComObject< cPluginSite > *pSite;
CComObject< cPluginSite >::CreateInstance( &pSite );
CComPtr< IPluginSite2 > pSiteRef = pSite;
pSite->m_pPlugin = pPlugin;
pSite->m_pDecal = this;
hRes = pSite->m_pPlugin->Initialize( pSiteRef );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
continue;
}
plugin.m_pSite = pSite;
m_plugins.push_back( plugin );
// NOTE: If the plugin has not stored the IPluginSite2 interface pointer, it
// will immediately terminate
}
m_bPluginsStarted = true;
return S_OK;
}
STDMETHODIMP cDecal::StopPlugins()
{
if( !m_bPluginsStarted )
return S_FALSE;
IPluginSite2 **pSites = reinterpret_cast< IPluginSite2 ** > ( _alloca ( sizeof ( IPluginSite2 * ) * m_plugins.size () ) );
{
IPluginSite2 **i2 = pSites;
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i, ++ i2 )
*i2 = i->m_pSite;
}
{
IPluginSite2 **end_sites = pSites + m_plugins.size ();
for ( IPluginSite2 **i = pSites; i != end_sites; ++ i )
( *i )->Unload ();
}
_ASSERTE ( m_plugins.empty () );
m_bPluginsStarted = false;
// Walk through the list of services and send the plugin start notification
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
i->m_p->AfterPlugins();
}
return S_OK;
}
STDMETHODIMP cDecal::get_Object(BSTR strPath, REFIID iid, LPVOID *pVal)
{
if( pVal == NULL )
{
_ASSERT( FALSE );
return E_POINTER;
}
USES_CONVERSION;
std::string str = OLE2A( strPath );
// OK, strPath is formated as such, {plugin|service}\{{clsid|progid}[\text]
int nOffset = str.find_first_of( _T( '\\' ) );
if( nOffset == std::string::npos )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
// Find the next backslash
int nclsid = str.find_first_of( _T( '\\' ), nOffset + 1 );
// Attempt to convert it to a CLSID
std::string strCLSID = str.substr( nOffset + 1, nclsid - ( nOffset + 1 ) );
CLSID clsid;
HRESULT hRes;
if( strCLSID[ 0 ] == _T( '{' ) )
hRes = ::CLSIDFromString( A2OLE( strCLSID.c_str() ), &clsid );
else
hRes = ::CLSIDFromProgID( A2OLE( strCLSID.c_str() ), &clsid );
if( FAILED( hRes ) )
{
// The substring could not be converted to a proper CLSID
_ASSERT( FALSE );
return E_INVALIDARG;
}
std::string collection = str.substr( 0, nOffset );
CComPtr< IUnknown > pObject;
if( collection.compare( "plugins" ) == 0 )
{
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i )
{
if( i->m_clsid == clsid )
{
pObject = i->m_pSite->m_pPlugin;
break;
}
}
}
else if( collection.compare( "services" ) == 0 )
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( i->m_clsid == clsid )
{
pObject = i->m_p;
break;
}
}
}
else
{
// Invalid prefix
_ASSERT( FALSE );
return E_INVALIDARG;
}
if( pObject == NULL )
{
// Could not find a match for that clsid
_ASSERT( FALSE );
return E_INVALIDARG;
}
while( nclsid != std::string::npos )
{
CComPtr< IDecalDirectory > pDir;
HRESULT hRes = pObject->QueryInterface( &pDir );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
return E_INVALIDARG;
}
int nEndclsid = str.find_first_of( _T( '\\' ), nclsid + 1 );
pObject.Release();
hRes = pDir->Lookup( _bstr_t( str.substr( nclsid + 1, nEndclsid - ( nclsid + 1 ) ).c_str() ), &pObject );
if( FAILED( hRes ) )
return hRes;
nclsid = nEndclsid;
}
return pObject->QueryInterface( iid, pVal );
}
struct cItfCaps
{
const IID *iid;
DWORD m_dwMask;
};
STDMETHODIMP cDecal::StartServices()
{
static cItfCaps _service_caps[] = {
{ &IID_IDecalRender, eServiceRender } },
*_end_service_caps = _service_caps + sizeof( _service_caps ) / sizeof( cItfCaps );
if( m_bServicesStarted )
// They've already been started
return S_FALSE;
m_pHooks.CoCreateInstance( _bstr_t( "Decal.ACHooks" ), NULL, CLSCTX_INPROC_SERVER );
m_pHooks->SetDecal( reinterpret_cast< IUnknown * >( this ) );
CComPtr< IDecalEnum > pEnumServices;
get_Configuration( _bstr_t( "Services" ), GUID_NULL, &pEnumServices );
while( pEnumServices->Next() == S_OK )
{
VARIANT_BOOL bEnabled;
HRESULT hRes = pEnumServices->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
if ( !bEnabled )
continue;
cService service;
pEnumServices->get_ComClass( &service.m_clsid );
hRes = pEnumServices->CreateInstance( __uuidof( IDecalService ), reinterpret_cast< void ** >( &service.m_p ) );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
// Unlike plugins, all services must initialize correctly
return hRes;
}
hRes = service.m_p->Initialize( this );
if( FAILED( hRes ) )
{
_ASSERT( FALSE );
// The service could not initialize for some reason
return hRes;
}
service.m_dwCaps = 0;
CComPtr< IUnknown > pUnkCaps;
for( cItfCaps *i_caps = _service_caps; i_caps != _end_service_caps; ++ i_caps )
{
HRESULT hRes = service.m_p->QueryInterface( *i_caps->iid, reinterpret_cast< void ** >( &pUnkCaps ) );
if( SUCCEEDED( hRes ) )
{
service.m_dwCaps |= i_caps->m_dwMask;
pUnkCaps.Release();
}
}
m_services.push_back( service );
}
m_bServicesStarted = true;
return S_OK;
}
STDMETHODIMP cDecal::get_Configuration(BSTR strType, REFCLSID clsidAdvance, IDecalEnum **pVal)
{
if (pVal == NULL)
{
_ASSERT( FALSE );
return E_POINTER;
}
CComObject< cDecalEnum > *pEnum;
HRESULT hRes = CComObject< cDecalEnum >::CreateInstance( &pEnum );
if( FAILED( hRes ) )
return hRes;
CComPtr< IUnknown > pUnk = pEnum;
if( !pEnum->Initialize( this, strType ) )
return E_FAIL;
if( clsidAdvance != GUID_NULL )
{
HRESULT hRes = pEnum->Advance( clsidAdvance );
if ( FAILED ( hRes ) )
return hRes;
}
else
{
HRESULT hRes = pEnum->Begin();
if ( FAILED ( hRes ) )
return hRes;
}
return pUnk->QueryInterface( pVal );
}
STDMETHODIMP cDecal::StopServices()
{
if( m_bPluginsStarted )
StopPlugins( );
if( !m_bServicesStarted )
return S_FALSE;
try
{
while( !m_services.empty() )
{
cServiceList::iterator i = ( m_services.end() - 1 );
i->m_p->Terminate();
m_services.erase( i );
}
}
catch( ... )
{
}
if( m_pHooks.p )
m_pHooks.Release( );
return S_OK;
}
STDMETHODIMP cDecal::get_Plugin(REFCLSID clsid, REFIID iid, LPVOID *pVal)
{
for( cPluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++ i )
{
if( i->m_clsid == clsid )
return i->m_pSite->m_pPlugin->QueryInterface( iid, pVal );
}
return E_INVALIDARG;
}
STDMETHODIMP cDecal::get_Service(REFCLSID clsid, REFIID iid, LPVOID *pVal)
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( i->m_clsid == clsid )
return i->m_p->QueryInterface( iid, pVal );
}
return E_INVALIDARG;
}
STDMETHODIMP cDecal::Render2D()
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->Render2D();
}
return S_OK;
}
STDMETHODIMP cDecal::Render3D()
{
for( cServiceList::iterator i = m_services.begin(); i != m_services.end(); ++ i )
{
if( !( i->m_dwCaps & eServiceRender ) )
continue;
CComPtr< IDecalRender > pRender;
HRESULT hRes = i->m_p->QueryInterface( &pRender );
_ASSERTE( SUCCEEDED( hRes ) );
pRender->Render3D();
}
return S_OK;
}
STDMETHODIMP cDecal::get_Hooks(IACHooks** pVal)
{
if( m_pHooks == NULL )
return E_FAIL;
m_pHooks->QueryInterface( pVal );
return S_OK;
}

View file

@ -0,0 +1,99 @@
// DecalManager.h : Declaration of the cDecal
#ifndef __DECAL_H_
#define __DECAL_H_
#include "resource.h" // main symbols
class cPluginSite;
/////////////////////////////////////////////////////////////////////////////
// cDecal
class ATL_NO_VTABLE cDecal :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecal, &CLSID_Decal>,
public IDecal
{
public:
cDecal()
: m_pD( NULL ),
m_pD3D( NULL ),
m_hWnd( NULL ),
m_bFocus( VARIANT_FALSE ),
m_bServicesStarted( false ),
m_bPluginsStarted( false )
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_DECAL)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecal)
COM_INTERFACE_ENTRY(IDecal)
END_COM_MAP()
struct cService
{
CLSID m_clsid;
DWORD m_dwCaps;
CComPtr< IDecalService > m_p;
};
enum eServiceCaps
{
eServiceRender = 0x01
};
typedef std::vector< cService > cServiceList;
cServiceList m_services;
struct cPlugin
{
CLSID m_clsid;
cPluginSite *m_pSite;
};
typedef std::vector< cPlugin > cPluginList;
cPluginList m_plugins;
bool m_bServicesStarted,
m_bPluginsStarted;
IDirectDraw4 *m_pD;
IDirect3DDevice3 *m_pD3D;
HWND m_hWnd;
VARIANT_BOOL m_bFocus;
CComPtr< IACHooks > m_pHooks;
HRESULT convertToken( std::string &strToken, std::string &strOut );
public:
// IDecal
STDMETHOD(InitGraphics)( IUnknown *pDirectDraw, IUnknown *pD3DDevice );
STDMETHOD(get_DirectDraw)(REFIID iid, VOID * * ppvItf);
STDMETHOD(get_D3DDevice)(REFIID iid, VOID * * ppvItf);
STDMETHOD(Render3D)();
STDMETHOD(Render2D)();
STDMETHOD(get_HWND)(LONG * pVal);
STDMETHOD(put_HWND)(LONG newVal);
STDMETHOD(get_Focus)(VARIANT_BOOL *pVal);
STDMETHOD(put_Focus)(VARIANT_BOOL newVal);
STDMETHOD(get_ScreenSize)(long *pWidth, long *pHeight);
STDMETHOD(get_Object)(BSTR strPath, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(MapPath)(BSTR pPath, BSTR * pMapped);
STDMETHOD(StartServices)();
STDMETHOD(StopServices)();
STDMETHOD(StartPlugins)();
STDMETHOD(StopPlugins)();
STDMETHOD(get_Configuration)(BSTR strType, /*[default(GUID_NULL)]*/ REFCLSID clsidAdvance, /*[out, retval]*/ IDecalEnum * *pVal);
STDMETHOD(get_Service)(REFCLSID clsid, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(get_Plugin)(REFCLSID clsid, REFIID iid, /*[out, retval]*/ LPVOID *pVal);
STDMETHOD(get_Hooks)(IACHooks** pVal);
};
#endif //__DECAL_H_

152
Native/Decal/DecalRes.cpp Normal file
View file

@ -0,0 +1,152 @@
// DecalRes.cpp : Implementation of cDecalRes
#include "stdafx.h"
#include "Decal.h"
#include "DecalRes.h"
/////////////////////////////////////////////////////////////////////////////
// cDecalRes
HRESULT cDecalRes::getLibID( MSXML::IXMLDOMDocumentPtr &pdoc, GUID *pGUID )
{
_variant_t vlib = pdoc->selectSingleNode( _T( "/*/@lib" ) )->text;
if( vlib.vt == VT_NULL )
{
// lib is a required field
_ASSERT( FALSE );
return E_FAIL;
}
return ::CLSIDFromString( vlib.bstrVal, pGUID );
}
bool cDecalRes::getTypelibFilename( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR *pbstrFilename )
{
USES_CONVERSION;
GUID libid;
HRESULT hRes = getLibID( pdoc, &libid );
if( FAILED( hRes ) )
return SUCCEEDED ( hRes );
// Look up the path of the typelib in the registry
hRes = ::QueryPathOfRegTypeLib( libid, 1, 0, 0, pbstrFilename );
if( SUCCEEDED( hRes ) )
return true;
// Otherwise, manufacture a type library filename
RegKey key;
key.Open( HKEY_LOCAL_MACHINE, _T( "Software\\Decal\\Agent" ) );
TCHAR szPath[ MAX_PATH ];
DWORD dwPath = MAX_PATH;
key.QueryStringValue (_T("PluginPath"), szPath, &dwPath);
if( szPath[ ::_tcslen( szPath ) - 1 ] != _T( '\\' ) )
::_tcscat( szPath, _T( "\\" ) );
_variant_t vName = pdoc->selectSingleNode( _T( "/*/@name" ) )->text;
if( vName.vt == VT_NULL )
::_tcscat( szPath, _T( "ErrorUnnamedTypelib.tlb" ) );
else
{
::_tcscat( szPath, OLE2T( vName.bstrVal ) );
::_tcscat( szPath, _T( ".tlb" ) );
}
*pbstrFilename = T2BSTR( szPath );
return false;
}
HRESULT cDecalRes::initTypelib( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR strFilename )
{
HRESULT hRes = ::CreateTypeLib2( SYS_WIN32, strFilename, &m_pLib );
if( FAILED( hRes ) )
return hRes;
GUID libid;
hRes = getLibID( pdoc, &libid );
if( FAILED( hRes ) )
return hRes;
m_pLib->SetGuid( libid );
_variant_t vName = pdoc->selectSingleNode( _T( "/*/@name" ) )->text;
if( vName.vt == VT_NULL )
{
// Name is a required field
_ASSERT( FALSE );
return E_FAIL;
}
m_pLib->SetName( vName.bstrVal );
m_pLib->SetVersion( 1, 0 );
// One initialized typelib
return S_OK;
}
HRESULT cDecalRes::scanTemplate( MSXML::IXMLDOMElementPtr &ptemp, ITypeInfo **ppCoClass, ITypeInfo **ppSource )
{
// Get the IDs for the coclass, default interface and default source interface
_variant_t vIDCoClass = ptemp->getAttribute( _T( "class" ) ),
vIDEvent = ptemp->getAttribute( _T( "event" ) ),
vName = ptemp->getAttribute( _T( "name" ) );
if( vIDCoClass.vt == VT_NULL || vIDEvent.vt == VT_NULL || vName.vt == VT_NULL )
{
// Both of these are required
_ASSERT( FALSE );
return E_FAIL;
}
// Next convert them to GUIDs
CLSID idClass;
IID idEvent;
if( FAILED( ::CLSIDFromString( vIDCoClass.bstrVal, &idClass ) ) ||
FAILED( ::CLSIDFromString( vIDEvent.bstrVal, &idEvent ) ) )
{
// They must be converted to guids
_ASSERT( FALSE );
return E_FAIL;
}
// Now we make the coclass typeinfo, default source typeinfo, get the default interface typeinfo
// and slap them all together
CComPtr< ICreateTypeInfo > pCoClass;
m_pLib->CreateTypeInfo( vName.bstrVal, TKIND_COCLASS, &pCoClass );
pCoClass->SetGuid( idClass );
pCoClass->QueryInterface( ppCoClass );
CComPtr< ITypeInfo > pDefaultItf;
GetTypeInfo( 0, 0, &pDefaultItf );
HREFTYPE hrefDefaultItf;
pCoClass->AddRefTypeInfo( pDefaultItf, &hrefDefaultItf );
pCoClass->AddImplType( 0, hrefDefaultItf );
pCoClass->SetImplTypeFlags( 0, IMPLTYPEFLAG_FDEFAULT );
CComPtr< ICreateTypeInfo > pSourceItf;
_bstr_t strEvent( _T( "_" ) );
strEvent += vName.bstrVal;
strEvent += _T( "Events" );
m_pLib->CreateTypeInfo( strEvent, TKIND_DISPATCH, &pSourceItf );
pSourceItf->SetGuid( idEvent );
HREFTYPE hrefSourceItf;
pSourceItf->QueryInterface( ppSource );
pCoClass->AddRefTypeInfo( *ppSource, &hrefSourceItf );
pCoClass->AddImplType( 1, hrefSourceItf );
pCoClass->SetImplTypeFlags( 1, IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE );
// Still incomplete
return S_OK;
}

337
Native/Decal/DecalRes.h Normal file
View file

@ -0,0 +1,337 @@
// DecalRes.h : Declaration of the cDecalRes
#ifndef __DECALRES_H_
#define __DECALRES_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cDecalRes
class ATL_NO_VTABLE cDecalRes :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cDecalRes, &CLSID_DecalRes>,
public IDispatchImpl<IDecalRes, &IID_IDecalRes, &LIBID_Decal>,
public IConnectionPoint,
public IConnectionPointContainer,
public IProvideClassInfo2
{
public:
cDecalRes()
: m_dwNextCookie( 1 )
{
}
// This object iterates over our one connection
// point.
class cEnumRes
: public CComObjectRootEx<CComMultiThreadModel>,
public IEnumConnectionPoints
{
public:
BEGIN_COM_MAP(cEnumRes)
COM_INTERFACE_ENTRY(IEnumConnectionPoints)
END_COM_MAP()
bool m_bEnd;
CComPtr< IConnectionPoint > m_pCP;
void init( IConnectionPoint *pCP )
{
m_pCP = pCP;
m_bEnd = false;
}
public:
// IEnumConnectionPoints
STDMETHOD(Next)( ULONG cConnections, IConnectionPoint **rgpcn, ULONG *pcFetched )
{
if( m_bEnd )
{
*pcFetched = 0;
return S_FALSE;
}
if( cConnections == 0 )
{
*pcFetched = 0;
return S_OK;
}
m_bEnd = true;
*pcFetched = 1;
return m_pCP->QueryInterface( rgpcn );
}
STDMETHOD(Skip)( ULONG cConnections )
{
if( cConnections == 0 )
return S_OK;
m_bEnd = true;
return S_OK;
}
STDMETHOD(Reset)()
{
m_bEnd = false;
return S_OK;
}
STDMETHOD(Clone)(IEnumConnectionPoints **ppNew )
{
CComObject< cEnumRes > *pEnum;
CComObject< cEnumRes >::CreateInstance( &pEnum );
pEnum->m_pCP = m_pCP;
pEnum->m_bEnd = m_bEnd;
return pEnum->QueryInterface( IID_IEnumConnectionPoints, reinterpret_cast< void ** >( ppNew ) );
}
};
// This object implements the event object - Fire resolves
// to dispatching an event to our parent. This object is added
// into the namespace of the resource.
class cResEvent
: public CComObjectRootEx<CComMultiThreadModel>,
public IDispatch
{
public:
BEGIN_COM_MAP(cResEvent)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
CComPtr< ITypeInfo > m_pItf;
cDecalRes *m_pRes;
DISPID m_dispid;
HRESULT load( MSXML::IXMLDOMElementPtr &pElement )
{
// TODO: load the dispid and Fire paramters and create the temporary typeinfo
}
public:
// IDispatch
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo )
{
if( pctinfo == NULL )
return E_POINTER;
*pctinfo = 1;
return S_OK;
}
STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID, ITypeInfo **ppTI )
{
if( iTInfo != 0 )
return E_INVALIDARG;
if( ppTI == NULL )
return E_POINTER;
return m_pItf->QueryInterface( ppTI );
}
STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID, DISPID *rgDispID)
{
if( rgDispID == NULL || rgszNames == NULL )
// By spec
return E_POINTER;
if( !::InlineIsEqualGUID( riid, IID_NULL ) )
// By spec
return DISP_E_UNKNOWNINTERFACE;
static LPOLESTR _szFire = OLESTR( "Fire" );
for( UINT i = 0; i < cNames; ++ i )
{
if( ::wcscmp( _szFire, rgszNames[ i ] ) == 0 )
rgDispID[ i ] = 1;
else
rgDispID[ i ] = -1;
}
return S_OK;
}
STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *pArgError )
{
// Do all the checks in here
if( dispIdMember != 1 )
return DISP_E_MEMBERNOTFOUND;
if( !::InlineIsEqualGUID( riid, IID_NULL ) )
return DISP_E_UNKNOWNINTERFACE;
if( wFlags != DISPATCH_METHOD )
return DISP_E_MEMBERNOTFOUND;
return m_pRes->dispatchEvent( m_dispid, pDispParams, pVarResult, pExcepInfo, pArgError );
}
};
// Generated TypeInfo
CComPtr< ICreateTypeLib2 > m_pLib;
CComPtr< ITypeInfo > m_pCoClass;
CComPtr< ICreateTypeInfo > m_pSource;
HRESULT GetSourceIID( IID *pIID )
{
if( !m_pSource.p )
// Not yet initialized - bad
return E_FAIL;
CComPtr< ITypeInfo > pTI;
HRESULT hRes = m_pSource->QueryInterface( &pTI );
if( FAILED( hRes ) )
return hRes;
TYPEATTR *pTA;
pTI->GetTypeAttr( &pTA );
*pIID = pTA->guid;
pTI->ReleaseTypeAttr( pTA );
return S_OK;
}
// Connection point members
typedef std::deque< std::pair< DWORD, CComPtr< IDispatch > > > cCPList;
DWORD m_dwNextCookie;
cCPList m_cp;
HRESULT dispatchEvent( DISPID nID, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr )
{
// We simply pass the invoke on, the event object calling us
// will correctly remap the ID.
for( cCPList::iterator i = m_cp.begin(); i != m_cp.end(); ++ i )
i->second->Invoke( nID, IID_NULL, 0, DISPATCH_METHOD, pDispParams, pVarResult, pExcepInfo, puArgErr );
return S_OK;
}
// Series of methods to create the type library
HRESULT getLibID( MSXML::IXMLDOMDocumentPtr &pdoc, GUID *pGUID );
bool getTypelibFilename( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR *pbstrFilename );
HRESULT initTypelib( MSXML::IXMLDOMDocumentPtr &pdoc, BSTR strFilename );
HRESULT scanTemplate( MSXML::IXMLDOMElementPtr &ptemp, ITypeInfo **ppCoClass, ITypeInfo **ppSource );
DECLARE_REGISTRY_RESOURCEID(IDR_DECALRES)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cDecalRes)
COM_INTERFACE_ENTRY(IDecalRes)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IConnectionPoint)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
// IDecalRes
public:
// IConnectionPointContainer
STDMETHOD(EnumConnectionPoints)( IEnumConnectionPoints **ppEnum )
{
CComObject< cEnumRes > *pEnum;
CComObject< cEnumRes >::CreateInstance( &pEnum );
pEnum->init( this );
return pEnum->QueryInterface( IID_IEnumConnectionPoints, reinterpret_cast< void ** >( ppEnum ) );
}
STDMETHOD(FindConnectionPoint)( REFIID iid, IConnectionPoint **ppCP )
{
if( ppCP == NULL )
return E_POINTER;
IID iidSource;
HRESULT hRes = GetSourceIID( &iidSource );
if( FAILED( hRes ) )
return hRes;
if( ::InlineIsEqualGUID( iid, GUID_NULL ) ||
::InlineIsEqualGUID( iid, iidSource ) )
{
// Return the connection point
return static_cast< IConnectionPoint * >( this )->QueryInterface( ppCP );
}
// Not found (duh, it's not the only connection)
return CONNECT_E_NOCONNECTION;
}
// IConnectionPoint
STDMETHOD(GetConnectionInterface)( IID *piid )
{
if( piid == NULL )
return E_POINTER;
return GetSourceIID( piid );
}
STDMETHOD(GetConnectionPointContainer)( IConnectionPointContainer **ppCPC )
{
return static_cast< IConnectionPoint * >( this )->QueryInterface( ppCPC );
}
STDMETHOD(Advise)(IUnknown *pUnk, DWORD *pdwCookie)
{
if( pdwCookie == NULL || pUnk == NULL )
return E_POINTER;
CComPtr< IDispatch > pDisp;
HRESULT hRes = pUnk->QueryInterface( &pDisp );
if( FAILED( hRes ) )
return hRes;
m_cp.push_back( cCPList::value_type( m_dwNextCookie, pDisp ) );
*pdwCookie = ( m_dwNextCookie ++ );
return S_OK;
}
STDMETHOD(Unadvise)( DWORD dwCookie )
{
// Find the matching cookie
for( cCPList::iterator i = m_cp.begin(); i != m_cp.end(); ++ i )
{
if( i->first == dwCookie )
{
m_cp.erase( i );
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
}
STDMETHOD(EnumConnections)(IEnumConnections **)
{
// We don't support enum'ing connections
return E_NOTIMPL;
}
// IProvideClassInfo
STDMETHOD(GetClassInfo)(ITypeInfo **ppTI)
{
return m_pCoClass->QueryInterface( ppTI );
}
// IProvideClassInfo2
STDMETHOD(GetGUID)(DWORD dwGuidKind, GUID *pGUID)
{
if( dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID )
return E_INVALIDARG;
if( pGUID == NULL )
return E_POINTER;
return GetSourceIID( pGUID );
}
};
#endif //__DECALRES_H_

26
Native/Decal/DecalRes.rgs Normal file
View file

@ -0,0 +1,26 @@
HKCR
{
Decal.DecalRes.1 = s 'DecalRes Class'
{
CLSID = s '{EA7BE91B-C98A-4138-8985-E22364BE8207}'
}
Decal.DecalRes = s 'DecalRes Class'
{
CLSID = s '{EA7BE91B-C98A-4138-8985-E22364BE8207}'
CurVer = s 'Decal.DecalRes.1'
}
NoRemove CLSID
{
ForceRemove {EA7BE91B-C98A-4138-8985-E22364BE8207} = s 'DecalRes Class'
{
ProgID = s 'Decal.DecalRes.1'
VersionIndependentProgID = s 'Decal.DecalRes'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

11
Native/Decal/Decalps.def Normal file
View file

@ -0,0 +1,11 @@
LIBRARY "DecalPS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

16
Native/Decal/Decalps.mk Normal file
View file

@ -0,0 +1,16 @@
Decalps.dll: dlldata.obj Decal_p.obj Decal_i.obj
link /dll /out:Decalps.dll /def:Decalps.def /entry:DllMain dlldata.obj Decal_p.obj Decal_i.obj \
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
.c.obj:
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
$<
clean:
@del Decalps.dll
@del Decalps.lib
@del Decalps.exp
@del dlldata.obj
@del Decal_p.obj
@del Decal_i.obj

View file

@ -0,0 +1,49 @@
// PluginSite.cpp : Implementation of cPluginSite
#include "stdafx.h"
#include "Decal.h"
#include "PluginSite.h"
#include "DecalManager.h"
/////////////////////////////////////////////////////////////////////////////
// cPluginSite
void cPluginSite::FinalRelease()
{
_ASSERTE( m_pDecal != NULL );
for( cDecal::cPluginList::iterator i = m_pDecal->m_plugins.begin(); i != m_pDecal->m_plugins.end(); ++ i )
{
if( i->m_pSite == this )
{
m_pDecal->m_plugins.erase( i );
return;
}
}
// Could not find ourself in the list (bad initialization?)
_ASSERT( FALSE );
}
STDMETHODIMP cPluginSite::Unload()
{
// Hold a reference to ourself, to keep everything 'together' until
// the method returns
CComPtr< IUnknown > pThis( this );
m_pPlugin->Terminate();
m_pPlugin.Release();
return S_OK;
}
STDMETHODIMP cPluginSite::get_Decal(IDecal **pVal)
{
return m_pDecal->QueryInterface( IID_IDecal, reinterpret_cast< void ** >( pVal ) );
}
STDMETHODIMP cPluginSite::get_Object(BSTR Path, LPDISPATCH *pVal)
{
return m_pDecal->get_Object( Path, IID_IDispatch, reinterpret_cast< void ** >( pVal ) );
}

42
Native/Decal/PluginSite.h Normal file
View file

@ -0,0 +1,42 @@
// PluginSite.h : Declaration of the cPluginSite
#ifndef __PLUGINSITE_H_
#define __PLUGINSITE_H_
#include "resource.h" // main symbols
class cDecal;
/////////////////////////////////////////////////////////////////////////////
// cPluginSite
class ATL_NO_VTABLE cPluginSite :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<cPluginSite, &CLSID_PluginSite2>,
public IPluginSite2
{
public:
cPluginSite()
{
}
void FinalRelease();
DECLARE_REGISTRY_RESOURCEID(IDR_PLUGINSITE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cPluginSite)
COM_INTERFACE_ENTRY(IPluginSite2)
END_COM_MAP()
CComPtr< IPlugin2 > m_pPlugin;
cDecal *m_pDecal;
// IPluginSite2
public:
STDMETHOD(get_Object)(BSTR Path, /*[out, retval]*/ LPDISPATCH *pVal);
STDMETHOD(get_Decal)(/*[out, retval]*/ IDecal * *pVal);
STDMETHOD(Unload)();
};
#endif //__PLUGINSITE_H_

5
Native/Decal/StdAfx.cpp Normal file
View file

@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

51
Native/Decal/StdAfx.h Normal file
View file

@ -0,0 +1,51 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED_)
#define AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#define _WIN32_WINDOWS 0x0410
#define _ATL_APARTMENT_THREADED
#define DIRECTINPUT_VERSION 0x600
#pragma warning(disable:4530)
#ifdef NDEBUG
#ifdef _ATL_DLL
#undef _ATL_DLL
#endif
#endif
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <comdef.h>
#include <atlcrypt.h>
#include <ddraw.h>
#include <d3d.h>
#include <string>
#include <list>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <iterator>
#import <msxml.dll>
#include "../include/Helpers.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C8B6D65E_6F24_4AE7_A4BF_AFEF8775700C__INCLUDED)

View file

@ -0,0 +1,8 @@
// SurrogateRemove.cpp : Implementation of cSurrogateRemove
#include "stdafx.h"
#include "Decal.h"
#include "SurrogateRemove.h"
/////////////////////////////////////////////////////////////////////////////
// cSurrogateRemove

View file

@ -0,0 +1,87 @@
// SurrogateRemove.h : Declaration of the cSurrogateRemove
#ifndef __SURROGATEREMOVE_H_
#define __SURROGATEREMOVE_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// cSurrogateRemove
class ATL_NO_VTABLE cSurrogateRemove :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<cSurrogateRemove, &CLSID_SurrogateRemove>,
public IDecalUninstall
{
public:
cSurrogateRemove()
{
}
CComBSTR m_strGroup;
CLSID m_clsid;
_bstr_t m_strProgID;
DECLARE_REGISTRY_RESOURCEID(IDR_SURROGATEREMOVE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(cSurrogateRemove)
COM_INTERFACE_ENTRY(IDecalUninstall)
END_COM_MAP()
// ISurrogateRemove
public:
// IDecalUninstall
STDMETHOD(Prepare)(IDecalEnum *pEnum)
{
pEnum->get_Group( &m_strGroup );
pEnum->get_ComClass( &m_clsid );
CComVariant vProgID;
pEnum->get_Property( _bstr_t( _T( "ProgID" ) ), &vProgID );
if( vProgID.vt == VT_BSTR )
m_strProgID = vProgID.bstrVal;
return S_OK;
}
STDMETHOD(Uninstall)()
{
USES_CONVERSION;
TCHAR szParent[ 255 ];
::_tcscat ( ::_tcscpy ( szParent, _T( "Software\\Decal\\" ) ), OLE2T( m_strGroup ) );
RegKey rk;
if( rk.Open( HKEY_LOCAL_MACHINE, szParent ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
LPOLESTR strCLSID;
::StringFromCLSID( m_clsid, &strCLSID );
LPTSTR szCLSID = OLE2T( strCLSID );
::CoTaskMemFree( strCLSID );
if( rk.RecurseDeleteKey( szCLSID ) != ERROR_SUCCESS )
{
_ASSERT( FALSE );
return E_FAIL;
}
if( m_strProgID.length() > 0 )
{
LPTSTR szProgID = OLE2T( m_strProgID );
RegKey rkcls;
rkcls.Open( HKEY_CLASSES_ROOT, NULL );
rkcls.RecurseDeleteKey( szProgID );
}
return S_OK;
}
};
#endif //__SURROGATEREMOVE_H_

View file

@ -0,0 +1,25 @@
HKCR
{
Decal.SurrogateRemove.1 = s 'SurrogateRemove Class'
{
CLSID = s '{144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B}'
}
Decal.SurrogateRemove = s 'SurrogateRemove Class'
{
CLSID = s '{144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B}'
CurVer = s 'Decal.SurrogateRemove.1'
}
NoRemove CLSID
{
ForceRemove {144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B} = s 'SurrogateRemove Class'
{
ProgID = s 'Decal.SurrogateRemove.1'
VersionIndependentProgID = s 'Decal.SurrogateRemove'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732}'
}
}
}

36
Native/Decal/resource.h Normal file
View file

@ -0,0 +1,36 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Decal.rc
//
#define IDS_PROJNAME 100
#define IDR_DECAL 101
#define IDR_PLUGINSITE 102
#define IDR_DECALENUM 103
#define IDR_SURROGATEREMOVE 104
#define IDR_ACTIVEXSURROGATE 105
#define IDR_DECALRES 106
#define IDR_DECALNODE 107
#define IDS_ACHOOKS_DESC 111
#define IDR_ACHooks 112
#define IDE_INDEXOUTOFRANGE2 512
#define IDE_INDEXOUTOFRANGE 513
#define IDE_BADINDEXTYPE 514
#define IDE_CLASSNOTFOUND 515
#define IDE_CLASSKEYNOTFOUND 516
#define IDE_GROUPKEYNOTOPEN 517
#define IDE_INVALIDSUBKEYS 518
#define IDE_BADITERATOR 519
#define IDE_MOVEUPTOP 520
#define IDE_MOVEDOWNBOTTOM 521
#define IDE_SURROGATEDISABLED 522
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 113
#endif
#endif