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

226
Native/Include/ApiHook.h Normal file
View file

@ -0,0 +1,226 @@
// ApiHook.h
// Declaration and implementation of functions for hooking APIs in DLLs
#ifndef __APIHOOK_H
#define __APIHOOK_H
enum eAddressing
{
eByName,
eByOrdinal
};
struct cHookDescriptor
{
eAddressing m_addr;
LPCTSTR m_szModule,
m_szFunction;
DWORD m_dwOrdinal,
m_pNewFunction,
m_pOldFunction;
};
// Functions to aid hooking
#define MakePtr( cast, ptr, AddValue ) (cast)( (DWORD)(ptr)+(DWORD)(AddValue))
PIMAGE_IMPORT_DESCRIPTOR getNamedImportDescriptor( HMODULE hModule, LPCSTR szImportMod )
{
PIMAGE_DOS_HEADER pDOSHeader = reinterpret_cast< PIMAGE_DOS_HEADER >( hModule );
// Get the PE header.
PIMAGE_NT_HEADERS pNTHeader = MakePtr( PIMAGE_NT_HEADERS, pDOSHeader, pDOSHeader->e_lfanew );
// If there is no imports section, leave now.
if( pNTHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].VirtualAddress == NULL )
return NULL;
// Get the pointer to the imports section.
PIMAGE_IMPORT_DESCRIPTOR pImportDesc = MakePtr ( PIMAGE_IMPORT_DESCRIPTOR, pDOSHeader,
pNTHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].VirtualAddress );
// Loop through the import module descriptors looking for the
// module whose name matches szImportMod.
while( pImportDesc->Name != NULL )
{
PSTR szCurrMod = MakePtr( PSTR, pDOSHeader, pImportDesc->Name );
if( stricmp( szCurrMod, szImportMod ) == 0 )
// Found it.
break;
// Look at the next one.
pImportDesc ++;
}
// If the name is NULL, then the module is not imported.
if ( pImportDesc->Name == NULL )
return ( NULL ) ;
// All OK, Jumpmaster!
return pImportDesc;
}
bool hookFunctions( cHookDescriptor *pHook, DWORD nCount, bool bHook )
{
HMODULE hProcess = ::GetModuleHandle( NULL );
for( cHookDescriptor *i = pHook; i != pHook + nCount; ++ i )
{
// Get the specific import descriptor.
PIMAGE_IMPORT_DESCRIPTOR pImportDesc = getNamedImportDescriptor( hProcess, i->m_szModule );
if ( pImportDesc == NULL )
continue;
// Get the original thunk information for this DLL. I cannot use
// the thunk information stored in the pImportDesc->FirstThunk
// because the that is the array that the loader has already
// bashed to fix up all the imports. This pointer gives us acess
// to the function names.
PIMAGE_THUNK_DATA pOrigThunk = MakePtr( PIMAGE_THUNK_DATA, hProcess, pImportDesc->OriginalFirstThunk );
// Get the array pointed to by the pImportDesc->FirstThunk. This is
// where I will do the actual bash.
PIMAGE_THUNK_DATA pRealThunk = MakePtr( PIMAGE_THUNK_DATA, hProcess, pImportDesc->FirstThunk );
// Loop through and look for the one that matches the name.
for( ; pOrigThunk->u1.Function != NULL; ++ pOrigThunk, ++ pRealThunk )
{
if( i->m_addr == eByName )
{
if( pOrigThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG )
// Only look at those that are imported by name, not ordinal.
continue;
// Look get the name of this imported function.
PIMAGE_IMPORT_BY_NAME pByName = MakePtr( PIMAGE_IMPORT_BY_NAME, hProcess, pOrigThunk->u1.AddressOfData );
// If the name starts with NULL, then just skip out now.
if( pByName->Name[ 0 ] == '\0' )
continue;
if ( ::_tcsicmp( reinterpret_cast< char * >( pByName->Name ), i->m_szFunction ) != 0 )
// This name dosen't match
continue;
}
else
{
if( !( pOrigThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG ) )
// The import must be by ordinal
continue;
if( ( pOrigThunk->u1.Ordinal & ~IMAGE_ORDINAL_FLAG ) != i->m_dwOrdinal )
// Ordinal does not match
continue;
}
// I found it. Now I need to change the protection to
// writable before I do the blast. Note that I am now
// blasting into the real thunk area!
MEMORY_BASIC_INFORMATION mbi_thunk;
::VirtualQuery( pRealThunk, &mbi_thunk, sizeof ( MEMORY_BASIC_INFORMATION ) );
::VirtualProtect( mbi_thunk.BaseAddress, mbi_thunk.RegionSize, PAGE_READWRITE, &mbi_thunk.Protect );
// Save the original address if requested.
if( bHook )
{
i->m_pOldFunction = pRealThunk->u1.Function;
pRealThunk->u1.Function = i->m_pNewFunction;
}
else if( i->m_pOldFunction != NULL )
pRealThunk->u1.Function = i->m_pOldFunction;
DWORD dwOldProtect;
::VirtualProtect( mbi_thunk.BaseAddress, mbi_thunk.RegionSize, mbi_thunk.Protect, &dwOldProtect );
break;
}
}
return true;
}
// This patches the export table rather than the import table
bool hookFunctionsByExport( char *szFilename, cHookDescriptor *pHook, DWORD nCount, bool bHook )
{
HMODULE hProcess = ::GetModuleHandle( reinterpret_cast< LPCSTR >( szFilename ) );
for( cHookDescriptor *i = pHook; i != pHook + nCount; ++ i )
{
// Get the specific import descriptor.
PIMAGE_IMPORT_DESCRIPTOR pImportDesc = getNamedImportDescriptor( hProcess, i->m_szModule );
if ( pImportDesc == NULL )
continue;
// Get the original thunk information for this DLL. I cannot use
// the thunk information stored in the pImportDesc->FirstThunk
// because the that is the array that the loader has already
// bashed to fix up all the imports. This pointer gives us acess
// to the function names.
PIMAGE_THUNK_DATA pOrigThunk = MakePtr( PIMAGE_THUNK_DATA, hProcess, pImportDesc->OriginalFirstThunk );
// Get the array pointed to by the pImportDesc->FirstThunk. This is
// where I will do the actual bash.
PIMAGE_THUNK_DATA pRealThunk = MakePtr( PIMAGE_THUNK_DATA, hProcess, pImportDesc->FirstThunk );
// Loop through and look for the one that matches the name.
for( ; pOrigThunk->u1.Function != NULL; ++ pOrigThunk, ++ pRealThunk )
{
if( i->m_addr == eByName )
{
if( pOrigThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG )
// Only look at those that are imported by name, not ordinal.
continue;
// Look get the name of this imported function.
PIMAGE_IMPORT_BY_NAME pByName = MakePtr( PIMAGE_IMPORT_BY_NAME, hProcess, pOrigThunk->u1.AddressOfData );
// If the name starts with NULL, then just skip out now.
if( pByName->Name[ 0 ] == '\0' )
continue;
if ( ::_tcsicmp( reinterpret_cast< char * >( pByName->Name ), i->m_szFunction ) != 0 )
// This name dosen't match
continue;
}
else
{
if( !( pOrigThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG ) )
// The import must be by ordinal
continue;
if( ( pOrigThunk->u1.Ordinal & ~IMAGE_ORDINAL_FLAG ) != i->m_dwOrdinal )
// Ordinal does not match
continue;
}
// I found it. Now I need to change the protection to
// writable before I do the blast. Note that I am now
// blasting into the real thunk area!
MEMORY_BASIC_INFORMATION mbi_thunk;
::VirtualQuery( pRealThunk, &mbi_thunk, sizeof ( MEMORY_BASIC_INFORMATION ) );
::VirtualProtect( mbi_thunk.BaseAddress, mbi_thunk.RegionSize, PAGE_READWRITE, &mbi_thunk.Protect );
// Save the original address if requested.
if( bHook )
{
i->m_pOldFunction = pRealThunk->u1.Function;
pRealThunk->u1.Function = i->m_pNewFunction;
}
else if( i->m_pOldFunction != NULL )
pRealThunk->u1.Function = i->m_pOldFunction;
DWORD dwOldProtect;
::VirtualProtect( mbi_thunk.BaseAddress, mbi_thunk.RegionSize, mbi_thunk.Protect, &dwOldProtect );
break;
}
}
return true;
}
#endif

View file

@ -0,0 +1,21 @@
// DX6InjectApi.h
// Declaration of exported functions from DX6Inject
#ifndef __DX6INJECTAPI_H
#define __DX6INJECTAPI_H
#ifdef DX6INJECT_IMPL
#define DX6INJECT_API __declspec(dllexport)
#else
#define DX6INJECT_API __declspec(dllimport)
#endif
// Adds a reference to the registered hook function
void DX6INJECT_API InjectInstall();
// Removes a reference to the registered hook function
void DX6INJECT_API InjectUninstall();
LRESULT CALLBACK DX6Callback( int, WPARAM, LPARAM );
#endif

566
Native/Include/Decal.idl Normal file
View file

