ReactOS 0.4.16-dev-319-g6cf4263
ddraw.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

HRESULT WINAPI Main_DirectDraw_QueryInterface (LPDDRAWI_DIRECTDRAW_INT This, REFIID id, LPVOID *obj)
 
ULONG WINAPI Main_DirectDraw_AddRef (LPDDRAWI_DIRECTDRAW_INT This)
 
ULONG WINAPI Main_DirectDraw_Release (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_Compact (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_CreateClipper (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDIRECTDRAWCLIPPER *ppClipper, IUnknown *pUnkOuter)
 
HRESULT WINAPI Main_DirectDraw_CreatePalette (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE *ppPalette, LPUNKNOWN pUnkOuter)
 
HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC pDDSD, LPDDRAWI_DDRAWSURFACE_INT *ppSurf, IUnknown *pUnkOuter)
 
HRESULT WINAPI Main_DirectDraw_CreateSurface4 (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pDDSD, LPDDRAWI_DDRAWSURFACE_INT *ppSurf, IUnknown *pUnkOuter)
 
HRESULT WINAPI Main_DirectDraw_DuplicateSurface (LPDDRAWI_DIRECTDRAW_INT This, LPDIRECTDRAWSURFACE7 src, LPDIRECTDRAWSURFACE7 *dst)
 
HRESULT WINAPI Main_DirectDraw_EnumDisplayModes (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC pDDSD, LPVOID pContext, LPDDENUMMODESCALLBACK pCallback)
 
HRESULT WINAPI Main_DirectDraw_EnumDisplayModes4 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC2 pDDSD, LPVOID pContext, LPDDENUMMODESCALLBACK2 pCallback)
 
HRESULT WINAPI Main_DirectDraw_EnumSurfaces (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC lpDDSD2, LPVOID context, LPDDENUMSURFACESCALLBACK callback)
 
HRESULT WINAPI Main_DirectDraw_EnumSurfaces4 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD2, LPVOID context, LPDDENUMSURFACESCALLBACK2 callback)
 
HRESULT WINAPI Main_DirectDraw_EnumSurfaces7 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD2, LPVOID context, LPDDENUMSURFACESCALLBACK7 callback)
 
HRESULT WINAPI Main_DirectDraw_FlipToGDISurface (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_GetCaps (LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps, LPDDCAPS pHELCaps)
 
HRESULT WINAPI Main_DirectDraw_GetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC pDDSD)
 
HRESULT WINAPI Main_DirectDraw_GetDisplayMode4 (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pDDSD)
 
HRESULT WINAPI Main_DirectDraw_GetFourCCCodes (LPDDRAWI_DIRECTDRAW_INT This, LPDWORD lpNumCodes, LPDWORD lpCodes)
 
HRESULT WINAPI Main_DirectDraw_GetGDISurface (LPDDRAWI_DIRECTDRAW_INT This, LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
 
HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency (LPDDRAWI_DIRECTDRAW_INT This, LPDWORD lpFreq)
 
HRESULT WINAPI Main_DirectDraw_GetScanLine (LPDDRAWI_DIRECTDRAW_INT This, LPDWORD lpdwScanLine)
 
HRESULT WINAPI Main_DirectDraw_GetVerticalBlankStatus (LPDDRAWI_DIRECTDRAW_INT This, LPBOOL lpbIsInVB)
 
HRESULT WINAPI Main_DirectDraw_Initialize (LPDDRAWI_DIRECTDRAW_INT This, LPGUID lpGUID)
 
HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDDRAWI_DIRECTDRAW_INT This, HWND hwnd, DWORD cooplevel)
 
HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP)
 
HRESULT WINAPI Main_DirectDraw_SetDisplayMode2 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 
HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, HANDLE h)
 
HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem4 (LPDDRAWI_DIRECTDRAW_INT This, LPDDSCAPS2 ddscaps, LPDWORD dwTotal, LPDWORD dwFree)
 
HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC (LPDDRAWI_DIRECTDRAW_INT This, HDC hdc, LPDIRECTDRAWSURFACE7 *lpDDS)
 
HRESULT WINAPI Main_DirectDraw_RestoreAllSurfaces (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel (LPDDRAWI_DIRECTDRAW_INT This)
 
HRESULT WINAPI Main_DirectDraw_GetDeviceIdentifier7 (LPDDRAWI_DIRECTDRAW_INT This, LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
 
HRESULT WINAPI Main_DirectDraw_StartModeTest (LPDDRAWI_DIRECTDRAW_INT This, LPSIZE pModes, DWORD dwNumModes, DWORD dwFlags)
 
HRESULT WINAPI Main_DirectDraw_EvaluateMode (LPDDRAWI_DIRECTDRAW_INT This, DWORD a, DWORD *b)
 
DWORD CALLBACK HelDdSurfAddAttachedSurface (LPDDHAL_ADDATTACHEDSURFACEDATA lpDestroySurface)
 
DWORD CALLBACK HelDdSurfBlt (LPDDHAL_BLTDATA lpBltData)
 
DWORD CALLBACK HelDdSurfDestroySurface (LPDDHAL_DESTROYSURFACEDATA lpDestroySurfaceData)
 
DWORD CALLBACK HelDdSurfFlip (LPDDHAL_FLIPDATA lpFlipData)
 
DWORD CALLBACK HelDdSurfGetBltStatus (LPDDHAL_GETBLTSTATUSDATA lpGetBltStatusData)
 
DWORD CALLBACK HelDdSurfGetFlipStatus (LPDDHAL_GETFLIPSTATUSDATA lpGetFlipStatusData)
 
DWORD CALLBACK HelDdSurfLock (LPDDHAL_LOCKDATA lpLockData)
 
DWORD CALLBACK HelDdSurfreserved4 (DWORD *lpPtr)
 
DWORD CALLBACK HelDdSurfSetClipList (LPDDHAL_SETCLIPLISTDATA lpSetClipListData)
 
DWORD CALLBACK HelDdSurfSetColorKey (LPDDHAL_SETCOLORKEYDATA lpSetColorKeyData)
 
DWORD CALLBACK HelDdSurfSetOverlayPosition (LPDDHAL_SETOVERLAYPOSITIONDATA lpSetOverlayPositionData)
 
DWORD CALLBACK HelDdSurfSetPalette (LPDDHAL_SETPALETTEDATA lpSetPaletteData)
 
DWORD CALLBACK HelDdSurfUnlock (LPDDHAL_UNLOCKDATA lpUnLockData)
 
DWORD CALLBACK HelDdSurfUpdateOverlay (LPDDHAL_UPDATEOVERLAYDATA lpUpDateOverLayData)
 

Function Documentation

◆ HelDdSurfAddAttachedSurface()

DWORD CALLBACK HelDdSurfAddAttachedSurface ( LPDDHAL_ADDATTACHEDSURFACEDATA  lpDestroySurface)

Definition at line 12 of file callbacks_surf_hel.c.

13{
14 DX_STUB;
15}
#define DX_STUB
Definition: rosdraw.h:224

Referenced by StartDirectDrawHel().

◆ HelDdSurfBlt()

DWORD CALLBACK HelDdSurfBlt ( LPDDHAL_BLTDATA  lpBltData)

Definition at line 17 of file callbacks_surf_hel.c.

18{
20
21 if (lpBltData->dwFlags & DDBLT_COLORFILL)
22 {
23 HBRUSH hbr = CreateSolidBrush(lpBltData->bltFX.dwFillColor );
25 (CONST RECT *)&lpBltData->rDest,
26 hbr);
27 DeleteObject(hbr);
28 lpBltData->ddRVal = DD_OK;
29 }
30 else if (lpBltData->dwFlags & DDBLT_ROP)
31 {
33 lpBltData->rDest.top,
34 lpBltData->rDest.left,
35 lpBltData->rDest.right,
36 lpBltData->rDest.bottom,
38 lpBltData->rSrc.top,
39 lpBltData->rSrc.right,
40 lpBltData->bltFX.dwROP);
41 lpBltData->ddRVal = DD_OK;
42 }
44}
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
pKey DeleteObject()
static HDC
Definition: imagelist.c:88
#define CONST
Definition: pedump.c:81
#define DX_WINDBG_trace()
Definition: rosdraw.h:262
#define DDBLT_COLORFILL
Definition: ddraw.h:555
#define DDBLT_ROP
Definition: ddraw.h:562
#define DD_OK
Definition: ddraw.h:186
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
DWORD dwROP
Definition: ddraw.h:1274
DWORD dwFillColor
Definition: ddraw.h:1310
LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface
Definition: ddrawi.h:849
RECTL rSrc
Definition: ddrawi.h:850
DDBLTFX bltFX
Definition: ddrawi.h:853
DWORD dwFlags
Definition: ddrawi.h:851
HRESULT ddRVal
Definition: ddrawi.h:854
LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface
Definition: ddrawi.h:847
RECTL rDest
Definition: ddrawi.h:848
LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore
Definition: ddrawi.h:1467
LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl
Definition: ddrawi.h:1431
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by StartDirectDrawHel().

◆ HelDdSurfDestroySurface()

DWORD CALLBACK HelDdSurfDestroySurface ( LPDDHAL_DESTROYSURFACEDATA  lpDestroySurfaceData)

Definition at line 46 of file callbacks_surf_hel.c.

47{
48 DX_STUB;
49}

Referenced by StartDirectDrawHel().

◆ HelDdSurfFlip()

DWORD CALLBACK HelDdSurfFlip ( LPDDHAL_FLIPDATA  lpFlipData)

Definition at line 51 of file callbacks_surf_hel.c.

52{
53 DX_STUB;
54}

Referenced by StartDirectDrawHel().

◆ HelDdSurfGetBltStatus()

DWORD CALLBACK HelDdSurfGetBltStatus ( LPDDHAL_GETBLTSTATUSDATA  lpGetBltStatusData)

Definition at line 56 of file callbacks_surf_hel.c.

57{
58 DX_STUB;
59}

Referenced by StartDirectDrawHel().

◆ HelDdSurfGetFlipStatus()

DWORD CALLBACK HelDdSurfGetFlipStatus ( LPDDHAL_GETFLIPSTATUSDATA  lpGetFlipStatusData)

Definition at line 61 of file callbacks_surf_hel.c.

62{
63 DX_STUB;
64}

Referenced by StartDirectDrawHel().

◆ HelDdSurfLock()

