crypt32: Pass key length to CryptDeriveKey.
[wine/multimedia.git] / dlls / ddraw / ddraw_private.h
blob9b78edf31632292e2958f0e192b73bf03113cee3
1 /*
2 * Copyright 2006 Stefan Dösinger
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
20 #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
22 /* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */
24 #include <stdarg.h>
25 #include <stdio.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wtypes.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "ddraw.h"
33 #include "ddrawi.h"
34 #include "d3d.h"
36 #include "ddcomimpl.h"
38 #include "wine/wined3d_interface.h"
39 #include "wine/list.h"
41 /*****************************************************************************
42 * IParent - a helper interface
43 *****************************************************************************/
44 DEFINE_GUID(IID_IParent, 0xc20e4c88, 0x74e7, 0x4940, 0xba, 0x9f, 0x2e, 0x32, 0x3f, 0x9d, 0xc9, 0x81);
45 typedef struct IParent *LPPARENT, *PPARENT;
47 #define INTERFACE IParent
48 DECLARE_INTERFACE_(IParent,IUnknown)
50 /*** IUnknown methods ***/
51 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
52 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
53 STDMETHOD_(ULONG,Release)(THIS) PURE;
55 #undef INTERFACE
57 #if !defined(__cplusplus) || defined(CINTERFACE)
58 /*** IUnknown methods ***/
59 #define IParent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
60 #define IParent_AddRef(p) (p)->lpVtbl->AddRef(p)
61 #define IParent_Release(p) (p)->lpVtbl->Release(p)
62 #endif
65 /* Typdef the interfaces */
66 typedef struct IDirectDrawImpl IDirectDrawImpl;
67 typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
68 typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl;
69 typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl;
70 typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
71 typedef struct IDirect3DLightImpl IDirect3DLightImpl;
72 typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
73 typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
74 typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
75 typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
76 typedef struct IParentImpl IParentImpl;
78 /* Callbacks for implicit object destruction */
79 extern ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain);
81 extern ULONG WINAPI D3D7CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface);
83 /* Global critical section */
84 extern CRITICAL_SECTION ddraw_cs;
86 /*****************************************************************************
87 * IDirectDraw implementation structure
88 *****************************************************************************/
89 struct FvfToDecl
91 DWORD fvf;
92 IWineD3DVertexDeclaration *decl;
95 struct IDirectDrawImpl
97 /* IUnknown fields */
98 ICOM_VFIELD_MULTI(IDirectDraw7);
99 ICOM_VFIELD_MULTI(IDirectDraw4);
100 ICOM_VFIELD_MULTI(IDirectDraw3);
101 ICOM_VFIELD_MULTI(IDirectDraw2);
102 ICOM_VFIELD_MULTI(IDirectDraw);
103 ICOM_VFIELD_MULTI(IDirect3D7);
104 ICOM_VFIELD_MULTI(IDirect3D3);
105 ICOM_VFIELD_MULTI(IDirect3D2);
106 ICOM_VFIELD_MULTI(IDirect3D);
108 /* See comment in IDirectDraw::AddRef */
109 LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
111 /* WineD3D linkage */
112 IWineD3D *wineD3D;
113 IWineD3DDevice *wineD3DDevice;
114 IDirectDrawSurfaceImpl *DepthStencilBuffer;
115 BOOL d3d_initialized;
117 /* Misc ddraw fields */
118 UINT total_vidmem;
119 DWORD cur_scanline;
120 BOOL fake_vblank;
121 BOOL initialized;
123 /* DirectDraw things, which are not handled by WineD3D */
124 DWORD cooperative_level;
126 DWORD orig_width, orig_height;
127 DWORD orig_bpp;
129 DDCAPS caps;
131 /* D3D things */
132 IDirectDrawSurfaceImpl *d3d_target;
133 HWND d3d_window;
134 IDirect3DDeviceImpl *d3ddevice;
135 int d3dversion;
137 /* Various HWNDs */
138 HWND focuswindow;
139 HWND devicewindow;
141 /* The surface type to request */
142 WINED3DSURFTYPE ImplType;
145 /* Our private window class */
146 char classname[32];
147 WNDCLASSA wnd_class;
149 /* Helpers for surface creation */
150 IDirectDrawSurfaceImpl *tex_root;
151 BOOL depthstencil;
153 /* For the dll unload cleanup code */
154 struct list ddraw_list_entry;
155 /* The surface list - can't relay this to WineD3D
156 * because of IParent
158 struct list surface_list;
159 LONG surfaces;
161 /* FVF management */
162 struct FvfToDecl *decls;
163 UINT numConvertedDecls, declArraySize;
166 /* Declare the VTables. They can be found ddraw.c */
167 const IDirectDraw7Vtbl IDirectDraw7_Vtbl;
168 const IDirectDraw4Vtbl IDirectDraw4_Vtbl;
169 const IDirectDraw3Vtbl IDirectDraw3_Vtbl;
170 const IDirectDraw2Vtbl IDirectDraw2_Vtbl;
171 const IDirectDrawVtbl IDirectDraw1_Vtbl;
173 /* Helper structures */
174 typedef struct EnumDisplayModesCBS
176 void *context;
177 LPDDENUMMODESCALLBACK2 callback;
178 } EnumDisplayModesCBS;
180 typedef struct EnumSurfacesCBS
182 void *context;
183 LPDDENUMSURFACESCALLBACK7 callback;
184 LPDDSURFACEDESC2 pDDSD;
185 DWORD Flags;
186 } EnumSurfacesCBS;
188 /* Utility functions */
189 void
190 DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS* pIn,
191 DDSCAPS2* pOut);
192 void
193 DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2* pIn,
194 DDDEVICEIDENTIFIER* pOut);
195 void
196 IDirectDrawImpl_Destroy(IDirectDrawImpl *This);
198 HRESULT WINAPI
199 IDirectDrawImpl_RecreateSurfacesCallback(IDirectDrawSurface7 *surf,
200 DDSURFACEDESC2 *desc,
201 void *Context);
202 IWineD3DVertexDeclaration *
203 IDirectDrawImpl_FindDecl(IDirectDrawImpl *This,
204 DWORD fvf);
206 /* The default surface type */
207 extern WINED3DSURFTYPE DefaultSurfaceType;
209 /*****************************************************************************
210 * IDirectDrawSurface implementation structure
211 *****************************************************************************/
213 struct IDirectDrawSurfaceImpl
215 /* IUnknown fields */
216 ICOM_VFIELD_MULTI(IDirectDrawSurface7);
217 ICOM_VFIELD_MULTI(IDirectDrawSurface3);
218 ICOM_VFIELD_MULTI(IDirectDrawGammaControl);
219 ICOM_VFIELD_MULTI(IDirect3DTexture2);
220 ICOM_VFIELD_MULTI(IDirect3DTexture);
222 LONG ref;
223 IUnknown *ifaceToRelease;
225 int version;
227 /* Connections to other Objects */
228 IDirectDrawImpl *ddraw;
229 IWineD3DSurface *WineD3DSurface;
230 IWineD3DBaseTexture *wineD3DTexture;
232 /* This implementation handles attaching surfaces to other surfaces */
233 IDirectDrawSurfaceImpl *next_attached;
234 IDirectDrawSurfaceImpl *first_attached;
236 /* Complex surfaces are organized in a tree, although the tree is degenerated to a list in most cases.
237 * In mipmap and primary surfaces each level has only one attachment, which is the next surface level.
238 * Only the cube texture root has 6 surfaces attached, which then have a normal mipmap chain attached
239 * to them. So hardcode the array to 6, a dynamic array or a list would be an overkill.
241 #define MAX_COMPLEX_ATTACHED 6
242 IDirectDrawSurfaceImpl *complex_array[MAX_COMPLEX_ATTACHED];
243 /* You can't traverse the tree upwards. Only a flag for Surface::Release because its needed there,
244 * but no pointer to prevent temptations to traverse it in the wrong direction.
246 BOOL is_complex_root;
248 /* Surface description, for GetAttachedSurface */
249 DDSURFACEDESC2 surface_desc;
251 /* Misc things */
252 DWORD uniqueness_value;
253 UINT mipmap_level;
254 WINED3DSURFTYPE ImplType;
256 /* For D3DDevice creation */
257 BOOL isRenderTarget;
259 /* Clipper objects */
260 IDirectDrawClipperImpl *clipper;
262 /* For the ddraw surface list */
263 struct list surface_list_entry;
265 DWORD Handle;
268 /* VTable declaration. It's located in surface.c / surface_thunks.c */
269 const IDirectDrawSurface7Vtbl IDirectDrawSurface7_Vtbl;
270 const IDirectDrawSurface3Vtbl IDirectDrawSurface3_Vtbl;
271 const IDirectDrawGammaControlVtbl IDirectDrawGammaControl_Vtbl;
272 const IDirect3DTexture2Vtbl IDirect3DTexture2_Vtbl;
273 const IDirect3DTextureVtbl IDirect3DTexture1_Vtbl;
275 HRESULT WINAPI IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurfaceImpl *This, IDirectDrawSurfaceImpl *Surf);
276 void IDirectDrawSurfaceImpl_Destroy(IDirectDrawSurfaceImpl *This);
278 /* Get the number of bytes per pixel for a given surface */
279 #define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8))
280 #define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
282 /*****************************************************************************
283 * IParent Implementation
284 *****************************************************************************/
285 struct IParentImpl
287 /* IUnknown fields */
288 ICOM_VFIELD_MULTI(IParent);
289 LONG ref;
291 /* IParentImpl fields */
292 IUnknown *child;
296 const IParentVtbl IParent_Vtbl;
298 /*****************************************************************************
299 * IDirect3DDevice implementation
300 *****************************************************************************/
301 typedef enum
303 DDrawHandle_Unknown = 0,
304 DDrawHandle_Texture = 1,
305 DDrawHandle_Material = 2,
306 DDrawHandle_Matrix = 3,
307 DDrawHandle_StateBlock = 4
308 } DDrawHandleTypes;
310 struct HandleEntry
312 void *ptr;
313 DDrawHandleTypes type;
316 struct IDirect3DDeviceImpl
318 /* IUnknown */
319 ICOM_VFIELD_MULTI(IDirect3DDevice7);
320 ICOM_VFIELD_MULTI(IDirect3DDevice3);
321 ICOM_VFIELD_MULTI(IDirect3DDevice2);
322 ICOM_VFIELD_MULTI(IDirect3DDevice);
323 LONG ref;
325 /* Other object connections */
326 IWineD3DDevice *wineD3DDevice;
327 IDirectDrawImpl *ddraw;
328 IWineD3DIndexBuffer *indexbuffer;
329 IDirectDrawSurfaceImpl *target;
330 BOOL OffScreenTarget;
332 /* Viewport management */
333 IDirect3DViewportImpl *viewport_list;
334 IDirect3DViewportImpl *current_viewport;
335 D3DVIEWPORT7 active_viewport;
337 /* Light state */
338 DWORD material;
340 /* Rendering functions to wrap D3D(1-3) to D3D7 */
341 D3DPRIMITIVETYPE primitive_type;
342 DWORD vertex_type;
343 DWORD render_flags;
344 DWORD nb_vertices;
345 LPBYTE vertex_buffer;
346 DWORD vertex_size;
347 DWORD buffer_size;
349 /* Handle management */
350 struct HandleEntry *Handles;
351 DWORD numHandles;
352 D3DMATRIXHANDLE world, proj, view;
355 /* Vtables in various versions */
356 const IDirect3DDevice7Vtbl IDirect3DDevice7_Vtbl;
357 const IDirect3DDevice3Vtbl IDirect3DDevice3_Vtbl;
358 const IDirect3DDevice2Vtbl IDirect3DDevice2_Vtbl;
359 const IDirect3DDeviceVtbl IDirect3DDevice1_Vtbl;
361 /* The IID */
362 const GUID IID_D3DDEVICE_WineD3D;
364 /* Helper functions */
365 HRESULT IDirect3DImpl_GetCaps(IWineD3D *WineD3D, D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7);
366 DWORD IDirect3DDeviceImpl_CreateHandle(IDirect3DDeviceImpl *This);
367 WINED3DZBUFFERTYPE IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This);
369 /* Structures */
370 struct EnumTextureFormatsCBS
372 LPD3DENUMTEXTUREFORMATSCALLBACK cbv2;
373 LPD3DENUMPIXELFORMATSCALLBACK cbv7;
374 void *Context;
377 /*****************************************************************************
378 * IDirect3D implementation
379 *****************************************************************************/
381 /* No implementation structure as this is only another interface to DirectDraw */
383 /* the Vtables */
384 const IDirect3DVtbl IDirect3D1_Vtbl;
385 const IDirect3D2Vtbl IDirect3D2_Vtbl;
386 const IDirect3D3Vtbl IDirect3D3_Vtbl;
387 const IDirect3D7Vtbl IDirect3D7_Vtbl;
389 /* Structure for EnumZBufferFormats */
390 struct EnumZBufferFormatsData
392 LPD3DENUMPIXELFORMATSCALLBACK Callback;
393 void *Context;
396 /*****************************************************************************
397 * IDirectDrawClipper implementation structure
398 *****************************************************************************/
399 struct IDirectDrawClipperImpl
401 /* IUnknown fields */
402 ICOM_VFIELD_MULTI(IDirectDrawClipper);
403 LONG ref;
405 IWineD3DClipper *wineD3DClipper;
406 IDirectDrawImpl *ddraw_owner;
409 const IDirectDrawClipperVtbl IDirectDrawClipper_Vtbl;
411 typedef IWineD3DClipper* (WINAPI *fnWineDirect3DCreateClipper)(IUnknown *);
412 fnWineDirect3DCreateClipper pWineDirect3DCreateClipper;
414 /*****************************************************************************
415 * IDirectDrawPalette implementation structure
416 *****************************************************************************/
417 struct IDirectDrawPaletteImpl
419 /* IUnknown fields */
420 ICOM_VFIELD_MULTI(IDirectDrawPalette);
421 LONG ref;
423 /* WineD3D uplink */
424 IWineD3DPalette *wineD3DPalette;
426 /* IDirectDrawPalette fields */
427 IDirectDrawImpl *ddraw_owner;
428 IUnknown *ifaceToRelease;
430 const IDirectDrawPaletteVtbl IDirectDrawPalette_Vtbl;
432 /******************************************************************************
433 * DirectDraw ClassFactory implementation - incomplete
434 ******************************************************************************/
435 typedef struct
437 ICOM_VFIELD_MULTI(IClassFactory);
439 LONG ref;
440 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj);
441 } IClassFactoryImpl;
443 /* Helper structures */
444 struct object_creation_info
446 const CLSID *clsid;
447 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID riid,
448 void **ppObj);
451 /******************************************************************************
452 * IDirect3DLight implementation structure - Wraps to D3D7
453 ******************************************************************************/
454 struct IDirect3DLightImpl
456 ICOM_VFIELD_MULTI(IDirect3DLight);
457 LONG ref;
459 /* IDirect3DLight fields */
460 IDirectDrawImpl *ddraw;
462 /* If this light is active for one viewport, put the viewport here */
463 IDirect3DViewportImpl *active_viewport;
465 D3DLIGHT2 light;
466 D3DLIGHT7 light7;
468 DWORD dwLightIndex;
470 /* Chained list used for adding / removing from viewports */
471 IDirect3DLightImpl *next;
473 /* Activation function */
474 void (*activate)(IDirect3DLightImpl*);
475 void (*desactivate)(IDirect3DLightImpl*);
476 void (*update)(IDirect3DLightImpl*);
479 /* Vtable */
480 const IDirect3DLightVtbl IDirect3DLight_Vtbl;
482 /* Helper functions */
483 void light_update(IDirect3DLightImpl* This);
484 void light_activate(IDirect3DLightImpl* This);
485 void light_desactivate(IDirect3DLightImpl* This);
487 /******************************************************************************
488 * IDirect3DMaterial implementation structure - Wraps to D3D7
489 ******************************************************************************/
490 struct IDirect3DMaterialImpl
492 ICOM_VFIELD_MULTI(IDirect3DMaterial3);
493 ICOM_VFIELD_MULTI(IDirect3DMaterial2);
494 ICOM_VFIELD_MULTI(IDirect3DMaterial);
495 LONG ref;
497 /* IDirect3DMaterial2 fields */
498 IDirectDrawImpl *ddraw;
499 IDirect3DDeviceImpl *active_device;
501 D3DMATERIAL mat;
502 DWORD Handle;
504 void (*activate)(IDirect3DMaterialImpl* this);
507 /* VTables in various versions */
508 const IDirect3DMaterialVtbl IDirect3DMaterial_Vtbl;
509 const IDirect3DMaterial2Vtbl IDirect3DMaterial2_Vtbl;
510 const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl;
512 /* Helper functions */
513 void material_activate(IDirect3DMaterialImpl* This);
515 /*****************************************************************************
516 * IDirect3DViewport - Wraps to D3D7
517 *****************************************************************************/
518 struct IDirect3DViewportImpl
520 ICOM_VFIELD_MULTI(IDirect3DViewport3);
521 LONG ref;
523 /* IDirect3DViewport fields */
524 IDirectDrawImpl *ddraw;
526 /* If this viewport is active for one device, put the device here */
527 IDirect3DDeviceImpl *active_device;
529 DWORD num_lights;
530 DWORD map_lights;
532 int use_vp2;
534 union
536 D3DVIEWPORT vp1;
537 D3DVIEWPORT2 vp2;
538 } viewports;
540 /* Activation function */
541 void (*activate)(IDirect3DViewportImpl*);
543 /* Field used to chain viewports together */
544 IDirect3DViewportImpl *next;
546 /* Lights list */
547 IDirect3DLightImpl *lights;
549 /* Background material */
550 IDirect3DMaterialImpl *background;
553 /* Vtable */
554 const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl;
556 /* Helper functions */
557 void viewport_activate(IDirect3DViewportImpl* This);
559 /*****************************************************************************
560 * IDirect3DExecuteBuffer - Wraps to D3D7
561 *****************************************************************************/
562 struct IDirect3DExecuteBufferImpl
564 /* IUnknown */
565 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
566 LONG ref;
568 /* IDirect3DExecuteBuffer fields */
569 IDirectDrawImpl *ddraw;
570 IDirect3DDeviceImpl *d3ddev;
572 D3DEXECUTEBUFFERDESC desc;
573 D3DEXECUTEDATA data;
575 /* This buffer will store the transformed vertices */
576 void *vertex_data;
577 WORD *indices;
578 int nb_indices;
580 /* This flags is set to TRUE if we allocated ourselves the
581 * data buffer
583 BOOL need_free;
586 /* The VTable */
587 const IDirect3DExecuteBufferVtbl IDirect3DExecuteBuffer_Vtbl;
589 /* The execute function */
590 void
591 IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
592 IDirect3DDeviceImpl *Device,
593 IDirect3DViewportImpl *ViewportImpl);
595 /*****************************************************************************
596 * IDirect3DVertexBuffer
597 *****************************************************************************/
598 struct IDirect3DVertexBufferImpl
600 /*** IUnknown Methods ***/
601 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
602 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
603 LONG ref;
605 /*** WineD3D and ddraw links ***/
606 IWineD3DVertexBuffer *wineD3DVertexBuffer;
607 IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
608 IDirectDrawImpl *ddraw;
610 /*** Storage for D3D7 specific things ***/
611 DWORD Caps;
614 /* The Vtables */
615 const IDirect3DVertexBuffer7Vtbl IDirect3DVertexBuffer7_Vtbl;
616 const IDirect3DVertexBufferVtbl IDirect3DVertexBuffer1_Vtbl;
618 /*****************************************************************************
619 * Helper functions from utils.c
620 *****************************************************************************/
622 #define GET_TEXCOUNT_FROM_FVF(d3dvtVertexType) \
623 (((d3dvtVertexType) & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT)
625 #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
626 (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
628 void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, WINED3DFORMAT WineD3DFormat);
629 WINED3DFORMAT PixelFormat_DD2WineD3D(const DDPIXELFORMAT *DDPixelFormat);
630 void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd);
631 void DDRAW_dump_pixelformat(const DDPIXELFORMAT *PixelFormat);
632 void dump_D3DMATRIX(const D3DMATRIX *mat);
633 void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps);
634 DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
635 void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in);
636 void DDRAW_dump_cooperativelevel(DWORD cooplevel);
638 /* This only needs to be here as long the processvertices functionality of
639 * IDirect3DExecuteBuffer isn't in WineD3D */
640 void multiply_matrix(LPD3DMATRIX dest, const D3DMATRIX *src1, const D3DMATRIX *src2);
642 /* Used for generic dumping */
643 typedef struct
645 DWORD val;
646 const char* name;
647 } flag_info;
649 #define FE(x) { x, #x }
651 typedef struct
653 DWORD val;
654 const char* name;
655 void (*func)(const void *);
656 ptrdiff_t offset;
657 } member_info;
659 /* Structure copy */
660 #define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
662 #define DD_STRUCT_COPY_BYSIZE(to,from) \
663 do { \
664 DWORD __size = (to)->dwSize; \
665 DWORD __copysize = __size; \
666 DWORD __resetsize = __size; \
667 assert(to != from); \
668 if (__resetsize > sizeof(*to)) \
669 __resetsize = sizeof(*to); \
670 memset(to,0,__resetsize); \
671 if ((from)->dwSize < __size) \
672 __copysize = (from)->dwSize; \
673 memcpy(to,from,__copysize); \
674 (to)->dwSize = __size;/*restore size*/ \
675 } while (0)
678 #endif
680 HRESULT hr_ddraw_from_wined3d(HRESULT hr);