Index: ddraw/glDirectDraw.cpp |
— | — | @@ -2228,16 +2228,20 @@ |
2229 | 2229 | {
|
2230 | 2230 | TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
|
2231 | 2231 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2232 | | - if (!lpDDSD)TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2233 | | - if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2232 | + if(lpDDSD)
|
| 2233 | + if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2234 | 2234 | LPVOID context[2];
|
2235 | 2235 | context[0] = lpEnumSurfacesCallback;
|
2236 | 2236 | context[1] = lpContext;
|
2237 | | - DDSURFACEDESC2 ddsd;
|
2238 | | - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
2239 | | - memcpy(&ddsd, lpDDSD, sizeof(DDSURFACEDESC));
|
2240 | | - ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
2241 | | - TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, &ddsd, context, EnumSurfacesCallback1));
|
| 2237 | + if (lpDDSD)
|
| 2238 | + {
|
| 2239 | + DDSURFACEDESC2 ddsd;
|
| 2240 | + ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
| 2241 | + memcpy(&ddsd, lpDDSD, sizeof(DDSURFACEDESC));
|
| 2242 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 2243 | + TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, &ddsd, context, EnumSurfacesCallback1));
|
| 2244 | + }
|
| 2245 | + else TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, NULL, context, EnumSurfacesCallback1));
|
2242 | 2246 | }
|
2243 | 2247 | HRESULT WINAPI glDirectDraw1::FlipToGDISurface()
|
2244 | 2248 | {
|
— | — | @@ -2429,16 +2433,20 @@ |
2430 | 2434 | {
|
2431 | 2435 | TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
|
2432 | 2436 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2433 | | - if (!lpDDSD)TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2434 | | - if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2437 | + if (lpDDSD)
|
| 2438 | + if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2435 | 2439 | LPVOID context[2];
|
2436 | 2440 | context[0] = lpEnumSurfacesCallback;
|
2437 | 2441 | context[1] = lpContext;
|
2438 | | - DDSURFACEDESC2 ddsd;
|
2439 | | - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
2440 | | - memcpy(&ddsd, lpDDSD, sizeof(DDSURFACEDESC));
|
2441 | | - ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
2442 | | - TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, &ddsd, context, EnumSurfacesCallback1));
|
| 2442 | + if (lpDDSD)
|
| 2443 | + {
|
| 2444 | + DDSURFACEDESC2 ddsd;
|
| 2445 | + ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
| 2446 | + memcpy(&ddsd, lpDDSD, sizeof(DDSURFACEDESC));
|
| 2447 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 2448 | + TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, &ddsd, context, EnumSurfacesCallback1));
|
| 2449 | + }
|
| 2450 | + else TRACE_RET(HRESULT, 23, glDD7->EnumSurfaces(dwFlags, NULL, context, EnumSurfacesCallback1));
|
2443 | 2451 | }
|
2444 | 2452 | HRESULT WINAPI glDirectDraw2::FlipToGDISurface()
|
2445 | 2453 | {
|
— | — | @@ -2657,8 +2665,8 @@ |
2658 | 2666 | {
|
2659 | 2667 | TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
|
2660 | 2668 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2661 | | - if (!lpDDSD)TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2662 | | - if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2669 | + if(lpDDSD)
|
| 2670 | + if (lpDDSD->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
2663 | 2671 | LPVOID context[2];
|
2664 | 2672 | context[0] = lpEnumSurfacesCallback;
|
2665 | 2673 | context[1] = lpContext;
|