DWORD CALLBACK HelDdSurfLock ( LPDDHAL_LOCKDATA  lpLockData)

Definition at line 66 of file callbacks_surf_hel.c.

67{
68
69 HDC hDC;
70 HBITMAP hImage = NULL;
71
72 LONG cbBuffer = 0;
74
75 HDC hMemDC = NULL;
76 HBITMAP hDCBmp = NULL;
77 BITMAP bm = {0};
78
80
81 /* ToDo tell ddraw internal this surface is locked */
82 /* ToDo add support for dwFlags */
83
84
85 /* Get our hdc for the active window */
87
88 if (hDC != NULL)
89 {
90 /* Create a memory bitmap to store a copy of current hdc surface */
91
92 if (!lpLockData->bHasRect)
93 {
94 hImage = CreateCompatibleBitmap (hDC, lpLockData->lpDDSurface->lpGbl->wWidth, lpLockData->lpDDSurface->lpGbl->wHeight);
95 }
96 else
97 {
98 hImage = CreateCompatibleBitmap (hDC, lpLockData->rArea.right, lpLockData->rArea.bottom);
99 }
100
101 /* Create a memory hdc so we can draw on our current memory bitmap */
102 hMemDC = CreateCompatibleDC(hDC);
103
104 if (hMemDC != NULL)
105 {
106 /* Select our memory bitmap to our memory hdc */
107 hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage);
108
109 /* Get our memory bitmap information */
110 GetObject(hImage, sizeof(BITMAP), &bm);
111
112 if (!lpLockData->bHasRect)
113 {
114 BitBlt (hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, hDC, 0, 0, SRCCOPY);
115 }
116 else
117 {
118 BitBlt (hMemDC, lpLockData->rArea.top, lpLockData->rArea.left, lpLockData->rArea.right, lpLockData->rArea.bottom, hDC, 0, 0, SRCCOPY);
119 }
120
121 SelectObject (hMemDC, hDCBmp);
122
123 /* Allocate memory buffer for the bitmap pixel data */
124 cbBuffer = bm.bmWidthBytes * bm.bmHeight ;
126
127 if (pixels != NULL)
128 {
129 /* Get the bitmap bits */
130 GetBitmapBits(hImage,cbBuffer,pixels);
131
132 /* Fixme HACK - check which member stores the HEL bitmap buffer */
134
135 /* Setup return value */
136 lpLockData->ddRVal = DD_OK;
137 lpLockData->lpSurfData = pixels;
138 }
139 }
140 }
141
142
143 /* Free the pixels buffer if we fail */
144 if ( (pixels != NULL) &&
145 (lpLockData->ddRVal != DD_OK) )
146 {
148 }
149
150 /* Cleanup after us */
151 if (hImage != NULL)
152 {
153 DeleteObject (hImage);
154 }
155
156 if (hMemDC != NULL)
157 {
158 DeleteDC (hMemDC);
159 }
160
162}
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
static HBITMAP
Definition: button.c:44
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
Definition: bl.h:1331
RECTL rArea
Definition: ddrawi.h:831
DWORD bHasRect
Definition: ddrawi.h:830
HRESULT ddRVal
Definition: ddrawi.h:833
LPVOID lpSurfData
Definition: ddrawi.h:832
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:829
LPDDRAWI_DDRAWSURFACE_GBL lpGbl
Definition: ddrawi.h:1468
ULONG_PTR hFocusWnd
Definition: ddrawi.h:1184
uint32_t * LPDWORD
Definition: typedefs.h:59
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by StartDirectDrawHel().

◆ HelDdSurfreserved4()

DWORD CALLBACK HelDdSurfreserved4 ( DWORD lpPtr)

Definition at line 164 of file callbacks_surf_hel.c.

165{
166 /* This api is not documented by MS, keep it stubbed */
167 DX_STUB;
168}

Referenced by StartDirectDrawHel().

◆ HelDdSurfSetClipList()

DWORD CALLBACK HelDdSurfSetClipList ( LPDDHAL_SETCLIPLISTDATA  lpSetClipListData)

Definition at line 170 of file callbacks_surf_hel.c.

171{
172 DX_STUB;
173}

Referenced by StartDirectDrawHel().

◆ HelDdSurfSetColorKey()

DWORD CALLBACK HelDdSurfSetColorKey ( LPDDHAL_SETCOLORKEYDATA  lpSetColorKeyData)

Definition at line 175 of file callbacks_surf_hel.c.

176{
177 DX_STUB;
178}

Referenced by StartDirectDrawHel().

◆ HelDdSurfSetOverlayPosition()

DWORD CALLBACK HelDdSurfSetOverlayPosition ( LPDDHAL_SETOVERLAYPOSITIONDATA  lpSetOverlayPositionData)

Definition at line 180 of file callbacks_surf_hel.c.

181{
182 DX_STUB;
183}

Referenced by StartDirectDrawHel().

◆ HelDdSurfSetPalette()

DWORD CALLBACK HelDdSurfSetPalette ( LPDDHAL_SETPALETTEDATA  lpSetPaletteData)

Definition at line 185 of file callbacks_surf_hel.c.

186{
187 DX_STUB;
188}

Referenced by StartDirectDrawHel().

◆ HelDdSurfUnlock()

DWORD CALLBACK HelDdSurfUnlock ( LPDDHAL_UNLOCKDATA  lpUnLockData)

Definition at line 190 of file callbacks_surf_hel.c.

191{
192 HDC hDC;
193 HBITMAP hImage = NULL;
194
195 HDC hMemDC = NULL;
196 HBITMAP hDCBmp = NULL;
197 BITMAP bm = {0};
198
200
201 /* Get our hdc for the active window */
203
204 if (hDC != NULL)
205 {
206 /* Create a memory bitmap to store a copy of current hdc surface */
207
208 /* fixme the rcarea are not store in the struct yet so the data will look corrupted */
209 hImage = CreateCompatibleBitmap (hDC, lpUnLockData->lpDDSurface->lpGbl->wWidth, lpUnLockData->lpDDSurface->lpGbl->wHeight);
210
211 /* Create a memory hdc so we can draw on our current memory bitmap */
212 hMemDC = CreateCompatibleDC(hDC);
213
214 if (hMemDC != NULL)
215 {
216 /* Select our memory bitmap to our memory hdc */
217 hDCBmp = (HBITMAP) SelectObject (hMemDC, hImage);
218
219 /* Get our memory bitmap information */
220 GetObject(hImage, sizeof(BITMAP), &bm);
221
222 SetBitmapBits(hImage,bm.bmWidthBytes * bm.bmHeight, lpUnLockData->lpDDSurface->lpSurfMore->lpDDRAWReserved2);
223
224 BitBlt (hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
225
226 SelectObject (hMemDC, hDCBmp);
227
228 /* Setup return value */
229 lpUnLockData->ddRVal = DD_OK;
230 }
231 }
232
233 /* Cleanup after us */
234 if (hImage != NULL)
235 {
236 DeleteObject (hImage);
237 }
238
239 if (hMemDC != NULL)
240 {
241 DeleteDC (hMemDC);
242 }
243
244 if (lpUnLockData->lpDDSurface->lpSurfMore->lpDDRAWReserved2 != NULL)
245 {
247 }
248
250}
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:840
HRESULT ddRVal
Definition: ddrawi.h:841
LONG WINAPI SetBitmapBits(_In_ HBITMAP hbm, _In_ DWORD cb, _In_reads_bytes_(cb) CONST VOID *pvBits)

Referenced by StartDirectDrawHel().

◆ HelDdSurfUpdateOverlay()

DWORD CALLBACK HelDdSurfUpdateOverlay ( LPDDHAL_UPDATEOVERLAYDATA  lpUpDateOverLayData)

Definition at line 252 of file callbacks_surf_hel.c.

253{
254 DX_STUB;
255}

Referenced by StartDirectDrawHel().

◆ Main_DirectDraw_AddRef()

ULONG WINAPI Main_DirectDraw_AddRef ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 145 of file ddraw_main.c.

146{
147 ULONG retValue = 0;
148
150
151 /* Lock the thread */
153
155 {
156 /* Increment the internal ref counter */
157 This->dwIntRefCnt++;
158
159 /* Increment the local internal ref counter */
160 This->lpLcl->dwLocalRefCnt++;
161
162 if (This->lpLcl->lpGbl != NULL)
163 {
164 /* Increment the global internal ref counter */
165 This->lpLcl->lpGbl->dwRefCnt++;
166 }
167 }
169 {
170 }
171 _SEH2_END;
172
174 {
175 retValue = This->dwIntRefCnt;
176 }
178 {
179 retValue = 0;
180 }
181 _SEH2_END;
182
183 /* Release the thread lock */
185
186 /* Return the local Ref counter */
187 return retValue;
188}
VOID WINAPI AcquireDDThreadLock()
Definition: main.c:412
VOID WINAPI ReleaseDDThreadLock()
Definition: main.c:421
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
uint32_t ULONG
Definition: typedefs.h:59

Referenced by Create_DirectDraw(), Main_DirectDraw_CreatePalette(), Main_DirectDraw_CreateSurface4(), Main_DirectDraw_QueryInterface(), ThunkDirectDraw2_AddRef(), ThunkDirectDraw4_AddRef(), and ThunkDirectDraw_AddRef().

◆ Main_DirectDraw_Compact()

HRESULT WINAPI Main_DirectDraw_Compact ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 267 of file ddraw_main.c.

268{
269 HRESULT retVal = DD_OK;
270
272
273 /* Lock the thread */
275
277 {
278 /* Check if Exclusive mode has been activated */
279 if (This->lpLcl->lpGbl->lpExclusiveOwner != This->lpLcl)
280 {
281 retVal = DDERR_NOEXCLUSIVEMODE;
282 }
283 }
285 {
286 }
287 _SEH2_END;
288
289 /* Release the thread lock */
291
292 return retVal;
293}
#define DDERR_NOEXCLUSIVEMODE
Definition: ddraw.h:93

Referenced by ThunkDirectDraw2_Compact(), ThunkDirectDraw4_Compact(), and ThunkDirectDraw_Compact().

◆ Main_DirectDraw_CreateClipper()

HRESULT WINAPI Main_DirectDraw_CreateClipper ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDIRECTDRAWCLIPPER ppClipper,
IUnknown pUnkOuter 
)

◆ Main_DirectDraw_CreatePalette()

