Index: ddraw/glClassFactory.cpp |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | HRESULT WINAPI glClassFactory::QueryInterface(REFIID riid, void** ppvObj)
|
43 | 43 | {
|
44 | 44 | if(!this) return DDERR_INVALIDPARAMS;
|
| 45 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
45 | 46 | if((riid == IID_IUnknown) || (riid == IID_IClassFactory))
|
46 | 47 | {
|
47 | 48 | *ppvObj = this;
|
Index: ddraw/glDirect3D.cpp |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
|
54 | 54 | {
|
55 | 55 | if(!this) return DDERR_INVALIDPARAMS;
|
| 56 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
56 | 57 | FIXME("glDirect3D7::QueryInterface: stub");
|
57 | 58 | return E_NOINTERFACE;
|
58 | 59 | }
|
Index: ddraw/glDirect3DDevice.cpp |
— | — | @@ -180,6 +180,7 @@ |
181 | 181 | HRESULT WINAPI glDirect3DDevice7::QueryInterface(REFIID riid, void** ppvObj)
|
182 | 182 | {
|
183 | 183 | if(!this) return DDERR_INVALIDPARAMS;
|
| 184 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
184 | 185 | ERR(E_NOINTERFACE);
|
185 | 186 | }
|
186 | 187 |
|
Index: ddraw/glDirect3DLight.cpp |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | HRESULT WINAPI glDirect3DLight::QueryInterface(REFIID riid, void** ppvObj)
|
71 | 71 | {
|
72 | 72 | if(!this) return DDERR_INVALIDPARAMS;
|
| 73 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
73 | 74 | return E_NOINTERFACE;
|
74 | 75 | }
|
75 | 76 |
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -324,6 +324,7 @@ |
325 | 325 |
|
326 | 326 | HRESULT EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback)
|
327 | 327 | {
|
| 328 | + if(!lpEnumModesCallback) return DDERR_INVALIDPARAMS;
|
328 | 329 | bool match;
|
329 | 330 | DWORD modenum = 0;
|
330 | 331 | DWORD modemax = 128;
|
— | — | @@ -597,6 +598,7 @@ |
598 | 599 | HRESULT WINAPI glDirectDraw7::QueryInterface(REFIID riid, void** ppvObj)
|
599 | 600 | {
|
600 | 601 | if(!this) return DDERR_INVALIDPARAMS;
|
| 602 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
601 | 603 | if(riid == IID_IDirectDraw)
|
602 | 604 | {
|
603 | 605 | // Create an IDirectDraw1 interface
|
— | — | @@ -788,7 +790,8 @@ |
789 | 791 | ZeroMemory(&ddCaps,sizeof(DDCAPS_DX7));
|
790 | 792 | if(lpDDDriverCaps) ddCaps.dwSize = lpDDDriverCaps->dwSize;
|
791 | 793 | else if(lpDDHELCaps) ddCaps.dwSize = lpDDHELCaps->dwSize;
|
792 | | - else ERR(DDERR_INVALIDPARAMS);
|
| 794 | + if(ddCaps.dwSize > sizeof(DDCAPS_DX7)) ddCaps.dwSize = sizeof(DDCAPS_DX7);
|
| 795 | + else return DDERR_INVALIDPARAMS;
|
793 | 796 | ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
|
794 | 797 | DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM;
|
795 | 798 | ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
|
— | — | @@ -801,14 +804,22 @@ |
802 | 805 | DDSCAPS_FRONTBUFFER | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE |
|
803 | 806 | DDSCAPS_SYSTEMMEMORY | DDSCAPS_VIDEOMEMORY;
|
804 | 807 | ddCaps.dwCKeyCaps = DDCKEYCAPS_SRCBLT;
|
805 | | - if(lpDDDriverCaps) memcpy(lpDDDriverCaps,&ddCaps,lpDDDriverCaps->dwSize);
|
806 | | - if(lpDDHELCaps) memcpy(lpDDHELCaps,&ddCaps,lpDDHELCaps->dwSize);
|
| 808 | + if(lpDDDriverCaps)
|
| 809 | + {
|
| 810 | + if(lpDDDriverCaps->dwSize > sizeof(DDCAPS_DX7)) lpDDDriverCaps->dwSize = sizeof(DDCAPS_DX7);
|
| 811 | + memcpy(lpDDDriverCaps,&ddCaps,lpDDDriverCaps->dwSize);
|
| 812 | + }
|
| 813 | + if(lpDDHELCaps)
|
| 814 | + {
|
| 815 | + if(lpDDHELCaps->dwSize > sizeof(DDCAPS_DX7)) lpDDHELCaps->dwSize = sizeof(DDCAPS_DX7);
|
| 816 | + memcpy(lpDDHELCaps,&ddCaps,lpDDHELCaps->dwSize);
|
| 817 | + }
|
807 | 818 | return DD_OK;
|
808 | 819 | }
|
809 | 820 | HRESULT WINAPI glDirectDraw7::GetDisplayMode(LPDDSURFACEDESC2 lpDDSurfaceDesc2)
|
810 | 821 | {
|
811 | 822 | if(!this) return DDERR_INVALIDPARAMS;
|
812 | | - if(!lpDDSurfaceDesc2) ERR(DDERR_INVALIDPARAMS);
|
| 823 | + if(!lpDDSurfaceDesc2) return DDERR_INVALIDPARAMS;
|
813 | 824 | DDSURFACEDESC2 ddsdMode;
|
814 | 825 | ZeroMemory(&ddsdMode, sizeof(DDSURFACEDESC2));
|
815 | 826 | ddsdMode.dwSize = sizeof(DDSURFACEDESC2);
|
— | — | @@ -894,6 +905,8 @@ |
895 | 906 | HRESULT WINAPI glDirectDraw7::GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes)
|
896 | 907 | {
|
897 | 908 | if(!this) return DDERR_INVALIDPARAMS;
|
| 909 | + if(!lpNumCodes) return DDERR_INVALIDPARAMS;
|
| 910 | + if(!lpCodes) return DDERR_INVALIDPARAMS;
|
898 | 911 | FIXME("IDirectDraw::GetFourCCCodes: stub\n");
|
899 | 912 | ERR(DDERR_GENERIC);
|
900 | 913 | }
|
— | — | @@ -906,6 +919,7 @@ |
907 | 920 | HRESULT WINAPI glDirectDraw7::GetMonitorFrequency(LPDWORD lpdwFrequency)
|
908 | 921 | {
|
909 | 922 | if(!this) return DDERR_INVALIDPARAMS;
|
| 923 | + if(!lpdwFrequency) return DDERR_INVALIDPARAMS;
|
910 | 924 | DEBUG("IDirectDraw::GetMonitorFrequency: support multi-monitor\n");
|
911 | 925 | DEVMODE devmode;
|
912 | 926 | devmode.dmSize = sizeof(DEVMODE);
|
Index: ddraw/glDirectDrawClipper.cpp |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | HRESULT WINAPI glDirectDrawClipper::QueryInterface(REFIID riid, LPVOID* obp)
|
38 | 38 | {
|
39 | 39 | if(!this) return DDERR_INVALIDPARAMS;
|
| 40 | + if(!obp) return DDERR_INVALIDPARAMS;
|
40 | 41 | if(riid == IID_IDirectDrawClipper)
|
41 | 42 | {
|
42 | 43 | *obp = this;
|
Index: ddraw/glDirectDrawPalette.cpp |
— | — | @@ -116,6 +116,7 @@ |
117 | 117 | HRESULT WINAPI glDirectDrawPalette::QueryInterface(REFIID riid, void** ppvObj)
|
118 | 118 | {
|
119 | 119 | if(!this) return DDERR_INVALIDPARAMS;
|
| 120 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
120 | 121 | ERR(E_NOINTERFACE);
|
121 | 122 | }
|
122 | 123 |
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -448,6 +448,7 @@ |
449 | 449 | HRESULT WINAPI glDirectDrawSurface7::QueryInterface(REFIID riid, void** ppvObj)
|
450 | 450 | {
|
451 | 451 | if(!this) return DDERR_INVALIDPARAMS;
|
| 452 | + if(!ppvObj) return DDERR_INVALIDPARAMS;
|
452 | 453 | if(riid == IID_IDirectDrawSurface7)
|
453 | 454 | {
|
454 | 455 | this->AddRef();
|
— | — | @@ -1101,8 +1102,7 @@ |
1102 | 1103 | {
|
1103 | 1104 | if(!this) return DDERR_INVALIDPARAMS;
|
1104 | 1105 | *lplpDD = ddInterface;
|
1105 | | - FIXME("glDirectDrawSurface7::GetDDInterface: stub\n");
|
1106 | | - ERR(DDERR_GENERIC);
|
| 1106 | + return DD_OK;
|
1107 | 1107 | }
|
1108 | 1108 | HRESULT WINAPI glDirectDrawSurface7::PageLock(DWORD dwFlags)
|
1109 | 1109 | {
|