1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_02_21_src

Former-commit-id: 19a4107c5167d803a3f7d0d58852c52f719c3610
This commit is contained in:
gho tik 2013-02-06 11:19:16 -05:00 committed by Refael ACkermann
parent 24d116b534
commit 68d6b7317c
43 changed files with 3134 additions and 8856 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,6 +126,40 @@ DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0
/* {E4A36723-FDFE-4b22-B146-3C04C07F4CC8} */
DEFINE_GUID(IID_HelperName, 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x4, 0xc0, 0x7f, 0x4c, 0xc8);
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
/* IID_IDirect3D9Ex */
/* {02177241-69FC-400C-8FF1-93A44DF6861D} */
DEFINE_GUID(IID_IDirect3D9Ex, 0x02177241, 0x69FC, 0x400C, 0x8F, 0xF1, 0x93, 0xA4, 0x4D, 0xF6, 0x86, 0x1D);
/* IID_IDirect3DDevice9Ex */
// {B18B10CE-2649-405a-870F-95F777D4313A}
DEFINE_GUID(IID_IDirect3DDevice9Ex, 0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a);
/* IID_IDirect3DSwapChain9Ex */
/* {91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303} */
DEFINE_GUID(IID_IDirect3DSwapChain9Ex, 0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3);
/* IID_IDirect3D9ExOverlayExtension */
/* {187aeb13-aaf5-4c59-876d-e059088c0df8} */
DEFINE_GUID(IID_IDirect3D9ExOverlayExtension, 0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8);
/* IID_IDirect3DDevice9Video */
// {26DC4561-A1EE-4ae7-96DA-118A36C0EC95}
DEFINE_GUID(IID_IDirect3DDevice9Video, 0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95);
/* IID_IDirect3D9AuthenticatedChannel */
// {FF24BEEE-DA21-4beb-98B5-D2F899F98AF9}
DEFINE_GUID(IID_IDirect3DAuthenticatedChannel9, 0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9);
/* IID_IDirect3DCryptoSession9 */
// {FA0AB799-7A9C-48ca-8C5B-237E71A54434}
DEFINE_GUID(IID_IDirect3DCryptoSession9, 0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34);
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#endif
@ -162,6 +196,20 @@ interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapCha
interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9;
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
interface DECLSPEC_UUID("02177241-69FC-400C-8FF1-93A44DF6861D") IDirect3D9Ex;
interface DECLSPEC_UUID("B18B10CE-2649-405a-870F-95F777D4313A") IDirect3DDevice9Ex;
interface DECLSPEC_UUID("91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303") IDirect3DSwapChain9Ex;
interface DECLSPEC_UUID("187AEB13-AAF5-4C59-876D-E059088C0DF8") IDirect3D9ExOverlayExtension;
interface DECLSPEC_UUID("26DC4561-A1EE-4ae7-96DA-118A36C0EC95") IDirect3DDevice9Video;
interface DECLSPEC_UUID("FF24BEEE-DA21-4beb-98B5-D2F899F98AF9") IDirect3DAuthenticatedChannel9;
interface DECLSPEC_UUID("FA0AB799-7A9C-48CA-8C5B-237E71A54434") IDirect3DCryptoSession9;
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#if defined(_COM_SMARTPTR_TYPEDEF)
_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9));
_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9));
@ -185,7 +233,23 @@ _COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9));
_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9));
_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9));
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
_COM_SMARTPTR_TYPEDEF(IDirect3D9Ex, __uuidof(IDirect3D9Ex));
_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Ex, __uuidof(IDirect3DDevice9Ex));
_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9Ex, __uuidof(IDirect3DSwapChain9Ex));
_COM_SMARTPTR_TYPEDEF(IDirect3D9ExOverlayExtension, __uuidof(IDirect3D9ExOverlayExtension));
_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Video, __uuidof(IDirect3DDevice9Video));
_COM_SMARTPTR_TYPEDEF(IDirect3DAuthenticatedChannel9, __uuidof(IDirect3DAuthenticatedChannel9));
_COM_SMARTPTR_TYPEDEF(IDirect3DCryptoSession9, __uuidof(IDirect3DCryptoSession9));
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#endif
#endif
@ -208,6 +272,21 @@ typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9;
typedef interface IDirect3DQuery9 IDirect3DQuery9;
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
typedef interface IDirect3D9Ex IDirect3D9Ex;
typedef interface IDirect3DDevice9Ex IDirect3DDevice9Ex;
typedef interface IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex;
typedef interface IDirect3D9ExOverlayExtension IDirect3D9ExOverlayExtension;
typedef interface IDirect3DDevice9Video IDirect3DDevice9Video;
typedef interface IDirect3DAuthenticatedChannel9 IDirect3DAuthenticatedChannel9;
typedef interface IDirect3DCryptoSession9 IDirect3DCryptoSession9;
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#include "d3d9types.h"
#include "d3d9caps.h"
@ -750,6 +829,9 @@ typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
#endif
#undef INTERFACE
#define INTERFACE IDirect3DStateBlock9
@ -1764,6 +1846,23 @@ typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
// mode, etc.) should be coded.
#define D3DCREATE_NOWINDOWCHANGES 0x00000800L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
// Disable multithreading for software vertex processing
#define D3DCREATE_DISABLE_PSGP_THREADING 0x00002000L
// This flag enables present statistics on device.
#define D3DCREATE_ENABLE_PRESENTSTATS 0x00004000L
// This flag disables printscreen support in the runtime for this device
#define D3DCREATE_DISABLE_PRINTSCREEN 0x00008000L
#define D3DCREATE_SCREENSAVER 0x10000000L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/****************************************************************************
*
@ -1779,8 +1878,24 @@ typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
*
****************************************************************************/
/*
* The D3DENUM_WHQL_LEVEL value has been retired for 9Ex and future versions,
* but it needs to be defined here for compatibility with DX9 and earlier versions.
* See the DirectX SDK for sample code on discovering driver signatures.
*/
#define D3DENUM_WHQL_LEVEL 0x00000002L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
/* NO_DRIVERVERSION will not fill out the DriverVersion field, nor will the
DriverVersion be incorporated into the DeviceIdentifier GUID. WINNT only */
#define D3DENUM_NO_DRIVERVERSION 0x00000004L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/****************************************************************************
*
* Maximum number of back-buffers supported in DX9
@ -1789,6 +1904,20 @@ typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
#define D3DPRESENT_BACK_BUFFERS_MAX 3L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
/****************************************************************************
*
* Maximum number of back-buffers supported when apps use CreateDeviceEx
*
****************************************************************************/
#define D3DPRESENT_BACK_BUFFERS_MAX_EX 30L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/****************************************************************************
*
* Flags for IDirect3DDevice9::SetGammaRamp
@ -1815,6 +1944,21 @@ typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
#define D3DPRESENT_DONOTWAIT 0x00000001L
#define D3DPRESENT_LINEAR_CONTENT 0x00000002L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DPRESENT_DONOTFLIP 0x00000004L
#define D3DPRESENT_FLIPRESTART 0x00000008L
#define D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR 0x00000010L
#define D3DPRESENT_UPDATEOVERLAYONLY 0x00000020L
#define D3DPRESENT_HIDEOVERLAY 0x00000040L
#define D3DPRESENT_UPDATECOLORKEY 0x00000080L
#define D3DPRESENT_FORCEIMMEDIATE 0x00000100L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/****************************************************************************
*
* Flags for DrawPrimitive/DrawIndexedPrimitive
@ -1860,6 +2004,783 @@ typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540)
#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159)
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DERR_DEVICEREMOVED MAKE_D3DHRESULT(2160)
#define S_NOT_RESIDENT MAKE_D3DSTATUS(2165)
#define S_RESIDENT_IN_SHARED_MEMORY MAKE_D3DSTATUS(2166)
#define S_PRESENT_MODE_CHANGED MAKE_D3DSTATUS(2167)
#define S_PRESENT_OCCLUDED MAKE_D3DSTATUS(2168)
#define D3DERR_DEVICEHUNG MAKE_D3DHRESULT(2164)
#define D3DERR_UNSUPPORTEDOVERLAY MAKE_D3DHRESULT(2171)
#define D3DERR_UNSUPPORTEDOVERLAYFORMAT MAKE_D3DHRESULT(2172)
#define D3DERR_CANNOTPROTECTCONTENT MAKE_D3DHRESULT(2173)
#define D3DERR_UNSUPPORTEDCRYPTO MAKE_D3DHRESULT(2174)
#define D3DERR_PRESENT_STATISTICS_DISJOINT MAKE_D3DHRESULT(2180)
/*********************
/* D3D9Ex interfaces
/*********************/
HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**);
#undef INTERFACE
#define INTERFACE IDirect3D9Ex
DECLARE_INTERFACE_(IDirect3D9Ex, IDirect3D9)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3D9 methods ***/
STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE;
STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE;
STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE;
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE;
STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE;
STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE;
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE;
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE;
STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter ) PURE;
STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter,UINT Mode,D3DDISPLAYMODEEX* pMode) PURE;
STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX* pFullscreenDisplayMode,IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE;
STDMETHOD(GetAdapterLUID)(THIS_ UINT Adapter,LUID * pLUID) PURE;
};
typedef struct IDirect3D9Ex *LPDIRECT3D9EX, *PDIRECT3D9EX;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p)
#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c)
#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b)
#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d)
#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b)
#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e)
#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f)
#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e)
#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a)
#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f)
#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b)
#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d)
#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c)
#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g)
#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b)
#else
#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3D9Ex_AddRef(p) (p)->AddRef()
#define IDirect3D9Ex_Release(p) (p)->Release()
#define IDirect3D9Ex_GetAdapterCount(p) (p)->GetAdapterCount()
#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c)
#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b)
#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d)
#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b)
#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e)
#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f)
#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f)
#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e)
#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d)
#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c)
#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a)
#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f)
#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->GetAdapterModeCountEx(a,b)
#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->EnumAdapterModesEx(a,b,c,d)
#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->GetAdapterDisplayModeEx(a,b,c)
#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->CreateDeviceEx(a,b,c,d,e,f,g)
#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->GetAdapterLUID(a,b)
#endif
#undef INTERFACE
#define INTERFACE IDirect3DDevice9Ex
DECLARE_INTERFACE_(IDirect3DDevice9Ex, IDirect3DDevice9)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DDevice9 methods ***/
STDMETHOD(TestCooperativeLevel)(THIS) PURE;
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
STDMETHOD(EvictManagedResources)(THIS) PURE;
STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE;
STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE;
STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE;
STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE;
STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE;
STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE;
STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE;
STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE;
STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE;
STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE;
STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE;
STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE;
STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE;
STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE;
STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE;
STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE;
STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE;
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE;
STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE;
STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE;
STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE;
STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE;
STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE;
STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE;
STDMETHOD(BeginScene)(THIS) PURE;
STDMETHOD(EndScene)(THIS) PURE;
STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE;
STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE;
STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE;
STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE;
STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE;
STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE;
STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE;
STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE;
STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE;
STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE;
STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE;
STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE;
STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE;
STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE;
STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE;
STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE;
STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE;
STDMETHOD(BeginStateBlock)(THIS) PURE;
STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE;
STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE;
STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE;
STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE;
STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE;
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE;
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE;
STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE;
STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;
STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE;
STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE;
STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE;
STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE;
STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE;
STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE;
STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE;
STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE;
STDMETHOD_(float, GetNPatchMode)(THIS) PURE;
STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;
STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;
STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE;
STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE;
STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE;
STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE;
STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE;
STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE;
STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE;
STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE;
STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE;
STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE;
STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE;
STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE;
STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE;
STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE;
STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE;
STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE;
STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE;
STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE;
STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE;
STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE;
STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE;
STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE;
STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE;
STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns) PURE;
STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset) PURE;
STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE;
STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority) PURE;
STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE;
STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE;
STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources) PURE;
STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE;
STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency) PURE;
STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow) PURE;
STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE;
STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
};
typedef struct IDirect3DDevice9Ex *LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p)
#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p)
#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a)
#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a)
#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a)
#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c)
#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c)
#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a)
#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b)
#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b)
#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p)
#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a)
#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d)
#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d)
#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b)
#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a)
#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c)
#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b)
#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g)
#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b)
#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e)
#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c)
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b)
#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b)
#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a)
#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a)
#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p)
#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p)
#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b)
#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b)
#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b)
#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a)
#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a)
#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a)
#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a)
#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b)
#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b)
#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b)
#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b)
#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b)
#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b)
#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b)
#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b)
#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b)
#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p)
#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a)
#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a)
#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a)
#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b)
#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b)
#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c)
#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c)
#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c)
#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c)
#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a)
#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b)
#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b)
#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a)
#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a)
#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a)
#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a)
#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a)
#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p)
#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a)
#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p)
#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c)
#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b)
#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a)
#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a)
#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a)
#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a)
#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b)
#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c)
#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c)
#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c)
#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d)
#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d)
#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b)
#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b)
#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a)
#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a)
#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b)
#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a)
#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a)
#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c)
#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c)
#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c)
#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c)
#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c)
#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a)
#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b)
#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d)
#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e)
#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a)
#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a)
#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a)
#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b)
#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a)
#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a)
#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a)
#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g)
#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b)
#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c)
#else
#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DDevice9Ex_AddRef(p) (p)->AddRef()
#define IDirect3DDevice9Ex_Release(p) (p)->Release()
#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->TestCooperativeLevel()
#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem()
#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->EvictManagedResources()
#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->GetDirect3D(a)
#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a)
#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b)
#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->GetCreationParameters(a)
#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c)
#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c)
#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->ShowCursor(a)
#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b)
#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b)
#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains()
#define IDirect3DDevice9Ex_Reset(p,a) (p)->Reset(a)
#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->Present(a,b,c,d)
#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d)
#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b)
#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a)
#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c)
#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b)
#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g)
#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d)
#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b)
#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b)
#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b)
#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e)
#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c)
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b)
#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b)
#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a)
#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a)
#define IDirect3DDevice9Ex_BeginScene(p) (p)->BeginScene()
#define IDirect3DDevice9Ex_EndScene(p) (p)->EndScene()
#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->SetTransform(a,b)
#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->GetTransform(a,b)
#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b)
#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->SetViewport(a)
#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->GetViewport(a)
#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->SetMaterial(a)
#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->GetMaterial(a)
#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->SetLight(a,b)
#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->GetLight(a,b)
#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->LightEnable(a,b)
#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b)
#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b)
#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b)
#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->SetRenderState(a,b)
#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->GetRenderState(a,b)
#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b)
#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->BeginStateBlock()
#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->EndStateBlock(a)
#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->SetClipStatus(a)
#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->GetClipStatus(a)
#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->GetTexture(a,b)
#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->SetTexture(a,b)
#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c)
#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c)
#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c)
#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c)
#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->ValidateDevice(a)
#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b)
#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b)
#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a)
#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a)
#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->SetScissorRect(a)
#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->GetScissorRect(a)
#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a)
#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing()
#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->SetNPatchMode(a)
#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->GetNPatchMode()
#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c)
#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d)
#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f)
#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b)
#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a)
#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a)
#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->SetFVF(a)
#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->GetFVF(a)
#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b)
#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->SetVertexShader(a)
#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->GetVertexShader(a)
#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c)
#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c)
#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c)
#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c)
#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d)
#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d)
#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b)
#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b)
#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->SetIndices(a)
#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->GetIndices(a)
#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b)
#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->SetPixelShader(a)
#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->GetPixelShader(a)
#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c)
#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c)
#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c)
#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c)
#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c)
#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c)
#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->DeletePatch(a)
#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->CreateQuery(a,b)
#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->SetConvolutionMonoKernel(a,b,c,d)
#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->ComposeRects(a,b,c,d,e,f,g,h)
#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->PresentEx(a,b,c,d,e)
#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->GetGPUThreadPriority(a)
#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->SetGPUThreadPriority(a)
#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->WaitForVBlank(a)
#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->CheckResourceResidency(a,b)
#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->SetMaximumFrameLatency(a)
#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->GetMaximumFrameLatency(a)
#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->CheckDeviceState(a)
#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateRenderTargetEx(a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->CreateOffscreenPlainSurfaceEx(a,b,c,d,e,f,g)
#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateDepthStencilSurfaceEx(a,b,c,d,e,f,g,h,i)
#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->ResetEx(a,b)
#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->GetDisplayModeEx(a,b,c)
#endif
#undef INTERFACE
#define INTERFACE IDirect3DSwapChain9Ex
DECLARE_INTERFACE_(IDirect3DSwapChain9Ex, IDirect3DSwapChain9)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DSwapChain9 methods ***/
STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE;
STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE;
STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE;
STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE;
STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount) PURE;
STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics) PURE;
STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
};
typedef struct IDirect3DSwapChain9Ex *LPDIRECT3DSWAPCHAIN9EX, *PDIRECT3DSWAPCHAIN9EX;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DSwapChain9Ex_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DSwapChain9Ex_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e)
#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a)
#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c)
#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a)
#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a)
#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a)
#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a)
#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a)
#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b)
#else
#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DSwapChain9Ex_AddRef(p) (p)->AddRef()
#define IDirect3DSwapChain9Ex_Release(p) (p)->Release()
#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e)
#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a)
#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c)
#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->GetRasterStatus(a)
#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->GetDisplayMode(a)
#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->GetDevice(a)
#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->GetPresentParameters(a)
#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->GetLastPresentCount(a)
#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->GetPresentStats(a)
#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->GetDisplayModeEx(a,b)
#endif
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#undef INTERFACE
#define INTERFACE IDirect3D9ExOverlayExtension
DECLARE_INTERFACE_(IDirect3D9ExOverlayExtension, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3D9ExOverlayExtension methods ***/
STDMETHOD(CheckDeviceOverlayType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,UINT OverlayWidth,UINT OverlayHeight,D3DFORMAT OverlayFormat,D3DDISPLAYMODEEX* pDisplayMode,D3DDISPLAYROTATION DisplayRotation,D3DOVERLAYCAPS* pOverlayCaps) PURE;
};
typedef struct IDirect3D9ExOverlayExtension *LPDIRECT3D9EXOVERLAYEXTENSION, *PDIRECT3D9EXOVERLAYEXTENSION;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3D9ExOverlayExtension_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h)
#else
#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->AddRef()
#define IDirect3D9ExOverlayExtension_Release(p) (p)->Release()
#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->CheckDeviceOverlayType(a,b,c,d,e,f,g,h)
#endif
#undef INTERFACE
#define INTERFACE IDirect3DDevice9Video
DECLARE_INTERFACE_(IDirect3DDevice9Video, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DDevice9Video methods ***/
STDMETHOD(GetContentProtectionCaps)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,D3DCONTENTPROTECTIONCAPS* pCaps) PURE;
STDMETHOD(CreateAuthenticatedChannel)(THIS_ D3DAUTHENTICATEDCHANNELTYPE ChannelType,IDirect3DAuthenticatedChannel9** ppAuthenticatedChannel,HANDLE* pChannelHandle) PURE;
STDMETHOD(CreateCryptoSession)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,IDirect3DCryptoSession9** ppCryptoSession,HANDLE* pCryptoHandle) PURE;
};
typedef struct IDirect3DDevice9Video *LPDIRECT3DDEVICE9VIDEO, *PDIRECT3DDEVICE9VIDEO;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DDevice9Video_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DDevice9Video_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->lpVtbl->GetContentProtectionCaps(p,a,b,c)
#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->lpVtbl->CreateAuthenticatedChannel(p,a,b,c)
#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->lpVtbl->CreateCryptoSession(p,a,b,c,d)
#else
#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DDevice9Video_AddRef(p) (p)->AddRef()
#define IDirect3DDevice9Video_Release(p) (p)->Release()
#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->GetContentProtectionCaps(a,b,c)
#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->CreateAuthenticatedChannel(a,b,c)
#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->CreateCryptoSession(a,b,c,d)
#endif
#undef INTERFACE
#define INTERFACE IDirect3DAuthenticatedChannel9
DECLARE_INTERFACE_(IDirect3DAuthenticatedChannel9, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DAuthenticatedChannel9 methods ***/
STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE;
STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE;
STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE;
STDMETHOD(Query)(THIS_ UINT InputSize,CONST VOID* pInput,UINT OutputSize,VOID* pOutput) PURE;
STDMETHOD(Configure)(THIS_ UINT InputSize,CONST VOID* pInput,D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT* pOutput) PURE;
};
typedef struct IDirect3DAuthenticatedChannel9 *LPDIRECT3DAUTHENTICATEDCHANNEL9, *PDIRECT3DAUTHENTICATEDCHANNEL9;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DAuthenticatedChannel9_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a)
#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b)
#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b)
#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->lpVtbl->Query(p,a,b,c,d)
#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->lpVtbl->Configure(p,a,b,c)
#else
#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->AddRef()
#define IDirect3DAuthenticatedChannel9_Release(p) (p)->Release()
#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->GetCertificateSize(a)
#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->GetCertificate(a,b)
#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b)
#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->Query(a,b,c,d)
#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->Configure(a,b,c)
#endif
#undef INTERFACE
#define INTERFACE IDirect3DCryptoSession9
DECLARE_INTERFACE_(IDirect3DCryptoSession9, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DCryptoSession9 methods ***/
STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE;
STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE;
STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE;
STDMETHOD(EncryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT DstSurfaceSize,VOID* pIV) PURE;
STDMETHOD(DecryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT SrcSurfaceSize,D3DENCRYPTED_BLOCK_INFO* pEncryptedBlockInfo,VOID* pContentKey,VOID* pIV) PURE;
STDMETHOD(GetSurfacePitch)(THIS_ IDirect3DSurface9* pSrcSurface,UINT* pSurfacePitch) PURE;
STDMETHOD(StartSessionKeyRefresh)(THIS_ VOID* pRandomNumber,UINT RandomNumberSize) PURE;
STDMETHOD(FinishSessionKeyRefresh)(THIS) PURE;
STDMETHOD(GetEncryptionBltKey)(THIS_ VOID* pReadbackKey,UINT KeySize) PURE;
};
typedef struct IDirect3DCryptoSession9 *LPDIRECT3DCRYPTOSESSION9, *PDIRECT3DCRYPTOSESSION9;
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DCryptoSession9_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DCryptoSession9_Release(p) (p)->lpVtbl->Release(p)
#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a)
#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b)
#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b)
#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->lpVtbl->EncryptionBlt(p,a,b,c,d)
#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->lpVtbl->DecryptionBlt(p,a,b,c,d,e,f)
#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->lpVtbl->GetSurfacePitch(p,a,b)
#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->lpVtbl->StartSessionKeyRefresh(p,a,b)
#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->lpVtbl->FinishSessionKeyRefresh(p)
#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->lpVtbl->GetEncryptionBltKey(p,a,b)
#else
#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DCryptoSession9_AddRef(p) (p)->AddRef()
#define IDirect3DCryptoSession9_Release(p) (p)->Release()
#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->GetCertificateSize(a)
#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->GetCertificate(a,b)
#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b)
#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->EncryptionBlt(a,b,c,d)
#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->DecryptionBlt(a,b,c,d,e,f)
#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->GetSurfacePitch(a,b)
#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->StartSessionKeyRefresh(a,b)
#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->FinishSessionKeyRefresh()
#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->GetEncryptionBltKey(a,b)
#endif
/* -- D3D9Ex only */
#endif // !D3D_DISABLE_9EX
#ifdef __cplusplus
};

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
// include this file content only if compiling for DX9 interfaces
#if(DIRECT3D_VERSION >= 0x0900)
#if defined(_X86_) || defined(_IA64)
#if defined(_X86_) || defined(_IA64_)
#pragma pack(4)
#endif
@ -65,6 +65,59 @@ typedef struct _D3DPSHADERCAPS2_0
#define D3DMIN30SHADERINSTRUCTIONS 512
#define D3DMAX30SHADERINSTRUCTIONS 32768
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
typedef struct _D3DOVERLAYCAPS
{
UINT Caps;
UINT MaxOverlayDisplayWidth;
UINT MaxOverlayDisplayHeight;
} D3DOVERLAYCAPS;
#define D3DOVERLAYCAPS_FULLRANGERGB 0x00000001
#define D3DOVERLAYCAPS_LIMITEDRANGERGB 0x00000002
#define D3DOVERLAYCAPS_YCbCr_BT601 0x00000004
#define D3DOVERLAYCAPS_YCbCr_BT709 0x00000008
#define D3DOVERLAYCAPS_YCbCr_BT601_xvYCC 0x00000010
#define D3DOVERLAYCAPS_YCbCr_BT709_xvYCC 0x00000020
#define D3DOVERLAYCAPS_STRETCHX 0x00000040
#define D3DOVERLAYCAPS_STRETCHY 0x00000080
typedef struct _D3DCONTENTPROTECTIONCAPS
{
DWORD Caps;
GUID KeyExchangeType;
UINT BufferAlignmentStart;
UINT BlockAlignmentSize;
ULONGLONG ProtectedMemorySize;
} D3DCONTENTPROTECTIONCAPS;
#define D3DCPCAPS_SOFTWARE 0x00000001
#define D3DCPCAPS_HARDWARE 0x00000002
#define D3DCPCAPS_PROTECTIONALWAYSON 0x00000004
#define D3DCPCAPS_PARTIALDECRYPTION 0x00000008
#define D3DCPCAPS_CONTENTKEY 0x00000010
#define D3DCPCAPS_FRESHENSESSIONKEY 0x00000020
#define D3DCPCAPS_ENCRYPTEDREADBACK 0x00000040
#define D3DCPCAPS_ENCRYPTEDREADBACKKEY 0x00000080
#define D3DCPCAPS_SEQUENTIAL_CTR_IV 0x00000100
#define D3DCPCAPS_ENCRYPTSLICEDATAONLY 0x00000200
DEFINE_GUID(D3DCRYPTOTYPE_AES128_CTR,
0x9b6bd711, 0x4f74, 0x41c9, 0x9e, 0x7b, 0xb, 0xe2, 0xd7, 0xd9, 0x3b, 0x4f);
DEFINE_GUID(D3DCRYPTOTYPE_PROPRIETARY,
0xab4e9afd, 0x1d1c, 0x46e6, 0xa7, 0x2f, 0x8, 0x69, 0x91, 0x7b, 0xd, 0xe8);
DEFINE_GUID(D3DKEYEXCHANGE_RSAES_OAEP,
0xc1949895, 0xd72a, 0x4a1d, 0x8e, 0x5d, 0xed, 0x85, 0x7d, 0x17, 0x15, 0x20);
DEFINE_GUID(D3DKEYEXCHANGE_DXVA,
0x43d3775c, 0x38e5, 0x4924, 0x8d, 0x86, 0xd3, 0xfc, 0xcf, 0x15, 0x3e, 0x9b);
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
typedef struct _D3DCAPS9
{
/* Device Info */
@ -167,6 +220,7 @@ typedef struct _D3DCAPS9
//
// Caps
//
#define D3DCAPS_OVERLAY 0x00000800L
#define D3DCAPS_READ_SCANLINE 0x00020000L
//
@ -179,6 +233,14 @@ typedef struct _D3DCAPS9
#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L
#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DCAPS2_CANSHARERESOURCE 0x80000000L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
//
// Caps3
//
@ -195,6 +257,7 @@ typedef struct _D3DCAPS9
#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */
#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */
#define D3DCAPS3_DXVAHD 0x00000400L
//
@ -261,6 +324,15 @@ typedef struct _D3DCAPS9
#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */
#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000L /* Indicates device can perform conversion to sRGB after blending. */
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
//
// LineCaps
//
@ -321,6 +393,16 @@ typedef struct _D3DCAPS9
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DPBLENDCAPS_SRCCOLOR2 0x00004000L
#define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000L
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
//
// ShadeCaps
//
@ -364,6 +446,15 @@ typedef struct _D3DCAPS9
#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L

View File

@ -23,7 +23,7 @@
#pragma warning(push)
#endif
#pragma warning(disable:4201) // anonymous unions warning
#if defined(_X86_) || defined(_IA64)
#if defined(_X86_) || defined(_IA64_)
#pragma pack(4)
#endif
@ -224,6 +224,14 @@ typedef enum _D3DBLEND {
D3DBLEND_BOTHINVSRCALPHA = 13,
D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */
D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
D3DBLEND_SRCCOLOR2 = 16,
D3DBLEND_INVSRCCOLOR2 = 17,
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DBLEND;
@ -625,6 +633,13 @@ typedef enum _D3DTEXTUREFILTERTYPE
D3DTEXF_ANISOTROPIC = 3, // anisotropic
D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent
D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DTEXTUREFILTERTYPE;
@ -1377,6 +1392,16 @@ typedef enum _D3DFORMAT
D3DFMT_D32F_LOCKABLE = 82,
D3DFMT_D24FS8 = 83,
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
/* Z-Stencil formats valid for CPU access */
D3DFMT_D32_LOCKABLE = 84,
D3DFMT_S8_LOCKABLE = 85,
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DFMT_L16 = 81,
@ -1402,6 +1427,22 @@ typedef enum _D3DFORMAT
D3DFMT_CxV8U8 = 117,
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
// Monochrome 1 bit per pixel format
D3DFMT_A1 = 118,
// 2.8 biased fixed point
D3DFMT_A2B10G10R10_XR_BIAS = 119,
// Binary format indicating that the data has no inherent type
D3DFMT_BINARYBUFFER = 199,
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DFMT_FORCE_DWORD =0x7fffffff
} D3DFORMAT;
@ -1432,6 +1473,13 @@ typedef enum _D3DSWAPEFFECT
D3DSWAPEFFECT_FLIP = 2,
D3DSWAPEFFECT_COPY = 3,
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
D3DSWAPEFFECT_OVERLAY = 4,
D3DSWAPEFFECT_FLIPEX = 5,
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DSWAPEFFECT_FORCE_DWORD = 0x7fffffff
} D3DSWAPEFFECT;
@ -1480,6 +1528,20 @@ typedef struct _D3DPRESENT_PARAMETERS_
#define D3DPRESENTFLAG_DEVICECLIP 0x00000004
#define D3DPRESENTFLAG_VIDEO 0x00000010
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DPRESENTFLAG_NOAUTOROTATE 0x00000020
#define D3DPRESENTFLAG_UNPRUNEDMODE 0x00000040
#define D3DPRESENTFLAG_OVERLAY_LIMITEDRGB 0x00000080
#define D3DPRESENTFLAG_OVERLAY_YCbCr_BT709 0x00000100
#define D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC 0x00000200
#define D3DPRESENTFLAG_RESTRICTED_CONTENT 0x00000400
#define D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER 0x00000800
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
/* Gamma Ramp: Same as DX7 */
typedef struct _D3DGAMMARAMP
@ -1508,7 +1570,7 @@ typedef enum _D3DRESOURCETYPE {
D3DRTYPE_VOLUMETEXTURE = 4,
D3DRTYPE_CUBETEXTURE = 5,
D3DRTYPE_VERTEXBUFFER = 6,
D3DRTYPE_INDEXBUFFER = 7,
D3DRTYPE_INDEXBUFFER = 7, //if this changes, change _D3DDEVINFO_RESOURCEMANAGER definition
D3DRTYPE_FORCE_DWORD = 0x7fffffff
@ -1519,6 +1581,14 @@ typedef enum _D3DRESOURCETYPE {
#define D3DUSAGE_DEPTHSTENCIL (0x00000002L)
#define D3DUSAGE_DYNAMIC (0x00000200L)
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DUSAGE_NONSECURE (0x00800000L)
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
// When passed to CheckDeviceFormat, D3DUSAGE_AUTOGENMIPMAP may return
// D3DOK_NOAUTOGEN if the device doesn't support autogeneration for that format.
// D3DOK_NOAUTOGEN is a success code, not a failure code... the SUCCEEDED and FAILED macros
@ -1543,6 +1613,23 @@ typedef enum _D3DRESOURCETYPE {
#define D3DUSAGE_RTPATCHES (0x00000080L)
#define D3DUSAGE_NPATCHES (0x00000100L)
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
#define D3DUSAGE_TEXTAPI (0x10000000L)
#define D3DUSAGE_RESTRICTED_CONTENT (0x00000800L)
#define D3DUSAGE_RESTRICT_SHARED_RESOURCE (0x00002000L)
#define D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER (0x00001000L)
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
@ -1756,6 +1843,10 @@ typedef enum _D3DQUERYTYPE {
D3DQUERYTYPE_PIXELTIMINGS = 16, /* D3DISSUE_BEGIN, D3DISSUE_END */
D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, /* D3DISSUE_BEGIN, D3DISSUE_END */
D3DQUERYTYPE_CACHEUTILIZATION = 18, /* D3DISSUE_BEGIN, D3DISSUE_END */
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
D3DQUERYTYPE_MEMORYPRESSURE = 19, /* D3DISSUE_BEGIN, D3DISSUE_END */
#endif // !D3D_DISABLE_9EX
} D3DQUERYTYPE;
// Flags field for Issue
@ -1788,7 +1879,11 @@ typedef struct _D3DRESOURCESTATS
typedef struct _D3DDEVINFO_RESOURCEMANAGER
{
#ifndef WOW64_ENUM_WORKAROUND
D3DRESOURCESTATS stats[D3DRTYPECOUNT];
#else
D3DRESOURCESTATS stats[8];
#endif
} D3DDEVINFO_RESOURCEMANAGER, *LPD3DDEVINFO_RESOURCEMANAGER;
typedef struct _D3DDEVINFO_D3DVERTEXSTATS
@ -1799,7 +1894,7 @@ typedef struct _D3DDEVINFO_D3DVERTEXSTATS
typedef struct _D3DDEVINFO_VCACHE {
DWORD Pattern; /* bit pattern, return value must be FOUR_CC(C, A, C, H) */
DWORD Pattern; /* bit pattern, return value must be FOUR_CC('C', 'A', 'C', 'H') */
DWORD OptMethod; /* optimization method 0 means longest strips, 1 means vertex cache based */
DWORD CacheSize; /* cache size to optimize for (only required if type is 1) */
DWORD MagicNumber; /* used to determine when to restart strips (only required if type is 1)*/
@ -1843,6 +1938,472 @@ typedef struct _D3DDEVINFO_D3D9CACHEUTILIZATION
FLOAT PostTransformVertexCacheHitRate;
} D3DDEVINFO_D3D9CACHEUTILIZATION;
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
typedef struct _D3DMEMORYPRESSURE
{
UINT64 BytesEvictedFromProcess;
UINT64 SizeOfInefficientAllocation;
DWORD LevelOfEfficiency;
} D3DMEMORYPRESSURE;
typedef enum _D3DCOMPOSERECTSOP{
D3DCOMPOSERECTS_COPY = 1,
D3DCOMPOSERECTS_OR = 2,
D3DCOMPOSERECTS_AND = 3,
D3DCOMPOSERECTS_NEG = 4,
D3DCOMPOSERECTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DCOMPOSERECTSOP;
typedef struct _D3DCOMPOSERECTDESC
{
USHORT X, Y; // Top-left coordinates of a rect in the source surface
USHORT Width, Height; // Dimensions of the rect
} D3DCOMPOSERECTDESC;
typedef struct _D3DCOMPOSERECTDESTINATION
{
USHORT SrcRectIndex; // Index of D3DCOMPOSERECTDESC
USHORT Reserved; // For alignment
SHORT X, Y; // Top-left coordinates of the rect in the destination surface
} D3DCOMPOSERECTDESTINATION;
#define D3DCOMPOSERECTS_MAXNUMRECTS 0xFFFF
#define D3DCONVOLUTIONMONO_MAXWIDTH 7
#define D3DCONVOLUTIONMONO_MAXHEIGHT D3DCONVOLUTIONMONO_MAXWIDTH
#define D3DFMT_A1_SURFACE_MAXWIDTH 8192
#define D3DFMT_A1_SURFACE_MAXHEIGHT 2048
typedef struct _D3DPRESENTSTATS {
UINT PresentCount;
UINT PresentRefreshCount;
UINT SyncRefreshCount;
LARGE_INTEGER SyncQPCTime;
LARGE_INTEGER SyncGPUTime;
} D3DPRESENTSTATS;
typedef enum D3DSCANLINEORDERING
{
D3DSCANLINEORDERING_UNKNOWN = 0,
D3DSCANLINEORDERING_PROGRESSIVE = 1,
D3DSCANLINEORDERING_INTERLACED = 2,
} D3DSCANLINEORDERING;
typedef struct D3DDISPLAYMODEEX
{
UINT Size;
UINT Width;
UINT Height;
UINT RefreshRate;
D3DFORMAT Format;
D3DSCANLINEORDERING ScanLineOrdering;
} D3DDISPLAYMODEEX;
typedef struct D3DDISPLAYMODEFILTER
{
UINT Size;
D3DFORMAT Format;
D3DSCANLINEORDERING ScanLineOrdering;
} D3DDISPLAYMODEFILTER;
typedef enum D3DDISPLAYROTATION
{
D3DDISPLAYROTATION_IDENTITY = 1, // No rotation.
D3DDISPLAYROTATION_90 = 2, // Rotated 90 degrees.
D3DDISPLAYROTATION_180 = 3, // Rotated 180 degrees.
D3DDISPLAYROTATION_270 = 4 // Rotated 270 degrees.
} D3DDISPLAYROTATION;
/* For use in ID3DResource9::SetPriority calls */
#define D3D9_RESOURCE_PRIORITY_MINIMUM 0x28000000
#define D3D9_RESOURCE_PRIORITY_LOW 0x50000000
#define D3D9_RESOURCE_PRIORITY_NORMAL 0x78000000
#define D3D9_RESOURCE_PRIORITY_HIGH 0xa0000000
#define D3D9_RESOURCE_PRIORITY_MAXIMUM 0xc8000000
#define D3D_OMAC_SIZE 16
typedef struct _D3D_OMAC
{
BYTE Omac[D3D_OMAC_SIZE];
} D3D_OMAC;
typedef enum _D3DAUTHENTICATEDCHANNELTYPE
{
D3DAUTHENTICATEDCHANNEL_D3D9 = 1,
D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2,
D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3,
} D3DAUTHENTICATEDCHANNELTYPE;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_INPUT
{
GUID QueryType;
HANDLE hChannel;
UINT SequenceNumber;
} D3DAUTHENTICATEDCHANNEL_QUERY_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT
{
D3D_OMAC omac;
GUID QueryType;
HANDLE hChannel;
UINT SequenceNumber;
HRESULT ReturnCode;
} D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_PROTECTION,
0xa84eb584, 0xc495, 0x48aa, 0xb9, 0x4d, 0x8b, 0xd2, 0xd6, 0xfb, 0xce, 0x5);
typedef struct _D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS
{
union
{
struct
{
UINT ProtectionEnabled : 1;
UINT OverlayOrFullscreenRequired : 1;
UINT Reserved : 30;
};
UINT Value;
};
} D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS ProtectionFlags;
} D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_CHANNELTYPE,
0xbc1b18a5, 0xb1fb, 0x42ab, 0xbd, 0x94, 0xb5, 0x82, 0x8b, 0x4b, 0xf7, 0xbe);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
D3DAUTHENTICATEDCHANNELTYPE ChannelType;
} D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_DEVICEHANDLE,
0xec1c539d, 0x8cff, 0x4e2a, 0xbc, 0xc4, 0xf5, 0x69, 0x2f, 0x99, 0xf4, 0x80);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
HANDLE DeviceHandle;
} D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_CRYPTOSESSION,
0x2634499e, 0xd018, 0x4d74, 0xac, 0x17, 0x7f, 0x72, 0x40, 0x59, 0x52, 0x8d);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input;
HANDLE DXVA2DecodeHandle;
} D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
HANDLE DXVA2DecodeHandle;
HANDLE CryptoSessionHandle;
HANDLE DeviceHandle;
} D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESSCOUNT,
0xdb207b3, 0x9450, 0x46a6, 0x82, 0xde, 0x1b, 0x96, 0xd4, 0x4f, 0x9c, 0xf2);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
UINT NumRestrictedSharedResourceProcesses;
} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESS,
0x649bbadb, 0xf0f4, 0x4639, 0xa1, 0x5b, 0x24, 0x39, 0x3f, 0xc3, 0xab, 0xac);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input;
UINT ProcessIndex;
} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT;
typedef enum _D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE
{
PROCESSIDTYPE_UNKNOWN = 0,
PROCESSIDTYPE_DWM = 1,
PROCESSIDTYPE_HANDLE = 2
} D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
UINT ProcessIndex;
D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentifer;
HANDLE ProcessHandle;
} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_UNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT,
0x12f0bd6, 0xe662, 0x4474, 0xbe, 0xfd, 0xaa, 0x53, 0xe5, 0x14, 0x3c, 0x6d);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
UINT NumUnrestrictedProtectedSharedResources;
} D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTIDCOUNT,
0x2c042b5e, 0x8c07, 0x46d5, 0xaa, 0xbe, 0x8f, 0x75, 0xcb, 0xad, 0x4c, 0x31);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input;
HANDLE DeviceHandle;
HANDLE CryptoSessionHandle;
} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
HANDLE DeviceHandle;
HANDLE CryptoSessionHandle;
UINT NumOutputIDs;
} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTID,
0x839ddca3, 0x9b4e, 0x41e4, 0xb0, 0x53, 0x89, 0x2b, 0xd2, 0xa1, 0x1e, 0xe7);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input;
HANDLE DeviceHandle;
HANDLE CryptoSessionHandle;
UINT OutputIDIndex;
} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
HANDLE DeviceHandle;
HANDLE CryptoSessionHandle;
UINT OutputIDIndex;
UINT64 OutputID;
} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_ACCESSIBILITYATTRIBUTES,
0x6214d9d2, 0x432c, 0x4abb, 0x9f, 0xce, 0x21, 0x6e, 0xea, 0x26, 0x9e, 0x3b);
typedef enum _D3DBUSTYPE
{
D3DBUSTYPE_OTHER = 0x00000000,
D3DBUSTYPE_PCI = 0x00000001,
D3DBUSTYPE_PCIX = 0x00000002,
D3DBUSTYPE_PCIEXPRESS = 0x00000003,
D3DBUSTYPE_AGP = 0x00000004,
D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000,
D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000,
D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000,
D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000,
D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000,
D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000,
} D3DBUSTYPE;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
D3DBUSTYPE BusType;
BOOL bAccessibleInContiguousBlocks;
BOOL bAccessibleInNonContiguousBlocks;
} D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUIDCOUNT,
0xb30f7066, 0x203c, 0x4b07, 0x93, 0xfc, 0xce, 0xaa, 0xfd, 0x61, 0x24, 0x1e);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
UINT NumEncryptionGuids;
} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUID,
0xf83a5958, 0xe986, 0x4bda, 0xbe, 0xb0, 0x41, 0x1f, 0x6a, 0x7a, 0x1, 0xb7);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input;
UINT EncryptionGuidIndex;
} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
UINT EncryptionGuidIndex;
GUID EncryptionGuid;
} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDQUERY_CURRENTENCRYPTIONWHENACCESSIBLE,
0xec1791c7, 0xdad3, 0x4f15, 0x9e, 0xc3, 0xfa, 0xa9, 0x3d, 0x60, 0xd4, 0xf0);
typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT
{
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output;
GUID EncryptionGuid;
} D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT
{
D3D_OMAC omac;
GUID ConfigureType;
HANDLE hChannel;
UINT SequenceNumber;
} D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT;
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT
{
D3D_OMAC omac;
GUID ConfigureType;
HANDLE hChannel;
UINT SequenceNumber;
HRESULT ReturnCode;
} D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT;
DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_INITIALIZE,
0x6114bdb, 0x3523, 0x470a, 0x8d, 0xca, 0xfb, 0xc2, 0x84, 0x51, 0x54, 0xf0);
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE
{
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters;
UINT StartSequenceQuery;
UINT StartSequenceConfigure;
} D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE;
DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_PROTECTION,
0x50455658, 0x3f47, 0x4362, 0xbf, 0x99, 0xbf, 0xdf, 0xcd, 0xe9, 0xed, 0x29);
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION
{
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters;
D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS Protections;
} D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION;
DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_CRYPTOSESSION,
0x6346cc54, 0x2cfc, 0x4ad4, 0x82, 0x24, 0xd1, 0x58, 0x37, 0xde, 0x77, 0x0);
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION
{
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters;
HANDLE DXVA2DecodeHandle;
HANDLE CryptoSessionHandle;
HANDLE DeviceHandle;
} D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION;
DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_SHAREDRESOURCE,
0x772d047, 0x1b40, 0x48e8, 0x9c, 0xa6, 0xb5, 0xf5, 0x10, 0xde, 0x9f, 0x1);
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE
{
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters;
D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentiferType;
HANDLE ProcessHandle;
BOOL AllowAccess;
} D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE;
DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_ENCRYPTIONWHENACCESSIBLE,
0x41fff286, 0x6ae0, 0x4d43, 0x9d, 0x55, 0xa4, 0x6e, 0x9e, 0xfd, 0x15, 0x8a);
typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION
{
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters;
GUID EncryptionGuid;
} D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION;
typedef struct _D3DENCRYPTED_BLOCK_INFO
{
UINT NumEncryptedBytesAtBeginning;
UINT NumBytesInSkipPattern;
UINT NumBytesInEncryptPattern;
} D3DENCRYPTED_BLOCK_INFO;
typedef struct _D3DAES_CTR_IV
{
UINT64 IV; // Big-Endian IV
UINT64 Count; // Big-Endian Block Count
} D3DAES_CTR_IV;
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
#pragma pack()
#if _MSC_VER >= 1200
#pragma warning(pop)