HRESULT WINAPI Main_DirectDraw_CreatePalette ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPPALETTEENTRY  palent,
LPDIRECTDRAWPALETTE ppPalette,
LPUNKNOWN  pUnkOuter 
)

Definition at line 545 of file ddraw_main.c.

547{
548 HRESULT ret = DD_OK;
550
552 *ppPalette = NULL;
553
555 {
556 ret = Internal_CreatePalette(This, dwFlags, palent, ppPalette, pUnkOuter);
557 }
559 {
561 }
562 _SEH2_END;
563
564 //Versions 7 and 4 are addref'ed
565 if((This->lpVtbl == &DirectDraw7_Vtable || This->lpVtbl == &DirectDraw4_Vtable) && *ppPalette != NULL)
567
569 return ret;
570}
HRESULT Internal_CreatePalette(LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags, LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE *ppPalette, LPUNKNOWN pUnkOuter)
Definition: createpalette.c:33
ULONG WINAPI Main_DirectDraw_AddRef(LPDDRAWI_DIRECTDRAW_INT This)
Definition: ddraw_main.c:145
CRITICAL_SECTION ddcs
Definition: main.c:14
IDirectDraw7Vtbl DirectDraw7_Vtable
IDirectDraw4Vtbl DirectDraw4_Vtable
Definition: ddraw_thunk.c:890
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
int ret
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by ThunkDirectDraw2_CreatePalette(), ThunkDirectDraw4_CreatePalette(), and ThunkDirectDraw_CreatePalette().

◆ Main_DirectDraw_CreateSurface()

HRESULT WINAPI Main_DirectDraw_CreateSurface ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDSURFACEDESC  pDDSD,
LPDDRAWI_DDRAWSURFACE_INT ppSurf,
IUnknown pUnkOuter 
)

Definition at line 478 of file ddraw_main.c.

480{
482 DDSURFACEDESC2 dd_desc_v2;
483
485
487 *ppSurf = NULL;
488
490 {
491 if (pDDSD->dwSize == sizeof(DDSURFACEDESC))
492 {
493 CopyDDSurfDescToDDSurfDesc2(&dd_desc_v2, (LPDDSURFACEDESC)pDDSD);
495 &dd_desc_v2,
496 ppSurf,
497 pUnkOuter);
498 }
499 else
500 {
502 }
503 }
505 {
507 }
508 _SEH2_END;
510 return ret;
511}
void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src_pDesc)
HRESULT Internal_CreateSurface(LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD, LPDDRAWI_DDRAWSURFACE_INT *ppSurf, IUnknown *pUnkOuter)
Definition: createsurface.c:18
#define DDERR_GENERIC
Definition: ddraw.h:72

Referenced by ThunkDirectDraw2_CreateSurface(), ThunkDirectDraw4_CreateSurface(), and ThunkDirectDraw_CreateSurface().

◆ Main_DirectDraw_CreateSurface4()

HRESULT WINAPI Main_DirectDraw_CreateSurface4 ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDSURFACEDESC2  pDDSD,
LPDDRAWI_DDRAWSURFACE_INT ppSurf,
IUnknown pUnkOuter 
)

Definition at line 516 of file ddraw_main.c.

518{
519 HRESULT ret = DD_OK;
521
523 *ppSurf = NULL;
524
526 {
527 ret = Internal_CreateSurface(This, pDDSD, ppSurf, pUnkOuter);
528 }
530 {
532 }
533 _SEH2_END;
534
535 if(*ppSurf != NULL)
537
539 return ret;
540}

◆ Main_DirectDraw_DuplicateSurface()

◆ Main_DirectDraw_EnumDisplayModes()

HRESULT WINAPI Main_DirectDraw_EnumDisplayModes ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDDSURFACEDESC  pDDSD,
LPVOID  pContext,
LPDDENUMMODESCALLBACK  pCallback 
)

Definition at line 14 of file ddraw_displaymode.c.

16{
18 INT iMode = 0;
19 DEVMODE DevMode;
20
22
23 ZeroMemory(&DevMode, sizeof(DEVMODE));
24
26 {
27
28 if (pDDSD != NULL)
29 {
30 if (pDDSD->dwSize != sizeof(DDSURFACEDESC))
31 {
33 }
34 }
35
37 {
39 }
40 else if ( ret == DD_OK)
41 {
42
43 DevMode.dmSize = sizeof(DEVMODE);
44
45 while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) != FALSE)
46 {
47 DDSURFACEDESC SurfaceDesc;
48
49 ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC));
50
51 iMode++;
52
53 SurfaceDesc.dwSize = sizeof (DDSURFACEDESC);
55 SurfaceDesc.dwHeight = DevMode.dmPelsHeight;
56 SurfaceDesc.dwWidth = DevMode.dmPelsWidth;
57 SurfaceDesc.lPitch = DevMode.dmPelsWidth * DevMode.dmBitsPerPel / 8;
58 SurfaceDesc.dwRefreshRate = DevMode.dmDisplayFrequency;
59
60 SurfaceDesc.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
61 SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_RGB;
62 // FIXME: get these
63 /*
64 SurfaceDesc.ddpfPixelFormat.dwRBitMask =
65 SurfaceDesc.ddpfPixelFormat.dwGBitMask =
66 SurfaceDesc.ddpfPixelFormat.dwBBitMask =
67 SurfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask =
68 */
69 SurfaceDesc.ddpfPixelFormat.dwRGBBitCount = DevMode.dmBitsPerPel;
70
71 // FIXME1: This->lpLcl->lpGbl->dwMonitorFrequency is not set !
72 if(dwFlags & DDEDM_REFRESHRATES && SurfaceDesc.dwRefreshRate != This->lpLcl->lpGbl->dwMonitorFrequency)
73 {
74 //continue; // FIXME2: what is SurfaceDesc.dwRefreshRate supposed to be set to ?
75 }
76
77 // FIXME: Take case when DDEDM_STANDARDVGAMODES flag is not set in account
78
79 if(pDDSD)
80 {
81 if (pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwHeight != SurfaceDesc.dwHeight)
82 continue;
83
84 if (pDDSD->dwFlags & DDSD_WIDTH && pDDSD->dwWidth != SurfaceDesc.dwWidth)
85 continue;
86
87 if (pDDSD->dwFlags & DDSD_PITCH && pDDSD->lPitch != SurfaceDesc.lPitch)
88 continue;
89
90 if (pDDSD->dwFlags & DDSD_REFRESHRATE && pDDSD->dwRefreshRate != SurfaceDesc.dwRefreshRate)
91 continue;
92
93 if (pDDSD->dwFlags & DDSD_PIXELFORMAT && pDDSD->ddpfPixelFormat.dwRGBBitCount != SurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
94 continue; // FIXME: test for the other members of ddpfPixelFormat as well
95 }
96
97 if((*pCallback)(&SurfaceDesc, pContext) == DDENUMRET_CANCEL)
98 break;
99 }
100 }
101
102 }
104 {
105 }
106 _SEH2_END;
107
108 return ret;
109}
void DDSURFACEDESC
Definition: amvideo.idl:25
#define FALSE
Definition: types.h:117
BOOL NTAPI IsBadCodePtr(FARPROC lpfn)
Definition: except.c:872
FxPnpStateCallbackInfo * pCallback
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
#define DDSD_PITCH
Definition: ddraw.h:211
#define DDEDM_REFRESHRATES
Definition: ddraw.h:529
#define DDSD_REFRESHRATE
Definition: ddraw.h:222
#define DDSD_HEIGHT
Definition: ddraw.h:209
struct _DDPIXELFORMAT DDPIXELFORMAT
#define DDENUMRET_CANCEL
Definition: ddraw.h:188
#define DDPF_RGB
Definition: ddraw.h:507
DWORD dmDisplayFrequency
Definition: wingdi.h:1602
DWORD dmPelsWidth
Definition: wingdi.h:1596
DWORD dmPelsHeight
Definition: wingdi.h:1597
DWORD dmBitsPerPel
Definition: wingdi.h:1595
WORD dmSize
Definition: wingdi.h:1568
int32_t INT
Definition: typedefs.h:58
#define ZeroMemory
Definition: winbase.h:1737
_In_ ULONG iMode
Definition: winddi.h:3520
DEVMODEA DEVMODE
Definition: wingdi.h:4418

Referenced by ThunkDirectDraw2_EnumDisplayModes(), ThunkDirectDraw4_EnumDisplayModes(), and ThunkDirectDraw_EnumDisplayModes().

◆ Main_DirectDraw_EnumDisplayModes4()

HRESULT WINAPI Main_DirectDraw_EnumDisplayModes4 ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDDSURFACEDESC2  pDDSD,
LPVOID  pContext,
LPDDENUMMODESCALLBACK2  pCallback 
)

Definition at line 112 of file ddraw_displaymode.c.