@ -0,0 +1,566 @@
// Decal.idl : IDL source for Decal.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (Decal.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
interface IPluginSite2;
[
object,
uuid(A51CEB03-B59F-4302-B125-A0846EA537DD),
helpstring("IPlugin2 Interface - All plugin components are required to implement this interface"),
pointer_default(unique)
]
interface IPlugin2 : IUnknown
{
[helpstring("Create all objects and views within your plugin. The assigned ID can be used for self termiantion and the plugin site should be stored.")] HRESULT Initialize(IPluginSite2 *Site);
[helpstring("Release all your objects including the stored IPluginSite2")] HRESULT Terminate();
};
[
object,
uuid(256DF70B-0B87-45e4-96EE-043E2254CC95),
helpstring("IRenderSink Interface"),
pointer_default(unique)
]
interface IKitchenSink : IUnknown
{
[helpstring("method AddToQueue")] HRESULT AddToQueue([in]long lObjectID);
[helpstring("method ShortcircuitID")] HRESULT ShortcircuitID([in] long lObjectID);
};
[
object,
uuid(FFA32A7A-EFAF-484A-B358-8802DBBAB0EC),
helpstring("IDecalEnum Interface"),
pointer_default(unique)
]
interface IDecalEnum : IUnknown
{
[propget, helpstring("Human Readable Name")] HRESULT FriendlyName([out, retval] BSTR *pVal);
[propget, helpstring("CLSID for the object")] HRESULT ComClass([out, retval] CLSID *pVal);
[propget, helpstring("If the object is enabled")] HRESULT Enabled([out, retval] VARIANT_BOOL *pVal);
[propput, helpstring("Set the object enabled")] HRESULT Enabled([in] VARIANT_BOOL newVal);
[helpstring("Create an instance of this object")] HRESULT CreateInstance(REFIID iid, [out, retval, iid_is(iid)] LPVOID *ppvItf);
[helpstring("Move to the next entry, returns S_FALSE when complete")] HRESULT Next();
[propget, helpstring("If this object is a surrogate, returns the surrogate CLSID, otherwise GUID_NULL")] HRESULT SurrogateClass([out, retval] CLSID *pVal);
[propget, helpstring("Resource path for this object, if not specified the decal resource path")] HRESULT ResourcePath([out, retval] BSTR *pVal);
[propget, helpstring("property Property")] HRESULT Property(BSTR Name, [out, retval] VARIANT *pVal);
[propget, helpstring("property Group")] HRESULT Group([out, retval] BSTR *pVal);
[helpstring("Advance to a specific class")] HRESULT Skip ([in] REFCLSID clsid);
[helpstring("method MoveBefore")] HRESULT MoveBefore(REFCLSID clsidBefore);
};
[
object,
uuid(9337777E-3079-47E3-8B6A-EDCB1ECABC27),
helpstring("IACHooks Interface"),
dual,
pointer_default(unique),
oleautomation
]
interface IACHooks : IDispatch
{
[id(1), propget, helpstring("property CurrentSelection")] HRESULT CurrentSelection([out, retval] long* pVal);
[id(1), propput, helpstring("property CurrentSelection")] HRESULT CurrentSelection([in] long pVal);
[id(2), propget, helpstring("property PreviousSelection")] HRESULT PreviousSelection([out, retval] long* pVal);
[id(2), propput, helpstring("property PreviousSelection")] HRESULT PreviousSelection([in] long pVal);
[id(3), helpstring("method ChatOut")] HRESULT ChatOut([in]BSTR szText, long lColor);
[id(4), helpstring("method RawChatOut")] HRESULT RawChatOut([in]BSTR szText, long lColor);
[id(5), helpstring("method SetCursorPosition")] HRESULT SetCursorPosition([in] long lX, long lY);
[id(6), helpstring("method CastSpell")] HRESULT CastSpell([in]long lSpellID, long lObjectID);
[id(7), helpstring("method MoveItem")] HRESULT MoveItem([in] long lObjectID, long lPackID, long lSlot, VARIANT_BOOL bStack);
[id(8), helpstring("method SelectItem")] HRESULT SelectItem([in]long lObjectID);
[id(9), helpstring("method UseItem")] HRESULT UseItem([in]long lObjectID, long lUseState);
[propget, id(10), helpstring("property CombatState")] HRESULT CombatState([out, retval] long *pVal);
[propget, id(12), helpstring("property ChatState")] HRESULT ChatState([out, retval] VARIANT_BOOL *pVal);
[id(13), helpstring("method UseItemEx")] HRESULT UseItemEx([in] long UseThis, long OnThis);
[id(14), helpstring("method GetFellowStats")] HRESULT GetFellowStats([in] long lCharID);
[propget, id(15), helpstring("property SelectedStackCount")] HRESULT SelectedStackCount(long lStackCount, [out, retval] long *pVal);
[propput, id(15), helpstring("property SelectedStackCount")] HRESULT SelectedStackCount(long lStackCount, [in] long newVal);
[propget, id(16), helpstring("property VendorID")] HRESULT VendorID([out, retval] long *pVal);
[propget, id(17), helpstring("property BusyState")] HRESULT BusyState([out, retval] long *pVal);
[propget, id(18), helpstring("property BusyStateID")] HRESULT BusyStateID([out, retval] long *pVal);
[propget, id(19), helpstring("property PointerState")] HRESULT PointerState([out, retval] long *pVal);
[id(20), helpstring("method MoveItemEx")] HRESULT MoveItemEx([in]long lObjectID, long lDestinationID);
[propget, id(21), helpstring("property Heading")] HRESULT Heading([out, retval] double *pVal);
[propget, id(22), helpstring("property Landblock")] HRESULT Landblock([out, retval] long *pVal);
[propget, id(23), helpstring("property LocationX")] HRESULT LocationX([out, retval] double *pVal);
[propget, id(24), helpstring("property LocationY")] HRESULT LocationY([out, retval] double *pVal);
[propget, id(25), helpstring("property LocationZ")] HRESULT LocationZ([out, retval] double *pVal);
[propget, id(26), helpstring("property HooksAvailable")] HRESULT HooksAvail([out, retval] long *pVal);
[id(27), helpstring("method DropItem")] HRESULT DropItem([in]long lObjectID);
[id(28), helpstring("method FaceHeading")] HRESULT FaceHeading([in] float fHeading, [in] VARIANT_BOOL bUnknown, [out,retval] VARIANT_BOOL *pVal);
[propget, id(29), helpstring("property Screen3DWidth")] HRESULT Area3DWidth([out, retval] long *pVal);
[propget, id(30), helpstring("property Screen3DHeight")] HRESULT Area3DHeight([out, retval] long *pVal);
[id(31), helpstring("method ItemIsKnown")] HRESULT ItemIsKnown([in] long lGUID, [out,retval] VARIANT_BOOL *pVal);
[id(32), helpstring("method SendTell")] HRESULT SendTell([in]long lPlayerID, BSTR Message);
[id(33), helpstring("method SetAutorun")] HRESULT SetAutorun([in] VARIANT_BOOL bOnOff);
[id(34), helpstring("method SendTellEx")] HRESULT SendTellEx([in]BSTR Name, BSTR Message);
[id(35), helpstring("Gets known MemLocs from the xml.")] HRESULT QueryMemLoc([in] BSTR bstrName, [out, retval] long *pVal);
[propget, id(36), helpstring("property Vital")] HRESULT Vital([in] long Vital, [out, retval] long* pVal);
[propget, id(37), helpstring("property Attribute")] HRESULT Attribute([in] long Attribute, [out, retval] long* pVal);
[propget, id(38), helpstring("property Skill")] HRESULT Skill([in] long Skill, [out, retval] long* pVal);
[id(39), helpstring("method LocalChatText")] HRESULT LocalChatText([in] BSTR Text);
[id(40), helpstring("method LocalChatEmote")] HRESULT LocalChatEmote([in] BSTR EmoteText);
[id(41), helpstring("method SetCombatState")] HRESULT SetCombatState([in] long pVal);
[propget, id(42), helpstring("property HooksAvailEx")] HRESULT HooksAvailEx([in] enum eAvailableHooksEx HookID,[out, retval] VARIANT_BOOL *pVal);
[id(43), helpstring("method Logout")] HRESULT Logout();
[id(44), helpstring("method SetDecal")] HRESULT SetDecal([in] IUnknown *pDecal);
[id(45), helpstring("method SecureTrade_Add")] HRESULT SecureTrade_Add([in] long ItemID, [out, retval] VARIANT_BOOL *pVal);
[propget, id(46), helpstring("property SkillTrainLevel")] HRESULT SkillTrainLevel([in] enum eSkill SkillID, [out, retval] enum eTrainLevel *pVal);
[propget, id(47), helpstring("property SkillTotalXP")] HRESULT SkillTotalXP([in] enum eSkill SkillID, [out, retval] int *pVal);
[propget, id(48), helpstring("property SkillFreePoints")] HRESULT SkillFreePoints([in] enum eSkill SkillID, [out, retval] int *pVal);
[propget, id(49), helpstring("property SkillClicks")] HRESULT SkillClicks([in] enum eSkill SkillID, [out, retval] int *pVal);
[propget, id(50), helpstring("property AttributeTotalXP")] HRESULT AttributeTotalXP([in] enum eAttribute AttributeID, [out, retval] int *pVal);
[propget, id(51), helpstring("property AttributeClicks")] HRESULT AttributeClicks([in] enum eAttribute AttributeID, [out, retval] int *pVal);
[propget, id(52), helpstring("property AttributeStart")] HRESULT AttributeStart([in] enum eAttribute AttributeID, [out, retval] int *pVal);
[propget, id(53), helpstring("property VitalTotalXP")] HRESULT VitalTotalXP([in] enum eVital VitalD, [out, retval] int *pVal);
[propget, id(54), helpstring("property VitalClicks")] HRESULT VitalClicks([in] enum eVital VitalID, [out, retval] int *pVal);
[id(55), helpstring("method RequestID")] HRESULT RequestID([in] long lObjectID);
[id(56), helpstring("method IDQueueAdd")] HRESULT IDQueueAdd([in] long lObjectID);
[id(57), helpstring("method SetIDFilter")] HRESULT SetIDFilter([in] IKitchenSink* pIDFilter);
[id(58), helpstring("method UstAddItem")] HRESULT UstAddItem([in] long lObjectID);
[id(59), helpstring("method SendMessageByMask")] HRESULT SendMessageByMask([in] LONG lMask, [in] BSTR szMessage);
[id(60), helpstring("Display a message in the upper left hand corner as either white text or yellow with the busy/error sound.")] HRESULT ToolText([in] BSTR Text, [in] VARIANT_BOOL bError);
[id(61), helpstring("Appends text to the message in the upper left hand corner as either white text or yellow with the busy/error sound.")] HRESULT ToolTextAppend([in] BSTR Text, [in] VARIANT_BOOL bError);
[id(62), helpstring("Raw Use Item (3rd param)")] HRESULT UseItemRaw([in]long lObjectID, long lUseState, long lUseMethod);
[id(63), helpstring("Use the Casting Foci's Spell")] HRESULT UseFociSpell([in]long UseThis, long OnThis);
[id(64), helpstring("Set the idle time required to log out")] HRESULT SetIdleTime([in] double dIdleTimeout);
[id(65), helpstring("Set /day")] HRESULT SetDay([in] VARIANT_BOOL bDay);
[propget, id(66), helpstring("property Misc")] HRESULT Misc([in] long Vital, [out, retval] long* pVal);
[id(67), helpstring("Give an item")] HRESULT GiveItem([in] long lObject, long lDestination);
[id(68), helpstring("Raw MoveItemEx")] HRESULT MoveItemExRaw([in] long lObject, long lDestination, long lMoveFlags);
};
[
object,
uuid(5C36D41D-1DDD-4315-97CA-75095DDFF8BB),
helpstring("IDecal Interface"),
pointer_default(unique)
]
interface IDecal : IUnknown
{
[helpstring("Initialize the graphics library")] HRESULT InitGraphics( IUnknown *pDirectDraw, IUnknown *pD3DDevice );
[propget, helpstring("The DirectDraw object used by AC")] HRESULT DirectDraw(REFIID iid, [iid_is(iid)] void **ppvItf);
[propget, helpstring("The Direct3DDevice used by AC")] HRESULT D3DDevice(REFIID iid, [iid_is(iid)] void **ppvItf);
[propget, helpstring("The main AC window")] HRESULT HWND([out, retval] long *pVal);
[propput, helpstring("The main AC window")] HRESULT HWND(long nVal);
[propget, helpstring("If a Decal control current has keyboard focus")] HRESULT Focus([out, retval] VARIANT_BOOL *pVal);
[propget, helpstring("Returns the current resolution, in windowed mode it is the client area")] HRESULT ScreenSize([out] long *pWidth, [out] long *pHeight);
[helpstring("Converts a tokenized path into a real path")] HRESULT MapPath(BSTR pPath, [out, retval] BSTR *pMapped);
[helpstring("Starts all plugins")] HRESULT StartPlugins();
[helpstring("Stops all plugins")] HRESULT StopPlugins();
[propget, helpstring("Get one fo the singleton objects")] HRESULT Object(BSTR strPath, REFIID iid, [out, retval, iid_is(iid)] LPVOID *pVal);
[helpstring("Starts services, should be called once and before starting plugins")] HRESULT StartServices();
[propget, helpstring("Returns an enumerator for child objects, the optional GUID advances the iterator to a particular object.")] HRESULT Configuration(BSTR strType, REFCLSID clsidAdvance, [out, retval] IDecalEnum * *pVal);
[helpstring("method StopServices")] HRESULT StopServices();
[propget, helpstring("property Plugin")] HRESULT Plugin(REFCLSID clsid, REFIID iid, [out, retval, iid_is(iid)] LPVOID *pVal);
[propget, helpstring("property Service")] HRESULT Service(REFCLSID clsid, REFIID iid, [out, retval, iid_is(iid)] LPVOID *pVal);
[helpstring("method Render2D")] HRESULT Render2D();
[helpstring("method Render3D")] HRESULT Render3D();
[propget, helpstring("property Hooks")] HRESULT Hooks([out, retval] IACHooks** pVal);
};
[
object,
uuid(5DBD2180-4B88-440e-9706-E6159A39D014),
helpstring("IDecalDirectory Interface"),
pointer_default(unique)
]
interface IDecalDirectory : IUnknown
{
[helpstring("method Lookup")] HRESULT Lookup(BSTR strName, [out, retval] IUnknown **ppvItf);
};
[
object,
uuid(0F95468D-5071-4e28-A223-D83FDFED99E2),
helpstring("Interface for a decal service object"),
pointer_default(unique)
]
interface IDecalService : IUnknown
{
[helpstring("Prepare the service")] HRESULT Initialize(IDecal *pDecal);
[helpstring("Before plugins are loaded")] HRESULT BeforePlugins();
[helpstring("After plugins are terminates")] HRESULT AfterPlugins();
[helpstring("method Terminate")] HRESULT Terminate();
};
[
object,
uuid(B66985FA-8CB0-48e5-A2A9-7B232D609B9C),
helpstring("Service interface for services that perform an action each frame"),
pointer_default(unique)
]
interface IDecalRender : IUnknown
{
[helpstring("method Render2D")] HRESULT Render2D();
[helpstring("method Render3D")] HRESULT Render3D();
[helpstring("method ChangeHWND")] HRESULT ChangeHWND();
[helpstring("method ChangeDirectX")] HRESULT ChangeDirectX();
};
[
object,
uuid(4FA5D6DF-6169-4F9C-B286-F863D4DA2357),
dual,
helpstring("IPluginSite2 Interface"),
pointer_default(unique)
]
interface IPluginSite2 : IUnknown
{
[helpstring("method Unload")] HRESULT Unload();
[propget, helpstring("property Object")] HRESULT Object(BSTR Path, [out, retval] LPDISPATCH *pVal);
[propget, helpstring("property Decal")] HRESULT Decal([out, retval] IDecal * *pVal);
};
[
object,
uuid(DA98635C-A312-463b-A746-2CF62AF7413A),
helpstring("IDecalSurrogate Interface"),
pointer_default(unique)
]
interface IDecalSurrogate : IUnknown
{
[helpstring("method CreateInstance")] HRESULT CreateInstance(IDecalEnum *pInitData, REFIID iid, [out, retval, iid_is(iid)] LPVOID *pObject);
};
[
object,
uuid(E182005F-6A67-48b5-A50F-464340105330),
helpstring("IDecalFileSurrogate Interface"),
pointer_default(unique)
]
interface IDecalFileSurrogate : IUnknown
{
[helpstring("method Register")] HRESULT Register(BSTR Filename);
[propget, helpstring("property Extension")] HRESULT Extension([out, retval] BSTR *pVal);
[propget, helpstring("property Description")] HRESULT Description([out, retval] BSTR *pVal);
};
[
object,
uuid(6A188D19-EC3D-409d-8190-7975FEEE2081),
helpstring("IDecalUninstall Interface"),
pointer_default(unique)
]
interface IDecalUninstall : IUnknown
{
[helpstring("This is the uninstallers last chance to see the configuration data. Record everything useful")] HRESULT Prepare(IDecalEnum *pEnum);
[helpstring("Perform the remove operation")] HRESULT Uninstall();
};
[
object,
uuid(A074F83A-32AB-46FC-9E4E-7E9DAFCD5D18),
dual,
helpstring("IDecalRes Interface"),
pointer_default(unique)
]
interface IDecalRes : IDispatch
{
};
[
uuid(EB282FE5-7170-4a37-A26E-92AF36385D2C),
helpstring("IACHooksEvents Interface")
]
dispinterface IACHooksEvents
{
properties:
methods:
[id(1), helpstring("method ObjectDestroyed")] HRESULT ObjectDestroyed([in] LONG lGuid);
[id(2), helpstring("method OnChatBoxMessage")] VARIANT_BOOL OnChatBoxMessage([in] BSTR bstrText, [in] LONG lColor, [in,out] VARIANT_BOOL *bEat );
[id(3), helpstring("method OnCommandLineText")] VARIANT_BOOL OnCommandLineText([in] BSTR bstrText, [in,out] VARIANT_BOOL *bEat );
[id(4), helpstring("method OnSelectItem")] HRESULT OnSelectItem([in] LONG lGuid);
[id(5), helpstring("method OnToolText")] void OnToolText([in] BSTR bstrText, [in] VARIANT_BOOL bError);
[id(6), helpstring("method OnToolTextAppend")] void OnToolTextAppend([in] BSTR bstrText, [in] VARIANT_BOOL bError);
};
[
uuid(FF7F5F6D-34E0-4B6F-B3BB-8141DE2EF732),
version(1.0),
helpstring("Decal 1.0 Type Library")
]
library Decal
{
// For SendMessageByMask
enum eMessageMasks
{
eFellowship = 0x800,
eVassals = 0x1000,
ePatron = 0x2000,
eMonarch = 0x4000,
eCovassals = 0x1000000,
eAllegiance = 0x2000000,
eMasks_DWORD = 0x7FFFFFFF
};
enum eTrainLevel
{
eUntrained = 1,
eTrained = 2,
eSpecialized = 3,
eTrainLevel_DWORD = 0x7FFFFFFF
};
enum eVital
{
eCurrentHealth = 1,
eMaximumHealth = 2,
eCurrentStamina = 3,
eMaximumStamina = 4,
eCurrentMana = 5,
eMaximumMana = 6,
eBaseHealth = 7,
eBaseStamina = 8,
eBaseMana = 9,
eVital_DWORD = 0x7FFFFFFF
};
enum eAttribute
{
eCurrentStrength = 1,
eCurrentEndurance = 2,
eCurrentQuickness = 3,
eCurrentCoordination = 4,
eCurrentFocus = 5,
eCurrentSelf = 6,
eBaseStrength = 7,
eBaseEndurance = 8,
eBaseQuickness = 9,
eBaseCoordination = 10,
eBaseFocus = 11,
eBaseSelf = 12,
eAttribute_DWORD = 0x7FFFFFFF
};
enum eSkill
{
eCurrentAxe = 1,
eCurrentBow = 2,
eCurrentCrossbow = 3,
eCurrentDagger = 4,
eCurrentMace = 5,
eCurrentMeleeDefense = 6,
eCurrentMissileDefense = 7,
eCurrentSpear = 9,
eCurrentStaff = 10,
eCurrentSword = 11,
eCurrentThrownWeapons = 12,
eCurrentUnarmed = 13,
eCurrentArcaneLore = 14,
eCurrentMagicDefense = 15,
eCurrentManaConversion = 16,
eCurrentItemTinkering = 18,
eCurrentAssessPerson = 19,
eCurrentDeception = 20,
eCurrentHealing = 21,
eCurrentJump = 22,
eCurrentLockpick = 23,
eCurrentRun = 24,
eCurrentAssessCreature = 27,
eCurrentWeaponTinkering = 28,
eCurrentArmorTinkering = 29,
eCurrentMagicItemTinkering = 30,
eCurrentCreatureEnchantment = 31,
eCurrentItemEnchantment = 32,
eCurrentLifeMagic = 33,
eCurrentWarMagic = 34,
eCurrentLeadership = 35,
eCurrentLoyalty = 36,
eCurrentFletchingSkill = 37,
eCurrentAlchemySkill = 38,
eCurrentCookingSkill = 39,
eBaseAxe = 51,
eBaseBow = 52,
eBaseCrossbow = 53,
eBaseDagger = 54,
eBaseMace = 55,
eBaseMeleeDefense = 56,
eBaseMissileDefense = 57,
eBaseSpear = 59,
eBaseStaff = 60,
eBaseSword = 61,
eBaseThrownWeapons = 62,
eBaseUnarmed = 63,
eBaseArcaneLore = 64,
eBaseMagicDefense = 65,
eBaseManaConversion = 66,
eBaseItemTinkering = 68,
eBaseAssessPerson = 69,
eBaseDeception = 70,
eBaseHealing = 71,
eBaseJump = 72,
eBaseLockpick = 73,
eBaseRun = 74,
eBaseAssessCreature = 77,
eBaseWeaponTinkering = 78,
eBaseArmorTinkering = 79,
eBaseMagicItemTinkering = 80,
eBaseCreatureEnchantment = 81,
eBaseItemEnchantment = 82,
eBaseLifeMagic = 83,
eBaseWarMagic = 84,
eBaseLeadership = 85,
eBaseLoyalty = 86,
eBaseFletchingSkill = 87,
eBaseAlchemySkill = 88,
eBaseCookingSkill = 89,
eSkill_DWORD = 0x7FFFFFFF
};
enum eAvailableHooks
{
ePrevSelect = 0x00000001,
eCurrentSelect = 0x00000002,
eMouse = 0x00000004,
eCastSpell = 0x00000008,
eMoveItem = 0x00000010,
eSelectItem = 0x00000020,
eUseItem = 0x00000040,
eCombatState = 0x00000080,
eChatState = 0x00000100,
eGetFellowStats = 0x00000200,
eStackCount = 0x00000400,
eTestFormula = 0x00000800,
eVendorID = 0x00001000,
eBusyState = 0x00002000,
eBusyStateID = 0x00004000,
ePointerState = 0x00008000,
eMoveItemEx = 0x00010000,
ePosition = 0x00020000,
eFaceHeading = 0x00040000,
eArea3DWidth = 0x00080000,
eArea3DHeight = 0x00100000,
eObjectDestroyed = 0x00200000,
eSendTell = 0x00400000,
eSetAutorun = 0x00800000,
eGetVital = 0x01000000,
eSendTellEx = 0x02000000,
eLocalChatText = 0x04000000,
eLocalChatEmote = 0x08000000,
eSetCombatState = 0x10000000,
eGetAttribute = 0x20000000,
eGetSkill = 0x40000000,
eHooksAvailEx = 0x80000000
};
// Items in here go in sequence (0, 1, 2, 3, ...), not as a bit-field
enum eAvailableHooksEx
{
eLogout = 0,
eSecureTrade_Add = 1,
eColorEx = 2,
eSkillInfo = 3,
eAttributeInfo = 4,
eVitalInfo = 5,
eObjectFromGUID = 6,
eObjectFromGUIDClass = 7,
eOnSelectItemEvent = 8,
eRequestID = 9,
eIDQueueAdd = 10,
eUstAddItem = 11,
eSendMessageByMask = 12,
eToolText = 13,
eToolText2 = 14,
eUseItemRaw = 15,
eUseFociSpell = 16,
eSetIdleTime = 17,
eSetDay = 18,
eGiveItem = 19,
eMoveItemExRaw = 20,
eAvailableHooksEx_DWORD = 0x7FFFFFFF // coerce enums into 4 byte instead of two
};
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IDecalSurrogate;
interface IDecalFileSurrogate;
interface IDecalUninstall;
interface IPlugin2;
interface IDecalService;
interface IDecalRender;
interface IKitchenSink;
dispinterface IACHooksEvents;
[
uuid(4557D5A1-00DB-48F6-ACB3-4FEF30E2F358),
helpstring("Decal Class")
]
coclass Decal
{
[default] interface IDecal;
};
[
uuid(E2284FC7-17E5-4846-ADAB-07953273C5FB),
helpstring("PluginSite Class"),
noncreatable
]
coclass PluginSite2
{
[default] interface IPluginSite2;
};
[
uuid(6DE65A82-C451-46E6-A82D-92137BE851AD),
helpstring("DecalEnum Class"),
noncreatable
]
coclass DecalEnum
{
[default] interface IDecalEnum;
};
[
uuid(144FBF76-E7FB-4B41-AE19-6B5AB0E0A89B),
helpstring("SurrogateRemove Class")
]
coclass SurrogateRemove
{
[default] interface IDecalUninstall;
};
[
uuid(7559F22F-C56F-4621-AE08-9C354D799D4B),
helpstring("ActiveXSurrogate Class")
]
coclass ActiveXSurrogate
{
[default] interface IDecalFileSurrogate;
interface IDecalUninstall;
};
[
uuid(EA7BE91B-C98A-4138-8985-E22364BE8207),
noncreatable,
helpstring("DecalRes Class")
]
coclass DecalRes
{
[default] interface IDecalRes;
};
[
uuid(CB8875CD-ABC2-42AD-8175-8908706EED37),
helpstring("ACHooks Class")
]
coclass ACHooks
{
[default] interface IACHooks;
[default, source] interface IACHooksEvents;
};
};