View File

@ -1,185 +0,0 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: dxdiag.h
* Content: DirectX Diagnostic Tool include file
*
****************************************************************************/
#ifndef _DXDIAG_H_
#define _DXDIAG_H_
#include <ole2.h> // for DECLARE_INTERFACE_ and HRESULT
// This identifier is passed to IDxDiagProvider::Initialize in order to ensure that an
// application was built against the correct header files. This number is
// incremented whenever a header (or other) change would require applications
// to be rebuilt. If the version doesn't match, IDxDiagProvider::Initialize will fail.
// (The number itself has no meaning.)
#define DXDIAG_DX9_SDK_VERSION 111
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
*
* DxDiag Errors
*
****************************************************************************/
#define DXDIAG_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
/****************************************************************************
*
* DxDiag CLSIDs
*
****************************************************************************/
// {A65B8071-3BFE-4213-9A5B-491DA4461CA7}
DEFINE_GUID(CLSID_DxDiagProvider,
0xA65B8071, 0x3BFE, 0x4213, 0x9A, 0x5B, 0x49, 0x1D, 0xA4, 0x46, 0x1C, 0xA7);
/****************************************************************************
*
* DxDiag Interface IIDs
*
****************************************************************************/
// {9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2}
DEFINE_GUID(IID_IDxDiagProvider,
0x9C6B4CB0, 0x23F8, 0x49CC, 0xA3, 0xED, 0x45, 0xA5, 0x50, 0x00, 0xA6, 0xD2);
// {0x7D0F462F-0x4064-0x4862-BC7F-933E5058C10F}
DEFINE_GUID(IID_IDxDiagContainer,
0x7D0F462F, 0x4064, 0x4862, 0xBC, 0x7F, 0x93, 0x3E, 0x50, 0x58, 0xC1, 0x0F);
/****************************************************************************
*
* DxDiag Interface Pointer definitions
*
****************************************************************************/
typedef struct IDxDiagProvider *LPDXDIAGPROVIDER, *PDXDIAGPROVIDER;
typedef struct IDxDiagContainer *LPDXDIAGCONTAINER, *PDXDIAGCONTAINER;
/****************************************************************************
*
* DxDiag Structures
*
****************************************************************************/
typedef struct _DXDIAG_INIT_PARAMS
{
DWORD dwSize; // Size of this structure.
DWORD dwDxDiagHeaderVersion; // Pass in DXDIAG_DX9_SDK_VERSION. This verifies
// the header and dll are correctly matched.
BOOL bAllowWHQLChecks; // If true, allow dxdiag to check if drivers are
// digital signed as logo'd by WHQL which may
// connect via internet to update WHQL certificates.
VOID* pReserved; // Reserved. Must be NULL.
} DXDIAG_INIT_PARAMS;
/****************************************************************************
*
* DxDiag Application Interfaces
*
****************************************************************************/
//
// COM definition for IDxDiagProvider
//
#undef INTERFACE // External COM Implementation
#define INTERFACE IDxDiagProvider
DECLARE_INTERFACE_(IDxDiagProvider,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDxDiagProvider methods ***/
STDMETHOD(Initialize) (THIS_ DXDIAG_INIT_PARAMS* pParams) PURE;
STDMETHOD(GetRootContainer) (THIS_ IDxDiagContainer **ppInstance) PURE;
};
//
// COM definition for IDxDiagContainer
//
#undef INTERFACE // External COM Implementation
#define INTERFACE IDxDiagContainer
DECLARE_INTERFACE_(IDxDiagContainer,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDxDiagContainer methods ***/
STDMETHOD(GetNumberOfChildContainers) (THIS_ DWORD *pdwCount) PURE;
STDMETHOD(EnumChildContainerNames) (THIS_ DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) PURE;
STDMETHOD(GetChildContainer) (THIS_ LPCWSTR pwszContainer, IDxDiagContainer **ppInstance) PURE;
STDMETHOD(GetNumberOfProps) (THIS_ DWORD *pdwCount) PURE;
STDMETHOD(EnumPropNames) (THIS_ DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) PURE;
STDMETHOD(GetProp) (THIS_ LPCWSTR pwszPropName, VARIANT *pvarProp) PURE;
};
/****************************************************************************
*
* DxDiag application interface macros
*
****************************************************************************/
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDxDiagProvider_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDxDiagProvider_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDxDiagProvider_Release(p) (p)->lpVtbl->Release(p)
#define IDxDiagProvider_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDxDiagProvider_GetRootContainer(p,a) (p)->lpVtbl->GetRootContainer(p,a)
#define IDxDiagContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDxDiagContainer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDxDiagContainer_Release(p) (p)->lpVtbl->Release(p)
#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->lpVtbl->GetNumberOfChildContainers(p,a)
#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->lpVtbl->EnumChildContainerNames(p,a,b,c)
#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->lpVtbl->GetChildContainer(p,a,b)
#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->lpVtbl->GetNumberOfProps(p,a)
#define IDxDiagContainer_EnumProps(p,a,b) (p)->lpVtbl->EnumProps(p,a,b,c)
#define IDxDiagContainer_GetProp(p,a,b) (p)->lpVtbl->GetProp(p,a,b)
#else /* C++ */
#define IDxDiagProvider_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
#define IDxDiagProvider_AddRef(p) (p)->AddRef(p)
#define IDxDiagProvider_Release(p) (p)->Release(p)
#define IDxDiagProvider_Initialize(p,a,b) (p)->Initialize(p,a,b)
#define IDxDiagProvider_GetRootContainer(p,a) (p)->GetRootContainer(p,a)
#define IDxDiagContainer_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
#define IDxDiagContainer_AddRef(p) (p)->AddRef(p)
#define IDxDiagContainer_Release(p) (p)->Release(p)
#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->GetNumberOfChildContainers(p,a)
#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->EnumChildContainerNames(p,a,b,c)
#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->GetChildContainer(p,a,b)
#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->GetNumberOfProps(p,a)
#define IDxDiagContainer_EnumProps(p,a,b) (p)->EnumProps(p,a,b,c)
#define IDxDiagContainer_GetProp(p,a,b) (p)->GetProp(p,a,b)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _DXDIAG_H_ */