114{
115 HRESULT ret = DD_OK;
116 INT iMode = 0;
117 DEVMODE DevMode;
118
120
121 ZeroMemory(&DevMode, sizeof(DEVMODE));
122
124 {
125
126 if (pDDSD != NULL)
127 {
128 if (pDDSD->dwSize != sizeof(DDSURFACEDESC2))
129 {
131 }
132 }
133
135 {
137 }
138 else if ( ret == DD_OK)
139 {
140
141 DevMode.dmSize = sizeof(DEVMODE);
142
143 while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) != FALSE)
144 {
145 DDSURFACEDESC2 SurfaceDesc;
146
147 ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC2));
148
149 iMode++;
150
151 SurfaceDesc.dwSize = sizeof (DDSURFACEDESC2);
153 SurfaceDesc.dwHeight = DevMode.dmPelsHeight;
154 SurfaceDesc.dwWidth = DevMode.dmPelsWidth;
155 SurfaceDesc.lPitch = DevMode.dmPelsWidth * DevMode.dmBitsPerPel / 8;
156 SurfaceDesc.dwRefreshRate = DevMode.dmDisplayFrequency;
157
158 SurfaceDesc.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
159 SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_RGB;
160 // FIXME: get these
161 /*
162 SurfaceDesc.ddpfPixelFormat.dwRBitMask =
163 SurfaceDesc.ddpfPixelFormat.dwGBitMask =
164 SurfaceDesc.ddpfPixelFormat.dwBBitMask =
165 SurfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask =
166 */
167 SurfaceDesc.ddpfPixelFormat.dwRGBBitCount = DevMode.dmBitsPerPel;
168
169 // FIXME1: This->lpLcl->lpGbl->dwMonitorFrequency is not set !
170 if(dwFlags & DDEDM_REFRESHRATES && SurfaceDesc.dwRefreshRate != This->lpLcl->lpGbl->dwMonitorFrequency)
171 {
172 //continue; // FIXME2: what is SurfaceDesc.dwRefreshRate supposed to be set to ?
173 }
174
175 // FIXME: Take case when DDEDM_STANDARDVGAMODES flag is not set in account
176
177 if(pDDSD)
178 {
179 if (pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwHeight != SurfaceDesc.dwHeight)
180 continue;
181
182 if (pDDSD->dwFlags & DDSD_WIDTH && pDDSD->dwWidth != SurfaceDesc.dwWidth)
183 continue;
184
185 if (pDDSD->dwFlags & DDSD_PITCH && pDDSD->lPitch != SurfaceDesc.lPitch)
186 continue;
187
188 if (pDDSD->dwFlags & DDSD_REFRESHRATE && pDDSD->dwRefreshRate != SurfaceDesc.dwRefreshRate)
189 continue;
190
192 continue; // FIXME: test for the other members of ddpfPixelFormat as well
193 }
194
195 if((*pCallback)(&SurfaceDesc, pContext) == DDENUMRET_CANCEL)
196 break;
197 }
198 }
199
200 }
202 {
203 }
204 _SEH2_END;
205
206 return ret;
207}
struct _DDSURFACEDESC2 DDSURFACEDESC2
DWORD dwSize
Definition: ddraw.h:1070
DWORD dwRGBBitCount
Definition: ddraw.h:1075
DWORD dwFlags
Definition: ddraw.h:1071
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
DWORD dwRefreshRate
Definition: ddraw.h:1169
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1185
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152

◆ Main_DirectDraw_EnumSurfaces()

HRESULT WINAPI Main_DirectDraw_EnumSurfaces ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDDSURFACEDESC  lpDDSD2,
LPVOID  context,
LPDDENUMSURFACESCALLBACK  callback 
)

◆ Main_DirectDraw_EnumSurfaces4()

HRESULT WINAPI Main_DirectDraw_EnumSurfaces4 ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDDSURFACEDESC2  lpDDSD2,
LPVOID  context,
LPDDENUMSURFACESCALLBACK2  callback 
)

Definition at line 43 of file ddraw_stubs.c.

46{
48 DX_STUB;
49}

◆ Main_DirectDraw_EnumSurfaces7()

HRESULT WINAPI Main_DirectDraw_EnumSurfaces7 ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
LPDDSURFACEDESC2  lpDDSD2,
LPVOID  context,
LPDDENUMSURFACESCALLBACK7  callback 
)

Definition at line 52 of file ddraw_stubs.c.

55{
57 DX_STUB;
58}

◆ Main_DirectDraw_EvaluateMode()

HRESULT WINAPI Main_DirectDraw_EvaluateMode ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  a,
DWORD b 
)

Definition at line 131 of file ddraw_stubs.c.

132{
134 DX_STUB;
135}

◆ Main_DirectDraw_FlipToGDISurface()

HRESULT WINAPI Main_DirectDraw_FlipToGDISurface ( LPDDRAWI_DIRECTDRAW_INT  This)

◆ Main_DirectDraw_GetAvailableVidMem4()

HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem4 ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDSCAPS2  ddscaps,
LPDWORD  dwTotal,
LPDWORD  dwFree 
)

Definition at line 318 of file ddraw_main.c.

320{
321 HRESULT retVal = DD_OK;
323
325
327 {
328 // There is no HEL implementation of this api
329 if (!(This->lpLcl->lpDDCB->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY) ||
330 (This->lpLcl->lpGbl->dwFlags & DDRAWI_NOHARDWARE) )
331 {
332 retVal = DDERR_NODIRECTDRAWHW;
333 }
334 else
335 {
336 if ((!dwTotal && !dwFree) || !ddscaps)
337 {
338 retVal = DDERR_INVALIDPARAMS;
340 }
341
345 {
346 retVal = DDERR_INVALIDPARAMS;
348 }
349
350
351 /* ddscaps->dwCaps2 & 0x01
352 this flag is outdate and are
353 set to 0 in ms dxsdk the name of
354 this flag is DDSCAPS2_HARDWAREDEINTERLACE
355 */
356
357 if ( ddscaps->dwCaps2 & 0x01)
358 {
359 retVal = DDERR_INVALIDCAPS;
361 }
362
367 {
368 retVal = DDERR_INVALIDCAPS;
370 }
371
372 if ( ddscaps->dwCaps4)
373 {
374 retVal = DDERR_INVALIDCAPS;
376 }
377
379 memdata.lpDD = This->lpLcl->lpGbl;
380 memdata.ddRVal = DDERR_INVALIDPARAMS;
381
382 memdata.ddsCapsEx.dwCaps2 = ddscaps->dwCaps2;
383 memdata.ddsCapsEx.dwCaps3 = ddscaps->dwCaps3;
384
385 This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
386
387 if (This->lpLcl->lpDDCB->HALDDMiscellaneous.GetAvailDriverMemory(&memdata) == DDHAL_DRIVER_NOTHANDLED)
388 {
389 retVal = DDERR_NODIRECTDRAWHW;
390
391 if (dwTotal)
392 *dwTotal = 0;
393
394 if (dwFree)
395 *dwFree = 0;
396 }
397 else
398 {
399 if (dwTotal)
400 *dwTotal = memdata.dwTotal;
401
402 if (dwFree)
403 *dwFree = memdata.dwFree;
404
405 retVal = memdata.ddRVal;
406 }
407 }
408 }
410 {
411 }
412 _SEH2_END;
413
414 return retVal;
415}
#define DDRAWI_NOHARDWARE
Definition: ddrawi.h:1301
#define DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
Definition: ddrawi.h:688
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
#define _SEH2_LEAVE
Definition: pseh2_64.h:167
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCAPS3_AUTOGENMIPMAP
Definition: ddraw.h:326
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
#define DDSCAPS3_DMAP
Definition: ddraw.h:327
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define DDSCAPS_WRITEONLY
Definition: ddraw.h:266
#define DDSCAPS3_MULTISAMPLE_QUALITY_MASK
Definition: ddraw.h:321
#define DDSCAPS_PALETTE
Definition: ddraw.h:257
#define DDSCAPS3_RESERVED1
Definition: ddraw.h:323
#define DDSCAPS_FLIP
Definition: ddraw.h:253
#define DDSCAPS3_MULTISAMPLE_MASK
Definition: ddraw.h:320
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
#define DDSCAPS3_RESERVED2
Definition: ddraw.h:324
#define DDSCAPS_OWNDC
Definition: ddraw.h:268
#define DDERR_NODIRECTDRAWHW
Definition: ddraw.h:137
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:261
#define DDSCAPS3_LIGHTWEIGHTMIPMAP
Definition: ddraw.h:325
#define DDSCAPS_COMPLEX
Definition: ddraw.h:252
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:1754
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps3
Definition: ddraw.h:734
DWORD dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwCaps3
Definition: ddraw.h:1060
DWORD dwCaps2
Definition: ddraw.h:1059

Referenced by Main_DirectDraw_GetAvailableVidMem(), and Main_DirectDraw_GetCaps().

◆ Main_DirectDraw_GetCaps()

HRESULT WINAPI Main_DirectDraw_GetCaps ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDCAPS  pDriverCaps,
LPDDCAPS  pHELCaps 
)

Definition at line 23 of file GetCaps.c.

