winapi_ui_automation/shared/
d3d9.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! Direct3D include file
7use shared::basetsd::UINT32;
8use shared::d3d9caps::{D3DCAPS9, D3DCONTENTPROTECTIONCAPS, D3DOVERLAYCAPS};
9use shared::d3d9types::{
10    D3DADAPTER_IDENTIFIER9, D3DAUTHENTICATEDCHANNELTYPE, D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT,
11    D3DBACKBUFFER_TYPE, D3DBOX, D3DCLIPSTATUS9, D3DCOLOR, D3DCOMPOSERECTSOP, D3DCUBEMAP_FACES,
12    D3DDEVICE_CREATION_PARAMETERS, D3DDEVTYPE, D3DDISPLAYMODE, D3DDISPLAYMODEEX,
13    D3DDISPLAYMODEFILTER, D3DDISPLAYROTATION, D3DENCRYPTED_BLOCK_INFO, D3DFORMAT, D3DGAMMARAMP,
14    D3DINDEXBUFFER_DESC, D3DLIGHT9, D3DLOCKED_BOX, D3DLOCKED_RECT, D3DMATERIAL9, D3DMATRIX,
15    D3DMULTISAMPLE_TYPE, D3DPOOL, D3DPRESENTSTATS, D3DPRESENT_PARAMETERS, D3DPRIMITIVETYPE,
16    D3DQUERYTYPE, D3DRASTER_STATUS, D3DRECT, D3DRECTPATCH_INFO, D3DRENDERSTATETYPE,
17    D3DRESOURCETYPE, D3DSAMPLERSTATETYPE, D3DSTATEBLOCKTYPE, D3DSURFACE_DESC, D3DTEXTUREFILTERTYPE,
18    D3DTEXTURESTAGESTATETYPE, D3DTRANSFORMSTATETYPE, D3DTRIPATCH_INFO, D3DVERTEXBUFFER_DESC,
19    D3DVERTEXELEMENT9, D3DVIEWPORT9, D3DVOLUME_DESC,
20};
21use shared::guiddef::{GUID, IID};
22use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, UINT};
23use shared::windef::{HDC, HMONITOR, HWND, POINT, RECT};
24use um::unknwnbase::{IUnknown, IUnknownVtbl};
25use um::wingdi::{PALETTEENTRY, RGNDATA};
26use um::winnt::{HANDLE, HRESULT, LPCWSTR, LUID, VOID};
27pub const D3D_SDK_VERSION: DWORD = 32;
28pub const D3D9b_SDK_VERSION: DWORD = 31;
29DEFINE_GUID!{IID_IDirect3D9,
30    0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x01, 0x47, 0xf4, 0x27, 0x5c}
31DEFINE_GUID!{IID_IDirect3DDevice9,
32    0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0x0d, 0x82, 0xb9, 0xeb}
33DEFINE_GUID!{IID_IDirect3DResource9,
34    0x05eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x04}
35DEFINE_GUID!{IID_IDirect3DBaseTexture9,
36    0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce}
37DEFINE_GUID!{IID_IDirect3DTexture9,
38    0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5}
39DEFINE_GUID!{IID_IDirect3DCubeTexture9,
40    0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f}
41DEFINE_GUID!{IID_IDirect3DVolumeTexture9,
42    0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6}
43DEFINE_GUID!{IID_IDirect3DVertexBuffer9,
44    0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3}
45DEFINE_GUID!{IID_IDirect3DIndexBuffer9,
46    0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35}
47DEFINE_GUID!{IID_IDirect3DSurface9,
48    0x0cfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b}
49DEFINE_GUID!{IID_IDirect3DVolume9,
50    0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1}
51DEFINE_GUID!{IID_IDirect3DSwapChain9,
52    0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0x0b, 0x0b, 0x50, 0x3b}
53DEFINE_GUID!{IID_IDirect3DVertexDeclaration9,
54    0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46}
55DEFINE_GUID!{IID_IDirect3DVertexShader9,
56    0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36}
57DEFINE_GUID!{IID_IDirect3DPixelShader9,
58    0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89}
59DEFINE_GUID!{IID_IDirect3DStateBlock9,
60    0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0x0f, 0x20, 0x6f, 0x21, 0x8b}
61DEFINE_GUID!{IID_IDirect3DQuery9,
62    0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc}
63DEFINE_GUID!{IID_HelperName,
64    0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x04, 0xc0, 0x7f, 0x4c, 0xc8}
65DEFINE_GUID!{IID_IDirect3D9Ex,
66    0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d}
67DEFINE_GUID!{IID_IDirect3DDevice9Ex,
68    0xb18b10ce, 0x2649, 0x405a, 0x87, 0x0f, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a}
69DEFINE_GUID!{IID_IDirect3DSwapChain9Ex,
70    0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x03}
71DEFINE_GUID!{IID_IDirect3D9ExOverlayExtension,
72    0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x08, 0x8c, 0x0d, 0xf8}
73DEFINE_GUID!{IID_IDirect3DDevice9Video,
74    0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95}
75DEFINE_GUID!{IID_IDirect3DAuthenticatedChannel9,
76    0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9}
77DEFINE_GUID!{IID_IDirect3DCryptoSession9,
78    0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34}
79extern "system" {
80    pub fn Direct3DCreate9(
81        SDKVersion: UINT,
82    ) -> *mut IDirect3D9;
83    pub fn D3DPERF_BeginEvent(
84        col: D3DCOLOR,
85        wszName: LPCWSTR,
86    ) -> INT;
87    pub fn D3DPERF_EndEvent() -> INT;
88    pub fn D3DPERF_SetMarker(
89        col: D3DCOLOR,
90        wszName: LPCWSTR,
91    ) -> ();
92    pub fn D3DPERF_SetRegion(
93        col: D3DCOLOR,
94        wszName: LPCWSTR,
95    ) -> ();
96    pub fn D3DPERF_QueryRepeatFrame() -> BOOL;
97    pub fn D3DPERF_SetOptions(
98        dwOptions: DWORD,
99    ) -> ();
100    pub fn D3DPERF_GetStatus() -> DWORD;
101}
102RIDL!{#[uuid(0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c)]
103interface IDirect3D9(IDirect3D9Vtbl): IUnknown(IUnknownVtbl) {
104    fn RegisterSoftwareDevice(
105        pInitializeFunction: *mut VOID,
106    ) -> HRESULT,
107    fn GetAdapterCount() -> UINT,
108    fn GetAdapterIdentifier(
109        Adapter: UINT,
110        Flags: DWORD,
111        pIdentifier: *mut D3DADAPTER_IDENTIFIER9,
112    ) -> HRESULT,
113    fn GetAdapterModeCount(
114        Adapter: UINT,
115        Format: D3DFORMAT,
116    ) -> UINT,
117    fn EnumAdapterModes(
118        Adapter: UINT,
119        Format: D3DFORMAT,
120        Mode: UINT,
121        pMode: *mut D3DDISPLAYMODE,
122    ) -> HRESULT,
123    fn GetAdapterDisplayMode(
124        Adapter: UINT,
125        pMode: *mut D3DDISPLAYMODE,
126    ) -> HRESULT,
127    fn CheckDeviceType(
128        Adapter: UINT,
129        DevType: D3DDEVTYPE,
130        AdapterFormat: D3DFORMAT,
131        BackBufferFormat: D3DFORMAT,
132        bWindowed: BOOL,
133    ) -> HRESULT,
134    fn CheckDeviceFormat(
135        Adapter: UINT,
136        DeviceType: D3DDEVTYPE,
137        AdapterFormat: D3DFORMAT,
138        Usage: DWORD,
139        RType: D3DRESOURCETYPE,
140        CheckFormat: D3DFORMAT,
141    ) -> HRESULT,
142    fn CheckDeviceMultiSampleType(
143        Adapter: UINT,
144        DeviceType: D3DDEVTYPE,
145        SurfaceFormat: D3DFORMAT,
146        Windowed: BOOL,
147        MultiSampleType: D3DMULTISAMPLE_TYPE,
148        pQualityLevels: *mut DWORD,
149    ) -> HRESULT,
150    fn CheckDepthStencilMatch(
151        Adapter: UINT,
152        DeviceType: D3DDEVTYPE,
153        AdapterFormat: D3DFORMAT,
154        RenderTargetFormat: D3DFORMAT,
155        DepthStencilFormat: D3DFORMAT,
156    ) -> HRESULT,
157    fn CheckDeviceFormatConversion(
158        Adapter: UINT,
159        DeviceType: D3DDEVTYPE,
160        SourceFormat: D3DFORMAT,
161        TargetFormat: D3DFORMAT,
162    ) -> HRESULT,
163    fn GetDeviceCaps(
164        Adapter: UINT,
165        DeviceType: D3DDEVTYPE,
166        pCaps: *mut D3DCAPS9,
167    ) -> HRESULT,
168    fn GetAdapterMonitor(
169        Adapter: UINT,
170    ) -> HMONITOR,
171    fn CreateDevice(
172        Adapter: UINT,
173        DeviceType: D3DDEVTYPE,
174        hFocusWindow: HWND,
175        BehaviorFlags: DWORD,
176        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
177        ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9,
178    ) -> HRESULT,
179}}
180pub type LPDIRECT3D9 = *mut IDirect3D9;
181pub type PDIRECT3D9 = *mut IDirect3D9;
182RIDL!{#[uuid(0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb)]
183interface IDirect3DDevice9(IDirect3DDevice9Vtbl): IUnknown(IUnknownVtbl) {
184    fn TestCooperativeLevel() -> HRESULT,
185    fn GetAvailableTextureMem() -> UINT,
186    fn EvictManagedResources() -> HRESULT,
187    fn GetDirect3D(
188        ppD3D9: *mut *mut IDirect3D9,
189    ) -> HRESULT,
190    fn GetDeviceCaps(
191        pCaps: *mut D3DCAPS9,
192    ) -> HRESULT,
193    fn GetDisplayMode(
194        iSwapChain: UINT,
195        pMode: *mut D3DDISPLAYMODE,
196    ) -> HRESULT,
197    fn GetCreationParameters(
198        pParameters: *mut D3DDEVICE_CREATION_PARAMETERS,
199    ) -> HRESULT,
200    fn SetCursorProperties(
201        XHotSpot: UINT,
202        YHotSpot: UINT,
203        pCursorBitmap: *mut IDirect3DSurface9,
204    ) -> HRESULT,
205    fn SetCursorPosition(
206        X: INT,
207        Y: INT,
208        Flags: DWORD,
209    ) -> (),
210    fn ShowCursor(
211        bShow: BOOL,
212    ) -> BOOL,
213    fn CreateAdditionalSwapChain(
214        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
215        pSwapChain: *mut *mut IDirect3DSwapChain9,
216    ) -> HRESULT,
217    fn GetSwapChain(
218        iSwapChain: UINT,
219        pSwapChain: *mut *mut IDirect3DSwapChain9,
220    ) -> HRESULT,
221    fn GetNumberOfSwapChains() -> UINT,
222    fn Reset(
223        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
224    ) -> HRESULT,
225    fn Present(
226        pSourceRect: *const RECT,
227        pDestRect: *const RECT,
228        hDestWindowOverride: HWND,
229        pDirtyRegion: *const RGNDATA,
230    ) -> HRESULT,
231    fn GetBackBuffer(
232        iSwapChain: UINT,
233        iBackBuffer: UINT,
234        Type: D3DBACKBUFFER_TYPE,
235        ppBackBuffer: *mut *mut IDirect3DSurface9,
236    ) -> HRESULT,
237    fn GetRasterStatus(
238        iSwapChain: UINT,
239        pRasterStatus: *mut D3DRASTER_STATUS,
240    ) -> HRESULT,
241    fn SetDialogBoxMode(
242        bEnableDialogs: BOOL,
243    ) -> HRESULT,
244    fn SetGammaRamp(
245        iSwapChain: UINT,
246        Flags: DWORD,
247        pRamp: *const D3DGAMMARAMP,
248    ) -> (),
249    fn GetGammaRamp(
250        iSwapChain: UINT,
251        pRamp: *mut D3DGAMMARAMP,
252    ) -> (),
253    fn CreateTexture(
254        Width: UINT,
255        Height: UINT,
256        Levels: UINT,
257        Usage: DWORD,
258        Format: D3DFORMAT,
259        Pool: D3DPOOL,
260        ppTexture: *mut *mut IDirect3DTexture9,
261        pSharedHandle: *mut HANDLE,
262    ) -> HRESULT,
263    fn CreateVolumeTexture(
264        Width: UINT,
265        Height: UINT,
266        Depth: UINT,
267        Levels: UINT,
268        Usage: DWORD,
269        Format: D3DFORMAT,
270        Pool: D3DPOOL,
271        ppVolumeTexture: *mut *mut IDirect3DVolumeTexture9,
272        pSharedHandle: *mut HANDLE,
273    ) -> HRESULT,
274    fn CreateCubeTexture(
275        EdgeLength: UINT,
276        Levels: UINT,
277        Usage: DWORD,
278        Format: D3DFORMAT,
279        Pool: D3DPOOL,
280        ppCubeTexture: *mut *mut IDirect3DCubeTexture9,
281        pSharedHandle: *mut HANDLE,
282    ) -> HRESULT,
283    fn CreateVertexBuffer(
284        Length: UINT,
285        Usage: DWORD,
286        FVF: DWORD,
287        Pool: D3DPOOL,
288        ppVertexBuffer: *mut *mut IDirect3DVertexBuffer9,
289        pSharedHandle: *mut HANDLE,
290    ) -> HRESULT,
291    fn CreateIndexBuffer(
292        Length: UINT,
293        Usage: DWORD,
294        Format: D3DFORMAT,
295        Pool: D3DPOOL,
296        ppIndexBuffer: *mut *mut IDirect3DIndexBuffer9,
297        pSharedHandle: *mut HANDLE,
298    ) -> HRESULT,
299    fn CreateRenderTarget(
300        Width: UINT,
301        Height: UINT,
302        Format: D3DFORMAT,
303        MultiSample: D3DMULTISAMPLE_TYPE,
304        MultisampleQuality: DWORD,
305        Lockable: BOOL,
306        ppSurface: *mut *mut IDirect3DSurface9,
307        pSharedHandle: *mut HANDLE,
308    ) -> HRESULT,
309    fn CreateDepthStencilSurface(
310        Width: UINT,
311        Height: UINT,
312        Format: D3DFORMAT,
313        MultiSample: D3DMULTISAMPLE_TYPE,
314        MultisampleQuality: DWORD,
315        Discard: BOOL,
316        ppSurface: *mut *mut IDirect3DSurface9,
317        pSharedHandle: *mut HANDLE,
318    ) -> HRESULT,
319    fn UpdateSurface(
320        pSourceSurface: *mut IDirect3DSurface9,
321        pSourceRect: *const RECT,
322        pDestinationSurface: *mut IDirect3DSurface9,
323        pDestPoint: *const POINT,
324    ) -> HRESULT,
325    fn UpdateTexture(
326        pSourceTexture: *mut IDirect3DBaseTexture9,
327        pDestinationTexture: *mut IDirect3DBaseTexture9,
328    ) -> HRESULT,
329    fn GetRenderTargetData(
330        pRenderTarget: *mut IDirect3DSurface9,
331        pDestSurface: *mut IDirect3DSurface9,
332    ) -> HRESULT,
333    fn GetFrontBufferData(
334        iSwapChain: UINT,
335        pDestSurface: *mut IDirect3DSurface9,
336    ) -> HRESULT,
337    fn StretchRect(
338        pSourceSurface: *mut IDirect3DSurface9,
339        pSourceRect: *const RECT,
340        pDestSurface: *mut IDirect3DSurface9,
341        pDestRect: *const RECT,
342        Filter: D3DTEXTUREFILTERTYPE,
343    ) -> HRESULT,
344    fn ColorFill(
345        pSurface: *mut IDirect3DSurface9,
346        pRect: *const RECT,
347        color: D3DCOLOR,
348    ) -> HRESULT,
349    fn CreateOffscreenPlainSurface(
350        Width: UINT,
351        Height: UINT,
352        Format: D3DFORMAT,
353        Pool: D3DPOOL,
354        ppSurface: *mut *mut IDirect3DSurface9,
355        pSharedHandle: *mut HANDLE,
356    ) -> HRESULT,
357    fn SetRenderTarget(
358        RenderTargetIndex: DWORD,
359        pRenderTarget: *mut IDirect3DSurface9,
360    ) -> HRESULT,
361    fn GetRenderTarget(
362        RenderTargetIndex: DWORD,
363        ppRenderTarget: *mut *mut IDirect3DSurface9,
364    ) -> HRESULT,
365    fn SetDepthStencilSurface(
366        pNewZStencil: *mut IDirect3DSurface9,
367    ) -> HRESULT,
368    fn GetDepthStencilSurface(
369        ppZStencilSurface: *mut *mut IDirect3DSurface9,
370    ) -> HRESULT,
371    fn BeginScene() -> HRESULT,
372    fn EndScene() -> HRESULT,
373    fn Clear(
374        Count: DWORD,
375        pRects: *const D3DRECT,
376        Flags: DWORD,
377        Color: D3DCOLOR,
378        Z: FLOAT,
379        Stencil: DWORD,
380    ) -> HRESULT,
381    fn SetTransform(
382        State: D3DTRANSFORMSTATETYPE,
383        pMatrix: *const D3DMATRIX,
384    ) -> HRESULT,
385    fn GetTransform(
386        State: D3DTRANSFORMSTATETYPE,
387        pMatrix: *mut D3DMATRIX,
388    ) -> HRESULT,
389    fn MultiplyTransform(
390        arg1: D3DTRANSFORMSTATETYPE,
391        arg2: *const D3DMATRIX,
392    ) -> HRESULT,
393    fn SetViewport(
394        pViewport: *const D3DVIEWPORT9,
395    ) -> HRESULT,
396    fn GetViewport(
397        pViewport: *mut D3DVIEWPORT9,
398    ) -> HRESULT,
399    fn SetMaterial(
400        pMaterial: *const D3DMATERIAL9,
401    ) -> HRESULT,
402    fn GetMaterial(
403        pMaterial: *mut D3DMATERIAL9,
404    ) -> HRESULT,
405    fn SetLight(
406        Index: DWORD,
407        arg1: *const D3DLIGHT9,
408    ) -> HRESULT,
409    fn GetLight(
410        Index: DWORD,
411        arg1: *mut D3DLIGHT9,
412    ) -> HRESULT,
413    fn LightEnable(
414        Index: DWORD,
415        Enable: BOOL,
416    ) -> HRESULT,
417    fn GetLightEnable(
418        Index: DWORD,
419        pEnable: *mut BOOL,
420    ) -> HRESULT,
421    fn SetClipPlane(
422        Index: DWORD,
423        pPlane: *const FLOAT,
424    ) -> HRESULT,
425    fn GetClipPlane(
426        Index: DWORD,
427        pPlane: *mut FLOAT,
428    ) -> HRESULT,
429    fn SetRenderState(
430        State: D3DRENDERSTATETYPE,
431        Value: DWORD,
432    ) -> HRESULT,
433    fn GetRenderState(
434        State: D3DRENDERSTATETYPE,
435        pValue: *mut DWORD,
436    ) -> HRESULT,
437    fn CreateStateBlock(
438        Type: D3DSTATEBLOCKTYPE,
439        ppSB: *mut *mut IDirect3DStateBlock9,
440    ) -> HRESULT,
441    fn BeginStateBlock() -> HRESULT,
442    fn EndStateBlock(
443        ppSB: *mut *mut IDirect3DStateBlock9,
444    ) -> HRESULT,
445    fn SetClipStatus(
446        pClipStatus: *const D3DCLIPSTATUS9,
447    ) -> HRESULT,
448    fn GetClipStatus(
449        pClipStatus: *mut D3DCLIPSTATUS9,
450    ) -> HRESULT,
451    fn GetTexture(
452        Stage: DWORD,
453        ppTexture: *mut *mut IDirect3DBaseTexture9,
454    ) -> HRESULT,
455    fn SetTexture(
456        Stage: DWORD,
457        pTexture: *mut IDirect3DBaseTexture9,
458    ) -> HRESULT,
459    fn GetTextureStageState(
460        Stage: DWORD,
461        Type: D3DTEXTURESTAGESTATETYPE,
462        pValue: *mut DWORD,
463    ) -> HRESULT,
464    fn SetTextureStageState(
465        Stage: DWORD,
466        Type: D3DTEXTURESTAGESTATETYPE,
467        Value: DWORD,
468    ) -> HRESULT,
469    fn GetSamplerState(
470        Sampler: DWORD,
471        Type: D3DSAMPLERSTATETYPE,
472        pValue: *mut DWORD,
473    ) -> HRESULT,
474    fn SetSamplerState(
475        Sampler: DWORD,
476        Type: D3DSAMPLERSTATETYPE,
477        Value: DWORD,
478    ) -> HRESULT,
479    fn ValidateDevice(
480        pNumPasses: *mut DWORD,
481    ) -> HRESULT,
482    fn SetPaletteEntries(
483        PaletteNumber: UINT,
484        pEntries: *const PALETTEENTRY,
485    ) -> HRESULT,
486    fn GetPaletteEntries(
487        PaletteNumber: UINT,
488        pEntries: *mut PALETTEENTRY,
489    ) -> HRESULT,
490    fn SetCurrentTexturePalette(
491        PaletteNumber: UINT,
492    ) -> HRESULT,
493    fn GetCurrentTexturePalette(
494        PaletteNumber: *mut UINT,
495    ) -> HRESULT,
496    fn SetScissorRect(
497        pRect: *const RECT,
498    ) -> HRESULT,
499    fn GetScissorRect(
500        pRect: *mut RECT,
501    ) -> HRESULT,
502    fn SetSoftwareVertexProcessing(
503        bSoftware: BOOL,
504    ) -> HRESULT,
505    fn GetSoftwareVertexProcessing() -> BOOL,
506    fn SetNPatchMode(
507        nSegments: FLOAT,
508    ) -> HRESULT,
509    fn GetNPatchMode() -> FLOAT,
510    fn DrawPrimitive(
511        PrimitiveType: D3DPRIMITIVETYPE,
512        StartVertex: UINT,
513        PrimitiveCount: UINT,
514    ) -> HRESULT,
515    fn DrawIndexedPrimitive(
516        arg1: D3DPRIMITIVETYPE,
517        BaseVertexIndex: INT,
518        MinVertexIndex: UINT,
519        NumVertices: UINT,
520        startIndex: UINT,
521        primCount: UINT,
522    ) -> HRESULT,
523    fn DrawPrimitiveUP(
524        PrimitiveType: D3DPRIMITIVETYPE,
525        PrimitiveCount: UINT,
526        pVertexStreamZeroData: *const VOID,
527        VertexStreamZeroStride: UINT,
528    ) -> HRESULT,
529    fn DrawIndexedPrimitiveUP(
530        PrimitiveType: D3DPRIMITIVETYPE,
531        MinVertexIndex: UINT,
532        NumVertices: UINT,
533        PrimitiveCount: UINT,
534        pIndexData: *const VOID,
535        IndexDataFormat: D3DFORMAT,
536        pVertexStreamZeroData: *const VOID,
537        VertexStreamZeroStride: UINT,
538    ) -> HRESULT,
539    fn ProcessVertices(
540        SrcStartIndex: UINT,
541        DestIndex: UINT,
542        VertexCount: UINT,
543        pDestBuffer: *mut IDirect3DVertexBuffer9,
544        pVertexDecl: *mut IDirect3DVertexDeclaration9,
545        Flags: DWORD,
546    ) -> HRESULT,
547    fn CreateVertexDeclaration(
548        pVertexElements: *const D3DVERTEXELEMENT9,
549        ppDecl: *mut *mut IDirect3DVertexDeclaration9,
550    ) -> HRESULT,
551    fn SetVertexDeclaration(
552        pDecl: *mut IDirect3DVertexDeclaration9,
553    ) -> HRESULT,
554    fn GetVertexDeclaration(
555        ppDecl: *mut *mut IDirect3DVertexDeclaration9,
556    ) -> HRESULT,
557    fn SetFVF(
558        FVF: DWORD,
559    ) -> HRESULT,
560    fn GetFVF(
561        pFVF: *mut DWORD,
562    ) -> HRESULT,
563    fn CreateVertexShader(
564        pFunction: *const DWORD,
565        ppShader: *mut *mut IDirect3DVertexShader9,
566    ) -> HRESULT,
567    fn SetVertexShader(
568        pShader: *mut IDirect3DVertexShader9,
569    ) -> HRESULT,
570    fn GetVertexShader(
571        ppShader: *mut *mut IDirect3DVertexShader9,
572    ) -> HRESULT,
573    fn SetVertexShaderConstantF(
574        StartRegister: UINT,
575        pConstantData: *const FLOAT,
576        Vector4fCount: UINT,
577    ) -> HRESULT,
578    fn GetVertexShaderConstantF(
579        StartRegister: UINT,
580        pConstantData: *mut FLOAT,
581        Vector4fCount: UINT,
582    ) -> HRESULT,
583    fn SetVertexShaderConstantI(
584        StartRegister: UINT,
585        pConstantData: *const INT,
586        Vector4iCount: UINT,
587    ) -> HRESULT,
588    fn GetVertexShaderConstantI(
589        StartRegister: UINT,
590        pConstantData: *mut INT,
591        Vector4iCount: UINT,
592    ) -> HRESULT,
593    fn SetVertexShaderConstantB(
594        StartRegister: UINT,
595        pConstantData: *const BOOL,
596        BoolCount: UINT,
597    ) -> HRESULT,
598    fn GetVertexShaderConstantB(
599        StartRegister: UINT,
600        pConstantData: *mut BOOL,
601        BoolCount: UINT,
602    ) -> HRESULT,
603    fn SetStreamSource(
604        StreamNumber: UINT,
605        pStreamData: *mut IDirect3DVertexBuffer9,
606        OffsetInBytes: UINT,
607        Stride: UINT,
608    ) -> HRESULT,
609    fn GetStreamSource(
610        StreamNumber: UINT,
611        ppStreamData: *mut *mut IDirect3DVertexBuffer9,
612        pOffsetInBytes: *mut UINT,
613        pStride: *mut UINT,
614    ) -> HRESULT,
615    fn SetStreamSourceFreq(
616        StreamNumber: UINT,
617        Setting: UINT,
618    ) -> HRESULT,
619    fn GetStreamSourceFreq(
620        StreamNumber: UINT,
621        pSetting: *mut UINT,
622    ) -> HRESULT,
623    fn SetIndices(
624        pIndexData: *mut IDirect3DIndexBuffer9,
625    ) -> HRESULT,
626    fn GetIndices(
627        ppIndexData: *mut *mut IDirect3DIndexBuffer9,
628    ) -> HRESULT,
629    fn CreatePixelShader(
630        pFunction: *const DWORD,
631        ppShader: *mut *mut IDirect3DPixelShader9,
632    ) -> HRESULT,
633    fn SetPixelShader(
634        pShader: *mut IDirect3DPixelShader9,
635    ) -> HRESULT,
636    fn GetPixelShader(
637        ppShader: *mut *mut IDirect3DPixelShader9,
638    ) -> HRESULT,
639    fn SetPixelShaderConstantF(
640        StartRegister: UINT,
641        pConstantData: *const FLOAT,
642        Vector4fCount: UINT,
643    ) -> HRESULT,
644    fn GetPixelShaderConstantF(
645        StartRegister: UINT,
646        pConstantData: *mut FLOAT,
647        Vector4fCount: UINT,
648    ) -> HRESULT,
649    fn SetPixelShaderConstantI(
650        StartRegister: UINT,
651        pConstantData: *const INT,
652        Vector4iCount: UINT,
653    ) -> HRESULT,
654    fn GetPixelShaderConstantI(
655        StartRegister: UINT,
656        pConstantData: *mut INT,
657        Vector4iCount: UINT,
658    ) -> HRESULT,
659    fn SetPixelShaderConstantB(
660        StartRegister: UINT,
661        pConstantData: *const BOOL,
662        BoolCount: UINT,
663    ) -> HRESULT,
664    fn GetPixelShaderConstantB(
665        StartRegister: UINT,
666        pConstantData: *mut BOOL,
667        BoolCount: UINT,
668    ) -> HRESULT,
669    fn DrawRectPatch(
670        Handle: UINT,
671        pNumSegs: *const FLOAT,
672        pRectPatchInfo: *const D3DRECTPATCH_INFO,
673    ) -> HRESULT,
674    fn DrawTriPatch(
675        Handle: UINT,
676        pNumSegs: *const FLOAT,
677        pTriPatchInfo: *const D3DTRIPATCH_INFO,
678    ) -> HRESULT,
679    fn DeletePatch(
680        Handle: UINT,
681    ) -> HRESULT,
682    fn CreateQuery(
683        Type: D3DQUERYTYPE,
684        ppQuery: *mut *mut IDirect3DQuery9,
685    ) -> HRESULT,
686}}
687pub type LPDIRECT3DDEVICE9 = *mut IDirect3DDevice9;
688pub type PDIRECT3DDEVICE9 = *mut IDirect3DDevice9;
689RIDL!{#[uuid(0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b)]
690interface IDirect3DStateBlock9(IDirect3DStateBlock9Vtbl): IUnknown(IUnknownVtbl) {
691    fn GetDevice(
692        ppDevice: *mut *mut IDirect3DDevice9,
693    ) -> HRESULT,
694    fn Capture() -> HRESULT,
695    fn Apply() -> HRESULT,
696}}
697pub type LPDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9;
698pub type PDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9;
699RIDL!{#[uuid(0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b)]
700interface IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl): IUnknown(IUnknownVtbl) {
701    fn Present(
702        pSourceRect: *const RECT,
703        pDestRect: *const RECT,
704        hDestWindowOverride: HWND,
705        pDirtyRegion: *const RGNDATA,
706        dwFlags: DWORD,
707    ) -> HRESULT,
708    fn GetFrontBufferData(
709        pDestSurface: *mut IDirect3DSurface9,
710    ) -> HRESULT,
711    fn GetBackBuffer(
712        iBackBuffer: UINT,
713        Type: D3DBACKBUFFER_TYPE,
714        ppBackBuffer: *mut *mut IDirect3DSurface9,
715    ) -> HRESULT,
716    fn GetRasterStatus(
717        pRasterStatus: *mut D3DRASTER_STATUS,
718    ) -> HRESULT,
719    fn GetDisplayMode(
720        pMode: *mut D3DDISPLAYMODE,
721    ) -> HRESULT,
722    fn GetDevice(
723        ppDevice: *mut *mut IDirect3DDevice9,
724    ) -> HRESULT,
725    fn GetPresentParameters(
726        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
727    ) -> HRESULT,
728}}
729pub type LPDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9;
730pub type PDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9;
731RIDL!{#[uuid(0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4)]
732interface IDirect3DResource9(IDirect3DResource9Vtbl): IUnknown(IUnknownVtbl) {
733    fn GetDevice(
734        ppDevice: *mut *mut IDirect3DDevice9,
735    ) -> HRESULT,
736    fn SetPrivateData(
737        refguid: *const GUID,
738        pData: *const VOID,
739        SizeOfData: DWORD,
740        Flags: DWORD,
741    ) -> HRESULT,
742    fn GetPrivateData(
743        refguid: *const GUID,
744        pData: *mut VOID,
745        pSizeOfData: *mut DWORD,
746    ) -> HRESULT,
747    fn FreePrivateData(
748        refguid: *const GUID,
749    ) -> HRESULT,
750    fn SetPriority(
751        PriorityNew: DWORD,
752    ) -> DWORD,
753    fn GetPriority() -> DWORD,
754    fn PreLoad() -> (),
755    fn GetType() -> D3DRESOURCETYPE,
756}}
757pub type LPDIRECT3DRESOURCE9 = *mut IDirect3DResource9;
758pub type PDIRECT3DRESOURCE9 = *mut IDirect3DResource9;
759RIDL!{#[uuid(0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46)]
760interface IDirect3DVertexDeclaration9(IDirect3DVertexDeclaration9Vtbl): IUnknown(IUnknownVtbl) {
761    fn GetDevice(
762        ppDevice: *mut *mut IDirect3DDevice9,
763    ) -> HRESULT,
764    fn GetDeclaration(
765        pElement: *mut D3DVERTEXELEMENT9,
766        pNumElements: *mut UINT,
767    ) -> HRESULT,
768}}
769pub type LPDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9;
770pub type PDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9;
771RIDL!{#[uuid(0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36)]
772interface IDirect3DVertexShader9(IDirect3DVertexShader9Vtbl): IUnknown(IUnknownVtbl) {
773    fn GetDevice(
774        ppDevice: *mut *mut IDirect3DDevice9,
775    ) -> HRESULT,
776    fn GetFunction(
777        arg1: *mut VOID,
778        pSizeOfData: *mut UINT,
779    ) -> HRESULT,
780}}
781pub type LPDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9;
782pub type PDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9;
783RIDL!{#[uuid(0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89)]
784interface IDirect3DPixelShader9(IDirect3DPixelShader9Vtbl): IUnknown(IUnknownVtbl) {
785    fn GetDevice(
786        ppDevice: *mut *mut IDirect3DDevice9,
787    ) -> HRESULT,
788    fn GetFunction(
789        arg1: *mut VOID,
790        pSizeOfData: *mut UINT,
791    ) -> HRESULT,
792}}
793pub type LPDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9;
794pub type PDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9;
795RIDL!{#[uuid(0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce)]
796interface IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl):
797    IDirect3DResource9(IDirect3DResource9Vtbl) {
798    fn SetLOD(
799        LODNew: DWORD,
800    ) -> DWORD,
801    fn GetLOD() -> DWORD,
802    fn GetLevelCount() -> DWORD,
803    fn SetAutoGenFilterType(
804        FilterType: D3DTEXTUREFILTERTYPE,
805    ) -> HRESULT,
806    fn GetAutoGenFilterType() -> D3DTEXTUREFILTERTYPE,
807    fn GenerateMipSubLevels() -> (),
808}}
809pub type LPDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9;
810pub type PDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9;
811RIDL!{#[uuid(0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5)]
812interface IDirect3DTexture9(IDirect3DTexture9Vtbl):
813    IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
814    fn GetLevelDesc(
815        Level: UINT,
816        pDesc: *mut D3DSURFACE_DESC,
817    ) -> HRESULT,
818    fn GetSurfaceLevel(
819        Level: UINT,
820        ppSurfaceLevel: *mut *mut IDirect3DSurface9,
821    ) -> HRESULT,
822    fn LockRect(
823        Level: UINT,
824        pLockedRect: *mut D3DLOCKED_RECT,
825        pRect: *const RECT,
826        Flags: DWORD,
827    ) -> HRESULT,
828    fn UnlockRect(
829        Level: UINT,
830    ) -> HRESULT,
831    fn AddDirtyRect(
832        pDirtyRect: *const RECT,
833    ) -> HRESULT,
834}}
835pub type LPDIRECT3DTEXTURE9 = *mut IDirect3DTexture9;
836pub type PDIRECT3DTEXTURE9 = *mut IDirect3DTexture9;
837RIDL!{#[uuid(0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6)]
838interface IDirect3DVolumeTexture9(IDirect3DVolumeTexture9Vtbl):
839    IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
840    fn GetLevelDesc(
841        Level: UINT,
842        pDesc: *mut D3DVOLUME_DESC,
843    ) -> HRESULT,
844    fn GetVolumeLevel(
845        Level: UINT,
846        ppVolumeLevel: *mut *mut IDirect3DVolume9,
847    ) -> HRESULT,
848    fn LockBox(
849        Level: UINT,
850        pLockedVolume: *mut D3DLOCKED_BOX,
851        pBox: *const D3DBOX,
852        Flags: DWORD,
853    ) -> HRESULT,
854    fn UnlockBox(
855        Level: UINT,
856    ) -> HRESULT,
857    fn AddDirtyBox(
858        pDirtyBox: *const D3DBOX,
859    ) -> HRESULT,
860}}
861pub type LPDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9;
862pub type PDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9;
863RIDL!{#[uuid(0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f)]
864interface IDirect3DCubeTexture9(IDirect3DCubeTexture9Vtbl):
865    IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
866    fn GetLevelDesc(
867        Level: UINT,
868        pDesc: *mut D3DSURFACE_DESC,
869    ) -> HRESULT,
870    fn GetCubeMapSurface(
871        FaceType: D3DCUBEMAP_FACES,
872        Level: UINT,
873        ppCubeMapSurface: *mut *mut IDirect3DSurface9,
874    ) -> HRESULT,
875    fn LockRect(
876        FaceType: D3DCUBEMAP_FACES,
877        Level: UINT,
878        pLockedRect: *mut D3DLOCKED_RECT,
879        pRect: *const RECT,
880        Flags: DWORD,
881    ) -> HRESULT,
882    fn UnlockRect(
883        FaceType: D3DCUBEMAP_FACES,
884        Level: UINT,
885    ) -> HRESULT,
886    fn AddDirtyRect(
887        FaceType: D3DCUBEMAP_FACES,
888        pDirtyRect: *const RECT,
889    ) -> HRESULT,
890}}
891pub type LPDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9;
892pub type PDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9;
893RIDL!{#[uuid(0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3)]
894interface IDirect3DVertexBuffer9(IDirect3DVertexBuffer9Vtbl):
895    IDirect3DResource9(IDirect3DResource9Vtbl) {
896    fn Lock(
897        OffsetToLock: UINT,
898        SizeToLock: UINT,
899        ppbData: *mut *mut VOID,
900        Flags: DWORD,
901    ) -> HRESULT,
902    fn Unlock() -> HRESULT,
903    fn GetDesc(
904        pDesc: *mut D3DVERTEXBUFFER_DESC,
905    ) -> HRESULT,
906}}
907pub type LPDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9;
908pub type PDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9;
909RIDL!{#[uuid(0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35)]
910interface IDirect3DIndexBuffer9(IDirect3DIndexBuffer9Vtbl):
911    IDirect3DResource9(IDirect3DResource9Vtbl) {
912    fn Lock(
913        OffsetToLock: UINT,
914        SizeToLock: UINT,
915        ppbData: *mut *mut VOID,
916        Flags: DWORD,
917    ) -> HRESULT,
918    fn Unlock() -> HRESULT,
919    fn GetDesc(
920        pDesc: *mut D3DINDEXBUFFER_DESC,
921    ) -> HRESULT,
922}}
923pub type LPDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9;
924pub type PDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9;
925RIDL!{#[uuid(0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b)]
926interface IDirect3DSurface9(IDirect3DSurface9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) {
927    fn GetContainer(
928        riid: *const IID,
929        ppContainer: *mut *mut VOID,
930    ) -> HRESULT,
931    fn GetDesc(
932        pDesc: *mut D3DSURFACE_DESC,
933    ) -> HRESULT,
934    fn LockRect(
935        pLockedRect: *mut D3DLOCKED_RECT,
936        pRect: *const RECT,
937        Flags: DWORD,
938    ) -> HRESULT,
939    fn UnlockRect() -> HRESULT,
940    fn GetDC(
941        phdc: *mut HDC,
942    ) -> HRESULT,
943    fn ReleaseDC(
944        hdc: HDC,
945    ) -> HRESULT,
946}}
947pub type LPDIRECT3DSURFACE9 = *mut IDirect3DSurface9;
948pub type PDIRECT3DSURFACE9 = *mut IDirect3DSurface9;
949RIDL!{#[uuid(0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1)]
950interface IDirect3DVolume9(IDirect3DVolume9Vtbl): IUnknown(IUnknownVtbl) {
951    fn GetDevice(
952        ppDevice: *mut *mut IDirect3DDevice9,
953    ) -> HRESULT,
954    fn SetPrivateData(
955        refguid: *const GUID,
956        pData: *const VOID,
957        SizeOfData: DWORD,
958        Flags: DWORD,
959    ) -> HRESULT,
960    fn GetPrivateData(
961        refguid: *const GUID,
962        pData: *mut VOID,
963        pSizeOfData: *mut DWORD,
964    ) -> HRESULT,
965    fn FreePrivateData(
966        refguid: *const GUID,
967    ) -> HRESULT,
968    fn GetContainer(
969        riid: *const IID,
970        ppContainer: *mut *mut VOID,
971    ) -> HRESULT,
972    fn GetDesc(
973        pDesc: *mut D3DVOLUME_DESC,
974    ) -> HRESULT,
975    fn LockBox(
976        pLockedVolume: *mut D3DLOCKED_BOX,
977        pBox: *const D3DBOX,
978        Flags: DWORD,
979    ) -> HRESULT,
980    fn UnlockBox() -> HRESULT,
981}}
982pub type LPDIRECT3DVOLUME9 = *mut IDirect3DVolume9;
983pub type PDIRECT3DVOLUME9 = *mut IDirect3DVolume9;
984RIDL!{#[uuid(0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc)]
985interface IDirect3DQuery9(IDirect3DQuery9Vtbl): IUnknown(IUnknownVtbl) {
986    fn GetDevice(
987        ppDevice: *mut *mut IDirect3DDevice9,
988    ) -> HRESULT,
989    fn GetType() -> D3DRESOURCETYPE,
990    fn GetDataSize() -> DWORD,
991    fn Issue(
992        dwIssueFlags: DWORD,
993    ) -> HRESULT,
994    fn GetData(
995        pData: *mut VOID,
996        dwSize: DWORD,
997        dwGetDataFlags: DWORD,
998    ) -> HRESULT,
999}}
1000pub type LPDIRECT3DQUERY9 = *mut IDirect3DQuery9;
1001pub type PDIRECT3DQUERY9 = *mut IDirect3DQuery9;
1002pub const D3DCREATE_FPU_PRESERVE: DWORD = 0x2;
1003pub const D3DCREATE_MULTITHREADED: DWORD = 0x4;
1004pub const D3DCREATE_PUREDEVICE: DWORD = 0x10;
1005pub const D3DCREATE_SOFTWARE_VERTEXPROCESSING: DWORD = 0x20;
1006pub const D3DCREATE_HARDWARE_VERTEXPROCESSING: DWORD = 0x40;
1007pub const D3DCREATE_MIXED_VERTEXPROCESSING: DWORD = 0x80;
1008pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT: DWORD = 0x100;
1009pub const D3DCREATE_ADAPTERGROUP_DEVICE: DWORD = 0x200;
1010pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX: DWORD = 0x400;
1011pub const D3DCREATE_NOWINDOWCHANGES: DWORD = 0x800;
1012pub const D3DCREATE_DISABLE_PSGP_THREADING: DWORD = 0x2000;
1013pub const D3DCREATE_ENABLE_PRESENTSTATS: DWORD = 0x4000;
1014pub const D3DCREATE_DISABLE_PRESENTSTATS: DWORD = 0x8000;
1015pub const D3DCREATE_SCREENSAVER: DWORD = 0x10000000;
1016pub const D3DADAPTER_DEFAULT: DWORD = 0;
1017extern "system" {
1018    pub fn Direct3DCreate9Ex(
1019        SDKVersion: UINT,
1020        arg1: *mut *mut IDirect3D9Ex,
1021    ) -> HRESULT;
1022}
1023RIDL!{#[uuid(0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d)]
1024interface IDirect3D9Ex(IDirect3D9ExVtbl): IDirect3D9(IDirect3D9Vtbl) {
1025    fn GetAdapterModeCountEx(
1026        Adapter: UINT,
1027        pFilter: *const D3DDISPLAYMODEFILTER,
1028    ) -> UINT,
1029    fn EnumAdapterModesEx(
1030        Adapter: UINT,
1031        pFilter: *const D3DDISPLAYMODEFILTER,
1032        Mode: UINT,
1033        pMode: *mut D3DDISPLAYMODEEX,
1034    ) -> HRESULT,
1035    fn GetAdapterDisplayModeEx(
1036        Adapter: UINT,
1037        pMode: *mut D3DDISPLAYMODEEX,
1038        pRotation: *mut D3DDISPLAYROTATION,
1039    ) -> HRESULT,
1040    fn CreateDeviceEx(
1041        Adapter: UINT,
1042        DeviceType: D3DDEVTYPE,
1043        hFocusWindow: HWND,
1044        BehaviorFlags: DWORD,
1045        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
1046        pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX,
1047        ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9Ex,
1048    ) -> HRESULT,
1049    fn GetAdapterLUID(
1050        Adapter: UINT,
1051        pLUID: *mut LUID,
1052    ) -> HRESULT,
1053}}
1054pub type LPDIRECT3D9EX = *mut IDirect3D9Ex;
1055pub type PDIRECT3D9EX = *mut IDirect3D9Ex;
1056RIDL!{#[uuid(0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a)]
1057interface IDirect3DDevice9Ex(IDirect3DDevice9ExVtbl): IDirect3DDevice9(IDirect3DDevice9Vtbl) {
1058    fn SetConvolutionMonoKernel(
1059        width: UINT,
1060        height: UINT,
1061        rows: *mut FLOAT,
1062        columns: *mut FLOAT,
1063    ) -> HRESULT,
1064    fn ComposeRects(
1065        pSrc: *mut IDirect3DSurface9,
1066        pDst: *mut IDirect3DSurface9,
1067        pSrcRectDescs: *mut IDirect3DVertexBuffer9,
1068        NumRects: UINT,
1069        pDstRectDescs: *mut IDirect3DVertexBuffer9,
1070        Operation: D3DCOMPOSERECTSOP,
1071        Xoffset: INT,
1072        Yoffset: INT,
1073    ) -> HRESULT,
1074    fn PresentEx(
1075        pSourceRect: *const RECT,
1076        pDestRect: *const RECT,
1077        hDestWindowOverride: HWND,
1078        pDirtyRegion: *const RGNDATA,
1079        dwFlags: DWORD,
1080    ) -> HRESULT,
1081    fn GetGPUThreadPriority(
1082        pPriority: *mut INT,
1083    ) -> HRESULT,
1084    fn SetGPUThreadPriority(
1085        Priority: INT,
1086    ) -> HRESULT,
1087    fn WaitForVBlank(
1088        iSwapChain: UINT,
1089    ) -> HRESULT,
1090    fn CheckResourceResidency(
1091        pResourceArray: *mut *mut IDirect3DResource9,
1092        NumResources: UINT32,
1093    ) -> HRESULT,
1094    fn SetMaximumFrameLatency(
1095        MaxLatency: UINT,
1096    ) -> HRESULT,
1097    fn GetMaximumFrameLatency(
1098        pMaxLatency: *mut UINT,
1099    ) -> HRESULT,
1100    fn CheckDeviceState(
1101        hDestinationWindow: HWND,
1102    ) -> HRESULT,
1103    fn CreateRenderTargetEx(
1104        Width: UINT,
1105        Height: UINT,
1106        Format: D3DFORMAT,
1107        MultiSample: D3DMULTISAMPLE_TYPE,
1108        MultisampleQuality: DWORD,
1109        Lockable: BOOL,
1110        ppSurface: *mut *mut IDirect3DSurface9,
1111        pSharedHandle: *mut HANDLE,
1112        Usage: DWORD,
1113    ) -> HRESULT,
1114    fn CreateOffscreenPlainSurfaceEx(
1115        Width: UINT,
1116        Height: UINT,
1117        Format: D3DFORMAT,
1118        Pool: D3DPOOL,
1119        ppSurface: *mut *mut IDirect3DSurface9,
1120        pSharedHandle: *mut HANDLE,
1121        Usage: DWORD,
1122    ) -> HRESULT,
1123    fn CreateDepthStencilSurfaceEx(
1124        Width: UINT,
1125        Height: UINT,
1126        Format: D3DFORMAT,
1127        MultiSample: D3DMULTISAMPLE_TYPE,
1128        MultisampleQuality: DWORD,
1129        Discard: BOOL,
1130        ppSurface: *mut *mut IDirect3DSurface9,
1131        pSharedHandle: *mut HANDLE,
1132        Usage: DWORD,
1133    ) -> HRESULT,
1134    fn ResetEx(
1135        pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
1136        pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX,
1137    ) -> HRESULT,
1138    fn GetDisplayModeEx(
1139        iSwapChain: UINT,
1140        pMode: *mut D3DDISPLAYMODEEX,
1141        pRotation: *mut D3DDISPLAYROTATION,
1142    ) -> HRESULT,
1143}}
1144pub type LPDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex;
1145pub type PDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex;
1146RIDL!{#[uuid(0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3)]
1147interface IDirect3DSwapChain9Ex(IDirect3DSwapChain9ExVtbl):
1148    IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl) {
1149    fn GetLastPresentCount(
1150        pLastPresentCount: *mut UINT,
1151    ) -> HRESULT,
1152    fn GetPresentStats(
1153        pPresentationStatistics: *mut D3DPRESENTSTATS,
1154    ) -> HRESULT,
1155    fn GetDisplayModeEx(
1156        pMode: *mut D3DDISPLAYMODEEX,
1157        pRotation: *mut D3DDISPLAYROTATION,
1158    ) -> HRESULT,
1159}}
1160pub type LPDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex;
1161pub type PDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex;
1162RIDL!{#[uuid(0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8)]
1163interface IDirect3D9ExOverlayExtension(IDirect3D9ExOverlayExtensionVtbl): IUnknown(IUnknownVtbl) {
1164    fn CheckDeviceOverlayType(
1165        Adapter: UINT,
1166        DevType: D3DDEVTYPE,
1167        OverlayWidth: UINT,
1168        OverlayHeight: UINT,
1169        OverlayFormat: D3DFORMAT,
1170        pDisplayMode: *mut D3DDISPLAYMODEEX,
1171        DisplayRotation: D3DDISPLAYROTATION,
1172        pOverlayCaps: *mut D3DOVERLAYCAPS,
1173    ) -> HRESULT,
1174}}
1175pub type LPDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension;
1176pub type PDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension;
1177RIDL!{#[uuid(0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95)]
1178interface IDirect3DDevice9Video(IDirect3DDevice9VideoVtbl): IUnknown(IUnknownVtbl) {
1179    fn GetContentProtectionCaps(
1180        pCryptoType: *const GUID,
1181        pDecodeProfile: *const GUID,
1182        pCaps: *mut D3DCONTENTPROTECTIONCAPS,
1183    ) -> HRESULT,
1184    fn CreateAuthenticatedChannel(
1185        ChannelType: D3DAUTHENTICATEDCHANNELTYPE,
1186        ppAuthenticatedChannel: *mut *mut IDirect3DAuthenticatedChannel9,
1187        pChannelHandle: *mut HANDLE,
1188    ) -> HRESULT,
1189    fn CreateCryptoSession(
1190        pCryptoType: *const GUID,
1191        pDecodeProfile: *const GUID,
1192        ppCryptoSession: *mut *mut IDirect3DCryptoSession9,
1193        pCryptoHandle: *mut HANDLE,
1194    ) -> HRESULT,
1195}}
1196pub type LPDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video;
1197pub type PDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video;
1198RIDL!{#[uuid(0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9)]
1199interface IDirect3DAuthenticatedChannel9(IDirect3DAuthenticatedChannel9Vtbl):
1200    IUnknown(IUnknownVtbl) {
1201    fn GetCertificateSize(
1202        pCertificateSize: *mut UINT,
1203    ) -> HRESULT,
1204    fn GetCertificate(
1205        CertifacteSize: UINT,
1206        ppCertificate: *mut BYTE,
1207    ) -> HRESULT,
1208    fn NegotiateKeyExchange(
1209        DataSize: UINT,
1210        pData: *mut VOID,
1211    ) -> HRESULT,
1212    fn Query(
1213        InputSize: UINT,
1214        pInput: *const VOID,
1215        OutputSize: UINT,
1216        pOutput: *mut VOID,
1217    ) -> HRESULT,
1218    fn Configure(
1219        InputSize: UINT,
1220        pInput: *const VOID,
1221        pOutput: *mut D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT,
1222    ) -> HRESULT,
1223}}
1224pub type LPDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9;
1225pub type PDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9;
1226RIDL!{#[uuid(0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34)]
1227interface IDirect3DCryptoSession9(IDirect3DCryptoSession9Vtbl): IUnknown(IUnknownVtbl) {
1228    fn GetCertificateSize(
1229        pCertificateSize: *mut UINT,
1230    ) -> HRESULT,
1231    fn GetCertificate(
1232        CertifacteSize: UINT,
1233        ppCertificate: *mut BYTE,
1234    ) -> HRESULT,
1235    fn NegotiateKeyExchange(
1236        DataSize: UINT,
1237        pData: *mut VOID,
1238    ) -> HRESULT,
1239    fn EncryptionBlt(
1240        pSrcSurface: *mut IDirect3DSurface9,
1241        pDstSurface: *mut IDirect3DSurface9,
1242        DstSurfaceSize: UINT,
1243        pIV: *mut VOID,
1244    ) -> HRESULT,
1245    fn DecryptionBlt(
1246        pSrcSurface: *mut IDirect3DSurface9,
1247        pDstSurface: *mut IDirect3DSurface9,
1248        SrcSurfaceSize: UINT,
1249        pEncryptedBlockInfo: *mut D3DENCRYPTED_BLOCK_INFO,
1250        pContentKey: *mut VOID,
1251        pIV: *mut VOID,
1252    ) -> HRESULT,
1253    fn GetSurfacePitch(
1254        pSrcSurface: *mut IDirect3DSurface9,
1255        pSurfacePitch: *mut UINT,
1256    ) -> HRESULT,
1257    fn StartSessionKeyRefresh(
1258        pRandomNumber: *mut VOID,
1259        RandomNumberSize: UINT,
1260    ) -> HRESULT,
1261    fn FinishSessionKeyRefresh() -> HRESULT,
1262    fn GetEncryptionBltKey(
1263        pReadbackKey: *mut VOID,
1264        KeySize: UINT,
1265    ) -> HRESULT,
1266}}
1267pub type LPDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9;
1268pub type PDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9;