101
Native/Include/DecalDat.idl Normal file
View file

@ -0,0 +1,101 @@
// DecalDat.idl : IDL source for DecalDat.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (DecalDat.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(D501DE12-DD81-4CE1-8854-78CBCB96C2DB),
dual,
helpstring("IDatService Interface"),
pointer_default(unique)
]
interface IDatService : IDispatch
{
};
[
object,
uuid(4EC04AB5-F87A-465D-B282-1B6C2E6068C9),
dual,
helpstring("IDatLibrary Interface"),
pointer_default(unique)
]
interface IDatLibrary : IDispatch
{
[propget, id(1), helpstring("property Stream")] HRESULT Stream(DWORD File, [out, retval] LPUNKNOWN *pVal);
[id(2), helpstring("method Open")] HRESULT Open(BSTR Protocol, DWORD File, [out, retval] LPUNKNOWN *pFile);
};
[
object,
uuid(B27D3F72-2640-432F-BAE4-175E1AA0CA39),
helpstring("IDatStream Interface"),
pointer_default(unique)
]
interface IDatStream : IUnknown
{
[propget, helpstring("property Size")] HRESULT Size([out, retval] long *pVal);
[propget, helpstring("property Tell")] HRESULT Tell([out, retval] long *pVal);
[helpstring("method Skip")] HRESULT Skip(long Bytes);
[helpstring("method Restart")] HRESULT Restart();
[helpstring("method ReadBinary")] HRESULT ReadBinary(long Bytes, [size_is(Bytes)] BYTE *Buffer);
[helpstring("method Read")] HRESULT Read(long Bytes, [out, retval] BSTR *Data);
};
[
object,
uuid(1349EF1A-06EA-43e5-9026-4F3967C6C1D3),
helpstring("IFileFilter Interface"),
pointer_default(unique)
]
interface IFileFilter : IUnknown
{
[helpstring("method Initiailize")] HRESULT Initialize(IDatStream *Stream);
};
[
uuid(C2C11EC7-2CB9-4999-BDD9-AF599455601F),
version(1.0),
helpstring("DecalDat 1.0 Type Library")
]
library DecalDat
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IFileFilter;
[
uuid(37B083F0-276E-43AD-8D26-3F7449B519DC),
helpstring("DatService Class")
]
coclass DatService
{
[default] interface IDatService;
};
[
uuid(6FA05FDA-B4B5-4386-AB45-92D7E6A5D698),
helpstring("DatLibrary Class"),
noncreatable
]
coclass DatLibrary
{
[default] interface IDatLibrary;
};
[
uuid(9F7F6CD9-D164-418D-8CB5-3B9ACD70BEAF),
helpstring("DatStream Class"),
noncreatable
]
coclass DatStream
{
[default] interface IDatStream;
};
};