25{
27
29
31
33 {
34 if ((!pDriverCaps) && (!pHELCaps))
35 {
36 retVal = DDERR_INVALIDPARAMS;
38 }
39
40 /*
41 * DDCAPS_DX6 and DDCAPS_DX7 have same size so
42 * we do not need check both only one of them
43 */
44 if ( (pDriverCaps) &&
45 (pDriverCaps->dwSize != sizeof(DDCAPS_DX1) ) &&
46 (pDriverCaps->dwSize != sizeof(DDCAPS_DX3) ) &&
47 (pDriverCaps->dwSize != sizeof(DDCAPS_DX5) ) &&
48 (pDriverCaps->dwSize != sizeof(DDCAPS_DX7 )) )
49 {
50 retVal = DDERR_INVALIDPARAMS;
52 }
53
54 /*
55 * DDCAPS_DX6 and DDCAPS_DX7 have same size so
56 * we do not need check both only one of them
57 */
58 if ( (pHELCaps) &&
59 (pHELCaps->dwSize != sizeof(DDCAPS_DX1) ) &&
60 (pHELCaps->dwSize != sizeof(DDCAPS_DX3) ) &&
61 (pHELCaps->dwSize != sizeof(DDCAPS_DX5) ) &&
62 (pHELCaps->dwSize != sizeof(DDCAPS_DX7 )) )
63 {
64 retVal = DDERR_INVALIDPARAMS;
66 }
67
68 if (pDriverCaps)
69 {
70 /* Setup hardware caps */
71 DDSCAPS2 ddscaps = { 0 };
72 LPDDCORECAPS CoreCaps = (LPDDCORECAPS)&This->lpLcl->lpGbl->ddCaps;
73
74 DWORD dwTotal = 0;
75 DWORD dwFree = 0;
76
77 Main_DirectDraw_GetAvailableVidMem4(This, &ddscaps, &dwTotal, &dwFree);
78
79 switch (pDriverCaps->dwSize)
80 {
81 case sizeof(DDCAPS_DX1):
82 {
83 LPDDCAPS_DX1 myCaps = (LPDDCAPS_DX1) pDriverCaps;
84
85 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
86 {
87 memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX1));
88 }
89
90 myCaps->dwVidMemFree = dwFree;
91 myCaps->dwVidMemTotal = dwTotal;
92 myCaps->dwSize = sizeof(DDCAPS_DX1);
93
94 retVal = DD_OK;
95 }
96 break;
97
98 case sizeof(DDCAPS_DX3):
99 {
100 LPDDCAPS_DX3 myCaps = (LPDDCAPS_DX3) pDriverCaps;
101
102 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
103 {
104 memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX3));
105 }
106
107 myCaps->dwVidMemFree = dwFree;
108 myCaps->dwVidMemTotal = dwTotal;
109 myCaps->dwSize = sizeof(DDCAPS_DX3);
110
111 retVal = DD_OK;
112 }
113 break;
114
115 case sizeof(DDCAPS_DX5):
116 {
117 LPDDCAPS_DX5 myCaps = (LPDDCAPS_DX5) pDriverCaps;
118
119 /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in startup.c
120 if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize == sizeof(DDNONLOCALVIDMEMCAPS))
121 {
122 memcpy(&myCaps->dwNLVBCaps, This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
123 }
124 */
125 memset(&myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
126
127 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
128 {
129 memcpy(myCaps, CoreCaps, sizeof(DDCORECAPS));
130 }
131
132 myCaps->dwVidMemFree = dwFree;
133 myCaps->dwVidMemTotal = dwTotal;
134 myCaps->dwSize = sizeof(DDCAPS_DX5);
135
136 retVal = DD_OK;
137 }
138 break;
139
140 /* DDCAPS_DX6 is same as DDCAPS_DX7 */
141 case sizeof(DDCAPS_DX7):
142 {
143 LPDDCAPS_DX7 myCaps = (LPDDCAPS_DX7) pDriverCaps;
144
145 /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in startup.c
146 if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize == sizeof(DDNONLOCALVIDMEMCAPS))
147 {
148 memcpy(&myCaps->dwNLVBCaps, This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
149 }
150 */
151 memset(&myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
152
153 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
154 {
155 memcpy(myCaps, CoreCaps, sizeof(DDCORECAPS));
156 }
157
158 myCaps->dwVidMemFree = dwFree;
159 myCaps->dwVidMemTotal = dwTotal;
160
161 myCaps->ddsCaps.dwCaps = myCaps->ddsOldCaps.dwCaps;
162 myCaps->ddsCaps.dwCaps2 = 0;
163 myCaps->ddsCaps.dwCaps3 = 0;
164 myCaps->ddsCaps.dwCaps4 = 0;
165 myCaps->dwSize = sizeof(DDCAPS_DX7);
166
167 retVal = DD_OK;
168
169 }
170 break;
171
172 default:
173 retVal = DDERR_INVALIDPARAMS;
174 break;
175 }
176 }
177
178 if (pHELCaps)
179 {
180 /* Setup software caps */
181 LPDDCORECAPS CoreCaps = (LPDDCORECAPS)&This->lpLcl->lpGbl->ddHELCaps;
182
183 DWORD dwTotal = 0;
184 DWORD dwFree = 0;
185
186 switch (pHELCaps->dwSize)
187 {
188 case sizeof(DDCAPS_DX1):
189 {
190 LPDDCAPS_DX1 myCaps = (LPDDCAPS_DX1) pHELCaps;
191
192 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
193 {
194 memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX1));
195 }
196
197 myCaps->dwVidMemFree = dwFree;
198 myCaps->dwVidMemTotal = dwTotal;
199 myCaps->dwSize = sizeof(DDCAPS_DX1);
200
201 retVal = DD_OK;
202 }
203 break;
204
205 case sizeof(DDCAPS_DX3):
206 {
207 LPDDCAPS_DX3 myCaps = (LPDDCAPS_DX3) pHELCaps;
208
209 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
210 {
211 memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX3));
212 }
213
214 myCaps->dwVidMemFree = dwFree;
215 myCaps->dwVidMemTotal = dwTotal;
216 myCaps->dwSize = sizeof(DDCAPS_DX3);
217
218 retVal = DD_OK;
219 }
220 break;
221
222 case sizeof(DDCAPS_DX5):
223 {
224 LPDDCAPS_DX5 myCaps = (LPDDCAPS_DX5) pHELCaps;
225
226 /* FIXME This->lpLcl->lpGbl->lpddNLVHELCaps are not set in startup.c
227 if (This->lpLcl->lpGbl->lpddNLVHELCaps->dwSize == sizeof(DDNONLOCALVIDMEMCAPS))
228 {
229 memcpy(&myCaps->dwNLVBCaps, This->lpLcl->lpGbl->lpddNLVHELCaps, sizeof(DDNONLOCALVIDMEMCAPS));
230 }
231 */
232 memset(&myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
233
234 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
235 {
236 memcpy(myCaps, CoreCaps, sizeof(DDCORECAPS));
237 }
238
239 myCaps->dwVidMemFree = dwFree;
240 myCaps->dwVidMemTotal = dwTotal;
241 myCaps->dwSize = sizeof(DDCAPS_DX5);
242
243 retVal = DD_OK;
244 }
245 break;
246
247 /* DDCAPS_DX6 is same as DDCAPS_DX7 */
248 case sizeof(DDCAPS_DX7):
249 {
250 LPDDCAPS_DX7 myCaps = (LPDDCAPS_DX7) pHELCaps;
251
252 /* FIXME This->lpLcl->lpGbl->lpddNLVHELCaps are not set in startup.c
253 if (This->lpLcl->lpGbl->lpddNLVHELCaps->dwSize == sizeof(DDNONLOCALVIDMEMCAPS))
254 {
255 memcpy(&myCaps->dwNLVBCaps, This->lpLcl->lpGbl->lpddNLVHELCaps, sizeof(DDNONLOCALVIDMEMCAPS));
256 }
257 */
258 memset(&myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
259
260 if (CoreCaps->dwSize == sizeof(DDCORECAPS))
261 {
262 memcpy(myCaps, CoreCaps, sizeof(DDCORECAPS));
263 }
264
265 myCaps->dwVidMemFree = dwFree;
266 myCaps->dwVidMemTotal = dwTotal;
267
268 myCaps->ddsCaps.dwCaps = myCaps->ddsOldCaps.dwCaps;
269 myCaps->ddsCaps.dwCaps2 = 0;
270 myCaps->ddsCaps.dwCaps3 = 0;
271 myCaps->ddsCaps.dwCaps4 = 0;
272 myCaps->dwSize = sizeof(DDCAPS_DX7);
273
274 retVal = DD_OK;
275
276 }
277 break;
278
279 default:
280 retVal = DDERR_INVALIDPARAMS;
281 break;
282 }
283 }
284
285 }
287 {
288 retVal = DD_FALSE;
289 }
290 _SEH2_END;
291
293 return retVal;
294}
struct _DDCORECAPS * LPDDCORECAPS
HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem4(LPDDRAWI_DIRECTDRAW_INT This, LPDDSCAPS2 ddscaps, LPDWORD dwTotal, LPDWORD dwFree)
Definition: ddraw_main.c:318
switch(r->id)
Definition: btrfs.c:3046
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _DDCAPS_DX1 DDCAPS_DX1
struct _DDCAPS_DX3 DDCAPS_DX3
struct _DDCAPS_DX7 * LPDDCAPS_DX7
struct _DDCAPS_DX3 * LPDDCAPS_DX3
struct _DDCAPS_DX5 * LPDDCAPS_DX5
struct _DDCAPS_DX1 * LPDDCAPS_DX1
#define DD_FALSE
Definition: ddraw.h:187
struct _DDCAPS_DX5 DDCAPS_DX5
struct _DDCAPS_DX7 DDCAPS_DX7
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwVidMemTotal
Definition: ddraw.h:759
DWORD dwVidMemFree
Definition: ddraw.h:760
DWORD dwSize
Definition: ddraw.h:744
DWORD dwVidMemFree
Definition: ddraw.h:800
DWORD dwVidMemTotal
Definition: ddraw.h:799
DWORD dwSize
Definition: ddraw.h:784
DWORD dwVidMemFree
Definition: ddraw.h:855
DWORD dwSize
Definition: ddraw.h:839
DWORD dwNLVBCaps
Definition: ddraw.h:890
DWORD dwVidMemTotal
Definition: ddraw.h:854
DWORD dwVidMemFree
Definition: ddraw.h:976
DDSCAPS2 ddsCaps
Definition: ddraw.h:1016
DWORD dwNLVBCaps
Definition: ddraw.h:1011
DWORD dwSize
Definition: ddraw.h:960
DDSCAPS ddsOldCaps
Definition: ddraw.h:986
DWORD dwVidMemTotal
Definition: ddraw.h:975
DWORD dwSize
Definition: ddrawi.h:251
DWORD dwCaps
Definition: ddraw.h:727

Referenced by ThunkDirectDraw2_GetCaps(), ThunkDirectDraw4_GetCaps(), and ThunkDirectDraw_GetCaps().

◆ Main_DirectDraw_GetDeviceIdentifier7()

HRESULT WINAPI Main_DirectDraw_GetDeviceIdentifier7 ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDDEVICEIDENTIFIER2  pDDDI,
DWORD  dwFlags 
)

Definition at line 58 of file GetDeviceIdentifier.c.

