Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -1875,7 +1875,16 @@ |
1876 | 1876 | {
|
1877 | 1877 | TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc);
|
1878 | 1878 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1879 | | - TRACE_RET(HRESULT,23,glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc));
|
| 1879 | + if (!lpDDSurfaceDesc) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1880 | + if (lpDDSurfaceDesc->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1881 | + DDSURFACEDESC2 ddsd;
|
| 1882 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 1883 | + HRESULT ret = glDDS7->GetSurfaceDesc(&ddsd);
|
| 1884 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 1885 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 1886 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 1887 | + TRACE_EXIT(23,ret);
|
| 1888 | + return ret;
|
1880 | 1889 | }
|
1881 | 1890 | HRESULT WINAPI glDirectDrawSurface1::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
|
1882 | 1891 | {
|
— | — | @@ -1894,7 +1903,15 @@ |
1895 | 1904 | {
|
1896 | 1905 | TRACE_ENTER(5,14,this,26,lpDestRect,14,lpDDSurfaceDesc,9,dwFlags,14,hEvent);
|
1897 | 1906 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1898 | | - TRACE_RET(HRESULT,23,glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent));
|
| 1907 | + DDSURFACEDESC2 ddsd;
|
| 1908 | + ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
| 1909 | + memcpy(&ddsd, lpDDSurfaceDesc, sizeof(DDSURFACEDESC));
|
| 1910 | + HRESULT ret = glDDS7->Lock(lpDestRect, &ddsd, dwFlags, hEvent);
|
| 1911 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 1912 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 1913 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 1914 | + TRACE_EXIT(23,ret);
|
| 1915 | + return ret;
|
1899 | 1916 | }
|
1900 | 1917 | HRESULT WINAPI glDirectDrawSurface1::ReleaseDC(HDC hDC)
|
1901 | 1918 | {
|
— | — | @@ -2228,7 +2245,16 @@ |
2229 | 2246 | {
|
2230 | 2247 | TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc);
|
2231 | 2248 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2232 | | - TRACE_RET(HRESULT,23,glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc));
|
| 2249 | + if (!lpDDSurfaceDesc) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2250 | + if (lpDDSurfaceDesc->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2251 | + DDSURFACEDESC2 ddsd;
|
| 2252 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 2253 | + HRESULT ret = glDDS7->GetSurfaceDesc(&ddsd);
|
| 2254 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 2255 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2256 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 2257 | + TRACE_EXIT(23, ret);
|
| 2258 | + return ret;
|
2233 | 2259 | }
|
2234 | 2260 | HRESULT WINAPI glDirectDrawSurface2::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
|
2235 | 2261 | {
|
— | — | @@ -2247,7 +2273,15 @@ |
2248 | 2274 | {
|
2249 | 2275 | TRACE_ENTER(5,14,this,26,lpDestRect,14,lpDDSurfaceDesc,9,dwFlags,14,hEvent);
|
2250 | 2276 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2251 | | - TRACE_RET(HRESULT,23,glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent));
|
| 2277 | + DDSURFACEDESC2 ddsd;
|
| 2278 | + ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
| 2279 | + memcpy(&ddsd, lpDDSurfaceDesc, sizeof(DDSURFACEDESC));
|
| 2280 | + HRESULT ret = glDDS7->Lock(lpDestRect, &ddsd, dwFlags, hEvent);
|
| 2281 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 2282 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2283 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 2284 | + TRACE_EXIT(23, ret);
|
| 2285 | + return ret;
|
2252 | 2286 | }
|
2253 | 2287 | HRESULT WINAPI glDirectDrawSurface2::ReleaseDC(HDC hDC)
|
2254 | 2288 | {
|
— | — | @@ -2606,7 +2640,16 @@ |
2607 | 2641 | {
|
2608 | 2642 | TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc);
|
2609 | 2643 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2610 | | - TRACE_RET(HRESULT,23,glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc));
|
| 2644 | + if (!lpDDSurfaceDesc) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2645 | + if (lpDDSurfaceDesc->dwSize != sizeof(DDSURFACEDESC)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 2646 | + DDSURFACEDESC2 ddsd;
|
| 2647 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 2648 | + HRESULT ret = glDDS7->GetSurfaceDesc(&ddsd);
|
| 2649 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 2650 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2651 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 2652 | + TRACE_EXIT(23, ret);
|
| 2653 | + return ret;
|
2611 | 2654 | }
|
2612 | 2655 | HRESULT WINAPI glDirectDrawSurface3::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
|
2613 | 2656 | {
|
— | — | @@ -2625,7 +2668,15 @@ |
2626 | 2669 | {
|
2627 | 2670 | TRACE_ENTER(5,14,this,26,lpDestRect,14,lpDDSurfaceDesc,9,dwFlags,14,hEvent);
|
2628 | 2671 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2629 | | - TRACE_RET(HRESULT,23,glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent));
|
| 2672 | + DDSURFACEDESC2 ddsd;
|
| 2673 | + ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
| 2674 | + memcpy(&ddsd, lpDDSurfaceDesc, sizeof(DDSURFACEDESC));
|
| 2675 | + HRESULT ret = glDDS7->Lock(lpDestRect, &ddsd, dwFlags, hEvent);
|
| 2676 | + if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
| 2677 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2678 | + memcpy(lpDDSurfaceDesc, &ddsd, sizeof(DDSURFACEDESC));
|
| 2679 | + TRACE_EXIT(23, ret);
|
| 2680 | + return ret;
|
2630 | 2681 | }
|
2631 | 2682 | HRESULT WINAPI glDirectDrawSurface3::ReleaseDC(HDC hDC)
|
2632 | 2683 | {
|