View file

@ -0,0 +1,273 @@
// DecalFilters.idl : IDL source for DecalFilters.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (DecalFilters.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
import "DecalNet.idl";
enum eTrainingType
{
eTrainUnusable,
eTrainUntrained,
eTrainTrained,
eTrainSpecialized
};
enum eAttributeID
{
eAttrStrength = 1,
eAttrEndurance = 2,
eAttrQuickness = 3,
eAttrCoordination = 4,
eAttrFocus = 5,
eAttrSelf = 6
};
enum eSkillID
{
eSkillAxe = 1,
eSkillBow = 2,
eSkillCrossbow = 3,
eSkillDagger = 4,
eSkillMace = 5,
eSkillMeleeDefense = 6,
eSkillMissileDefense = 7,
eSkillSpear = 9,
eSkillStaff = 10,
eSkillSword = 11,
eSkillThrownWeapons = 12,
eSkillUnarmed = 13,
eSkillArcaneLore = 14,
eSkillMagicDefense = 15,
eSkillManaConversion = 16,
eSkillAppraiseItem = 18,
eSkillAssessPerson = 19,
eSkillDeception = 20,
eSkillHealing = 21,
eSkillJump = 22,
eSkillLockpick = 23,
eSkillRun = 24,
eSkillAssessCreature = 27,
eSkillAppraiseWeapon = 28,
eSkillAppraiseArmour = 29,
eSkillAppraiseMagicItem = 30,
eSkillCreatureEnchantment = 31,
eSkillItemEnchantment = 32,
eSkillLifeMagic = 33,
eSkillWarMagic = 34,
eSkillLeadership = 35,
eSkillLoyalty = 36,
eSkillFletching = 37,
eSkillAlchemy = 38,
eSkillCooking = 39
};
enum eVitalID
{
eHealth = 1,
eStamina = 2,
eMana = 3
};
enum eStatisticType
{
eStatBurden = 5,
eStatPyreal = 20,
eStatExperience = 21,
eStatUnassignedExp = 22,
eStatUnassignedSkillPoints = 24,
eStatLevel = 25,
eStatRank = 30
};
enum eStringType
{
eStringName = 1,
eStringGender = 3,
eStringRace = 4,
eStringClass = 5
};
[
uuid(236B3F19-8F40-492b-A462-0EB4447A6296),
helpstring("IEchoEvents Interface")
]
dispinterface IEchoEvents
{
properties:
methods:
[id(1), helpstring("method EchoMessage")] void EchoMessage(IMessage *Message);
};
[
uuid(A67C748D-2427-4a13-A114-7ACC1D4C9433),
helpstring("IPrefilterEvents Interface")
]
dispinterface IPrefilterEvents
{
properties:
methods:
[id(1), helpstring("method Event")] void Event(long ID, IMessage *Message);
};
[
object,
uuid(B6496852-E977-4DA2-884D-09AFEA3D7582),
dual,
helpstring("IAttributeInfo Interface"),
pointer_default(unique)
]
interface IAttributeInfo : IDispatch
{
[propget, id(1), helpstring("property Name")] HRESULT Name([out, retval] BSTR *pVal);
[propget, id(2), helpstring("property Creation")] HRESULT Creation([out, retval] long *pVal);
[propget, id(3), helpstring("property Exp")] HRESULT Exp([out, retval] long *pVal);
[propget, id(4), helpstring("property Current")] HRESULT Current([out, retval] long *pVal);
};
[
object,
uuid(6FBA5326-F234-4AEC-B844-2136A0D50FD5),
dual,
helpstring("ISkillInfo Interface"),
pointer_default(unique)
]
interface ISkillInfo : IDispatch
{
[propget, id(1), helpstring("property Name")] HRESULT Name([out, retval] BSTR *pVal);
[propget, id(2), helpstring("property ShortName")] HRESULT ShortName([out, retval] BSTR *pVal);
[propget, id(3), helpstring("property Formula")] HRESULT Formula([out, retval] BSTR *pVal);
[propget, id(4), helpstring("property Base")] HRESULT Base([out, retval] long *pVal);
[propget, id(5), helpstring("property Current")] HRESULT Current([out, retval] long *pVal);
[propget, id(6), helpstring("property Exp")] HRESULT Exp([out, retval] long *pVal);
[propget, id(7), helpstring("property Training")] HRESULT Training([out, retval] enum eTrainingType *pVal);
[propget, id(8), helpstring("property Known")] HRESULT Known([out, retval] VARIANT_BOOL *pVal);
};
[
object,
uuid(BFBE3A29-5F61-4973-9A74-EF50B328225E),
dual,
helpstring("INetworkFilter Interface"),
pointer_default(unique)
]
interface IEchoFilter : IDispatch
{
};
[
object,
uuid(0CE57594-4E30-4446-956D-CE460C7355AF),
dual,
helpstring("ICharacterStats Interface"),
pointer_default(unique)
]
interface ICharacterStats : IDispatch
{
[propget, id(1), helpstring("property Character")] HRESULT Character([out, retval] long *pVal);
[propget, id(2), helpstring("property Level")] HRESULT Level([out, retval] long *pVal);
[propget, id(3), helpstring("property Rank")] HRESULT Rank([out, retval] long *pVal);
[propget, id(4), helpstring("property TotalExp")] HRESULT TotalExp([out, retval] long *pVal);
[propget, id(5), helpstring("property UnassignedExp")] HRESULT UnassignedExp([out, retval] long *pVal);
[propget, id(6), helpstring("property SkillPoints")] HRESULT SkillPoints([out, retval] long *pVal);
[propget, id(7), helpstring("property Server")] HRESULT Server([out, retval] BSTR *pVal);
[propget, id(8), helpstring("property Name")] HRESULT Name([out, retval] BSTR *pVal);
[propget, id(9), helpstring("property Race")] HRESULT Race([out, retval] BSTR *pVal);
[propget, id(10), helpstring("property Gender")] HRESULT Gender([out, retval] BSTR *pVal);
[propget, id(11), helpstring("property ClassTemplate")] HRESULT ClassTemplate([out, retval] BSTR *pVal);
[propget, id(12), helpstring("property AttributeCount")] HRESULT AttributeCount([out, retval] long *pVal);
[propget, id(13), helpstring("property SkillCount")] HRESULT SkillCount([out, retval] long *pVal);
[propget, id(14), helpstring("property VitalCount")] HRESULT VitalCount([out, retval] long *pVal);
[propget, id(15), helpstring("property Attribute")] HRESULT Attribute(enum eAttributeID Index, [out, retval] IAttributeInfo * *pVal);
[propget, id(16), helpstring("property Skill")] HRESULT Skill(enum eSkillID Index, [out, retval] ISkillInfo * *pVal);
[propget, id(17), helpstring("property Vital")] HRESULT Vital(enum eVitalID Index, [out, retval] ISkillInfo * *pVal);
};
[
uuid(DA16DAA9-7F16-45D9-A59F-8C45A7F2ACB1),
version(1.0),
helpstring("Decal Network Filters Type Library")
]
library DecalFilters
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
dispinterface IEchoEvents;
dispinterface IPrefilterEvents;
[
uuid(8C2FA400-315D-41DE-B063-D6EF04F12E1F),
helpstring("EchoFilter Class")
]
coclass EchoFilter
{
[default] interface IEchoFilter;
[default, source] dispinterface IEchoEvents;
};
[
uuid(0B60F187-13CD-4E35-B8A2-FE128F05CA6B),
helpstring("_ICharacterStatsEvents Interface")
]
dispinterface ICharacterStatsEvents
{
properties:
methods:
[id(1), helpstring("method Login")] HRESULT Login(long character);
};
[
object,
uuid(3C1CBEF8-E72A-4BDF-B92E-4F3307109766),
dual,
helpstring("IPrefilter Interface"),
pointer_default(unique)
]
interface IPrefilter : IDispatch
{
};
[
uuid(4540C969-08D1-46BF-97AD-6B19D3C10BEE),
helpstring("CharacterStats Class")
]
coclass CharacterStats
{
[default] interface ICharacterStats;
[default, source] dispinterface ICharacterStatsEvents;
};
[
uuid(AF42E9D7-E3F3-416B-AF32-A411F3F6EE72),
helpstring("AttributeInfo Class"),
noncreatable
]
coclass AttributeInfo
{
[default] interface IAttributeInfo;
};
[
uuid(652DA384-AA3B-4F9D-9730-8CF753DA1A31),
helpstring("SkillInfo Class"),
noncreatable
]
coclass SkillInfo
{
[default] interface ISkillInfo;
};
[
uuid(443D4A68-5422-4E0C-9460-973F8FBDB190),
helpstring("Prefilter Class")
]
coclass Prefilter
{
[default] interface IPrefilter;
[default, source] dispinterface IPrefilterEvents;
};
};