60{
62
63 BOOL found = FALSE;
64 DWORD iDevNum = 0;
65 DISPLAY_DEVICEA DisplayDeviceA;
66 HKEY hKey;
67 DWORD lpType = 0;
69 char *pdest;
70 char* pcCnvEnd;
71 long *lpdata;
72
74
76
78 {
79 if ( (IsBadWritePtr( pDDDI, sizeof(DDDEVICEIDENTIFIER2) ) ) ||
81 {
82 retVal = DDERR_INVALIDPARAMS;
84 }
85
86 /* now we can start getting the driver data */
87
88 while (1)
89 {
90 ZeroMemory(&DisplayDeviceA,sizeof(DISPLAY_DEVICEA));
91
92 DisplayDeviceA.cb = sizeof(DISPLAY_DEVICEA);
93
94 if ( EnumDisplayDevicesA( NULL, iDevNum, &DisplayDeviceA, 0) == 0)
95 {
96 retVal = DDERR_INVALIDPARAMS;
97 break;
98 }
99
100 if (_stricmp(DisplayDeviceA.DeviceName, This->lpLcl->lpGbl->cDriverName) != 0)
101 {
102 /* if we got another device like hardware mpeg decoder or video card or another drv */
103 found = TRUE;
104 }
105 else if (DisplayDeviceA.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
106 {
107 /* double check if it primary driver we just found */
108 if (!_stricmp( This->lpLcl->lpGbl->cDriverName, "DISPLAY"))
109 {
110 /* yeah we found it */
111 found = TRUE;
112 }
113 }
114
115 if (found != FALSE)
116 {
117 /* we found our driver now we start setup it */
118 if (!_strnicmp(DisplayDeviceA.DeviceKey,"\\REGISTRY\\Machine\\",18))
119 {
121 {
122
123 if (RegQueryValueExA(hKey, "InstalledDisplayDrivers",0, &lpType, (LPBYTE)pDDDI->szDriver, &strSize) != ERROR_SUCCESS)
124 {
126 }
127 else
128 {
129 strcat(pDDDI->szDriver,".dll");
130 }
132 }
133
134 strcpy( pDDDI->szDescription, DisplayDeviceA.DeviceString);
135 pDDDI->liDriverVersion.HighPart = 0;
136 pDDDI->liDriverVersion.LowPart = 0;
137
138 pdest = strstr(DisplayDeviceA.DeviceID,"REV_");
139 pDDDI->dwRevision = strtol ( &pdest[4], &pcCnvEnd, 16);
140
141 pdest = strstr(DisplayDeviceA.DeviceID,"SUBSYS_");
142 pDDDI->dwSubSysId = strtol ( &pdest[7], &pcCnvEnd, 16);
143
144 pdest = strstr(DisplayDeviceA.DeviceID,"DEV_");
145 pDDDI->dwDeviceId = strtol ( &pdest[4], &pcCnvEnd, 16);
146
147 pdest = strstr(DisplayDeviceA.DeviceID,"VEN_");
148 pDDDI->dwVendorId =strtol ( &pdest[4], &pcCnvEnd, 16);
149
150 /* Count out the guidDeviceIdentifier */
151 memcpy(&pDDDI->guidDeviceIdentifier, &CLSID_DirectDraw,sizeof(GUID));
152
153 pDDDI->guidDeviceIdentifier.Data1 ^= pDDDI->dwVendorId;
154
155 lpdata = (long *)&pDDDI->guidDeviceIdentifier.Data2;
156 *lpdata ^= pDDDI->dwDeviceId;
157
158 lpdata = (long *)&pDDDI->guidDeviceIdentifier.Data4;
159 *lpdata = (*lpdata ^ pDDDI->dwSubSysId) ^ pDDDI->liDriverVersion.LowPart;
160
161 lpdata = (long *)&pDDDI->guidDeviceIdentifier.Data4[4];
162 *lpdata = (*lpdata ^ pDDDI->dwRevision) ^ pDDDI->liDriverVersion.HighPart;
163
164 /* FIXME pDDDI->dwWHQLLevel
165 * we leave this with no informations, I do not known
166 * if program care for it, I mark this api done, and
167 * tested, no bugs was found in it
168 */
169 pDDDI->dwWHQLLevel = 0;
170 retVal = DD_OK;
171 }
172
173 break;
174 }
175
176 iDevNum++;
177 }
178
179 }
181 {
182 retVal = DD_FALSE;
183 }
184 _SEH2_END;
185
187 return retVal;
188}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define RegCloseKey(hKey)
Definition: registry.h:49
#define _stricmp
Definition: cat.c:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:883
unsigned int BOOL
Definition: ntddk_ex.h:94
FxAutoRegKey hKey
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DDGDI_GETHOSTIDENTIFIER
Definition: ddraw.h:202
#define MAX_DDDEVICEID_STRING
Definition: ddraw.h:201
DWORD StateFlags
Definition: wingdi.h:2812
CHAR DeviceString[128]
Definition: wingdi.h:2811
CHAR DeviceName[32]
Definition: wingdi.h:2810
CHAR DeviceID[128]
Definition: wingdi.h:2813
CHAR DeviceKey[128]
Definition: wingdi.h:2814
char szDescription[MAX_DDDEVICEID_STRING]
Definition: ddraw.h:1346
char szDriver[MAX_DDDEVICEID_STRING]
Definition: ddraw.h:1345
unsigned char * LPBYTE
Definition: typedefs.h:53
BOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags)
Definition: display.c:23
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1398
struct _DISPLAY_DEVICEA DISPLAY_DEVICEA
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by Main_DirectDraw_GetDeviceIdentifier().

◆ Main_DirectDraw_GetDisplayMode()

HRESULT WINAPI Main_DirectDraw_GetDisplayMode ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDSURFACEDESC  pDDSD 
)

Definition at line 366 of file ddraw_displaymode.c.

367{
368 HRESULT retVal = DD_OK;
370
372 {
373 if(IsBadWritePtr(pDDSD,sizeof(LPDDSURFACEDESC)))
374 {
375 retVal = DDERR_INVALIDPARAMS;
376 }
377 else if (pDDSD->dwSize != sizeof(DDSURFACEDESC))
378 {
379 retVal = DDERR_INVALIDPARAMS;
380 }
381 else
382 {
383 // FIXME: More structure members might need to be filled
384
386 pDDSD->dwHeight = This->lpLcl->lpGbl->vmiData.dwDisplayHeight;
387 pDDSD->dwWidth = This->lpLcl->lpGbl->vmiData.dwDisplayWidth;
388 pDDSD->ddpfPixelFormat = This->lpLcl->lpGbl->vmiData.ddpfDisplay;
389 pDDSD->dwRefreshRate = This->lpLcl->lpGbl->dwMonitorFrequency;
390 pDDSD->lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch;
391 }
392 }
394 {
395 }
396 _SEH2_END;
397
398 return retVal;
399}

Referenced by ThunkDirectDraw2_GetDisplayMode(), ThunkDirectDraw4_GetDisplayMode(), and ThunkDirectDraw_GetDisplayMode().

◆ Main_DirectDraw_GetDisplayMode4()

HRESULT WINAPI Main_DirectDraw_GetDisplayMode4 ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDDSURFACEDESC2  pDDSD 
)

Definition at line 402 of file ddraw_displaymode.c.

403{
404 HRESULT retVal = DD_OK;
406
408 {
409 if(IsBadWritePtr(pDDSD,sizeof(LPDDSURFACEDESC2)))
410 {
411 retVal = DDERR_INVALIDPARAMS;
412 }
413 else if (pDDSD->dwSize != sizeof(DDSURFACEDESC2))
414 {
415 retVal = DDERR_INVALIDPARAMS;
416 }
417 else
418 {
419 // FIXME: More structure members might need to be filled
420
422 pDDSD->dwHeight = This->lpLcl->lpGbl->vmiData.dwDisplayHeight;
423 pDDSD->dwWidth = This->lpLcl->lpGbl->vmiData.dwDisplayWidth;
424 pDDSD->ddpfPixelFormat = This->lpLcl->lpGbl->vmiData.ddpfDisplay;
425 pDDSD->dwRefreshRate = This->lpLcl->lpGbl->dwMonitorFrequency;
426 pDDSD->lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch;
427 }
428 }
430 {
431 }
432 _SEH2_END;
433
434 return retVal;
435}

◆ Main_DirectDraw_GetFourCCCodes()

HRESULT WINAPI Main_DirectDraw_GetFourCCCodes ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDWORD  lpNumCodes,
LPDWORD  lpCodes 
)

Definition at line 418 of file ddraw_main.c.

419{
420 HRESULT retVal = DD_OK;
421
423
424
425 // EnterCriticalSection(&ddcs);
426
428 {
429 if(IsBadWritePtr(lpNumCodes,sizeof(LPDWORD)))
430 {
431 retVal = DDERR_INVALIDPARAMS;
432 }
433 else
434 {
435 if(!(IsBadWritePtr(lpNumCodes,sizeof(LPDWORD))))
436 {
437 DWORD size;
438
439 if (*lpNumCodes > This->lpLcl->lpGbl->dwNumFourCC)
440 {
441 *lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
442 }
443
444 size = *lpNumCodes * sizeof(DWORD);
445
446 if(!IsBadWritePtr(lpCodes, size ))
447 {
448 memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, size );
449 }
450 else
451 {
452 *lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
453 }
454 }
455 }
456 }
458 {
459 }
460 _SEH2_END;
461
462 //LeaveCriticalSection(&ddcs);
463 return retVal;
464}
GLsizeiptr size
Definition: glext.h:5919
#define DWORD
Definition: nt_native.h:44

Referenced by ThunkDirectDraw2_GetFourCCCodes(), ThunkDirectDraw4_GetFourCCCodes(), and ThunkDirectDraw_GetFourCCCodes().

◆ Main_DirectDraw_GetGDISurface()

HRESULT WINAPI Main_DirectDraw_GetGDISurface ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDIRECTDRAWSURFACE7 lplpGDIDDSSurface 
)

◆ Main_DirectDraw_GetMonitorFrequency()

HRESULT WINAPI Main_DirectDraw_GetMonitorFrequency ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDWORD  lpFreq 
)

Definition at line 333 of file ddraw_displaymode.c.

334{
335 HRESULT retVal = DD_OK;
337
339 {
340 if(IsBadWritePtr(lpFreq,sizeof(LPDWORD)))
341 {
342 retVal = DDERR_INVALIDPARAMS;
343 }
344 else
345 {
346 if (This->lpLcl->lpGbl->dwMonitorFrequency)
347 {
348 *lpFreq = This->lpLcl->lpGbl->dwMonitorFrequency;
349 }
350 else
351 {
352 retVal = DDERR_UNSUPPORTED;
353 }
354 }
355 }
357 {
358 retVal = DD_FALSE;
359 }
360 _SEH2_END;
361
362 return retVal;
363}
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127

Referenced by ThunkDirectDraw2_GetMonitorFrequency(), ThunkDirectDraw4_GetMonitorFrequency(), and ThunkDirectDraw_GetMonitorFrequency().

◆ Main_DirectDraw_GetScanLine()

HRESULT WINAPI Main_DirectDraw_GetScanLine ( LPDDRAWI_DIRECTDRAW_INT  This,
LPDWORD  lpdwScanLine 
)

◆ Main_DirectDraw_GetSurfaceFromDC()

HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC ( LPDDRAWI_DIRECTDRAW_INT  This,
HDC  hdc,
LPDIRECTDRAWSURFACE7 lpDDS 
)

Definition at line 104 of file ddraw_stubs.c.

106{
108 DX_STUB;
109}

Referenced by ThunkDirectDraw4_GetSurfaceFromDC().

◆ Main_DirectDraw_GetVerticalBlankStatus()

HRESULT WINAPI Main_DirectDraw_GetVerticalBlankStatus ( LPDDRAWI_DIRECTDRAW_INT  This,
LPBOOL  lpbIsInVB 
)

◆ Main_DirectDraw_Initialize()

HRESULT WINAPI Main_DirectDraw_Initialize ( LPDDRAWI_DIRECTDRAW_INT  This,
LPGUID  lpGUID 
)

Definition at line 247 of file ddraw_main.c.

248{
250}
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67

