1 
2 #ifndef _DXINTERNEL_
3 #define _DXINTERNEL_
4 
5 #ifdef __W32K_H
6 #define PDD_BASEOBJECT POBJ
7 #define DD_BASEOBJECT BASEOBJECT
8 #endif
9 
10 /* _EDD_DIRECTDRAW_LOCAL is 0x54 bytes long on Windows XP */
11 typedef struct _EDD_DIRECTDRAW_LOCAL
12 {
13     //
14     // GDI Object Header
15     //
16 /* 0x00 */    DD_BASEOBJECT pobj; // verified to match Windows XP
17 /* 0x10 */    struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal;    // verified to match Windows XP
18 /* 0x14 */    ULONG hRefCount;
19 /* 0x18 */    struct _EDD_SURFACE * peSurface_DdList;
20 /* 0x1C */    ULONG hSurface;
21 /* 0x20 */    ULONG unk_020;
22 /* 0x24 */    struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2;   // verified to match Windows XP
23 /* 0x28 */    FLATPTR fpProcess;
24 /* 0x2C */    FLONG fl;
25 /* 0x30 */    struct _EDD_DIRECTDRAW_LOCAL *peDirectDrawLocal_prev;  // verified to match Windows XP,
26                                                                      // points to the old DDLocal when new handle is created.
27 /* 0x34 */    FLATPTR fpProcess2;                                    // surface memory address returned by graphic driver
28 /* 0x38 */    ULONG isMemoryMapped;                                  // surface memory mapped?
29 /* 0x3C */    HANDLE hCreatorProcess;
30 /* 0x40 */    PEPROCESS Process;
31 /* 0x44 */    VOID *heapList;
32 /* 0x48 */    ULONG unk_048;
33 /* 0x4C */    ULONG unk_04C;
34 /* 0x50 */    ULONG unk_050;
35 } EDD_DIRECTDRAW_LOCAL, *PEDD_DIRECTDRAW_LOCAL;
36 
37 
38 //
39 // Surface Object
40 //
41 typedef struct _EDD_SURFACE
42 {
43     //
44     // GDI Object Header
45     //
46     DD_BASEOBJECT pobj;
47 
48     //
49     // Direct Draw Surface Data
50     //
51     DD_SURFACE_LOCAL ddsSurfaceLocal;
52     DD_SURFACE_MORE ddsSurfaceMore;
53     DD_SURFACE_GLOBAL ddsSurfaceGlobal;
54     DD_SURFACE_INT ddsSurfaceInt;
55 
56     //
57     // Surface pointers
58     //
59     struct _EDD_SURFACE *peSurface_DdNext;
60     struct _EDD_SURFACE *peSurface_LockNext;
61 
62     //
63     // Unknown
64     //
65     ULONG field_C0;
66 
67     //
68     // Private Direct Draw Data
69     //
70     struct _EDD_DIRECTDRAW_GLOBAL* peDirectDrawGlobal;
71     struct _EDD_DIRECTDRAW_GLOBAL* peDirectDrawGlobalNext;
72     struct _EDD_DIRECTDRAW_LOCAL* peDirectDrawLocal;
73 
74     //
75     // Surface Attributes
76     //
77     ULONG cLocks;
78     ULONG iVisRgnUniqueness;
79     BOOL bLost;
80     HANDLE hSecure;
81     HANDLE hdc;
82     HBITMAP hbmGdi;
83     HANDLE hGdiSurface;
84 
85     //
86     // Surface Lock
87     //
88     RECTL rclLock;
89     ULONG field_FC;
90     ULONG field_100;
91     ULONG field_104;
92     ULONG field_108;
93     ULONG field_10C;
94 
95     ULONG ldev;
96     struct _EDD_DIRECTDRAW_GLOBAL* peDirectDrawGlobal3;
97     ULONG gdev;
98     ULONG wWidth;
99     ULONG wHeight;
100 } EDD_SURFACE, *PEDD_SURFACE;
101 
102 
103 /* NOTE :
104  * if any of these flags are set in dwCallbackFlags (struct EDD_DIRECTDRAW_GLOBAL),
105  * it means that the respective callback member for it has been filled in by a graphic driver
106  */
107 #define EDDDGBL_MISCCALLBACKS           0x001 // ddMiscellanousCallbacks
108 #define EDDDGBL_VIDEOPORTCALLBACKS      0x002 // ddVideoPortCallback
109 #define EDDDGBL_COLORCONTROLCALLBACKS   0x004 // ddColorControlCallbacks
110 #define EDDDGBL_MOTIONCOMPCALLBACKS     0x040 // ddMotionCompCallbacks
111 #define EDDDGBL_MISC2CALLBACKS          0x080 // ddMiscellanous2Callbacks
112 #define EDDDGBL_DDMORECAPS              0x100 // ddMorecaps
113 #define EDDDGBL_D3DCALLBACKS3           0x200 // d3dNtHalCallbacks3
114 #define EDDDGBL_NTCALLBACKS             0x400 // ddNtCallbacks
115 #define EDDDGBL_PRIVATEDRIVERCAPS       0x800 // ddNtPrivateDriverCaps
116 
117 
118 typedef struct _EDD_DIRECTDRAW_GLOBAL
119 {
120 /* 0x000 */    PVOID dhpdev;           // 0x000 <-- verified to match Windows XP, dhpdev, the drv hPDev -->
121 /* 0x004 */    DWORD dwReserved1;
122 /* 0x008 */    DWORD dwReserved2;
123 /* 0x00C */    LPDDVIDEOPORTCAPS lpDDVideoPortCaps;                    // 0x00C <-- verified to match Win2k3
124 /* 0x010 */    ULONG unk_010;
125 /* 0x014 */    ULONG unk_014;
126 /* 0x018 */    LONG cDriverReferences;
127 /* 0x01C */    ULONG unk_01c;
128 /* 0x020 */    DWORD dwCallbackFlags; /* 0x020 <-- verified to match Windows XP, dwCallbackFlags
129                                          Flags value
130                                          0x0002 = ddVideoPortCallback and GUID_VideoPortCaps
131                                          0x0004 = GUID_ColorControlCallbacks
132                                          0x0040 = GUID_MotionCompCallbacks
133                                          0x0080 = GUID_Miscellaneous2Callbacks
134                                          0x0100 = GUID_DDMoreCaps
135                                          0x0200 = GUID_D3DCallbacks3
136                                          0x0400 = GUID_NTCallbacks
137                                        */
138 
139 /* 0x024 */    ULONG unk_024;
140 
141 /* 0x028 */    LARGE_INTEGER   llAssertModeTimeout;                    /* 0x028 <-- verified to match Windows XP, llAssertModeTimeout, it
142                                                                           using regkey
143                                                                           HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\DCI
144                                                                           Specifies how long a DirectDraw application can keep a graphics-device frame-buffer locked
145                                                                           in second, if this value are set to 0 it disable directdraw acclatrions.
146                                                                           it is normal set to 7 (7 sec in windwos xp/2003)
147                                                                         */
148 
149 /* 0x030 */    DWORD dwNumHeaps;                                       // 0x030 <-- verified to match Windows XP, dwNumHeaps
150 /* 0x034 */    VIDEOMEMORY *pvmList;                                   // 0x034 <-- verified to match Windows XP, pvmList
151 /* 0x038 */    DWORD dwNumFourCC;                                      // 0x038 <-- verified to match Windows XP, dwNumFourCC
152 /* 0x03C */    PDWORD pdwFourCC;                                       // 0x03C <-- verified to match Windows XP, pdwFourCC
153 /* 0x040 */    DD_HALINFO ddHalInfo;                                   // 0x040 <-- verified to match Windows XP, ddHalInfo
154 /* 0x1E0 */    ULONG unk_1e0[17];                                      // DxApi interface (size 0x44)
155 /* 0x224 */    ULONG unk_224;                                          //
156 /* 0x228 */    ULONG unk_228[14];                                      // AGP interface (size 0x38)
157 /* 0x260 */    DDKERNELCAPS ddKernelCaps;                              // 0x260 <-- verified to match Windows Server 2003
158 /* 0x26C */    DD_MORECAPS ddMoreCaps;                                 // 0x26C <-- verified to match Windows Server 2003
159 /* 0x290 */    DD_NTPRIVATEDRIVERCAPS ddNtPrivateDriverCaps;           // 0x290 <-- verified to match Windows Server 2003
160 /* 0x298 */    DD_CALLBACKS ddCallbacks;                               // 0x298 <-- verified to match Windows XP, ddCallbacks
161 /* 0x2C4 */    DD_SURFACECALLBACKS ddSurfaceCallbacks;                 // 0x2C4 <-- verified to match Windows XP, ddSurfaceCallbacks
162 /* 0x304 */    DD_PALETTECALLBACKS ddPaletteCallbacks;                 // 0x304 <-- verified to match Windows XP, ddPaletteCallbacks
163 /* 0x314 */    D3DNTHAL_GLOBALDRIVERDATA d3dNtGlobalDriverData;
164 /* 0x3D4 */    D3DNTHAL_CALLBACKS d3dNtHalCallbacks;
165 /* 0x460 */    DD_D3DBUFCALLBACKS d3dBufCallbacks;
166 /* 0x47C */    D3DNTHAL_CALLBACKS2 d3dNtHalCallbacks2;
167 /* 0x498 */    DD_VIDEOPORTCALLBACKS ddVideoPortCallback;              // 0x498 <-- verified to match Windows XP, ddVideoPortCallback
168 /* 0x4E0 */    DD_MISCELLANEOUSCALLBACKS ddMiscellanousCallbacks;      // 0x4E0 <-- verified to match Windows XP, ddMiscellanousCallbacks
169 /* 0x4EC */    DD_MISCELLANEOUS2CALLBACKS ddMiscellanous2Callbacks;    // 0x4EC <-- verified to match Windows XP, ddMiscellanous2Callbacks
170 /* 0x504 */    DD_NTCALLBACKS ddNtCallbacks;                           // 0x504 <-- verified to match Windows Server 2003
171 /* 0x518 */    DD_COLORCONTROLCALLBACKS ddColorControlCallbacks;       // 0x518 <-- verified to match Windows Server 2003
172 /* 0x524 */    DD_KERNELCALLBACKS ddKernelCallbacks;                   // 0x524 <-- verified to match Windows Server 2003
173 /* 0x534 */    D3DNTHAL_CALLBACKS3 d3dNtHalCallbacks3;                 // 0x524 <-- verified to match Windows Server 2003
174 /* 0x54C */    DD_MOTIONCOMPCALLBACKS ddMotionCompCallbacks;           // 0x54C <-- verified to match Windows Server 2003
175 /* 0x57C */    DDMORESURFACECAPS ddMoreSurfaceCaps;                    // 0x57C <-- verified to match Windows Server 2003
176 /* 0x5A8 */    EDD_DIRECTDRAW_LOCAL* peDirectDrawLocalList; // 0x5A8 <-- verified to match Windows XP, it is a current local struct, not a list, peDirectDrawLocalList Current
177 /* 0x5AC */    EDD_SURFACE* peSurface_LockList;
178 /* 0x5B0 */    FLONG fl;
179 /* 0x5B4 */    ULONG cSurfaceLocks;
180 /* 0x5B8 */    PKEVENT pAssertModeEvent;
181 /* 0x5BC */    EDD_SURFACE *peSurfaceCurrent;
182 /* 0x5C0 */    EDD_SURFACE *peSurfacePrimary;
183 /* 0x5C4 */    BOOL bSuspended;                             // 0x5C4 <-- verified to match Windows XP, tells dxg to use driver's own api or return error code instead
184 /* 0x5C8 */    ULONG unk_5c8[12];
185 /* 0x5F8 */    RECTL rcbounds;
186 /* 0x608 */    ULONG unk_608;
187 /* 0x60C */    HDEV hDev;                                   // 0x60c <-- verified to match Windows XP, The real Pdev, hDev
188 
189 /* Windows XP and higher */
190 /* 0x610 */    ULONG unk_610[63];
191 /* 0x70C */    ULONG unk_70C;
192 } EDD_DIRECTDRAW_GLOBAL, *PEDD_DIRECTDRAW_GLOBAL;
193 
194 #endif
195