1DirectDraw Object struct 2 3DDRAWI_DIRECTDRAW_INT 4it is the the return pointer from ddraw.dll to the program 5 6DDRAWI_DIRECTDRAW_LCL 7It is the program own private data 8 9DDRAWI_DIRECTDRAW_GBL 10This struct is gboal for whole ddraw.dll for all program 11it is static in ddraw if it change it change for all 12program 13 14The struct 15 16from http://msdn2.microsoft.com/en-us/library/ms898267.aspx 17it was not document for windows 2000/xp/2003 but ms did document it 18for windows ce 5.0 the link are to windows ce 5.0 arch 19 20typedef struct _DDRAWI_DIRECTDRAW_INT { 21 LPVOID lpVtbl; 22 LPDDRAWI_DIRECTDRAW_LCL lpLcl; 23 LPDDRAWI_DIRECTDRAW_INT lpLink; 24 DWORD dwIntRefCnt; 25} DDRAWI_DIRECTDRAW_INT; 26 27Rest of the struct are from msdn for windows 2000/xp/2003 28typedef struct _DDRAWI_DIRECTDRAW_LCL { 29 DWORD lpDDMore; 30 LPDDRAWI_DIRECTDRAW_GBL lpGbl; // fill it from function Create_DirectDraw with static pointer ddgbl 31 DWORD dwUnused0; 32 DWORD dwLocalFlags; 33 DWORD dwLocalRefCnt; 34 DWORD dwProcessId; 35 IUnknown FAR *pUnkOuter; 36 DWORD dwObsolete1; 37 ULONG_PTR hWnd; 38 ULONG_PTR hDC; // create HDC and save it to this pointer 39 DWORD dwErrorMode; 40 LPDDRAWI_DDRAWSURFACE_INT lpPrimary; // The primary surface 41 LPDDRAWI_DDRAWSURFACE_INT lpCB; 42 DWORD dwPreferredMode; 43 HINSTANCE hD3DInstance; 44 IUnknown FAR *pD3DIUnknown; 45 LPDDHAL_CALLBACKS lpDDCB; // same memory pointer as DDRAWI_DIRECTDRAW_GBL->lpDDCBtmp, setup by function StartDirectDraw 46 ULONG_PTR hDDVxd; 47 DWORD dwAppHackFlags; 48 ULONG_PTR hFocusWnd; 49 DWORD dwHotTracking; 50 DWORD dwIMEState; 51 ULONG_PTR hWndPopup; 52 ULONG_PTR hDD; // from Gdientry1 copy the _DDRAWI_DIRECTDRAW_GBL hDD after startup then copy this back each time we need hDD 53 ULONG_PTR hGammaCalibrator; 54 LPDDGAMMACALIBRATORPROC lpGammaCalibrator; 55} DDRAWI_DIRECTDRAW_LCL; 56 57typedef struct _DDRAWI_DIRECTDRAW_GBL { 58 DWORD dwRefCnt; 59 DWORD dwFlags; 60 FLATPTR fpPrimaryOrig; 61 DDCORECAPS ddCaps; 62 DWORD dwInternal1; 63 DWORD dwUnused1[9]; 64 LPDDHAL_CALLBACKS lpDDCBtmp; 65 LPDDRAWI_DDRAWSURFACE_INT dsList; // list of all created directdraw surface, it is a pointer list 66 LPDDRAWI_DDRAWPALETTE_INT palList; 67 LPDDRAWI_DDRAWCLIPPER_INT clipperList; 68 LPDDRAWI_DIRECTDRAW_GBL lp16DD; // pointer to it self (DDRAWI_DIRECTDRAW_GBL) 69 DWORD dwMaxOverlays; 70 DWORD dwCurrOverlays; 71 DWORD dwMonitorFrequency; // current monitor freq, (nvidia always set this to 0, it is a bug in nvidia drv) 72 DDCORECAPS ddHELCaps; 73 DWORD dwUnused2[50]; 74 DDCOLORKEY ddckCKDestOverlay; 75 DDCOLORKEY ddckCKSrcOverlay; 76 VIDMEMINFO vmiData; 77 LPVOID lpDriverHandle; 78 LPDDRAWI_DIRECTDRAW_LCL lpExclusiveOwner; // which local directdraw comobject is in Exclusive mode and own this 79 DWORD dwModeIndex; 80 DWORD dwModeIndexOrig; 81 DWORD dwNumFourCC; 82 DWORD FAR *lpdwFourCC; 83 DWORD dwNumModes; 84 LPDDHALMODEINFO lpModeInfo; 85 PROCESS_LIST plProcessList; 86 DWORD dwSurfaceLockCount; 87 DWORD dwAliasedLockCnt; 88 ULONG_PTR dwReserved3; 89 ULONG_PTR hDD; // GdiEntry1 are filling this pointer 90 char cObsolete[12]; 91 DWORD dwReserved1; 92 DWORD dwReserved2; 93 DBLNODE dbnOverlayRoot; 94 volatile LPWORD lpwPDeviceFlags; 95 DWORD dwPDevice; 96 DWORD dwWin16LockCnt; 97 DWORD dwUnused3; 98 DWORD hInstance; 99 DWORD dwEvent16; 100 DWORD dwSaveNumModes; 101 ULONG_PTR lpD3DGlobalDriverData; 102 ULONG_PTR lpD3DHALCallbacks; 103 DDCORECAPS ddBothCaps; 104 LPDDVIDEOPORTCAPS lpDDVideoPortCaps; 105 LPDDRAWI_DDVIDEOPORT_INT dvpList; 106 ULONG_PTR lpD3DHALCallbacks2; 107 RECT rectDevice; 108 DWORD cMonitors; 109 LPVOID gpbmiSrc; 110 LPVOID gpbmiDest; 111 LPHEAPALIASINFO phaiHeapAliases; 112 ULONG_PTR hKernelHandle; 113 ULONG_PTR pfnNotifyProc; 114 LPDDKERNELCAPS lpDDKernelCaps; 115 LPDDNONLOCALVIDMEMCAPS lpddNLVCaps; 116 LPDDNONLOCALVIDMEMCAPS lpddNLVHELCaps; 117 LPDDNONLOCALVIDMEMCAPS lpddNLVBothCaps; 118 ULONG_PTR lpD3DExtendedCaps; 119 DWORD dwDOSBoxEvent; 120 RECT rectDesktop; 121 char cDriverName[MAX_DRIVER_NAME]; // driver name, if we send in CreateDirectDraw(NULL, ...) this will be fill in the name "display" 122 ULONG_PTR lpD3DHALCallbacks3; 123 DWORD dwNumZPixelFormats; 124 LPDDPIXELFORMAT lpZPixelFormats; 125 LPDDRAWI_DDMOTIONCOMP_INT mcList; 126 DWORD hDDVxd; 127 DDSCAPSEX ddsCapsMore; 128} DDRAWI_DIRECTDRAW_GBL; 129 130Clipper Object struct 131DDRAWI_DDRAWCLIPPER_INT 132It is the the return pointer from ddraw.dll to the program 133 134DDRAWI_DDRAWCLIPPER_LCL 135It is the program own private data 136 137DDRAWI_DDRAWCLIPPER_GBL 138This struct is gboal for whole ddraw.dll for all program 139it is static in ddraw if it change it change for all 140program 141 142The struct 143 144typedef struct _DDRAWI_DDRAWCLIPPER_INT { 145 LPVOID lpVtbl; 146 LPDDRAWI_DDRAWCLIPPER_LCL lpLcl; 147 LPDDRAWI_DDRAWCLIPPER_INT lpLink; 148 DWORD dwIntRefCnt; 149} DDRAWI_DDRAWCLIPPER_INT; 150 151typedef struct _DDRAWI_DDRAWCLIPPER_LCL { 152 DWORD lpClipMore; 153 LPDDRAWI_DDRAWCLIPPER_GBL lpGbl; 154 LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; 155 DWORD dwLocalRefCnt; 156 IUnknown FAR *pUnkOuter; 157 LPDDRAWI_DIRECTDRAW_INT lpDD_int; 158 ULONG_PTR dwReserved1; 159 IUnknown *pAddrefedThisOwner; 160} DDRAWI_DDRAWCLIPPER_LCL; 161 162 163typedef struct _DDRAWI_DDRAWCLIPPER_GBL { 164 DWORD dwRefCnt; 165 DWORD dwFlags; 166 LPDDRAWI_DIRECTDRAW_GBL lpDD; 167 DWORD dwProcessId; 168 ULONG_PTR dwReserved1; 169 ULONG_PTR hWnd; 170 LPRGNDATA lpStaticClipList; 171} DDRAWI_DDRAWCLIPPER_GBL; 172 173typedef struct _DDRAWI_DDRAWPALETTE_INT { 174 LPVOID lpVtbl; 175 LPDDRAWI_DDRAWPALETTE_LCL lpLcl; 176 LPDDRAWI_DDRAWPALETTE_INT lpLink; 177 DWORD dwIntRefCnt; 178} DDRAWI_DDRAWPALETTE_INT; 179 180typedef struct _DDRAWI_DDRAWPALETTE_LCL { 181 DWORD lpPalMore; 182 LPDDRAWI_DDRAWPALETTE_GBL lpGbl; 183 ULONG_PTR dwUnused0; 184 DWORD dwLocalRefCnt; 185 IUnknown FAR *pUnkOuter; 186 LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; 187 ULONG_PTR dwReserved1; 188 ULONG_PTR dwDDRAWReserved1; 189 ULONG_PTR dwDDRAWReserved2; 190 ULONG_PTR dwDDRAWReserved3; 191} DDRAWI_DDRAWPALETTE_LCL; 192 193typedef struct _DDRAWI_DDRAWPALETTE_GBL { 194 DWORD dwRefCnt; 195 DWORD dwFlags; 196 LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl; 197 DWORD dwProcessId; 198 LPPALETTEENTRY lpColorTable; 199 union { 200 ULONG_PTR dwReserved1; 201 HPALETTE hHELGDIPalette; 202 }; 203 DWORD dwDriverReserved; 204 DWORD dwContentsStamp; 205 DWORD dwSaveStamp; 206 DWORD dwHandle; 207} DDRAWI_DDRAWPALETTE_GBL; 208 209 210typedef struct _DDRAWI_DDVIDEOPORT_INT { 211 LPVOID lpVtbl; 212 LPDDRAWI_DDVIDEOPORT_LCL lpLcl; 213 LPDDRAWI_DDVIDEOPORT_INT lpLink; 214 DWORD dwIntRefCnt; 215 DWORD dwFlags; 216} DDRAWI_DDVIDEOPORT_INT; 217 218typedef struct _DDRAWI_DDVIDEOPORT_LCL { 219 LPDDRAWI_DIRECTDRAW_LCL lpDD; 220 DDVIDEOPORTDESC ddvpDesc; 221 DDVIDEOPORTINFO ddvpInfo; 222 LPDDRAWI_DDRAWSURFACE_INT lpSurface; 223 LPDDRAWI_DDRAWSURFACE_INT lpVBISurface; 224 LPDDRAWI_DDRAWSURFACE_INT *lpFlipInts; 225 DWORD dwNumAutoflip; 226 DWORD dwProcessID; 227 DWORD dwStateFlags; 228 DWORD dwFlags; 229 DWORD dwRefCnt; 230 FLATPTR fpLastFlip; 231 ULONG_PTR dwReserved1; 232 ULONG_PTR dwReserved2; 233 HANDLE hDDVideoPort; 234 DWORD dwNumVBIAutoflip; 235 LPDDVIDEOPORTDESC lpVBIDesc; 236 LPDDVIDEOPORTDESC lpVideoDesc; 237 LPDDVIDEOPORTINFO lpVBIInfo; 238 LPDDVIDEOPORTINFO lpVideoInfo; 239 DWORD dwVBIProcessID; 240} DDRAWI_DDVIDEOPORT_LCL; 241 242 243Surface: 244 245typedef struct _DDRAWI_DDRAWSURFACE_GBL { 246 DWORD dwRefCnt; 247 DWORD dwGlobalFlags; 248 union { 249 LPACCESSRECTLIST lpRectList; 250 DWORD dwBlockSizeY; 251 }; 252 union { 253 LPVMEMHEAP lpVidMemHeap; 254 DWORD dwBlockSizeX; 255 }; 256 union { 257 LPDDRAWI_DIRECTDRAW_GBL lpDD; 258 LPVOID lpDDHandle; 259 }; 260 FLATPTR fpVidMem; 261 union { 262 LONG lPitch; 263 DWORD dwLinearSize; 264 }; 265 WORD wHeight; 266 WORD wWidth; 267 DWORD dwUsageCount; 268 ULONG_PTR dwReserved1; 269 DDPIXELFORMAT ddpfSurface; 270} DDRAWI_DDRAWSURFACE_GBL; 271 272The following informations might be incorrectly 273I am using logic thinking since the info does 274not exists in MSDN so I am drawing clue how 275previews stuffs works that are document in MSDN/DDK 276 277follow struct should exists ??? 278DDRAWI_DDVIDEOPORT_GBL 279DDRAWI_DDGAMMACONTROL_INT 280DDRAWI_DDGAMMACONTROL_LCL 281DDRAWI_DDGAMMACONTROL_GBL 282DDRAWI_DDCOLORCONTROL_INT 283DDRAWI_DDCOLORCONTROL_LCL 284DDRAWI_DDCOLORCONTROL_GBL 285DDRAWI_KERNEL_INT 286DDRAWI_KERNEL_LCL 287DDRAWI_KERNEL_GBL 288DDRAWI_DDKERNELSURFACE_INT 289DDRAWI_DDKERNELSURFACE_LCL 290DDRAWI_DDKERNELSURFACE_GBL 291 292follow struct can be easy create 293DDRAWI_DDGAMMACONTROL_INT 294DDRAWI_DDCOLORCONTROL_INT 295DDRAWI_KERNEL_INT 296 297the DDRAWI_DDGAMMACONTROL_INT should looking like this 298typedef struct _DDRAWI_DDGAMMACONTROL_INT 299{ 300 LPVOID lpVtbl; 301 LPDDRAWI_DDGAMMACONTROL_LCL lpLcl; 302 LPDDRAWI_DDGAMMACONTROL_INT lpLink; 303 DWORD dwIntRefCnt; 304} DDRAWI_DDGAMMACONTROL_INT, *LPDDRAWI_DDGAMMACONTROL_INT 305 306how did I got this struct I looked at all other INT struct how they where 307build. But it is not 100% sure this one is right untill I/we known how 308the DDRAWI_DDGAMMACONTROL_LCL works and DDRAWI_DDCOLORCONTROL_GBL 309our internal struct will look like this 310 311typedef struct _DDRAWI_DDGAMMACONTROL_INT 312{ 313 LPVOID lpVtbl; 314 LPVOID lpLcl; 315 LPVOID lpLink; 316 DWORD dwIntRefCnt; 317} DDRAWI_DDGAMMACONTROL_INT, *LPDDRAWI_DDGAMMACONTROL_INT 318 319same goes for DDRAWI_DDCOLORCONTROL_INT 320 321typedef struct DDRAWI_DDCOLORCONTROL_INT 322{ 323 LPVOID lpVtbl; 324 LPVOID lpLcl; 325 LPVOID lpLink; 326 DWORD dwIntRefCnt; 327} DDRAWI_DDCOLORCONTROL_INT, *LPDDRAWI_DDCOLORCONTROL_INT 328 329 330 331 332 333 334 335 336