◆ Main_DirectDraw_QueryInterface()

HRESULT WINAPI Main_DirectDraw_QueryInterface ( LPDDRAWI_DIRECTDRAW_INT  This,
REFIID  id,
LPVOID obj 
)

Definition at line 37 of file ddraw_main.c.

40{
41 HRESULT retVal = DD_OK;
42
44
46 {
47 /* FIXME
48 the D3D object can be obtained from here
49 Direct3D7
50 */
51 if (IsEqualGUID(&IID_IDirectDraw7, id))
52 {
53 if (This->lpVtbl != &DirectDraw7_Vtable)
54 {
56 if (!This)
57 {
60 }
61 }
62
63 This->lpVtbl = &DirectDraw7_Vtable;
64 *obj = This;
66 }
67 else if (IsEqualGUID(&IID_IDirectDraw4, id))
68 {
69 if (This->lpVtbl != &DirectDraw4_Vtable)
70 {
72 if (!This)
73 {
76 }
77 }
78
79 This->lpVtbl = &DirectDraw4_Vtable;
80 *obj = This;
82 }
83
84 else if (IsEqualGUID(&IID_IDirectDraw2, id))
85 {
86 if (This->lpVtbl != &DirectDraw2_Vtable)
87 {
89 if (!This)
90 {
93 }
94 }
95
96 This->lpVtbl = &DirectDraw2_Vtable;
97 *obj = This;
99 }
100 else if (IsEqualGUID(&IID_IDirectDraw, id))
101 {
102 if (This->lpVtbl != &DirectDraw_Vtable)
103 {
105 if (!This)
106 {
107 retVal = DDERR_OUTOFVIDEOMEMORY;
109 }
110 }
111
112 This->lpVtbl = &DirectDraw_Vtable;
113 *obj = This;
115 }
116 else
117 {
118 *obj = NULL;
119 DX_STUB_str("E_NOINTERFACE");
120 retVal = E_NOINTERFACE;
121 }
122 }
124 {
125 }
126 _SEH2_END;
127
128 return retVal;
129}
LPDDRAWI_DIRECTDRAW_INT internal_directdraw_int_alloc(LPDDRAWI_DIRECTDRAW_INT This)
Definition: ddraw_main.c:23
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define DX_STUB_str(x)
Definition: rosdraw.h:254
IDirectDraw2Vtbl DirectDraw2_Vtable
Definition: ddraw_thunk.c:862
IDirectDrawVtbl DirectDraw_Vtable
Definition: ddraw_thunk.c:835
#define DDERR_OUTOFVIDEOMEMORY
Definition: ddraw.h:112
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by ThunkDirectDraw2_QueryInterface(), ThunkDirectDraw4_QueryInterface(), and ThunkDirectDraw_QueryInterface().

◆ Main_DirectDraw_Release()

ULONG WINAPI Main_DirectDraw_Release ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 194 of file ddraw_main.c.

195{
196 ULONG Counter = 0;
197
199
200 /* Lock the thread */
202
204 {
205 if (This!=NULL)
206 {
207 This->lpLcl->dwLocalRefCnt--;
208 This->dwIntRefCnt--;
209
210 if (This->lpLcl->lpGbl != NULL)
211 {
212 This->lpLcl->lpGbl->dwRefCnt--;
213 }
214
215 if ( This->lpLcl->lpGbl->dwRefCnt == 0)
216 {
217 // set resolution back to the one in registry
218 /*if(This->cooperative_level & DDSCL_EXCLUSIVE)
219 {
220 ChangeDisplaySettings(NULL, 0);
221 }*/
222
223 Cleanup(This);
224 }
225
226 /* FIXME cleanup being not call why ?? */
227 Counter = This->dwIntRefCnt;
228 }
229 else
230 {
231 Counter = This->dwIntRefCnt;
232 }
233 }
235 {
236 }
237 _SEH2_END;
238
239 /* Release the thread lock */
241
242 return Counter;
243}
static const WCHAR Cleanup[]
Definition: register.c:80
static LARGE_INTEGER Counter
Definition: clock.c:43

Referenced by DirectDrawPalette_Release(), Main_DDrawSurface_Release4(), ThunkDirectDraw2_Release(), ThunkDirectDraw4_Release(), and ThunkDirectDraw_Release().

◆ Main_DirectDraw_RestoreAllSurfaces()

HRESULT WINAPI Main_DirectDraw_RestoreAllSurfaces ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 111 of file ddraw_stubs.c.

112{
114 DX_STUB;
115}

Referenced by ThunkDirectDraw4_RestoreAllSurfaces().

◆ Main_DirectDraw_RestoreDisplayMode()

HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 306 of file ddraw_displaymode.c.

307{
309
311 {
313
314 ChangeDisplaySettings(NULL, 0);
315
316 // Update Interals
317
318
319 This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
322 }
324 {
325 }
326 _SEH2_END;
327
328
329 return DD_OK;
330}
#define DdReenableDirectDrawObject
Definition: ddrawgdi.h:33
HRESULT WINAPI StartDirectDraw(LPDIRECTDRAW iface, LPGUID pGUID, BOOL reenable)
Definition: startup.c:180
struct IDirectDraw * LPDIRECTDRAW
Definition: ddraw.h:710
static BOOLEAN ModeChanged
Definition: svga.c:282

Referenced by ThunkDirectDraw2_RestoreDisplayMode(), ThunkDirectDraw4_RestoreDisplayMode(), and ThunkDirectDraw_RestoreDisplayMode().

◆ Main_DirectDraw_SetCooperativeLevel()

HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel ( LPDDRAWI_DIRECTDRAW_INT  This,
HWND  hwnd,
DWORD  cooplevel 
)
  • Handle those levels first which set various hwnds *‍/
  • DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE *‍/

Definition at line 13 of file ddraw_setcooperativelevel.c.

