///////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005 Werner Willemsens
//
///////////////////////////////////////////////////////////////////////
#ifndef _HOOK_H
#define _HOOK_H
#include <windows.h>
#include <oaidl.h>
#include <comutil.h>
#include <comdef.h>
static const GUID IID_IMarshalRichError =
{ 0x0000031C, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
static const GUID IID_IUnmarshalRichError =
{ 0x0000031B, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
class Hook : public IChannelHook
{
public:
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
STDMETHODIMP_(void) ClientGetSize(REFGUID uExtent, REFIID riid, ULONG *pDataSize);
STDMETHODIMP_(void) ClientFillBuffer(REFGUID uExtent, REFIID riid, ULONG *pDataSize, void *pDataBuffer);
STDMETHODIMP_(void) ClientNotify(REFGUID uExtent, REFIID riid, ULONG cbDataSize, void *pDataBuffer, DWORD lDataRep, HRESULT hrFault);
STDMETHODIMP_(void) ServerNotify(REFGUID uExtent, REFIID riid, ULONG cbDataSize, void *pDataBuffer, DWORD lDataRep);
STDMETHODIMP_(void) ServerGetSize(REFGUID uExtent, REFIID riid, HRESULT hrFault, ULONG *pDataSize);
STDMETHODIMP_(void) ServerFillBuffer(REFGUID uExtent, REFIID riid, ULONG *pDataSize, void *pDataBuffer, HRESULT hrFault);
protected:
GUID m_Guid;
_bstr_t m_sDescription;
_bstr_t m_sSource;
_bstr_t m_sHelpFile;
DWORD m_dwHelpContext;
};
/*
typedef struct tagSTDOBJREF
{
unsigned long flags;
unsigned long cPublicRefs;
OXID oxid;
OID oid;
IPID ipid;
} STDOBJREF;
typedef struct tagDUALSTRINGARRAY
{
unsigned short wNumEntries;
unsigned short wSecurityOffset;
unsigned short aStringArray[];
} DUALSTRINGARRAY;
*/
typedef struct tagOBJREF
{
unsigned long signature;
unsigned long flags;
GUID iid;
union
{
/*
struct
{
STDOBJREF std;
DUALSTRINGARRAY saResAddr;
} u_standard;
struct
{
STDOBJREF std;
CLSID clsid;
DUALSTRINGARRAY saResAddr;
} u_handler;
*/
struct
{
CLSID clsid;
unsigned long cbExtension;
unsigned long size;
byte Data;
} u_custom;
} u_objref;
} OBJREF;
bool StartChannelHook (void);
bool StopChannelHook (void);
#endif