The code doesn't start at the base of the image mate.
dwEngineEntryPoint = (DWORD)GetModuleHandleA("Engine.exe");
dwEngineCodeSize = GetCodeSize("Engine.exe");
FindPattern(dwEngineEntryPoint, dwEngineCodeSize, ...);
Just makes it apparent that you're pulling stuff out of various different sources and then dumping it altogther as your *own* base. Would make a lot more sense to keep using the FindPattern function and just do this:
DWORD * FindDevice(VOID)
DWORD Base = (DWORD)LoadLibraryW(L"d3d9.dll");
for(DWORD i = 0; i < 0x128000; i++ )
if ( (*(BYTE *)(Base+i+0x00))==0xC7
&& (*(BYTE *)(Base+i+0x01))==0x06
&& (*(BYTE *)(Base+i+0x06))==0x89
&& (*(BYTE *)(Base+i+0x07))==0x86
&& (*(BYTE *)(Base+i+0x0C))==0x89
&& (*(BYTE *)(Base+i+0x0D))==0x86 )
return (DWORD *)(Base + i + 2);
And there's so much unnecessary dereferencing and casting going on it's unreal.
DWORD *pVTable = (DWORD*)(FindPattern(GetModuleHandleW(L"d3d9.dll"), 0x128000, "\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx") + 2); //untested, just wrote it to make a point.