386
Native/Include/DecalImpl.h Normal file
View file

@ -0,0 +1,386 @@
// DecalImpl.h
// Declaration of default implementations for Decal interfaces
#ifndef __DECALIMPL_H
#define __DECALIMPL_H
//C Library includes
#include <stdio.h>
#include <stdlib.h>
#include <Decal.h>
#import <msxml.dll>
#include "../Include/Helpers.h"
template< class ImplT >
class ATL_NO_VTABLE IDecalServiceImpl
: public IDecalService
{
public:
CComPtr< IDecal > m_pDecal;
HRESULT onInitialize()
{
return S_OK;
}
void onTerminate()
{
}
STDMETHOD(Initialize)( IDecal *pDecal )
{
m_pDecal = pDecal;
HRESULT hRes = static_cast< ImplT * >( this )->onInitialize();
if( FAILED( hRes ) )
m_pDecal.Release();
return hRes;
}
STDMETHOD(Terminate)()
{
static_cast< ImplT * >( this )->onTerminate();
m_pDecal.Release();
return S_OK;
}
STDMETHOD(BeforePlugins)()
{
return S_OK;
}
STDMETHOD(AfterPlugins)()
{
return S_OK;
}
};
class IDecalRenderImpl
: public IDecalRender
{
public:
STDMETHOD(Render2D)()
{
return S_OK;
}
STDMETHOD(Render3D)()
{
return S_OK;
}
STDMETHOD(ChangeHWND)()
{
return S_OK;
}
STDMETHOD(ChangeDirectX)()
{
return S_OK;
}
};
template< class ImplT, const CLSID *pClsid >
class IDecalFileSurrogateXMLImpl
: public IDecalFileSurrogate
{
public:
static LPCTSTR getConfigGroup()
{
// This function must be overridden
_ASSERT( FALSE );
return _T( "Error: Bad config group" );
}
STDMETHOD(Register)(BSTR strFilename)
{
USES_CONVERSION;
MSXML::IXMLDOMDocumentPtr pDoc;
pDoc.CreateInstance( __uuidof( MSXML::DOMDocument ), NULL, CLSCTX_INPROC_SERVER );
if( !pDoc->load( strFilename ) )
{
_ASSERT( FALSE );
return E_FAIL;
}
MSXML::IXMLDOMElementPtr pRoot = pDoc->selectSingleNode( _T( "/*" ) );
_variant_t vCLSID = pRoot->getAttribute( _T( "clsid" ) ),
vProgID = pRoot->getAttribute( _T( "progid" ) ),
vName = pRoot->getAttribute( _T( "name" ) );
if( vCLSID.vt != VT_BSTR )
{
_ASSERT( FALSE );
return E_FAIL;
}
// Convert the clsid
CLSID clsid;
HRESULT hRes = ::CLSIDFromString( vCLSID.bstrVal, &clsid );
if( FAILED( hRes ) )
{
// Improperly formatted CLSID
_ASSERT( FALSE );
return hRes;
}
// Everything we need now, make the registry entries
LPOLESTR strKey, strSurrogate, strUninstall;
::StringFromCLSID( clsid, &strKey );
::StringFromCLSID( *pClsid, &strSurrogate );
::StringFromCLSID( __uuidof( SurrogateRemove ), &strUninstall );
LPTSTR szKey = OLE2T( strKey );
RegKey rk;
TCHAR szPluginKey[ 255 ];
::_stprintf( szPluginKey, _T( "Software\\Decal\\%s\\%s" ), static_cast< ImplT * >( this )->getConfigGroup(), szKey );
// Open it up
rk.Create( HKEY_LOCAL_MACHINE, szPluginKey );
if( vName.vt == VT_BSTR )
rk.SetStringValue (NULL, OLE2T( vName.bstrVal ));
LPTSTR szSurrogate = OLE2T( strSurrogate );
rk.SetDWORDValue (_T("Enabled"), 1);
rk.SetStringValue (_T("Surrogate"), szSurrogate);
rk.SetStringValue ( _T("Uninstall"), OLE2T( strUninstall ));
rk.SetStringValue( _T("File"), OLE2T( strFilename ) );
if( vProgID.vt == VT_BSTR )
{
LPTSTR szProgID = OLE2T( vProgID.bstrVal );
RegKey rkProgID;
rkProgID.Create( HKEY_CLASSES_ROOT, szProgID );
rkProgID.SetKeyValue( _T( "CLSID" ), szKey );
rk.SetStringValue( _T("ProgID"), szProgID );
}
::CoTaskMemFree( strUninstall );
::CoTaskMemFree( strSurrogate );
::CoTaskMemFree( strKey );
return S_OK;
}
};
// Disp event dynamic is a hybrid that uses type info from a generated
// typelib (at runtime) to dispatch messages. Unlike IDispEventImpl which
// requires a registered typelib. Still, much code is copied from IDispEventImpl.
template< UINT nID, class T >
class ATL_NO_VTABLE IDispEventDynamicImpl
: public IDispEventSimpleImpl< nID, T, &GUID_NULL >
{
public:
typedef IDispEventSimpleImpl< nID, T, &GUID_NULL > _base;
CComPtr< ITypeInfo2 > m_pTI;
HRESULT GetSourceInterfaceInfo( IUnknown *pUnk, ITypeInfo **ppTI )
{
// Get provide class info
CComPtr< IProvideClassInfo > pPCI;
HRESULT hRes = pUnk->QueryInterface( &pPCI );
if( FAILED( hRes ) )
// Does not support IProvideClassInfo, bad
return hRes;
CComPtr< ITypeInfo > pClassInfo;
hRes = pPCI->GetClassInfo( &pClassInfo );
if( FAILED( hRes ) )
// Failed to return any class info
return hRes;
// Iterate through the Impl types to find the default source interface
int nImplFlags;
for( UINT i = 0; SUCCEEDED( pClassInfo->GetImplTypeFlags() ); ++ i )
{
if( nImplFlags == ( IMPLTYPEFLAG_FSOURCE | IMPLTYPEFLAG_FDEFAULT ) )
{
// Found it - locate our type info
HREFTYPE href;
hRes = pClassInfo->GetRefTypeOfImplType( i, &href );
if( FAILED( hRes ) )
// Could not access the ref type (referenced typelib not available?)
return hRes;
return pClassInfo->GetRefTypeInfo( href, ppTI );
}
}
// Did not find a suitable interface
return E_FAIL;
}
HRESULT GetSourceIID( ITypeInfo *pTI, IID *piid )
{
TYPEATTR *pTA;
HRESULT hRes = pTI->GetTypeAttr( &pTA );
if( FAILED( hRes ) )
return hRes;
*piid = pTA->guid;
pTI->ReleaseTypeAttr( pTA );
return S_OK;
}
HRESULT DispEventAdvise( IUnknown *pUnk )
{
CComPtr< ITypeInfo > pSourceInfo;
HRESULT hRes = GetSourceInterfaceInfo( pUnk, &pSourceInfo );
if( FAILED( hRes ) )
return hRes;
IID iid;
hRes = GetSourceIID( pSourceInfo, &iid );
if( FAILED( hRes ) )
return hRes;
hRes = _base::DispEventAdvise( pUnk, iid );
if( SUCCEEDED( hRes ) )
m_pTI = pSourceInfo;
return hRes;
}
HRESULT DispEventUnadvise( IUnknown *pUnk )
{
IID iid;
HRESULT hRes = GetSourceIID( pSourceInfo, &iid );
_ASSERTE( SUCCEEDED( hRes ) );
_base::DispEventUnadvise( pUnk, iid );
m_pTI.Release();
return S_OK;
}
// Functions copied from IDispEventImpl
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo)
{
if( pctinfo == NULL )
return E_POINTER;
*pctinfo = 1;
return S_OK;
}
STDMETHOD(GetTypeInfo)(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
{
if( itinfo > 0 )
return E_INVALIDARG;
if( pptinfo == NULL )
return E_POINTER;
return m_pTI->QueryIterface( pptinfo );
}
STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID, DISPID* rgdispid)
{
if( !::InlineIsEqualGUID( riid, IID_NULL ) )
// By spec
return DISP_E_UNKNOWNINTERFACE;
return m_pTI->GetIDsOfNames( rgszNames, cNames, rgdispid );
}
// Helper for finding the function index for a DISPID
HRESULT GetFuncInfoFromId(const IID& /*iid*/, DISPID dispidMember, LCID lcid, _ATL_FUNC_INFO& info)
{
FUNCDESC* pFuncDesc = NULL;
UINT nIndex;
HRESULT hr = m_pTI->GetFuncIndexOfMemId(dispidMember, INVOKE_FUNC, &nIndex);
if (FAILED(hr))
return hr;
hr = m_pTI->GetFuncDesc(nIndex, &pFuncDesc);
if (FAILED(hr))
return hr;
// If this assert occurs, then add a #define _ATL_MAX_VARTYPES nnnn
// before including atlcom.h
ATLASSERT(pFuncDesc->cParams <= _ATL_MAX_VARTYPES);
if (pFuncDesc->cParams > _ATL_MAX_VARTYPES)
return E_FAIL;
for (int i=0; i<pFuncDesc->cParams; i++)
{
info.pVarTypes[i] = pFuncDesc->lprgelemdescParam[pFuncDesc->cParams - i - 1].tdesc.vt;
if (info.pVarTypes[i] == VT_PTR)
info.pVarTypes[i] = pFuncDesc->lprgelemdescParam[pFuncDesc->cParams - i - 1].tdesc.lptdesc->vt | VT_BYREF;
if (info.pVarTypes[i] == VT_USERDEFINED)
info.pVarTypes[i] = GetUserDefinedType(pFuncDesc->lprgelemdescParam[pFuncDesc->cParams-i-1].tdesc.hreftype);
}
VARTYPE vtReturn = pFuncDesc->elemdescFunc.tdesc.vt;
switch(vtReturn)
{
case VT_INT:
vtReturn = VT_I4;
break;
case VT_UINT:
vtReturn = VT_UI4;
break;
case VT_VOID:
vtReturn = VT_EMPTY; // this is how DispCallFunc() represents void
break;
case VT_HRESULT:
vtReturn = VT_ERROR;
break;
}
info.vtReturn = vtReturn;
info.cc = pFuncDesc->callconv;
info.nParams = pFuncDesc->cParams;
m_pTI->ReleaseFuncDesc(pFuncDesc);
return S_OK;
}
VARTYPE GetUserDefinedType(HREFTYPE hrt)
{
CComPtr<ITypeInfo> spTypeInfo;
VARTYPE vt = VT_USERDEFINED;
HRESULT hr = E_FAIL;
hr = m_pTI->GetRefTypeInfo(hrt, &spTypeInfo);
if(FAILED(hr))
return vt;
TYPEATTR *pta=NULL;
m_pTI->GetTypeAttr(&pta);
if(pta && pta->typekind == TKIND_ALIAS)
{
if (pta->tdescAlias.vt == VT_USERDEFINED)
GetUserDefinedType(spTypeInfo,pta->tdescAlias.hreftype);
else
vt = pta->tdescAlias.vt;
}
if(pta)
spTypeInfo->ReleaseTypeAttr(pta);
return vt;
}
};
#endif

