ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2005
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
609 discussions
Start a n
N
ew thread
[greatlrd] 14205: update directx d3d and draw header to Wine-20050310
by greatlrd@svn.reactos.com
update directx d3d and draw header to Wine-20050310 so the work on ddraw dll can continue. Modified: trunk/reactos/include/d3d.h Added: trunk/reactos/include/d3d8.h Added: trunk/reactos/include/d3d8caps.h Added: trunk/reactos/include/d3d8types.h Added: trunk/reactos/include/d3d9.h Added: trunk/reactos/include/d3d9caps.h Added: trunk/reactos/include/d3d9types.h Added: trunk/reactos/include/d3drm.h Modified: trunk/reactos/include/d3dtypes.h Modified: trunk/reactos/include/ddrawi.h _____ Modified: trunk/reactos/include/d3d.h --- trunk/reactos/include/d3d.h 2005-03-19 22:50:11 UTC (rev 14204) +++ trunk/reactos/include/d3d.h 2005-03-19 23:47:52 UTC (rev 14205) @@ -19,10 +19,79 @@ #ifndef __WINE_D3D_H #define __WINE_D3D_H -#include <ddraw.h> +#include <stdlib.h> +#include <objbase.h> #include <d3dtypes.h> /* must precede d3dcaps.h */ #include <d3dcaps.h> +/********************************************************************** ******* + * Predeclare the interfaces + */ +DEFINE_GUID(IID_IDirect3D, 0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56); +DEFINE_GUID(IID_IDirect3D2, 0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a); +DEFINE_GUID(IID_IDirect3D3, 0xbb223240,0xe72b,0x11d0,0xa9,0xb4,0x00,0xaa,0x00,0xc0,0x99,0x3e); +DEFINE_GUID(IID_IDirect3D7, 0xf5049e77,0x4861,0x11d2,0xa4,0x07,0x00,0xa0,0xc9,0x06,0x29,0xa8); + +DEFINE_GUID(IID_IDirect3DRampDevice, 0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DRGBDevice, 0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DHALDevice, 0x84E63dE0,0x46AA,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E); +DEFINE_GUID(IID_IDirect3DMMXDevice, 0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DRefDevice, 0x50936643,0x13e9,0x11d1,0x89,0xaa,0x00,0xa0,0xc9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DTnLHalDevice, 0xf5049e78,0x4861,0x11d2,0xa4,0x07,0x00,0xa0,0xc9,0x06,0x29,0xa8); +DEFINE_GUID(IID_IDirect3DNullDevice, 0x8767df22,0xbacc,0x11d1,0x89,0x69,0x00,0xa0,0xc9,0x06,0x29,0xa8); + +DEFINE_GUID(IID_IDirect3DDevice, 0x64108800,0x957d,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DDevice2, 0x93281501,0x8CF8,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DDevice3, 0xb0ab3b60,0x33d7,0x11d1,0xa9,0x81,0x00,0xc0,0x4f,0xd7,0xb1,0x74); +DEFINE_GUID(IID_IDirect3DDevice7, 0xf5049e79,0x4861,0x11d2,0xa4,0x07,0x00,0xa0,0xc9,0x06,0x29,0xa8); + +DEFINE_GUID(IID_IDirect3DTexture, 0x2CDCD9E0,0x25A0,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DTexture2, 0x93281502,0x8CF8,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29); + +DEFINE_GUID(IID_IDirect3DLight, 0x4417C142,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E); + +DEFINE_GUID(IID_IDirect3DMaterial, 0x4417C144,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E); +DEFINE_GUID(IID_IDirect3DMaterial2, 0x93281503,0x8CF8,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DMaterial3, 0xca9c46f4,0xd3c5,0x11d1,0xb7,0x5a,0x00,0x60,0x08,0x52,0xb3,0x12); + +DEFINE_GUID(IID_IDirect3DExecuteBuffer, 0x4417C145,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E); + +DEFINE_GUID(IID_IDirect3DViewport, 0x4417C146,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E); +DEFINE_GUID(IID_IDirect3DViewport2, 0x93281500,0x8CF8,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DViewport3, 0xb0ab3b61,0x33d7,0x11d1,0xa9,0x81,0x00,0xc0,0x4f,0xd7,0xb1,0x74); + +DEFINE_GUID(IID_IDirect3DVertexBuffer, 0x7a503555,0x4a83,0x11d1,0xa5,0xdb,0x00,0xa0,0xc9,0x03,0x67,0xf8); +DEFINE_GUID(IID_IDirect3DVertexBuffer7, 0xf5049e7d,0x4861,0x11d2,0xa4,0x07,0x00,0xa0,0xc9,0x06,0x29,0xa8); + + +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3D2 *LPDIRECT3D2; +typedef struct IDirect3D3 *LPDIRECT3D3; +typedef struct IDirect3D7 *LPDIRECT3D7; + +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; + +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; + +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; + +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; + +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; + +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; + +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; + /* ******************************************************************** Error Codes ******************************************************************** */ @@ -82,6 +151,7 @@ #define D3DERR_VIEWPORTHASNODEVICE MAKE_DDHRESULT(774) #define D3DERR_NOCURRENTVIEWPORT MAKE_DDHRESULT(775) #define D3DERR_INVALIDVERTEXFORMAT MAKE_DDHRESULT(2048) +#define D3DERR_COLORKEYATTACHED MAKE_DDHRESULT(2050) #define D3DERR_VERTEXBUFFEROPTIMIZED MAKE_DDHRESULT(2060) #define D3DERR_VBUF_CREATE_FAILED MAKE_DDHRESULT(2061) #define D3DERR_VERTEXBUFFERLOCKED MAKE_DDHRESULT(2062) @@ -125,4 +195,1334 @@ Types and structures ******************************************************************** */ typedef DWORD D3DVIEWPORTHANDLE, *LPD3DVIEWPORTHANDLE; + + +/********************************************************************** ******* + * IDirect3D interface + */ +#define INTERFACE IDirect3D +DECLARE_INTERFACE_(IDirect3D,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3D methods ***/ + STDMETHOD(Initialize)(THIS_ REFIID riid) PURE; + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *lplpDirect3DLight, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL *lplpDirect3DMaterial, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT *lplpD3DViewport, IUnknown *pUnkOuter) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3D methods ***/ +#define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3D_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D_AddRef(p) (p)->AddRef() +#define IDirect3D_Release(p) (p)->Release() +/*** IDirect3D methods ***/ +#define IDirect3D_Initialize(p,a) (p)->Initialize(a) +#define IDirect3D_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->FindDevice(a,b) #endif + + +/********************************************************************** ******* + * IDirect3D2 interface + */ +#define INTERFACE IDirect3D2 +DECLARE_INTERFACE_(IDirect3D2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3D2 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *lplpDirect3DLight, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL2 *lplpDirect3DMaterial2, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT2 *lplpD3DViewport2, IUnknown *pUnkOuter) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lpD3DFDR) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID rclsid, LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DDEVICE2 *lplpD3DDevice2) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3D2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3D2 methods ***/ +#define IDirect3D2_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3D2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D2_AddRef(p) (p)->AddRef() +#define IDirect3D2_Release(p) (p)->Release() +/*** IDirect3D2 methods ***/ +#define IDirect3D2_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#endif + + +/********************************************************************** ******* + * IDirect3D3 interface + */ +#define INTERFACE IDirect3D3 +DECLARE_INTERFACE_(IDirect3D3,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3D3 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPVOID lpUserArg) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT *lplpDirect3DLight, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL3 *lplpDirect3DMaterial3, IUnknown *pUnkOuter) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT3 *lplpD3DViewport3, IUnknown *pUnkOuter) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lpD3DFDR) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID rclsid,LPDIRECTDRAWSURFACE4 lpDDS, LPDIRECT3DDEVICE3 *lplpD3DDevice3,LPUNKNOWN lpUnk) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,LPDIRECT3DVERTEXBUFFER *lplpD3DVertBuf,DWORD dwFlags,LPUNKNOWN lpUnk) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID riidDevice,LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,LPVOID lpContext) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3D3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3D3 methods ***/ +#define IDirect3D3_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->lpVtbl->CreateDevice(p,a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +/*** IUnknown methods ***/ +#define IDirect3D3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D3_AddRef(p) (p)->AddRef() +#define IDirect3D3_Release(p) (p)->Release() +/*** IDirect3D3 methods ***/ +#define IDirect3D3_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->CreateDevice(a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->CreateVertexBuffer(a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif + +/********************************************************************** ******* + * IDirect3D7 interface + */ +#define INTERFACE IDirect3D7 +DECLARE_INTERFACE_(IDirect3D7,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3D7 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID rclsid,LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,LPDIRECT3DVERTEXBUFFER7 *lplpD3DVertBuf,DWORD dwFlags) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID riidDevice,LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,LPVOID lpContext) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3D7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D7_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3D3 methods ***/ +#define IDirect3D7_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +/*** IUnknown methods ***/ +#define IDirect3D7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D7_AddRef(p) (p)->AddRef() +#define IDirect3D7_Release(p) (p)->Release() +/*** IDirect3D3 methods ***/ +#define IDirect3D7_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->CreateVertexBuffer(a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif + + +/********************************************************************** ******* + * IDirect3DLight interface + */ +#define INTERFACE IDirect3DLight +DECLARE_INTERFACE_(IDirect3DLight,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DLight methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D) PURE; + STDMETHOD(SetLight)(THIS_ LPD3DLIGHT lpLight) PURE; + STDMETHOD(GetLight)(THIS_ LPD3DLIGHT lpLight) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DLight_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DLight_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DLight_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DLight methods ***/ +#define IDirect3DLight_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DLight_SetLight(p,a) (p)->lpVtbl->SetLight(p,a) +#define IDirect3DLight_GetLight(p,a) (p)->lpVtbl->GetLight(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DLight_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DLight_AddRef(p) (p)->AddRef() +#define IDirect3DLight_Release(p) (p)->Release() +/*** IDirect3DLight methods ***/ +#define IDirect3DLight_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DLight_SetLight(p,a) (p)->SetLight(a) +#define IDirect3DLight_GetLight(p,a) (p)->GetLight(a) +#endif + + +/********************************************************************** ******* + * IDirect3DMaterial interface + */ +#define INTERFACE IDirect3DMaterial +DECLARE_INTERFACE_(IDirect3DMaterial,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DMaterial methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D) PURE; + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DMATERIALHANDLE lpHandle) PURE; + STDMETHOD(Reserve)(THIS) PURE; + STDMETHOD(Unreserve)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DMaterial methods ***/ +#define IDirect3DMaterial_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DMaterial_Reserve(p) (p)->lpVtbl->Reserve(p) +#define IDirect3DMaterial_Unreserve(p) (p)->lpVtbl->Unreserve(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial_Release(p) (p)->Release() +/*** IDirect3DMaterial methods ***/ +#define IDirect3DMaterial_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DMaterial_Reserve(p) (p)->Reserve() +#define IDirect3DMaterial_Unreserve(p) (p)->Unreserve() +#endif + + +/********************************************************************** ******* + * IDirect3DMaterial2 interface + */ +#define INTERFACE IDirect3DMaterial2 +DECLARE_INTERFACE_(IDirect3DMaterial2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DMaterial2 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2 lpDirect3DDevice2, LPD3DMATERIALHANDLE lpHandle) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DMaterial2 methods ***/ +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial2_Release(p) (p)->Release() +/*** IDirect3DMaterial2 methods ***/ +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif + + +/********************************************************************** ******* + * IDirect3DMaterial3 interface + */ +#define INTERFACE IDirect3DMaterial3 +DECLARE_INTERFACE_(IDirect3DMaterial3,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DMaterial3 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL lpMat) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE3 lpDirect3DDevice3, LPD3DMATERIALHANDLE lpHandle) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DMaterial3 methods ***/ +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial3_Release(p) (p)->Release() +/*** IDirect3DMaterial3 methods ***/ +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif + + +/********************************************************************** ******* + * IDirect3DTexture interface + */ +#define INTERFACE IDirect3DTexture +DECLARE_INTERFACE_(IDirect3DTexture,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DTexture methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE lpDirect3DDevice, LPDIRECTDRAWSURFACE lpDDSurface) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DTEXTUREHANDLE lpHandle) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD dwStart, DWORD dwCount) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE lpD3DTexture) PURE; + STDMETHOD(Unload)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DTexture methods ***/ +#define IDirect3DTexture_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirect3DTexture_GetHandle(p,a,b,c) (p)->lpVtbl->GetHandle(p,a,b,c) +#define IDirect3DTexture_PaletteChanged(p,a,b,c) (p)->lpVtbl->PaletteChanged(p,a,b,c) +#define IDirect3DTexture_Load(p,a,b,c) (p)->lpVtbl->Load(p,a,b,c) +#define IDirect3DTexture_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture_AddRef(p) (p)->AddRef() +#define IDirect3DTexture_Release(p) (p)->Release() +/*** IDirect3DTexture methods ***/ +#define IDirect3DTexture_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirect3DTexture_GetHandle(p,a,b,c) (p)->GetHandle(a,b,c) +#define IDirect3DTexture_PaletteChanged(p,a,b,c) (p)->PaletteChanged(a,b,c) +#define IDirect3DTexture_Load(p,a,b,c) (p)->Load(a,b,c) +#define IDirect3DTexture_Unload(p,a,b,c) (p)->Unload(a,b,c) +#endif + + +/********************************************************************** ******* + * IDirect3DTexture2 interface + */ +#define INTERFACE IDirect3DTexture2 +DECLARE_INTERFACE_(IDirect3DTexture2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DTexture2 methods ***/ + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2 lpDirect3DDevice2, LPD3DTEXTUREHANDLE lpHandle) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD dwStart, DWORD dwCount) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE2 lpD3DTexture2) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DTexture2 methods ***/ +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->lpVtbl->PaletteChanged(p,a,b) +#define IDirect3DTexture2_Load(p,a) (p)->lpVtbl->Load(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture2_AddRef(p) (p)->AddRef() +#define IDirect3DTexture2_Release(p) (p)->Release() +/*** IDirect3DTexture2 methods ***/ +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->PaletteChanged(a,b) +#define IDirect3DTexture2_Load(p,a) (p)->Load(a) +#endif + + +/********************************************************************** ******* + * IDirect3DViewport interface + */ +#define INTERFACE IDirect3DViewport +DECLARE_INTERFACE_(IDirect3DViewport,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD dwVertexCount, LPD3DTRANSFORMDATA lpData, DWORD dwFlags, LPDWORD lpOffScreen) PURE; + STDMETHOD(LightElements)(THIS_ DWORD dwElementCount, LPD3DLIGHTDATA lpData) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE hMat) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE lphMat, LPBOOL lpValid) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *lplpDDSurface, LPBOOL lpValid) PURE; + STDMETHOD(Clear)(THIS_ DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight, LPDIRECT3DLIGHT *lplpDirect3DLight, DWORD dwFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DViewport methods ***/ +#define IDirect3DViewport_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport_AddRef(p) (p)->AddRef() +#define IDirect3DViewport_Release(p) (p)->Release() +/*** IDirect3DViewport methods ***/ +#define IDirect3DViewport_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#endif + + +/********************************************************************** ******* + * IDirect3DViewport2 interface + */ +#define INTERFACE IDirect3DViewport2 +DECLARE_INTERFACE_(IDirect3DViewport2,IDirect3DViewport) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD dwVertexCount, LPD3DTRANSFORMDATA lpData, DWORD dwFlags, LPDWORD lpOffScreen) PURE; + STDMETHOD(LightElements)(THIS_ DWORD dwElementCount, LPD3DLIGHTDATA lpData) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE hMat) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE lphMat, LPBOOL lpValid) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *lplpDDSurface, LPBOOL lpValid) PURE; + STDMETHOD(Clear)(THIS_ DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight, LPDIRECT3DLIGHT *lplpDirect3DLight, DWORD dwFlags) PURE; + /*** IDirect3DViewport2 methods ***/ + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2 lpData) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2 lpData) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3Viewport methods ***/ +#define IDirect3DViewport2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +/*** IDirect3DViewport2 methods ***/ +#define IDirect3DViewport2_GetViewport2(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->lpVtbl->SetViewport2(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport2_AddRef(p) (p)->AddRef() +#define IDirect3DViewport2_Release(p) (p)->Release() +/*** IDirect3Viewport methods ***/ +#define IDirect3DViewport2_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +/*** IDirect3DViewport2 methods ***/ +#define IDirect3DViewport2_GetViewport2(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->SetViewport2(a) +#endif + +/********************************************************************** ******* + * IDirect3DViewport3 interface + */ +#define INTERFACE IDirect3DViewport3 +DECLARE_INTERFACE_(IDirect3DViewport3,IDirect3DViewport2) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT lpData) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD dwVertexCount, LPD3DTRANSFORMDATA lpData, DWORD dwFlags, LPDWORD lpOffScreen) PURE; + STDMETHOD(LightElements)(THIS_ DWORD dwElementCount, LPD3DLIGHTDATA lpData) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE hMat) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE lphMat, LPBOOL lpValid) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *lplpDDSurface, LPBOOL lpValid) PURE; + STDMETHOD(Clear)(THIS_ DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT lpDirect3DLight, LPDIRECT3DLIGHT *lplpDirect3DLight, DWORD dwFlags) PURE; + /*** IDirect3DViewport2 methods ***/ + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2 lpData) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2 lpData) PURE; + /*** IDirect3DViewport3 methods ***/ + STDMETHOD(SetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4 lpDDS) PURE; + STDMETHOD(GetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4 *lplpDDS,LPBOOL lpValid) PURE; + STDMETHOD(Clear2)(THIS_ DWORD dwCount,LPD3DRECT lpRects,DWORD dwFlags,DWORD dwColor,D3DVALUE dvZ,DWORD dwStencil) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3Viewport methods ***/ +#define IDirect3DViewport3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +/*** IDirect3DViewport2 methods ***/ +#define IDirect3DViewport3_GetViewport3(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport3_SetViewport3(p,a) (p)->lpVtbl->SetViewport2(p,a) +/*** IDirect3DViewport3 methods ***/ +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->lpVtbl->SetBackgroundDepth2(p,a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->lpVtbl->GetBackgroundDepth2(p,a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->lpVtbl->Clear2(p,a,b,c,d,e,f) +#else +/*** IUnknown methods ***/ +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport3_AddRef(p) (p)->AddRef() +#define IDirect3DViewport3_Release(p) (p)->Release() +/*** IDirect3Viewport methods ***/ +#define IDirect3DViewport3_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +/*** IDirect3DViewport2 methods ***/ +#define IDirect3DViewport3_GetViewport3(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport3_SetViewport3(p,a) (p)->SetViewport2(a) +/*** IDirect3DViewport3 methods ***/ +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->SetBackgroundDepth2(a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->GetBackgroundDepth2(a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->Clear2(a,b,c,d,e,f) +#endif + + + +/********************************************************************** ******* + * IDirect3DExecuteBuffer interface + */ +#define INTERFACE IDirect3DExecuteBuffer +DECLARE_INTERFACE_(IDirect3DExecuteBuffer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DExecuteBuffer methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DEXECUTEBUFFERDESC lpDesc) PURE; + STDMETHOD(Lock)(THIS_ LPD3DEXECUTEBUFFERDESC lpDesc) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(SetExecuteData)(THIS_ LPD3DEXECUTEDATA lpData) PURE; + STDMETHOD(GetExecuteData)(THIS_ LPD3DEXECUTEDATA lpData) PURE; + STDMETHOD(Validate)(THIS_ LPDWORD lpdwOffset, LPD3DVALIDATECALLBACK lpFunc, LPVOID lpUserArg, DWORD dwReserved) PURE; + STDMETHOD(Optimize)(THIS_ DWORD dwDummy) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DExecuteBuffer_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DExecuteBuffer methods ***/ +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->lpVtbl->Lock(p,a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->lpVtbl->SetExecuteData(p,a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->lpVtbl->GetExecuteData(p,a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->lpVtbl->Validate(p,a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->lpVtbl->Optimize(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->AddRef() +#define IDirect3DExecuteBuffer_Release(p) (p)->Release() +/*** IDirect3DExecuteBuffer methods ***/ +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->Lock(a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->Unlock() +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->SetExecuteData(a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->GetExecuteData(a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->Validate(a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->Optimize(a) +#endif + + +/********************************************************************** ******* + * IDirect3DDevice interface + */ +#define INTERFACE IDirect3DDevice +DECLARE_INTERFACE_(IDirect3DDevice,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DDevice methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D lpDirect3D, LPGUID lpGUID, LPD3DDEVICEDESC lpD3DDVDesc) PURE; + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE lpD3Dtex1, LPDIRECT3DTEXTURE lpD3DTex2) PURE; + STDMETHOD(CreateExecuteBuffer)(THIS_ LPD3DEXECUTEBUFFERDESC lpDesc, LPDIRECT3DEXECUTEBUFFER *lplpDirect3DExecuteBuffer, IUnknown *pUnkOuter) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS lpD3DStats) PURE; + STDMETHOD(Execute)(THIS_ LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT lpDirect3DViewport) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT lpDirect3DViewport) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT lpDirect3DViewport, LPDIRECT3DVIEWPORT *lplpDirect3DViewport, DWORD dwFlags) PURE; + STDMETHOD(Pick)(THIS_ LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer, LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags, LPD3DRECT lpRect) PURE; + STDMETHOD(GetPickRecords)(THIS_ LPDWORD lpCount, LPD3DPICKRECORD lpD3DPickRec) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc, LPVOID lpArg) PURE; + STDMETHOD(CreateMatrix)(THIS_ LPD3DMATRIXHANDLE lpD3DMatHandle) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DMATRIXHANDLE D3DMatHandle, LPD3DMATRIX lpD3DMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DMATRIXHANDLE D3DMatHandle, LPD3DMATRIX lpD3DMatrix) PURE; + STDMETHOD(DeleteMatrix)(THIS_ D3DMATRIXHANDLE D3DMatHandle) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D *lplpDirect3D) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DDevice methods ***/ +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->lpVtbl->CreateExecuteBuffer(p,a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->lpVtbl->Execute(p,a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->lpVtbl->Pick(p,a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->lpVtbl->GetPickRecords(p,a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->lpVtbl->CreateMatrix(p,a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->lpVtbl->SetMatrix(p,a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->lpVtbl->GetMatrix(p,a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->lpVtbl->DeleteMatrix(p,a) +#define IDirect3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice_AddRef(p) (p)->AddRef() +#define IDirect3DDevice_Release(p) (p)->Release() +/*** IDirect3DDevice methods ***/ +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->CreateExecuteBuffer(a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->Execute(a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->Pick(a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->GetPickRecords(a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->CreateMatrix(a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->SetMatrix(a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->GetMatrix(a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->DeleteMatrix(a) +#define IDirect3DDevice_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice_EndScene(p) (p)->EndScene() +#define IDirect3DDevice_GetDirect3D(p,a) (p)->GetDirect3D(a) +#endif + + +/********************************************************************** ******* + * IDirect3DDevice2 interface + */ +#define INTERFACE IDirect3DDevice2 +DECLARE_INTERFACE_(IDirect3DDevice2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DDevice2 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE2 lpD3DTex1, LPDIRECT3DTEXTURE2 lpD3DTex2) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS lpD3DStats) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT2 lpDirect3DViewport2) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT2 lpDirect3DViewport2) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT2 lpDirect3DViewport2, LPDIRECT3DVIEWPORT2 *lplpDirect3DViewport2, DWORD dwFlags) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc, LPVOID lpArg) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D2 *lplpDirect3D2) PURE; + /*** DrawPrimitive API ***/ + STDMETHOD(SetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2 lpDirect3DViewport2) PURE; + STDMETHOD(GetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2 *lplpDirect3DViewport2) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE lpNewRenderTarget, DWORD dwFlags) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE *lplpRenderTarget) PURE; + STDMETHOD(Begin)(THIS_ D3DPRIMITIVETYPE d3dpt,D3DVERTEXTYPE dwVertexTypeDesc,DWORD dwFlags) PURE; + STDMETHOD(BeginIndexed)(THIS_ D3DPRIMITIVETYPE d3dptPrimitiveType, D3DVERTEXTYPE d3dvtVertexType, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags) PURE; + STDMETHOD(Vertex)(THIS_ LPVOID lpVertexType) PURE; + STDMETHOD(Index)(THIS_ WORD wVertexIndex) PURE; + STDMETHOD(End)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState) PURE; + STDMETHOD(GetLightState)(THIS_ D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState) PURE; + STDMETHOD(SetLightState)(THIS_ D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE d3dptPrimitiveType, D3DVERTEXTYPE d3dvtVertexType, LPVOID lpvVertices, DWORD dwVertexCount, DWORD dwFlags) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE d3dptPrimitiveType, D3DVERTEXTYPE d3dvtVertexType, LPVOID lpvVertices, DWORD dwVertexCount, LPWORD dwIndices, DWORD dwIndexCount, DWORD dwFlags) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS lpD3DClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS lpD3DClipStatus) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DDevice2 methods ***/ +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice2_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice2_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice2_SetCurrentViewport(p,a) (p)->lpVtbl->SetCurrentViewport(p,a) +#define IDirect3DDevice2_GetCurrentViewport(p,a) (p)->lpVtbl->GetCurrentViewport(p,a) +#define IDirect3DDevice2_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice2_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice2_Begin(p,a,b,c) (p)->lpVtbl->Begin(p,a,b,c) +#define IDirect3DDevice2_BeginIndexed(p,a,b,c,d,e) (p)->lpVtbl->BeginIndexed(p,a,b,c,d,e) +#define IDirect3DDevice2_Vertex(p,a) (p)->lpVtbl->Vertex(p,a) +#define IDirect3DDevice2_Index(p,a) (p)->lpVtbl->Index(p,a) +#define IDirect3DDevice2_End(p,a) (p)->lpVtbl->End(p,a) +#define IDirect3DDevice2_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice2_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice2_GetLightState(p,a,b) (p)->lpVtbl->GetLightState(p,a,b) +#define IDirect3DDevice2_SetLightState(p,a,b) (p)->lpVtbl->SetLightState(p,a,b) +#define IDirect3DDevice2_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice2_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice2_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice2_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice2_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice2_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice2_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice2_AddRef(p) (p)->AddRef() +#define IDirect3DDevice2_Release(p) (p)->Release() +/*** IDirect3DDevice2 methods ***/ +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->BeginScene() [truncated at 1000 lines; 6665 more skipped]
19 years, 9 months
1
0
0
0
[navaraf] 14204: Forgot to add this file in revision 14203.
by navaraf@svn.reactos.com
Forgot to add this file in revision 14203. Added: trunk/reactos/lib/gdi32/objects/brush.c _____ Added: trunk/reactos/lib/gdi32/objects/brush.c --- trunk/reactos/lib/gdi32/objects/brush.c 2005-03-19 22:15:02 UTC (rev 14203) +++ trunk/reactos/lib/gdi32/objects/brush.c 2005-03-19 22:50:11 UTC (rev 14204) @@ -0,0 +1,127 @@ +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + +/* + * @implemented + */ +BOOL +STDCALL +FixBrushOrgEx( + HDC hDC, + INT nXOrg, + INT nYOrg, + LPPOINT lpPoint) +{ + return FALSE; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateDIBPatternBrush( + HGLOBAL hglbDIBPacked, + UINT fuColorSpec) +{ + PVOID lpPackedDIB; + HBRUSH hBrush = NULL; + PBITMAPINFO pConvertedInfo; + UINT ConvertedInfoSize; + + lpPackedDIB = GlobalLock(hglbDIBPacked); + if (lpPackedDIB == NULL) + return 0; + + pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, fuColorSpec, + &ConvertedInfoSize, TRUE); + if (pConvertedInfo) + { + hBrush = NtGdiCreateDIBBrush(pConvertedInfo, fuColorSpec, + ConvertedInfoSize, lpPackedDIB); + if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); + } + + GlobalUnlock(hglbDIBPacked); + + return hBrush; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateDIBPatternBrushPt( + CONST VOID *lpPackedDIB, + UINT fuColorSpec) +{ + HBRUSH hBrush = NULL; + PBITMAPINFO pConvertedInfo; + UINT ConvertedInfoSize; + + if (lpPackedDIB == NULL) + return 0; + + pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, fuColorSpec, + &ConvertedInfoSize, TRUE); + if (pConvertedInfo) + { + hBrush = NtGdiCreateDIBBrush(pConvertedInfo, fuColorSpec, + ConvertedInfoSize, lpPackedDIB); + if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); + } + + return hBrush; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateBrushIndirect( + CONST LOGBRUSH *LogBrush) +{ + HBRUSH hBrush; + + switch (LogBrush->lbStyle) + { + case BS_DIBPATTERN8X8: + case BS_DIBPATTERN: + hBrush = CreateDIBPatternBrush((HGLOBAL)LogBrush->lbHatch, + LogBrush->lbColor); + break; + + case BS_DIBPATTERNPT: + hBrush = CreateDIBPatternBrushPt((PVOID)LogBrush->lbHatch, + LogBrush->lbColor); + break; + + case BS_PATTERN: + case BS_PATTERN8X8: + hBrush = NtGdiCreatePatternBrush((HBITMAP)LogBrush->lbHatch); + break; + + case BS_SOLID: + hBrush = NtGdiCreateSolidBrush(LogBrush->lbColor); + break; + + case BS_HATCHED: + hBrush = NtGdiCreateHatchBrush(LogBrush->lbHatch, LogBrush->lbColor); + break; + + case BS_NULL: + hBrush = NtGdiGetStockObject(NULL_BRUSH); + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + hBrush = NULL; + break; + } + + return hBrush; +} +
19 years, 9 months
1
0
0
0
[navaraf] 14203: - Replace the ColorMap pointer in BITMAPOBJ with palette handle and
by navaraf@svn.reactos.com
- Replace the ColorMap pointer in BITMAPOBJ with palette handle and correctly free it when the bitmap is about to be destroyed. Also get rid of some palette leaks when DIBs were selected into device context. - Refine GDI32 -> Win32k interface for creating and managing brushes. Remove NtGdiCreateBrushIndirect, NtGdiCreateDIBPatternBrush, NtGdiCreateDIBPatternBrushPt and NtGdiFixBrushOrgEx syscalls and add NtGdiCreateDIBBrush. - Implement basic support for DIB pattern brushes. - Add user mode helper routine for "normalizing" BITMAPINFO structure. - Add definition for BITMAPV5HEADER. Modified: trunk/reactos/include/win32k/bitmaps.h Modified: trunk/reactos/include/win32k/brush.h Modified: trunk/reactos/lib/gdi32/gdi32.def Modified: trunk/reactos/lib/gdi32/include/precomp.h Modified: trunk/reactos/lib/gdi32/makefile Modified: trunk/reactos/lib/gdi32/misc/stubs.c Modified: trunk/reactos/lib/gdi32/objects/dc.c Added: trunk/reactos/lib/gdi32/objects/utils.c Modified: trunk/reactos/subsys/win32k/include/dib.h Modified: trunk/reactos/subsys/win32k/include/intgdi.h Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c Modified: trunk/reactos/subsys/win32k/objects/bitmaps.c Modified: trunk/reactos/subsys/win32k/objects/brush.c Modified: trunk/reactos/subsys/win32k/objects/color.c Modified: trunk/reactos/subsys/win32k/objects/dc.c Modified: trunk/reactos/subsys/win32k/objects/dib.c Modified: trunk/reactos/subsys/win32k/objects/stockobj.c Modified: trunk/reactos/tools/nci/w32ksvc.db Modified: trunk/reactos/w32api/include/wingdi.h _____ Modified: trunk/reactos/include/win32k/bitmaps.h --- trunk/reactos/include/win32k/bitmaps.h 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/include/win32k/bitmaps.h 2005-03-19 22:15:02 UTC (rev 14203) @@ -18,7 +18,7 @@ /* For device-independent bitmaps: */ DIBSECTION *dib; - RGBQUAD *ColorMap; + HPALETTE hDIBPalette; } BITMAPOBJ, *PBITMAPOBJ; #define BITMAPOBJ_IS_APIBITMAP 0x1 _____ Modified: trunk/reactos/include/win32k/brush.h --- trunk/reactos/include/win32k/brush.h 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/include/win32k/brush.h 2005-03-19 22:15:02 UTC (rev 14203) @@ -86,16 +86,13 @@ CONST LOGBRUSH *LogBrush); HBRUSH STDCALL -NtGdiCreateDIBPatternBrush( - HGLOBAL hDIBPacked, - UINT ColorSpec); +NtGdiCreateDIBBrush( + CONST BITMAPINFO *BitmapInfoAndData, + UINT ColorSpec, + UINT BitmapInfoSize, + CONST VOID *PackedDIB); HBRUSH STDCALL -NtGdiCreateDIBPatternBrushPt( - CONST VOID *PackedDIB, - UINT Usage); - -HBRUSH STDCALL NtGdiCreateHatchBrush( INT Style, COLORREF Color); _____ Modified: trunk/reactos/lib/gdi32/gdi32.def --- trunk/reactos/lib/gdi32/gdi32.def 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/gdi32.def 2005-03-19 22:15:02 UTC (rev 14203) @@ -49,7 +49,7 @@ CopyMetaFileW@8 CreateBitmap@20=NtGdiCreateBitmap@20 CreateBitmapIndirect@4=NtGdiCreateBitmapIndirect@4 -CreateBrushIndirect@4=NtGdiCreateBrushIndirect@4 +CreateBrushIndirect@4 CreateColorSpaceA@4 CreateColorSpaceW@4 CreateCompatibleBitmap@12=NtGdiCreateCompatibleBitmap@12 @@ -57,7 +57,7 @@ CreateDCA@16 CreateDCW@16 CreateDIBPatternBrush@8 -CreateDIBPatternBrushPt@8=NtGdiCreateDIBPatternBrushPt@8 +CreateDIBPatternBrushPt@8 CreateDIBSection@24=NtGdiCreateDIBSection@24 CreateDIBitmap@24=NtGdiCreateDIBitmap@24 CreateDiscardableBitmap@12=NtGdiCreateDiscardableBitmap@12 _____ Modified: trunk/reactos/lib/gdi32/include/precomp.h --- trunk/reactos/lib/gdi32/include/precomp.h 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/include/precomp.h 2005-03-19 22:15:02 UTC (rev 14203) @@ -53,7 +53,13 @@ BOOL FASTCALL NewTextMetricExW2A(NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw); /* == GDI HANDLES =========================================================== */ + BOOL GdiIsHandleValid(HGDIOBJ hGdiObj); BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData); +/* == BITMAP UTILITY FUNCTIONS ============================================== */ + +BOOL STDCALL CalculateColorTableSize(LPBITMAPINFOHEADER BitmapInfoHeader, UINT *ColorSpec, UINT *ColorTableSize); +LPBITMAPINFO STDCALL ConvertBitmapInfo(LPBITMAPINFO BitmapInfo, UINT ColorSpec, UINT *BitmapInfoSize, BOOL FollowedByData); + /* EOF */ _____ Modified: trunk/reactos/lib/gdi32/makefile --- trunk/reactos/lib/gdi32/makefile 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/makefile 2005-03-19 22:15:02 UTC (rev 14203) @@ -40,6 +40,8 @@ OBJECTS_OBJECTS = \ objects/bitblt.o \ + objects/utils.o \ + objects/brush.o \ objects/dc.o \ objects/font.o \ objects/linedda.o \ _____ Modified: trunk/reactos/lib/gdi32/misc/stubs.c --- trunk/reactos/lib/gdi32/misc/stubs.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/misc/stubs.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -84,22 +84,7 @@ return 0; } -/* - * @unimplemented - */ -HBRUSH -STDCALL -CreateDIBPatternBrush( - HGLOBAL a0, - UINT a1 - ) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */ _____ Modified: trunk/reactos/lib/gdi32/objects/dc.c --- trunk/reactos/lib/gdi32/objects/dc.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/objects/dc.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -290,26 +290,6 @@ /* * @implemented */ -BOOL -STDCALL -FixBrushOrgEx( - HDC hdc, - int nXOrg, - int nYOrg, - LPPOINT lppt - ) -{ - #if 0 - /* FIXME - Check if we're emulating win95, if so, forward to SetBrushOrgEx() */ - return SetBrushOrgEx(hdc, nXOrg, nYOrg, lppt); - #endif - - return FALSE; -} - -/* - * @implemented - */ COLORREF STDCALL GetDCBrushColor( _____ Added: trunk/reactos/lib/gdi32/objects/utils.c --- trunk/reactos/lib/gdi32/objects/utils.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/lib/gdi32/objects/utils.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -0,0 +1,333 @@ +#include "precomp.h" + +/** + * @name CalculateColorTableSize + * + * Internal routine to calculate the number of color table entries. + * + * @param BitmapInfoHeader + * Input bitmap information header, can be any version of + * BITMAPINFOHEADER or BITMAPCOREHEADER. + * + * @param ColorSpec + * Pointer to variable which specifiing the color mode (DIB_RGB_COLORS + * or DIB_RGB_COLORS). On successful return this value is normalized + * according to the bitmap info. + * + * @param ColorTableSize + * On successful return this variable is filled with number of + * entries in color table for the image with specified parameters. + * + * @return + * TRUE if the input values together form a valid image, FALSE otherwise. + */ + +BOOL STDCALL +CalculateColorTableSize( + LPBITMAPINFOHEADER BitmapInfoHeader, + UINT *ColorSpec, + UINT *ColorTableSize) +{ + WORD BitCount; + DWORD ClrUsed; + DWORD Compression; + + /* + * At first get some basic parameters from the passed BitmapInfoHeader + * structure. It can have one of the following formats: + * - BITMAPCOREHEADER (the oldest one with totally different layout + * from the others) + * - BITMAPINFOHEADER (the standard and most common header) + * - BITMAPV4HEADER (extension of BITMAPINFOHEADER) + * - BITMAPV5HEADER (extension of BITMAPV4HEADER) + */ + + if (BitmapInfoHeader->biSize == sizeof(BITMAPCOREHEADER)) + { + BitCount = ((LPBITMAPCOREHEADER)BitmapInfoHeader)->bcBitCount; + ClrUsed = 0; + Compression = BI_RGB; + } + else + { + BitCount = BitmapInfoHeader->biBitCount; + ClrUsed = BitmapInfoHeader->biClrUsed; + Compression = BitmapInfoHeader->biCompression; + } + + switch (Compression) + { + case BI_BITFIELDS: + if (*ColorSpec == DIB_PAL_COLORS) + *ColorSpec = DIB_RGB_COLORS; + + if (BitCount != 16 && BitCount != 32) + return FALSE; + + /* + * For BITMAPV4HEADER/BITMAPV5HEADER the masks are included in + * the structure itself (bV4RedMask, bV4GreenMask, and bV4BlueMask). + * For BITMAPINFOHEADER the color masks are stored in the palette. + */ + + if (BitmapInfoHeader->biSize > sizeof(BITMAPINFOHEADER)) + *ColorTableSize = 0; + else + *ColorTableSize = 3; + + return TRUE; + + case BI_RGB: + switch (BitCount) + { + case 1: + *ColorTableSize = ClrUsed ? min(ClrUsed, 2) : 2; + return TRUE; + + case 4: + *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16; + return TRUE; + + case 8: + *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256; + return TRUE; + + default: + if (*ColorSpec == DIB_PAL_COLORS) + *ColorSpec = DIB_RGB_COLORS; + if (BitCount != 16 && BitCount != 24 && BitCount != 32) + return FALSE; + *ColorTableSize = ClrUsed; + return TRUE; + } + + case BI_RLE4: + if (BitCount == 4) + { + *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16; + return TRUE; + } + return FALSE; + + case BI_RLE8: + if (BitCount == 8) + { + *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256; + return TRUE; + } + return FALSE; + + case BI_JPEG: + case BI_PNG: + *ColorTableSize = ClrUsed; + return TRUE; + + default: + return FALSE; + } +} + +/** + * @name ConvertBitmapInfo + * + * Internal routine to convert a user-passed BITMAPINFO structure into + * unified BITMAPINFO structure. + * + * @param BitmapInfo + * Input bitmap info, can be any version of BITMAPINFO or + * BITMAPCOREINFO. + * @param ColorSpec + * Specifies whether the bmiColors member of the BITMAPINFO structure + * contains a valid color table and, if so, whether the entries in + * this color table contain explicit red, green, blue (DIB_RGB_COLORS) + * values or palette indexes (DIB_PAL_COLORS). + * @param BitmapInfoSize + * On successful return contains the size of the returned BITMAPINFO + * structure. If FollowedByData is TRUE the size includes the number + * of bytes occupied by the image data. + * @param FollowedByData + * Specifies if the BITMAPINFO header is immediately followed + * by the actual bitmap data (eg. as passed to CreateDIBPatternBrush). + * + * @return + * Either the original BitmapInfo or newly allocated structure is + * returned. For the later case the caller is responsible for freeing the + * memory using RtlFreeHeap with the current process heap. + * + * @example + * PBITMAPINFO NewBitmapInfo; + * UINT NewBitmapInfoSize; + * + * NewBitmapInfo = ConvertBitmapInfo(OldBitmapInfo, DIB_RGB_COLORS, + * &NewBitmapInfoSize, FALSE); + * if (NewBitmapInfo) + * { + * <do something with the bitmap info> + * if (NewBitmapInfo != OldBitmapInfo) + * RtlFreeHeap(RtlGetProcessHeap(), 0, NewBitmapInfo); + * } + */ + +LPBITMAPINFO STDCALL +ConvertBitmapInfo( + LPBITMAPINFO BitmapInfo, + UINT ColorSpec, + UINT *BitmapInfoSize, + BOOL FollowedByData) +{ + LPBITMAPINFO NewBitmapInfo = BitmapInfo; + LPBITMAPCOREINFO CoreBitmapInfo = (LPBITMAPCOREINFO)BitmapInfo; + DWORD Size = 0; + ULONG DataSize = 0; + UINT PaletteEntryCount = 0; + + /* + * At first check if the passed BitmapInfo structure has valid size. It + * can have one of these headers: BITMAPCOREHEADER, BITMAPINFOHEADER, + * BITMAPV4HEADER or BITMAPV5HEADER (see CalculateColorTableSize for + * description). + */ + + if (BitmapInfo->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) && + (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER) || + BitmapInfo->bmiHeader.biSize > sizeof(BITMAPV5HEADER))) + { + return NULL; + } + + /* + * Now calculate the color table size. Also if the bitmap info contains + * invalid color information it's rejected here. + */ + + if (!CalculateColorTableSize(&BitmapInfo->bmiHeader, &ColorSpec, + &PaletteEntryCount)) + { + return NULL; + } + + /* + * Calculate the size of image data if applicable. We must be careful + * to do proper aligning on line ends. + */ + + if (FollowedByData) + { + if (BitmapInfo->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + DataSize = + CoreBitmapInfo->bmciHeader.bcHeight * + CoreBitmapInfo->bmciHeader.bcWidth * + CoreBitmapInfo->bmciHeader.bcBitCount; + DataSize = ((DataSize + 31) & ~31) / 8; + DataSize *= CoreBitmapInfo->bmciHeader.bcPlanes; + } + else + { + if (BitmapInfo->bmiHeader.biCompression == BI_RGB || + BitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) + { + DataSize = + abs(BitmapInfo->bmiHeader.biHeight) * + BitmapInfo->bmiHeader.biWidth * + BitmapInfo->bmiHeader.biBitCount; + DataSize = ((DataSize + 31) & ~31) / 8; + DataSize *= BitmapInfo->bmiHeader.biPlanes; + } + else + { + DataSize = BitmapInfo->bmiHeader.biSizeImage; + } + } + } + + /* + * If BitmapInfo was originally BITMAPCOREINFO then we need to convert + * it to the standard BITMAPINFO layout. + */ + + if (BitmapInfo->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + Size = sizeof(BITMAPINFOHEADER); + if (ColorSpec == DIB_RGB_COLORS) + Size += PaletteEntryCount * sizeof(RGBQUAD); + else + Size += PaletteEntryCount * sizeof(USHORT); + Size += DataSize; + + NewBitmapInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size); + if (NewBitmapInfo == NULL) + { + return NULL; + } + + NewBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + NewBitmapInfo->bmiHeader.biWidth = CoreBitmapInfo->bmciHeader.bcWidth; + NewBitmapInfo->bmiHeader.biHeight = CoreBitmapInfo->bmciHeader.bcHeight; + NewBitmapInfo->bmiHeader.biPlanes = CoreBitmapInfo->bmciHeader.bcPlanes; + NewBitmapInfo->bmiHeader.biBitCount = CoreBitmapInfo->bmciHeader.bcBitCount; + NewBitmapInfo->bmiHeader.biCompression = BI_RGB; + NewBitmapInfo->bmiHeader.biSizeImage = 0; + NewBitmapInfo->bmiHeader.biXPelsPerMeter = 0; + NewBitmapInfo->bmiHeader.biYPelsPerMeter = 0; + NewBitmapInfo->bmiHeader.biClrUsed = 0; + NewBitmapInfo->bmiHeader.biClrImportant = 0; + + if (PaletteEntryCount != 0) + { + if (ColorSpec == DIB_RGB_COLORS) + { + ULONG Index; + + for (Index = 0; Index < PaletteEntryCount; Index++) + { + NewBitmapInfo->bmiColors[Index].rgbRed = + CoreBitmapInfo->bmciColors[Index].rgbtRed; + NewBitmapInfo->bmiColors[Index].rgbGreen = + CoreBitmapInfo->bmciColors[Index].rgbtGreen; + NewBitmapInfo->bmiColors[Index].rgbBlue = + CoreBitmapInfo->bmciColors[Index].rgbtBlue; + NewBitmapInfo->bmiColors[Index].rgbReserved = 0; + } + } + else + { + RtlCopyMemory(NewBitmapInfo->bmiColors, + CoreBitmapInfo->bmciColors, + PaletteEntryCount * sizeof(USHORT)); + } + } + + if (FollowedByData) + { + ULONG_PTR NewDataPtr, OldDataPtr; + + if (ColorSpec == DIB_RGB_COLORS) + { + NewDataPtr = (ULONG_PTR)(NewBitmapInfo->bmiColors + + PaletteEntryCount); + OldDataPtr = (ULONG_PTR)(CoreBitmapInfo->bmciColors + + PaletteEntryCount); + } + else + { + NewDataPtr = (ULONG_PTR)(NewBitmapInfo->bmiColors) + + PaletteEntryCount * sizeof(USHORT); + OldDataPtr = (ULONG_PTR)(CoreBitmapInfo->bmciColors) + + PaletteEntryCount * sizeof(USHORT); + } + + RtlCopyMemory((PVOID)NewDataPtr, (PVOID)OldDataPtr, DataSize); + } + } + + Size = NewBitmapInfo->bmiHeader.biSize; + if (ColorSpec == DIB_RGB_COLORS) + Size += PaletteEntryCount * sizeof(RGBQUAD); + else + Size += PaletteEntryCount * sizeof(USHORT); + Size += DataSize; + *BitmapInfoSize = Size; + + return NewBitmapInfo; +} _____ Modified: trunk/reactos/subsys/win32k/include/dib.h --- trunk/reactos/subsys/win32k/include/dib.h 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/subsys/win32k/include/dib.h 2005-03-19 22:15:02 UTC (rev 14203) @@ -17,6 +17,6 @@ DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi); HPALETTE FASTCALL -BuildDIBPalette (PBITMAPINFO bmi, PINT paletteType); +BuildDIBPalette (CONST BITMAPINFO *bmi, PINT paletteType); #endif /* _WIN32K_DIB_H */ _____ Modified: trunk/reactos/subsys/win32k/include/intgdi.h --- trunk/reactos/subsys/win32k/include/intgdi.h 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/subsys/win32k/include/intgdi.h 2005-03-19 22:15:02 UTC (rev 14203) @@ -9,17 +9,30 @@ VOID FASTCALL IntGdiInitBrushInstance(GDIBRUSHINST *BrushInst, PGDIBRUSHOBJ BrushObj, XLATEOBJ *XlateObj); -HBRUSH FASTCALL -IntGdiCreateBrushIndirect(PLOGBRUSH lb); -HBRUSH FASTCALL -IntGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked, - UINT ColorSpec); +HBRUSH STDCALL +IntGdiCreateDIBBrush( + CONST BITMAPINFO *BitmapInfo, + UINT ColorSpec, + UINT BitmapInfoSize, + CONST VOID *PackedDIB); -HBRUSH FASTCALL -IntGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB, - UINT Usage); +HBRUSH STDCALL +IntGdiCreateHatchBrush( + INT Style, + COLORREF Color); +HBRUSH STDCALL +IntGdiCreatePatternBrush( + HBITMAP hBitmap); + +HBRUSH STDCALL +IntGdiCreateSolidBrush( + COLORREF Color); + +HBRUSH STDCALL +IntGdiCreateNullBrush(VOID); + BOOL FASTCALL IntPatBlt( PDC dc, _____ Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c --- trunk/reactos/subsys/win32k/ntuser/winsta.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/subsys/win32k/ntuser/winsta.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -309,6 +309,13 @@ { NTSTATUS Status; + if (WindowStation == NULL) + { +// DPRINT1("Invalid window station handle\n"); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return STATUS_INVALID_HANDLE; + } + Status = ObReferenceObjectByHandle( WindowStation, DesiredAccess, _____ Modified: trunk/reactos/subsys/win32k/objects/bitmaps.c --- trunk/reactos/subsys/win32k/objects/bitmaps.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/subsys/win32k/objects/bitmaps.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -463,6 +463,10 @@ { EngFreeUserMem(pBmp->SurfObj.pvBits); } + if (pBmp->hDIBPalette) + { + NtGdiDeleteObject(pBmp->hDIBPalette); + } } return TRUE; _____ Modified: trunk/reactos/subsys/win32k/objects/brush.c --- trunk/reactos/subsys/win32k/objects/brush.c 2005-03-19 21:48:33 UTC (rev 14202) +++ trunk/reactos/subsys/win32k/objects/brush.c 2005-03-19 22:15:02 UTC (rev 14203) @@ -72,6 +72,10 @@ if (Dc->w.bitsPerPixel != 1) Result = IntEngCreateSrcMonoXlate(Dc->w.hPalette, Dc->w.textColor, Dc->w.backgroundColor); } + else if (BrushObj->flAttrs & GDIBRUSH_IS_DIB) + { + Result = IntEngCreateXlate(0, 0, Dc->w.hPalette, Pattern->hDIBPalette); + } BITMAPOBJ_UnlockBitmap(BrushObj->hbmPattern); *Failed = FALSE; @@ -97,83 +101,332 @@ BrushInst->XlateObject = XlateObj; } -HBRUSH FASTCALL -IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush) +/** + * @name CalculateColorTableSize + * + * Internal routine to calculate the number of color table entries. + * + * @param BitmapInfoHeader + * Input bitmap information header, can be any version of + * BITMAPINFOHEADER or BITMAPCOREHEADER. + * + * @param ColorSpec + * Pointer to variable which specifiing the color mode (DIB_RGB_COLORS + * or DIB_RGB_COLORS). On successful return this value is normalized + * according to the bitmap info. + * + * @param ColorTableSize + * On successful return this variable is filled with number of + * entries in color table for the image with specified parameters. + * + * @return + * TRUE if the input values together form a valid image, FALSE otherwise. + */ + +BOOL STDCALL +CalculateColorTableSize( + CONST BITMAPINFOHEADER *BitmapInfoHeader, + UINT *ColorSpec, + UINT *ColorTableSize) { - PGDIBRUSHOBJ BrushObject; - HBRUSH hBrush; - HBITMAP hPattern = 0; - - switch (LogBrush->lbStyle) + WORD BitCount; + DWORD ClrUsed; + DWORD Compression; + + /* + * At first get some basic parameters from the passed BitmapInfoHeader + * structure. It can have one of the following formats: + * - BITMAPCOREHEADER (the oldest one with totally different layout + * from the others) + * - BITMAPINFOHEADER (the standard and most common header) + * - BITMAPV4HEADER (extension of BITMAPINFOHEADER) + * - BITMAPV5HEADER (extension of BITMAPV4HEADER) + */ + + if (BitmapInfoHeader->biSize == sizeof(BITMAPCOREHEADER)) { - case BS_HATCHED: - hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[LogBrush->lbHatch]); - if (hPattern == NULL) + BitCount = ((LPBITMAPCOREHEADER)BitmapInfoHeader)->bcBitCount; + ClrUsed = 0; + Compression = BI_RGB; + } + else + { + BitCount = BitmapInfoHeader->biBitCount; + ClrUsed = BitmapInfoHeader->biClrUsed; + Compression = BitmapInfoHeader->biCompression; + } + + switch (Compression) + { + case BI_BITFIELDS: + if (*ColorSpec == DIB_PAL_COLORS) + *ColorSpec = DIB_RGB_COLORS; + + if (BitCount != 16 && BitCount != 32) + return FALSE; + + /* + * For BITMAPV4HEADER/BITMAPV5HEADER the masks are included in + * the structure itself (bV4RedMask, bV4GreenMask, and bV4BlueMask). + * For BITMAPINFOHEADER the color masks are stored in the palette. + */ + + if (BitmapInfoHeader->biSize > sizeof(BITMAPINFOHEADER)) + *ColorTableSize = 0; + else + *ColorTableSize = 3; + + return TRUE; + + case BI_RGB: + switch (BitCount) { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return NULL; + case 1: + *ColorTableSize = ClrUsed ? min(ClrUsed, 2) : 2; + return TRUE; + + case 4: + *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16; + return TRUE; + + case 8: + *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256; + return TRUE; + + default: + if (*ColorSpec == DIB_PAL_COLORS) + *ColorSpec = DIB_RGB_COLORS; + if (BitCount != 16 && BitCount != 24 && BitCount != 32) + return FALSE; + *ColorTableSize = ClrUsed; + return TRUE; } - break; - - case BS_PATTERN: - hPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch); - if (hPattern == NULL) + + case BI_RLE4: + if (BitCount == 4) { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return NULL; + *ColorTableSize = ClrUsed ? min(ClrUsed, 16) : 16; + return TRUE; } - break; + return FALSE; + + case BI_RLE8: + if (BitCount == 8) + { + *ColorTableSize = ClrUsed ? min(ClrUsed, 256) : 256; + return TRUE; + } + return FALSE; + + case BI_JPEG: + case BI_PNG: + *ColorTableSize = ClrUsed; + return TRUE; + + default: + return FALSE; } +} + +HBRUSH STDCALL +IntGdiCreateDIBBrush( + CONST BITMAPINFO *BitmapInfo, + UINT ColorSpec, + UINT BitmapInfoSize, + CONST VOID *PackedDIB) +{ + HBRUSH hBrush; + PGDIBRUSHOBJ BrushObject; + HBITMAP hPattern; + ULONG_PTR DataPtr; + UINT PaletteEntryCount; + PBITMAPOBJ BitmapObject; + UINT PaletteType; + + if (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return NULL; + } + + if (!CalculateColorTableSize(&BitmapInfo->bmiHeader, &ColorSpec, + &PaletteEntryCount)) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return NULL; + } + + DataPtr = (ULONG_PTR)BitmapInfo + BitmapInfo->bmiHeader.biSize; + if (ColorSpec == DIB_RGB_COLORS) + DataPtr += PaletteEntryCount * sizeof(RGBQUAD); + else + DataPtr += PaletteEntryCount * sizeof(USHORT); + + hPattern = NtGdiCreateBitmap(BitmapInfo->bmiHeader.biWidth, + BitmapInfo->bmiHeader.biHeight, + BitmapInfo->bmiHeader.biPlanes, + BitmapInfo->bmiHeader.biBitCount, + (PVOID)DataPtr); + if (hPattern == NULL) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + BitmapObject = BITMAPOBJ_LockBitmap(hPattern); + ASSERT(BitmapObject != NULL); + BitmapObject->hDIBPalette = BuildDIBPalette(BitmapInfo, &PaletteType); + BITMAPOBJ_UnlockBitmap(hPattern); + + hBrush = BRUSHOBJ_AllocBrush(); + if (hBrush == NULL) + { + NtGdiDeleteObject(hPattern); + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + BrushObject = BRUSHOBJ_LockBrush(hBrush); + ASSERT(BrushObject != NULL); + + BrushObject->flAttrs |= GDIBRUSH_IS_BITMAP | GDIBRUSH_IS_DIB; + BrushObject->hbmPattern = hPattern; + /* FIXME: Fill in the rest of fields!!! */ + + GDIOBJ_SetOwnership(hPattern, NULL); + + BRUSHOBJ_UnlockBrush(hBrush); + return hBrush; +} + +HBRUSH STDCALL +IntGdiCreateHatchBrush( + INT Style, + COLORREF Color) +{ + HBRUSH hBrush; + PGDIBRUSHOBJ BrushObject; + HBITMAP hPattern; + + if (Style < 0 || Style >= NB_HATCH_STYLES) + { + return 0; + } + + hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[Style]); + if (hPattern == NULL) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + hBrush = BRUSHOBJ_AllocBrush(); if (hBrush == NULL) { + NtGdiDeleteObject(hPattern); SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return NULL; } BrushObject = BRUSHOBJ_LockBrush(hBrush); - if(BrushObject != NULL) + ASSERT(BrushObject != NULL); + + BrushObject->flAttrs |= GDIBRUSH_IS_HATCH; + BrushObject->hbmPattern = hPattern; + BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF; + + GDIOBJ_SetOwnership(hPattern, NULL); + + BRUSHOBJ_UnlockBrush(hBrush); + + return hBrush; +} + +HBRUSH STDCALL +IntGdiCreatePatternBrush( + HBITMAP hBitmap) +{ + HBRUSH hBrush; + PGDIBRUSHOBJ BrushObject; + HBITMAP hPattern; + + hPattern = BITMAPOBJ_CopyBitmap(hBitmap); + if (hPattern == NULL) { - switch (LogBrush->lbStyle) - { - case BS_NULL: - BrushObject->flAttrs |= GDIBRUSH_IS_NULL; - break; + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + hBrush = BRUSHOBJ_AllocBrush(); + if (hBrush == NULL) + { + NtGdiDeleteObject(hPattern); + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } - case BS_SOLID: - BrushObject->flAttrs |= GDIBRUSH_IS_SOLID; - BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF; - /* FIXME: Fill in the rest of fields!!! */ - break; + BrushObject = BRUSHOBJ_LockBrush(hBrush); + ASSERT(BrushObject != NULL); - case BS_HATCHED: - BrushObject->flAttrs |= GDIBRUSH_IS_HATCH; - BrushObject->hbmPattern = hPattern; - BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF; - break; + BrushObject->flAttrs |= GDIBRUSH_IS_BITMAP; + BrushObject->hbmPattern = hPattern; + /* FIXME: Fill in the rest of fields!!! */ - case BS_PATTERN: - BrushObject->flAttrs |= GDIBRUSH_IS_BITMAP; - BrushObject->hbmPattern = hPattern; - /* FIXME: Fill in the rest of fields!!! */ - break; + GDIOBJ_SetOwnership(hPattern, NULL); - default: - DPRINT1("Brush Style: %d\n", LogBrush->lbStyle); - UNIMPLEMENTED; - break; - } - - BRUSHOBJ_UnlockBrush(hBrush); + BRUSHOBJ_UnlockBrush(hBrush); + + return hBrush; +} + +HBRUSH STDCALL +IntGdiCreateSolidBrush( + COLORREF Color) +{ + HBRUSH hBrush; + PGDIBRUSHOBJ BrushObject; + + hBrush = BRUSHOBJ_AllocBrush(); + if (hBrush == NULL) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; } - if (hPattern != 0) - GDIOBJ_SetOwnership(hPattern, NULL); + BrushObject = BRUSHOBJ_LockBrush(hBrush); + ASSERT(BrushObject != NULL); + + BrushObject->flAttrs |= GDIBRUSH_IS_SOLID; + BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF; + /* FIXME: Fill in the rest of fields!!! */ + + BRUSHOBJ_UnlockBrush(hBrush); return hBrush; } +HBRUSH STDCALL +IntGdiCreateNullBrush(VOID) +{ + HBRUSH hBrush; + PGDIBRUSHOBJ BrushObject; + + hBrush = BRUSHOBJ_AllocBrush(); + if (hBrush == NULL) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + BrushObject = BRUSHOBJ_LockBrush(hBrush); + ASSERT(BrushObject != NULL); + BrushObject->flAttrs |= GDIBRUSH_IS_NULL; + BRUSHOBJ_UnlockBrush(hBrush); + + return hBrush; +} + BOOL FASTCALL IntPatBlt( PDC dc, @@ -299,82 +552,60 @@ /* PUBLIC FUNCTIONS ***********************************************************/ HBRUSH STDCALL -NtGdiCreateBrushIndirect(CONST LOGBRUSH *LogBrush) +NtGdiCreateDIBBrush( + CONST BITMAPINFO *BitmapInfoAndData, + UINT ColorSpec, + UINT BitmapInfoSize, + CONST VOID *PackedDIB) { - LOGBRUSH SafeLogBrush; + BITMAPINFO *SafeBitmapInfoAndData; NTSTATUS Status; - - Status = MmCopyFromCaller(&SafeLogBrush, LogBrush, sizeof(LOGBRUSH)); + HBRUSH hBrush; + + SafeBitmapInfoAndData = EngAllocMem(0, BitmapInfoSize, 0); + if (SafeBitmapInfoAndData == NULL) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + + Status = MmCopyFromCaller(SafeBitmapInfoAndData, BitmapInfoAndData, [truncated at 1000 lines; 398 more skipped]
19 years, 9 months
1
0
0
0
[navaraf] 14202: Specify correct buffer size in GetPrivateProfileStringW calls.
by navaraf@svn.reactos.com
Specify correct buffer size in GetPrivateProfileStringW calls. Modified: trunk/reactos/lib/winmm/driver.c Modified: trunk/reactos/lib/winmm/mci.c _____ Modified: trunk/reactos/lib/winmm/driver.c --- trunk/reactos/lib/winmm/driver.c 2005-03-19 20:39:25 UTC (rev 14201) +++ trunk/reactos/lib/winmm/driver.c 2005-03-19 21:48:33 UTC (rev 14202) @@ -226,7 +226,7 @@ if (lRet == ERROR_SUCCESS) return TRUE; /* default to system.ini if we can't find it in the registry, * to support native installations where system.ini is still used */ - return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz, wszSystemIni); + return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz / sizeof(WCHAR), wszSystemIni); } /*********************************************************************** *** _____ Modified: trunk/reactos/lib/winmm/mci.c --- trunk/reactos/lib/winmm/mci.c 2005-03-19 20:39:25 UTC (rev 14201) +++ trunk/reactos/lib/winmm/mci.c 2005-03-19 21:48:33 UTC (rev 14202) @@ -1840,7 +1840,7 @@ RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0); RegCloseKey( hKey ); } - if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, sizeof(buf), wszSystemIni)) + if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, sizeof(buf) / sizeof(buf[0]), wszSystemIni)) for (s = buf; *s; s += strlenW(s) + 1) cnt++; } } else { @@ -1892,7 +1892,7 @@ RegCloseKey( hKey ); } if (!s) { - if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, sizeof(buf), wszSystemIni)) { + if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, sizeof(buf) / sizeof(buf[0]), wszSystemIni)) { for (p = buf; *p; p += strlenW(p) + 1, cnt++) { TRACE("%ld: %s\n", cnt, debugstr_w(p)); if (cnt == lpParms->dwNumber - 1) {
19 years, 9 months
1
0
0
0
[greatlrd] 14201: add more code.
by greatlrd@svn.reactos.com
add more code. start create a protype of hal, that can be use also for software emulation mode. Modified: trunk/reactos/lib/ddraw/Makefile Modified: trunk/reactos/lib/ddraw/ddraw.c Added: trunk/reactos/lib/ddraw/ddraw_hal.c Added: trunk/reactos/lib/ddraw/ddraw_private.h Added: trunk/reactos/lib/ddraw/ddraw_user.c Modified: trunk/reactos/lib/ddraw/rosddraw.h _____ Modified: trunk/reactos/lib/ddraw/Makefile --- trunk/reactos/lib/ddraw/Makefile 2005-03-19 20:29:19 UTC (rev 14200) +++ trunk/reactos/lib/ddraw/Makefile 2005-03-19 20:39:25 UTC (rev 14201) @@ -10,15 +10,18 @@ TARGET_CFLAGS = -D__USE_W32API -I$(PATH_TO_TOP)/include/wine # require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall -Werror +TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall TARGET_SDKLIBS = ntdll.a gdi32.a dxguid.a ole32.a user32.a d3d8thk.a TARGET_OBJECTS = \ regsvr.o \ - ddraw.o + ddraw.o \ + ddraw_hal.o + + DEP_OBJECTS = $(TARGET_OBJECTS) include $(PATH_TO_TOP)/rules.mak _____ Modified: trunk/reactos/lib/ddraw/ddraw.c --- trunk/reactos/lib/ddraw/ddraw.c 2005-03-19 20:29:19 UTC (rev 14200) +++ trunk/reactos/lib/ddraw/ddraw.c 2005-03-19 20:39:25 UTC (rev 14201) @@ -12,14 +12,14 @@ #include <windows.h> #include "ddraw.h" #include "rosddraw.h" - - -HRESULT WINAPI DirectDrawCreate(LPGUID lpGUID, LPVOID* lplpDD, LPUNKNOWN pUnkOuter) + +HRESULT WINAPI DirectDrawCreate(LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter) { if (pUnkOuter==NULL) return DDERR_INVALIDPARAMS; return DDRAW_Create(lpGUID, (LPVOID*) lplpDD, pUnkOuter, &IID_IDirectDraw, FALSE); } + HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter) { if (pUnkOuter==NULL) return DDERR_INVALIDPARAMS; @@ -29,7 +29,7 @@ } HRESULT WINAPI DirectDrawEnumerateA( - DWORD *lpCallback, + LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ) { @@ -38,7 +38,7 @@ HRESULT WINAPI DirectDrawEnumerateW( - DWORD *lpCallback, + LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ) { @@ -46,7 +46,7 @@ } HRESULT WINAPI DirectDrawEnumerateExA( - DWORD lpCallback, + LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags ) @@ -55,18 +55,18 @@ } HRESULT WINAPI DirectDrawEnumerateExW( - DWORD lpCallback, + LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags ) { return DD_OK; } - + HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, - DWORD FAR* lplpDDClipper, - IUnknown FAR* pUnkOuter + LPDIRECTDRAWCLIPPER* lplpDDClipper, + LPUNKNOWN pUnkOuter ) { return DD_OK; @@ -75,8 +75,12 @@ HRESULT DDRAW_Create( LPGUID lpGUID, LPVOID *lplpDD, LPUNKNOWN pUnkOuter, REFIID iid, BOOL ex) { - HDC desktop; + + + + //HDC desktop; + /* BOOL ex == TRUE it is DirectDrawCreateEx call here. */ /* TODO: _____ Added: trunk/reactos/lib/ddraw/ddraw_hal.c --- trunk/reactos/lib/ddraw/ddraw_hal.c 2005-03-19 20:29:19 UTC (rev 14200) +++ trunk/reactos/lib/ddraw/ddraw_hal.c 2005-03-19 20:39:25 UTC (rev 14201) @@ -0,0 +1,330 @@ +/* DirectDraw HAL driver + * + * Copyright 2001 TransGaming Technologies Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + +#include <windows.h> +#include "ddraw.h" +#include "rosddraw.h" +#include "ddraw_private.h" + +static IDirectDraw7Vtbl HAL_DirectDraw_VTable; + + +HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex) +{ + //This->local.lpGbl = &dd_gbl; + + This->final_release = HAL_DirectDraw_final_release; + This->set_exclusive_mode = HAL_DirectDrawSet_exclusive_mode; + // This->create_palette = HAL_DirectDrawPalette_Create; + + This->create_primary = HAL_DirectDraw_create_primary; + This->create_backbuffer = HAL_DirectDraw_create_backbuffer; + This->create_texture = HAL_DirectDraw_create_texture; + + ICOM_INIT_INTERFACE(This, IDirectDraw7, HAL_DirectDraw_VTable); + return S_OK; +} + +void HAL_DirectDraw_final_release(IDirectDrawImpl *This) +{ + +} + +HRESULT HAL_DirectDrawSet_exclusive_mode(IDirectDrawImpl *This, DWORD dwEnterExcl) +{ + return DDERR_UNSUPPORTED; +} + + +HRESULT HAL_DirectDraw_create_primary(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD, LPDIRECTDRAWSURFACE7* ppSurf, + IUnknown* pUnkOuter) + +{ + return DDERR_UNSUPPORTED; + } + +HRESULT HAL_DirectDraw_create_backbuffer(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, + IUnknown* pUnkOuter, + IDirectDrawSurfaceImpl* primary) +{ + return DDERR_UNSUPPORTED; + } + +HRESULT HAL_DirectDraw_create_texture(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, + LPUNKNOWN pOuter, + DWORD dwMipMapLevel) +{ + return DDERR_UNSUPPORTED; + } + + + + + + +/* basic funtion for the com object */ +HRESULT WINAPI HAL_DirectDraw_QueryInterface(LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj) +{ + return DDERR_UNSUPPORTED; + } + +ULONG WINAPI HAL_DirectDraw_AddRef(LPDIRECTDRAW7 iface) +{ + IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + //TRACE("(%p)->() incrementing from %lu.\n", This, ref -1); + + return ref; +} + +ULONG WINAPI HAL_DirectDraw_Release(LPDIRECTDRAW7 iface) +{ + IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + if (ref == 0) + { + if (This->final_release != NULL) + This->final_release(This); + + /* We free the private. This is an artifact of the fact that I don't + * have the destructors set up correctly. */ + if (This->private != (This+1)) + HeapFree(GetProcessHeap(), 0, This->private); + + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +HRESULT WINAPI HAL_DirectDraw_Compact(LPDIRECTDRAW7 iface) +{ + + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface, DWORD dwFlags, + LPDIRECTDRAWCLIPPER *ppClipper, IUnknown *pUnkOuter) +{ + return DDERR_UNSUPPORTED; +} +HRESULT WINAPI HAL_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags, + LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE* ppPalette,LPUNKNOWN pUnknown) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, + LPDIRECTDRAWSURFACE7 *ppSurf,IUnknown *pUnkOuter) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src, + LPDIRECTDRAWSURFACE7* dst) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags, + LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags, + LPDDSURFACEDESC2 lpDDSD2, LPVOID context, + LPDDENUMSURFACESCALLBACK7 callback) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface) +{ +return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps, + LPDDCAPS pHELCaps) +{ +return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD) +{ + return DDERR_UNSUPPORTED; +} + + +HRESULT WINAPI HAL_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD pCodes) +{ + + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface, + LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface) +{ + + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL status) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID lpGuid) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd, + DWORD cooplevel) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth, + DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) +{ + + return DDERR_UNSUPPORTED; +} + + +HRESULT WINAPI HAL_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags, + HANDLE h) +{ + + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, + LPDWORD total, LPDWORD free) + +{ + + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc, + LPDIRECTDRAWSURFACE7 *lpDDS) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface, + LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes, + DWORD dwNumModes, DWORD dwFlags) +{ + return DDERR_UNSUPPORTED; +} + +HRESULT WINAPI HAL_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b) +{ + return DDERR_UNSUPPORTED; +} + +/* End com interface */ + + + + +HRESULT WINAPI HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface, + IUnknown* pUnkOuter, BOOL ex) +{ + + IDirectDrawImpl* This; + *pIface = ICOM_INTERFACE(This, IDirectDraw7); + + return DD_OK; +} + +static IDirectDraw7Vtbl HAL_DirectDraw_VTable = +{ + HAL_DirectDraw_QueryInterface, + HAL_DirectDraw_AddRef, + HAL_DirectDraw_Release, + HAL_DirectDraw_Compact, + HAL_DirectDraw_CreateClipper, + HAL_DirectDraw_CreatePalette, + HAL_DirectDraw_CreateSurface, + HAL_DirectDraw_DuplicateSurface, + HAL_DirectDraw_EnumDisplayModes, + HAL_DirectDraw_EnumSurfaces, + HAL_DirectDraw_FlipToGDISurface, + HAL_DirectDraw_GetCaps, + HAL_DirectDraw_GetDisplayMode, + HAL_DirectDraw_GetFourCCCodes, + HAL_DirectDraw_GetGDISurface, + HAL_DirectDraw_GetMonitorFrequency, + HAL_DirectDraw_GetScanLine, + HAL_DirectDraw_GetVerticalBlankStatus, + HAL_DirectDraw_Initialize, + HAL_DirectDraw_RestoreDisplayMode, + HAL_DirectDraw_SetCooperativeLevel, + HAL_DirectDraw_SetDisplayMode, + HAL_DirectDraw_WaitForVerticalBlank, + HAL_DirectDraw_GetAvailableVidMem, + HAL_DirectDraw_GetSurfaceFromDC, + HAL_DirectDraw_RestoreAllSurfaces, + HAL_DirectDraw_TestCooperativeLevel, + HAL_DirectDraw_GetDeviceIdentifier, + HAL_DirectDraw_StartModeTest, + HAL_DirectDraw_EvaluateMode +}; _____ Added: trunk/reactos/lib/ddraw/ddraw_private.h --- trunk/reactos/lib/ddraw/ddraw_private.h 2005-03-19 20:29:19 UTC (rev 14200) +++ trunk/reactos/lib/ddraw/ddraw_private.h 2005-03-19 20:39:25 UTC (rev 14201) @@ -0,0 +1,481 @@ +/* + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef _DDCOMIMPL_H_ +#define _DDCOMIMPL_H_ + +#include <stddef.h> + +/* Generates the name for a vtable pointer for a given interface. */ +/* The canonical name for a single interface is "lpVtbl". */ +#define ICOM_VFIELD_MULTI_NAME2(iface) ITF_##iface +#define ICOM_VFIELD_MULTI_NAME(iface) ICOM_VFIELD_MULTI_NAME2(iface) + +/* Declares a vtable pointer field in an implementation. */ +#define ICOM_VFIELD_MULTI(iface) \ + iface ICOM_VFIELD_MULTI_NAME(iface) + +/* Returns the offset of a vtable pointer within an implementation object. */ +#define ICOM_VFIELD_OFFSET(impltype, iface) \ + offsetof(impltype, ICOM_VFIELD_MULTI_NAME(iface)) + +/* Given an interface pointer, returns the implementation pointer. */ +#define ICOM_OBJECT(impltype, ifacename, ifaceptr) \ + (impltype*)((ifaceptr) == NULL ? NULL \ + : (char*)(ifaceptr) - ICOM_VFIELD_OFFSET(impltype,ifacename)) + +#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \ + impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr) + +/* Given an object and interface name, returns a pointer to that interface. */ +#define ICOM_INTERFACE(implobj, iface) \ + (&((implobj)->ICOM_VFIELD_MULTI_NAME(iface))) + +#define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \ + do { \ + (implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \ + } while (0) + +#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \ + ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto) + +#endif /* _DDCOMIMPL_H_ */ + +#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H +#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H + +/* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */ + +#include <stdarg.h> +#include <stdio.h> + +#include "windef.h" +#include "winbase.h" +#include "wtypes.h" +#include "wingdi.h" +#include "winuser.h" +#include "ddraw.h" +#include "d3d.h" +#include "ddrawi.h" + +/* XXX Put this somewhere proper. */ +#define DD_STRUCT_INIT(x) \ + do { \ + memset((x), 0, sizeof(*(x))); \ + (x)->dwSize = sizeof(*x); \ + } while (0) + +#define DD_STRUCT_COPY_BYSIZE(to,from) \ + do { \ + DWORD __size = (to)->dwSize; \ + DWORD __copysize = __size; \ + DWORD __resetsize = __size; \ + if (__resetsize > sizeof(*to)) \ + __resetsize = sizeof(*to); \ + memset(to,0,__resetsize); \ + if ((from)->dwSize < __size) \ + __copysize = (from)->dwSize; \ + memcpy(to,from,__copysize); \ + (to)->dwSize = __size;/*restore size*/ \ + } while (0) + +#define MAKE_FOURCC(a,b,c,d) ((a << 0) | (b << 8) | (c << 16) | (d << 24)) + +/********************************************************************** ******* + * IDirectDraw implementation structure + */ + +typedef struct IDirectDrawImpl IDirectDrawImpl; +typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl; +typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl; +typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl; +typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl; + +typedef void (*pixel_convert_func)(void *src, void *dst, DWORD width, + DWORD height, LONG pitch, + IDirectDrawPaletteImpl *palette); + +typedef void (*palette_convert_func)(LPPALETTEENTRY palent, + void *screen_palette, DWORD start, + DWORD count); + +struct IDirectDrawImpl +{ + ICOM_VFIELD_MULTI(IDirectDraw7); + ICOM_VFIELD_MULTI(IDirectDraw4); + ICOM_VFIELD_MULTI(IDirectDraw2); + ICOM_VFIELD_MULTI(IDirectDraw); + // ICOM_VFIELD_MULTI(IDirect3D7); + // ICOM_VFIELD_MULTI(IDirect3D3); + // ICOM_VFIELD_MULTI(IDirect3D2); + // ICOM_VFIELD_MULTI(IDirect3D); + + DWORD ref; + + /* TRUE if created via DirectDrawCreateEx or CoCreateInstance, + * FALSE if created via DirectDrawCreate. */ + BOOL ex; + + /* Linked list of surfaces, joined by next_ddraw in IDirectSurfaceImpl. */ + IDirectDrawSurfaceImpl* surfaces; + /* Linked list of palettes, joined by next_ddraw. */ + IDirectDrawPaletteImpl* palettes; + /* Linked list of clippers, joined by next_ddraw. */ + IDirectDrawClipperImpl* clippers; + + IDirectDrawSurfaceImpl* primary_surface; + + DDRAWI_DIRECTDRAW_LCL local; + DDCAPS caps; + + HWND window; + DWORD cooperative_level; + WNDPROC original_wndproc; + + DWORD width, height; + LONG pitch; + DDPIXELFORMAT pixelformat; + DWORD cur_scanline; + + /* Should each of these go into some structure? */ + DWORD orig_width, orig_height; + LONG orig_pitch; + DDPIXELFORMAT orig_pixelformat; + + /* Called when the refcount goes to 0. */ + void (*final_release)(IDirectDrawImpl *This); + + HRESULT (*set_exclusive_mode)(IDirectDrawImpl *This, DWORD dwExcl); + + HRESULT (*create_palette)(IDirectDrawImpl* This, DWORD dwFlags, + LPDIRECTDRAWPALETTE* ppPalette, + LPUNKNOWN pUnkOuter); + + /* Surface creation functions. For all of these, pOuter == NULL. */ + + /* Do not create any backbuffers or the flipping chain. */ + HRESULT (*create_primary)(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter); + + /* Primary may be NULL if we are creating an unattached backbuffer. */ + HRESULT (*create_backbuffer)(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, + LPUNKNOWN pOuter, + IDirectDrawSurfaceImpl* primary); + + /* shiny happy offscreenplain surfaces */ + HRESULT (*create_offscreen)(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, + LPUNKNOWN pOuter); + + /* dwMipMapLevel is specified as per OpenGL. (i.e. 0 is base) */ + HRESULT (*create_texture)(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter, + DWORD dwMipMapLevel); + + HRESULT (*create_zbuffer)(IDirectDrawImpl* This, + const DDSURFACEDESC2* pDDSD, + LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter); + + LPVOID private; + + /* Everything below here is still questionable. */ + + DDPIXELFORMAT screen_pixelformat; + + int pixmap_depth; + // pixel_convert_func pixel_convert; + // palette_convert_func palette_convert; + + /* Use to fool some too strict games */ + INT32 (*allocate_memory)(IDirectDrawImpl *This, DWORD mem); + void (*free_memory)(IDirectDrawImpl *This, DWORD mem); + DWORD total_vidmem, available_vidmem; + + /* IDirect3D fields */ + LPVOID d3d_private; + + /* Used as a callback function to create a texture */ + HRESULT (*d3d_create_texture)(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main); + + /* Used as a callback for Devices to tell to the D3D object it's been created */ + HRESULT (*d3d_added_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device); + HRESULT (*d3d_removed_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device); + + /* This is needed for delayed texture creation and Z buffer blits */ + IDirect3DDeviceImpl *current_device; + + /* This is for the fake mainWindow */ + ATOM winclass; + PAINTSTRUCT ps; + BOOL paintable; +}; + +/********************************************************************** ******* + * IDirectDrawPalette implementation structure + */ +struct IDirectDrawPaletteImpl +{ + /* IUnknown fields */ + ICOM_VFIELD_MULTI(IDirectDrawPalette); + DWORD ref; + + DDRAWI_DDRAWPALETTE_LCL local; + DDRAWI_DDRAWPALETTE_GBL global; + + /* IDirectDrawPalette fields */ + HPALETTE hpal; + WORD palVersion, palNumEntries; /* LOGPALETTE */ + PALETTEENTRY palents[256]; + /* This is to store the palette in 'screen format' */ + int screen_palents[256]; + + VOID (*final_release)(IDirectDrawPaletteImpl* This); + + IDirectDrawImpl* ddraw_owner; + IDirectDrawPaletteImpl* prev_ddraw; + IDirectDrawPaletteImpl* next_ddraw; + + LPVOID private; +}; + +/********************************************************************** ******* + * IDirectDrawClipper implementation structure + */ +struct IDirectDrawClipperImpl +{ + /* IUnknown fields */ + ICOM_VFIELD_MULTI(IDirectDrawClipper); + DWORD ref; + + /* IDirectDrawClipper fields */ + HWND hWnd; + + IDirectDrawImpl* ddraw_owner; + IDirectDrawClipperImpl* prev_ddraw; + IDirectDrawClipperImpl* next_ddraw; +}; + +/********************************************************************** ******* + * IDirectDrawSurface implementation structure + */ + +struct IDirectDrawSurfaceImpl +{ + /* IUnknown fields */ + ICOM_VFIELD_MULTI(IDirectDrawSurface7); + ICOM_VFIELD_MULTI(IDirectDrawSurface3); + ICOM_VFIELD_MULTI(IDirectDrawGammaControl); + //ICOM_VFIELD_MULTI(IDirect3DTexture2); + //ICOM_VFIELD_MULTI(IDirect3DTexture); + DWORD ref; + + struct IDirectDrawSurfaceImpl* attached; /* attached surfaces */ + + struct IDirectDrawSurfaceImpl* next_ddraw; /* ddraw surface chain */ + struct IDirectDrawSurfaceImpl* prev_ddraw; + struct IDirectDrawSurfaceImpl* next_attached; /* attached surface chain */ + struct IDirectDrawSurfaceImpl* prev_attached; + + IDirectDrawImpl* ddraw_owner; + IDirectDrawSurfaceImpl* surface_owner; + + IDirectDrawPaletteImpl* palette; /* strong ref */ + IDirectDrawClipperImpl* clipper; /* strong ref */ + + DDRAWI_DDRAWSURFACE_LCL local; + DDRAWI_DDRAWSURFACE_MORE more; + /* FIXME: since Flip should swap the GBL structures, they should + * probably not be embedded into the IDirectDrawSurfaceImpl structure... */ + LPDDRAWI_DDRAWSURFACE_GBL_MORE gmore; + DDRAWI_DDRAWSURFACE_GBL global; + DDRAWI_DDRAWSURFACE_GBL_MORE global_more; + + DDSURFACEDESC2 surface_desc; + + HDC hDC; + RECT lastlockrect; + DWORD lastlocktype; + BOOL dc_in_use; + BOOL locked; + + HRESULT (*duplicate_surface)(IDirectDrawSurfaceImpl* src, + LPDIRECTDRAWSURFACE7* dst); + void (*final_release)(IDirectDrawSurfaceImpl *This); + HRESULT (*late_allocate)(IDirectDrawSurfaceImpl *This); + BOOL (*attach)(IDirectDrawSurfaceImpl *This, IDirectDrawSurfaceImpl *to); + BOOL (*detach)(IDirectDrawSurfaceImpl *This); + void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags); + void (*unlock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect); + void (*lose_surface)(IDirectDrawSurfaceImpl* This); + BOOL (*flip_data)(IDirectDrawSurfaceImpl* front, + IDirectDrawSurfaceImpl* back, + DWORD dwFlags); + void (*flip_update)(IDirectDrawSurfaceImpl* front, DWORD dwFlags); + HRESULT (*get_dc)(IDirectDrawSurfaceImpl* This, HDC* phDC); + HRESULT (*release_dc)(IDirectDrawSurfaceImpl* This, HDC hDC); + void (*set_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal); + void (*update_palette)(IDirectDrawSurfaceImpl* This, IDirectDrawPaletteImpl* pal, + DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent); + HWND (*get_display_window)(IDirectDrawSurfaceImpl *This); + HRESULT (*get_gamma_ramp)(IDirectDrawSurfaceImpl *This, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp); + HRESULT (*set_gamma_ramp)(IDirectDrawSurfaceImpl *This, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp); + + struct PrivateData* private_data; + + DWORD max_lod; + DWORD priority; + + BOOL lost; + + DWORD uniqueness_value; + + LPVOID private; + + /* Everything below here is dodgy. */ + /* For Direct3D use */ + LPVOID aux_ctx, aux_data; + void (*aux_release)(LPVOID ctx, LPVOID data); + BOOL (*aux_flip)(LPVOID ctx, LPVOID data); + void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect); + HRESULT (*aux_blt)(struct IDirectDrawSurfaceImpl *This, LPRECT rdst, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx); + HRESULT (*aux_bltfast)(struct IDirectDrawSurfaceImpl *This, DWORD dstx, DWORD dsty, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD trans); + HRESULT (*aux_setcolorkey_cb)(struct IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ); + /* This is to get the D3DDevice object associated to this surface */ + struct IDirect3DDeviceImpl *d3ddevice; + /* This is for texture */ + IDirectDrawSurfaceImpl *mip_main; + int mipmap_level; + LPVOID tex_private; + void (*lock_update_prev)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags); + void (*unlock_update_prev)(IDirectDrawSurfaceImpl* This, LPCRECT pRect); + BOOLEAN (*get_dirty_status)(IDirectDrawSurfaceImpl* This, LPCRECT pRect); +}; + +/********************************************************************** ******* + * Driver initialisation functions. + */ +BOOL DDRAW_HAL_Init(HINSTANCE, DWORD, LPVOID); +BOOL DDRAW_User_Init(HINSTANCE, DWORD, LPVOID); + +typedef struct { + const DDDEVICEIDENTIFIER2* info; + int preference; /* how good we are. dga might get 100, xlib 50*/ + HRESULT (*create)(const GUID*, LPDIRECTDRAW7*, LPUNKNOWN, BOOL ex); + + /* For IDirectDraw7::Initialize. */ + HRESULT (*init)(IDirectDrawImpl *, const GUID*); +} ddraw_driver; + +void DDRAW_register_driver(const ddraw_driver*); + +const ddraw_driver* DDRAW_FindDriver(const GUID* guid); + +/********************************************************************** ******** + * Random utilities + */ + +/* Get DDSCAPS of surface (shortcutmacro) */ +#define SDDSCAPS(iface) ((iface)->s.surface_desc.ddsCaps.dwCaps) +/* Get the number of bytes per pixel for a given surface */ +#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.u1.dwRGBBitCount+7)/8)) +#define GET_BPP(desc) PFGET_BPP(desc.u4.ddpfPixelFormat) + +LONG DDRAW_width_bpp_to_pitch(DWORD width, DWORD bpp); + +typedef struct { + unsigned short bpp,depth; + unsigned int rmask,gmask,bmask; +} ConvertMode; + +typedef struct { + void (*pixel_convert)(void *src, void *dst, DWORD width, DWORD height, LONG pitch, IDirectDrawPaletteImpl* palette); + void (*palette_convert)(LPPALETTEENTRY palent, void *screen_palette, DWORD start, DWORD count); +} ConvertFuncs; + +typedef struct { + ConvertMode screen, dest; + ConvertFuncs funcs; +} Convert; + +extern Convert ModeEmulations[8]; +extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw); +extern BOOL opengl_initialized; +extern BOOL s3tc_initialized; + +typedef void (*FUNC_FETCH_2D_TEXEL_RGBA_DXT1)(int srcRowStride, const BYTE *pixdata, int i, int j, void *texel); +typedef void (*FUNC_FETCH_2D_TEXEL_RGBA_DXT3)(int srcRowStride, const BYTE *pixdata, int i, int j, void *texel); +typedef void (*FUNC_FETCH_2D_TEXEL_RGBA_DXT5)(int srcRowStride, const BYTE *pixdata, int i, int j, void *texel); + +extern FUNC_FETCH_2D_TEXEL_RGBA_DXT1 fetch_2d_texel_rgba_dxt1; +extern FUNC_FETCH_2D_TEXEL_RGBA_DXT3 fetch_2d_texel_rgba_dxt3; +extern FUNC_FETCH_2D_TEXEL_RGBA_DXT5 fetch_2d_texel_rgba_dxt5; + +/********************************************************************** ******** + * Structure conversion (for thunks) + */ +void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS* pIn, DDSCAPS2* pOut); +void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2* pIn, + DDDEVICEIDENTIFIER* pOut); + +/********************************************************************** ******** + * Debugging / Flags output functions + */ +extern void DDRAW_dump_DDBLTFX(DWORD flagmask); +extern void DDRAW_dump_DDBLTFAST(DWORD flagmask); +extern void DDRAW_dump_DDBLT(DWORD flagmask); +extern void DDRAW_dump_DDSCAPS(const DDSCAPS *in); +extern void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in); +extern void DDRAW_dump_pixelformat_flag(DWORD flagmask); +extern void DDRAW_dump_paletteformat(DWORD dwFlags); +extern void DDRAW_dump_pixelformat(const DDPIXELFORMAT *in); +extern void DDRAW_dump_colorkeyflag(DWORD ck); +extern void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd); +extern void DDRAW_dump_cooperativelevel(DWORD cooplevel); +extern void DDRAW_dump_lockflag(DWORD lockflag); +extern void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *in); +extern void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps); +extern void DDRAW_dump_surface_to_disk(IDirectDrawSurfaceImpl *surface, FILE *f, int scale) ; + +/* Used for generic dumping */ +typedef struct +{ + DWORD val; + const char* name; +} flag_info; + +#define FE(x) { x, #x } + +typedef struct +{ + DWORD val; + const char* name; + void (*func)(const void *); + ptrdiff_t offset; +} member_info; + +#define DDRAW_dump_flags(flags,names,num_names) DDRAW_dump_flags_(flags, names, num_names, 1) +#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) } + +extern void DDRAW_dump_flags_(DWORD flags, const flag_info* names, size_t num_names, int newline); +extern void DDRAW_dump_members(DWORD flags, const void* data, const member_info* mems, size_t num_mems); + +#endif /* __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H */ _____ Added: trunk/reactos/lib/ddraw/ddraw_user.c --- trunk/reactos/lib/ddraw/ddraw_user.c 2005-03-19 20:29:19 UTC (rev 14200) +++ trunk/reactos/lib/ddraw/ddraw_user.c 2005-03-19 20:39:25 UTC (rev 14201) @@ -0,0 +1,330 @@ +/* DirectDraw HAL driver + * + * Copyright 2001 TransGaming Technologies Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + +#include <windows.h> +#include "ddraw.h" +#include "rosddraw.h" +#include "ddraw_private.h" + +static IDirectDraw7Vtbl MAIN_DirectDraw_VTable; + + +HRESULT MAIN_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex) +{ + //This->local.lpGbl = &dd_gbl; + + This->final_release = MAIN_DirectDraw_final_release; + This->set_exclusive_mode = MAIN_DirectDrawSet_exclusive_mode; + // This->create_palette = MAIN_DirectDrawPalette_Create; + + This->create_primary = MAIN_DirectDraw_create_primary; + This->create_backbuffer = MAIN_DirectDraw_create_backbuffer; + This->create_texture = MAIN_DirectDraw_create_texture; + + ICOM_INIT_INTERFACE(This, IDirectDraw7, MAIN_DirectDraw_VTable); + return S_OK; +} + +void MAIN_DirectDraw_final_release(IDirectDrawImpl *This) +{ + +} + +HRESULT MAIN_DirectDrawSet_exclusive_mode(IDirectDrawImpl *This, DWORD dwEnterExcl) +{ + return DDERR_UNSUPPORTED; +} + + +HRESULT MAIN_DirectDraw_create_primary(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD, LPDIRECTDRAWSURFACE7* ppSurf, + IUnknown* pUnkOuter) + +{ + return DDERR_UNSUPPORTED; + } + [truncated at 1000 lines; 392 more skipped]
19 years, 9 months
1
0
0
0
[ion] 14200: Oops
by ion@svn.reactos.com
Oops Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-03-19 20:26:46 UTC (rev 14199) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-03-19 20:29:19 UTC (rev 14200) @@ -66,6 +66,6 @@ /* * */ -#define MM_STACK_SIZE (12*4096) +#define MM_STACK_SIZE (3*4096) #endif /* INCLUDE_INTERNAL_NTOSKRNL_H */
19 years, 9 months
1
0
0
0
[ion] 14199: Correct NtW32call to call correct kernel function, add placeholder for SEH, implement KeUserModeCallback (right now a copy of the old code). Part I of an incomplete W32Callback rewrite, just to set up the groundwork to make testing easier. Might look ugly/messy now but it'll be clean soon
by ion@svn.reactos.com
Correct NtW32call to call correct kernel function, add placeholder for SEH, implement KeUserModeCallback (right now a copy of the old code). Part I of an incomplete W32Callback rewrite, just to set up the groundwork to make testing easier. Might look ugly/messy now but it'll be clean soon Modified: trunk/reactos/ntoskrnl/Makefile Modified: trunk/reactos/ntoskrnl/include/internal/i386/fpu.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Added: trunk/reactos/ntoskrnl/ke/i386/usercall.S Deleted: trunk/reactos/ntoskrnl/ke/i386/usercall.c Added: trunk/reactos/ntoskrnl/ke/usercall.c Modified: trunk/reactos/ntoskrnl/ldr/sysdll.c Deleted: trunk/reactos/ntoskrnl/ps/w32call.c Modified: trunk/reactos/ntoskrnl/ps/win32.c _____ Modified: trunk/reactos/ntoskrnl/Makefile --- trunk/reactos/ntoskrnl/Makefile 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/Makefile 2005-03-19 20:26:46 UTC (rev 14199) @@ -111,6 +111,7 @@ ke/sem.o \ ke/spinlock.o \ ke/timer.o \ + ke/usercall.o \ ke/wait.o # Memory Manager (Mm) @@ -230,8 +231,7 @@ ps/security.o \ ps/suspend.o \ ps/thread.o \ - ps/win32.o \ - ps/w32call.o + ps/win32.o # Executive Subsystem (Ex) OBJECTS_EX = \ _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/fpu.h --- trunk/reactos/ntoskrnl/include/internal/i386/fpu.h 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/include/internal/i386/fpu.h 2005-03-19 20:26:46 UTC (rev 14199) @@ -20,6 +20,11 @@ #ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H #define __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H +#define FN_CONTROL_WORD 0x0 +#define FN_STATUS_WORD 0x4 +#define FN_TAG_WORD 0x8 +#define FN_DATA_SELECTOR 0x18 +#define FN_CR0_NPX_STATE 0x20C #define SIZEOF_FX_SAVE_AREA 528 #ifndef __ASM__ _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h --- trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-03-19 20:26:46 UTC (rev 14199) @@ -43,6 +43,7 @@ #define KPCR_BASE 0xFF000000 #define KPCR_EXCEPTION_LIST 0x0 +#define KPCR_INITIAL_STACK 0x4 #define KPCR_SELF 0x1C #define KPCR_TSS 0x40 #define KPCR_CURRENT_THREAD 0x124 _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-03-19 20:26:46 UTC (rev 14199) @@ -66,6 +66,6 @@ /* * */ -#define MM_STACK_SIZE (3*4096) +#define MM_STACK_SIZE (12*4096) #endif /* INCLUDE_INTERNAL_NTOSKRNL_H */ _____ Added: trunk/reactos/ntoskrnl/ke/i386/usercall.S --- trunk/reactos/ntoskrnl/ke/i386/usercall.S 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ke/i386/usercall.S 2005-03-19 20:26:46 UTC (rev 14199) @@ -0,0 +1,59 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/i386s/usercall.S + * PURPOSE: User-Mode callbacks and return. + * + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +#include <roscfg.h> +#include <internal/i386/segment.h> +#include <internal/i386/ke.h> +#include <internal/i386/fpu.h> +#include <internal/ps.h> +#include <ntos/tss.h> +#include <internal/ntoskrnl.h> +.intel_syntax noprefix + +/* GLOBALS ****************************************************************/ +.extern PVOID _SystemDllCallbackDispatcher + +#define CBSTACK_BUFFER_ADDRESS 0x20 +#define CBSTACK_BUFFER_LENGTH 0x24 +/* FUNCTIONS ****************************************************************/ + +/*++ + * KiSwitchToUserMode + * + * The KiSwitchToUserMode routine sets up a Trap Frame and a Callback stack + * for the purpose of switching to user mode. The actual final jump is done + * by KiServiceExit which will treat this as a syscall return. + * + * Params: + * OutputBuffer - Pointer to a caller-allocated buffer where to receive + * the return data from the user-mode function + * + * OutputLength - Size of the Output Buffer described above. + * + * Returns: + * Jumps into KiServiceExit. + * + * Remarks: + * If there is not enough Kernel Stack space, the routine will increase the + * Kernel Stack. + * + * User mode execution resumes at ntdll!KiUserCallbackDispatcher. + * + * This call MUST be paired by interrupt 0x2B or NtCallbackReturn. + * + *--*/ +.globl _KiSwitchToUserMode@8 +.func KiSwitchToUserMode@8 +_KiSwitchToUserMode@8: + +.endfunc + + _____ Deleted: trunk/reactos/ntoskrnl/ke/i386/usercall.c --- trunk/reactos/ntoskrnl/ke/i386/usercall.c 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ke/i386/usercall.c 2005-03-19 20:26:46 UTC (rev 14199) @@ -1,36 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ke/i386/usercall.c - * PURPOSE: 2E interrupt handler - * - * PROGRAMMERS: David Welch (david.welch(a)seh.ox.ac.uk) - */ - -/* INCLUDES ******************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -/* FUNCTIONS *****************************************************************/ - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -KeUserModeCallback( - IN ULONG FunctionID, - IN PVOID InputBuffer, - IN ULONG InputLength, - OUT PVOID *OutputBuffer, - OUT PULONG OutputLength -) -{ - UNIMPLEMENTED; - return 0; -} - -/* EOF */ _____ Added: trunk/reactos/ntoskrnl/ke/usercall.c --- trunk/reactos/ntoskrnl/ke/usercall.c 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ke/usercall.c 2005-03-19 20:26:46 UTC (rev 14199) @@ -0,0 +1,253 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/usercall.c + * PURPOSE: User-Mode callbacks. Portable part. + * + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <internal/debug.h> + +/* FUNCTIONS *****************************************************************/ + +#if ALEX_CB_REWRITE + +NTSTATUS +STDCALL +KiSwitchToUserMode(IN PVOID *OutputBuffer, + IN PULONG OutputLength); + +#else + +typedef struct _NTW32CALL_SAVED_STATE +{ + ULONG_PTR SavedStackLimit; + PVOID SavedStackBase; + PVOID SavedInitialStack; + PVOID CallerResult; + PULONG CallerResultLength; + PNTSTATUS CallbackStatus; + PKTRAP_FRAME SavedTrapFrame; + PVOID SavedCallbackStack; + PVOID SavedExceptionStack; +} NTW32CALL_SAVED_STATE, *PNTW32CALL_SAVED_STATE; + +typedef struct +{ + PVOID BaseAddress; + LIST_ENTRY ListEntry; +} NTW32CALL_CALLBACK_STACK, *PNTW32CALL_CALLBACK_STACK; + +KSPIN_LOCK CallbackStackListLock; +static LIST_ENTRY CallbackStackListHead; + +VOID INIT_FUNCTION +PsInitialiseW32Call(VOID) +{ + InitializeListHead(&CallbackStackListHead); + KeInitializeSpinLock(&CallbackStackListLock); +} + +VOID STATIC +PsFreeCallbackStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, + PFN_TYPE Page, SWAPENTRY SwapEntry, + BOOLEAN Dirty) +{ + ASSERT(SwapEntry == 0); + if (Page != 0) + { + MmReleasePageMemoryConsumer(MC_NPPOOL, Page); + } +} + +VOID STATIC +PsFreeCallbackStack(PVOID StackLimit) +{ + MmLockAddressSpace(MmGetKernelAddressSpace()); + MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), + StackLimit, + PsFreeCallbackStackPage, + NULL); + MmUnlockAddressSpace(MmGetKernelAddressSpace()); +} + +VOID +PsFreeCallbackStacks(VOID) +{ + PLIST_ENTRY CurrentListEntry; + PNTW32CALL_CALLBACK_STACK Current; + + while (!IsListEmpty(&CallbackStackListHead)) + { + CurrentListEntry = RemoveHeadList(&CallbackStackListHead); + Current = CONTAINING_RECORD(CurrentListEntry, NTW32CALL_CALLBACK_STACK, + ListEntry); + PsFreeCallbackStack(Current->BaseAddress); + ExFreePool(Current); + } +} + +PVOID STATIC +PsAllocateCallbackStack(ULONG StackSize) +{ + PVOID KernelStack = NULL; + NTSTATUS Status; + PMEMORY_AREA StackArea; + ULONG i, j; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + PPFN_TYPE Pages = alloca(sizeof(PFN_TYPE) * (StackSize /PAGE_SIZE)); + + + BoundaryAddressMultiple.QuadPart = 0; + StackSize = PAGE_ROUND_UP(StackSize); + MmLockAddressSpace(MmGetKernelAddressSpace()); + Status = MmCreateMemoryArea(NULL, + MmGetKernelAddressSpace(), + MEMORY_AREA_KERNEL_STACK, + &KernelStack, + StackSize, + 0, + &StackArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + MmUnlockAddressSpace(MmGetKernelAddressSpace()); + if (!NT_SUCCESS(Status)) + { + DPRINT("Failed to create thread stack\n"); + return(NULL); + } + for (i = 0; i < (StackSize / PAGE_SIZE); i++) + { + Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Pages[i]); + if (!NT_SUCCESS(Status)) + { + for (j = 0; j < i; j++) + { + MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[j]); + } + return(NULL); + } + } + Status = MmCreateVirtualMapping(NULL, + KernelStack, + PAGE_READWRITE, + Pages, + StackSize / PAGE_SIZE); + if (!NT_SUCCESS(Status)) + { + for (i = 0; i < (StackSize / PAGE_SIZE); i++) + { + MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[i]); + } + return(NULL); + } + return(KernelStack); +} +#endif + +/* + * @implemented + */ +NTSTATUS +STDCALL +KeUserModeCallback(IN ULONG RoutineIndex, + IN PVOID Argument, + IN ULONG ArgumentLength, + OUT PVOID *Result, + OUT PULONG ResultLength) +{ + PETHREAD Thread; + PVOID NewStack; + ULONG_PTR StackSize; + PKTRAP_FRAME NewFrame; + PULONG UserEsp; + KIRQL oldIrql; + NTSTATUS CallbackStatus; + NTW32CALL_SAVED_STATE SavedState; + PNTW32CALL_CALLBACK_STACK AssignedStack; + + PAGED_CODE(); + + DPRINT("KeUserModeCallback(RoutineIndex %d, Argument %X, ArgumentLength %d)\n", + RoutineIndex, Argument, ArgumentLength); + + Thread = PsGetCurrentThread(); + + /* Set up the new kernel and user environment. */ + StackSize = (ULONG_PTR)Thread->Tcb.StackBase - Thread->Tcb.StackLimit; + KeAcquireSpinLock(&CallbackStackListLock, &oldIrql); + if (IsListEmpty(&CallbackStackListHead)) + { + KeReleaseSpinLock(&CallbackStackListLock, oldIrql); + NewStack = PsAllocateCallbackStack(StackSize); + AssignedStack = ExAllocatePool(NonPagedPool, + sizeof(NTW32CALL_CALLBACK_STACK)); + AssignedStack->BaseAddress = NewStack; + } + else + { + PLIST_ENTRY StackEntry; + + StackEntry = RemoveHeadList(&CallbackStackListHead); + KeReleaseSpinLock(&CallbackStackListLock, oldIrql); + AssignedStack = CONTAINING_RECORD(StackEntry, NTW32CALL_CALLBACK_STACK, + ListEntry); + NewStack = AssignedStack->BaseAddress; + RtlZeroMemory(NewStack, StackSize); + } + /* FIXME: Need to check whether we were interrupted from v86 mode. */ + RtlCopyMemory((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA), + Thread->Tcb.TrapFrame, sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD))); + NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA)); + /* We need the stack pointer to remain 4-byte aligned */ + NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG))); + NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher(); + UserEsp = (PULONG)NewFrame->Esp; + UserEsp[0] = 0; /* Return address. */ + UserEsp[1] = RoutineIndex; + UserEsp[2] = (ULONG)&UserEsp[4]; + UserEsp[3] = ArgumentLength; + RtlCopyMemory((PVOID)&UserEsp[4], Argument, ArgumentLength); + + /* Switch to the new environment and return to user-mode. */ + KeRaiseIrql(HIGH_LEVEL, &oldIrql); + SavedState.SavedStackLimit = Thread->Tcb.StackLimit; + SavedState.SavedStackBase = Thread->Tcb.StackBase; + SavedState.SavedInitialStack = Thread->Tcb.InitialStack; + SavedState.CallerResult = Result; + SavedState.CallerResultLength = ResultLength; + SavedState.CallbackStatus = &CallbackStatus; + SavedState.SavedTrapFrame = Thread->Tcb.TrapFrame; + SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack; + SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0; + if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && + ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) + { + RtlCopyMemory((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA), + (char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA), + sizeof(FX_SAVE_AREA)); + } + Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)NewStack + StackSize; + Thread->Tcb.StackLimit = (ULONG)NewStack; + Thread->Tcb.KernelStack = (char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA); + KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA); + KePushAndStackSwitchAndSysRet((ULONG)&SavedState, Thread->Tcb.KernelStack); + + /* + * The callback return will have already restored most of the state we + * modified. + */ + KeLowerIrql(DISPATCH_LEVEL); + KeAcquireSpinLockAtDpcLevel(&CallbackStackListLock); + InsertTailList(&CallbackStackListHead, &AssignedStack->ListEntry); + KeReleaseSpinLock(&CallbackStackListLock, PASSIVE_LEVEL); + return(CallbackStatus); +} + +/* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ldr/sysdll.c --- trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-03-19 20:26:46 UTC (rev 14199) @@ -18,11 +18,11 @@ /* GLOBALS *******************************************************************/ -static PVOID SystemDllEntryPoint = NULL; -static PVOID SystemDllApcDispatcher = NULL; -static PVOID SystemDllCallbackDispatcher = NULL; -static PVOID SystemDllExceptionDispatcher = NULL; -static PVOID SystemDllRaiseExceptionDispatcher = NULL; +PVOID SystemDllEntryPoint = NULL; +PVOID SystemDllApcDispatcher = NULL; +PVOID SystemDllCallbackDispatcher = NULL; +PVOID SystemDllExceptionDispatcher = NULL; +PVOID SystemDllRaiseExceptionDispatcher = NULL; /* FUNCTIONS *****************************************************************/ _____ Deleted: trunk/reactos/ntoskrnl/ps/w32call.c --- trunk/reactos/ntoskrnl/ps/w32call.c 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ps/w32call.c 2005-03-19 20:26:46 UTC (rev 14199) @@ -1,343 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ps/w32call.c - * PURPOSE: Thread managment - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) - * Phillip Susi - */ - -/* - * NOTE: - * - * All of the routines that manipulate the thread queue synchronize on - * a single spinlock - * - */ - -/* INCLUDES ****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -#if defined(__GNUC__) -/* void * alloca(size_t size); */ -#elif defined(_MSC_VER) -void* _alloca(size_t size); -#else -#error Unknown compiler for alloca intrinsic stack allocation "function" -#endif - -/* TYPES *******************************************************************/ - -typedef struct _NTW32CALL_SAVED_STATE -{ - ULONG_PTR SavedStackLimit; - PVOID SavedStackBase; - PVOID SavedInitialStack; - PVOID CallerResult; - PULONG CallerResultLength; - PNTSTATUS CallbackStatus; - PKTRAP_FRAME SavedTrapFrame; - PVOID SavedCallbackStack; - PVOID SavedExceptionStack; -} NTW32CALL_SAVED_STATE, *PNTW32CALL_SAVED_STATE; - -typedef struct -{ - PVOID BaseAddress; - LIST_ENTRY ListEntry; -} NTW32CALL_CALLBACK_STACK, *PNTW32CALL_CALLBACK_STACK; - -KSPIN_LOCK CallbackStackListLock; -static LIST_ENTRY CallbackStackListHead; - -/* FUNCTIONS ***************************************************************/ - -VOID INIT_FUNCTION -PsInitialiseW32Call(VOID) -{ - InitializeListHead(&CallbackStackListHead); - KeInitializeSpinLock(&CallbackStackListLock); -} - -NTSTATUS STDCALL -NtCallbackReturn (PVOID Result, - ULONG ResultLength, - NTSTATUS Status) -{ - PULONG OldStack; - PETHREAD Thread; - PNTSTATUS CallbackStatus; - PULONG CallerResultLength; - PVOID* CallerResult; - PVOID InitialStack; - PVOID StackBase; - ULONG_PTR StackLimit; - KIRQL oldIrql; - PNTW32CALL_SAVED_STATE State; - PKTRAP_FRAME SavedTrapFrame; - PVOID SavedCallbackStack; - PVOID SavedExceptionStack; - - PAGED_CODE(); - - Thread = PsGetCurrentThread(); - if (Thread->Tcb.CallbackStack == NULL) - { - return(STATUS_NO_CALLBACK_ACTIVE); - } - - OldStack = (PULONG)Thread->Tcb.CallbackStack; - - /* - * Get the values that NtW32Call left on the inactive stack for us. - */ - State = (PNTW32CALL_SAVED_STATE)OldStack[0]; - CallbackStatus = State->CallbackStatus; - CallerResultLength = State->CallerResultLength; - CallerResult = State->CallerResult; - InitialStack = State->SavedInitialStack; - StackBase = State->SavedStackBase; - StackLimit = State->SavedStackLimit; - SavedTrapFrame = State->SavedTrapFrame; - SavedCallbackStack = State->SavedCallbackStack; - SavedExceptionStack = State->SavedExceptionStack; - - /* - * Copy the callback status and the callback result to NtW32Call - */ - *CallbackStatus = Status; - if (CallerResult != NULL && CallerResultLength != NULL) - { - if (Result == NULL) - { - *CallerResultLength = 0; - } - else - { - *CallerResultLength = min(ResultLength, *CallerResultLength); - RtlCopyMemory(*CallerResult, Result, *CallerResultLength); - } - } - - /* - * Restore the old stack. - */ - KeRaiseIrql(HIGH_LEVEL, &oldIrql); - if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && - ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) - { - RtlCopyMemory((char*)InitialStack - sizeof(FX_SAVE_AREA), - (char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA), - sizeof(FX_SAVE_AREA)); - } - Thread->Tcb.InitialStack = InitialStack; - Thread->Tcb.StackBase = StackBase; - Thread->Tcb.StackLimit = StackLimit; - Thread->Tcb.TrapFrame = SavedTrapFrame; - Thread->Tcb.CallbackStack = SavedCallbackStack; - KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)SavedExceptionStack; - KeStackSwitchAndRet((PVOID)(OldStack + 1)); - - /* Should never return. */ - KEBUGCHECK(0); - return(STATUS_UNSUCCESSFUL); -} - -VOID STATIC -PsFreeCallbackStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, - PFN_TYPE Page, SWAPENTRY SwapEntry, - BOOLEAN Dirty) -{ - ASSERT(SwapEntry == 0); - if (Page != 0) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, Page); - } -} - -VOID STATIC -PsFreeCallbackStack(PVOID StackLimit) -{ - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - StackLimit, - PsFreeCallbackStackPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); -} - -VOID -PsFreeCallbackStacks(VOID) -{ - PLIST_ENTRY CurrentListEntry; - PNTW32CALL_CALLBACK_STACK Current; - - while (!IsListEmpty(&CallbackStackListHead)) - { - CurrentListEntry = RemoveHeadList(&CallbackStackListHead); - Current = CONTAINING_RECORD(CurrentListEntry, NTW32CALL_CALLBACK_STACK, - ListEntry); - PsFreeCallbackStack(Current->BaseAddress); - ExFreePool(Current); - } -} - -PVOID STATIC -PsAllocateCallbackStack(ULONG StackSize) -{ - PVOID KernelStack = NULL; - NTSTATUS Status; - PMEMORY_AREA StackArea; - ULONG i, j; - PHYSICAL_ADDRESS BoundaryAddressMultiple; - PPFN_TYPE Pages = alloca(sizeof(PFN_TYPE) * (StackSize /PAGE_SIZE)); - - - BoundaryAddressMultiple.QuadPart = 0; - StackSize = PAGE_ROUND_UP(StackSize); - MmLockAddressSpace(MmGetKernelAddressSpace()); - Status = MmCreateMemoryArea(NULL, - MmGetKernelAddressSpace(), - MEMORY_AREA_KERNEL_STACK, - &KernelStack, - StackSize, - 0, - &StackArea, - FALSE, - FALSE, - BoundaryAddressMultiple); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - if (!NT_SUCCESS(Status)) - { - DPRINT("Failed to create thread stack\n"); - return(NULL); - } - for (i = 0; i < (StackSize / PAGE_SIZE); i++) - { - Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Pages[i]); - if (!NT_SUCCESS(Status)) - { - for (j = 0; j < i; j++) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[j]); - } - return(NULL); - } - } - Status = MmCreateVirtualMapping(NULL, - KernelStack, - PAGE_READWRITE, - Pages, - StackSize / PAGE_SIZE); - if (!NT_SUCCESS(Status)) - { - for (i = 0; i < (StackSize / PAGE_SIZE); i++) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[i]); - } - return(NULL); - } - return(KernelStack); -} - -NTSTATUS STDCALL -NtW32Call (IN ULONG RoutineIndex, - IN PVOID Argument, - IN ULONG ArgumentLength, - OUT PVOID* Result OPTIONAL, - OUT PULONG ResultLength OPTIONAL) -{ - PETHREAD Thread; - PVOID NewStack; - ULONG_PTR StackSize; - PKTRAP_FRAME NewFrame; - PULONG UserEsp; - KIRQL oldIrql; - NTSTATUS CallbackStatus; - NTW32CALL_SAVED_STATE SavedState; - PNTW32CALL_CALLBACK_STACK AssignedStack; - - PAGED_CODE(); - - DPRINT("NtW32Call(RoutineIndex %d, Argument %X, ArgumentLength %d)\n", - RoutineIndex, Argument, ArgumentLength); - - Thread = PsGetCurrentThread(); - - /* Set up the new kernel and user environment. */ - StackSize = (ULONG_PTR)Thread->Tcb.StackBase - Thread->Tcb.StackLimit; - KeAcquireSpinLock(&CallbackStackListLock, &oldIrql); - if (IsListEmpty(&CallbackStackListHead)) - { - KeReleaseSpinLock(&CallbackStackListLock, oldIrql); - NewStack = PsAllocateCallbackStack(StackSize); - AssignedStack = ExAllocatePool(NonPagedPool, - sizeof(NTW32CALL_CALLBACK_STACK)); - AssignedStack->BaseAddress = NewStack; - } - else - { - PLIST_ENTRY StackEntry; - - StackEntry = RemoveHeadList(&CallbackStackListHead); - KeReleaseSpinLock(&CallbackStackListLock, oldIrql); - AssignedStack = CONTAINING_RECORD(StackEntry, NTW32CALL_CALLBACK_STACK, - ListEntry); - NewStack = AssignedStack->BaseAddress; - RtlZeroMemory(NewStack, StackSize); - } - /* FIXME: Need to check whether we were interrupted from v86 mode. */ - RtlCopyMemory((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA), - Thread->Tcb.TrapFrame, sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD))); - NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA)); - /* We need the stack pointer to remain 4-byte aligned */ - NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG))); - NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher(); - UserEsp = (PULONG)NewFrame->Esp; - UserEsp[0] = 0; /* Return address. */ - UserEsp[1] = RoutineIndex; - UserEsp[2] = (ULONG)&UserEsp[4]; - UserEsp[3] = ArgumentLength; - RtlCopyMemory((PVOID)&UserEsp[4], Argument, ArgumentLength); - - /* Switch to the new environment and return to user-mode. */ - KeRaiseIrql(HIGH_LEVEL, &oldIrql); - SavedState.SavedStackLimit = Thread->Tcb.StackLimit; - SavedState.SavedStackBase = Thread->Tcb.StackBase; - SavedState.SavedInitialStack = Thread->Tcb.InitialStack; - SavedState.CallerResult = Result; - SavedState.CallerResultLength = ResultLength; - SavedState.CallbackStatus = &CallbackStatus; - SavedState.SavedTrapFrame = Thread->Tcb.TrapFrame; - SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack; - SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0; - if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && - ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) - { - RtlCopyMemory((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA), - (char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA), - sizeof(FX_SAVE_AREA)); - } - Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)NewStack + StackSize; - Thread->Tcb.StackLimit = (ULONG)NewStack; - Thread->Tcb.KernelStack = (char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA); - KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA); - KePushAndStackSwitchAndSysRet((ULONG)&SavedState, Thread->Tcb.KernelStack); - - /* - * The callback return will have already restored most of the state we - * modified. - */ - KeLowerIrql(DISPATCH_LEVEL); - KeAcquireSpinLockAtDpcLevel(&CallbackStackListLock); - InsertTailList(&CallbackStackListHead, &AssignedStack->ListEntry); - KeReleaseSpinLock(&CallbackStackListLock, PASSIVE_LEVEL); - return(CallbackStatus); -} - -/* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ps/win32.c --- trunk/reactos/ntoskrnl/ps/win32.c 2005-03-19 19:52:36 UTC (rev 14198) +++ trunk/reactos/ntoskrnl/ps/win32.c 2005-03-19 20:26:46 UTC (rev 14199) @@ -11,9 +11,9 @@ /* INCLUDES ****************************************************************/ #include <ntoskrnl.h> +#define NDEBUG +#include <internal/debug.h> -/* TYPES *******************************************************************/ - /* GLOBALS ******************************************************************/ static PW32_PROCESS_CALLBACK PspWin32ProcessCallback = NULL; @@ -28,6 +28,21 @@ extern OBJECT_CREATE_ROUTINE ExpDesktopObjectCreate; extern OBJECT_DELETE_ROUTINE ExpDesktopObjectDelete; +#ifndef ALEX_CB_REWRITE +typedef struct _NTW32CALL_SAVED_STATE +{ + ULONG_PTR SavedStackLimit; + PVOID SavedStackBase; + PVOID SavedInitialStack; + PVOID CallerResult; + PULONG CallerResultLength; + PNTSTATUS CallbackStatus; + PKTRAP_FRAME SavedTrapFrame; + PVOID SavedCallbackStack; + PVOID SavedExceptionStack; +} NTW32CALL_SAVED_STATE, *PNTW32CALL_SAVED_STATE; +#endif + /* FUNCTIONS ***************************************************************/ PW32THREAD STDCALL @@ -162,4 +177,182 @@ } } +VOID +STDCALL +DumpEspData(ULONG Esp, ULONG ThLimit, ULONG ThStack, ULONG PcrLimit, ULONG PcrStack, ULONG Esp0) +{ + DPRINT1("Current Esp: %p\n Thread Stack Limit: %p\n Thread Stack: %p\n Pcr Limit: %p, Pcr Stack: %p\n Esp0 :%p\n",Esp, ThLimit, ThStack, PcrLimit, PcrStack, Esp0) ; +} + + PVOID +STDCALL + PsAllocateCallbackStack(ULONG StackSize) + { + PVOID KernelStack = NULL; + NTSTATUS Status; + PMEMORY_AREA StackArea; + ULONG i, j; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + PPFN_TYPE Pages = alloca(sizeof(PFN_TYPE) * (StackSize /PAGE_SIZE)); + + DPRINT1("PsAllocateCallbackStack\n"); + BoundaryAddressMultiple.QuadPart = 0; + StackSize = PAGE_ROUND_UP(StackSize); + MmLockAddressSpace(MmGetKernelAddressSpace()); + Status = MmCreateMemoryArea(NULL, + MmGetKernelAddressSpace(), + MEMORY_AREA_KERNEL_STACK, + &KernelStack, + StackSize, + 0, + &StackArea, + FALSE, + FALSE, + BoundaryAddressMultiple); + MmUnlockAddressSpace(MmGetKernelAddressSpace()); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create thread stack\n"); + return(NULL); + } + for (i = 0; i < (StackSize / PAGE_SIZE); i++) + { + Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Pages[i]); + if (!NT_SUCCESS(Status)) + { + for (j = 0; j < i; j++) + { + MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[j]); + } + return(NULL); + } + } + Status = MmCreateVirtualMapping(NULL, + KernelStack, + PAGE_READWRITE, + Pages, + StackSize / PAGE_SIZE); + if (!NT_SUCCESS(Status)) + { + for (i = 0; i < (StackSize / PAGE_SIZE); i++) + { + MmReleasePageMemoryConsumer(MC_NPPOOL, Pages[i]); + } + return(NULL); + } + DPRINT1("PsAllocateCallbackStack %x\n", KernelStack); + return(KernelStack); +} + +NTSTATUS +STDCALL +NtW32Call(IN ULONG RoutineIndex, + IN PVOID Argument, + IN ULONG ArgumentLength, + OUT PVOID* Result OPTIONAL, + OUT PULONG ResultLength OPTIONAL) +{ + NTSTATUS CallbackStatus; + + DPRINT("NtW32Call(RoutineIndex %d, Argument %X, ArgumentLength %d)\n", + RoutineIndex, Argument, ArgumentLength); + + /* FIXME: SEH!!! */ + + /* Call kernel function */ + CallbackStatus = KeUserModeCallback(RoutineIndex, + Argument, + ArgumentLength, + Result, + ResultLength); + + /* Return the result */ + return(CallbackStatus); +} + +#ifndef ALEX_CB_REWRITE +NTSTATUS STDCALL +NtCallbackReturn (PVOID Result, + ULONG ResultLength, + NTSTATUS Status) +{ + PULONG OldStack; + PETHREAD Thread; + PNTSTATUS CallbackStatus; + PULONG CallerResultLength; + PVOID* CallerResult; + PVOID InitialStack; + PVOID StackBase; + ULONG_PTR StackLimit; + KIRQL oldIrql; + PNTW32CALL_SAVED_STATE State; + PKTRAP_FRAME SavedTrapFrame; + PVOID SavedCallbackStack; + PVOID SavedExceptionStack; + + PAGED_CODE(); + + Thread = PsGetCurrentThread(); + if (Thread->Tcb.CallbackStack == NULL) + { + return(STATUS_NO_CALLBACK_ACTIVE); + } + + OldStack = (PULONG)Thread->Tcb.CallbackStack; + + /* + * Get the values that NtW32Call left on the inactive stack for us. + */ + State = (PNTW32CALL_SAVED_STATE)OldStack[0]; + CallbackStatus = State->CallbackStatus; + CallerResultLength = State->CallerResultLength; + CallerResult = State->CallerResult; + InitialStack = State->SavedInitialStack; + StackBase = State->SavedStackBase; + StackLimit = State->SavedStackLimit; + SavedTrapFrame = State->SavedTrapFrame; + SavedCallbackStack = State->SavedCallbackStack; + SavedExceptionStack = State->SavedExceptionStack; + + /* + * Copy the callback status and the callback result to NtW32Call + */ + *CallbackStatus = Status; + if (CallerResult != NULL && CallerResultLength != NULL) + { + if (Result == NULL) + { + *CallerResultLength = 0; + } + else + { + *CallerResultLength = min(ResultLength, *CallerResultLength); + RtlCopyMemory(*CallerResult, Result, *CallerResultLength); + } + } + + /* + * Restore the old stack. + */ + KeRaiseIrql(HIGH_LEVEL, &oldIrql); + if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && + ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) + { + RtlCopyMemory((char*)InitialStack - sizeof(FX_SAVE_AREA), + (char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA), + sizeof(FX_SAVE_AREA)); [truncated at 1000 lines; 15 more skipped]
19 years, 9 months
1
0
0
0
[navaraf] 14198: Fix indentation.
by navaraf@svn.reactos.com
Fix indentation. Modified: trunk/reactos/ntoskrnl/ke/catch.c _____ Modified: trunk/reactos/ntoskrnl/ke/catch.c --- trunk/reactos/ntoskrnl/ke/catch.c 2005-03-19 19:13:01 UTC (rev 14197) +++ trunk/reactos/ntoskrnl/ke/catch.c 2005-03-19 19:52:36 UTC (rev 14198) @@ -118,68 +118,67 @@ if (Action == kdContinue) return; #endif - /* FIXME: Forward exception to user mode debugger */ + /* FIXME: Forward exception to user mode debugger */ - /* FIXME: Check user mode stack for enough space */ - - /* Let usermode try and handle the exception. Setup Stack */ - Stack = (PULONG)temp_space; - CDest = 3 + (ROUND_UP(sizeof(EXCEPTION_RECORD), 4) / 4); - /* Return Address */ - Stack[0] = 0; - /* Pointer to EXCEPTION_RECORD structure */ - Stack[1] = (ULONG)&pNewUserStack[3]; - /* Pointer to CONTEXT structure */ - Stack[2] = (ULONG)&pNewUserStack[CDest]; - memcpy(&Stack[3], ExceptionRecord, sizeof(EXCEPTION_RECORD)); - memcpy(&Stack[CDest], Context, sizeof(CONTEXT)); - - /* Copy Stack */ - StatusOfCopy = MmCopyToCaller(pNewUserStack, - temp_space, - (12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT))); - - /* Check for success */ - if (NT_SUCCESS(StatusOfCopy)) { + /* FIXME: Check user mode stack for enough space */ + + /* Let usermode try and handle the exception. Setup Stack */ + Stack = (PULONG)temp_space; + CDest = 3 + (ROUND_UP(sizeof(EXCEPTION_RECORD), 4) / 4); + /* Return Address */ + Stack[0] = 0; + /* Pointer to EXCEPTION_RECORD structure */ + Stack[1] = (ULONG)&pNewUserStack[3]; + /* Pointer to CONTEXT structure */ + Stack[2] = (ULONG)&pNewUserStack[CDest]; + memcpy(&Stack[3], ExceptionRecord, sizeof(EXCEPTION_RECORD)); + memcpy(&Stack[CDest], Context, sizeof(CONTEXT)); - /* Set new Stack Pointer */ - Tf->Esp = (ULONG)pNewUserStack; + /* Copy Stack */ + StatusOfCopy = MmCopyToCaller(pNewUserStack, + temp_space, + (12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT))); - } else { + /* Check for success */ + if (NT_SUCCESS(StatusOfCopy)) { + + /* Set new Stack Pointer */ + Tf->Esp = (ULONG)pNewUserStack; + + } else { + + /* + * Now it really hit the ventilation device. Sorry, + * can do nothing but kill the sucker. + */ + ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); + DPRINT1("User-mode stack was invalid. Terminating target thread\n"); + } - /* - * Now it really hit the ventilation device. Sorry, - * can do nothing but kill the sucker. - */ - ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); - DPRINT1("User-mode stack was invalid. Terminating target thread\n"); + /* Set EIP to the User-mode Dispathcer */ + Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher(); + return; } - - /* Set EIP to the User-mode Dispathcer */ - Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher(); - return; - } - /* FIXME: Forward the exception to the debugger */ + /* FIXME: Forward the exception to the debugger */ - /* FIXME: Forward the exception to the process exception port */ + /* FIXME: Forward the exception to the process exception port */ - #ifdef KDBG - /* Enter KDB if available */ - Action = KdbEnterDebuggerException(ExceptionRecord, - PreviousMode, - Context, - Tf, - FALSE); + /* Enter KDB if available */ + Action = KdbEnterDebuggerException(ExceptionRecord, + PreviousMode, + Context, + Tf, + FALSE); - /* Exit if we're continuing */ - if (Action == kdContinue) return; + /* Exit if we're continuing */ + if (Action == kdContinue) return; #endif - /* Terminate the offending thread */ - DPRINT1("Unhandled UserMode exception, terminating thread\n"); - ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); + /* Terminate the offending thread */ + DPRINT1("Unhandled UserMode exception, terminating thread\n"); + ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); } else {
19 years, 9 months
1
0
0
0
[weiden] 14197: - correctly deny access to handles when rights requested can't be granted
by weiden@svn.reactos.com
- correctly deny access to handles when rights requested can't be granted - map generic rights correctly - various fixes where handles with inappropriate access rights were created Modified: trunk/reactos/include/ddk/cmtypes.h Modified: trunk/reactos/lib/advapi32/reg/reg.c Modified: trunk/reactos/lib/kernel32/file/dir.c Modified: trunk/reactos/lib/ntdll/ldr/utils.c Modified: trunk/reactos/lib/ntdll/rtl/path.c Modified: trunk/reactos/lib/syssetup/wizard.c Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c Modified: trunk/reactos/ntoskrnl/cm/registry.c Modified: trunk/reactos/ntoskrnl/io/create.c Modified: trunk/reactos/ntoskrnl/io/device.c Modified: trunk/reactos/ntoskrnl/io/driver.c Modified: trunk/reactos/ntoskrnl/io/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr.c Modified: trunk/reactos/ntoskrnl/io/vpb.c Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/ldr/sysdll.c Modified: trunk/reactos/ntoskrnl/ob/handle.c Modified: trunk/reactos/ntoskrnl/ob/object.c Modified: trunk/reactos/ntoskrnl/se/token.c Modified: trunk/reactos/subsys/smss/initwkdll.c Modified: trunk/reactos/subsys/system/services/database.c Modified: trunk/reactos/subsys/system/winlogon/setup.c _____ Modified: trunk/reactos/include/ddk/cmtypes.h --- trunk/reactos/include/ddk/cmtypes.h 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/include/ddk/cmtypes.h 2005-03-19 19:13:01 UTC (rev 14197) @@ -10,7 +10,10 @@ { KeyBasicInformation, KeyNodeInformation, - KeyFullInformation + KeyFullInformation, + KeyNameInformation, + KeyCachedInformation, + KeyFlagsInformation } KEY_INFORMATION_CLASS; typedef struct _KEY_BASIC_INFORMATION _____ Modified: trunk/reactos/lib/advapi32/reg/reg.c --- trunk/reactos/lib/advapi32/reg/reg.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/lib/advapi32/reg/reg.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -222,7 +222,7 @@ NULL, NULL); return NtOpenKey (KeyHandle, - KEY_ALL_ACCESS, + MAXIMUM_ALLOWED, &Attributes); } _____ Modified: trunk/reactos/lib/kernel32/file/dir.c --- trunk/reactos/lib/kernel32/file/dir.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/lib/kernel32/file/dir.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -221,7 +221,7 @@ DPRINT("NtPathU '%S'\n", NtPathU.Buffer); Status = NtCreateFile (&DirectoryHandle, - FILE_WRITE_ATTRIBUTES, /* 0x110080 */ + DELETE, &ObjectAttributes, &IoStatusBlock, NULL, _____ Modified: trunk/reactos/lib/ntdll/ldr/utils.c --- trunk/reactos/lib/ntdll/ldr/utils.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/lib/ntdll/ldr/utils.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -682,7 +682,7 @@ SECTION_ALL_ACCESS, NULL, NULL, - PAGE_READWRITE, + PAGE_READONLY, SEC_COMMIT | (MapAsDataFile ? 0 : SEC_IMAGE), FileHandle); NtClose(FileHandle); @@ -2048,7 +2048,7 @@ &ViewSize, 0, MEM_COMMIT, - PAGE_READWRITE); + PAGE_READONLY); if (!NT_SUCCESS(Status)) { DPRINT1("map view of section failed (Status %x)\n", Status); @@ -2875,10 +2875,10 @@ DPRINT ("LdrVerifyImageMatchesChecksum() called\n"); Status = NtCreateSection (&SectionHandle, - SECTION_MAP_EXECUTE, + SECTION_MAP_READ, NULL, NULL, - PAGE_EXECUTE, + PAGE_READONLY, SEC_COMMIT, FileHandle); if (!NT_SUCCESS(Status)) @@ -2898,7 +2898,7 @@ &ViewSize, ViewShare, 0, - PAGE_EXECUTE); + PAGE_READONLY); if (!NT_SUCCESS(Status)) { DPRINT1 ("NtMapViewOfSection() failed (Status %lx)\n", Status); _____ Modified: trunk/reactos/lib/ntdll/rtl/path.c --- trunk/reactos/lib/ntdll/rtl/path.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/lib/ntdll/rtl/path.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -290,8 +290,8 @@ } /* don't keep the directory handle open on removable media */ - if (!NtQueryVolumeInformationFile( handle, &iosb, &device_info, - sizeof(device_info), FileFsDeviceInformation ) && + if (NT_SUCCESS(NtQueryVolumeInformationFile( handle, &iosb, &device_info, + sizeof(device_info), FileFsDeviceInformation )) && (device_info.Characteristics & FILE_REMOVABLE_MEDIA)) { DPRINT1("don't keep the directory handle open on removable media\n"); _____ Modified: trunk/reactos/lib/syssetup/wizard.c --- trunk/reactos/lib/syssetup/wizard.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/lib/syssetup/wizard.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -1133,7 +1133,7 @@ */ if(OpenProcessToken(GetCurrentProcess(), - TOKEN_ADJUST_PRIVILEGES, + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { priv.PrivilegeCount = 1; _____ Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c --- trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -460,9 +460,12 @@ PKEY_FULL_INFORMATION FullInformation; PDATA_CELL ClassCell; ULONG NameSize, ClassSize; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); DPRINT("KH %x I %d KIC %x KI %x L %d RL %x\n", KeyHandle, @@ -476,7 +479,7 @@ Status = ObReferenceObjectByHandle(KeyHandle, KEY_ENUMERATE_SUB_KEYS, CmiKeyType, - UserMode, + PreviousMode, (PVOID *) &KeyObject, NULL); if (!NT_SUCCESS(Status)) @@ -1056,7 +1059,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, - KEY_QUERY_VALUE, + 0, CmiKeyType, PreviousMode, (PVOID *)&KeyObject, @@ -1218,7 +1221,7 @@ /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, - KEY_READ, + (KeyInformationClass != KeyNameInformation ? KEY_QUERY_VALUE : 0), CmiKeyType, UserMode, (PVOID *) &KeyObject, @@ -1377,6 +1380,13 @@ } break; + case KeyNameInformation: + case KeyCachedInformation: + case KeyFlagsInformation: + DPRINT1("Key information class 0x%x not yet implemented!\n", KeyInformationClass); + Status = STATUS_NOT_IMPLEMENTED; + break; + default: DPRINT1("Not handling 0x%x\n", KeyInformationClass); Status = STATUS_INVALID_INFO_CLASS; @@ -1658,14 +1668,12 @@ KeyHandle, ValueName, Type); DesiredAccess = KEY_SET_VALUE; - if (Type == REG_LINK) - DesiredAccess |= KEY_CREATE_LINK; /* Verify that the handle is valid and is a registry key */ Status = ObReferenceObjectByHandle(KeyHandle, DesiredAccess, CmiKeyType, - UserMode, + ExGetPreviousMode(), (PVOID *)&KeyObject, NULL); if (!NT_SUCCESS(Status)) _____ Modified: trunk/reactos/ntoskrnl/cm/registry.c --- trunk/reactos/ntoskrnl/cm/registry.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/cm/registry.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -423,7 +423,7 @@ ASSERT(NT_SUCCESS(Status)); Status = ObInsertObject(RootKey, NULL, - STANDARD_RIGHTS_REQUIRED, + KEY_ALL_ACCESS, 0, NULL, &RootKeyHandle); @@ -462,7 +462,7 @@ RootKeyHandle, NULL); Status = ZwCreateKey(&KeyHandle, - STANDARD_RIGHTS_REQUIRED, + KEY_ALL_ACCESS, &ObjectAttributes, 0, NULL, @@ -479,7 +479,7 @@ RootKeyHandle, NULL); Status = ZwCreateKey(&KeyHandle, - STANDARD_RIGHTS_REQUIRED, + KEY_ALL_ACCESS, &ObjectAttributes, 0, NULL, _____ Modified: trunk/reactos/ntoskrnl/io/create.c --- trunk/reactos/ntoskrnl/io/create.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/create.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -448,9 +448,6 @@ return Status; } - RtlMapGenericMask(&DesiredAccess, - BODY_TO_HEADER(FileObject)->ObjectType->Mapping); - Status = ObInsertObject ((PVOID)FileObject, NULL, DesiredAccess, _____ Modified: trunk/reactos/ntoskrnl/io/device.c --- trunk/reactos/ntoskrnl/io/device.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/device.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -349,7 +349,10 @@ FILE_NON_DIRECTORY_FILE); if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile failed, Status: 0x%x\n", Status); return Status; + } Status = ObReferenceObjectByHandle( FileHandle, _____ Modified: trunk/reactos/ntoskrnl/io/driver.c --- trunk/reactos/ntoskrnl/io/driver.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/driver.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -960,7 +960,7 @@ NULL); Status = ZwOpenKey(&KeyHandle, - 0x10001, + KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); if (!NT_SUCCESS(Status)) { _____ Modified: trunk/reactos/ntoskrnl/io/file.c --- trunk/reactos/ntoskrnl/io/file.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/file.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -50,7 +50,7 @@ PreviousMode = ExGetPreviousMode(); Status = ObReferenceObjectByHandle(FileHandle, - FILE_READ_ATTRIBUTES, + 0, /* FIXME - access depends on the information class! */ IoFileObjectType, PreviousMode, (PVOID *)&FileObject, @@ -402,7 +402,7 @@ /* Get the file object from the file handle */ Status = ObReferenceObjectByHandle(FileHandle, - FILE_WRITE_ATTRIBUTES, + 0, /* FIXME - depends on the information class */ IoFileObjectType, PreviousMode, (PVOID *)&FileObject, _____ Modified: trunk/reactos/ntoskrnl/io/iomgr.c --- trunk/reactos/ntoskrnl/io/iomgr.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/iomgr.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -34,9 +34,9 @@ ULONGLONG IoOtherTransferCount = 0; KSPIN_LOCK EXPORTED IoStatisticsLock = 0; -static GENERIC_MAPPING IopFileMapping = {FILE_GENERIC_READ, - FILE_GENERIC_WRITE, - FILE_GENERIC_EXECUTE, +static GENERIC_MAPPING IopFileMapping = {STANDARD_RIGHTS_READ | SYNCHRONIZE | FILE_READ_DATA | FILE_READ_PROPERTIES, + STANDARD_RIGHTS_WRITE | SYNCHRONIZE | FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_PROPERTIES, + STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | FILE_EXECUTE | FILE_READ_ATTRIBUTES, FILE_ALL_ACCESS}; /* FUNCTIONS ****************************************************************/ _____ Modified: trunk/reactos/ntoskrnl/io/vpb.c --- trunk/reactos/ntoskrnl/io/vpb.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/io/vpb.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -107,7 +107,7 @@ PreviousMode = ExGetPreviousMode(); Status = ObReferenceObjectByHandle(FileHandle, - FILE_READ_ATTRIBUTES, + 0, /* FIXME - depends on the information class! */ IoFileObjectType, PreviousMode, (PVOID*)&FileObject, _____ Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c --- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -1,9 +1,9 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/i386/exp.c * PURPOSE: Handling exceptions - * + * * PROGRAMMERS: David Welch (welch(a)cwcom.net) * Skywing (skywing(a)valhallalegends.com) */ @@ -120,24 +120,31 @@ MODULE_TEXT_SECTION* current; extern LIST_ENTRY ModuleTextListHead; ULONG_PTR RelativeAddress; + ULONG i = 0; - current_entry = ModuleTextListHead.Flink; + do + { + current_entry = ModuleTextListHead.Flink; - while (current_entry != &ModuleTextListHead && - current_entry != NULL) - { - current = - CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry); + while (current_entry != &ModuleTextListHead && + current_entry != NULL) + { + current = + CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry); - if (address >= (PVOID)current->Base && - address < (PVOID)(current->Base + current->Length)) - { - RelativeAddress = (ULONG_PTR) address - current->Base; - DbgPrint("<%ws: %x>", current->Name, RelativeAddress); - return(TRUE); - } - current_entry = current_entry->Flink; - } + if (address >= (PVOID)current->Base && + address < (PVOID)(current->Base + current->Length)) + { + RelativeAddress = (ULONG_PTR) address - current->Base; + DbgPrint("<%ws: %x>", current->Name, RelativeAddress); + return(TRUE); + } + current_entry = current_entry->Flink; + } + + address = (PVOID)((ULONG_PTR)address & ~0xC0000000); + } while(++i <= 1); + return(FALSE); } #endif /* KDBG */ @@ -511,9 +518,9 @@ if (ExceptionNr == 15) { - /* + /* * FIXME: - * This exception should never occur. The P6 has a bug, which does sometimes deliver + * This exception should never occur. The P6 has a bug, which does sometimes deliver * the apic spurious interrupt as exception 15. On an athlon64, I get one exception * in the early boot phase in apic mode (using the smp build). I've looked to the linux * sources. Linux does ignore this exception. @@ -941,7 +948,7 @@ } _SEH_HANDLE { return(ExceptionCode); } _SEH_END; - + OldEip = Thread->TrapFrame->Eip; Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher(); return((NTSTATUS)OldEip); @@ -972,7 +979,7 @@ /* Restore the user context */ Thread->TrapFrame = PrevTrapFrame; __asm__("mov %%ebx, %%esp;\n" "jmp _KiServiceExit": : "b" (TrapFrame)); - + /* We never get here */ return(STATUS_SUCCESS); } _____ Modified: trunk/reactos/ntoskrnl/ldr/sysdll.c --- trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -144,7 +144,7 @@ SECTION_ALL_ACCESS, NULL, NULL, - PAGE_READWRITE, + PAGE_READONLY, SEC_IMAGE | SEC_COMMIT, FileHandle); if (!NT_SUCCESS(Status)) _____ Modified: trunk/reactos/ntoskrnl/ob/handle.c --- trunk/reactos/ntoskrnl/ob/handle.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/ob/handle.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -40,6 +40,8 @@ ~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE | \ EX_HANDLE_ENTRY_AUDITONCLOSE))) +#define GENERIC_ANY (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL) + /* FUNCTIONS ***************************************************************/ VOID @@ -548,7 +550,19 @@ ObjectHeader = BODY_TO_HEADER(ObjectBody); ASSERT((ULONG_PTR)ObjectHeader & EX_HANDLE_ENTRY_LOCKED); + + if (GrantedAccess & MAXIMUM_ALLOWED) + { + GrantedAccess &= ~MAXIMUM_ALLOWED; + GrantedAccess |= GENERIC_ALL; + } + if (GrantedAccess & GENERIC_ANY) + { + RtlMapGenericMask(&GrantedAccess, + ObjectHeader->ObjectType->Mapping); + } + NewEntry.u1.Object = ObjectHeader; if(Inherit) NewEntry.u1.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE; @@ -644,7 +658,6 @@ POBJECT_HEADER ObjectHeader; PVOID ObjectBody; ACCESS_MASK GrantedAccess; - PGENERIC_MAPPING GenericMapping; ULONG Attributes; NTSTATUS Status; LONG ExHandle = HANDLE_TO_EX_HANDLE(Handle); @@ -714,6 +727,13 @@ return(STATUS_OBJECT_TYPE_MISMATCH); } + /* desire as much access rights as possible */ + if (DesiredAccess & MAXIMUM_ALLOWED) + { + DesiredAccess &= ~MAXIMUM_ALLOWED; + DesiredAccess |= GENERIC_ALL; + } + KeEnterCriticalRegion(); HandleEntry = ExMapHandleToPointer(PsGetCurrentProcess()->ObjectTable, @@ -729,48 +749,53 @@ ObjectBody = HEADER_TO_BODY(ObjectHeader); DPRINT("locked1: ObjectHeader: 0x%x [HT:0x%x]\n", ObjectHeader, PsGetCurrentProcess()->ObjectTable); - - ObReferenceObjectByPointer(ObjectBody, - 0, - NULL, - UserMode); - Attributes = HandleEntry->u1.ObAttributes & (EX_HANDLE_ENTRY_PROTECTFROMCLOSE | - EX_HANDLE_ENTRY_INHERITABLE | - EX_HANDLE_ENTRY_AUDITONCLOSE); - GrantedAccess = HandleEntry->u2.GrantedAccess; - GenericMapping = ObjectHeader->ObjectType->Mapping; - + if (ObjectType != NULL && ObjectType != ObjectHeader->ObjectType) { DPRINT("ObjectType mismatch: %wZ vs %wZ (handle 0x%x)\n", &ObjectType->TypeName, ObjectHeader->ObjectType ? &ObjectHeader->ObjectType->TypeName : NULL, Handle); - + ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, HandleEntry); KeLeaveCriticalRegion(); - ObDereferenceObject(ObjectBody); - + return(STATUS_OBJECT_TYPE_MISMATCH); } - ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, - HandleEntry); + /* map the generic access masks if the caller asks for generic access */ + if (DesiredAccess & GENERIC_ANY) + { + RtlMapGenericMask(&DesiredAccess, + BODY_TO_HEADER(ObjectBody)->ObjectType->Mapping); + } - KeLeaveCriticalRegion(); + GrantedAccess = HandleEntry->u2.GrantedAccess; - if (DesiredAccess && AccessMode != KernelMode) + /* Unless running as KernelMode, deny access if caller desires more access + rights than the handle can grant */ + if(AccessMode != KernelMode && (~GrantedAccess & DesiredAccess)) { - RtlMapGenericMask(&DesiredAccess, GenericMapping); + ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, + HandleEntry); - if (!(GrantedAccess & DesiredAccess) && - !((~GrantedAccess) & DesiredAccess)) - { - ObDereferenceObject(ObjectBody); - CHECKPOINT; - return(STATUS_ACCESS_DENIED); - } + KeLeaveCriticalRegion(); + + return(STATUS_ACCESS_DENIED); } + ObReferenceObjectByPointer(ObjectBody, + 0, + NULL, + UserMode); + Attributes = HandleEntry->u1.ObAttributes & (EX_HANDLE_ENTRY_PROTECTFROMCLOSE | + EX_HANDLE_ENTRY_INHERITABLE | + EX_HANDLE_ENTRY_AUDITONCLOSE); + + ExUnlockHandleTableEntry(PsGetCurrentProcess()->ObjectTable, + HandleEntry); + + KeLeaveCriticalRegion(); + if (HandleInformation != NULL) { HandleInformation->HandleAttributes = Attributes; @@ -838,9 +863,6 @@ Access = DesiredAccess; ObjectHeader = BODY_TO_HEADER(Object); - RtlMapGenericMask(&Access, - ObjectHeader->ObjectType->Mapping); - return(ObCreateHandle(PsGetCurrentProcess(), Object, Access, _____ Modified: trunk/reactos/ntoskrnl/ob/object.c --- trunk/reactos/ntoskrnl/ob/object.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/ob/object.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -412,7 +412,7 @@ else { Status = ObReferenceObjectByHandle(ObjectAttributes->RootDirectory, - DIRECTORY_TRAVERSE, + 0, NULL, UserMode, &CurrentObject, _____ Modified: trunk/reactos/ntoskrnl/se/token.c --- trunk/reactos/ntoskrnl/se/token.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/ntoskrnl/se/token.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -1663,7 +1663,7 @@ // &Length); Status = ObReferenceObjectByHandle (TokenHandle, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + TOKEN_ADJUST_PRIVILEGES | (PreviousState != NULL ? TOKEN_QUERY : 0), SepTokenObjectType, PreviousMode, (PVOID*)&Token, _____ Modified: trunk/reactos/subsys/smss/initwkdll.c --- trunk/reactos/subsys/smss/initwkdll.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/subsys/smss/initwkdll.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -60,7 +60,7 @@ (HANDLE)Context, NULL); Status = NtOpenFile(&FileHandle, - SYNCHRONIZE | FILE_EXECUTE, + SYNCHRONIZE | FILE_EXECUTE | FILE_READ_DATA, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, _____ Modified: trunk/reactos/subsys/system/services/database.c --- trunk/reactos/subsys/system/services/database.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/subsys/system/services/database.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -327,7 +327,7 @@ NULL); Status = RtlpNtOpenKey(&ServicesKey, - 0x10001, + KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes, 0); if (!NT_SUCCESS(Status)) _____ Modified: trunk/reactos/subsys/system/winlogon/setup.c --- trunk/reactos/subsys/system/winlogon/setup.c 2005-03-19 18:31:14 UTC (rev 14196) +++ trunk/reactos/subsys/system/winlogon/setup.c 2005-03-19 19:13:01 UTC (rev 14197) @@ -84,7 +84,7 @@ dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"), 0, - KEY_QUERY_VALUE, + KEY_SET_VALUE, &hKey); if (dwError != ERROR_SUCCESS) {
19 years, 9 months
1
0
0
0
[ea] 14196: winsta.dll raw stubs
by ea@svn.reactos.com
winsta.dll raw stubs Added: trunk/reactos/lib/winsta/ Added: trunk/reactos/lib/winsta/main.c Added: trunk/reactos/lib/winsta/makefile Added: trunk/reactos/lib/winsta/misc.c Added: trunk/reactos/lib/winsta/server.c Added: trunk/reactos/lib/winsta/winsta.def Added: trunk/reactos/lib/winsta/winsta.h Added: trunk/reactos/lib/winsta/winsta.rc Added: trunk/reactos/lib/winsta/ws.c _____ Added: trunk/reactos/lib/winsta/main.c --- trunk/reactos/lib/winsta/main.c 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/main.c 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,50 @@ +/* + * ReactOS WinStation + * Copyright (C) 2005 ReactOS Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* $Id$ + * + * PROJECT: ReactOS Access Control List Editor + * FILE: lib/winsta/main.c + * PURPOSE: WinStation + * PROGRAMMER: Emanuele Aliberti <ea(a)reactos.com> + */ +#include <windows.h> + +HINSTANCE hDllInstance; + + +BOOL STDCALL +DllMain(HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpvReserved) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + hDllInstance = hinstDLL; + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} +/* EOF */ _____ Added: trunk/reactos/lib/winsta/makefile --- trunk/reactos/lib/winsta/makefile 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/makefile 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,23 @@ +# $Id$ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = dynlink + +TARGET_NAME = winsta + +TARGET_CFLAGS = -g -Werror -Wall + +TARGET_OBJECTS = \ + main.o \ + misc.o \ + server.o \ + ws.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +# EOF _____ Added: trunk/reactos/lib/winsta/misc.c --- trunk/reactos/lib/winsta/misc.c 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/misc.c 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,12 @@ +/* $Id$ */ +#include <windows.h> +#include "winsta.h" + +WINSTASTUB(LogonIdFromWinStationNameA) +WINSTASTUB(LogonIdFromWinStationNameW) +WINSTASTUB(RemoteAssistancePrepareSystemRestore) +WINSTASTUB(_NWLogonQueryAdmin) +WINSTASTUB(_NWLogonSetAdmin) +/* EOF */ + + _____ Added: trunk/reactos/lib/winsta/server.c --- trunk/reactos/lib/winsta/server.c 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/server.c 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,21 @@ +/* $Id$ */ +#include <windows.h> +#include "winsta.h" + +WINSTASTUB(ServerGetInternetConnectorStatus) +WINSTASTUB(ServerLicensingClose) +WINSTASTUB(ServerLicensingDeactivateCurrentPolicy) +WINSTASTUB(ServerLicensingFreePolicyInformation) +WINSTASTUB(ServerLicensingGetAvailablePolicyIds) +WINSTASTUB(ServerLicensingGetPolicy) +WINSTASTUB(ServerLicensingGetPolicyInformationA) +WINSTASTUB(ServerLicensingGetPolicyInformationW) +WINSTASTUB(ServerLicensingLoadPolicy) +WINSTASTUB(ServerLicensingOpenA) +WINSTASTUB(ServerLicensingOpenW) +WINSTASTUB(ServerLicensingSetPolicy) +WINSTASTUB(ServerLicensingUnloadPolicy) +WINSTASTUB(ServerQueryInetConnectorInformationA) +WINSTASTUB(ServerQueryInetConnectorInformationW) +WINSTASTUB(ServerSetInternetConnectorStatus) +/* EOF */ _____ Added: trunk/reactos/lib/winsta/winsta.def --- trunk/reactos/lib/winsta/winsta.def 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/winsta.def 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,100 @@ +; $Id$ +LIBRARY winsta.dll +EXPORTS +LogonIdFromWinStationNameA@0 +LogonIdFromWinStationNameW@0 +RemoteAssistancePrepareSystemRestore@0 +ServerGetInternetConnectorStatus@0 +ServerLicensingClose@0 +ServerLicensingDeactivateCurrentPolicy@0 +ServerLicensingFreePolicyInformation@0 +ServerLicensingGetAvailablePolicyIds@0 +ServerLicensingGetPolicy@0 +ServerLicensingGetPolicyInformationA@0 +ServerLicensingGetPolicyInformationW@0 +ServerLicensingLoadPolicy@0 +ServerLicensingOpenA@0 +ServerLicensingOpenW@0 +ServerLicensingSetPolicy@0 +ServerLicensingUnloadPolicy@0 +ServerQueryInetConnectorInformationA@0 +ServerQueryInetConnectorInformationW@0 +ServerSetInternetConnectorStatus@0 +WinStationActivateLicense@0 +WinStationAutoReconnect@0 +WinStationBroadcastSystemMessage@0 +WinStationCheckLoopBack@0 +WinStationCloseServer@0 +WinStationConnectA@0 +WinStationConnectCallback@0 +WinStationConnectW@0 +WinStationDisconnect@0 +WinStationEnumerateA@0 +WinStationEnumerateLicenses@0 +WinStationEnumerateProcesses@0 +WinStationEnumerateW@0 +WinStationEnumerate_IndexedA@0 +WinStationEnumerate_IndexedW@0 +WinStationFreeGAPMemory@0 +WinStationFreeMemory@0 +WinStationGenerateLicense@0 +WinStationGetAllProcesses@0 +WinStationGetLanAdapterNameA@0 +WinStationGetLanAdapterNameW@0 +WinStationGetMachinePolicy@0 +WinStationGetProcessSid@0 +WinStationGetTermSrvCountersValue@0 +WinStationInstallLicense@0 +WinStationIsHelpAssistantSession@0 +WinStationNameFromLogonIdA@0 +WinStationNameFromLogonIdW@0 +WinStationNtsdDebug@0 +WinStationOpenServerA@0 +WinStationOpenServerW@0 +WinStationQueryInformationA@0 +WinStationQueryInformationW@0 +WinStationQueryLicense@0 +WinStationQueryLogonCredentialsW@0 +WinStationQueryUpdateRequired@0 +WinStationRegisterConsoleNotification@0 +WinStationRemoveLicense@0 +WinStationRenameA@0 +WinStationRenameW@0 +WinStationRequestSessionsList@0 +WinStationReset@0 +WinStationSendMessageA@0 +WinStationSendMessageW@0 +WinStationSendWindowMessage@0 +WinStationServerPing@0 +WinStationSetInformationA@0 +WinStationSetInformationW@0 +WinStationSetPoolCount@0 +WinStationShadow@0 +WinStationShadowStop@0 +WinStationShutdownSystem@0 +WinStationTerminateProcess@0 +WinStationUnRegisterConsoleNotification@0 +WinStationVirtualOpen@0 +WinStationWaitSystemEvent@0 +_NWLogonQueryAdmin@0 +_NWLogonSetAdmin@0 +_WinStationAnnoyancePopup@0 +_WinStationBeepOpen@0 +_WinStationBreakPoint@0 +_WinStationCallback@0 +_WinStationCheckForApplicationName@0 +_WinStationFUSCanRemoteUserDisconnect@0 +_WinStationGetApplicationInfo@0 +_WinStationNotifyDisconnectPipe@0 +_WinStationNotifyLogoff@0 +_WinStationNotifyLogon@0 +_WinStationNotifyNewSession@0 +_WinStationReInitializeSecurity@0 +_WinStationReadRegistry@0 +_WinStationShadowTarget@0 +_WinStationShadowTargetSetup@0 +_WinStationUpdateClientCachedCredentials@0 +_WinStationUpdateSettings@0 +_WinStationUpdateUserConfig@0 +_WinStationWaitForConnect@0 +; EOF _____ Added: trunk/reactos/lib/winsta/winsta.h --- trunk/reactos/lib/winsta/winsta.h 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/winsta.h 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,7 @@ +#if !defined(_WINSTA_H) +#define _WINSTA_H + +#define WINSTASTUB(n) VOID STDCALL n (VOID) { } + +#endif /* !def _WINSTA_H */ + _____ Added: trunk/reactos/lib/winsta/winsta.rc --- trunk/reactos/lib/winsta/winsta.rc 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/winsta.rc 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS WinStation\0" +#define REACTOS_STR_INTERNAL_NAME "winsta\0" +#define REACTOS_STR_ORIGINAL_FILENAME "winsta.dll\0" +#include <reactos/version.rc> _____ Added: trunk/reactos/lib/winsta/ws.c --- trunk/reactos/lib/winsta/ws.c 2005-03-19 18:28:01 UTC (rev 14195) +++ trunk/reactos/lib/winsta/ws.c 2005-03-19 18:31:14 UTC (rev 14196) @@ -0,0 +1,80 @@ +/* $Id$ */ +#include <windows.h> +#include "winsta.h" + +WINSTASTUB(WinStationActivateLicense) +WINSTASTUB(WinStationAutoReconnect) +WINSTASTUB(WinStationBroadcastSystemMessage) +WINSTASTUB(WinStationCheckLoopBack) +WINSTASTUB(WinStationCloseServer) +WINSTASTUB(WinStationConnectA) +WINSTASTUB(WinStationConnectCallback) +WINSTASTUB(WinStationConnectW) +WINSTASTUB(WinStationDisconnect) +WINSTASTUB(WinStationEnumerateA) +WINSTASTUB(WinStationEnumerateLicenses) +WINSTASTUB(WinStationEnumerateProcesses) +WINSTASTUB(WinStationEnumerateW) +WINSTASTUB(WinStationEnumerate_IndexedA) +WINSTASTUB(WinStationEnumerate_IndexedW) +WINSTASTUB(WinStationFreeGAPMemory) +WINSTASTUB(WinStationFreeMemory) +WINSTASTUB(WinStationGenerateLicense) +WINSTASTUB(WinStationGetAllProcesses) +WINSTASTUB(WinStationGetLanAdapterNameA) +WINSTASTUB(WinStationGetLanAdapterNameW) +WINSTASTUB(WinStationGetMachinePolicy) +WINSTASTUB(WinStationGetProcessSid) +WINSTASTUB(WinStationGetTermSrvCountersValue) +WINSTASTUB(WinStationInstallLicense) +WINSTASTUB(WinStationIsHelpAssistantSession) +WINSTASTUB(WinStationNameFromLogonIdA) +WINSTASTUB(WinStationNameFromLogonIdW) +WINSTASTUB(WinStationNtsdDebug) +WINSTASTUB(WinStationOpenServerA) +WINSTASTUB(WinStationOpenServerW) +WINSTASTUB(WinStationQueryInformationA) +WINSTASTUB(WinStationQueryInformationW) +WINSTASTUB(WinStationQueryLicense) +WINSTASTUB(WinStationQueryLogonCredentialsW) +WINSTASTUB(WinStationQueryUpdateRequired) +WINSTASTUB(WinStationRegisterConsoleNotification) +WINSTASTUB(WinStationRemoveLicense) +WINSTASTUB(WinStationRenameA) +WINSTASTUB(WinStationRenameW) +WINSTASTUB(WinStationRequestSessionsList) +WINSTASTUB(WinStationReset) +WINSTASTUB(WinStationSendMessageA) +WINSTASTUB(WinStationSendMessageW) +WINSTASTUB(WinStationSendWindowMessage) +WINSTASTUB(WinStationServerPing) +WINSTASTUB(WinStationSetInformationA) +WINSTASTUB(WinStationSetInformationW) +WINSTASTUB(WinStationSetPoolCount) +WINSTASTUB(WinStationShadow) +WINSTASTUB(WinStationShadowStop) +WINSTASTUB(WinStationShutdownSystem) +WINSTASTUB(WinStationTerminateProcess) +WINSTASTUB(WinStationUnRegisterConsoleNotification) +WINSTASTUB(WinStationVirtualOpen) +WINSTASTUB(WinStationWaitSystemEvent) +WINSTASTUB(_WinStationAnnoyancePopup) +WINSTASTUB(_WinStationBeepOpen) +WINSTASTUB(_WinStationBreakPoint) +WINSTASTUB(_WinStationCallback) +WINSTASTUB(_WinStationCheckForApplicationName) +WINSTASTUB(_WinStationFUSCanRemoteUserDisconnect) +WINSTASTUB(_WinStationGetApplicationInfo) +WINSTASTUB(_WinStationNotifyDisconnectPipe) +WINSTASTUB(_WinStationNotifyLogoff) +WINSTASTUB(_WinStationNotifyLogon) +WINSTASTUB(_WinStationNotifyNewSession) +WINSTASTUB(_WinStationReInitializeSecurity) +WINSTASTUB(_WinStationReadRegistry) +WINSTASTUB(_WinStationShadowTarget) +WINSTASTUB(_WinStationShadowTargetSetup) +WINSTASTUB(_WinStationUpdateClientCachedCredentials) +WINSTASTUB(_WinStationUpdateSettings) +WINSTASTUB(_WinStationUpdateUserConfig) +WINSTASTUB(_WinStationWaitForConnect) +/* EOF */
19 years, 9 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200