View File

@ -80,6 +80,8 @@
// third flags DWORD dxw.dwFlags3:
#define FORCEHOOKOPENGL 0x00000001 // loads OpenGL32.dll and hooks it
#define MARKBLIT 0x00000002 // higlights the blit to primary surface operation by surroundig the rect in color
#define HOOKDLLS 0x00000004 // Hook all DLLs referenced in PE
#define SUPPRESSD3DEXT 0x00000008 // Disables extended d3d APIs for Vista/Win7/Win8 platforms
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d27bd94b95b7ca824b05b37e72626d7250273d4c55512eac260ea59ed8cb2cb
size 314880
oid sha256:3ab8190eadcff243a68b15f1b95a1ae8a260ec90013a73ba149322adc1786dfd
size 340992

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c518035d2eea78a680be7ee136ab574ad087f8f346f923be2e43b1ba9fa5b3ee
size 502272
oid sha256:b5a29f58873b15c65c45cc3216847b5bd94c4c6a382ad62f717087cb69e8406e
size 503296

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,12 @@ Disabled hooking of system libraries
Fixed a nasty bug that caused your desktop to freeze until shutdown !!!
Fixed GetWindowRect handling for windows not created by the task: Diablo queries the explorer window size! Now the retrieved RECT can't be larger than the virtual desktop
v2.02.20
Fixed an error in D3D10/11 preliminary code: AoE III working again
Added "Hook all DLLs" option to simplify congiguration: see new Diablo setup
Added screen coordinates to log
Some code rearrangement
v2.02.21
it's a w.i.p. release, wait 'till finished....

View File