14{
15 HRESULT retVal = DD_OK;
16
17
19
21 {
22
23 if (hwnd && !IsWindow(hwnd))
24 {
25 retVal = DDERR_INVALIDPARAMS;
27 }
28
29 // FIXME test if 0x20 exists as a flag and what thuse it do
33 {
34
35 retVal = DDERR_INVALIDPARAMS;
37 }
38
39 if (!( cooplevel & (DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_SETFOCUSWINDOW)))
40 {
41 retVal = DDERR_INVALIDPARAMS;
43 }
44
45 if ((cooplevel & DDSCL_FPUSETUP) && (cooplevel & DDSCL_FPUPRESERVE))
46 {
47 retVal = DDERR_INVALIDPARAMS;
49 }
50
51 if ((cooplevel & DDSCL_EXCLUSIVE) && (!(cooplevel & DDSCL_FULLSCREEN)))
52 {
53 retVal = DDERR_INVALIDPARAMS;
55 }
56
57 if ((cooplevel & DDSCL_ALLOWMODEX) && (!(cooplevel & DDSCL_FULLSCREEN)))
58 {
59 retVal = DDERR_INVALIDPARAMS;
61 }
62
64 {
65 retVal = DDERR_INVALIDPARAMS;
67 }
68
69 if (!cooplevel)
70 {
71 retVal = DDERR_INVALIDPARAMS;
73 }
74
75
76 /* NORMAL MODE */
77 if(!(cooplevel & (~DDSCL_NORMAL)))
78 {
79 /* FIXME in setup.c set DDRAWI_UMODELOADED | DDRAWI_DISPLAYDRV | DDRAWI_EMULATIONINITIALIZED | DDRAWI_GDIDRV | DDRAWI_ATTACHEDTODESKTOP */
80 /* FIXME in setup.c This->lpLcl->lpGbl->dwFlags = */
81
82 This->lpLcl->dwLocalFlags = DDRAWILCL_SETCOOPCALLED | DDRAWILCL_DIRECTDRAW7 ;
83 This->lpLcl->hWnd = (ULONG_PTR) hwnd;
84 This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
85 This->lpLcl->lpGbl->lpExclusiveOwner=NULL;
86
87 retVal = DD_OK;
89 }
90
91 /* FULLSCREEN */
92 if ((!(cooplevel & (~(DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))) ||
93 (!(cooplevel & (~(DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX)))))
94
95 {
96 /* FIXME in setup.c This->lpLcl->lpGbl->dwFlags = */
97
98 if (hwnd == NULL)
99 {
100 retVal = DDERR_INVALIDPARAMS;
102 }
103
105 {
106 retVal = DDERR_INVALIDPARAMS;
108 }
109
110 if( (This->lpLcl->lpGbl->lpExclusiveOwner != NULL) &&
111 (This->lpLcl->lpGbl->lpExclusiveOwner != This->lpLcl) )
112 {
113 retVal = DDERR_INVALIDPARAMS;
115 }
116
117 This->lpLcl->lpGbl->lpExclusiveOwner = This-> lpLcl;
118
122
123 if (cooplevel & DDSCL_ALLOWMODEX)
124 {
125 This->lpLcl->dwLocalFlags = This->lpLcl->dwLocalFlags | DDRAWILCL_ALLOWMODEX;
126 }
127
128 This->lpLcl->hWnd = (ULONG_PTR) hwnd;
129 This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
130
131
132 /* FIXME fullscreen are not finuish */
133
134 retVal = DD_OK;
136 }
137
138 /*
139 * Code from wine, this functions have been cut and paste from wine 0.9.35
140 * and have been modify allot and are still in devloping so it match with
141 * msdn document struct and flags
142 */
143
144
145
147 //if(cooplevel & DDSCL_SETFOCUSWINDOW)
148 //{
149 //
150
151 // if(This->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED)
152 // {
153 // retVal = DDERR_HWNDALREADYSET;
154 // _SEH2_LEAVE;
155 // }
156 // else if( (This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN) && window)
157 // {
158 // retVal = DDERR_HWNDALREADYSET;
159 // _SEH2_LEAVE;
160 // }
161
162 // This->lpLcl->hFocusWnd = (ULONG_PTR) hwnd;
163
164
165 // /* Won't use the hwnd param for anything else */
166 // hwnd = NULL;
167
168 // /* Use the focus window for drawing too */
169 // This->lpLcl->hWnd = This->lpLcl->hFocusWnd;
170
171 //}
172
174 //if(cooplevel & DDSCL_NORMAL)
175 //{
176 // /* Can't coexist with fullscreen or exclusive */
177 // if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
178 // {
179 // retVal = DDERR_INVALIDPARAMS;
180 // _SEH2_LEAVE;
181 // }
182
183 // /* Switching from fullscreen? */
184 // if(This->lpLcl->dwLocalFlags & DDRAWILCL_ISFULLSCREEN)
185 // {
186 // /* Restore the display mode */
187 // Main_DirectDraw_RestoreDisplayMode(iface);
188
189 // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ISFULLSCREEN;
190 // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_HASEXCLUSIVEMODE;
191 // This->lpLcl->dwLocalFlags &= ~DDRAWILCL_ALLOWMODEX;
192 // }
193
194 // /* Don't override focus windows or private device windows */
195 // if( hwnd &&
196 // !(This->lpLcl->hFocusWnd) &&
197 // !(This->lpLcl->dwObsolete1) &&
198 // (hwnd != window) )
199 // {
200 // This->lpLcl->hWnd = (ULONG_PTR)hwnd;
201 // }
202
203 // /* FIXME GL
204 // IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
205 // FALSE);
206 // */
207 // }
208 // else if(cooplevel & DDSCL_FULLSCREEN)
209 // {
210 // /* Needs DDSCL_EXCLUSIVE */
211 // if(!(cooplevel & DDSCL_EXCLUSIVE) )
212 // {
213 // retVal = DDERR_INVALIDPARAMS;
214 // _SEH2_LEAVE;
215 // }
216
217 // /* Switch from normal to full screen mode? */
218 // if (!(This->lpLcl->dwLocalFlags & DDRAWILCL_HASEXCLUSIVEMODE))
219 // {
220 // /* FIXME GL
221 // IWineD3DDevice_SetFullscreen(This->wineD3DDevice,
222 // TRUE);
223 // */
224 // }
225
226 // /* Don't override focus windows or private device windows */
227 // if( hwnd &&
228 // !(This->lpLcl->hFocusWnd) &&
229 // !(This->lpLcl->dwObsolete1) &&
230 // (hwnd != window) )
231 // {
232 // This->lpLcl->hWnd = (ULONG_PTR) hwnd;
233 // }
234 // }
235 // else if(cooplevel & DDSCL_EXCLUSIVE)
236 // {
237 // retVal = DDERR_INVALIDPARAMS;
238 // _SEH2_LEAVE;
239 // }
240
241 // if(cooplevel & DDSCL_CREATEDEVICEWINDOW)
242 // {
243 // /* Don't create a device window if a focus window is set */
244 // if( !This->lpLcl->hFocusWnd)
245 // {
246 // HWND devicewindow = CreateWindowExW(0, classname, L"DDraw device window",
247 // WS_POPUP, 0, 0,
248 // GetSystemMetrics(SM_CXSCREEN),
249 // GetSystemMetrics(SM_CYSCREEN),
250 // NULL, NULL, GetModuleHandleW(0), NULL);
251
252 // ShowWindow(devicewindow, SW_SHOW); /* Just to be sure */
253
254 // This->lpLcl->dwObsolete1 = (DWORD)devicewindow;
255 // }
256 // }
257
258 // if(cooplevel & DDSCL_MULTITHREADED && !(This->lpLcl->dwLocalFlags & DDRAWILCL_MULTITHREADED))
259 // {
260 // /* FIXME GL
261 // * IWineD3DDevice_SetMultithreaded(This->wineD3DDevice);
262 // */
263 // }
264
265
266
267 // /* Store the cooperative_level */
268
269 // /* FIXME GL
270 // * This->cooperative_level |= cooplevel;
271 // */
272 }
274 {
275 }
276 _SEH2_END;
277
278
279 return retVal;
280}
#define DDRAWILCL_ALLOWMODEX
Definition: ddrawi.h:1200
#define DDRAWILCL_DIRECTDRAW7
Definition: ddrawi.h:1211
#define DDRAWILCL_HOOKEDHWND
Definition: ddrawi.h:1199
#define DDRAWILCL_ISFULLSCREEN
Definition: ddrawi.h:1195
#define DDRAWILCL_ACTIVEYES
Definition: ddrawi.h:1197
#define DDRAWILCL_SETCOOPCALLED
Definition: ddrawi.h:1196
#define DDRAWILCL_CURSORCLIPPED
Definition: ddrawi.h:1206
#define DDRAWILCL_HASEXCLUSIVEMODE
Definition: ddrawi.h:1194
#define ULONG_PTR
Definition: config.h:101
#define WS_CHILD
Definition: pedump.c:617
#define DDSCL_SETDEVICEWINDOW
Definition: ddraw.h:539
#define DDSCL_SETFOCUSWINDOW
Definition: ddraw.h:538
#define DDSCL_FPUPRESERVE
Definition: ddraw.h:543
#define DDSCL_NORMAL
Definition: ddraw.h:535
#define DDSCL_MULTITHREADED
Definition: ddraw.h:541
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:533
#define DDSCL_CREATEDEVICEWINDOW
Definition: ddraw.h:540
#define DDSCL_FPUSETUP
Definition: ddraw.h:542
#define DDSCL_NOWINDOWCHANGES
Definition: ddraw.h:534
#define DDSCL_ALLOWMODEX
Definition: ddraw.h:537
#define DDSCL_FULLSCREEN
Definition: ddraw.h:532
#define GetWindowLongPtr
Definition: treelist.c:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define GWL_STYLE
Definition: winuser.h:855

Referenced by ThunkDirectDraw2_SetCooperativeLevel(), ThunkDirectDraw4_SetCooperativeLevel(), and ThunkDirectDraw_SetCooperativeLevel().

◆ Main_DirectDraw_SetDisplayMode()

HRESULT WINAPI Main_DirectDraw_SetDisplayMode ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwWidth,
DWORD  dwHeight,
DWORD  dwBPP 
)

Definition at line 210 of file ddraw_displaymode.c.

211{
213
214 return Main_DirectDraw_SetDisplayMode2 (This, dwWidth, dwHeight, dwBPP, 0, 0 );
215}
HRESULT WINAPI Main_DirectDraw_SetDisplayMode2(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
static const WCHAR dwWidth[]
Definition: provider.c:62
static const WCHAR dwHeight[]
Definition: provider.c:63

Referenced by ThunkDirectDraw2_SetDisplayMode(), ThunkDirectDraw4_SetDisplayMode(), and ThunkDirectDraw_SetDisplayMode().

◆ Main_DirectDraw_SetDisplayMode2()

HRESULT WINAPI Main_DirectDraw_SetDisplayMode2 ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwWidth,
DWORD  dwHeight,
DWORD  dwBPP,
DWORD  dwRefreshRate,
DWORD  dwFlags 
)

Definition at line 218 of file ddraw_displaymode.c.

220{
221 HRESULT ret = DD_OK;
223
225 {
226 // FIXME: Check primary if surface is locked / busy etc.
227
228 // Check Parameters
229 if(dwFlags != 0)
230 {
232 }
233 else
234 {
235 if ((!dwHeight || This->lpLcl->lpGbl->vmiData.dwDisplayHeight == dwHeight) &&
236 (!dwWidth || This->lpLcl->lpGbl->vmiData.dwDisplayWidth == dwWidth) &&
237 (!dwBPP || This->lpLcl->lpGbl->vmiData.ddpfDisplay.dwRGBBitCount == dwBPP) &&
238 (!dwRefreshRate || This->lpLcl->lpGbl->dwMonitorFrequency == dwRefreshRate))
239 {
240 ret = DD_OK; // nothing to do here for us
241 }
242 else
243 {
244 LONG retval;
245 // Here we go
246 DEVMODE DevMode;
247 ZeroMemory(&DevMode, sizeof(DEVMODE));
248 DevMode.dmSize = sizeof(DEVMODE);
249
250 if (dwHeight)
251 DevMode.dmFields |= DM_PELSHEIGHT;
252 if (dwWidth)
253 DevMode.dmFields |= DM_PELSWIDTH;
254 if (dwBPP)
255 DevMode.dmFields |= DM_BITSPERPEL;
256 if (dwRefreshRate)
257 DevMode.dmFields |= DM_DISPLAYFREQUENCY;
258
259 DevMode.dmPelsHeight = dwHeight;
260 DevMode.dmPelsWidth = dwWidth;
261 DevMode.dmBitsPerPel = dwBPP;
263
265
266 retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN);
267 /* FIXME: Are we supposed to set CDS_SET_PRIMARY as well ? */
268
269 if(retval == DISP_CHANGE_BADMODE)
270 {
271 /* Note : it seam ms ddraw ignore this and try using the bad mode any case.
272 * tested with Ati HD2400 that only support 16 and 32 Bpp in windows
273 */
274 DX_STUB_str("Warning ChangeDisplaySettings return DISP_CHANGE_BADMODE, but ddraw.dll ignore it\n");
275
276 //ret = DDERR_UNSUPPORTED;
278 This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
281 }
282 else if(retval != DISP_CHANGE_SUCCESSFUL)
283 {
285 }
286 else
287 {
288 // Update Interals
290 This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
293 }
294 }
295 }
296 }
298 {
299 }
300 _SEH2_END;
301
302 return ret;
303}
static const WCHAR dwRefreshRate[]
Definition: provider.c:73
#define DX_WINDBG_trace_res(width, height, bpp, freq)
Definition: rosdraw.h:273
DWORD dmFields
Definition: wingdi.h:1570
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DM_BITSPERPEL
Definition: wingdi.h:1268
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
#define DISP_CHANGE_BADMODE
Definition: winuser.h:195
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define CDS_FULLSCREEN
Definition: winuser.h:183

Referenced by Main_DirectDraw_SetDisplayMode().

◆ Main_DirectDraw_StartModeTest()

HRESULT WINAPI Main_DirectDraw_StartModeTest ( LPDDRAWI_DIRECTDRAW_INT  This,
LPSIZE  pModes,
DWORD  dwNumModes,
DWORD  dwFlags 
)

Definition at line 124 of file ddraw_stubs.c.

126{
128 DX_STUB;
129}

◆ Main_DirectDraw_TestCooperativeLevel()

HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel ( LPDDRAWI_DIRECTDRAW_INT  This)

Definition at line 117 of file ddraw_stubs.c.

118{
120 DX_STUB;
121}

Referenced by ThunkDirectDraw4_TestCooperativeLevel().

◆ Main_DirectDraw_WaitForVerticalBlank()

HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank ( LPDDRAWI_DIRECTDRAW_INT  This,
DWORD  dwFlags,
HANDLE  h 
)