View file

@ -0,0 +1,319 @@
// DecalInput.idl : IDL source for DecalInput.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (DecalInput.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
import "Decal.idl";
[
object,
uuid(27A63073-10D6-4282-85CF-77E4DEB8C6B8),
dual,
helpstring("IInputService Interface"),
pointer_default(unique)
]
interface IInputService : IDispatch
{
[propget, id(1), helpstring("property Command")] HRESULT Command(BSTR strCommandName, [out, retval] BSTR *pVal);
[propget, id(2), helpstring("property Decal")] HRESULT Decal([out, retval] IDecal * *pVal);
[propget, id(3), helpstring("property KeyByName")] HRESULT KeyByName(BSTR strName, [out, retval] long *pVal);
[propget, id(4), helpstring("property CommandKey")] HRESULT CommandKey(BSTR strCommand, [out, retval] long *pVal);
};
[
object,
uuid(6CE124D7-534E-4BB6-AAF2-2BE22F69326D),
dual,
helpstring("IDecalTimer Interface"),
pointer_default(unique)
]
interface IDecalTimer : IDispatch
{
[id(1), helpstring("method Start")] HRESULT Start(long Interval);
[id(2), helpstring("method Stop")] HRESULT Stop();
[propget, id(3), helpstring("property Tag")] HRESULT Tag([out, retval] VARIANT *pVal);
[propput, id(3), helpstring("property Tag")] HRESULT Tag([in] VARIANT newVal);
[propget, id(4), helpstring("property Running")] HRESULT Running([out, retval] VARIANT_BOOL *pVal);
};
[
object,
uuid(95AF8DF7-F2A0-476E-9D8C-B23493B1698D),
dual,
helpstring("IHotkey Interface"),
pointer_default(unique)
]
interface IHotkey : IDispatch
{
[propget, id(1), helpstring("property Tag")] HRESULT Tag([out, retval] VARIANT *pVal);
[propput, id(1), helpstring("property Tag")] HRESULT Tag([in] VARIANT newVal);
[propget, id(2), helpstring("property Key")] HRESULT Key([out, retval] BSTR *pVal);
[propput, id(2), helpstring("property Key")] HRESULT Key([in] BSTR newVal);
[propget, id(3), helpstring("property Enabled")] HRESULT Enabled([out, retval] VARIANT_BOOL *pVal);
[propput, id(3), helpstring("property Enabled")] HRESULT Enabled([in] VARIANT_BOOL newVal);
};
[
object,
uuid(F4E4EA59-0E47-4BAD-819A-722F5FFD506F),
dual,
helpstring("IWinMsgHook Interface"),
pointer_default(unique)
]
interface IWinMsgHook : IDispatch
{
[propget, id(1), helpstring("property Tag")] HRESULT Tag([out, retval] VARIANT *pVal);
[propput, id(1), helpstring("property Tag")] HRESULT Tag([in] VARIANT newVal);
[propget, id(2), helpstring("property Enabled")] HRESULT Enabled([out, retval] VARIANT_BOOL *pVal);
[propput, id(2), helpstring("property Enabled")] HRESULT Enabled([in] VARIANT_BOOL newVal);
};
[
object,
uuid(BDAD721B-7A00-440D-8964-70427167DD36),
dual,
helpstring("IWndMsg Interface"),
pointer_default(unique)
]
interface IWndMsg : IDispatch
{
[propget, id(1), helpstring("property HWND")] HRESULT HWND([out, retval] long *pVal);
[propget, id(2), helpstring("property Message")] HRESULT Message([out, retval] long *pVal);
[propget, id(3), helpstring("property WParam")] HRESULT WParam([out, retval] long *pVal);
[propget, id(4), helpstring("property LParam")] HRESULT LParam([out, retval] long *pVal);
[propget, id(5), helpstring("property Eat")] HRESULT Eat([out, retval] VARIANT_BOOL *pVal);
[propput, id(5), helpstring("property Eat")] HRESULT Eat([in] VARIANT_BOOL newVal);
};
[
object,
uuid(B772FDC3-36AD-4957-9143-5A10FBDA6D1D),
dual,
helpstring("IInputBuffer Interface"),
pointer_default(unique)
]
interface IInputBuffer : IDispatch
{
[propget, id(1), helpstring("property Tag")] HRESULT Tag([out, retval] VARIANT *pVal);
[propput, id(1), helpstring("property Tag")] HRESULT Tag([in] VARIANT newVal);
[id(2), helpstring("method Add")] HRESULT Add(BSTR Command);
[id(3), helpstring("method Push")] HRESULT Push(BSTR Command);
[id(4), helpstring("method Pop")] HRESULT Pop();
[propget, id(5), helpstring("property CanRun")] HRESULT CanRun([out, retval] VARIANT_BOOL *pVal);
[id(6), helpstring("method Run")] HRESULT Run();
[id(7), helpstring("method Stop")] HRESULT Stop();
};
interface IInputActionSite;
enum eActionUse
{
eActionExecute,
eActionStack
};
[
object,
uuid(C73A3F3D-8286-4250-BF97-155EE341E42F),
helpstring("IInputAction Interface"),
pointer_default(unique)
]
interface IInputAction : IUnknown
{
[helpstring("method Initialize")] HRESULT Initialize(IInputActionSite *pSite, BSTR strData);
[helpstring("method Terminate")] HRESULT Terminate();
[propget, helpstring("property Stackable")] HRESULT Stackable([out, retval] VARIANT_BOOL *pVal);
[helpstring("method Reset")] HRESULT Reset();
[helpstring("method Push")] HRESULT Push();
[helpstring("method Pop")] HRESULT Pop();
[helpstring("method Execute")] HRESULT Execute();
};
[
object,
uuid(1751F4E5-4E11-42f1-A00F-ED5B1D899C66),
helpstring("IInputActionSite Interface"),
pointer_default(unique)
]
interface IInputActionSite : IUnknown
{
[helpstring("method Delay")] HRESULT Delay(long Time, VARIANT_BOOL Advance);
[helpstring("method FireEvent")] HRESULT FireEvent(long nEventID, VARIANT vParam);
[helpstring("method MoveMouse")] HRESULT MoveMouse(long X, long Y);
[propget, helpstring("property Service")] HRESULT Service([out, retval] IInputService * *pVal);
};
[
uuid(3A985F2B-BAD5-43BF-9008-ED4EBBB45B6E),
version(1.0),
helpstring("DecalInput 1.0 Type Library")
]
library DecalInput
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IInputAction;
interface IInputActionSite;
[
uuid(B33307BA-706D-474A-80B9-70BB8D13EF3E),
helpstring("InputService Class")
]
coclass InputService
{
[default] interface IInputService;
};
[
uuid(BBF25010-50FE-4398-BB78-BF8B9D392915),
helpstring("ITimerEvents Interface")
]
dispinterface ITimerEvents
{
properties:
methods:
[id(1), helpstring("method Timeout")] HRESULT Timeout(IDecalTimer *Source);
};
[
uuid(79497C87-92E1-416B-AE5C-9D6C4C59133C),
helpstring("Timer Class")
]
coclass Timer
{
[default] interface IDecalTimer;
[default, source] dispinterface ITimerEvents;
};
[
uuid(15EAEB82-6EC8-4A09-8FA3-2D691BBB732F),
helpstring("IHotkeyEvents Interface")
]
dispinterface IHotkeyEvents
{
properties:
methods:
[id(1), helpstring("method Hotkey")] HRESULT Hotkey(IHotkey *Source);
};
[
uuid(F183506A-3664-49D6-8CA4-CFD295F2811D),
helpstring("Hotkey Class")
]
coclass Hotkey
{
[default] interface IHotkey;
[default, source] dispinterface IHotkeyEvents;
};
[
uuid(7E3E2EE8-1E06-4CFD-87D9-E4AEAB4CFE31),
helpstring("IWinMsgHookEvents Interface")
]
dispinterface IWinMsgHookEvents
{
properties:
methods:
[id(1), helpstring("method Message")] HRESULT Message(IWinMsgHook *Hook, IWndMsg *Message);
};
[
uuid(F3170E85-517E-43A4-B7B4-6F006A7B1B85),
helpstring("WinMsgHook Class")
]
coclass WinMsgHook
{
[default] interface IWinMsgHook;
[default, source] dispinterface IWinMsgHookEvents;
};
[
uuid(85AB0296-124E-4E68-A6A8-FCF5721AC09B),
noncreatable,
helpstring("WndMsg Class")
]
coclass WndMsg
{
[default] interface IWndMsg;
};
[
uuid(04CD59E6-672E-45A6-AE0A-454B1F59377A),
helpstring("IInputBufferEvents Interface")
]
dispinterface IInputBufferEvents
{
properties:
methods:
[id(1), helpstring("method Begin")] HRESULT Begin(IInputBuffer *Buffer);
[id(2), helpstring("method End")] HRESULT End(IInputBuffer *Buffer);
[id(3), helpstring("method Event")] HRESULT Event(IInputBuffer *Buffer, long EventID, VARIANT Param);
};
[
uuid(F0A17A04-7F8F-4A17-A41D-8C297A1E929B),
helpstring("InputBuffer Class")
]
coclass InputBuffer
{
[default] interface IInputBuffer;
[default, source] dispinterface IInputBufferEvents;
};
[
uuid(9CDCEEDC-F8AC-42D5-9A05-52B9346D00A4),
helpstring("TypeAction Class")
]
coclass TypeAction
{
[default] interface IInputAction;
};
[
uuid(57D18578-0BF0-4DE5-A0A9-E7CB531C0429),
helpstring("MouseMoveAction Class")
]
coclass MouseMoveAction
{
[default] interface IInputAction;
};
[
uuid(324D76B8-D8C7-4A81-B867-E4E1F874E488),
helpstring("DelayAction Class")
]
coclass DelayAction
{
[default] interface IInputAction;
};
[
uuid(D6E4BD19-4900-4515-BCE2-A9EA4AAE2699),
helpstring("EventAction Class")
]
coclass EventAction
{
[default] interface IInputAction;
};
[
uuid(762335B2-2274-4BB4-8B1F-F7286C949FF7),
helpstring("PolledDelayAction Class")
]
coclass PolledDelayAction
{
[default] interface IInputAction;
};
[
uuid(6EE2F682-7129-44BE-84B9-787BAE35EC1C),
helpstring("RestoreAction Class")
]
coclass RestoreAction
{
[default] interface IInputAction;
};
};