@ -20,6 +20,9 @@
dxwCore dxw;
extern void InitScreenParameters();
void HookModule(HMODULE, int);
static void RecoverScreenMode();
static void LockScreenMode(DWORD, DWORD, DWORD);
extern HANDLE hTraceMutex;
@ -48,7 +51,7 @@ static char *Flag2Names[32]={
};
static char *Flag3Names[32]={
"FORCEHOOKOPENGL", "", "", "",
"FORCEHOOKOPENGL", "MARKBLIT", "HOOKDLLS", "SUPPRESSD3DEXT",
"", "", "", "",
"", "", "", "",
"", "", "", "",
@ -147,6 +150,68 @@ static void dx_ToggleLogging()
GetHookInfo()->isLogging=(dxw.dwTFlags & OUTTRACE);
}
void HookDlls(HMODULE module)
{
PIMAGE_NT_HEADERS pnth;
PIMAGE_IMPORT_DESCRIPTOR pidesc;
DWORD base, rva;
PSTR impmodule;
PIMAGE_THUNK_DATA ptname;
extern char *SysNames[];
base=(DWORD)module;
OutTraceB("HookDlls: base=%x\n", base);
__try{
pnth = PIMAGE_NT_HEADERS(PBYTE(base) + PIMAGE_DOS_HEADER(base)->e_lfanew);
if(!pnth) {
OutTraceB("HookDlls: ERROR no pnth at %d\n", __LINE__);
return;
}
rva = pnth->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
if(!rva) {
OutTraceB("HookDlls: ERROR no rva at %d\n", __LINE__);
return;
}
for(pidesc = (PIMAGE_IMPORT_DESCRIPTOR)(base + rva); pidesc->FirstThunk; pidesc++){
HMODULE DllBase;
int idx;
extern HMODULE SysLibs[];
impmodule = (PSTR)(base + pidesc->Name);
// skip dxwnd and system dll
if(!lstrcmpi(impmodule, "DxWnd")) continue;
idx=dxw.GetDLLIndex(impmodule);
if(!lstrcmpi(impmodule,dxw.CustomOpenGLLib))idx=SYSLIBIDX_OPENGL;
if(idx != -1) {
DllBase=GetModuleHandle(impmodule);
SysLibs[idx]=DllBase;
OutTraceB("HookDlls: system module %s at %x\n", impmodule, DllBase);
continue;
}
OutTraceB("HookDlls: ENTRY timestamp=%x module=%s forwarderchain=%x\n",
pidesc->TimeDateStamp, impmodule, pidesc->ForwarderChain);
if(pidesc->OriginalFirstThunk) {
ptname = (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->OriginalFirstThunk);
}
else{
ptname = 0;
OutTraceB("HookDlls: no PE OFTs - stripped module=%s\n", impmodule);
}
DllBase=GetModuleHandle(impmodule);
if(DllBase) HookModule(DllBase, 0);
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
OutTraceD("HookDlls: EXCEPTION\n");
}
return;
}
void DumpImportTable(HMODULE module)
{
PIMAGE_NT_HEADERS pnth;
@ -221,7 +286,12 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
dwTmp = *(DWORD *)target;
if(dwTmp == (DWORD)hookproc) return; // already hooked
if((dwTmp <= MaxHook) && (dwTmp >= MinHook)) return; // already hooked
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) return; // error condition
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) {
sprintf(msg,"SetHook ERROR: target=%x err=%d\n", target, GetLastError());
OutTraceD(msg);
if (IsAssertEnabled) MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION);
return; // error condition
}
*(DWORD *)target = (DWORD)hookproc;
VirtualProtect(target, 4, oldprot, &oldprot);
tmp=(void *)dwTmp;
@ -273,7 +343,7 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi
pidesc ++;
}
if(!pidesc->FirstThunk) {
if (IsDebug) OutTraceD("HookAPI: PE unreferenced dll=%s\n", dll);
OutTraceB("HookAPI: PE unreferenced dll=%s\n", dll);
return 0;
}
@ -386,7 +456,7 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height)
HRESULT res=0;
WNDPROC pWindowProc;
OutTraceD("AdjustWindowFrame hwnd=%x, wxh=%dx%d\n", hwnd, width, height);
OutTraceD("AdjustWindowFrame hwnd=%x, size=(%d,%d)\n", hwnd, width, height);
dxw.SetScreenSize(width, height);
if (hwnd==NULL) return;
@ -394,7 +464,7 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height)
(*pSetWindowLong)(hwnd, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
(*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0);
(*pShowWindow)(hwnd, SW_SHOWNORMAL);
OutTraceD("AdjustWindowFrame hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", hwnd);
OutTraceD("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (dxw.dwFlags2 & MODALSTYLE) ? "0" : "WS_OVERLAPPEDWINDOW");
AdjustWindowPos(hwnd, width, height);
// fixing windows message handling procedure
@ -1111,39 +1181,7 @@ void HookSysLibs(HMODULE module)
tmp = HookAPI(module, "user32.dll", MoveWindow, "MoveWindow", extMoveWindow);
if(tmp) pMoveWindow = (MoveWindow_Type)tmp;
if(dxw.dwFlags2 & LIMITRESOURCES){
tmp = HookAPI(module, "kernel32.dll", GetDiskFreeSpaceA, "GetDiskFreeSpaceA", extGetDiskFreeSpaceA);
if(tmp) pGetDiskFreeSpaceA = (GetDiskFreeSpaceA_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GlobalMemoryStatus, "GlobalMemoryStatus", extGlobalMemoryStatus);
if(tmp) pGlobalMemoryStatus = (GlobalMemoryStatus_Type)tmp;
}
if(dxw.dwFlags2 & TIMESTRETCH){
tmp = HookAPI(module, "kernel32.dll", GetTickCount, "GetTickCount", extGetTickCount);
if(tmp) pGetTickCount = (GetTickCount_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetLocalTime, "GetLocalTime", extGetLocalTime);
if(tmp) pGetLocalTime = (GetLocalTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetSystemTime, "GetSystemTime", extGetSystemTime);
if(tmp) pGetSystemTime = (GetSystemTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime", extGetSystemTimeAsFileTime);
if(tmp) pGetSystemTimeAsFileTime = (GetSystemTimeAsFileTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", Sleep, "Sleep", extSleep);
if(tmp) pSleep = (Sleep_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", SleepEx, "SleepEx", extSleepEx);
if(tmp) pSleepEx = (SleepEx_Type)tmp;
tmp = HookAPI(module, "user32.dll", SetTimer, "SetTimer", extSetTimer);
if(tmp) pSetTimer = (SetTimer_Type)tmp;
tmp = HookAPI(module, "winmm.dll", NULL, "timeGetTime", exttimeGetTime);
if(tmp) ptimeGetTime = (timeGetTime_Type)tmp;
}
if(dxw.dwFlags2 & FAKEVERSION){
tmp = HookAPI(module, "kernel32.dll", GetVersion, "GetVersion", extGetVersion);
if(tmp) pGetVersion = (GetVersion_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetVersionEx, "GetVersionEx", extGetVersionEx);
if(tmp) pGetVersionEx = (GetVersionEx_Type)tmp;
}
HookKernel32(module);
return;
}
@ -1158,6 +1196,23 @@ static void RecoverScreenMode()
if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
static void LockScreenMode(DWORD dmPelsWidth, DWORD dmPelsHeight, DWORD dmBitsPerPel)
{
DEVMODE InitDevMode;
BOOL res;
EnumDisplaySettings(NULL, ENUM_REGISTRY_SETTINGS, &InitDevMode);
OutTraceD("ChangeDisplaySettings: LOCK wxh=(%dx%d) BitsPerPel=%d -> wxh=(%dx%d) BitsPerPel=%d\n",
InitDevMode.dmPelsWidth, InitDevMode.dmPelsHeight, InitDevMode.dmBitsPerPel,
dmPelsWidth, dmPelsHeight, dmBitsPerPel);
if( (dmPelsWidth != InitDevMode.dmPelsWidth) ||
(dmPelsHeight !=InitDevMode.dmPelsHeight) ||
(dmBitsPerPel != InitDevMode.dmBitsPerPel)){
res=(*pChangeDisplaySettings)(&InitDevMode, 0);
if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
}
// to do: find a logic in the exception codes (0xc0000095 impies a bitmask ?)
// idem for ExceptionFlags
// generalize, find OPCODE length and set number of NOPs accordingly!
@ -1292,8 +1347,10 @@ int HookInit(TARGETMAP *target, HWND hwnd)
dxw.hParentWnd=GetParent(hwnd);
dxw.hChildWnd=hwnd;
OutTraceD("HookInit: path=\"%s\" module=\"%s\" dxversion=%s hWnd=%x dxw.hParentWnd=%x desktop=%x\n",
target->path, target->module, dxversions[dxw.dwTargetDDVersion], hwnd, dxw.hParentWnd, GetDesktopWindow());
OutTraceD("HookInit: path=\"%s\" module=\"%s\" dxversion=%s pos=(%d,%d) size=(%d,%d) hWnd=%x dxw.hParentWnd=%x desktop=%x\n",
target->path, target->module, dxversions[dxw.dwTargetDDVersion],
target->posx, target->posy, target->sizx, target->sizy,
hwnd, dxw.hParentWnd, GetDesktopWindow());
if (IsDebug){
DWORD dwStyle, dwExStyle;
dwStyle=GetWindowLong(dxw.GethWnd(), GWL_STYLE);
@ -1323,11 +1380,8 @@ int HookInit(TARGETMAP *target, HWND hwnd)
OutTraceB("HookInit: base hmodule=%x\n", base);
HookModule(base, dxw.dwTargetDDVersion);
// ListProcessModules needs to be fixed: it hangs the exe....
//if(1){
// extern BOOL ListProcessModules(BOOL);
// ListProcessModules(true);
//}
if (dxw.dwFlags3 & HOOKDLLS) HookDlls(base);
strncpy(sModuleBuf, dxw.gsModules, 60);
sModule=strtok(sModuleBuf," ;");
while (sModule) {

View File

@ -4,7 +4,22 @@ extern int HookDirect3D(HMODULE, int);
extern int HookOle32(HMODULE, int);
extern int HookDirectInput(HMODULE, int);
extern void HookImeLib(HMODULE);
extern void HookKernel32(HMODULE);
extern void InitPosition(int, int, int, int, int, int);
//void InitWindowPos(int, int, int, int);
extern LPCSTR ProcToString(LPCSTR proc);
extern HRESULT HookDxDiag(REFIID, LPVOID FAR*);
extern HRESULT HookDxDiag(REFIID, LPVOID FAR*);
extern FARPROC Remap_ddraw_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d8_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d9_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d10_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d10_1_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_d3d11_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_gl_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_smack_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_user32_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_kernel32_ProcAddress(LPCSTR, HMODULE);
extern FARPROC Remap_ole32_ProcAddress(LPCSTR, HMODULE);

331
dll/dxkernel32.cpp Normal file
View File

@ -0,0 +1,331 @@
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
void HookKernel32(HMODULE module)
{
void *tmp;
if(dxw.dwFlags2 & LIMITRESOURCES){
tmp = HookAPI(module, "kernel32.dll", GetDiskFreeSpaceA, "GetDiskFreeSpaceA", extGetDiskFreeSpaceA);
if(tmp) pGetDiskFreeSpaceA = (GetDiskFreeSpaceA_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GlobalMemoryStatus, "GlobalMemoryStatus", extGlobalMemoryStatus);
if(tmp) pGlobalMemoryStatus = (GlobalMemoryStatus_Type)tmp;
}
if(dxw.dwFlags2 & TIMESTRETCH){
tmp = HookAPI(module, "kernel32.dll", GetTickCount, "GetTickCount", extGetTickCount);
if(tmp) pGetTickCount = (GetTickCount_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetLocalTime, "GetLocalTime", extGetLocalTime);
if(tmp) pGetLocalTime = (GetLocalTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetSystemTime, "GetSystemTime", extGetSystemTime);
if(tmp) pGetSystemTime = (GetSystemTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetSystemTimeAsFileTime, "GetSystemTimeAsFileTime", extGetSystemTimeAsFileTime);
if(tmp) pGetSystemTimeAsFileTime = (GetSystemTimeAsFileTime_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", Sleep, "Sleep", extSleep);
if(tmp) pSleep = (Sleep_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", SleepEx, "SleepEx", extSleepEx);
if(tmp) pSleepEx = (SleepEx_Type)tmp;
tmp = HookAPI(module, "user32.dll", SetTimer, "SetTimer", extSetTimer);
if(tmp) pSetTimer = (SetTimer_Type)tmp;
tmp = HookAPI(module, "winmm.dll", NULL, "timeGetTime", exttimeGetTime);
if(tmp) ptimeGetTime = (timeGetTime_Type)tmp;
}
if(dxw.dwFlags2 & FAKEVERSION){
tmp = HookAPI(module, "kernel32.dll", GetVersion, "GetVersion", extGetVersion);
if(tmp) pGetVersion = (GetVersion_Type)tmp;
tmp = HookAPI(module, "kernel32.dll", GetVersionEx, "GetVersionEx", extGetVersionEx);
if(tmp) pGetVersionEx = (GetVersionEx_Type)tmp;
}
}
FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"IsDebuggerPresent")){
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extIsDebuggerPresent);
return (FARPROC)extIsDebuggerPresent;
}
if(dxw.dwFlags2 & LIMITRESOURCES){
if (!strcmp(proc,"GetDiskFreeSpaceA")){
pGetDiskFreeSpaceA=(GetDiskFreeSpaceA_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetDiskFreeSpaceA);
return (FARPROC)extGetDiskFreeSpaceA;
}
if (!strcmp(proc,"GlobalMemoryStatus")){
pGlobalMemoryStatus=(GlobalMemoryStatus_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGlobalMemoryStatus);
return (FARPROC)extGlobalMemoryStatus;
}
}
if(dxw.dwFlags2 & TIMESTRETCH){
if (!strcmp(proc,"GetTickCount")){
pGetTickCount=(GetTickCount_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetTickCount);
return (FARPROC)extGetTickCount;
}
if (!strcmp(proc,"GetLocalTime")){
pGetLocalTime=(GetLocalTime_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetLocalTime);
return (FARPROC)extGetLocalTime;
}
if (!strcmp(proc,"GetSystemTime")){
pGetSystemTime=(GetSystemTime_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetSystemTime);
return (FARPROC)extGetSystemTime;
}
if (!strcmp(proc,"GetSystemTimeAsFileTime")){
pGetSystemTimeAsFileTime=(GetSystemTimeAsFileTime_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetSystemTimeAsFileTime);
return (FARPROC)extGetSystemTimeAsFileTime;
}
if (!strcmp(proc,"Sleep")){
pSleep=(Sleep_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSleep);
return (FARPROC)extSleep;
}
if (!strcmp(proc,"SleepEx")){
pSleepEx=(SleepEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSleepEx);
return (FARPROC)extSleepEx;
}
if (!strcmp(proc,"SetTimer")){
pSetTimer=(SetTimer_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extSetTimer);
return (FARPROC)extSetTimer;
}
}
if(dxw.dwFlags2 & FAKEVERSION){
if (!strcmp(proc,"GetVersion")){
pGetVersion=(GetVersion_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetVersion);
return (FARPROC)extGetVersion;
}
if (!strcmp(proc,"GetVersionEx")){
pGetVersionEx=(GetVersionEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extGetVersionEx);
return (FARPROC)extGetVersionEx;
}
}
return NULL;
}
int WINAPI extIsDebuggerPresent(void)
{
OutTraceD("extIsDebuggerPresent: return FALSE\n");
return FALSE;
}
BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
{
BOOL ret;
OutTraceD("GetDiskFreeSpace: RootPathName=\"%s\"\n", lpRootPathName);
ret=(*pGetDiskFreeSpaceA)(lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters);
if(!ret) OutTraceE("GetDiskFreeSpace: ERROR err=%d at %d\n", GetLastError(), __LINE__);
*lpNumberOfFreeClusters = 16000;
return ret;
}
/* -------------------------------------------------------------------------------
GlobalMemoryStatus: MSDN documents that on modern PCs that have more than DWORD
memory values the GlobalMemoryStatus sets the fields to -1 (0xFFFFFFFF) and you
should use GlobalMemoryStatusEx instead.
But in some cases the value is less that DWORD max, but greater that DWORD>>1, that
is the calling application may get a big value and see it as a signed negative
value, as it happened to Nocturne on my PC. That's why it's not adviseable to write:
if(lpBuffer->dwTotalPhys== -1) ...
but this way:
if ((int)lpBuffer->dwTotalPhys < 0) ...
and also don't set
BIGENOUGH 0x80000000 // possibly negative!!!
but:
BIGENOUGH 0x20000000 // surely positive !!!
/* ---------------------------------------------------------------------------- */
#define BIGENOUGH 0x20000000
void WINAPI extGlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{
(*pGlobalMemoryStatus)(lpBuffer);
OutTraceD("GlobalMemoryStatus: Length=%x MemoryLoad=%x "
"TotalPhys=%x AvailPhys=%x TotalPageFile=%x AvailPageFile=%x TotalVirtual=%x AvailVirtual=%x\n",
lpBuffer->dwMemoryLoad, lpBuffer->dwTotalPhys, lpBuffer->dwAvailPhys,
lpBuffer->dwTotalPageFile, lpBuffer->dwAvailPageFile, lpBuffer->dwTotalVirtual, lpBuffer->dwAvailVirtual);
if(lpBuffer->dwLength==sizeof(MEMORYSTATUS)){
if ((int)lpBuffer->dwTotalPhys < 0) lpBuffer->dwTotalPhys = BIGENOUGH;
if ((int)lpBuffer->dwAvailPhys < 0) lpBuffer->dwAvailPhys = BIGENOUGH;
if ((int)lpBuffer->dwTotalPageFile < 0) lpBuffer->dwTotalPageFile = BIGENOUGH;
if ((int)lpBuffer->dwAvailPageFile < 0) lpBuffer->dwAvailPageFile = BIGENOUGH;
if ((int)lpBuffer->dwTotalVirtual < 0) lpBuffer->dwTotalVirtual = BIGENOUGH;
if ((int)lpBuffer->dwAvailVirtual < 0) lpBuffer->dwAvailVirtual = BIGENOUGH;
}
}
/*
From MSDN:
Operating system Version number dwMajorVersion dwMinorVersion Other
Windows 8 6.2 6 2 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2012 6.2 6 2 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows 7 6.1 6 1 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2008 R2 6.1 6 1 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Server 2008 6.0 6 0 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Vista 6.0 6 0 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2003 R2 5.2 5 2 GetSystemMetrics(SM_SERVERR2) != 0
Windows Home Server 5.2 5 2 OSVERSIONINFOEX.wSuiteMask & VER_SUITE_WH_SERVER
Windows Server 2003 5.2 5 2 GetSystemMetrics(SM_SERVERR2) == 0
Windows XP Pro x64 Ed. 5.2 5 2 (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION) && (SYSTEM_INFO.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
Windows XP 5.1 5 1 Not applicable
Windows 2000 5.0 5 0 Not applicable
From http://delphi.about.com/cs/adptips2000/a/bltip1100_2.htm
Windows 95 4.0 4 0
Windows 98/SE" 4.10 4 10 if osVerInfo.szCSDVersion[1] = 'A' then Windows98SE
Windows ME 4.90 4 90
*/
static struct {char bMajor; char bMinor; char *sName;} WinVersions[9]=
{
{4, 0, "Windows 95"},
{4,10, "Windows 98/SE"},
{4,90, "Windows ME"},
{5, 0, "Windows 2000"},
{5, 1, "Windows XP"},
{5, 2, "Windows Server 2003"},
{6, 0, "Windows Vista"},
{6, 1, "Windows 7"},
{6, 2, "Windows 8"}
};
BOOL WINAPI extGetVersionEx(LPOSVERSIONINFO lpVersionInfo)
{
BOOL ret;
ret=(*pGetVersionEx)(lpVersionInfo);
if(!ret) {
OutTraceE("GetVersionEx: ERROR err=%d\n", GetLastError());
return ret;
}
OutTraceD("GetVersionEx: version=%d.%d build=(%d)\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber);
if(dxw.dwFlags2 & FAKEVERSION) {
// fake Win XP build 0
lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor;
lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor;
lpVersionInfo->dwBuildNumber = 0;
OutTraceD("GetVersionEx: FIXED version=%d.%d build=(%d) os=\"%s\"\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber,
WinVersions[dxw.FakeVersionId].sName);
}
return TRUE;
}
DWORD WINAPI extGetVersion(void)
{
DWORD dwVersion;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuild = 0;
dwVersion = (*pGetVersion)();
// Get the Windows version.
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number.
if (dwVersion < 0x80000000)
dwBuild = (DWORD)(HIWORD(dwVersion));
OutTraceD("GetVersion: version=%d.%d build=(%d)\n", dwMajorVersion, dwMinorVersion, dwBuild);
if(dxw.dwFlags2 & FAKEVERSION) {
dwVersion = WinVersions[dxw.FakeVersionId].bMajor | (WinVersions[dxw.FakeVersionId].bMinor << 8);
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
dwBuild = (DWORD)(HIWORD(dwVersion));
OutTraceD("GetVersion: FIXED version=%d.%d build=(%d) os=\"%s\"\n",
dwMajorVersion, dwMinorVersion, dwBuild, WinVersions[dxw.FakeVersionId].sName);
}
return dwVersion;
}
/* -------------------------------------------------------------------------------
time related APIs
/* ---------------------------------------------------------------------------- */
DWORD WINAPI extGetTickCount(void)
{
return dxw.GetTickCount();
}
void WINAPI extGetSystemTime(LPSYSTEMTIME lpSystemTime)
{
dxw.GetSystemTime(lpSystemTime);
if (IsDebug) OutTrace("GetSystemTime: %02d:%02d:%02d.%03d\n",
lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond, lpSystemTime->wMilliseconds);
}
void WINAPI extGetLocalTime(LPSYSTEMTIME lpLocalTime)
{
SYSTEMTIME SystemTime;
dxw.GetSystemTime(&SystemTime);
SystemTimeToTzSpecificLocalTime(NULL, &SystemTime, lpLocalTime);
if (IsDebug) OutTrace("GetLocalTime: %02d:%02d:%02d.%03d\n",
lpLocalTime->wHour, lpLocalTime->wMinute, lpLocalTime->wSecond, lpLocalTime->wMilliseconds);
}
UINT_PTR WINAPI extSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
{
UINT uShiftedElapse;
// beware: the quicker the time flows, the more the time clicks are incremented,
// and the lesser the pauses must be lasting! Shift operations are reverted in
// GetSystemTime vs. Sleep or SetTimer
uShiftedElapse = dxw.StretchTime(uElapse);
if (IsDebug) OutTrace("SetTimer: elapse=%d->%d timeshift=%d\n", uElapse, uShiftedElapse, dxw.TimeShift);
return (*pSetTimer)(hWnd, nIDEvent, uShiftedElapse, lpTimerFunc);
}
VOID WINAPI extSleep(DWORD dwMilliseconds)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
if (IsDebug) OutTrace("Sleep: msec=%d->%d timeshift=%d\n", dwMilliseconds, dwNewDelay, dxw.TimeShift);
(*pSleep)(dwNewDelay);
}
DWORD WINAPI extSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
if (IsDebug) OutTrace("SleepEx: msec=%d->%d alertable=%x, timeshift=%d\n", dwMilliseconds, dwNewDelay, bAlertable, dxw.TimeShift);
return (*pSleepEx)(dwNewDelay, bAlertable);
}
void WINAPI extGetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
{
if (IsDebug) OutTrace("GetSystemTimeAsFileTime\n");
dxw.GetSystemTimeAsFileTime(lpSystemTimeAsFileTime);
}

100
dll/dxole32.cpp Normal file
View File

@ -0,0 +1,100 @@
#include <dxdiag.h>
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
#include "dxhelper.h"
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *);
FARPROC Remap_ole32_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"CoCreateInstance")){
pCoCreateInstance=(CoCreateInstance_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCoCreateInstance);
return (FARPROC)extCoCreateInstance;
}
return NULL;
}
// -------------------------------------------------------------------------------------
// Ole32 CoCreateInstance handling: you can create DirectDraw objects through it!
// utilized so far in a single game: Axiz & Allies
// -------------------------------------------------------------------------------------
static void HookDDSession(LPDIRECTDRAW *, int);
//CoCreateInstance_Type pCoCreateInstance=NULL;
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
HRESULT res;
OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x\n",
rclsid, pUnkOuter, dwClsContext, riid);
// CLSID e436ebb3 implies loading quartz.dll to play movies through dshow:
// quartz.dll must be hooked.
if (*(DWORD *)&rclsid==0xe436ebb3){
HMODULE qlib;
OutTraceD("CoCreateInstance: CLSID_FilterGraph RIID=%x\n", *(DWORD *)&riid);
qlib=(*pLoadLibraryA)("quartz.dll");
OutTraceD("CoCreateInstance: quartz lib handle=%x\n", qlib);
extern void HookSysLibs(HMODULE);
HookSysLibs(qlib);
}
res=(*pCoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv);
if(res)
OutTraceE("CoCreateInstance: ERROR res=%x\n", res);
else
OutTraceD("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv);
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){
LPDIRECTDRAW lpOldDDraw;
OutTraceD("CoCreateInstance: CLSID_DirectDraw object\n");
switch (*(DWORD *)&riid){
case 0x6C14DB80:
OutTraceD("DirectDrawCreate: IID_DirectDraw RIID\n");
res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xB3A6F3E0:
OutTraceD("DirectDrawCreate: IID_DirectDraw2 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
break;
case 0x9c59509a:
OutTraceD("DirectDrawCreate: IID_DirectDraw4 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
case 0x15e65ec0:
OutTraceD("CoCreateInstance: IID_DirectDraw7 RIID\n");
res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0);
if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xe436ebb3:
break;
}
}
else
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DxDiagProvider) res=HookDxDiag(riid, ppv);
return res;
}
int HookOle32(HMODULE module, int version)
{
// used by Axis & Allies ....
void *tmp;
//return 0;
OutTraceD("HookOle32 version=%d\n", version); //GHO
tmp = HookAPI(module, "ole32.dll", NULL, "CoCreateInstance", extCoCreateInstance);
if(tmp) pCoCreateInstance = (CoCreateInstance_Type)tmp;
return 0;
}

140
dll/dxuser32.cpp Normal file
View File

@ -0,0 +1,140 @@
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"ChangeDisplaySettingsA")){
pChangeDisplaySettings=(ChangeDisplaySettings_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pChangeDisplaySettings);
return (FARPROC)extChangeDisplaySettings;
}
if (!strcmp(proc,"ChangeDisplaySettingsExA")){
pChangeDisplaySettingsEx=(ChangeDisplaySettingsEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pChangeDisplaySettingsEx);
return (FARPROC)extChangeDisplaySettingsEx;
}
if (!strcmp(proc,"BeginPaint")){
pBeginPaint=(BeginPaint_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pBeginPaint);
return (FARPROC)extBeginPaint;
}
if (!strcmp(proc,"EndPaint")){
pEndPaint=(EndPaint_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pEndPaint);
return (FARPROC)extEndPaint;
}
if (!strcmp(proc,"ShowCursor")){
pShowCursor=(ShowCursor_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pShowCursor);
return (FARPROC)extShowCursor;
}
/*
if(dxw.dwFlags1 & MAPGDITOPRIMARY){
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extDDGetDC);
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extDDGetWindowDC);
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extDDReleaseDC);
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extDDInvalidateRect);
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
}
else{
tmp = HookAPI(module, "user32.dll", GetDC, "GetDC", extGDIGetDC);
if(tmp) pGDIGetDC = (GDIGetDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetWindowDC, "GetWindowDC", extGDIGetWindowDC);
if(tmp) pGDIGetWindowDC = (GDIGetDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", ReleaseDC, "ReleaseDC", extGDIReleaseDC);
if(tmp) pGDIReleaseDC = (GDIReleaseDC_Type)tmp;
tmp = HookAPI(module, "user32.dll", InvalidateRect, "InvalidateRect", extInvalidateRect);
if(tmp) pInvalidateRect = (InvalidateRect_Type)tmp;
}
if (dxw.dwFlags1 & CLIENTREMAPPING){
tmp = HookAPI(module, "user32.dll", ScreenToClient, "ScreenToClient", extScreenToClient);
if(tmp) pScreenToClient = (ScreenToClient_Type)tmp;
tmp = HookAPI(module, "user32.dll", ClientToScreen, "ClientToScreen", extClientToScreen);
if(tmp) pClientToScreen = (ClientToScreen_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetClientRect, "GetClientRect", extGetClientRect);
if(tmp) pGetClientRect = (GetClientRect_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetWindowRect, "GetWindowRect", extGetWindowRect);
if(tmp) pGetWindowRect = (GetWindowRect_Type)tmp;
tmp = HookAPI(module, "user32.dll", MapWindowPoints, "MapWindowPoints", extMapWindowPoints);
if(tmp) pMapWindowPoints = (MapWindowPoints_Type)tmp;
}
// get / change display settings
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsA, "ChangeDisplaySettingsA", extChangeDisplaySettings);
if(tmp) pChangeDisplaySettings = (ChangeDisplaySettings_Type)tmp;
tmp = HookAPI(module, "user32.dll", ChangeDisplaySettingsExA, "ChangeDisplaySettingsExA", extChangeDisplaySettingsEx);
if(tmp) pChangeDisplaySettingsEx = (ChangeDisplaySettingsEx_Type)tmp;
tmp = HookAPI(module, "user32.dll", EnumDisplaySettingsA, "EnumDisplaySettingsA", extEnumDisplaySettings);
if(tmp) pEnumDisplaySettings = (EnumDisplaySettings_Type)tmp;
// handle cursor clipping
tmp = HookAPI(module, "user32.dll", GetClipCursor, "GetClipCursor", extGetClipCursor);
if(tmp) pGetClipCursor = (GetClipCursor_Type)tmp;
tmp = HookAPI(module, "user32.dll", ClipCursor, "ClipCursor", extClipCursor);
if(tmp) pClipCursor = (ClipCursor_Type)tmp;
tmp = HookAPI(module, "user32.dll", FillRect, "FillRect", extFillRect);
if(tmp) pFillRect = (FillRect_Type)tmp;
if (dxw.dwFlags1 & MESSAGEPROC) {
tmp = HookAPI(module, "user32.dll", PeekMessageA, "PeekMessageA", extPeekMessage); // added for GPL
if(tmp) pPeekMessage = (PeekMessage_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetMessageA, "GetMessageA", extGetMessage); // added for GPL
if(tmp) pGetMessage = (GetMessage_Type)tmp;
}
tmp = HookAPI(module, "user32.dll", DefWindowProcA, "DefWindowProcA", extDefWindowProc); // added for WarWind background erase
if(tmp) pDefWindowProc = (DefWindowProc_Type)tmp;
tmp = HookAPI(module, "user32.dll", CreateWindowExA, "CreateWindowExA", extCreateWindowExA);
if(tmp) pCreateWindowExA = (CreateWindowExA_Type)tmp;
tmp = HookAPI(module, "user32.dll", RegisterClassExA, "RegisterClassExA", extRegisterClassExA);
if(tmp) pRegisterClassExA = (RegisterClassExA_Type)tmp;
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)){
tmp = HookAPI(module, "user32.dll", ShowWindow, "ShowWindow", extShowWindow);
if(tmp) pShowWindow = (ShowWindow_Type)tmp;
tmp = HookAPI(module, "user32.dll", SetWindowLongA, "SetWindowLongA", extSetWindowLong);
if(tmp) pSetWindowLong = (SetWindowLong_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetWindowLongA, "GetWindowLongA", extGetWindowLong);
if(tmp) pGetWindowLong = (GetWindowLong_Type)tmp;
tmp = HookAPI(module, "user32.dll", SetWindowPos, "SetWindowPos", extSetWindowPos);
if(tmp) pSetWindowPos = (SetWindowPos_Type)tmp;
tmp = HookAPI(module, "user32.dll", DeferWindowPos, "DeferWindowPos", extDeferWindowPos);
if(tmp) pGDIDeferWindowPos = (DeferWindowPos_Type)tmp;
tmp = HookAPI(module, "user32.dll", CallWindowProcA, "CallWindowProcA", extCallWindowProc);
if(tmp) pCallWindowProc = (CallWindowProc_Type)tmp;
}
tmp = HookAPI(module, "user32.dll", GetSystemMetrics, "GetSystemMetrics", extGetSystemMetrics);
if(tmp) pGetSystemMetrics = (GetSystemMetrics_Type)tmp;
tmp = HookAPI(module, "user32.dll", GetDesktopWindow, "GetDesktopWindow", extGetDesktopWindow);
if(tmp) pGetDesktopWindow = (GetDesktopWindow_Type)tmp;
if(dxw.dwFlags1 & MODIFYMOUSE){
tmp = HookAPI(module, "user32.dll", GetCursorPos, "GetCursorPos", extGetCursorPos);
if(tmp) pGetCursorPos = (GetCursorPos_Type)tmp;
//tmp = HookAPI(module, "user32.dll", GetPhysicalCursorPos, "", extGetCursorPos);
tmp = HookAPI(module, "user32.dll", SetCursor, "SetCursor", extSetCursor);
if(tmp) pSetCursor = (SetCursor_Type)tmp;
//tmp = HookAPI(module, "user32.dll", SetPhysicalCursorPos, "", extSetCursorPos);
tmp = HookAPI(module, "user32.dll", SendMessageA, "SendMessageA", extSendMessage);
if(tmp) pSendMessage = (SendMessage_Type)tmp;
}
if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)){
tmp = HookAPI(module, "user32.dll", SetCursorPos, "SetCursorPos", extSetCursorPos);
if(tmp) pSetCursorPos = (SetCursorPos_Type)tmp;
}
tmp = HookAPI(module, "user32.dll", CreateDialogIndirectParamA, "CreateDialogIndirectParamA", extCreateDialogIndirectParam);
if(tmp) pCreateDialogIndirectParam = (CreateDialogIndirectParam_Type)tmp;
tmp = HookAPI(module, "user32.dll", CreateDialogParamA, "CreateDialogParamA", extCreateDialogParam);
if(tmp) pCreateDialogParam = (CreateDialogParam_Type)tmp;
tmp = HookAPI(module, "user32.dll", MoveWindow, "MoveWindow", extMoveWindow);
if(tmp) pMoveWindow = (MoveWindow_Type)tmp;
*/
return NULL;
}

