text: #pragma once
  class m_IDirectDrawSurface2 : public IDirectDrawSurface2, public AddressLookupTableD3d9Object
  {
  private:
  	std::unique_ptr<m_IDirectDrawSurfaceX> UniqueProxyInterface;
  	m_IDirectDrawSurfaceX *ProxyInterface;
  	IDirectDrawSurface2 *RealInterface;
  	REFIID WrapperID = IID_IDirectDrawSurface2;
  	const DWORD DirectXVersion = 2;
  
  public:
  	m_IDirectDrawSurface2(IDirectDrawSurface2 *aOriginal) : RealInterface(aOriginal)
  	{
  		UniqueProxyInterface = std::make_unique<m_IDirectDrawSurfaceX>((IDirectDrawSurface7*)RealInterface, DirectXVersion, (m_IDirectDrawSurface7*)this);
  		ProxyInterface = UniqueProxyInterface.get();
  		ProxyAddressLookupTable.SaveAddress(this, RealInterface);
  	}
  	m_IDirectDrawSurface2(m_IDirectDrawSurfaceX *aOriginal) : ProxyInterface(aOriginal)
  	{
  		RealInterface = nullptr;
  	}
  	~m_IDirectDrawSurface2()
  	{
  		ProxyAddressLookupTable.DeleteAddress(this);
  	}
  
  	DWORD GetDirectXVersion() { return DirectXVersion; }
  	REFIID GetWrapperType() { return WrapperID; }
  	IDirectDrawSurface2 *GetProxyInterface() { return RealInterface; }
  	m_IDirectDrawSurfaceX *GetWrapperInterface() { return ProxyInterface; }
  
  	/*** IUnknown methods ***/
  	STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj);
  	STDMETHOD_(ULONG, AddRef) (THIS);
  	STDMETHOD_(ULONG, Release) (THIS);
  
  	/*** IDirectDrawSurface methods ***/
  	STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2);
  	STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT);
  	STDMETHOD(Blt)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2, LPRECT, DWORD, LPDDBLTFX);
  	STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD);
  	STDMETHOD(BltFast)(THIS_ DWORD, DWORD, LPDIRECTDRAWSURFACE2, LPRECT, DWORD);
  	STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD, LPDIRECTDRAWSURFACE2);
  	STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID, LPDDENUMSURFACESCALLBACK);
  	STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD, LPVOID, LPDDENUMSURFACESCALLBACK);
  	STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD);
  	STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *);
  	STDMETHOD(GetBltStatus)(THIS_ DWORD);
  	STDMETHOD(GetCaps)(THIS_ LPDDSCAPS);
  	STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*);
  	STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY);
  	STDMETHOD(GetDC)(THIS_ HDC FAR *);
  	STDMETHOD(GetFlipStatus)(THIS_ DWORD);
  	STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG);
  	STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*);
  	STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT);
  	STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC);
  	STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC);
  	STDMETHOD(IsLost)(THIS);
  	STDMETHOD(Lock)(THIS_ LPRECT, LPDDSURFACEDESC, DWORD, HANDLE);
  	STDMETHOD(ReleaseDC)(THIS_ HDC);
  	STDMETHOD(Restore)(THIS);
  	STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER);
  	STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY);
  	STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG);
  	STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE);
  	STDMETHOD(Unlock)(THIS_ LPVOID);
  	STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2, LPRECT, DWORD, LPDDOVERLAYFX);
  	STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD);
  	STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2);
  	/*** Added in the v2 interface ***/
  	STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *);
  	STDMETHOD(PageLock)(THIS_ DWORD);
  	STDMETHOD(PageUnlock)(THIS_ DWORD);
  };
  