SoD Client backporting zones up to RoF (.DLL injection)
Works with the Seeds of Destruction client. Requires MSDetours to compile..
Adds all of the zones up to RoF to the Seeds of Destruction client. If you use a program like WinMerge, and add the files, all of the new zones will magically start to load.
Simply compile and place in your Seeds of Destruction folder. Should work with no issues with third party programs that reference dinput8.dll, not 100% sure though.
Source:
myIDinput.cpp
Code:
#include "StdAfx.h"
#include "myIDinput.h"
// ---------------------------------------------------------------------------------------------------
myIDirectInput8::myIDirectInput8(IDirectInput8 *pOriginal)
{ m_pIDirectInput8 = pOriginal; }
myIDirectInput8::~myIDirectInput8(void)
{ }
HRESULT myIDirectInput8::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
*ppvObj = NULL;
// call this to increase AddRef at original object
// and to check if such an interface is there
HRESULT hRes = m_pIDirectInput8->QueryInterface(riid, ppvObj);
if (hRes == NOERROR) // if OK, send our "fake" address
{
*ppvObj = this;
}
return hRes;
}
ULONG myIDirectInput8::AddRef(void)
{ return(m_pIDirectInput8->AddRef()); }
ULONG myIDirectInput8::Release(void)
{
extern myIDirectInput8* gl_pmyIDirectInput8;
// call original routine
ULONG count = m_pIDirectInput8->Release();
// in case no further Ref is there, the Original Object has deleted itself
// so do we here
if (count == 0)
{
// Debug
char tmp[150];
sprintf(tmp, "DI-PROXYDLL: myIDirectInput8::Release Deleting IDirectInput8 (ret=%i)", count);
OutputDebugString(tmp);
gl_pmyIDirectInput8 = NULL;
delete(this);
}
return(count);
}
HRESULT myIDirectInput8::CreateDevice(REFGUID a, LPDIRECTINPUTDEVICE8W *b, LPUNKNOWN c)
{
// global var
extern myIDirectInputDevice8* gl_pmyIDirectInputDevice8Array[];
// we intercept this call and provide our own "fake" Device Object
HRESULT hres = m_pIDirectInput8->CreateDevice( a,b,c);
int i = 0;
// find free Device slot
for (i=0; i<MAXNUMBER_DEVICES; i++)
{
if (gl_pmyIDirectInputDevice8Array[i] == NULL) break;
}
// Debug
char tmp[150];
sprintf(tmp, "DI-PROXYDLL: myIDirectInput8::CreateDevice called. Filling device slot %i \r\n", i);
OutputDebugString(tmp);
// Create our own Device object and store it in global pointer
// note: the object will delete itself once Ref count is zero (similar to COM objects)
gl_pmyIDirectInputDevice8Array[i] = new myIDirectInputDevice8(*b,i);
// store our pointer (the fake one) for returning it to the calling progam
*b = gl_pmyIDirectInputDevice8Array[i];
return(hres);
}
HRESULT myIDirectInput8::EnumDevices(DWORD a, LPDIENUMDEVICESCALLBACKW b, LPVOID c, DWORD d)
{ return(m_pIDirectInput8->EnumDevices(a, b, c, d)); }
HRESULT myIDirectInput8::GetDeviceStatus(REFGUID a)
{ return(m_pIDirectInput8->GetDeviceStatus(a)); }
HRESULT myIDirectInput8::RunControlPanel(HWND a, DWORD b)
{ return(m_pIDirectInput8->RunControlPanel(a, b)); }
HRESULT myIDirectInput8::Initialize(HINSTANCE a, DWORD b)
{ return(m_pIDirectInput8->Initialize(a, b)); }
HRESULT myIDirectInput8::FindDevice(REFGUID a, LPCWSTR b, LPGUID c)
{ return(m_pIDirectInput8->FindDevice(a, b, c)); }
HRESULT myIDirectInput8::EnumDevicesBySemantics(LPCWSTR a, LPDIACTIONFORMATW b, LPDIENUMDEVICESBYSEMANTICSCBW c, LPVOID d, DWORD e)
{ return(m_pIDirectInput8->EnumDevicesBySemantics(a,b,c,d,e)); }
HRESULT myIDirectInput8::ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK a, LPDICONFIGUREDEVICESPARAMSW b, DWORD c, LPVOID d)
{ return(m_pIDirectInput8->ConfigureDevices(a,b,c,d)); }
// ---------------------------------------------------------------------------------------------------
myIDirectInputDevice8::myIDirectInputDevice8(IDirectInputDevice8 *pOriginal, int iInterfaceNumber)
{
m_iInterfaceNumber = iInterfaceNumber;
m_pIDirectInputDevice8 = pOriginal;
}
myIDirectInputDevice8::~myIDirectInputDevice8(void)
{ }
HRESULT myIDirectInputDevice8::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
*ppvObj = NULL;
// call this to increase AddRef at original object
// and to check if such an interface is there
HRESULT hRes = m_pIDirectInputDevice8->QueryInterface(riid, ppvObj);
if (hRes == NOERROR) // if OK, send our "fake" address
{
*ppvObj = this;
}
return hRes;
}
ULONG myIDirectInputDevice8::AddRef(void)
{ return(m_pIDirectInputDevice8->AddRef()); }
ULONG myIDirectInputDevice8::Release(void)
{
extern myIDirectInputDevice8* gl_pmyIDirectInputDevice8Array[];
// call original routine
ULONG count = m_pIDirectInputDevice8->Release();
// in case no further Ref is there, the Original Object has deleted itself
// so do we here
if (count == 0)
{
// Debug
char tmp[150];
sprintf(tmp, "DI-PROXYDLL: myIDirectInputDevice8::Release called. Clearing device slot %i \r\n", m_iInterfaceNumber);
OutputDebugString(tmp);
gl_pmyIDirectInputDevice8Array[m_iInterfaceNumber] = NULL;
delete(this);
}
return(count);}
HRESULT myIDirectInputDevice8::GetCapabilities(LPDIDEVCAPS a)
{ return(m_pIDirectInputDevice8->GetCapabilities(a)); }
HRESULT myIDirectInputDevice8::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW a, LPVOID b, DWORD c)
{ return(m_pIDirectInputDevice8->EnumObjects(a,b,c)); }
HRESULT myIDirectInputDevice8::GetProperty(REFGUID a,LPDIPROPHEADER b)
{ return(m_pIDirectInputDevice8->GetProperty(a,b)); }
HRESULT myIDirectInputDevice8::SetProperty(REFGUID a,LPCDIPROPHEADER b)
{ return(m_pIDirectInputDevice8->SetProperty(a,b)); }
HRESULT myIDirectInputDevice8::Acquire(void)
{ return(m_pIDirectInputDevice8->Acquire()); }
HRESULT myIDirectInputDevice8::Unacquire(void)
{ return(m_pIDirectInputDevice8->Unacquire()); }
HRESULT myIDirectInputDevice8::GetDeviceState(DWORD a,LPVOID b)
{ return(m_pIDirectInputDevice8->GetDeviceState(a,b));}
HRESULT myIDirectInputDevice8::GetDeviceData(DWORD a,LPDIDEVICEOBJECTDATA b,LPDWORD c,DWORD d)
{ return(m_pIDirectInputDevice8->GetDeviceData(a,b,c,d)); }
HRESULT myIDirectInputDevice8::SetDataFormat(LPCDIDATAFORMAT a)
{ return(m_pIDirectInputDevice8->SetDataFormat(a)); }
HRESULT myIDirectInputDevice8::SetEventNotification(HANDLE a)
{ return(m_pIDirectInputDevice8->SetEventNotification(a)); }
HRESULT myIDirectInputDevice8::SetCooperativeLevel(HWND a,DWORD b)
{ return(m_pIDirectInputDevice8->SetCooperativeLevel(a,b)); }
HRESULT myIDirectInputDevice8::GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW a,DWORD b,DWORD c)
{ return(m_pIDirectInputDevice8->GetObjectInfo(a,b,c)); }
HRESULT myIDirectInputDevice8::GetDeviceInfo(LPDIDEVICEINSTANCEW a)
{ return(m_pIDirectInputDevice8->GetDeviceInfo(a)); }
HRESULT myIDirectInputDevice8::RunControlPanel(HWND a,DWORD b)
{ return(m_pIDirectInputDevice8->RunControlPanel(a,b)); }
HRESULT myIDirectInputDevice8::Initialize(HINSTANCE a,DWORD b,REFGUID c)
{ return(m_pIDirectInputDevice8->Initialize(a,b,c)); }
HRESULT myIDirectInputDevice8::CreateEffect(REFGUID a,LPCDIEFFECT b,LPDIRECTINPUTEFFECT *c,LPUNKNOWN d)
{ return(m_pIDirectInputDevice8->CreateEffect(a,b,c,d)); }
HRESULT myIDirectInputDevice8::EnumEffects(LPDIENUMEFFECTSCALLBACKW a,LPVOID b,DWORD c)
{ return(m_pIDirectInputDevice8->EnumEffects(a,b,c)); }
HRESULT myIDirectInputDevice8::GetEffectInfo(LPDIEFFECTINFOW a,REFGUID b)
{ return(m_pIDirectInputDevice8->GetEffectInfo(a,b)); }
HRESULT myIDirectInputDevice8::GetForceFeedbackState(LPDWORD a)
{ return(m_pIDirectInputDevice8->GetForceFeedbackState(a)); }
HRESULT myIDirectInputDevice8::SendForceFeedbackCommand(DWORD a)
{ return(m_pIDirectInputDevice8->SendForceFeedbackCommand(a)); }
HRESULT myIDirectInputDevice8::EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK a,LPVOID b,DWORD c)
{ return(m_pIDirectInputDevice8->EnumCreatedEffectObjects(a,b,c)); }
HRESULT myIDirectInputDevice8::Escape(LPDIEFFESCAPE a)
{ return(m_pIDirectInputDevice8->Escape(a)); }
HRESULT myIDirectInputDevice8::Poll(void)
{ return(m_pIDirectInputDevice8->Poll()); }
HRESULT myIDirectInputDevice8::SendDeviceData(DWORD a,LPCDIDEVICEOBJECTDATA b,LPDWORD c,DWORD d)
{ return(m_pIDirectInputDevice8->SendDeviceData(a,b,c,d)); }
HRESULT myIDirectInputDevice8::EnumEffectsInFile(LPCWSTR a,LPDIENUMEFFECTSINFILECALLBACK b,LPVOID c,DWORD d)
{ return(m_pIDirectInputDevice8->EnumEffectsInFile(a,b,c,d)); }
HRESULT myIDirectInputDevice8::WriteEffectToFile(LPCWSTR a,DWORD b,LPDIFILEEFFECT c,DWORD d)
{ return(m_pIDirectInputDevice8->WriteEffectToFile(a,b,c,d)); }
HRESULT myIDirectInputDevice8::BuildActionMap(LPDIACTIONFORMATW a,LPCWSTR b,DWORD c)
{ return(m_pIDirectInputDevice8->BuildActionMap(a,b,c)); }
HRESULT myIDirectInputDevice8::SetActionMap(LPDIACTIONFORMATW a,LPCWSTR b,DWORD c)
{ return(m_pIDirectInputDevice8->SetActionMap(a,b,c)); }
HRESULT myIDirectInputDevice8::GetImageInfo(LPDIDEVICEIMAGEINFOHEADERW a)
{ return(m_pIDirectInputDevice8->GetImageInfo(a)); }
// ---------------------------------------------------------------------------------------------------
myIDirectInputEffect::myIDirectInputEffect(IDirectInputEffect *pOriginal)
{ m_pIDirectInputEffect = pOriginal; }
myIDirectInputEffect::~myIDirectInputEffect(void)
{ }
HRESULT myIDirectInputEffect::QueryInterface(REFIID riid, LPVOID * ppvObj)
{ return(m_pIDirectInputEffect->QueryInterface(riid, ppvObj)); }
ULONG myIDirectInputEffect::AddRef(void)
{ return(m_pIDirectInputEffect->AddRef()); }
ULONG myIDirectInputEffect::Release(void)
{ return(m_pIDirectInputEffect->Release()); }
HRESULT myIDirectInputEffect::Initialize(HINSTANCE a,DWORD b,REFGUID c)
{ return(m_pIDirectInputEffect->Initialize(a,b,c)); }
HRESULT myIDirectInputEffect::GetEffectGuid(LPGUID a)
{ return(m_pIDirectInputEffect->GetEffectGuid(a)); }
HRESULT myIDirectInputEffect::GetParameters(LPDIEFFECT a,DWORD b)
{ return(m_pIDirectInputEffect->GetParameters(a,b)); }
HRESULT myIDirectInputEffect::SetParameters(LPCDIEFFECT a,DWORD b)
{ return(m_pIDirectInputEffect->SetParameters(a,b)); }
HRESULT myIDirectInputEffect::Start(DWORD a,DWORD b)
{ return(m_pIDirectInputEffect->Start(a,b)); }
HRESULT myIDirectInputEffect::Stop(void)
{ return(m_pIDirectInputEffect->Stop()); }
HRESULT myIDirectInputEffect::GetEffectStatus(LPDWORD a)
{ return(m_pIDirectInputEffect->GetEffectStatus(a)); }
HRESULT myIDirectInputEffect::Download(void)
{ return(m_pIDirectInputEffect->Download()); }
HRESULT myIDirectInputEffect::Unload(void)
{ return(m_pIDirectInputEffect->Unload()); }
HRESULT myIDirectInputEffect::Escape(LPDIEFFESCAPE a)
{ return(m_pIDirectInputEffect->Escape(a)); }
myIDinput.h
Code:
#pragma once
class myIDirectInput8: public IDirectInput8
{
public:
myIDirectInput8(IDirectInput8 *pOriginal);
virtual ~myIDirectInput8(void);
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall CreateDevice(REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN);
HRESULT __stdcall EnumDevices(DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD);
HRESULT __stdcall GetDeviceStatus(REFGUID);
HRESULT __stdcall RunControlPanel(HWND,DWORD);
HRESULT __stdcall Initialize(HINSTANCE,DWORD);
HRESULT __stdcall FindDevice(REFGUID,LPCWSTR,LPGUID);
HRESULT __stdcall EnumDevicesBySemantics(LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD);
HRESULT __stdcall ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID);
private:
IDirectInput8 *m_pIDirectInput8;
};
class myIDirectInputDevice8: public IDirectInputDevice8
{
public:
myIDirectInputDevice8(IDirectInputDevice8 *pOriginal, int iInterfaceNumber);
virtual ~myIDirectInputDevice8(void);
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall GetCapabilities(LPDIDEVCAPS);
HRESULT __stdcall EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD);
HRESULT __stdcall GetProperty(REFGUID,LPDIPROPHEADER);
HRESULT __stdcall SetProperty(REFGUID,LPCDIPROPHEADER);
HRESULT __stdcall Acquire(void);
HRESULT __stdcall Unacquire(void);
HRESULT __stdcall GetDeviceState(DWORD,LPVOID);
HRESULT __stdcall GetDeviceData(DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD);
HRESULT __stdcall SetDataFormat(LPCDIDATAFORMAT);
HRESULT __stdcall SetEventNotification(HANDLE);
HRESULT __stdcall SetCooperativeLevel(HWND,DWORD);
HRESULT __stdcall GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD);
HRESULT __stdcall GetDeviceInfo(LPDIDEVICEINSTANCEW);
HRESULT __stdcall RunControlPanel(HWND,DWORD);
HRESULT __stdcall Initialize(HINSTANCE,DWORD,REFGUID);
HRESULT __stdcall CreateEffect(REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN);
HRESULT __stdcall EnumEffects(LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD);
HRESULT __stdcall GetEffectInfo(LPDIEFFECTINFOW,REFGUID);
HRESULT __stdcall GetForceFeedbackState(LPDWORD);
HRESULT __stdcall SendForceFeedbackCommand(DWORD);
HRESULT __stdcall EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD);
HRESULT __stdcall Escape(LPDIEFFESCAPE);
HRESULT __stdcall Poll(void);
HRESULT __stdcall SendDeviceData(DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD);
HRESULT __stdcall EnumEffectsInFile(LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD);
HRESULT __stdcall WriteEffectToFile(LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD);
HRESULT __stdcall BuildActionMap(LPDIACTIONFORMATW,LPCWSTR,DWORD);
HRESULT __stdcall SetActionMap(LPDIACTIONFORMATW,LPCWSTR,DWORD);
HRESULT __stdcall GetImageInfo(LPDIDEVICEIMAGEINFOHEADERW);
private:
IDirectInputDevice8 *m_pIDirectInputDevice8;
int m_iInterfaceNumber;
};
class myIDirectInputEffect: public IDirectInputEffect
{
public:
myIDirectInputEffect(IDirectInputEffect *pOriginal);
virtual ~myIDirectInputEffect(void);
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall Initialize(HINSTANCE,DWORD,REFGUID);
HRESULT __stdcall GetEffectGuid(LPGUID);
HRESULT __stdcall GetParameters(LPDIEFFECT,DWORD);
HRESULT __stdcall SetParameters(LPCDIEFFECT,DWORD);
HRESULT __stdcall Start(DWORD,DWORD);
HRESULT __stdcall Stop(void);
HRESULT __stdcall GetEffectStatus(LPDWORD);
HRESULT __stdcall Download(void);
HRESULT __stdcall Unload(void);
HRESULT __stdcall Escape(LPDIEFFESCAPE);
private:
IDirectInputEffect *m_pIDirectInputEffect;
};
//WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags );
//void WINAPI ShowJoyCPL( HWND hWnd );
dllmain.cpp
Code:
#include <Windows.h>
#include <stdio.h>
#include <string>
#include "detours.h"
#pragma comment( lib, "detours.lib" )
#include "stdafx.h"
#include "DInputDll.h"
// global variables
#pragma data_seg (".dinput_shared")
myIDirectInputDevice8* gl_pmyIDirectInputDevice8Array[MAXNUMBER_DEVICES];
myIDirectInput8* gl_pmyIDirectInput8;
//myIDirectInputEffect* gl_pmyIDirectInputEffect;
HINSTANCE gl_hOriginalDll;
HINSTANCE gl_hThisInstance;
#pragma data_seg ()
class EQWorldData {
public:
};
DWORD LogAddr = 0x006B0BB0;
DWORD WDataAddr = 0x00693E10;
DWORD WDataAddZoneAddr = 0x006939D0;
EQWorldData** pinstWorldData = (EQWorldData**)0x00A425C4;
DWORD DeconstructorAddr = 0x0071A640;
bool isWorldDataLoaded = false;
bool AddedZone = false;
void __cdecl WDataHook() {
AddedZone = false;
isWorldDataLoaded = false;
}
void WDataCheck()
{
while (1==1)
{
while (isWorldDataLoaded==false)
{
while (*pinstWorldData == NULL)
{
Sleep(1000);
}
isWorldDataLoaded = true;
}
if(isWorldDataLoaded==true && AddedZone == false)
{
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData, 0 , 5, "highpass", "Highhold Pass", 2247, 7, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 480, "brellsrest", "Brell's Rest", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 481, "fungalforest", "Fungal Forest", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 482, "underquarry", "The Underquarry", 1216, 32, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 483, "coolingchamber", "The Cooling Chamber", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 484, "shiningcity", "Kernagir, The Shining City", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 485, "arthicrex", "Arthicrex", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 486, "foundation", "The Foundation", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 487, "lichencreep", "Lichen Creep", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 488, "pellucid", "Pellucid Grotto", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 489, "stonesnake", "Volska's Husk", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 490, "brellstemple", "Brell's Temple", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 491, "convorteum", "The Convorteum", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 492, "brellsarena", "Brell's Arena", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 493, "weddingchapel", "Wedding Chapel", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 494, "weddingchapeldark", "Wedding Chapel", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 495, "dragoncrypt", "Lair of the Fallen", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 700, "feerrott2", "The Feerrott", 1216, 32, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 701, "thulehouse1", "House of Thule", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 702, "thulehouse2", "House of Thule, Upper Floors", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 703, "housegarden", "The Grounds", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 704, "thulelibrary", "The Library", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 705, "well", "The Well", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 706, "fallen", "Erudin Burning", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 707, "morellcastle", "Morell's Castle", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 708, "somnium", "Sanctum Somnium", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 709, "alkabormare", "Al'Kabor's Nightmare", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 710, "miragulmare", "Miragul's Nightmare", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 711, "thuledream", "Fear Itself", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 712, "neighborhood", "Sunrise Hills", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 713, "phylactery", "Miragul's Phylactery", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 714, "phinterior3a1", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 716, "phinterior3a2", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 717, "phinterior3a3", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 715, "phinterior1a1", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 718, "phinterior1a2", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 719, "phinterior1a3", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 719, "phinterior1a3", "House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 720, "phinterior1b1", "Dragon House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 723, "phinterior1d1", "Dragon House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 724, "argath", "Argath, Bastion of Illdaera", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 725, "arelis", "Valley of Lunanyn", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 726, "sarithcity", "Sarith, City of Tides", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 727, "rubak", "Rubak Oseka, Temple of the Sea", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 728, "beastdomain", "Beasts' Domain", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 729, "resplendent", "The Resplendent Temple", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 730, "pillarsalra", "Pillars of Alra", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 731, "windsong", "Windsong Sanctuary", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 732, "cityofbronze", "Erillion, City of Bronze", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 733, "sepulcher", "Sepulcher of Order", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 734, "eastsepulcher", "Sepulcher East", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 735, "westsepulcher", "Sepulcher West", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 736, "shadowedmount", "Shadowed Mount", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 737, "guildhalllrg", "Grand Guild Hall", 1216, -2139095040, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 738, "guildhallsml", "Greater Guild Hall", 1216, -2139095040, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 739, "plhogrinteriors1a1", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 740, "plhogrinteriors1a2", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 741, "plhogrinteriors3a1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 742, "plhogrinteriors3a2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 743, "plhogrinteriors3b1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 744, "plhogrinteriors3b2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 745, "plhdkeinteriors1a1", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 746, "plhdkeinteriors1a2", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 747, "plhdkeinteriors1a3", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 748, "plhdkeinteriors3a1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 749, "plhdkeinteriors3a2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 750, "plhdkeinteriors3a3", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 751, "guildhall3", "Modest Guild Hall", 1216, -2139095040, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 754, "kaelshard", "Kael Drakkel: The King's Madness", 1216, 8213, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 755, "eastwastesshard", "East Wastes: Zeixshi-Kar's Awakening", 1216, 4227076, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 756, "crystalshard", "The Crystal Caverns: Fragment of Fear", 1216, 4, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 752, "shardslanding", "Shard's Landing", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 753, "xorbb", "Valley of King Xorbb", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 757, "breedinggrounds", "The Breeding Grounds", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 758, "eviltree", "Evantil, the Vile Oak", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 759, "grelleth", "Grelleth's Palace, the Chateau of Filth", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 760, "chapterhouse", "Chapterhouse of the Fallen", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 766, "phinteriortree", "Evantil's Abode", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 763, "chelsith", "Chelsith Reborn", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 764, "poshadow", "Plane of Shadow", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 765, "heartoffear", "Heart of Fear", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,2, 761, "pomischief", "The Plane of Mischief", 1216, 0, 0, 0, 0);
((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,1, 762, "burnedwoods", "The Burned Woods", 1216, 0, 0, 0, 0);
AddedZone=true;
}
Sleep(1000);
}
}
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
// to avoid compiler lvl4 warnings
LPVOID lpDummy = lpReserved;
lpDummy = NULL;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
InitInstance(hModule);
CreateThread(NULL, 0, (unsigned long (__stdcall *)(void *))WDataCheck, NULL, 0, NULL);
//LogDet.Detour((PBYTE)LogAddr, ( PBYTE )LogHook);
DetourFunction((PBYTE)DeconstructorAddr, (PBYTE)WDataHook);
/*if(!AllocConsole())
{
return 0;
}*/
//SetConsoleTitle(TEXT("Console of the Gods"));
//LogDet.Apply();
break;
}
case DLL_PROCESS_DETACH: ExitInstance(); break;
case DLL_THREAD_ATTACH: break;
case DLL_THREAD_DETACH: break;
}
return TRUE;
}
// Exported function (faking dinput.dll's exports)
HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter)
{
OutputDebugString("DI-PROXYDLL: In DirectInput8Create.\r\n");
if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
typedef HRESULT (WINAPI* DirectInputCreate_Type)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter);
DirectInputCreate_Type DirectInputCreate_fn = (DirectInputCreate_Type) GetProcAddress( gl_hOriginalDll, "DirectInput8Create");
// Debug
if (!DirectInputCreate_fn)
{
OutputDebugString("DI-PROXYDLL: Pointer to original DirectInput8Create function not received ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
// Debug
char tmp[150];
sprintf(tmp, "DI-PROXYDLL: DirectInput8Create called with DIRECTINPUT_VERSION=%o \r\n",dwVersion);
OutputDebugString(tmp);
// REVIEW REVIEW REVIEW Instance Handle ! Original or own ?
// REVIEW REVIEW REVIEW Check for UNICODE or ANSI (riidltf) !
HINSTANCE dummy = hinst;
dummy = NULL;
// Create real Interface
LPVOID pIDirectInput_orig;
HRESULT hr = DirectInputCreate_fn(gl_hThisInstance, dwVersion, riidltf, (LPVOID*) &pIDirectInput_orig, punkOuter);
// Create my IDirectInput object and store pointer to original object there.
// note: the object will delete itself once Ref count is zero (similar to COM objects)
if (gl_pmyIDirectInput8) gl_pmyIDirectInput8->AddRef();
else gl_pmyIDirectInput8 = new myIDirectInput8((IDirectInput8*)pIDirectInput_orig);
// Return pointer to hooking Object instead of "real one"
*ppvOut = gl_pmyIDirectInput8;
return(hr);
}
// Exported function (faking dinput.dll's exports)
HRESULT WINAPI DllCanUnloadNow(void)
{
OutputDebugString("DI-PROXYDLL: In DllCanUnloadNow.\r\n");
if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
typedef HRESULT (WINAPI *DllCanUnloadNow_Type)(void);
DllCanUnloadNow_Type DllCanUnloadNow_fn = (DllCanUnloadNow_Type) GetProcAddress( gl_hOriginalDll, "DllCanUnloadNow");
// Debug
if (!DllCanUnloadNow_fn)
{
OutputDebugString("DI-PROXYDLL: Pointer to original DllCanUnloadNow function not received ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
// Call original dll and return
return(DllCanUnloadNow_fn());
}
HRESULT WINAPI DllGetClassObject (const CLSID &rclsid, const IID &riid, void **ppv)
{
OutputDebugString("DI-PROXYDLL: In DllGetClassObject.\r\n");
if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
typedef HRESULT (WINAPI *DllGetClassObject_Type)(const CLSID &rclsid, const IID &riid, void **ppv);
DllGetClassObject_Type DllGetClassObject_fn = (DllGetClassObject_Type) GetProcAddress( gl_hOriginalDll, "DllGetClassObject");
// Debug
if (!DllGetClassObject_fn)
{
OutputDebugString("DI-PROXYDLL: Pointer to original DllGetClassObject function not received ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
// Call original dll and return
return(DllGetClassObject_fn(rclsid, riid, ppv));
}
HRESULT WINAPI DllRegisterServer (void)
{
OutputDebugString("DI-PROXYDLL: In DllRegisterServer.\r\n");
if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
typedef HRESULT (WINAPI *DllRegisterServer_Type)(void);
DllRegisterServer_Type DllRegisterServer_fn = (DllRegisterServer_Type) GetProcAddress( gl_hOriginalDll, "DllRegisterServer");
// Debug
if (!DllRegisterServer_fn)
{
OutputDebugString("DI-PROXYDLL: Pointer to original DllRegisterServer function not received ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
// Call original dll and return
return(DllRegisterServer_fn());
}
HRESULT WINAPI DllUnregisterServer (void)
{
OutputDebugString("DI-PROXYDLL: In DllUnregisterServer.\r\n");
if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
typedef HRESULT (WINAPI *DllUnregisterServer_Type)(void);
DllUnregisterServer_Type DllUnregisterServer_fn = (DllUnregisterServer_Type) GetProcAddress( gl_hOriginalDll, "DllUnregisterServer");
// Debug
if (!DllUnregisterServer_fn)
{
OutputDebugString("DI-PROXYDLL: Pointer to original DllUnregisterServer function not received ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
// Call original dll and return
return(DllUnregisterServer_fn());
}
void InitInstance(HANDLE hModule)
{
OutputDebugString("DI-PROXYDLL: In InitInstance.\r\n");
// Initialisation
gl_pmyIDirectInput8 = NULL;
for (int i=0; i<MAXNUMBER_DEVICES; i++) gl_pmyIDirectInputDevice8Array[i] = NULL;
//gl_pmyIDirectInputEffect = NULL
gl_hOriginalDll = NULL;
gl_hThisInstance = NULL;
// Storing Instance handle into global var
gl_hThisInstance = (HINSTANCE) hModule;
}
void LoadOriginalDll(void)
{
OutputDebugString("DI-PROXYDLL: In LoadOriginalDll.\r\n");
char buffer[MAX_PATH];
// Getting path to system dir and to dinput.dll
::GetSystemDirectory(buffer,MAX_PATH);
// Append dll name
strcat(buffer,"\\dinput8.dll");
// try to load the system's dinput.dll, if pointer empty
if (!gl_hOriginalDll) gl_hOriginalDll = ::LoadLibrary(buffer);
// Debug
if (!gl_hOriginalDll)
{
OutputDebugString("DI-PROXYDLL: Original dinput8.dll not loaded ERROR ****\r\n");
::ExitProcess(0); // exit the hard way
}
}
void ExitInstance()
{
OutputDebugString("DI-PROXYDLL: In ExitInstance.\r\n");
// Release the system's dinput8.dll
if (gl_hOriginalDll)
{
::FreeLibrary(gl_hOriginalDll);
gl_hOriginalDll = NULL;
}
}
//------------------------------------------------------------------------------------------------------------------------------------
// always return false on this shit
extern "C" __declspec(naked) void __stdcall __E__0__()
{
}
dinputdll.def
Code:
LIBRARY "dinput8.dll"
EXPORTS
DirectInput8Create @1
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
|