View File

@ -657,6 +657,11 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
}
}
void dxwCore::ShowFPS()
{
this->ShowFPS(GetDC(hWnd));
}
void dxwCore::ShowFPS(HDC xdc)
{
char sBuf[81];
@ -741,13 +746,14 @@ void dxwCore::ShowBanner(HWND hwnd)
HBITMAP g_hbmBall;
RECT client;
if(JustOnce || (dwFlags2 & NOBANNER)) return;
JustOnce=TRUE;
hClientDC=GetDC(hwnd);
(*pGetClientRect)(hwnd, &client);
//BitBlt(hClientDC, 0, 0, wp.cx, wp.cy, NULL, 0, 0, BLACKNESS);
BitBlt(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS);
if(JustOnce || (dwFlags2 & NOBANNER)) return;
g_hbmBall = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BANNER));
HDC hdcMem = CreateCompatibleDC(hClientDC);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall);
@ -770,4 +776,57 @@ void dxwCore::ShowBanner(HWND hwnd)
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
Sleep(200);
}
int dxwCore::GetDLLIndex(char *lpFileName)
{
int idx;
char *lpName, *lpNext;
char *SysNames[]={
"kernel32",
"USER32",
"GDI32",
"ADVAPI32",
"ole32",
"ddraw",
"d3d8",
"d3d9",
"d3d10",
"d3d10_1",
"d3d11",
"opengl32",
"msvfw32",
"smackw32",
"version",
"dplayx",
"dsound",
"winmm",
"imm32",
"wsock32",
"dinput",
"dinput8",
"shfolder",
"shell32",
"ws2_32",
"tapi32",
"netapi32",
NULL
};
lpName=lpFileName;
while (lpNext=strchr(lpName,'\\')) lpName=lpNext+1;
for(idx=0; SysNames[idx]; idx++){
char SysNameExt[81];
strcpy(SysNameExt, SysNames[idx]);
strcat(SysNameExt, ".dll");
if(
(!lstrcmpi(lpName,SysNames[idx])) ||
(!lstrcmpi(lpName,SysNameExt))
){
OutTraceB("Registered DLL FileName=%s\n", lpFileName);
break;
}
}
if (!SysNames[idx]) return -1;
return idx;
}

View File

@ -55,12 +55,14 @@ public: // methods
void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
DWORD StretchTime(DWORD);
void ShowFPS(LPDIRECTDRAWSURFACE);
void ShowFPS(void);
void ShowFPS(HDC);
char *GetTSCaption(int);
char *GetTSCaption(void);
void DoSlow(int);
void ShowBanner(HWND);
POINT ScreenToClient(POINT);
int GetDLLIndex(char *);
public: // simple data variables
DDPIXELFORMAT ActualPixelFormat;
@ -105,3 +107,32 @@ protected:
};
extern dxwCore dxw;
typedef enum {
SYSLIBIDX_KERNEL32 = 0,
SYSLIBIDX_USER32,
SYSLIBIDX_GDI32,
SYSLIBIDX_ADVAPI32,
SYSLIBIDX_OLE32,
SYSLIBIDX_DIRECTDRAW,
SYSLIBIDX_DIRECT3D8,
SYSLIBIDX_DIRECT3D9,
SYSLIBIDX_DIRECT3D10,
SYSLIBIDX_DIRECT3D10_1,
SYSLIBIDX_DIRECT2D11,
SYSLIBIDX_OPENGL,
SYSLIBIDX_MSVFW,
SYSLIBIDX_SMACK,
SYSLIBIDX_VERSION,
SYSLIBIDX_DPLAYX,
SYSLIBIDX_DSOUND,
SYSLIBIDX_WINMM,
SYSLIBIDX_WSOCK,
SYSLIBIDX_DINPUT,
SYSLIBIDX_DINPUT8,
SYSLIBIDX_SHFOLDER,
SYSLIBIDX_SHELL32,
SYSLIBIDX_WS2_32,
SYSLIBIDX_TAPI32,
SYSLIBIDX_NETAPI32,
SYSLIBIDX_MAX } enum_syslibraries;

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h"
#include "dxwcore.hpp"
#define VERSION "2.02.19"
#define VERSION "2.02.21"
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);

Binary file not shown.

View File

@ -248,6 +248,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\dxkernel32.cpp"
>
</File>
<File
RelativePath=".\dxole32.cpp"
>
</File>
<File
RelativePath=".\dxuser32.cpp"
>
</File>
<File
RelativePath=".\dxwcore.cpp"
>
@ -356,6 +368,10 @@
RelativePath=".\msvfwhook.cpp"
>
</File>
<File
RelativePath=".\smack.cpp"
>
</File>
<File
RelativePath=".\syslibs.cpp"
>

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9,00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="USER-PC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -9,6 +9,8 @@
FARPROC Remap_gl_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if(!(dxw.dwFlags2 & HOOKOPENGL)) return NULL;
if (!strcmp(proc,"glViewport") && !pglViewport){
pglViewport=(glViewport_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pglViewport);
@ -254,6 +256,7 @@ void WINAPI extglDrawBuffer(GLenum mode)
}
}
(*pglDrawBuffer)(mode);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS();
}
void WINAPI extglPolygonMode(GLenum face, GLenum mode)

View File

@ -1,6 +1,5 @@
#include "gl.h"
extern FARPROC Remap_gl_ProcAddress(LPCSTR, HMODULE);
extern void HookOpenGLLibs(HMODULE, char *);
typedef void (WINAPI *glViewport_Type)(GLint, GLint, GLsizei, GLsizei);

View File