View file

@ -0,0 +1,68 @@
// DecalInputImpl.h
// Declaration of classes for inputing Input Actions
#ifndef __DECALINPUTIMPL_H
#define __DECALINPUTIMPL_H
#include "DecalInput.h"
template< class ImplT >
class IInputActionImpl
: public IInputAction
{
public:
CComPtr< IInputActionSite > m_pSite;
HRESULT onLoad( LPTSTR szData )
{
return S_OK;
}
STDMETHOD(Initialize)(IInputActionSite *pSite, BSTR strData)
{
USES_CONVERSION;
m_pSite = pSite;
HRESULT hRes = static_cast< ImplT * >( this )->onLoad( OLE2T( strData ) );
if( FAILED( hRes ) )
m_pSite.Release();
return hRes;
}
STDMETHOD(Terminate)()
{
m_pSite.Release();
return S_OK;
}
// Default Implementation returns false
STDMETHOD(get_Stackable)(VARIANT_BOOL *pVal)
{
*pVal = VARIANT_FALSE;
return S_OK;
}
STDMETHOD(Push)()
{
return S_OK;
}
STDMETHOD(Pop)()
{
return S_OK;
}
STDMETHOD(Execute)()
{
return S_OK;
}
STDMETHOD(Reset)()
{
return S_OK;
}
};
#endif

View file

@ -0,0 +1,9 @@
// DecalVersion.h
// Declaration of the Decal version resource
#ifndef __DECALKEY_H__
#define __DECALKEY_H__
#define DECAL_KEY "DECAL"
#endif

187
Native/Include/DecalNet.idl Normal file
View file