@ -6,11 +6,20 @@
#include <D3D11.h>
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "dxhook.h"
#define HOOKD3D10ANDLATER 1
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID riid, void** ppvObj);
typedef void* (WINAPI *Direct3DCreate8_Type)(UINT);
typedef void* (WINAPI *Direct3DCreate9_Type)(UINT);
typedef HRESULT (WINAPI *Direct3DCreate9Ex_Type)(UINT, IDirect3D9Ex **);
typedef UINT (WINAPI *GetAdapterCount_Type)(void *);
typedef HRESULT (WINAPI *GetAdapterIdentifier_Type)(void *, UINT, DWORD, D3DADAPTER_IDENTIFIER9 *);
typedef HRESULT (WINAPI *CreateDevice_Type)(void *, UINT, D3DDEVTYPE, HWND, DWORD, void *, void **);
typedef HRESULT (WINAPI *CreateDeviceEx_Type)(void *, UINT, D3DDEVTYPE, HWND, DWORD, void *, D3DDISPLAYMODEEX *, void **);
typedef HRESULT (WINAPI *EnumAdapterModes8_Type)(void *, UINT, UINT, D3DDISPLAYMODE *);
typedef HRESULT (WINAPI *EnumAdapterModes9_Type)(void *, UINT, D3DFORMAT ,UINT, D3DDISPLAYMODE *);
typedef HRESULT (WINAPI *GetAdapterDisplayMode_Type)(void *, UINT, D3DDISPLAYMODE *);
@ -18,6 +27,10 @@ typedef HRESULT (WINAPI *GetDisplayMode_Type)(void *, D3DDISPLAYMODE *);
typedef HRESULT (WINAPI *Present_Type)(void *, CONST RECT *, CONST RECT *, HWND, CONST RGNDATA *);
typedef HRESULT (WINAPI *SetRenderState_Type)(void *, D3DRENDERSTATETYPE, DWORD);
typedef HRESULT (WINAPI *GetRenderState_Type)(void *, D3DRENDERSTATETYPE, DWORD );
typedef HRESULT (WINAPI *CreateAdditionalSwapChain_Type)(void *, D3DPRESENT_PARAMETERS *, IDirect3DSwapChain9 **);
typedef HRESULT (WINAPI *GetDirect3D_Type)(void *, IDirect3D9 **);
typedef HRESULT (WINAPI *GetViewport_Type)(void *, D3DVIEWPORT9 *);
typedef HRESULT (WINAPI *SetViewport_Type)(void *, D3DVIEWPORT9 *);
typedef HRESULT (WINAPI *D3D10CreateDevice_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **);
typedef HRESULT (WINAPI *D3D10CreateDeviceAndSwapChain_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
@ -25,11 +38,21 @@ typedef HRESULT (WINAPI *D3D10CreateDevice1_Type)(IDXGIAdapter *, D3D10_DRIVER_T
typedef HRESULT (WINAPI *D3D10CreateDeviceAndSwapChain1_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
typedef HRESULT (WINAPI *D3D11CreateDevice_Type)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
typedef HRESULT (WINAPI *D3D11CreateDeviceAndSwapChain_Type)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, const DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
typedef void (WINAPI *RSSetViewports_Type)(void *, UINT, D3D11_VIEWPORT *);
HRESULT WINAPI extQueryInterfaceD3D8(void *, REFIID, void** );
HRESULT WINAPI extQueryInterfaceDev8(void *, REFIID, void** );
HRESULT WINAPI extQueryInterfaceD3D9(void *, REFIID, void** );
HRESULT WINAPI extQueryInterfaceDev9(void *, REFIID, void** );
HRESULT WINAPI extGetDirect3D(void *, IDirect3D9 **);
void* WINAPI extDirect3DCreate8(UINT);
void* WINAPI extDirect3DCreate9(UINT);
HRESULT WINAPI extDirect3DCreate9Ex(UINT, IDirect3D9Ex **);
UINT WINAPI extGetAdapterCount(void *);
HRESULT WINAPI extGetAdapterIdentifier(void *, UINT, DWORD, D3DADAPTER_IDENTIFIER9 *);
HRESULT WINAPI extCreateDevice(void *, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS *, void **);
HRESULT WINAPI extCreateDeviceEx(void *, UINT, D3DDEVTYPE, HWND, DWORD, D3DPRESENT_PARAMETERS *, D3DDISPLAYMODEEX *, void **);
HRESULT WINAPI extEnumAdapterModes8(void *, UINT, UINT , D3DDISPLAYMODE *);
HRESULT WINAPI extEnumAdapterModes9(void *, UINT, D3DFORMAT, UINT , D3DDISPLAYMODE *);
HRESULT WINAPI extGetAdapterDisplayMode(void *, UINT, D3DDISPLAYMODE *);
@ -37,6 +60,9 @@ HRESULT WINAPI extGetDisplayMode(void *, D3DDISPLAYMODE *);
HRESULT WINAPI extPresent(void *, CONST RECT *, CONST RECT *, HWND, CONST RGNDATA *);
HRESULT WINAPI extSetRenderState(void *, D3DRENDERSTATETYPE, DWORD);
HRESULT WINAPI extGetRenderState(void *, D3DRENDERSTATETYPE, DWORD);
HRESULT WINAPI extCreateAdditionalSwapChain(void *, D3DPRESENT_PARAMETERS *, IDirect3DSwapChain9 **);
HRESULT WINAPI extGetViewport(void *, D3DVIEWPORT9 *);
HRESULT WINAPI extSetViewport(void *, D3DVIEWPORT9 *);
HRESULT WINAPI extD3D10CreateDevice(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **);
HRESULT WINAPI extD3D10CreateDeviceAndSwapChain(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
@ -44,20 +70,33 @@ HRESULT WINAPI extD3D10CreateDevice1(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE,
HRESULT WINAPI extD3D10CreateDeviceAndSwapChain1(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
HRESULT WINAPI extD3D11CreateDevice(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
HRESULT WINAPI extD3D11CreateDeviceAndSwapChain(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, const DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
void WINAPI extRSSetViewports(ID3D11DeviceContext *, UINT, D3D11_VIEWPORT *);
extern char *ExplainDDError(DWORD);
QueryInterface_Type pQueryInterfaceD3D8;
QueryInterface_Type pQueryInterfaceDev8;
QueryInterface_Type pQueryInterfaceD3D9;
QueryInterface_Type pQueryInterfaceDev9;
GetDirect3D_Type pGetDirect3D;
Direct3DCreate8_Type pDirect3DCreate8 = 0;
Direct3DCreate9_Type pDirect3DCreate9 = 0;
Direct3DCreate9Ex_Type pDirect3DCreate9Ex = 0;
GetAdapterCount_Type pGetAdapterCount;
GetAdapterIdentifier_Type pGetAdapterIdentifier;
CreateDevice_Type pCreateDevice;
CreateDeviceEx_Type pCreateDeviceEx;
EnumAdapterModes8_Type pEnumAdapterModes8;
EnumAdapterModes9_Type pEnumAdapterModes9;
GetAdapterDisplayMode_Type pGetAdapterDisplayMode;
GetDisplayMode_Type pGetDisplayMode;
Present_Type pPresent;
Present_Type pPresent = 0;
SetRenderState_Type pSetRenderState;
GetRenderState_Type pGetRenderState;
CreateAdditionalSwapChain_Type pCreateAdditionalSwapChain;
GetViewport_Type pGetViewport;
SetViewport_Type pSetViewport;
D3D10CreateDevice_Type pD3D10CreateDevice;
D3D10CreateDeviceAndSwapChain_Type pD3D10CreateDeviceAndSwapChain;
@ -65,9 +104,121 @@ D3D10CreateDevice1_Type pD3D10CreateDevice1;
D3D10CreateDeviceAndSwapChain1_Type pD3D10CreateDeviceAndSwapChain1;
D3D11CreateDevice_Type pD3D11CreateDevice;
D3D11CreateDeviceAndSwapChain_Type pD3D11CreateDeviceAndSwapChain;
RSSetViewports_Type pRSSetViewports;
DWORD dwD3DVersion;
FARPROC Remap_d3d8_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"Direct3DCreate8") && !pDirect3DCreate8){
pDirect3DCreate8=(Direct3DCreate8_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate8);
return (FARPROC)extDirect3DCreate8;
}
// NULL -> keep the original call address
return NULL;
}
HRESULT WINAPI voidDirect3DShaderValidatorCreate9(void)
{
OutTraceD("Direct3DShaderValidatorCreate9: SUPPRESSED\n");
return 0;
}
void WINAPI voidDebugSetLevel(void)
{
OutTraceD("DebugSetLevel: SUPPRESSED\n");
}
void WINAPI voidDebugSetMute(void)
{
OutTraceD("DebugSetMute: SUPPRESSED\n");
}
FARPROC Remap_d3d9_ProcAddress(LPCSTR proc, HMODULE hModule)
{
// NULL -> keep the original call address
// (FARPROC)-1 -> returns NULL
if (!strcmp(proc,"Direct3DCreate9") && !pDirect3DCreate9){
pDirect3DCreate9=(Direct3DCreate9_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9);
return (FARPROC)extDirect3DCreate9;
}
if (!strcmp(proc,"Direct3DCreate9Ex") && !pDirect3DCreate9Ex){
pDirect3DCreate9Ex=(Direct3DCreate9Ex_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9Ex);
return (FARPROC)extDirect3DCreate9Ex;
}
if (!(dxw.dwFlags3 & SUPPRESSD3DEXT)) return NULL;
if (!strcmp(proc,"Direct3DShaderValidatorCreate9")){
OutTraceD("GetProcAddress: suppressing Direct3DShaderValidatorCreate9\n");
return (FARPROC)voidDirect3DShaderValidatorCreate9;
//return (FARPROC)-1;
}
if (!strcmp(proc,"DebugSetLevel")){
OutTraceD("GetProcAddress: suppressing DebugSetLevel\n");
return (FARPROC)voidDebugSetLevel;
//return (FARPROC)-1;
}
if (!strcmp(proc,"DebugSetMute")){
OutTraceD("GetProcAddress: suppressing DebugSetMute\n");
return (FARPROC)voidDebugSetMute;
//return (FARPROC)-1;
}
return NULL;
}
FARPROC Remap_d3d10_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"D3D10CreateDevice") && !pD3D10CreateDevice){
pD3D10CreateDevice=(D3D10CreateDevice_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice);
return (FARPROC)extD3D10CreateDevice;
}
if (!strcmp(proc,"D3D10CreateDeviceAndSwapChain") && !pD3D10CreateDeviceAndSwapChain){
pD3D10CreateDeviceAndSwapChain=(D3D10CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain);
return (FARPROC)extD3D10CreateDeviceAndSwapChain;
}
// NULL -> keep the original call address
return NULL;
}
FARPROC Remap_d3d10_1_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"D3D10CreateDevice1") && !pD3D10CreateDevice1){
pD3D10CreateDevice1=(D3D10CreateDevice1_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice1);
return (FARPROC)extD3D10CreateDevice1;
}
if (!strcmp(proc,"D3D10CreateDeviceAndSwapChain1") && !pD3D10CreateDeviceAndSwapChain1){
pD3D10CreateDeviceAndSwapChain1=(D3D10CreateDeviceAndSwapChain1_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain1);
return (FARPROC)extD3D10CreateDeviceAndSwapChain1;
}
// NULL -> keep the original call address
return NULL;
}
FARPROC Remap_d3d11_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"D3D11CreateDevice") && !pD3D11CreateDevice){
pD3D11CreateDevice=(D3D11CreateDevice_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDevice);
return (FARPROC)extD3D11CreateDevice;
}
if (!strcmp(proc,"D3D11CreateDeviceAndSwapChain") && !pD3D11CreateDeviceAndSwapChain){
pD3D11CreateDeviceAndSwapChain=(D3D11CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDeviceAndSwapChain);
return (FARPROC)extD3D11CreateDeviceAndSwapChain;
}
// NULL -> keep the original call address
return NULL;
}
int HookDirect3D(HMODULE module, int version){
HINSTANCE hinst;
void *tmp;
@ -84,13 +235,16 @@ int HookDirect3D(HMODULE module, int version){
// D3D9
tmp = HookAPI(module, "d3d9.dll", NULL, "Direct3DCreate9", extDirect3DCreate9);
if(tmp) pDirect3DCreate9 = (Direct3DCreate9_Type)tmp;
tmp = HookAPI(module, "d3d9.dll", NULL, "Direct3DCreate9Ex", extDirect3DCreate9Ex);
if(tmp) pDirect3DCreate9Ex = (Direct3DCreate9Ex_Type)tmp;
#ifdef HOOKD3D10ANDLATER
// D3D10
tmp = HookAPI(module, "d3d10.dll", NULL, "D3D10CreateDevice", extD3D10CreateDevice);
if(tmp) pD3D10CreateDevice = (D3D10CreateDevice_Type)tmp;
tmp = HookAPI(module, "d3d10.dll", NULL, "D3D10CreateDeviceAndSwapChain", extD3D10CreateDeviceAndSwapChain);
if(tmp) pD3D10CreateDeviceAndSwapChain = (D3D10CreateDeviceAndSwapChain_Type)tmp;
// D3D10.1
tmp = HookAPI(module, "d3d10_1.dll", NULL, "D3D10CreateDevice1", extD3D10CreateDevice);
tmp = HookAPI(module, "d3d10_1.dll", NULL, "D3D10CreateDevice1", extD3D10CreateDevice1);
if(tmp) pD3D10CreateDevice1 = (D3D10CreateDevice1_Type)tmp;
tmp = HookAPI(module, "d3d10_1.dll", NULL, "D3D10CreateDeviceAndSwapChain1", extD3D10CreateDeviceAndSwapChain);
if(tmp) pD3D10CreateDeviceAndSwapChain1 = (D3D10CreateDeviceAndSwapChain1_Type)tmp;
@ -99,6 +253,7 @@ int HookDirect3D(HMODULE module, int version){
if(tmp) pD3D11CreateDevice = (D3D11CreateDevice_Type)tmp;
tmp = HookAPI(module, "d3d11.dll", NULL, "D3D11CreateDeviceAndSwapChain", extD3D11CreateDeviceAndSwapChain);
if(tmp) pD3D11CreateDeviceAndSwapChain = (D3D11CreateDeviceAndSwapChain_Type)tmp;
#endif
break;
case 8:
hinst = LoadLibrary("d3d8.dll");
@ -118,6 +273,7 @@ int HookDirect3D(HMODULE module, int version){
if(lpd3d) lpd3d->Release();
}
break;
#ifdef HOOKD3D10ANDLATER
case 10:
hinst = LoadLibrary("d3d10.dll");
pD3D10CreateDevice =
@ -207,6 +363,7 @@ int HookDirect3D(HMODULE module, int version){
pD3D11CreateDeviceAndSwapChain =
(D3D11CreateDeviceAndSwapChain_Type)GetProcAddress(hinst, "D3D11CreateDeviceAndSwapChain");
break;
#endif
}
if(pDirect3DCreate8 || pDirect3DCreate9) return 1;
return 0;
@ -219,9 +376,9 @@ void* WINAPI extDirect3DCreate8(UINT sdkversion)
dwD3DVersion = 8;
lpd3d = (*pDirect3DCreate8)(sdkversion);
if(!lpd3d) return 0;
//OutTrace("DEBUG: Hooking lpd3d=%x\n", lpd3d);
//OutTrace("DEBUG: Hooking %x -> %x as CreateDevice(D8)\n", (void *)(*(DWORD *)lpd3d + 60), extCreateDevice);
SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D8, (void **)&pQueryInterfaceD3D8, "QueryInterface(D8)");
SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount, (void **)&pGetAdapterCount, "GetAdapterCount(D8)");
SetHook((void *)(*(DWORD *)lpd3d + 20), extGetAdapterIdentifier, (void **)&pGetAdapterIdentifier, "GetAdapterIdentifier(D8)");
SetHook((void *)(*(DWORD *)lpd3d + 28), extEnumAdapterModes8, (void **)&pEnumAdapterModes8, "EnumAdapterModes(D8)");
SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode, (void **)&pGetAdapterDisplayMode, "GetAdapterDisplayMode(D8)");
SetHook((void *)(*(DWORD *)lpd3d + 60), extCreateDevice, (void **)&pCreateDevice, "CreateDevice(D8)");
@ -238,7 +395,9 @@ void* WINAPI extDirect3DCreate9(UINT sdkversion)
dwD3DVersion = 9;
lpd3d = (*pDirect3DCreate9)(sdkversion);
if(!lpd3d) return 0;
SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D9, (void **)&pQueryInterfaceD3D9, "QueryInterface(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount, (void **)&pGetAdapterCount, "GetAdapterCount(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 20), extGetAdapterIdentifier, (void **)&pGetAdapterIdentifier, "GetAdapterIdentifier(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 28), extEnumAdapterModes9, (void **)&pEnumAdapterModes9, "EnumAdapterModes(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode, (void **)&pGetAdapterDisplayMode, "GetAdapterDisplayMode(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 64), extCreateDevice, (void **)&pCreateDevice, "CreateDevice(D9)");
@ -249,6 +408,32 @@ void* WINAPI extDirect3DCreate9(UINT sdkversion)
return lpd3d;
}
HRESULT WINAPI extDirect3DCreate9Ex(UINT sdkversion, IDirect3D9Ex **ppD3D)
{
void *lpd3d;
HRESULT res;
dwD3DVersion = 9;
res = (*pDirect3DCreate9Ex)(sdkversion, ppD3D);
if(res) {
OutTraceD("Direct3DCreate9Ex: ERROR res=%x SDKVERSION=%x\n", res, sdkversion);
return res;
}
lpd3d = *ppD3D;
SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D9, (void **)&pQueryInterfaceD3D9, "QueryInterface(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount, (void **)&pGetAdapterCount, "GetAdapterCount(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 20), extGetAdapterIdentifier, (void **)&pGetAdapterIdentifier, "GetAdapterIdentifier(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 28), extEnumAdapterModes9, (void **)&pEnumAdapterModes9, "EnumAdapterModes(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode, (void **)&pGetAdapterDisplayMode, "GetAdapterDisplayMode(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 64), extCreateDevice, (void **)&pCreateDevice, "CreateDevice(D9)");
SetHook((void *)(*(DWORD *)lpd3d + 80), extCreateDeviceEx, (void **)&pCreateDeviceEx, "CreateDeviceEx(D9)");
OutTraceD("Direct3DCreate9Ex: SDKVERSION=%x pCreateDeviceEx=%x\n",
sdkversion, pDirect3DCreate9Ex);
return res;
}
UINT WINAPI extGetAdapterCount(void *lpd3d)
{
UINT res;
@ -261,19 +446,31 @@ UINT WINAPI extGetAdapterCount(void *lpd3d)
return res;
}
HRESULT WINAPI extGetAdapterIdentifier(void *pd3dd, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier)
{
HRESULT res;
OutTraceD("GetAdapterIdentifier: Adapter=%d flags=%x\n", Adapter, Flags);
res=pGetAdapterIdentifier(pd3dd, Adapter, Flags, pIdentifier);
OutTraceD("GetAdapterIdentifier: ret=%x\n", res);
return res;
}
HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
OutTraceD("DEBUG: neutralizing pd3dd->Reset()\n");
OutTraceD("Reset: SUPPRESSED\n");
return D3D_OK;
}
HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
{
if (IsDebug) OutTrace("Present\n");
HRESULT res;
OutTraceB("Present\n");
// frame counter handling....
if (dxw.HandleFPS()) return D3D_OK;
// proxy ....
return (*pPresent)(pd3dd, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
res=(*pPresent)(pd3dd, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS();
return res;
}
HRESULT WINAPI extGetDisplayMode(void *lpd3d, D3DDISPLAYMODE *pMode)
@ -322,6 +519,23 @@ HRESULT WINAPI extGetAdapterDisplayMode(void *lpd3d, UINT Adapter, D3DDISPLAYMOD
return res;
}
//HRESULT extValidateDevice(void *, DWORD *pNumPasses);
//HRESULT extGetDeviceCaps(void *, D3DCAPS9 *pCaps);
//typedef HRESULT (WINAPI *ValidateDevice_Type)(void *, DWORD *);
//typedef HRESULT (WINAPI *GetDeviceCapsD3D_Type)(void *, D3DCAPS9 *);
//ValidateDevice_Type pValidateDevice;
//GetDeviceCapsD3D_Type pGetDeviceCapsD3D;
//HRESULT extValidateDevice(void *lpd3dd, DWORD *pNumPasses)
//{
// OutTrace("ValidateDevice hooked\n");
// return (*pValidateDevice)(lpd3dd, pNumPasses);
//}
//HRESULT extGetDeviceCapsD3D(void *lpd3dd, D3DCAPS9 *pCaps)
//{
// OutTrace("GetDeviceCaps hooked\n");
// return (*pGetDeviceCapsD3D)(lpd3dd, pCaps);
//}
HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
HWND hfocuswindow, DWORD behaviorflags, D3DPRESENT_PARAMETERS *ppresentparam, void **ppd3dd)
{
@ -361,11 +575,6 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
param[2] = mode.Format;
OutTraceD(" Current Format = 0x%x\n", mode.Format);
// useless ...
//param[0] = 0; //defaulting to window width
//param[1] = 0; //defaulting to window height
//param[2] = D3DFMT_UNKNOWN; // try
if(dwD3DVersion == 9){
param[7] = 0; //hDeviceWindow
dxw.SetFullScreen(~param[8]?TRUE:FALSE);
@ -391,7 +600,10 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
if(dwD3DVersion == 8){
void *pReset;
pReset=NULL; // to avoid assert condition
SetHook((void *)(*(DWORD *)lpd3d + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev8, (void **)&pQueryInterfaceDev8, "QueryInterface(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D8)");
//SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 56), extReset, (void **)&pReset, "Reset(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 60), extPresent, (void **)&pPresent, "Present(D8)");
if(dxw.dwFlags2 & WIREFRAME){
@ -403,14 +615,98 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
else {
void *pReset;
pReset=NULL; // to avoid assert condition
SetHook((void *)(*(DWORD *)lpd3d + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
if(dxw.dwFlags2 & WIREFRAME){
SetHook((void *)(**(DWORD **)ppd3dd + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
(*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
}
//SetHook((void *)(**(DWORD **)ppd3dd +280), extValidateDevice, (void **)&pValidateDevice, "ValidateDevice(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd + 28), extGetDeviceCapsD3D, (void **)&pGetDeviceCapsD3D, "GetDeviceCaps(D9)");
}
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
GetHookInfo()->DXVersion=(short)dwD3DVersion;
GetHookInfo()->Height=(short)dxw.GetScreenHeight();
GetHookInfo()->Width=(short)dxw.GetScreenWidth();
GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount;
return 0;
}
HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
HWND hfocuswindow, DWORD behaviorflags, D3DPRESENT_PARAMETERS *ppresentparam, D3DDISPLAYMODEEX *pFullscreenDisplayMode, void **ppd3dd)
{
HRESULT res;
DWORD param[64], *tmp;
D3DDISPLAYMODE mode;
int Windowed;
memcpy(param, ppresentparam, 56);
dxw.SethWnd(hfocuswindow);
dxw.SetScreenSize(param[0], param[1]);
AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight());
tmp = param;
OutTraceD("D3D%d::CreateDeviceEx\n", dwD3DVersion);
OutTraceD(" Adapter = %i\n", adapter);
OutTraceD(" DeviceType = %i\n", devicetype);
OutTraceD(" hFocusWindow = 0x%x\n", hfocuswindow);
OutTraceD(" BehaviorFlags = 0x%x\n", behaviorflags);
OutTraceD(" BackBufferWidth = %i\n", *(tmp ++));
OutTraceD(" BackBufferHeight = %i\n", *(tmp ++));
OutTraceD(" BackBufferFormat = %i\n", *(tmp ++));
OutTraceD(" BackBufferCount = %i\n", *(tmp ++));
OutTraceD(" MultiSampleType = %i\n", *(tmp ++));
OutTraceD(" MultiSampleQuality = %i\n", *(tmp ++));
OutTraceD(" SwapEffect = 0x%x\n", *(tmp ++));
OutTraceD(" hDeviceWindow = 0x%x\n", *(tmp ++));
OutTraceD(" Windowed = %i\n", (Windowed=*(tmp ++)));
OutTraceD(" EnableAutoDepthStencil = %i\n", *(tmp ++));
OutTraceD(" AutoDepthStencilFormat = %i\n", *(tmp ++));
OutTraceD(" Flags = 0x%x\n", *(tmp ++));
OutTraceD(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++));
OutTraceD(" PresentationInterval = 0x%x\n", *(tmp ++));
//((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode);
(*pGetAdapterDisplayMode)(lpd3d, 0, &mode);
param[2] = mode.Format;
OutTraceD(" Current Format = 0x%x\n", mode.Format);
//param[7] = 0; //hDeviceWindow
param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow
dxw.SetFullScreen(~param[8]?TRUE:FALSE);
param[8] = 1; //Windowed
param[12] = 0; //FullScreen_RefreshRateInHz;
param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd);
if(res){
OutTraceD("FAILED! %x\n", res);
return res;
}
OutTraceD("SUCCESS!\n");
void *pReset;
pReset=NULL; // to avoid assert condition
SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
if(dxw.dwFlags2 & WIREFRAME){
SetHook((void *)(**(DWORD **)ppd3dd + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
(*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
}
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
@ -433,10 +729,83 @@ HRESULT WINAPI extGetRenderState(void *pd3dd, D3DRENDERSTATETYPE State, DWORD Va
return (*pGetRenderState)(pd3dd, State, Value);
}
// to do:
// hook IDirect3DDevice9::CreateAdditionalSwapChain to intercept Present method on further Swap Chains
// hook SetCursorPosition ShowCursor to handle cursor
HRESULT WINAPI extGetViewport(void *pd3dd, D3DVIEWPORT9 *pViewport)
{
return (*pGetViewport)(pd3dd, pViewport);
}
HRESULT WINAPI extSetViewport(void *pd3dd, D3DVIEWPORT9 *pViewport)
{
RECT client;
POINT p={0,0};
(*pGetClientRect)(dxw.GethWnd(), &client);
OutTraceD("SetViewport: declared pos=(%d,%d) size=(%d,%d) depth=(%f;%f)\n",
pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ);
if(IsDebug) OutTrace("glViewport: DEBUG win=(%d,%d) screen=(%d,%d)\n",
client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight());
pViewport->X = (pViewport->X * (int)client.right) / (int)dxw.GetScreenWidth();
pViewport->Y = (pViewport->Y * (int)client.bottom) / (int)dxw.GetScreenHeight();
pViewport->Width = (pViewport->Width * (int)client.right) / (int)dxw.GetScreenWidth();
pViewport->Height = (pViewport->Height * (int)client.bottom) / (int)dxw.GetScreenHeight();
OutTraceD("SetViewport: remapped pos=(%d,%d) size=(%d,%d)\n",
pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height);
return (*pSetViewport)(pd3dd, pViewport);
}
HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **ppSwapChain)
{
HRESULT res;
DWORD param[64], *tmp;
D3DDISPLAYMODE mode;
int Windowed;
memcpy(param, pPresentationParameters, (dwD3DVersion == 9)?56:52);
dxw.SetScreenSize(param[0], param[1]);
AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight());
tmp = param;
OutTraceD("D3D%d::CreateAdditionalSwapChain\n", dwD3DVersion);
OutTraceD(" BackBufferWidth = %i\n", *(tmp ++));
OutTraceD(" BackBufferHeight = %i\n", *(tmp ++));
OutTraceD(" BackBufferFormat = %i\n", *(tmp ++));
OutTraceD(" BackBufferCount = %i\n", *(tmp ++));
OutTraceD(" MultiSampleType = %i\n", *(tmp ++));
if(dwD3DVersion == 9) OutTraceD(" MultiSampleQuality = %i\n", *(tmp ++));
OutTraceD(" SwapEffect = 0x%x\n", *(tmp ++));
OutTraceD(" hDeviceWindow = 0x%x\n", *(tmp ++));
OutTraceD(" Windowed = %i\n", (Windowed=*(tmp ++)));
OutTraceD(" EnableAutoDepthStencil = %i\n", *(tmp ++));
OutTraceD(" AutoDepthStencilFormat = %i\n", *(tmp ++));
OutTraceD(" Flags = 0x%x\n", *(tmp ++));
OutTraceD(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++));
OutTraceD(" PresentationInterval = 0x%x\n", *(tmp ++));
//((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode);
(*pGetAdapterDisplayMode)(lpd3d, 0, &mode);
param[2] = mode.Format;
OutTraceD(" Current Format = 0x%x\n", mode.Format);
if(dwD3DVersion == 9){
param[7] = 0; //hDeviceWindow
dxw.SetFullScreen(~param[8]?TRUE:FALSE);
param[8] = 1; //Windowed
param[12] = 0; //FullScreen_RefreshRateInHz;
param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
}
else{
param[6] = 0; //hDeviceWindow
dxw.SetFullScreen(~param[7]?TRUE:FALSE);
param[7] = 1; //Windowed
param[11] = 0; //FullScreen_RefreshRateInHz;
param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
}
res=(*pCreateAdditionalSwapChain)(lpd3d, (D3DPRESENT_PARAMETERS *)param, ppSwapChain);
if(res) OutTraceE("CreateAdditionalSwapChain ERROR: res=%x\n", res);
return res;
}
// to do:
// hook SetCursorPosition ShowCursor to handle cursor
HRESULT WINAPI extD3D10CreateDevice(
IDXGIAdapter *pAdapter,
@ -447,9 +816,23 @@ HRESULT WINAPI extD3D10CreateDevice(
ID3D10Device **ppDevice)
{
HRESULT res;
OutTraceD("D3D10CreateDevice\n");
D3D10_VIEWPORT ViewPort;
OutTraceD("D3D10CreateDevice: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion);
//return 0x887a0004;
res=(*pD3D10CreateDevice)(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice);
OutTraceD("D3D10CreateDevice ret=%x\n", res);
if(res){
OutTraceD("D3D10CreateDevice: ret=%x\n", res);
return res;
}
SetHook((void *)(*(DWORD *)*ppDevice + 100), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D10)");
ViewPort.TopLeftX=dxw.iPosX;
ViewPort.TopLeftY=dxw.iPosY;
ViewPort.Width=dxw.iSizX;
ViewPort.Height=dxw.iSizY;
ViewPort.MinDepth=1.0;
ViewPort.MaxDepth=1.0;
(*pRSSetViewports)((void *)*ppDevice, 1, (D3D11_VIEWPORT *)&ViewPort);
OutTraceD("D3D10CreateDevice: ret=%x\n", res);
return res;
}
@ -463,9 +846,10 @@ HRESULT WINAPI extD3D10CreateDevice1(
ID3D10Device **ppDevice)
{
HRESULT res;
OutTraceD("D3D10CreateDevice1\n");
OutTraceD("D3D10CreateDevice1: DriverType=%x Flags=%x HardwareLevel=%x SDKVersion=%x\n", DriverType, Flags, HardwareLevel, SDKVersion);
res=(*pD3D10CreateDevice1)(pAdapter, DriverType, Software, Flags, HardwareLevel, SDKVersion, ppDevice);
OutTraceD("D3D10CreateDevice1 ret=%x\n", res);
SetHook((void *)(*(DWORD *)*ppDevice + 100), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D10)");
OutTraceD("D3D10CreateDevice1: ret=%x\n", res);
return res;
}
@ -480,7 +864,8 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain(
ID3D10Device **ppDevice)
{
HRESULT res;
OutTraceD("D3D10CreateDeviceAndSwapChain\n");
OutTraceD("D3D10CreateDeviceAndSwapChain: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion);
//return 0x887a0004;
pSwapChainDesc->OutputWindow = dxw.GethWnd();
pSwapChainDesc->Windowed = true;
res=(*pD3D10CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice);
@ -499,7 +884,8 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain1(
ID3D10Device **ppDevice)
{
HRESULT res;
OutTraceD("D3D10CreateDeviceAndSwapChain1\n");
OutTraceD("D3D10CreateDeviceAndSwapChain1: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion);
//return 0x887a0004;
pSwapChainDesc->OutputWindow = dxw.GethWnd();
pSwapChainDesc->Windowed = true;
res=(*pD3D10CreateDeviceAndSwapChain1)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice);
@ -520,8 +906,15 @@ HRESULT WINAPI extD3D11CreateDevice(
ID3D11DeviceContext **ppImmediateContext)
{
HRESULT res;
OutTraceD("D3D11CreateDevice\n");
OutTraceD("D3D11CreateDevice: DriverType=%x Flags=%x FeatureLevels=%x SDKVersion=%x\n", DriverType, Flags, FeatureLevels, SDKVersion);
//return 0x887a0004;
res=(*pD3D11CreateDevice)(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
if(res){
OutTraceD("D3D11CreateDevice: ret=%x\n", res);
return res;
}
SetHook((void *)(*(DWORD *)ppImmediateContext + 148), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D11)");
//SetHook((void *)(*(DWORD *)ppImmediateContext + 152), extRSSetScissorRects, (void **)&pRSSetScissorRects, "RSSetScissorRects(D11)");
OutTraceD("D3D11CreateDevice ret=%x\n", res);
return res;
}
@ -542,8 +935,81 @@ HRESULT WINAPI extD3D11CreateDeviceAndSwapChain(
{
HRESULT res;
OutTraceD("D3D11CreateDeviceAndSwapChain\n");
//res=(*pD3D11CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, *ppDevice, pFeatureLevel, ppImmediateContext);
res=DD_OK;
return 0x887a0004;
res=(*pD3D11CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
OutTraceD("D3D11CreateDeviceAndSwapChain ret=%x\n", res);
return res;
}
void WINAPI extRSSetViewports(ID3D11DeviceContext *This, UINT NumViewports, D3D11_VIEWPORT *pViewports)
{
OutTraceD("RSSetViewports: NumViewports=%d\n", NumViewports);
if(NumViewports==1){
pViewports->TopLeftX=dxw.iPosX;
pViewports->TopLeftY=dxw.iPosY;
pViewports->Width=dxw.iSizX;
pViewports->Height=dxw.iSizY;
}
(*pRSSetViewports)(This, NumViewports, pViewports);
}
HRESULT WINAPI extQueryInterfaceD3D8(void *obj, REFIID riid, void** ppvObj)
{
HRESULT res;
OutTraceD("D3D::QueryInterface(8)\n");
res=pQueryInterfaceD3D8(obj, riid, ppvObj);
return res;
}
HRESULT WINAPI extQueryInterfaceDev8(void *obj, REFIID riid, void** ppvObj)
{
HRESULT res;
OutTraceD("Device::QueryInterface(8)\n");
res=pQueryInterfaceDev8(obj, riid, ppvObj);
return res;
}
HRESULT WINAPI extQueryInterfaceD3D9(void *obj, REFIID riid, void** ppvObj)
{
HRESULT res;
OutTraceD("D3D::QueryInterface(9)\n");
res=pQueryInterfaceD3D9(obj, riid, ppvObj);
return res;
}
HRESULT WINAPI extQueryInterfaceDev9(void *obj, REFIID riid, void** ppvObj)
{
HRESULT res;
OutTraceD("Device::QueryInterface(9): lpd3dd=%x refiid=%x\n", obj, riid);
res=pQueryInterfaceDev9(obj, riid, ppvObj);
if(res){
OutTraceD("Device::QueryInterface(9): ERROR ret=%x\n", res);
return res;
}
OutTraceD("Device::QueryInterface(9): ppvObj=%x\n", *ppvObj);
void *pReset;
pReset=NULL; // to avoid assert condition
SetHook((void *)(**(DWORD **)ppvObj + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)");
SetHook((void *)(**(DWORD **)ppvObj + 32), extGetDisplayMode, (void **)&pGetDisplayMode, "GetDisplayMode(D9)");
SetHook((void *)(**(DWORD **)ppvObj + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
SetHook((void *)(**(DWORD **)ppvObj + 64), extReset, (void **)&pReset, "Reset(D9)");
SetHook((void *)(**(DWORD **)ppvObj + 68), extPresent, (void **)&pPresent, "Present(D9)");
SetHook((void *)(**(DWORD **)ppvObj +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
SetHook((void *)(**(DWORD **)ppvObj +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
if(dxw.dwFlags2 & WIREFRAME){
SetHook((void *)(**(DWORD **)ppvObj + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)");
SetHook((void *)(**(DWORD **)ppvObj + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)");
(*pSetRenderState)((void *)*ppvObj, D3DRS_FILLMODE, D3DFILL_WIREFRAME);
}
return res;
}
HRESULT WINAPI extGetDirect3D(void *lpdd3dd, IDirect3D9 **ppD3D9)
{
OutTraceD("Device::GetDirect3D\n");
return (*pGetDirect3D)(lpdd3dd, ppD3D9);
}

View File

@ -227,6 +227,32 @@ LPVOID rSurface = NULL;
static char *SetPixFmt(LPDDSURFACEDESC2);
int FlipChainLength=0;
FARPROC Remap_ddraw_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"DirectDrawCreate")){
pDirectDrawCreate=(DirectDrawCreate_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirectDrawCreate);
return (FARPROC)extDirectDrawCreate;
}
if (!strcmp(proc,"DirectDrawCreateEx")){
pDirectDrawCreateEx=(DirectDrawCreateEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirectDrawCreateEx);
return (FARPROC)extDirectDrawCreateEx;
}
if (!strcmp(proc,"DirectDrawEnumerateA")){
pDirectDrawEnumerate=(DirectDrawEnumerate_Type)(*pGetProcAddress)(hModule, proc);
OutTraceP("GetProcAddress: hooking proc=%s at addr=%x\n", proc, pDirectDrawEnumerate);
return (FARPROC)extDirectDrawEnumerateProxy;
}
if (!strcmp(proc,"DirectDrawEnumerateExA")){
pDirectDrawEnumerateEx=(DirectDrawEnumerateEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceP("GetProcAddress: hooking proc=%s at addr=%x\n", proc, pDirectDrawEnumerateEx);
return (FARPROC)extDirectDrawEnumerateExProxy;
}
// NULL -> keep the original call address
return NULL;
}
/* ------------------------------------------------------------------------------ */
// auxiliary (static) functions
/* ------------------------------------------------------------------------------ */
@ -467,87 +493,6 @@ void FixPixelFormat(int ColorDepth, DDPIXELFORMAT *pf)
}
}
// -------------------------------------------------------------------------------------
// Ole32 CoCreateInstance handling: you can create DirectDraw objects through it!
// utilized so far in a single game: Axiz & Allies
// -------------------------------------------------------------------------------------
static void HookDDSession(LPDIRECTDRAW *, int);
//CoCreateInstance_Type pCoCreateInstance=NULL;
HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv)
{
HRESULT res;
OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x\n",
rclsid, pUnkOuter, dwClsContext, riid);
// CLSID e436ebb3 implies loading quartz.dll to play movies through dshow:
// quartz.dll must be hooked.
if (*(DWORD *)&rclsid==0xe436ebb3){
HMODULE qlib;
OutTraceD("CoCreateInstance: CLSID_FilterGraph RIID=%x\n", *(DWORD *)&riid);
qlib=(*pLoadLibraryA)("quartz.dll");
OutTraceD("CoCreateInstance: quartz lib handle=%x\n", qlib);
extern void HookSysLibs(HMODULE);
HookSysLibs(qlib);
}
res=(*pCoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv);
if(res)
OutTraceE("CoCreateInstance: ERROR res=%x\n", res);
else
OutTraceD("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv);
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){
LPDIRECTDRAW lpOldDDraw;
OutTraceD("CoCreateInstance: CLSID_DirectDraw object\n");
switch (*(DWORD *)&riid){
case 0x6C14DB80:
OutTraceD("DirectDrawCreate: IID_DirectDraw RIID\n");
res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xB3A6F3E0:
OutTraceD("DirectDrawCreate: IID_DirectDraw2 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
break;
case 0x9c59509a:
OutTraceD("DirectDrawCreate: IID_DirectDraw4 RIID\n");
res=extDirectDrawCreate(NULL, &lpOldDDraw, 0);
if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res));
res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv);
if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res));
lpOldDDraw->Release();
case 0x15e65ec0:
OutTraceD("CoCreateInstance: IID_DirectDraw7 RIID\n");
res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0);
if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res));
break;
case 0xe436ebb3:
break;
}
}
else
if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DxDiagProvider) res=HookDxDiag(riid, ppv);
return res;
}
int HookOle32(HMODULE module, int version)
{
// used by Axis & Allies ....
void *tmp;
//return 0;
OutTraceD("HookOle32 version=%d\n", version); //GHO
tmp = HookAPI(module, "ole32.dll", NULL, "CoCreateInstance", extCoCreateInstance);
if(tmp) pCoCreateInstance = (CoCreateInstance_Type)tmp;
return 0;
}
int HookDirectDraw(HMODULE module, int version)
{
HINSTANCE hinst;
@ -2424,6 +2369,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
res=0;
// blit only when source and dest surface are different. Should make ScreenRefresh faster.
if (lpdds != lpddssrc) {
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(lpddssrc);
if (IsDebug) BlitTrace("PRIM-NOEMU", lpsrcrect, &destrect, __LINE__);
res= (*pBlt)(lpdds, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
}

52
dll/smack.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <windows.h>
#include "dxwnd.h"
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
#pragma pack(1)
typedef struct {
UINT32 version;
UINT32 width;
UINT32 height;
UINT32 frame_count;
UINT32 mspf;
char unknown[864];
UINT32 frame_number;
} SmackStruct;
typedef SmackStruct * (WINAPI *SmackOpen_Type)(HANDLE, UINT32, INT32);
SmackOpen_Type pSmackOpen = NULL;
SmackStruct * WINAPI extSmackOpen(HANDLE, UINT32, INT32);
FARPROC Remap_smack_ProcAddress(LPCSTR proc, HMODULE hModule)
{
if (!strcmp(proc,"_SmackOpen@12") && !pSmackOpen){
pSmackOpen=(SmackOpen_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pSmackOpen);
return (FARPROC)extSmackOpen;
}
// NULL -> keep the original call address
return NULL;
}
SmackStruct * WINAPI extSmackOpen(HANDLE SmackFile, UINT32 flags, INT32 unknown)
{
SmackStruct *ret;
OutTraceD("SmackOpen: SmackFile=%x flags=%x unknown=%x\n", SmackFile, flags, unknown);
if(!pSmackOpen) OutTraceE("ASSERT: NULL pSmackOpen\n");
ret=(*pSmackOpen)(SmackFile, flags, unknown);
OutTraceD("SmackOpen: ret=%x\n", ret);
if (ret) {
OutTraceD("SmackOpen: version=%x screen=(%dx%d) frame_count=%d frame_number=%d\n",
ret->version, ret->width, ret->height, ret->frame_count, ret->frame_number);
//ret->width=800;
//ret->height=600;
}
return ret;
}

View File

@ -1177,22 +1177,19 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
if(lpDevMode)
dxw.SetScreenSize(lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight);
if (dxw.dwFlags1 & EMULATESURFACE){
OutTraceD("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname);
return DISP_CHANGE_SUCCESSFUL;
}
else{
if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){
if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){
// v2.2.21: save desired mode to possible use in EnumDisplaySettings wrapper v2.2.21
SetDevMode=*lpDevMode;
pSetDevMode=&SetDevMode;
if (dxw.dwFlags1 & EMULATESURFACE){
OutTraceD("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname);
return DISP_CHANGE_SUCCESSFUL;
}
else{
DEVMODE NewMode, TryMode;
int i;
//EnumDisplaySettings_Type pEnum;
// find what address call to use
// pEnum = pEnumDisplaySettings ? pEnumDisplaySettings : EnumDisplaySettings;
// pEnum = EnumDisplaySettings;
SetDevMode=*lpDevMode;
pSetDevMode=&SetDevMode;
// set the proper mode
NewMode = *lpDevMode;
@ -1223,9 +1220,9 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
res, ExplainDisplaySettingsRetcode(res));
return res;
}
else
return (*ChangeDisplaySettings)(lpDevMode, dwflags);
}
else
return (*ChangeDisplaySettings)(lpDevMode, dwflags);
}
LONG WINAPI extChangeDisplaySettings(DEVMODE *lpDevMode, DWORD dwflags)
@ -1466,44 +1463,19 @@ BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgF
// intercept GetProcAddress to initialize DirectDraw hook pointers.
// This is necessary in "The Sims" game, that loads DirectDraw dinamically
#define SYSLIBIDX_KERNEL32 0
#define SYSLIBIDX_USER32 1
#define SYSLIBIDX_GDI32 2
#define SYSLIBIDX_OLE32 3
#define SYSLIBIDX_DIRECTDRAW 4
#define SYSLIBIDX_OPENGL 5
#define SYSLIBIDX_MSVFW 6
//#define SYSLIBIDX_SMACK 7
#define SYSLIBIDX_MAX 7 // array size
HMODULE SysLibs[SYSLIBIDX_MAX];
char *SysNames[SYSLIBIDX_MAX]={
"kernel32.dll",
"USER32.dll",
"GDI32.dll",
"ole32.dll",
"ddraw.dll",
"opengl32.dll",
//"msvfw32.dll",
"smackw32.dll"
};
char *SysNames2[SYSLIBIDX_MAX]={
"kernel32",
"USER32",
"GDI32",
"ole32",
"ddraw",
"opengl32",
//"msvfw32",
"smackw32"
};
extern void HookModule(HMODULE, int);
extern void HookSysLibs(HMODULE);
HMODULE SysLibs[SYSLIBIDX_MAX];
HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags, char *api)
{
HMODULE libhandle;
int idx;
char *lpName, *lpNext;
//if(!strcmp(lpFileName, "d3d9.dll") && GetModuleHandle(lpFileName)) return GetModuleHandle(lpFileName); // attempt to avoid loading same dll twice....
libhandle=(*pLoadLibraryExA)(lpFileName, hFile, dwFlags);
OutTraceD("%s: FileName=%s hFile=%x Flags=%x(%s) hmodule=%x\n", api, lpFileName, hFile, dwFlags, ExplainLoadLibFlags(dwFlags), libhandle);
if(!libhandle){
@ -1515,24 +1487,15 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl
// there's no symbol map, then itìs no possible to hook function calls.
if(dwFlags & (LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE|LOAD_LIBRARY_AS_DATAFILE)) return libhandle;
lpName=(char *)lpFileName;
while (lpNext=strchr(lpName,'\\')) lpName=lpNext+1;
for(idx=0; idx<SYSLIBIDX_MAX; idx++){
if(
(!lstrcmpi(lpName,SysNames[idx])) ||
(!lstrcmpi(lpName,SysNames2[idx]))
){
OutTraceD("%s: registered hmodule=%x->FileName=%s\n", api, libhandle, lpFileName);
SysLibs[idx]=libhandle;
break;
}
}
idx=dxw.GetDLLIndex((char *)lpFileName);
if(idx != -1) SysLibs[idx]=libhandle;
// handle custom OpenGL library
if(!lstrcmpi(lpName,dxw.CustomOpenGLLib)){
if(!lstrcmpi(lpFileName,dxw.CustomOpenGLLib)){
idx=SYSLIBIDX_OPENGL;
SysLibs[idx]=libhandle;
}
if (idx == SYSLIBIDX_MAX) HookModule(libhandle, 0);
//if (idx == SYSLIBIDX_MAX) HookModule(libhandle, 0);
if (idx == -1) HookModule(libhandle, 0);
return libhandle;
}
@ -1567,12 +1530,6 @@ extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFI
extern GetProcAddress_Type pGetProcAddress;
//extern HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*);
int WINAPI extIsDebuggerPresent(void)
{
OutTraceD("extIsDebuggerPresent: return FALSE\n");
return FALSE;
}
FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
{
FARPROC ret;
@ -1596,54 +1553,43 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
FARPROC remap;
switch(idx){
case SYSLIBIDX_DIRECTDRAW:
if (!strcmp(proc,"DirectDrawCreate")){
pDirectDrawCreate=(DirectDrawCreate_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirectDrawCreate);
return (FARPROC)extDirectDrawCreate;
}
if (!strcmp(proc,"DirectDrawCreateEx")){
pDirectDrawCreateEx=(DirectDrawCreateEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirectDrawCreateEx);
return (FARPROC)extDirectDrawCreateEx;
}
if (!strcmp(proc,"DirectDrawEnumerateA")){
pDirectDrawEnumerate=(DirectDrawEnumerate_Type)(*pGetProcAddress)(hModule, proc);
OutTraceP("GetProcAddress: hooking proc=%s at addr=%x\n", proc, pDirectDrawEnumerate);
return (FARPROC)extDirectDrawEnumerateProxy;
}
if (!strcmp(proc,"DirectDrawEnumerateExA")){
pDirectDrawEnumerateEx=(DirectDrawEnumerateEx_Type)(*pGetProcAddress)(hModule, proc);
OutTraceP("GetProcAddress: hooking proc=%s at addr=%x\n", proc, pDirectDrawEnumerateEx);
return (FARPROC)extDirectDrawEnumerateExProxy;
}
if (remap=Remap_ddraw_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_USER32:
if (!strcmp(proc,"ChangeDisplaySettingsA")){
pChangeDisplaySettings=(ChangeDisplaySettings_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pChangeDisplaySettings);
return (FARPROC)extChangeDisplaySettings;
}
if (remap=Remap_user32_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_KERNEL32:
if (!strcmp(proc,"IsDebuggerPresent")){
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extIsDebuggerPresent);
return (FARPROC)extIsDebuggerPresent;
}
case SYSLIBIDX_OLE32:
if (!strcmp(proc,"CoCreateInstance")){
pCoCreateInstance=(CoCreateInstance_Type)(*pGetProcAddress)(hModule, proc);
OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCoCreateInstance);
return (FARPROC)extCoCreateInstance;
}
if (remap=Remap_kernel32_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_OLE32:
if (remap=Remap_ole32_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D8:
if (remap=Remap_d3d8_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D9:
if (remap=Remap_d3d9_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D10:
if (remap=Remap_d3d10_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT3D10_1:
if (remap=Remap_d3d10_1_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_DIRECT2D11:
if (remap=Remap_d3d11_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_OPENGL:
if(!(dxw.dwFlags2 & HOOKOPENGL)) break;
if (remap=Remap_gl_ProcAddress(proc, hModule)) return remap;
break;
case SYSLIBIDX_MSVFW:
if (remap=Remap_vfw_ProcAddress(proc, hModule)) return remap;
break;
//default:
case SYSLIBIDX_SMACK:
if (remap=Remap_smack_ProcAddress(proc, hModule)) return remap;
break;
default:
break;
}
}
else {
@ -2445,16 +2391,6 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI extSetUnhandledExceptionFilter(LPTOP_LEVEL_E
return (*pSetUnhandledExceptionFilter)(myUnhandledExceptionFilter);
}
BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
{
BOOL ret;
OutTraceD("GetDiskFreeSpace: RootPathName=\"%s\"\n", lpRootPathName);
ret=(*pGetDiskFreeSpaceA)(lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters);
if(!ret) OutTraceE("GetDiskFreeSpace: ERROR err=%d at %d\n", GetLastError(), __LINE__);
*lpNumberOfFreeClusters = 16000;
return ret;
}
BOOL WINAPI extSetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
{
BOOL ret;
@ -2515,69 +2451,6 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
return ret;
}
DWORD WINAPI extGetTickCount(void)
{
return dxw.GetTickCount();
}
void WINAPI extGetSystemTime(LPSYSTEMTIME lpSystemTime)
{
dxw.GetSystemTime(lpSystemTime);
if (IsDebug) OutTrace("GetSystemTime: %02d:%02d:%02d.%03d\n",
lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond, lpSystemTime->wMilliseconds);
}
void WINAPI extGetLocalTime(LPSYSTEMTIME lpLocalTime)
{
SYSTEMTIME SystemTime;
dxw.GetSystemTime(&SystemTime);
SystemTimeToTzSpecificLocalTime(NULL, &SystemTime, lpLocalTime);
if (IsDebug) OutTrace("GetLocalTime: %02d:%02d:%02d.%03d\n",
lpLocalTime->wHour, lpLocalTime->wMinute, lpLocalTime->wSecond, lpLocalTime->wMilliseconds);
}
UINT_PTR WINAPI extSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
{
UINT uShiftedElapse;
// beware: the quicker the time flows, the more the time clicks are incremented,
// and the lesser the pauses must be lasting! Shift operations are reverted in
// GetSystemTime vs. Sleep or SetTimer
uShiftedElapse = dxw.StretchTime(uElapse);
if (IsDebug) OutTrace("SetTimer: elapse=%d->%d timeshift=%d\n", uElapse, uShiftedElapse, dxw.TimeShift);
return (*pSetTimer)(hWnd, nIDEvent, uShiftedElapse, lpTimerFunc);
}
VOID WINAPI extSleep(DWORD dwMilliseconds)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
if (IsDebug) OutTrace("Sleep: msec=%d->%d timeshift=%d\n", dwMilliseconds, dwNewDelay, dxw.TimeShift);
(*pSleep)(dwNewDelay);
}
DWORD WINAPI extSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
{
DWORD dwNewDelay;
dwNewDelay=dwMilliseconds;
if (dwMilliseconds!=INFINITE && dwMilliseconds!=0){
dwNewDelay = dxw.StretchTime(dwMilliseconds);
if (dwNewDelay==0){ // oh oh! troubles...
if (dxw.TimeShift > 0) dwNewDelay=1; // minimum allowed...
else dwNewDelay = INFINITE-1; // maximum allowed !!!
}
}
if (IsDebug) OutTrace("SleepEx: msec=%d->%d alertable=%x, timeshift=%d\n", dwMilliseconds, dwNewDelay, bAlertable, dxw.TimeShift);
return (*pSleepEx)(dwNewDelay, bAlertable);
}
DWORD WINAPI exttimeGetTime(void)
{
DWORD ret;
@ -2586,12 +2459,6 @@ DWORD WINAPI exttimeGetTime(void)
return ret;
}
void WINAPI extGetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
{
if (IsDebug) OutTrace("GetSystemTimeAsFileTime\n");
dxw.GetSystemTimeAsFileTime(lpSystemTimeAsFileTime);
}
int WINAPI extShowCursor(BOOL bShow)
{
static int iFakeCounter;
@ -2617,130 +2484,3 @@ int WINAPI extShowCursor(BOOL bShow)
return ret;
}
/*
From MSDN:
Operating system Version number dwMajorVersion dwMinorVersion Other
Windows 8 6.2 6 2 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2012 6.2 6 2 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows 7 6.1 6 1 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2008 R2 6.1 6 1 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Server 2008 6.0 6 0 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Vista 6.0 6 0 OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2003 R2 5.2 5 2 GetSystemMetrics(SM_SERVERR2) != 0
Windows Home Server 5.2 5 2 OSVERSIONINFOEX.wSuiteMask & VER_SUITE_WH_SERVER
Windows Server 2003 5.2 5 2 GetSystemMetrics(SM_SERVERR2) == 0
Windows XP Pro x64 Ed. 5.2 5 2 (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION) && (SYSTEM_INFO.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
Windows XP 5.1 5 1 Not applicable
Windows 2000 5.0 5 0 Not applicable
From http://delphi.about.com/cs/adptips2000/a/bltip1100_2.htm
Windows 95 4.0 4 0
Windows 98/SE" 4.10 4 10 if osVerInfo.szCSDVersion[1] = 'A' then Windows98SE
Windows ME 4.90 4 90
*/
static struct {char bMajor; char bMinor; char *sName;} WinVersions[9]=
{
{4, 0, "Windows 95"},
{4,10, "Windows 98/SE"},
{4,90, "Windows ME"},
{5, 0, "Windows 2000"},
{5, 1, "Windows XP"},
{5, 2, "Windows Server 2003"},
{6, 0, "Windows Vista"},
{6, 1, "Windows 7"},
{6, 2, "Windows 8"}
};
BOOL WINAPI extGetVersionEx(LPOSVERSIONINFO lpVersionInfo)
{
BOOL ret;
ret=(*pGetVersionEx)(lpVersionInfo);
if(!ret) {
OutTraceE("GetVersionEx: ERROR err=%d\n", GetLastError());
return ret;
}
OutTraceD("GetVersionEx: version=%d.%d build=(%d)\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber);
if(dxw.dwFlags2 & FAKEVERSION) {
// fake Win XP build 0
lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor;
lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor;
lpVersionInfo->dwBuildNumber = 0;
OutTraceD("GetVersionEx: FIXED version=%d.%d build=(%d) os=\"%s\"\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber,
WinVersions[dxw.FakeVersionId].sName);
}
return TRUE;
}
DWORD WINAPI extGetVersion(void)
{
DWORD dwVersion;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuild = 0;
dwVersion = (*pGetVersion)();
// Get the Windows version.
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number.
if (dwVersion < 0x80000000)
dwBuild = (DWORD)(HIWORD(dwVersion));
OutTraceD("GetVersion: version=%d.%d build=(%d)\n", dwMajorVersion, dwMinorVersion, dwBuild);
if(dxw.dwFlags2 & FAKEVERSION) {
dwVersion = WinVersions[dxw.FakeVersionId].bMajor | (WinVersions[dxw.FakeVersionId].bMinor << 8);
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
dwBuild = (DWORD)(HIWORD(dwVersion));
OutTraceD("GetVersion: FIXED version=%d.%d build=(%d) os=\"%s\"\n",
dwMajorVersion, dwMinorVersion, dwBuild, WinVersions[dxw.FakeVersionId].sName);
}
return dwVersion;
}
/* -------------------------------------------------------------------------------
GlobalMemoryStatus: MSDN documents that on modern PCs that have more than DWORD
memory values the GlobalMemoryStatus sets the fields to -1 (0xFFFFFFFF) and you
should use GlobalMemoryStatusEx instead.
But in some cases the value is less that DWORD max, but greater that DWORD>>1, that
is the calling application may get a big value and see it as a signed negative
value, as it happened to Nocturne on my PC. That's why it's not adviseable to write:
if(lpBuffer->dwTotalPhys== -1) ...
but this way:
if ((int)lpBuffer->dwTotalPhys < 0) ...
and also don't set
BIGENOUGH 0x80000000 // possibly negative!!!
but:
BIGENOUGH 0x20000000 // surely positive !!!
/* ---------------------------------------------------------------------------- */
#define BIGENOUGH 0x20000000
void WINAPI extGlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{
(*pGlobalMemoryStatus)(lpBuffer);
OutTraceD("GlobalMemoryStatus: Length=%x MemoryLoad=%x "
"TotalPhys=%x AvailPhys=%x TotalPageFile=%x AvailPageFile=%x TotalVirtual=%x AvailVirtual=%x\n",
lpBuffer->dwMemoryLoad, lpBuffer->dwTotalPhys, lpBuffer->dwAvailPhys,
lpBuffer->dwTotalPageFile, lpBuffer->dwAvailPageFile, lpBuffer->dwTotalVirtual, lpBuffer->dwAvailVirtual);
if(lpBuffer->dwLength==sizeof(MEMORYSTATUS)){
if ((int)lpBuffer->dwTotalPhys < 0) lpBuffer->dwTotalPhys = BIGENOUGH;
if ((int)lpBuffer->dwAvailPhys < 0) lpBuffer->dwAvailPhys = BIGENOUGH;
if ((int)lpBuffer->dwTotalPageFile < 0) lpBuffer->dwTotalPageFile = BIGENOUGH;
if ((int)lpBuffer->dwAvailPageFile < 0) lpBuffer->dwAvailPageFile = BIGENOUGH;
if ((int)lpBuffer->dwTotalVirtual < 0) lpBuffer->dwTotalVirtual = BIGENOUGH;
if ((int)lpBuffer->dwAvailVirtual < 0) lpBuffer->dwAvailVirtual = BIGENOUGH;
}
}

View File

@ -278,6 +278,7 @@ extern DWORD WINAPI extGetTickCount(void);
extern DWORD WINAPI extGetVersion(void);
extern BOOL WINAPI extGetVersionEx(LPOSVERSIONINFO);
extern void WINAPI extGlobalMemoryStatus(LPMEMORYSTATUS);
extern int WINAPI extIsDebuggerPresent(void);
extern HMODULE WINAPI extLoadLibraryA(LPCTSTR);
extern HMODULE WINAPI extLoadLibraryExA(LPCTSTR, HANDLE, DWORD);
extern HMODULE WINAPI extLoadLibraryW(LPCWSTR);

View File

@ -41,6 +41,8 @@ IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_MOVE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -64,6 +66,32 @@ CMainFrame::CMainFrame()
CMainFrame::~CMainFrame()
{
char InitPath[MAX_PATH];
char val[32];
GetCurrentDirectory(MAX_PATH, InitPath);
strcat_s(InitPath, sizeof(InitPath), "\\dxwnd.ini");
// adjust client win coordinates
RECT rect;
rect.top = y;
rect.bottom = y + cy;
rect.left = x;
rect.right = x + cx;
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, 1);
x = rect.left;
y = rect.top;
cx = rect.right - rect.left;
cy = rect.bottom - rect.top;
// save window rect
sprintf_s(val, sizeof(val), "%i", x);
WritePrivateProfileString("window", "posx", val, InitPath);
sprintf_s(val, sizeof(val), "%i", y);
WritePrivateProfileString("window", "posy", val, InitPath);
sprintf_s(val, sizeof(val), "%i", cx);
WritePrivateProfileString("window", "sizx", val, InitPath);
sprintf_s(val, sizeof(val), "%i", cy);
WritePrivateProfileString("window", "sizy", val, InitPath);
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
@ -76,13 +104,32 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.cx = 320;
cs.cy = 200;
char InitPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH, InitPath);
strcat_s(InitPath, sizeof(InitPath), "\\dxwnd.ini");
cs.x = GetPrivateProfileInt("window", "posx", 50, InitPath);
cs.y = GetPrivateProfileInt("window", "posy", 50, InitPath);
cs.cx = GetPrivateProfileInt("window", "sizx", 320, InitPath);
cs.cy = GetPrivateProfileInt("window", "sizy", 200, InitPath);
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
void CMainFrame::OnMove(int x, int y)
{
CFrameWnd::OnMove(x, y);
this->x=x;
this->y=y;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
this->cx=cx;
this->cy=cy;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame Diagnostic Class

View File

@ -31,6 +31,7 @@ public:
// Implementation
public:
virtual ~CMainFrame();
int x, y, cx, cy;
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
@ -40,6 +41,8 @@ public:
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnMove(int, int);
afx_msg void OnSize(UINT, int, int);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -124,6 +124,7 @@
#define IDC_LIMITRESOURCES 1071
#define IDC_SUPPRESSIME 1072
#define IDC_SETCOMPATIBILITY 1073
#define IDC_SUPPRESSD3DEXT 1073
#define IDC_FIXNCHITTEST 1074
#define IDC_LIMITFPS 1075
#define IDC_SKIPFPS 1076
@ -147,6 +148,8 @@
#define IDC_STARTDEBUG 1093
#define IDC_WIREFRAME 1094
#define IDC_DISABLEGAMMARAMP 1095
#define IDC_WINDOWIZE2 1095
#define IDC_HOOKDLLS 1095
#define IDC_FORCEWINRESIZE 1096
#define IDC_TIMESLIDER 1097
#define IDC_FORCEHOOKOPENGL 1098

View File

@ -32,6 +32,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_HANDLEEXCEPTIONS, cTarget->m_HandleExceptions);
DDX_Check(pDX, IDC_LIMITRESOURCES, cTarget->m_LimitResources);
DDX_Check(pDX, IDC_SUPPRESSIME, cTarget->m_SuppressIME);
DDX_Check(pDX, IDC_SUPPRESSD3DEXT, cTarget->m_SuppressD3DExt);
}
BEGIN_MESSAGE_MAP(CTabCompat, CDialog)

View File

@ -32,6 +32,7 @@ void CTabProgram::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_TITLE, cTarget->m_Title);
DDX_Check(pDX, IDC_UNNOTIFY, cTarget->m_UnNotify);
DDX_Check(pDX, IDC_WINDOWIZE, cTarget->m_Windowize);
DDX_Check(pDX, IDC_HOOKDLLS, cTarget->m_HookDLLs);
DDX_Check(pDX, IDC_NOBANNER, cTarget->m_NoBanner);
DDX_Check(pDX, IDC_STARTDEBUG, cTarget->m_StartDebug);
DDX_Check(pDX, IDC_CLIENTREMAPPING, cTarget->m_ClientRemapping);

View File

@ -35,10 +35,12 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_HandleDC = FALSE;
m_HandleExceptions = FALSE;
m_SuppressIME = FALSE;
m_SuppressD3DExt = FALSE;
m_SetCompatibility = FALSE;
m_LimitResources = FALSE;
m_UnNotify = FALSE;
m_Windowize = TRUE;
m_HookDLLs = FALSE;
m_NoBanner = FALSE;
m_StartDebug = FALSE;
m_FilePath = _T("");

View File

@ -41,6 +41,7 @@ public:
BOOL m_HandleDC;
BOOL m_UnNotify;
BOOL m_Windowize;
BOOL m_HookDLLs;
BOOL m_NoBanner;
BOOL m_StartDebug;
CString m_FilePath;
@ -101,6 +102,7 @@ public:
BOOL m_SuppressIME;
BOOL m_SetCompatibility;
BOOL m_WireFrame;
BOOL m_SuppressD3DExt;
int m_InitX;
int m_InitY;
int m_MaxX;

5
host/dxwnd.ini Normal file
View File

@ -0,0 +1,5 @@
[window]
posx=1104
posy=310
sizx=303
sizy=138

Binary file not shown.

View File

@ -44,8 +44,6 @@ public:
// Implementation
//{{AFX_MSG(CDxwndhostApp)
afx_msg void OnAppAbout();
//afx_msg void OnClose();
//afx_msg void OnAppExit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -261,6 +261,7 @@ BEGIN
CONTROL "use DLL Injection",IDC_STARTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,132,100,12
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,142,115,12
CONTROL "Remap Client Rect",IDC_CLIENTREMAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,112,115,10
CONTROL "Hook all DLLs",IDC_HOOKDLLS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,152,124,12
END
IDD_TAB_LOG DIALOGEX 0, 0, 300, 240
@ -412,6 +413,7 @@ BEGIN
CONTROL "Handle Exceptions",IDC_HANDLEEXCEPTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,201,109,12
CONTROL "Limit available resources",IDC_LIMITRESOURCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,212,109,12
CONTROL "Suppress IME",IDC_SUPPRESSIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,190,109,12
CONTROL "Suppress d3d9 extensions",IDC_SUPPRESSD3DEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,179,109,12
END
IDD_TAB_GDI DIALOGEX 0, 0, 300, 240

Binary file not shown.

View File

@ -55,6 +55,9 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_DXAPP_EXIT, OnExit)
ON_WM_RBUTTONDOWN()
ON_WM_DESTROY()
ON_WM_MOVE()
ON_WM_SIZE()
ON_WM_DESTROY()
ON_COMMAND(ID_RUN, OnRun)
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
@ -98,22 +101,47 @@ CDxwndhostView::CDxwndhostView()
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &this->InitDevMode);
}
void CDxwndhostView::OnMove(int x, int y)
{
CWnd::OnMove(x, y);
this->LastX=x;
this->LastY=y;
}
void CDxwndhostView::OnSize(UINT nSize, int cx, int cy)
{
this->LastCX=cx;
this->LastCY=cy;
// save x,y pos since OnMove is not working .... why?
RECT rect;
this->GetActiveWindow()->GetWindowRect(&rect);
this->LastX=rect.left;
this->LastY=rect.top;
}
void CDxwndhostView::SaveWinPos()
{
char val[32];
RECT rect;
//RECT rect;
// save window rect
//::GetWindowRect(::GetActiveWindow(), &rect);
this->GetActiveWindow()->GetWindowRect(&rect);
if((rect.top < 0) || (rect.bottom < 0) || (rect.left < 0) || (rect.right < 0)) return;
sprintf_s(val, sizeof(val), "%i", rect.left);
//this->GetActiveWindow()->GetWindowRect(&rect);
//if((rect.top < 0) || (rect.bottom < 0) || (rect.left < 0) || (rect.right < 0)) return;
//sprintf_s(val, sizeof(val), "%i", rect.left);
//WritePrivateProfileString("window", "posx", val, InitPath);
//sprintf_s(val, sizeof(val), "%i", rect.top);
//WritePrivateProfileString("window", "posy", val, InitPath);
//sprintf_s(val, sizeof(val), "%i", rect.right-rect.left);
//WritePrivateProfileString("window", "sizx", val, InitPath);
//sprintf_s(val, sizeof(val), "%i", rect.bottom-rect.top);
//WritePrivateProfileString("window", "sizy", val, InitPath);
sprintf_s(val, sizeof(val), "%i", this->LastX);
WritePrivateProfileString("window", "posx", val, InitPath);
sprintf_s(val, sizeof(val), "%i", rect.top);
sprintf_s(val, sizeof(val), "%i", this->LastY);
WritePrivateProfileString("window", "posy", val, InitPath);
sprintf_s(val, sizeof(val), "%i", rect.right-rect.left);
sprintf_s(val, sizeof(val), "%i", this->LastCX);
WritePrivateProfileString("window", "sizx", val, InitPath);
sprintf_s(val, sizeof(val), "%i", rect.bottom-rect.top);
sprintf_s(val, sizeof(val), "%i", this->LastCY);
WritePrivateProfileString("window", "sizy", val, InitPath);
}
@ -250,6 +278,12 @@ CDxwndhostView::~CDxwndhostView()
}
}
void CDxwndhostView::OnDestroy()
{
this->OnExit();
exit(0);
}
void CDxwndhostView::OnExit()
{
// check for running apps ....
@ -287,7 +321,6 @@ void CDxwndhostView::OnInitialUpdate()
LV_ITEM listitem;
int i;
char key[32];
RECT rect;
listcol.mask = LVCF_WIDTH;
listcol.cx = 100;
@ -297,16 +330,6 @@ void CDxwndhostView::OnInitialUpdate()
strcat_s(InitPath, sizeof(InitPath), "\\");
strcat_s(InitPath, sizeof(InitPath), m_ConfigFileName);
// restore last window pos
AfxGetApp()->m_pMainWnd->GetWindowRect(&rect);
rect.left = GetPrivateProfileInt("window", "posx", 50, InitPath);
rect.top = GetPrivateProfileInt("window", "posy", 50, InitPath);
rect.right = rect.left + GetPrivateProfileInt("window", "sizx", 320, InitPath);
rect.bottom = rect.top + GetPrivateProfileInt("window", "sizy", 200, InitPath);
AfxGetApp()->m_pMainWnd->MoveWindow(&rect, TRUE);
AfxGetApp()->m_pMainWnd->ShowWindow(SW_SHOW);
AfxGetApp()->m_pMainWnd->UpdateWindow();
for(i = 0; i < MAXTARGETS; i ++){
sprintf_s(key, sizeof(key), "path%i", i);
GetPrivateProfileString("target", key, "", TargetMaps[i].path, MAX_PATH, InitPath);
@ -421,6 +444,7 @@ void CDxwndhostView::OnModify()
dlg.m_Title = TitleMaps[i].title;
dlg.m_UnNotify = TargetMaps[i].flags & UNNOTIFY ? 1 : 0;
dlg.m_Windowize = TargetMaps[i].flags2 & WINDOWIZE ? 1 : 0;
dlg.m_HookDLLs = TargetMaps[i].flags3 & HOOKDLLS ? 1 : 0;
dlg.m_NoBanner = TargetMaps[i].flags2 & NOBANNER ? 1 : 0;
dlg.m_StartDebug = TargetMaps[i].flags2 & STARTDEBUG ? 1 : 0;
dlg.m_EmulateSurface = TargetMaps[i].flags & EMULATESURFACE ? 1 : 0;
@ -440,6 +464,7 @@ void CDxwndhostView::OnModify()
dlg.m_HandleDC = TargetMaps[i].flags & HANDLEDC ? 1 : 0;
dlg.m_HandleExceptions = TargetMaps[i].flags & HANDLEEXCEPTIONS ? 1 : 0;
dlg.m_SuppressIME = TargetMaps[i].flags2 & SUPPRESSIME ? 1 : 0;
dlg.m_SuppressD3DExt = TargetMaps[i].flags3 & SUPPRESSD3DEXT ? 1 : 0;
dlg.m_SetCompatibility = TargetMaps[i].flags2 & SETCOMPATIBILITY ? 1 : 0;
dlg.m_LimitResources = TargetMaps[i].flags2 & LIMITRESOURCES ? 1 : 0;
dlg.m_SaveLoad = TargetMaps[i].flags & SAVELOAD ? 1 : 0;
@ -519,6 +544,7 @@ void CDxwndhostView::OnModify()
TargetMaps[i].tflags = 0;
if(dlg.m_UnNotify) TargetMaps[i].flags |= UNNOTIFY;
if(dlg.m_Windowize) TargetMaps[i].flags2 |= WINDOWIZE;
if(dlg.m_HookDLLs) TargetMaps[i].flags3 |= HOOKDLLS;
if(dlg.m_NoBanner) TargetMaps[i].flags2 |= NOBANNER;
if(dlg.m_StartDebug) TargetMaps[i].flags2 |= STARTDEBUG;
if(dlg.m_NoEmulateSurface) {
@ -553,6 +579,7 @@ void CDxwndhostView::OnModify()
if(dlg.m_HandleExceptions) TargetMaps[i].flags |= HANDLEEXCEPTIONS;
if(dlg.m_LimitResources) TargetMaps[i].flags2 |= LIMITRESOURCES;
if(dlg.m_SuppressIME) TargetMaps[i].flags2 |= SUPPRESSIME;
if(dlg.m_SuppressD3DExt) TargetMaps[i].flags3 |= SUPPRESSD3DEXT;
if(dlg.m_SetCompatibility) TargetMaps[i].flags2 |= SETCOMPATIBILITY;
if(dlg.m_SaveLoad) TargetMaps[i].flags |= SAVELOAD;
if(dlg.m_SlowDown) TargetMaps[i].flags |= SLOWDOWN;
@ -822,6 +849,7 @@ void CDxwndhostView::OnAdd()
TargetMaps[i].tflags = 0;
if(dlg.m_UnNotify) TargetMaps[i].flags |= UNNOTIFY;
if(dlg.m_Windowize) TargetMaps[i].flags2 |= WINDOWIZE;
if(dlg.m_HookDLLs) TargetMaps[i].flags3 |= HOOKDLLS;
if(dlg.m_NoBanner) TargetMaps[i].flags2 |= NOBANNER;
if(dlg.m_StartDebug) TargetMaps[i].flags2 |= STARTDEBUG;
if(dlg.m_NoEmulateSurface) {
@ -855,6 +883,7 @@ void CDxwndhostView::OnAdd()
if(dlg.m_HandleDC) TargetMaps[i].flags |= HANDLEDC;
if(dlg.m_HandleExceptions) TargetMaps[i].flags |= HANDLEEXCEPTIONS;
if(dlg.m_SuppressIME) TargetMaps[i].flags2 |= SUPPRESSIME;
if(dlg.m_SuppressD3DExt) TargetMaps[i].flags3 |= SUPPRESSD3DEXT;
if(dlg.m_SetCompatibility) TargetMaps[i].flags2 |= SETCOMPATIBILITY;
if(dlg.m_LimitResources) TargetMaps[i].flags2 |= LIMITRESOURCES;
if(dlg.m_SaveLoad) TargetMaps[i].flags |= SAVELOAD;
@ -1128,7 +1157,6 @@ void CDxwndhostView::OnGoToTrayIcon()
void CDxwndhostView::OnSaveFile()
{
this->SaveWinPos();
if (this->isUpdated)
if (MessageBoxEx(0,
"Task list has changed.\n"

View File

@ -27,6 +27,7 @@ private:
BOOL isUpdated;
DEVMODE InitDevMode;
CSystemTray SystemTray;
int LastX, LastY, LastCX, LastCY;
// Attributes
public:
@ -43,6 +44,9 @@ public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // Called once after the initial construction.
virtual void OnMove(int, int);
virtual void OnSize(UINT, int, int);
virtual void OnDestroy();
//}}AFX_VIRTUAL
// Implementation