@ -0,0 +1,187 @@
// DecalNet.idl : IDL source for DecalNet.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (DecalNet.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
import "Decal.idl";
interface IMessage;
[
object,
uuid(05D14E34-0A23-4A9F-95CF-9DB24B3CFB9F),
dual,
helpstring("IMessageMember Interface"),
pointer_default(unique)
]
interface IMessageMember : IDispatch
{
[id(5), propget, helpstring("property Member"), defaultcollelem] HRESULT Member(VARIANT vIndex, [out, retval] VARIANT *pVal);
[id(6), propget, helpstring("property MemberName")] HRESULT MemberName(long Index, [out, retval] BSTR *pVal);
[id(7), propget, helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
};
[
object,
uuid(23EE0804-EAC7-493B-BB9D-2298FD44FFA1),
dual,
helpstring("IMessage Interface"),
pointer_default(unique)
]
interface IMessage : IDispatch
{
[id(2), propget, helpstring("property Type")] HRESULT Type([out, retval] long *pVal);
[id(3), propget, helpstring("property Data")] HRESULT Data([out, retval] VARIANT *pVal);
[id(5), propget, helpstring("property Member"), defaultcollelem] HRESULT Member(VARIANT vElement, [out, retval] VARIANT *pVal);
[id(6), propget, helpstring("property MemberName")] HRESULT MemberName(long Index, [out, retval] BSTR *pVal);
[id(7), propget, helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
};
[
object,
uuid(853BFE61-6C14-4244-8B96-96F0C9647DE6),
dual,
helpstring("IMessageMember Interface"),
pointer_default(unique)
]
interface IMessageIterator : IDispatch
{
[propget, id(10), helpstring("Move the cursor to the next position")] HRESULT Next([optional] VARIANT vIndex, [out, retval] VARIANT *pbValue);
[propget, id(1), helpstring("Data at the current position")] HRESULT Current([out, retval] VARIANT *pData);
[propget, id(2), helpstring("Name of a member at a particular index")] HRESULT MemberName([out, retval] BSTR *pVal);
[propget, id(3), helpstring("Current index of the iterator")] HRESULT Index([out,retval] long *pIndex);
[propget, id(4), helpstring("String member by name")] HRESULT NextString (BSTR Name, [out, retval] BSTR *pValue);
[propget, id(5), helpstring("Integer member by name")] HRESULT NextInt (BSTR Name, [out, retval] long *pValue);
[propget, id(6), helpstring("Float member by name")] HRESULT NextFloat (BSTR Name, [out, retval] float *pValue);
[propget, id(7), helpstring("Object member by name")] HRESULT NextObject (BSTR Name, [out, retval] IMessageIterator **pValue);
[propget, id(8), helpstring("Object member by index")] HRESULT NextObjectIndex ([out, retval] IMessageIterator **pValue);
[id(9), helpstring("Reset the iterator")] HRESULT Reset();
[propget, id(11), helpstring("Parent Message Object")] HRESULT Message([out, retval] IMessage **ppMsg);
};
[
object,
uuid(38AFE740-9189-4f7c-8DE2-E61087DD9F19),
dual,
helpstring("IMessage Interface"),
pointer_default(unique)
]
interface IMessage2 : IMessage
{
[propget, id(101), helpstring("property Members")] HRESULT Begin([out, retval] IMessageIterator * *pVal);
};
[
object,
uuid(AA405035-E001-4CC3-B43A-156206843D64),
helpstring("INetService Interface"),
pointer_default(unique)
]
interface INetService : IUnknown
{
[propget, helpstring("property Decal")] HRESULT Decal([out, retval] IDecal * *pVal);
[propget, helpstring("property Filter")] HRESULT Filter(REFCLSID clsid, REFIID iid, [out, retval, iid_is(iid)] LPVOID *pVal);
[propget, helpstring("property FilterVB")] HRESULT FilterVB(BSTR strProgID, [out, retval] LPDISPATCH *pVal);
[propget, helpstring("property Hooks")] HRESULT Hooks([out, retval] IACHooks * *pVal);
};
[
object,
uuid(EEB0BE9E-46BD-493F-97E2-330670C09F59),
dual,
helpstring("INetworkFilter Interface"),
pointer_default(unique)
]
interface INetworkFilter : IDispatch
{
[id(1), helpstring("method Dispatch")] HRESULT Dispatch(IMessage *Message);
};
[
object,
uuid(CE518B62-714F-4993-B0C2-C703A7062F38),
helpstring("INetworkFilter Interface"),
pointer_default(unique)
]
interface INetworkFilter2 : IUnknown
{
[helpstring("method Dispatch")] HRESULT DispatchServer(IMessage2 *Message);
[helpstring("method Dispatch")] HRESULT DispatchClient(IMessage2 *Message);
[helpstring("method Initialize")] HRESULT Initialize(INetService *pService);
[helpstring("method Terminate")] HRESULT Terminate();
};
[
object,
uuid(03F3E2D0-7026-4C11-988A-4B3C58C71917),
dual,
helpstring("IWebRequest Interface"),
pointer_default(unique)
]
interface IWebRequest : IDispatch
{
[id(1), helpstring("method Get")] HRESULT Get(BSTR strURL);
[id(2), helpstring("method Post")] HRESULT Post(BSTR strURL, BSTR strPostData);
};
[
uuid(572B87C4-93BD-46B3-A291-CD58181D25DC),
version(1.0),
helpstring("DecalNet 1.0 Type Library")
]
library DecalNet
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IMessageMember;
interface IMessage;
interface IMessage2;
interface INetworkFilter;
interface INetworkFilter2;
interface IMessageIterator;
[
uuid(C8C406F8-BA2E-4964-8B04-FF38394A8E0E),
helpstring("NetService Class")
]
coclass NetService
{
[default] interface INetService;
};
[
uuid(EEFA38DC-15B2-4232-B5BE-5A9ECB8E1A58),
helpstring("_IWebRequestEvents Interface")
]
dispinterface IWebRequestEvents
{
properties:
methods:
[id(1), helpstring("method Begin")] HRESULT Begin();
[id(2), helpstring("method End")] HRESULT End(long nResultCode, BSTR strText);
};
[
uuid(15631E36-55CB-4D16-ADE7-74D9F8A5F4B6),
helpstring("WebRequest Class")
]
coclass WebRequest
{
[default] interface IWebRequest;
[default, source] dispinterface IWebRequestEvents;
};
[
uuid(7A85E352-B133-4AB5-A9DA-85978005BF88),
helpstring("MessageRoot Class"),
noncreatable
]
coclass MessageRoot
{
[default] interface IMessageIterator;
};
};

View file

@ -0,0 +1,87 @@
// DecalNetImpl.h
// Declaration of class to help you implement Decal Network Filters
#ifndef __DECALNETIMPL_H
#define __DECALNETIMPL_H
#include <DecalNet.h>
// The solo network filter does not have any depencies and does not store
// the INetServices object - clients must implement INetworkFilter::Dispatch
template< class ImplT >
class ATL_NO_VTABLE ISoloNetworkFilterImpl
: public INetworkFilter2
{
public:
STDMETHOD(Initialize)(INetService *)
{
return S_OK;
}
STDMETHOD(Terminate)()
{
return S_OK;
}
STDMETHOD(DispatchServer)(IMessage2 *)
{
return S_OK;
}
STDMETHOD(DispatchClient)(IMessage2 *)
{
return S_OK;
}
};
// This version stores the INetService pointer passed during initialization.
// A network can use this to recall back to the Decal object and get extended
// state information
template< class ImplT >
class ATL_NO_VTABLE INetworkFilterImpl
: public INetworkFilter2
{
public:
CComPtr< INetService > m_pService;
HRESULT onInitialize()
{
return S_OK;
}
void onTerminate()
{
}
STDMETHOD(Initialize)(INetService *pService)
{
m_pService = pService;
HRESULT hRes = static_cast< ImplT * >( this )->onInitialize();
if( FAILED( hRes ) )
m_pService.Release();
return hRes;
}
STDMETHOD(Terminate)()
{
static_cast< ImplT * >( this )->onTerminate();
m_pService.Release();
return S_OK;
}
STDMETHOD(DispatchServer)(IMessage2 *)
{
return S_OK;
}
STDMETHOD(DispatchClient)(IMessage2 *)
{
return S_OK;
}
};
#endif

View file

@ -0,0 +1,14 @@
// DecalVersion.h
// Declaration of the Decal version resource
#ifndef __DECALVERSION_H__
#define __DECALVERSION_H__
#define DECAL_MAJOR 2
#define DECAL_MINOR 6
#define DECAL_BUGFIX 1
#define DECAL_RELEASE 1
#define DECAL_VERSION_STRING "2, 6, 1, 1"
#endif

View file

@ -0,0 +1,91 @@
// EventsImpl.h
// Declaration of helper class for implementing plugins
#ifndef _EVENTSIMPL_H_
#define _EVENTSIMPL_H_
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl, const IID *pIID, const GUID *pLIBID >
class IControlEventsImpl
: public IDispEventImpl< nID, cImpl, pIID, pLIBID, 1, 0 >
{
protected:
void advise( IUnknown *pUnk )
{
HRESULT hRes = DispEventAdvise( pUnk );
_ASSERTE( SUCCEEDED( hRes ) );
}
void unadvise( IUnknown *pUnk )
{
HRESULT hRes = DispEventUnadvise( pUnk );
_ASSERTE( SUCCEEDED( hRes ) );
}
};
#define DISPID_DESTROY 1
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class ICommandEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_ICommandEvents, &LIBID_DecalPlugins >
{
};
#define DISPID_HIT 2
#define DISPID_UNHIT 3
#define DISPID_ACCEPTED 4
#define DISPID_CANCELED 5
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IPagerEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IPagerEvents, &LIBID_DecalPlugins >
{
};
#define DISPID_CHANGE 6
#define DISPID_GETNEXTPOSITION 7
#define DISPID_UPDATE_POSITION 6
#define DISPID_GET_NEXT_POSITION 7
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IViewEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IViewEvents, &LIBID_DecalPlugins >
{
};
#define DISPID_ACTIVATE 8
#define DISPID_DEACTIVATE 9
#define DISPID_SIZE 13
#define DISPID_SIZING 14
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IInputEventsImpl
: public IControlEventsImpl< nID, cImpl, &DIID_IInputEvents, &LIBID_DecalPlugins >
{
};
#define DISPID_BEGIN 10
#define DISPID_END 11
#define DISPID_PAUSE 12
#endif // _EVENTSIMPL_H_

View file

@ -0,0 +1,80 @@
// FilterImpl.h
// Declaration of template classes to help network filters
#ifndef __FILTERIMPL_H
#define __FILTERIMPL_H
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl, const IID *pIID >
class IFilterEventsImpl
: public IDispEventImpl< nID, cImpl, pIID, &LIBID_DecalFilters, 1, 0 >
{
public:
HRESULT advise( IUnknown *pUnk )
{
return DispEventAdvise( pUnk );
}
HRESULT unadvise( IUnknown *pUnk )
{
return DispEventUnadvise( pUnk );
}
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IWorldEventsImpl
: public IFilterEventsImpl< nID, cImpl, &DIID_IWorldEvents >
{
};
#define DISPID_CREATE_OBJECT 1
#define DISPID_RELEASE_OBJECT 2
#define DISPID_CHANGE_OBJECT 3
#define DISPID_MOVED_OBJECT 4
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IEchoEventsImpl
: public IFilterEventsImpl< nID, cImpl, &DIID_IEchoSink >
{
};
#define DISPID_ECHO_MESSAGE 1
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class IEcho2EventsImpl
: public IFilterEventsImpl< nID, cImpl, &DIID_IEchoSink2 >
{
};
#define DISPID_ECHO_SERVER 1
#define DISPID_ECHO_CLIENT 2
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
template< UINT nID, class cImpl >
class ICharacterStatsEventsImpl
: public IFilterEventsImpl< nID, cImpl, &DIID_ICharacterStatsEvents >
{
};
#define DISPID_LOGIN 1
#define DISPID_SPELLBOOK_ADD 2
#define DISPID_SPELLBOOK_DELETE 3
#endif

27
Native/Include/ForceLib.h Normal file
View file

@ -0,0 +1,27 @@
/*
-> ForceLib.h
ForceLibrary.dll prototypes...
*/
#ifndef __ForceLibraryHeader__
#define __ForceLibraryHeader__
#ifdef __cplusplus
extern "C" {
#endif
DWORD __stdcall ForceLibrary(CHAR* szLibraryPath,PROCESS_INFORMATION* pProcInfo);
DWORD __stdcall ForceLibraryNow(DWORD dwPID, char* szDllPath);
BOOL __stdcall RemoteExec(DWORD dwPID, void* pCode, DWORD dwCodeSize, DWORD *dwCodeResult, DWORD dwMilliseconds);
BOOL __stdcall TrapEntry(DWORD dwEntryPoint,PROCESS_INFORMATION *pPI);
BOOL __stdcall ForceLibraryDBG(CHAR* szTargetLib,DWORD dwEntryPoint,PROCESS_INFORMATION *pPI);
DWORD __stdcall PerformCleanup(DWORD dwEntryPoint,PROCESS_INFORMATION *pPI);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

67
Native/Include/Helpers.h Normal file
View file

@ -0,0 +1,67 @@
#pragma once
class RegKey:
public CRegKey
{
#if _MSC_VER == 1200
public:
inline LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue)
{
return SetValue(dwValue, pszValueName);
}
inline LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType = REG_SZ)
{
return SetValue(pszValue, pszValueName);
}
inline LONG QueryDWORDValue(LPCTSTR pszValueName, DWORD& dwValue)
{
return QueryValue(dwValue, pszValueName);
}
inline LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars)
{
return QueryValue(pszValue, pszValueName, pnChars);
}
#endif
};
/*
inline LONG RegKey::QueryValue(DWORD& dwValue, LPCTSTR lpszValueName)
{
DWORD dwType = NULL;
DWORD dwCount = sizeof(DWORD);
LONG lRes = RegQueryValueEx(m_hKey, (LPTSTR)lpszValueName, NULL, &dwType,
(LPBYTE)&dwValue, &dwCount);
ATLASSERT((lRes!=ERROR_SUCCESS) || (dwType == REG_DWORD));
ATLASSERT((lRes!=ERROR_SUCCESS) || (dwCount == sizeof(DWORD)));
return lRes;
}
inline LONG RegKey::QueryValue(LPTSTR szValue, LPCTSTR lpszValueName, DWORD* pdwCount)
{
ATLASSERT(pdwCount != NULL);
DWORD dwType = NULL;
LONG lRes = RegQueryValueEx(m_hKey, (LPTSTR)lpszValueName, NULL, &dwType,
(LPBYTE)szValue, pdwCount);
ATLASSERT((lRes!=ERROR_SUCCESS) || (dwType == REG_SZ) ||
(dwType == REG_MULTI_SZ) || (dwType == REG_EXPAND_SZ));
return lRes;
}
inline LONG RegKey::SetValue(DWORD dwValue, LPCTSTR lpszValueName)
{
ATLASSERT(m_hKey != NULL);
return RegSetValueEx(m_hKey, lpszValueName, NULL, REG_DWORD,
(BYTE * const)&dwValue, sizeof(DWORD));
}
inline LONG RegKey::SetValue(LPCTSTR lpszValue, LPCTSTR lpszValueName)
{
ATLASSERT(lpszValue != NULL);
ATLASSERT(m_hKey != NULL);
return RegSetValueEx(m_hKey, lpszValueName, NULL, REG_SZ,
(BYTE * const)lpszValue, (lstrlen(lpszValue)+1)*sizeof(TCHAR));
}
*/

BIN
Native/Include/Inject.tlb Normal file

Binary file not shown.

43
Native/Include/VSBridge.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef __VSBRIDGE_H_
#define __VSBRIDGE_H_
namespace VSBridge
{
template<class _Ty>
class auto_ptr {
public:
typedef _Ty element_type;
explicit auto_ptr(_Ty *_P = 0) _THROW0()
: _Owns(_P != 0), _Ptr(_P) {}
auto_ptr(const auto_ptr<_Ty>& _Y) _THROW0()
: _Owns(_Y._Owns), _Ptr(_Y.release()) {}
auto_ptr<_Ty>& operator=(const auto_ptr<_Ty>& _Y) _THROW0()
{if (this != &_Y)
{if (_Ptr != _Y.get())
{if (_Owns)
delete _Ptr;
_Owns = _Y._Owns; }
else if (_Y._Owns)
_Owns = true;
_Ptr = _Y.release(); }
return (*this); }
~auto_ptr()
{if (_Owns)
delete _Ptr; }
_Ty& operator*() const _THROW0()
{return (*get()); }
_Ty *operator->() const _THROW0()
{return (get()); }
_Ty *get() const _THROW0()
{return (_Ptr); }
_Ty *release() const _THROW0()
{((auto_ptr<_Ty> *)this)->_Owns = false;
return (_Ptr); }
private:
bool _Owns;
_Ty *_Ptr;
};
}
#endif