DXGL r254 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r253‎ | r254 | r255 >
Date:20:58, 3 September 2012
Author:admin
Status:new
Tags:
Comment:
Return DDERR_INVALIDOBJECT on IDirectDrawSurface objects when passing no "this" pointer.
Partially fix GetDDInterface on IDirectDrawSurface versions 2 and 3.
Partially implement DX5 textures.
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.h (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -661,6 +661,7 @@
662662 for(int i = 0; i < numtexformats; i++)
663663 {
664664 if(::texformats[i].dwFlags & DDPF_ZBUFFER) continue;
 665+ if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
665666 memcpy(&fmt,&::texformats[i],sizeof(DDPIXELFORMAT));
666667 result = lpd3dEnumPixelProc(&fmt,lpArg);
667668 if(result != D3DENUMRET_OK) return D3D_OK;
@@ -961,6 +962,114 @@
962963 HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
963964 {
964965 if(!this) return DDERR_INVALIDOBJECT;
 966+ switch(dwRendStateType)
 967+ {
 968+ case D3DRENDERSTATE_TEXTUREHANDLE:
 969+ if(dwRenderState > texturecount-1) return DDERR_INVALIDPARAMS;
 970+ if(dwRenderState)
 971+ {
 972+ if(!textures[dwRenderState]) return DDERR_INVALIDPARAMS;
 973+ SetTexture(0,textures[dwRenderState]);
 974+ }
 975+ else SetTexture(0,NULL);
 976+ break;
 977+ case D3DRENDERSTATE_TEXTUREADDRESS:
 978+ SetRenderState(D3DRENDERSTATE_TEXTUREADDRESSU,dwRenderState);
 979+ SetRenderState(D3DRENDERSTATE_TEXTUREADDRESSV,dwRenderState);
 980+ break;
 981+ case D3DRENDERSTATE_WRAPU:
 982+ if(dwRenderState) renderstate[D3DRENDERSTATE_WRAP0] |= D3DWRAP_U;
 983+ else renderstate[D3DRENDERSTATE_WRAP0] &= ~D3DWRAP_U;
 984+ break;
 985+ case D3DRENDERSTATE_WRAPV:
 986+ if(dwRenderState) renderstate[D3DRENDERSTATE_WRAP0] |= D3DWRAP_V;
 987+ else renderstate[D3DRENDERSTATE_WRAP0] &= ~D3DWRAP_V;
 988+ break;
 989+ case D3DRENDERSTATE_TEXTUREMAG:
 990+ switch(dwRenderState)
 991+ {
 992+ case D3DFILTER_NEAREST:
 993+ default:
 994+ SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTFG_POINT);
 995+ break;
 996+ case D3DFILTER_LINEAR:
 997+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFG_POINT);
 998+ }
 999+ break;
 1000+ case D3DRENDERSTATE_TEXTUREMIN:
 1001+ switch(dwRenderState)
 1002+ {
 1003+ case D3DFILTER_NEAREST:
 1004+ default:
 1005+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_POINT);
 1006+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_NONE);
 1007+ break;
 1008+ case D3DFILTER_LINEAR:
 1009+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_LINEAR);
 1010+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_NONE);
 1011+ break;
 1012+ case D3DFILTER_MIPNEAREST:
 1013+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_POINT);
 1014+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_POINT);
 1015+ break;
 1016+ case D3DFILTER_MIPLINEAR:
 1017+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_LINEAR);
 1018+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_POINT);
 1019+ break;
 1020+ case D3DFILTER_LINEARMIPNEAREST:
 1021+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_POINT);
 1022+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_LINEAR);
 1023+ break;
 1024+ case D3DFILTER_LINEARMIPLINEAR:
 1025+ SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFN_LINEAR);
 1026+ SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTFP_LINEAR);
 1027+ break;
 1028+ }
 1029+ break;
 1030+ case D3DRENDERSTATE_TEXTUREMAPBLEND:
 1031+ if(!dwRenderState || (dwRenderState > D3DTBLEND_ADD)) return DDERR_INVALIDPARAMS;
 1032+ switch(dwRenderState)
 1033+ {
 1034+ case D3DTBLEND_DECAL:
 1035+ case D3DTBLEND_COPY:
 1036+ default:
 1037+ SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
 1038+ SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
 1039+ SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
 1040+ SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
 1041+ break;
 1042+ case D3DTBLEND_MODULATE:
 1043+ FIXME("DX5 modulate not yet supported.");
 1044+ ERR(DDERR_GENERIC);
 1045+ case D3DTBLEND_DECALALPHA:
 1046+ SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
 1047+ SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
 1048+ SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURRENT);
 1049+ SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_BLENDTEXTUREALPHA);
 1050+ SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG2);
 1051+ break;
 1052+ case D3DTBLEND_MODULATEALPHA:
 1053+ SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
 1054+ SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
 1055+ SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
 1056+ SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURRENT);
 1057+ SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
 1058+ SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE);
 1059+ break;
 1060+ case D3DTBLEND_DECALMASK:
 1061+ case D3DTBLEND_MODULATEMASK:
 1062+ FIXME("DX5 masked blend modes not supported.");
 1063+ return DDERR_UNSUPPORTED;
 1064+ case D3DTBLEND_ADD:
 1065+ SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
 1066+ SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
 1067+ SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURRENT);
 1068+ SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_ADD);
 1069+ SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG2);
 1070+ break;
 1071+ }
 1072+ break;
 1073+ }
9651074 if(dwRendStateType > 152) return DDERR_INVALIDPARAMS;
9661075 if(dwRendStateType < 0) return DDERR_INVALIDPARAMS;
9671076 renderstate[dwRendStateType] = dwRenderState;
@@ -1470,9 +1579,17 @@
14711580 if(!this) return DDERR_INVALIDOBJECT;
14721581 if(!lpD3DHWDevDesc && !lpD3DHELDevDesc) return DDERR_INVALIDPARAMS;
14731582 D3DDEVICEDESC desc = d3ddesc3;
1474 - if(lpD3DHELDevDesc) *lpD3DHELDevDesc = desc;
 1583+ if(lpD3DHELDevDesc)
 1584+ {
 1585+ if(lpD3DHELDevDesc->dwSize < sizeof(D3DDEVICEDESC)) return DDERR_INVALIDPARAMS;
 1586+ memcpy(lpD3DHELDevDesc, &desc, sizeof(D3DDEVICEDESC));
 1587+ }
14751588 desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION;
1476 - if(lpD3DHWDevDesc) *lpD3DHWDevDesc = desc;
 1589+ if(lpD3DHWDevDesc)
 1590+ {
 1591+ if(lpD3DHWDevDesc->dwSize < sizeof(D3DDEVICEDESC)) return DDERR_INVALIDPARAMS;
 1592+ memcpy(lpD3DHWDevDesc, &desc, sizeof(D3DDEVICEDESC));
 1593+ }
14771594 return D3D_OK;
14781595 }
14791596
@@ -1559,6 +1676,18 @@
15601677 return DDERR_GENERIC;
15611678 }
15621679
 1680+void glDirect3DDevice7::InitDX5()
 1681+{
 1682+ SetRenderState(D3DRENDERSTATE_TEXTUREHANDLE,0);
 1683+ SetRenderState(D3DRENDERSTATE_TEXTUREADDRESS,D3DTADDRESS_WRAP);
 1684+ SetRenderState(D3DRENDERSTATE_WRAPU,FALSE);
 1685+ SetRenderState(D3DRENDERSTATE_WRAPV,FALSE);
 1686+ SetRenderState(D3DRENDERSTATE_TEXTUREMAG,D3DFILTER_NEAREST);
 1687+ SetRenderState(D3DRENDERSTATE_TEXTUREMIN,D3DFILTER_NEAREST);
 1688+ //SetRenderState(D3DRENDERSTATE_TEXTUREMAPBLEND,D3DTBLEND_MODULATE);
 1689+ SetRenderState(D3DRENDERSTATE_SPECULARENABLE,TRUE);
 1690+}
 1691+
15631692 // IDirect3DDevice3 wrapper
15641693 glDirect3DDevice3::glDirect3DDevice3(glDirect3DDevice7 *glD3DDev7)
15651694 {
@@ -1865,6 +1994,7 @@
18661995 glDirect3DDevice2::glDirect3DDevice2(glDirect3DDevice7 *glD3DDev7)
18671996 {
18681997 this->glD3DDev7 = glD3DDev7;
 1998+ glD3DDev7->InitDX5();
18691999 refcount = 1;
18702000 }
18712001
Index: ddraw/glDirect3DDevice.h
@@ -144,6 +144,7 @@
145145 HRESULT SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState);
146146 HRESULT GetStats(LPD3DSTATS lpD3DStats);
147147 HRESULT SwapTextureHandles(LPDIRECT3DTEXTURE2 lpD3DTex1, LPDIRECT3DTEXTURE2 lpD3DTex2);
 148+ void InitDX5();
148149 __int64 SelectShader(GLVERTEX *VertexType);
149150 GLfloat matWorld[16];
150151 GLfloat matView[16];
Index: ddraw/glDirectDrawSurface.cpp
@@ -335,7 +335,7 @@
336336 }
337337 HRESULT WINAPI glDirectDrawSurface7::QueryInterface(REFIID riid, void** ppvObj)
338338 {
339 - if(!this) return DDERR_INVALIDPARAMS;
 339+ if(!this) return DDERR_INVALIDOBJECT;
340340 if(!ppvObj) return DDERR_INVALIDPARAMS;
341341 if(riid == IID_IUnknown)
342342 {
@@ -448,7 +448,7 @@
449449 }
450450 HRESULT WINAPI glDirectDrawSurface7::AddAttachedSurface(LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface)
451451 {
452 - if(!this) return DDERR_INVALIDPARAMS;
 452+ if(!this) return DDERR_INVALIDOBJECT;
453453 if(!lpDDSAttachedSurface) return DDERR_INVALIDPARAMS;
454454 if(zbuffer) ERR(DDERR_SURFACEALREADYATTACHED);
455455 glDirectDrawSurface7 *attached = (glDirectDrawSurface7 *)lpDDSAttachedSurface;
@@ -465,13 +465,13 @@
466466 }
467467 HRESULT WINAPI glDirectDrawSurface7::AddOverlayDirtyRect(LPRECT lpRect)
468468 {
469 - if(!this) return DDERR_INVALIDPARAMS;
 469+ if(!this) return DDERR_INVALIDOBJECT;
470470 FIXME("glDirectDrawSurface7::AddOverlayDirtyRect: stub\n");
471471 ERR(DDERR_GENERIC);
472472 }
473473 HRESULT WINAPI glDirectDrawSurface7::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
474474 {
475 - if(!this) return DDERR_INVALIDPARAMS;
 475+ if(!this) return DDERR_INVALIDOBJECT;
476476 if((dwFlags & DDBLT_COLORFILL) && !lpDDBltFx) return DDERR_INVALIDPARAMS;
477477 glDirectDrawSurface7 *src = (glDirectDrawSurface7 *)lpDDSrcSurface;
478478 if(dirty & 1)
@@ -493,13 +493,13 @@
494494 }
495495 HRESULT WINAPI glDirectDrawSurface7::BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
496496 {
497 - if(!this) return DDERR_INVALIDPARAMS;
 497+ if(!this) return DDERR_INVALIDOBJECT;
498498 FIXME("glDirectDrawSurface7::BltBatch: stub\n");
499499 ERR(DDERR_GENERIC);
500500 }
501501 HRESULT WINAPI glDirectDrawSurface7::BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
502502 {
503 - if(!this) return DDERR_INVALIDPARAMS;
 503+ if(!this) return DDERR_INVALIDOBJECT;
504504 DDSURFACEDESC2 ddsd;
505505 ddsd.dwSize = sizeof(DDSURFACEDESC2);
506506 lpDDSrcSurface->GetSurfaceDesc(&ddsd);
@@ -524,7 +524,7 @@
525525 }
526526 HRESULT WINAPI glDirectDrawSurface7::DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface)
527527 {
528 - if(!this) return DDERR_INVALIDPARAMS;
 528+ if(!this) return DDERR_INVALIDOBJECT;
529529 if(lpDDSAttachedSurface == (LPDIRECTDRAWSURFACE7)zbuffer)
530530 {
531531 zbuffer->Release();
@@ -535,19 +535,19 @@
536536 }
537537 HRESULT WINAPI glDirectDrawSurface7::EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback)
538538 {
539 - if(!this) return DDERR_INVALIDPARAMS;
 539+ if(!this) return DDERR_INVALIDOBJECT;
540540 FIXME("glDirectDrawSurface7::EnumAttachedSurfaces: stub\n");
541541 ERR(DDERR_GENERIC);
542542 }
543543 HRESULT WINAPI glDirectDrawSurface7::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback)
544544 {
545 - if(!this) return DDERR_INVALIDPARAMS;
 545+ if(!this) return DDERR_INVALIDOBJECT;
546546 FIXME("glDirectDrawSurface7::EnumOverlayZOrders: stub\n");
547547 ERR(DDERR_GENERIC);
548548 }
549549 HRESULT WINAPI glDirectDrawSurface7::Flip(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
550550 {
551 - if(!this) return DDERR_INVALIDPARAMS;
 551+ if(!this) return DDERR_INVALIDOBJECT;
552552 HRESULT ret = Flip2(lpDDSurfaceTargetOverride,dwFlags);
553553 if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) RenderScreen(texture,this);
554554 return ret;
@@ -554,7 +554,7 @@
555555 }
556556 HRESULT glDirectDrawSurface7::Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
557557 {
558 - if(!this) return DDERR_INVALIDPARAMS;
 558+ if(!this) return DDERR_INVALIDOBJECT;
559559 DWORD i;
560560 glDirectDrawSurface7 *tmp;
561561 if(dwFlags & DDFLIP_NOVSYNC) swapinterval=0;
@@ -634,7 +634,7 @@
635635 }
636636 HRESULT WINAPI glDirectDrawSurface7::GetAttachedSurface(LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE7 FAR *lplpDDAttachedSurface)
637637 {
638 - if(!this) return DDERR_INVALIDPARAMS;
 638+ if(!this) return DDERR_INVALIDOBJECT;
639639 DDSCAPS2 ddsComp;
640640 backbuffer->GetCaps(&ddsComp);
641641 unsigned __int64 comp1,comp2;
@@ -662,13 +662,13 @@
663663 }
664664 HRESULT WINAPI glDirectDrawSurface7::GetBltStatus(DWORD dwFlags)
665665 {
666 - if(!this) return DDERR_INVALIDPARAMS;
 666+ if(!this) return DDERR_INVALIDOBJECT;
667667 FIXME("glDirectDrawSurface7::GetBltStatus: stub\n");
668668 ERR(DDERR_GENERIC);
669669 }
670670 HRESULT WINAPI glDirectDrawSurface7::GetCaps(LPDDSCAPS2 lpDDSCaps)
671671 {
672 - if(!this) return DDERR_INVALIDPARAMS;
 672+ if(!this) return DDERR_INVALIDOBJECT;
673673 if(!lpDDSCaps) return DDERR_INVALIDPARAMS;
674674 memcpy(lpDDSCaps,&ddsd.ddsCaps,sizeof(DDSCAPS2));
675675 return DD_OK;
@@ -675,13 +675,13 @@
676676 }
677677 HRESULT WINAPI glDirectDrawSurface7::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
678678 {
679 - if(!this) return DDERR_INVALIDPARAMS;
 679+ if(!this) return DDERR_INVALIDOBJECT;
680680 FIXME("glDirectDrawSurface7::GetClipper: stub\n");
681681 ERR(DDERR_GENERIC);
682682 }
683683 HRESULT WINAPI glDirectDrawSurface7::GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
684684 {
685 - if(!this) return DDERR_INVALIDPARAMS;
 685+ if(!this) return DDERR_INVALIDOBJECT;
686686 if(!lpDDColorKey) return DDERR_INVALIDPARAMS;
687687 if(dwFlags == DDCKEY_SRCBLT)
688688 {
@@ -723,7 +723,7 @@
724724 }
725725 HRESULT WINAPI glDirectDrawSurface7::GetDC(HDC FAR *lphDC)
726726 {
727 - if(!this) return DDERR_INVALIDPARAMS;
 727+ if(!this) return DDERR_INVALIDOBJECT;
728728 if(!lphDC) return DDERR_INVALIDPARAMS;
729729 if(hdc) ERR(DDERR_DCALREADYCREATED);
730730 glDirectDrawPalette *pal;
@@ -754,7 +754,7 @@
755755 }
756756 HRESULT WINAPI glDirectDrawSurface7::GetFlipStatus(DWORD dwFlags)
757757 {
758 - if(!this) return DDERR_INVALIDPARAMS;
 758+ if(!this) return DDERR_INVALIDOBJECT;
759759 return DD_OK;
760760 FIXME("glDirectDrawSurface7::GetFlipStatus: stub\n");
761761 ERR(DDERR_GENERIC);
@@ -761,13 +761,13 @@
762762 }
763763 HRESULT WINAPI glDirectDrawSurface7::GetOverlayPosition(LPLONG lplX, LPLONG lplY)
764764 {
765 - if(!this) return DDERR_INVALIDPARAMS;
 765+ if(!this) return DDERR_INVALIDOBJECT;
766766 FIXME("glDirectDrawSurface7::GetOverlayPosition: stub\n");
767767 ERR(DDERR_GENERIC);
768768 }
769769 HRESULT WINAPI glDirectDrawSurface7::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
770770 {
771 - if(!this) return DDERR_INVALIDPARAMS;
 771+ if(!this) return DDERR_INVALIDOBJECT;
772772 HRESULT err;
773773 if(palette)
774774 {
@@ -784,7 +784,7 @@
785785 }
786786 HRESULT WINAPI glDirectDrawSurface7::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat)
787787 {
788 - if(!this) return DDERR_INVALIDPARAMS;
 788+ if(!this) return DDERR_INVALIDOBJECT;
789789 if(!lpDDPixelFormat) return DDERR_INVALIDPARAMS;
790790 *lpDDPixelFormat = ddsd.ddpfPixelFormat;
791791 return DD_OK;
@@ -791,7 +791,7 @@
792792 }
793793 HRESULT WINAPI glDirectDrawSurface7::GetSurfaceDesc(LPDDSURFACEDESC2 lpDDSurfaceDesc)
794794 {
795 - if(!this) return DDERR_INVALIDPARAMS;
 795+ if(!this) return DDERR_INVALIDOBJECT;
796796 if(!lpDDSurfaceDesc) return DDERR_INVALIDPARAMS;
797797 memcpy(lpDDSurfaceDesc,&ddsd,lpDDSurfaceDesc->dwSize);
798798 return DD_OK;
@@ -798,12 +798,12 @@
799799 }
800800 HRESULT WINAPI glDirectDrawSurface7::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc)
801801 {
802 - if(!this) return DDERR_INVALIDPARAMS;
 802+ if(!this) return DDERR_INVALIDOBJECT;
803803 return DDERR_ALREADYINITIALIZED;
804804 }
805805 HRESULT WINAPI glDirectDrawSurface7::IsLost()
806806 {
807 - if(!this) return DDERR_INVALIDPARAMS;
 807+ if(!this) return DDERR_INVALIDOBJECT;
808808 if(hRC == renderer->hRC) return DD_OK;
809809 else return DDERR_SURFACELOST;
810810 }
@@ -810,7 +810,7 @@
811811
812812 HRESULT WINAPI glDirectDrawSurface7::Lock(LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
813813 {
814 - if(!this) return DDERR_INVALIDPARAMS;
 814+ if(!this) return DDERR_INVALIDOBJECT;
815815 if(locked) ERR(DDERR_SURFACEBUSY);
816816 dirty |= 1;
817817 retry:
@@ -854,7 +854,7 @@
855855 }
856856 HRESULT WINAPI glDirectDrawSurface7::ReleaseDC(HDC hDC)
857857 {
858 - if(!this) return DDERR_INVALIDPARAMS;
 858+ if(!this) return DDERR_INVALIDOBJECT;
859859 if(!hdc) return DDERR_INVALIDOBJECT;
860860 if(hDC != hdc) return DDERR_INVALIDOBJECT;
861861 GetDIBits(hDC,hbitmap,0,ddsd.dwHeight,ddsd.lpSurface,bitmapinfo,DIB_RGB_COLORS);
@@ -901,7 +901,7 @@
902902 }
903903 HRESULT WINAPI glDirectDrawSurface7::Restore()
904904 {
905 - if(!this) return DDERR_INVALIDPARAMS;
 905+ if(!this) return DDERR_INVALIDOBJECT;
906906 LONG sizes[6];
907907 if(!renderer) return DDERR_INVALIDOBJECT;
908908 if(hRC != renderer->hRC)
@@ -947,7 +947,7 @@
948948 }
949949 HRESULT WINAPI glDirectDrawSurface7::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
950950 {
951 - if(!this) return DDERR_INVALIDPARAMS;
 951+ if(!this) return DDERR_INVALIDOBJECT;
952952 if(clipper) clipper->Release();
953953 clipper = (glDirectDrawClipper *)lpDDClipper;
954954 if(clipper)clipper->AddRef();
@@ -955,7 +955,7 @@
956956 }
957957 HRESULT WINAPI glDirectDrawSurface7::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
958958 {
959 - if(!this) return DDERR_INVALIDPARAMS;
 959+ if(!this) return DDERR_INVALIDOBJECT;
960960 if(!lpDDColorKey) ERR(DDERR_GENERIC);
961961 CKEY key;
962962 key.enabled = true;
@@ -970,13 +970,13 @@
971971 }
972972 HRESULT WINAPI glDirectDrawSurface7::SetOverlayPosition(LONG lX, LONG lY)
973973 {
974 - if(!this) return DDERR_INVALIDPARAMS;
 974+ if(!this) return DDERR_INVALIDOBJECT;
975975 FIXME("glDirectDrawSurface7::SetOverlayPosition: stub\n");
976976 ERR(DDERR_GENERIC);
977977 }
978978 HRESULT WINAPI glDirectDrawSurface7::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
979979 {
980 - if(!this) return DDERR_INVALIDPARAMS;
 980+ if(!this) return DDERR_INVALIDOBJECT;
981981 if(palette)
982982 {
983983 palette->Release();
@@ -992,7 +992,7 @@
993993
994994 HRESULT WINAPI glDirectDrawSurface7::Unlock(LPRECT lpRect)
995995 {
996 - if(!this) return DDERR_INVALIDPARAMS;
 996+ if(!this) return DDERR_INVALIDOBJECT;
997997 if(!locked) return DDERR_NOTLOCKED;
998998 locked--;
999999 ddsd.lpSurface = NULL;
@@ -1004,19 +1004,19 @@
10051005 }
10061006 HRESULT WINAPI glDirectDrawSurface7::UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE7 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx)
10071007 {
1008 - if(!this) return DDERR_INVALIDPARAMS;
 1008+ if(!this) return DDERR_INVALIDOBJECT;
10091009 FIXME("glDirectDrawSurface7::UpdateOverlay: stub\n");
10101010 ERR(DDERR_GENERIC);
10111011 }
10121012 HRESULT WINAPI glDirectDrawSurface7::UpdateOverlayDisplay(DWORD dwFlags)
10131013 {
1014 - if(!this) return DDERR_INVALIDPARAMS;
 1014+ if(!this) return DDERR_INVALIDOBJECT;
10151015 FIXME("glDirectDrawSurface7::UpdateOverlayDisplay: stub\n");
10161016 ERR(DDERR_GENERIC);
10171017 }
10181018 HRESULT WINAPI glDirectDrawSurface7::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSReference)
10191019 {
1020 - if(!this) return DDERR_INVALIDPARAMS;
 1020+ if(!this) return DDERR_INVALIDOBJECT;
10211021 FIXME("glDirectDrawSurface7::UpdateOverlayZOrder: stub\n");
10221022 ERR(DDERR_GENERIC);
10231023 }
@@ -1028,7 +1028,7 @@
10291029 // ddraw 2+ api
10301030 HRESULT WINAPI glDirectDrawSurface7::GetDDInterface(LPVOID FAR *lplpDD)
10311031 {
1032 - if(!this) return DDERR_INVALIDPARAMS;
 1032+ if(!this) return DDERR_INVALIDOBJECT;
10331033 ddInterface->AddRef();
10341034 *lplpDD = ddInterface;
10351035 return DD_OK;
@@ -1035,13 +1035,13 @@
10361036 }
10371037 HRESULT WINAPI glDirectDrawSurface7::PageLock(DWORD dwFlags)
10381038 {
1039 - if(!this) return DDERR_INVALIDPARAMS;
 1039+ if(!this) return DDERR_INVALIDOBJECT;
10401040 pagelocked++;
10411041 return DD_OK;
10421042 }
10431043 HRESULT WINAPI glDirectDrawSurface7::PageUnlock(DWORD dwFlags)
10441044 {
1045 - if(!this) return DDERR_INVALIDPARAMS;
 1045+ if(!this) return DDERR_INVALIDOBJECT;
10461046 if(!pagelocked) ERR(DDERR_NOTPAGELOCKED);
10471047 pagelocked--;
10481048 return DD_OK;
@@ -1049,7 +1049,7 @@
10501050 // ddraw 3+ api
10511051 HRESULT WINAPI glDirectDrawSurface7::SetSurfaceDesc(LPDDSURFACEDESC2 lpddsd2, DWORD dwFlags)
10521052 {
1053 - if(!this) return DDERR_INVALIDPARAMS;
 1053+ if(!this) return DDERR_INVALIDOBJECT;
10541054 FIXME("glDirectDrawSurface7::SetSurfaceDesc: stub\n");
10551055 ERR(DDERR_GENERIC);
10561056 }
@@ -1056,31 +1056,31 @@
10571057 // ddraw 4+ api
10581058 HRESULT WINAPI glDirectDrawSurface7::SetPrivateData(REFGUID guidTag, LPVOID lpData, DWORD cbSize, DWORD dwFlags)
10591059 {
1060 - if(!this) return DDERR_INVALIDPARAMS;
 1060+ if(!this) return DDERR_INVALIDOBJECT;
10611061 FIXME("glDirectDrawSurface7::SetPrivateData: stub\n");
10621062 ERR(DDERR_GENERIC);
10631063 }
10641064 HRESULT WINAPI glDirectDrawSurface7::GetPrivateData(REFGUID guidTag, LPVOID lpBuffer, LPDWORD lpcbBufferSize)
10651065 {
1066 - if(!this) return DDERR_INVALIDPARAMS;
 1066+ if(!this) return DDERR_INVALIDOBJECT;
10671067 FIXME("glDirectDrawSurface7::GetPrivateData: stub\n");
10681068 ERR(DDERR_GENERIC);
10691069 }
10701070 HRESULT WINAPI glDirectDrawSurface7::FreePrivateData(REFGUID guidTag)
10711071 {
1072 - if(!this) return DDERR_INVALIDPARAMS;
 1072+ if(!this) return DDERR_INVALIDOBJECT;
10731073 FIXME("glDirectDrawSurface7::FreePrivateData: stub\n");
10741074 ERR(DDERR_GENERIC);
10751075 }
10761076 HRESULT WINAPI glDirectDrawSurface7::GetUniquenessValue(LPDWORD lpValue)
10771077 {
1078 - if(!this) return DDERR_INVALIDPARAMS;
 1078+ if(!this) return DDERR_INVALIDOBJECT;
10791079 FIXME("glDirectDrawSurface7::GetUniquenessValue: stub\n");
10801080 ERR(DDERR_GENERIC);
10811081 }
10821082 HRESULT WINAPI glDirectDrawSurface7::ChangeUniquenessValue()
10831083 {
1084 - if(!this) return DDERR_INVALIDPARAMS;
 1084+ if(!this) return DDERR_INVALIDOBJECT;
10851085 FIXME("glDirectDrawSurface7::ChangeUniquenessValue: stub\n");
10861086 ERR(DDERR_GENERIC);
10871087 }
@@ -1087,31 +1087,31 @@
10881088 // ddraw 7 api
10891089 HRESULT WINAPI glDirectDrawSurface7::SetPriority(DWORD dwPriority)
10901090 {
1091 - if(!this) return DDERR_INVALIDPARAMS;
 1091+ if(!this) return DDERR_INVALIDOBJECT;
10921092 FIXME("glDirectDrawSurface7::SetPriority: stub\n");
10931093 ERR(DDERR_GENERIC);
10941094 }
10951095 HRESULT WINAPI glDirectDrawSurface7::GetPriority(LPDWORD lpdwPriority)
10961096 {
1097 - if(!this) return DDERR_INVALIDPARAMS;
 1097+ if(!this) return DDERR_INVALIDOBJECT;
10981098 FIXME("glDirectDrawSurface7::GetPriority: stub\n");
10991099 ERR(DDERR_GENERIC);
11001100 }
11011101 HRESULT WINAPI glDirectDrawSurface7::SetLOD(DWORD dwMaxLOD)
11021102 {
1103 - if(!this) return DDERR_INVALIDPARAMS;
 1103+ if(!this) return DDERR_INVALIDOBJECT;
11041104 FIXME("glDirectDrawSurface7::SetLOD: stub\n");
11051105 ERR(DDERR_GENERIC);
11061106 }
11071107 HRESULT WINAPI glDirectDrawSurface7::GetLOD(LPDWORD lpdwMaxLOD)
11081108 {
1109 - if(!this) return DDERR_INVALIDPARAMS;
 1109+ if(!this) return DDERR_INVALIDOBJECT;
11101110 FIXME("glDirectDrawSurface7::GetLOD: stub\n");
11111111 ERR(DDERR_GENERIC);
11121112 }
11131113 HRESULT WINAPI glDirectDrawSurface7::Unlock2(LPVOID lpSurfaceData)
11141114 {
1115 - if(!this) return DDERR_INVALIDPARAMS;
 1115+ if(!this) return DDERR_INVALIDOBJECT;
11161116 return Unlock((LPRECT)lpSurfaceData);
11171117 }
11181118 void glDirectDrawSurface7::SetFilter(int level, GLint mag, GLint min)
@@ -1185,7 +1185,7 @@
11861186 }
11871187 HRESULT WINAPI glDirectDrawSurface1::QueryInterface(REFIID riid, void** ppvObj)
11881188 {
1189 - if(!this) return DDERR_INVALIDPARAMS;
 1189+ if(!this) return DDERR_INVALIDOBJECT;
11901190 if(riid == IID_IUnknown)
11911191 {
11921192 this->AddRef();
@@ -1211,48 +1211,48 @@
12121212 }
12131213 HRESULT WINAPI glDirectDrawSurface1::AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
12141214 {
1215 - if(!this) return DDERR_INVALIDPARAMS;
 1215+ if(!this) return DDERR_INVALIDOBJECT;
12161216 return glDDS7->AddAttachedSurface(((glDirectDrawSurface1*)lpDDSAttachedSurface)->GetDDS7());
12171217 }
12181218 HRESULT WINAPI glDirectDrawSurface1::AddOverlayDirtyRect(LPRECT lpRect)
12191219 {
1220 - if(!this) return DDERR_INVALIDPARAMS;
 1220+ if(!this) return DDERR_INVALIDOBJECT;
12211221 return glDDS7->AddOverlayDirtyRect(lpRect);
12221222 }
12231223 HRESULT WINAPI glDirectDrawSurface1::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
12241224 {
1225 - if(!this) return DDERR_INVALIDPARAMS;
 1225+ if(!this) return DDERR_INVALIDOBJECT;
12261226 if(lpDDSrcSurface) return glDDS7->Blt(lpDestRect,((glDirectDrawSurface1*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwFlags,lpDDBltFx);
12271227 else return glDDS7->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
12281228 }
12291229 HRESULT WINAPI glDirectDrawSurface1::BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
12301230 {
1231 - if(!this) return DDERR_INVALIDPARAMS;
 1231+ if(!this) return DDERR_INVALIDOBJECT;
12321232 return glDDS7->BltBatch(lpDDBltBatch,dwCount,dwFlags);
12331233 }
12341234 HRESULT WINAPI glDirectDrawSurface1::BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
12351235 {
1236 - if(!this) return DDERR_INVALIDPARAMS;
 1236+ if(!this) return DDERR_INVALIDOBJECT;
12371237 return glDDS7->BltFast(dwX,dwY,((glDirectDrawSurface1*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwTrans);
12381238 }
12391239 HRESULT WINAPI glDirectDrawSurface1::DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
12401240 {
1241 - if(!this) return DDERR_INVALIDPARAMS;
 1241+ if(!this) return DDERR_INVALIDOBJECT;
12421242 return glDDS7->DeleteAttachedSurface(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSAttachedSurface);
12431243 }
12441244 HRESULT WINAPI glDirectDrawSurface1::EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
12451245 {
1246 - if(!this) return DDERR_INVALIDPARAMS;
 1246+ if(!this) return DDERR_INVALIDOBJECT;
12471247 return glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback);
12481248 }
12491249 HRESULT WINAPI glDirectDrawSurface1::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
12501250 {
1251 - if(!this) return DDERR_INVALIDPARAMS;
 1251+ if(!this) return DDERR_INVALIDOBJECT;
12521252 return glDDS7->EnumOverlayZOrders(dwFlags,lpContext,(LPDDENUMSURFACESCALLBACK7)lpfnCallback);
12531253 }
12541254 HRESULT WINAPI glDirectDrawSurface1::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags)
12551255 {
1256 - if(!this) return DDERR_INVALIDPARAMS;
 1256+ if(!this) return DDERR_INVALIDOBJECT;
12571257 if(lpDDSurfaceTargetOverride)
12581258 return glDDS7->Flip(((glDirectDrawSurface1*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
12591259 else return glDDS7->Flip(NULL,dwFlags);
@@ -1259,7 +1259,7 @@
12601260 }
12611261 HRESULT WINAPI glDirectDrawSurface1::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE FAR *lplpDDAttachedSurface)
12621262 {
1263 - if(!this) return DDERR_INVALIDPARAMS;
 1263+ if(!this) return DDERR_INVALIDOBJECT;
12641264 if(!lpDDSCaps) return DDERR_INVALIDPARAMS;
12651265 HRESULT error;
12661266 glDirectDrawSurface7 *attachedsurface;
@@ -1278,12 +1278,12 @@
12791279 }
12801280 HRESULT WINAPI glDirectDrawSurface1::GetBltStatus(DWORD dwFlags)
12811281 {
1282 - if(!this) return DDERR_INVALIDPARAMS;
 1282+ if(!this) return DDERR_INVALIDOBJECT;
12831283 return glDDS7->GetBltStatus(dwFlags);
12841284 }
12851285 HRESULT WINAPI glDirectDrawSurface1::GetCaps(LPDDSCAPS lpDDSCaps)
12861286 {
1287 - if(!this) return DDERR_INVALIDPARAMS;
 1287+ if(!this) return DDERR_INVALIDOBJECT;
12881288 if(!lpDDSCaps) return DDERR_INVALIDPARAMS;
12891289 HRESULT error;
12901290 DDSCAPS2 ddsCaps1;
@@ -1294,107 +1294,107 @@
12951295 }
12961296 HRESULT WINAPI glDirectDrawSurface1::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
12971297 {
1298 - if(!this) return DDERR_INVALIDPARAMS;
 1298+ if(!this) return DDERR_INVALIDOBJECT;
12991299 return glDDS7->GetClipper(lplpDDClipper);
13001300 }
13011301 HRESULT WINAPI glDirectDrawSurface1::GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
13021302 {
1303 - if(!this) return DDERR_INVALIDPARAMS;
 1303+ if(!this) return DDERR_INVALIDOBJECT;
13041304 return glDDS7->GetColorKey(dwFlags,lpDDColorKey);
13051305 }
13061306 HRESULT WINAPI glDirectDrawSurface1::GetDC(HDC FAR *lphDC)
13071307 {
1308 - if(!this) return DDERR_INVALIDPARAMS;
 1308+ if(!this) return DDERR_INVALIDOBJECT;
13091309 return glDDS7->GetDC(lphDC);
13101310 }
13111311 HRESULT WINAPI glDirectDrawSurface1::GetFlipStatus(DWORD dwFlags)
13121312 {
1313 - if(!this) return DDERR_INVALIDPARAMS;
 1313+ if(!this) return DDERR_INVALIDOBJECT;
13141314 return glDDS7->GetFlipStatus(dwFlags);
13151315 }
13161316 HRESULT WINAPI glDirectDrawSurface1::GetOverlayPosition(LPLONG lplX, LPLONG lplY)
13171317 {
1318 - if(!this) return DDERR_INVALIDPARAMS;
 1318+ if(!this) return DDERR_INVALIDOBJECT;
13191319 return glDDS7->GetOverlayPosition(lplX,lplY);
13201320 }
13211321 HRESULT WINAPI glDirectDrawSurface1::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
13221322 {
1323 - if(!this) return DDERR_INVALIDPARAMS;
 1323+ if(!this) return DDERR_INVALIDOBJECT;
13241324 return glDDS7->GetPalette(lplpDDPalette);
13251325 }
13261326 HRESULT WINAPI glDirectDrawSurface1::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat)
13271327 {
1328 - if(!this) return DDERR_INVALIDPARAMS;
 1328+ if(!this) return DDERR_INVALIDOBJECT;
13291329 return glDDS7->GetPixelFormat(lpDDPixelFormat);
13301330 }
13311331 HRESULT WINAPI glDirectDrawSurface1::GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc)
13321332 {
1333 - if(!this) return DDERR_INVALIDPARAMS;
 1333+ if(!this) return DDERR_INVALIDOBJECT;
13341334 return glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc);
13351335 }
13361336 HRESULT WINAPI glDirectDrawSurface1::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
13371337 {
1338 - if(!this) return DDERR_INVALIDPARAMS;
 1338+ if(!this) return DDERR_INVALIDOBJECT;
13391339 return DDERR_ALREADYINITIALIZED;
13401340 }
13411341 HRESULT WINAPI glDirectDrawSurface1::IsLost()
13421342 {
1343 - if(!this) return DDERR_INVALIDPARAMS;
 1343+ if(!this) return DDERR_INVALIDOBJECT;
13441344 return glDDS7->IsLost();
13451345 }
13461346 HRESULT WINAPI glDirectDrawSurface1::Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
13471347 {
1348 - if(!this) return DDERR_INVALIDPARAMS;
 1348+ if(!this) return DDERR_INVALIDOBJECT;
13491349 return glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent);
13501350 }
13511351 HRESULT WINAPI glDirectDrawSurface1::ReleaseDC(HDC hDC)
13521352 {
1353 - if(!this) return DDERR_INVALIDPARAMS;
 1353+ if(!this) return DDERR_INVALIDOBJECT;
13541354 return glDDS7->ReleaseDC(hDC);
13551355 }
13561356 HRESULT WINAPI glDirectDrawSurface1::Restore()
13571357 {
1358 - if(!this) return DDERR_INVALIDPARAMS;
 1358+ if(!this) return DDERR_INVALIDOBJECT;
13591359 return glDDS7->Restore();
13601360 }
13611361 HRESULT WINAPI glDirectDrawSurface1::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
13621362 {
1363 - if(!this) return DDERR_INVALIDPARAMS;
 1363+ if(!this) return DDERR_INVALIDOBJECT;
13641364 return glDDS7->SetClipper(lpDDClipper);
13651365 }
13661366 HRESULT WINAPI glDirectDrawSurface1::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
13671367 {
1368 - if(!this) return DDERR_INVALIDPARAMS;
 1368+ if(!this) return DDERR_INVALIDOBJECT;
13691369 return glDDS7->SetColorKey(dwFlags,lpDDColorKey);
13701370 }
13711371 HRESULT WINAPI glDirectDrawSurface1::SetOverlayPosition(LONG lX, LONG lY)
13721372 {
1373 - if(!this) return DDERR_INVALIDPARAMS;
 1373+ if(!this) return DDERR_INVALIDOBJECT;
13741374 return glDDS7->SetOverlayPosition(lX,lY);
13751375 }
13761376 HRESULT WINAPI glDirectDrawSurface1::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
13771377 {
1378 - if(!this) return DDERR_INVALIDPARAMS;
 1378+ if(!this) return DDERR_INVALIDOBJECT;
13791379 return glDDS7->SetPalette(lpDDPalette);
13801380 }
13811381 HRESULT WINAPI glDirectDrawSurface1::Unlock(LPVOID lpSurfaceData)
13821382 {
1383 - if(!this) return DDERR_INVALIDPARAMS;
 1383+ if(!this) return DDERR_INVALIDOBJECT;
13841384 return glDDS7->Unlock2(lpSurfaceData);
13851385 }
13861386 HRESULT WINAPI glDirectDrawSurface1::UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx)
13871387 {
1388 - if(!this) return DDERR_INVALIDPARAMS;
 1388+ if(!this) return DDERR_INVALIDOBJECT;
13891389 return glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx);
13901390 }
13911391 HRESULT WINAPI glDirectDrawSurface1::UpdateOverlayDisplay(DWORD dwFlags)
13921392 {
1393 - if(!this) return DDERR_INVALIDPARAMS;
 1393+ if(!this) return DDERR_INVALIDOBJECT;
13941394 return glDDS7->UpdateOverlayDisplay(dwFlags);
13951395 }
13961396 HRESULT WINAPI glDirectDrawSurface1::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSReference)
13971397 {
1398 - if(!this) return DDERR_INVALIDPARAMS;
 1398+ if(!this) return DDERR_INVALIDOBJECT;
13991399 return glDDS7->UpdateOverlayZOrder(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSReference);
14001400 }
14011401
@@ -1411,7 +1411,7 @@
14121412 }
14131413 HRESULT WINAPI glDirectDrawSurface2::QueryInterface(REFIID riid, void** ppvObj)
14141414 {
1415 - if(!this) return DDERR_INVALIDPARAMS;
 1415+ if(!this) return DDERR_INVALIDOBJECT;
14161416 if(riid == IID_IUnknown)
14171417 {
14181418 this->AddRef();
@@ -1437,48 +1437,48 @@
14381438 }
14391439 HRESULT WINAPI glDirectDrawSurface2::AddAttachedSurface(LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface)
14401440 {
1441 - if(!this) return DDERR_INVALIDPARAMS;
 1441+ if(!this) return DDERR_INVALIDOBJECT;
14421442 return glDDS7->AddAttachedSurface(((glDirectDrawSurface2*)lpDDSAttachedSurface)->GetDDS7());
14431443 }
14441444 HRESULT WINAPI glDirectDrawSurface2::AddOverlayDirtyRect(LPRECT lpRect)
14451445 {
1446 - if(!this) return DDERR_INVALIDPARAMS;
 1446+ if(!this) return DDERR_INVALIDOBJECT;
14471447 return glDDS7->AddOverlayDirtyRect(lpRect);
14481448 }
14491449 HRESULT WINAPI glDirectDrawSurface2::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
14501450 {
1451 - if(!this) return DDERR_INVALIDPARAMS;
 1451+ if(!this) return DDERR_INVALIDOBJECT;
14521452 if(lpDDSrcSurface) return glDDS7->Blt(lpDestRect,((glDirectDrawSurface2*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwFlags,lpDDBltFx);
14531453 else return glDDS7->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
14541454 }
14551455 HRESULT WINAPI glDirectDrawSurface2::BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
14561456 {
1457 - if(!this) return DDERR_INVALIDPARAMS;
 1457+ if(!this) return DDERR_INVALIDOBJECT;
14581458 return glDDS7->BltBatch(lpDDBltBatch,dwCount,dwFlags);
14591459 }
14601460 HRESULT WINAPI glDirectDrawSurface2::BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
14611461 {
1462 - if(!this) return DDERR_INVALIDPARAMS;
 1462+ if(!this) return DDERR_INVALIDOBJECT;
14631463 return glDDS7->BltFast(dwX,dwY,((glDirectDrawSurface2*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwTrans);
14641464 }
14651465 HRESULT WINAPI glDirectDrawSurface2::DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface)
14661466 {
1467 - if(!this) return DDERR_INVALIDPARAMS;
 1467+ if(!this) return DDERR_INVALIDOBJECT;
14681468 return glDDS7->DeleteAttachedSurface(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSAttachedSurface);
14691469 }
14701470 HRESULT WINAPI glDirectDrawSurface2::EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
14711471 {
1472 - if(!this) return DDERR_INVALIDPARAMS;
 1472+ if(!this) return DDERR_INVALIDOBJECT;
14731473 return glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback);
14741474 }
14751475 HRESULT WINAPI glDirectDrawSurface2::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
14761476 {
1477 - if(!this) return DDERR_INVALIDPARAMS;
 1477+ if(!this) return DDERR_INVALIDOBJECT;
14781478 return glDDS7->EnumOverlayZOrders(dwFlags,lpContext,(LPDDENUMSURFACESCALLBACK7)lpfnCallback);
14791479 }
14801480 HRESULT WINAPI glDirectDrawSurface2::Flip(LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride, DWORD dwFlags)
14811481 {
1482 - if(!this) return DDERR_INVALIDPARAMS;
 1482+ if(!this) return DDERR_INVALIDOBJECT;
14831483 if(lpDDSurfaceTargetOverride)
14841484 return glDDS7->Flip(((glDirectDrawSurface2*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
14851485 else return glDDS7->Flip(NULL,dwFlags);
@@ -1485,7 +1485,7 @@
14861486 }
14871487 HRESULT WINAPI glDirectDrawSurface2::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE2 FAR *lplpDDAttachedSurface)
14881488 {
1489 - if(!this) return DDERR_INVALIDPARAMS;
 1489+ if(!this) return DDERR_INVALIDOBJECT;
14901490 HRESULT error;
14911491 glDirectDrawSurface7 *attachedsurface;
14921492 glDirectDrawSurface2 *attached1;
@@ -1503,12 +1503,12 @@
15041504 }
15051505 HRESULT WINAPI glDirectDrawSurface2::GetBltStatus(DWORD dwFlags)
15061506 {
1507 - if(!this) return DDERR_INVALIDPARAMS;
 1507+ if(!this) return DDERR_INVALIDOBJECT;
15081508 return glDDS7->GetBltStatus(dwFlags);
15091509 }
15101510 HRESULT WINAPI glDirectDrawSurface2::GetCaps(LPDDSCAPS lpDDSCaps)
15111511 {
1512 - if(!this) return DDERR_INVALIDPARAMS;
 1512+ if(!this) return DDERR_INVALIDOBJECT;
15131513 if(!lpDDSCaps) return DDERR_INVALIDPARAMS;
15141514 HRESULT error;
15151515 DDSCAPS2 ddsCaps1;
@@ -1519,122 +1519,127 @@
15201520 }
15211521 HRESULT WINAPI glDirectDrawSurface2::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
15221522 {
1523 - if(!this) return DDERR_INVALIDPARAMS;
 1523+ if(!this) return DDERR_INVALIDOBJECT;
15241524 return glDDS7->GetClipper(lplpDDClipper);
15251525 }
15261526 HRESULT WINAPI glDirectDrawSurface2::GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
15271527 {
1528 - if(!this) return DDERR_INVALIDPARAMS;
 1528+ if(!this) return DDERR_INVALIDOBJECT;
15291529 return glDDS7->GetColorKey(dwFlags,lpDDColorKey);
15301530 }
15311531 HRESULT WINAPI glDirectDrawSurface2::GetDC(HDC FAR *lphDC)
15321532 {
1533 - if(!this) return DDERR_INVALIDPARAMS;
 1533+ if(!this) return DDERR_INVALIDOBJECT;
15341534 return glDDS7->GetDC(lphDC);
15351535 }
15361536 HRESULT WINAPI glDirectDrawSurface2::GetFlipStatus(DWORD dwFlags)
15371537 {
1538 - if(!this) return DDERR_INVALIDPARAMS;
 1538+ if(!this) return DDERR_INVALIDOBJECT;
15391539 return glDDS7->GetFlipStatus(dwFlags);
15401540 }
15411541 HRESULT WINAPI glDirectDrawSurface2::GetOverlayPosition(LPLONG lplX, LPLONG lplY)
15421542 {
1543 - if(!this) return DDERR_INVALIDPARAMS;
 1543+ if(!this) return DDERR_INVALIDOBJECT;
15441544 return glDDS7->GetOverlayPosition(lplX,lplY);
15451545 }
15461546 HRESULT WINAPI glDirectDrawSurface2::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
15471547 {
1548 - if(!this) return DDERR_INVALIDPARAMS;
 1548+ if(!this) return DDERR_INVALIDOBJECT;
15491549 return glDDS7->GetPalette(lplpDDPalette);
15501550 }
15511551 HRESULT WINAPI glDirectDrawSurface2::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat)
15521552 {
1553 - if(!this) return DDERR_INVALIDPARAMS;
 1553+ if(!this) return DDERR_INVALIDOBJECT;
15541554 return glDDS7->GetPixelFormat(lpDDPixelFormat);
15551555 }
15561556 HRESULT WINAPI glDirectDrawSurface2::GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc)
15571557 {
1558 - if(!this) return DDERR_INVALIDPARAMS;
 1558+ if(!this) return DDERR_INVALIDOBJECT;
15591559 return glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc);
15601560 }
15611561 HRESULT WINAPI glDirectDrawSurface2::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
15621562 {
1563 - if(!this) return DDERR_INVALIDPARAMS;
 1563+ if(!this) return DDERR_INVALIDOBJECT;
15641564 return DDERR_ALREADYINITIALIZED;
15651565 }
15661566 HRESULT WINAPI glDirectDrawSurface2::IsLost()
15671567 {
1568 - if(!this) return DDERR_INVALIDPARAMS;
 1568+ if(!this) return DDERR_INVALIDOBJECT;
15691569 return glDDS7->IsLost();
15701570 }
15711571 HRESULT WINAPI glDirectDrawSurface2::Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
15721572 {
1573 - if(!this) return DDERR_INVALIDPARAMS;
 1573+ if(!this) return DDERR_INVALIDOBJECT;
15741574 return glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent);
15751575 }
15761576 HRESULT WINAPI glDirectDrawSurface2::ReleaseDC(HDC hDC)
15771577 {
1578 - if(!this) return DDERR_INVALIDPARAMS;
 1578+ if(!this) return DDERR_INVALIDOBJECT;
15791579 return glDDS7->ReleaseDC(hDC);
15801580 }
15811581 HRESULT WINAPI glDirectDrawSurface2::Restore()
15821582 {
1583 - if(!this) return DDERR_INVALIDPARAMS;
 1583+ if(!this) return DDERR_INVALIDOBJECT;
15841584 return glDDS7->Restore();
15851585 }
15861586 HRESULT WINAPI glDirectDrawSurface2::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
15871587 {
1588 - if(!this) return DDERR_INVALIDPARAMS;
 1588+ if(!this) return DDERR_INVALIDOBJECT;
15891589 return glDDS7->SetClipper(lpDDClipper);
15901590 }
15911591 HRESULT WINAPI glDirectDrawSurface2::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
15921592 {
1593 - if(!this) return DDERR_INVALIDPARAMS;
 1593+ if(!this) return DDERR_INVALIDOBJECT;
15941594 return glDDS7->SetColorKey(dwFlags,lpDDColorKey);
15951595 }
15961596 HRESULT WINAPI glDirectDrawSurface2::SetOverlayPosition(LONG lX, LONG lY)
15971597 {
1598 - if(!this) return DDERR_INVALIDPARAMS;
 1598+ if(!this) return DDERR_INVALIDOBJECT;
15991599 return glDDS7->SetOverlayPosition(lX,lY);
16001600 }
16011601 HRESULT WINAPI glDirectDrawSurface2::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
16021602 {
1603 - if(!this) return DDERR_INVALIDPARAMS;
 1603+ if(!this) return DDERR_INVALIDOBJECT;
16041604 return glDDS7->SetPalette(lpDDPalette);
16051605 }
16061606 HRESULT WINAPI glDirectDrawSurface2::Unlock(LPVOID lpSurfaceData)
16071607 {
1608 - if(!this) return DDERR_INVALIDPARAMS;
 1608+ if(!this) return DDERR_INVALIDOBJECT;
16091609 return glDDS7->Unlock2(lpSurfaceData);
16101610 }
16111611 HRESULT WINAPI glDirectDrawSurface2::UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE2 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx)
16121612 {
1613 - if(!this) return DDERR_INVALIDPARAMS;
 1613+ if(!this) return DDERR_INVALIDOBJECT;
16141614 return glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx);
16151615 }
16161616 HRESULT WINAPI glDirectDrawSurface2::UpdateOverlayDisplay(DWORD dwFlags)
16171617 {
1618 - if(!this) return DDERR_INVALIDPARAMS;
 1618+ if(!this) return DDERR_INVALIDOBJECT;
16191619 return glDDS7->UpdateOverlayDisplay(dwFlags);
16201620 }
16211621 HRESULT WINAPI glDirectDrawSurface2::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSReference)
16221622 {
1623 - if(!this) return DDERR_INVALIDPARAMS;
 1623+ if(!this) return DDERR_INVALIDOBJECT;
16241624 return glDDS7->UpdateOverlayZOrder(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSReference);
16251625 }
16261626 HRESULT WINAPI glDirectDrawSurface2::GetDDInterface(LPVOID FAR *lplpDD)
16271627 {
1628 - if(!this) return DDERR_INVALIDPARAMS;
1629 - return glDDS7->GetDDInterface(lplpDD);
 1628+ if(!this) return DDERR_INVALIDOBJECT;
 1629+ glDirectDraw7 *glDD7;
 1630+ HRESULT ret = glDDS7->GetDDInterface((void**)&glDD7);
 1631+ if(ret != DD_OK) return ret;
 1632+ glDD7->QueryInterface(IID_IDirectDraw,lplpDD);
 1633+ glDD7->Release();
 1634+ return ret;
16301635 }
16311636 HRESULT WINAPI glDirectDrawSurface2::PageLock(DWORD dwFlags)
16321637 {
1633 - if(!this) return DDERR_INVALIDPARAMS;
 1638+ if(!this) return DDERR_INVALIDOBJECT;
16341639 return glDDS7->PageLock(dwFlags);
16351640 }
16361641 HRESULT WINAPI glDirectDrawSurface2::PageUnlock(DWORD dwFlags)
16371642 {
1638 - if(!this) return DDERR_INVALIDPARAMS;
 1643+ if(!this) return DDERR_INVALIDOBJECT;
16391644 return glDDS7->PageUnlock(dwFlags);
16401645 }
16411646
@@ -1651,7 +1656,7 @@
16521657 }
16531658 HRESULT WINAPI glDirectDrawSurface3::QueryInterface(REFIID riid, void** ppvObj)
16541659 {
1655 - if(!this) return DDERR_INVALIDPARAMS;
 1660+ if(!this) return DDERR_INVALIDOBJECT;
16561661 if(riid == IID_IUnknown)
16571662 {
16581663 this->AddRef();
@@ -1677,48 +1682,48 @@
16781683 }
16791684 HRESULT WINAPI glDirectDrawSurface3::AddAttachedSurface(LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface)
16801685 {
1681 - if(!this) return DDERR_INVALIDPARAMS;
 1686+ if(!this) return DDERR_INVALIDOBJECT;
16821687 return glDDS7->AddAttachedSurface(((glDirectDrawSurface3*)lpDDSAttachedSurface)->GetDDS7());
16831688 }
16841689 HRESULT WINAPI glDirectDrawSurface3::AddOverlayDirtyRect(LPRECT lpRect)
16851690 {
1686 - if(!this) return DDERR_INVALIDPARAMS;
 1691+ if(!this) return DDERR_INVALIDOBJECT;
16871692 return glDDS7->AddOverlayDirtyRect(lpRect);
16881693 }
16891694 HRESULT WINAPI glDirectDrawSurface3::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
16901695 {
1691 - if(!this) return DDERR_INVALIDPARAMS;
 1696+ if(!this) return DDERR_INVALIDOBJECT;
16921697 if(lpDDSrcSurface) return glDDS7->Blt(lpDestRect,((glDirectDrawSurface3*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwFlags,lpDDBltFx);
16931698 else return glDDS7->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
16941699 }
16951700 HRESULT WINAPI glDirectDrawSurface3::BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
16961701 {
1697 - if(!this) return DDERR_INVALIDPARAMS;
 1702+ if(!this) return DDERR_INVALIDOBJECT;
16981703 return glDDS7->BltBatch(lpDDBltBatch,dwCount,dwFlags);
16991704 }
17001705 HRESULT WINAPI glDirectDrawSurface3::BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
17011706 {
1702 - if(!this) return DDERR_INVALIDPARAMS;
 1707+ if(!this) return DDERR_INVALIDOBJECT;
17031708 return glDDS7->BltFast(dwX,dwY,((glDirectDrawSurface3*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwTrans);
17041709 }
17051710 HRESULT WINAPI glDirectDrawSurface3::DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface)
17061711 {
1707 - if(!this) return DDERR_INVALIDPARAMS;
 1712+ if(!this) return DDERR_INVALIDOBJECT;
17081713 return glDDS7->DeleteAttachedSurface(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSAttachedSurface);
17091714 }
17101715 HRESULT WINAPI glDirectDrawSurface3::EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
17111716 {
1712 - if(!this) return DDERR_INVALIDPARAMS;
 1717+ if(!this) return DDERR_INVALIDOBJECT;
17131718 return glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback);
17141719 }
17151720 HRESULT WINAPI glDirectDrawSurface3::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback)
17161721 {
1717 - if(!this) return DDERR_INVALIDPARAMS;
 1722+ if(!this) return DDERR_INVALIDOBJECT;
17181723 return glDDS7->EnumOverlayZOrders(dwFlags,lpContext,(LPDDENUMSURFACESCALLBACK7)lpfnCallback);
17191724 }
17201725 HRESULT WINAPI glDirectDrawSurface3::Flip(LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags)
17211726 {
1722 - if(!this) return DDERR_INVALIDPARAMS;
 1727+ if(!this) return DDERR_INVALIDOBJECT;
17231728 if(lpDDSurfaceTargetOverride)
17241729 return glDDS7->Flip(((glDirectDrawSurface3*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
17251730 else return glDDS7->Flip(NULL,dwFlags);
@@ -1725,7 +1730,7 @@
17261731 }
17271732 HRESULT WINAPI glDirectDrawSurface3::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE3 FAR *lplpDDAttachedSurface)
17281733 {
1729 - if(!this) return DDERR_INVALIDPARAMS;
 1734+ if(!this) return DDERR_INVALIDOBJECT;
17301735 HRESULT error;
17311736 glDirectDrawSurface7 *attachedsurface;
17321737 glDirectDrawSurface3 *attached1;
@@ -1743,12 +1748,12 @@
17441749 }
17451750 HRESULT WINAPI glDirectDrawSurface3::GetBltStatus(DWORD dwFlags)
17461751 {
1747 - if(!this) return DDERR_INVALIDPARAMS;
 1752+ if(!this) return DDERR_INVALIDOBJECT;
17481753 return glDDS7->GetBltStatus(dwFlags);
17491754 }
17501755 HRESULT WINAPI glDirectDrawSurface3::GetCaps(LPDDSCAPS lpDDSCaps)
17511756 {
1752 - if(!this) return DDERR_INVALIDPARAMS;
 1757+ if(!this) return DDERR_INVALIDOBJECT;
17531758 if(!lpDDSCaps) return DDERR_INVALIDPARAMS;
17541759 HRESULT error;
17551760 DDSCAPS2 ddsCaps1;
@@ -1759,127 +1764,132 @@
17601765 }
17611766 HRESULT WINAPI glDirectDrawSurface3::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
17621767 {
1763 - if(!this) return DDERR_INVALIDPARAMS;
 1768+ if(!this) return DDERR_INVALIDOBJECT;
17641769 return glDDS7->GetClipper(lplpDDClipper);
17651770 }
17661771 HRESULT WINAPI glDirectDrawSurface3::GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
17671772 {
1768 - if(!this) return DDERR_INVALIDPARAMS;
 1773+ if(!this) return DDERR_INVALIDOBJECT;
17691774 return glDDS7->GetColorKey(dwFlags,lpDDColorKey);
17701775 }
17711776 HRESULT WINAPI glDirectDrawSurface3::GetDC(HDC FAR *lphDC)
17721777 {
1773 - if(!this) return DDERR_INVALIDPARAMS;
 1778+ if(!this) return DDERR_INVALIDOBJECT;
17741779 return glDDS7->GetDC(lphDC);
17751780 }
17761781 HRESULT WINAPI glDirectDrawSurface3::GetFlipStatus(DWORD dwFlags)
17771782 {
1778 - if(!this) return DDERR_INVALIDPARAMS;
 1783+ if(!this) return DDERR_INVALIDOBJECT;
17791784 return glDDS7->GetFlipStatus(dwFlags);
17801785 }
17811786 HRESULT WINAPI glDirectDrawSurface3::GetOverlayPosition(LPLONG lplX, LPLONG lplY)
17821787 {
1783 - if(!this) return DDERR_INVALIDPARAMS;
 1788+ if(!this) return DDERR_INVALIDOBJECT;
17841789 return glDDS7->GetOverlayPosition(lplX,lplY);
17851790 }
17861791 HRESULT WINAPI glDirectDrawSurface3::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
17871792 {
1788 - if(!this) return DDERR_INVALIDPARAMS;
 1793+ if(!this) return DDERR_INVALIDOBJECT;
17891794 return glDDS7->GetPalette(lplpDDPalette);
17901795 }
17911796 HRESULT WINAPI glDirectDrawSurface3::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat)
17921797 {
1793 - if(!this) return DDERR_INVALIDPARAMS;
 1798+ if(!this) return DDERR_INVALIDOBJECT;
17941799 return glDDS7->GetPixelFormat(lpDDPixelFormat);
17951800 }
17961801 HRESULT WINAPI glDirectDrawSurface3::GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc)
17971802 {
1798 - if(!this) return DDERR_INVALIDPARAMS;
 1803+ if(!this) return DDERR_INVALIDOBJECT;
17991804 return glDDS7->GetSurfaceDesc((LPDDSURFACEDESC2)lpDDSurfaceDesc);
18001805 }
18011806 HRESULT WINAPI glDirectDrawSurface3::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc)
18021807 {
1803 - if(!this) return DDERR_INVALIDPARAMS;
 1808+ if(!this) return DDERR_INVALIDOBJECT;
18041809 return DDERR_ALREADYINITIALIZED;
18051810 }
18061811 HRESULT WINAPI glDirectDrawSurface3::IsLost()
18071812 {
1808 - if(!this) return DDERR_INVALIDPARAMS;
 1813+ if(!this) return DDERR_INVALIDOBJECT;
18091814 return glDDS7->IsLost();
18101815 }
18111816 HRESULT WINAPI glDirectDrawSurface3::Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
18121817 {
1813 - if(!this) return DDERR_INVALIDPARAMS;
 1818+ if(!this) return DDERR_INVALIDOBJECT;
18141819 return glDDS7->Lock(lpDestRect,(LPDDSURFACEDESC2)lpDDSurfaceDesc,dwFlags,hEvent);
18151820 }
18161821 HRESULT WINAPI glDirectDrawSurface3::ReleaseDC(HDC hDC)
18171822 {
1818 - if(!this) return DDERR_INVALIDPARAMS;
 1823+ if(!this) return DDERR_INVALIDOBJECT;
18191824 return glDDS7->ReleaseDC(hDC);
18201825 }
18211826 HRESULT WINAPI glDirectDrawSurface3::Restore()
18221827 {
1823 - if(!this) return DDERR_INVALIDPARAMS;
 1828+ if(!this) return DDERR_INVALIDOBJECT;
18241829 return glDDS7->Restore();
18251830 }
18261831 HRESULT WINAPI glDirectDrawSurface3::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
18271832 {
1828 - if(!this) return DDERR_INVALIDPARAMS;
 1833+ if(!this) return DDERR_INVALIDOBJECT;
18291834 return glDDS7->SetClipper(lpDDClipper);
18301835 }
18311836 HRESULT WINAPI glDirectDrawSurface3::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
18321837 {
1833 - if(!this) return DDERR_INVALIDPARAMS;
 1838+ if(!this) return DDERR_INVALIDOBJECT;
18341839 return glDDS7->SetColorKey(dwFlags,lpDDColorKey);
18351840 }
18361841 HRESULT WINAPI glDirectDrawSurface3::SetOverlayPosition(LONG lX, LONG lY)
18371842 {
1838 - if(!this) return DDERR_INVALIDPARAMS;
 1843+ if(!this) return DDERR_INVALIDOBJECT;
18391844 return glDDS7->SetOverlayPosition(lX,lY);
18401845 }
18411846 HRESULT WINAPI glDirectDrawSurface3::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
18421847 {
1843 - if(!this) return DDERR_INVALIDPARAMS;
 1848+ if(!this) return DDERR_INVALIDOBJECT;
18441849 return glDDS7->SetPalette(lpDDPalette);
18451850 }
18461851 HRESULT WINAPI glDirectDrawSurface3::Unlock(LPVOID lpSurfaceData)
18471852 {
1848 - if(!this) return DDERR_INVALIDPARAMS;
 1853+ if(!this) return DDERR_INVALIDOBJECT;
18491854 return glDDS7->Unlock2(lpSurfaceData);
18501855 }
18511856 HRESULT WINAPI glDirectDrawSurface3::UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE3 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx)
18521857 {
1853 - if(!this) return DDERR_INVALIDPARAMS;
 1858+ if(!this) return DDERR_INVALIDOBJECT;
18541859 return glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx);
18551860 }
18561861 HRESULT WINAPI glDirectDrawSurface3::UpdateOverlayDisplay(DWORD dwFlags)
18571862 {
1858 - if(!this) return DDERR_INVALIDPARAMS;
 1863+ if(!this) return DDERR_INVALIDOBJECT;
18591864 return glDDS7->UpdateOverlayDisplay(dwFlags);
18601865 }
18611866 HRESULT WINAPI glDirectDrawSurface3::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSReference)
18621867 {
1863 - if(!this) return DDERR_INVALIDPARAMS;
 1868+ if(!this) return DDERR_INVALIDOBJECT;
18641869 return glDDS7->UpdateOverlayZOrder(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSReference);
18651870 }
18661871 HRESULT WINAPI glDirectDrawSurface3::GetDDInterface(LPVOID FAR *lplpDD)
18671872 {
1868 - if(!this) return DDERR_INVALIDPARAMS;
1869 - return glDDS7->GetDDInterface(lplpDD);
 1873+ if(!this) return DDERR_INVALIDOBJECT;
 1874+ glDirectDraw7 *glDD7;
 1875+ HRESULT ret = glDDS7->GetDDInterface((void**)&glDD7);
 1876+ if(ret != DD_OK) return ret;
 1877+ glDD7->QueryInterface(IID_IDirectDraw,lplpDD);
 1878+ glDD7->Release();
 1879+ return ret;
18701880 }
18711881 HRESULT WINAPI glDirectDrawSurface3::PageLock(DWORD dwFlags)
18721882 {
1873 - if(!this) return DDERR_INVALIDPARAMS;
 1883+ if(!this) return DDERR_INVALIDOBJECT;
18741884 return glDDS7->PageLock(dwFlags);
18751885 }
18761886 HRESULT WINAPI glDirectDrawSurface3::PageUnlock(DWORD dwFlags)
18771887 {
1878 - if(!this) return DDERR_INVALIDPARAMS;
 1888+ if(!this) return DDERR_INVALIDOBJECT;
18791889 return glDDS7->PageUnlock(dwFlags);
18801890 }
18811891 HRESULT WINAPI glDirectDrawSurface3::SetSurfaceDesc(LPDDSURFACEDESC lpddsd, DWORD dwFlags)
18821892 {
1883 - if(!this) return DDERR_INVALIDPARAMS;
 1893+ if(!this) return DDERR_INVALIDOBJECT;
18841894 return glDDS7->SetSurfaceDesc((LPDDSURFACEDESC2)lpddsd,dwFlags);
18851895 }
18861896
@@ -1896,7 +1906,7 @@
18971907 }
18981908 HRESULT WINAPI glDirectDrawSurface4::QueryInterface(REFIID riid, void** ppvObj)
18991909 {
1900 - if(!this) return DDERR_INVALIDPARAMS;
 1910+ if(!this) return DDERR_INVALIDOBJECT;
19011911 if(riid == IID_IUnknown)
19021912 {
19031913 this->AddRef();
@@ -1922,48 +1932,48 @@
19231933 }
19241934 HRESULT WINAPI glDirectDrawSurface4::AddAttachedSurface(LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface)
19251935 {
1926 - if(!this) return DDERR_INVALIDPARAMS;
 1936+ if(!this) return DDERR_INVALIDOBJECT;
19271937 return glDDS7->AddAttachedSurface(((glDirectDrawSurface4*)lpDDSAttachedSurface)->GetDDS7());
19281938 }
19291939 HRESULT WINAPI glDirectDrawSurface4::AddOverlayDirtyRect(LPRECT lpRect)
19301940 {
1931 - if(!this) return DDERR_INVALIDPARAMS;
 1941+ if(!this) return DDERR_INVALIDOBJECT;
19321942 return glDDS7->AddOverlayDirtyRect(lpRect);
19331943 }
19341944 HRESULT WINAPI glDirectDrawSurface4::Blt(LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
19351945 {
1936 - if(!this) return DDERR_INVALIDPARAMS;
 1946+ if(!this) return DDERR_INVALIDOBJECT;
19371947 if(lpDDSrcSurface) return glDDS7->Blt(lpDestRect,((glDirectDrawSurface4*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwFlags,lpDDBltFx);
19381948 else return glDDS7->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
19391949 }
19401950 HRESULT WINAPI glDirectDrawSurface4::BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
19411951 {
1942 - if(!this) return DDERR_INVALIDPARAMS;
 1952+ if(!this) return DDERR_INVALIDOBJECT;
19431953 return glDDS7->BltBatch(lpDDBltBatch,dwCount,dwFlags);
19441954 }
19451955 HRESULT WINAPI glDirectDrawSurface4::BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
19461956 {
1947 - if(!this) return DDERR_INVALIDPARAMS;
 1957+ if(!this) return DDERR_INVALIDOBJECT;
19481958 return glDDS7->BltFast(dwX,dwY,((glDirectDrawSurface4*)lpDDSrcSurface)->GetDDS7(),lpSrcRect,dwTrans);
19491959 }
19501960 HRESULT WINAPI glDirectDrawSurface4::DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface)
19511961 {
1952 - if(!this) return DDERR_INVALIDPARAMS;
 1962+ if(!this) return DDERR_INVALIDOBJECT;
19531963 return glDDS7->DeleteAttachedSurface(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSAttachedSurface);
19541964 }
19551965 HRESULT WINAPI glDirectDrawSurface4::EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback)
19561966 {
1957 - if(!this) return DDERR_INVALIDPARAMS;
 1967+ if(!this) return DDERR_INVALIDOBJECT;
19581968 return glDDS7->EnumAttachedSurfaces(lpContext,(LPDDENUMSURFACESCALLBACK7)lpEnumSurfacesCallback);
19591969 }
19601970 HRESULT WINAPI glDirectDrawSurface4::EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpfnCallback)
19611971 {
1962 - if(!this) return DDERR_INVALIDPARAMS;
 1972+ if(!this) return DDERR_INVALIDOBJECT;
19631973 return glDDS7->EnumOverlayZOrders(dwFlags,lpContext,(LPDDENUMSURFACESCALLBACK7)lpfnCallback);
19641974 }
19651975 HRESULT WINAPI glDirectDrawSurface4::Flip(LPDIRECTDRAWSURFACE4 lpDDSurfaceTargetOverride, DWORD dwFlags)
19661976 {
1967 - if(!this) return DDERR_INVALIDPARAMS;
 1977+ if(!this) return DDERR_INVALIDOBJECT;
19681978 if(lpDDSurfaceTargetOverride)
19691979 return glDDS7->Flip(((glDirectDrawSurface4*)lpDDSurfaceTargetOverride)->GetDDS7(),dwFlags);
19701980 else return glDDS7->Flip(NULL,dwFlags);
@@ -1970,7 +1980,7 @@
19711981 }
19721982 HRESULT WINAPI glDirectDrawSurface4::GetAttachedSurface(LPDDSCAPS2 lpDDSCaps2, LPDIRECTDRAWSURFACE4 FAR *lplpDDAttachedSurface)
19731983 {
1974 - if(!this) return DDERR_INVALIDPARAMS;
 1984+ if(!this) return DDERR_INVALIDOBJECT;
19751985 HRESULT error;
19761986 glDirectDrawSurface7 *attachedsurface;
19771987 glDirectDrawSurface4 *attached1;
@@ -1985,161 +1995,161 @@
19861996 }
19871997 HRESULT WINAPI glDirectDrawSurface4::GetBltStatus(DWORD dwFlags)
19881998 {
1989 - if(!this) return DDERR_INVALIDPARAMS;
 1999+ if(!this) return DDERR_INVALIDOBJECT;
19902000 return glDDS7->GetBltStatus(dwFlags);
19912001 }
19922002 HRESULT WINAPI glDirectDrawSurface4::GetCaps(LPDDSCAPS2 lpDDSCaps)
19932003 {
1994 - if(!this) return DDERR_INVALIDPARAMS;
 2004+ if(!this) return DDERR_INVALIDOBJECT;
19952005 return glDDS7->GetCaps(lpDDSCaps);
19962006 }
19972007 HRESULT WINAPI glDirectDrawSurface4::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
19982008 {
1999 - if(!this) return DDERR_INVALIDPARAMS;
 2009+ if(!this) return DDERR_INVALIDOBJECT;
20002010 return glDDS7->GetClipper(lplpDDClipper);
20012011 }
20022012 HRESULT WINAPI glDirectDrawSurface4::GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
20032013 {
2004 - if(!this) return DDERR_INVALIDPARAMS;
 2014+ if(!this) return DDERR_INVALIDOBJECT;
20052015 return glDDS7->GetColorKey(dwFlags,lpDDColorKey);
20062016 }
20072017 HRESULT WINAPI glDirectDrawSurface4::GetDC(HDC FAR *lphDC)
20082018 {
2009 - if(!this) return DDERR_INVALIDPARAMS;
 2019+ if(!this) return DDERR_INVALIDOBJECT;
20102020 return glDDS7->GetDC(lphDC);
20112021 }
20122022 HRESULT WINAPI glDirectDrawSurface4::GetFlipStatus(DWORD dwFlags)
20132023 {
2014 - if(!this) return DDERR_INVALIDPARAMS;
 2024+ if(!this) return DDERR_INVALIDOBJECT;
20152025 return glDDS7->GetFlipStatus(dwFlags);
20162026 }
20172027 HRESULT WINAPI glDirectDrawSurface4::GetOverlayPosition(LPLONG lplX, LPLONG lplY)
20182028 {
2019 - if(!this) return DDERR_INVALIDPARAMS;
 2029+ if(!this) return DDERR_INVALIDOBJECT;
20202030 return glDDS7->GetOverlayPosition(lplX,lplY);
20212031 }
20222032 HRESULT WINAPI glDirectDrawSurface4::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
20232033 {
2024 - if(!this) return DDERR_INVALIDPARAMS;
 2034+ if(!this) return DDERR_INVALIDOBJECT;
20252035 return glDDS7->GetPalette(lplpDDPalette);
20262036 }
20272037 HRESULT WINAPI glDirectDrawSurface4::GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat)
20282038 {
2029 - if(!this) return DDERR_INVALIDPARAMS;
 2039+ if(!this) return DDERR_INVALIDOBJECT;
20302040 return glDDS7->GetPixelFormat(lpDDPixelFormat);
20312041 }
20322042 HRESULT WINAPI glDirectDrawSurface4::GetSurfaceDesc(LPDDSURFACEDESC2 lpDDSurfaceDesc)
20332043 {
2034 - if(!this) return DDERR_INVALIDPARAMS;
 2044+ if(!this) return DDERR_INVALIDOBJECT;
20352045 return glDDS7->GetSurfaceDesc(lpDDSurfaceDesc);
20362046 }
20372047 HRESULT WINAPI glDirectDrawSurface4::Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc)
20382048 {
2039 - if(!this) return DDERR_INVALIDPARAMS;
 2049+ if(!this) return DDERR_INVALIDOBJECT;
20402050 return DDERR_ALREADYINITIALIZED;
20412051 }
20422052 HRESULT WINAPI glDirectDrawSurface4::IsLost()
20432053 {
2044 - if(!this) return DDERR_INVALIDPARAMS;
 2054+ if(!this) return DDERR_INVALIDOBJECT;
20452055 return glDDS7->IsLost();
20462056 }
20472057 HRESULT WINAPI glDirectDrawSurface4::Lock(LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
20482058 {
2049 - if(!this) return DDERR_INVALIDPARAMS;
 2059+ if(!this) return DDERR_INVALIDOBJECT;
20502060 return glDDS7->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent);
20512061 }
20522062 HRESULT WINAPI glDirectDrawSurface4::ReleaseDC(HDC hDC)
20532063 {
2054 - if(!this) return DDERR_INVALIDPARAMS;
 2064+ if(!this) return DDERR_INVALIDOBJECT;
20552065 return glDDS7->ReleaseDC(hDC);
20562066 }
20572067 HRESULT WINAPI glDirectDrawSurface4::Restore()
20582068 {
2059 - if(!this) return DDERR_INVALIDPARAMS;
 2069+ if(!this) return DDERR_INVALIDOBJECT;
20602070 return glDDS7->Restore();
20612071 }
20622072 HRESULT WINAPI glDirectDrawSurface4::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
20632073 {
2064 - if(!this) return DDERR_INVALIDPARAMS;
 2074+ if(!this) return DDERR_INVALIDOBJECT;
20652075 return glDDS7->SetClipper(lpDDClipper);
20662076 }
20672077 HRESULT WINAPI glDirectDrawSurface4::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
20682078 {
2069 - if(!this) return DDERR_INVALIDPARAMS;
 2079+ if(!this) return DDERR_INVALIDOBJECT;
20702080 return glDDS7->SetColorKey(dwFlags,lpDDColorKey);
20712081 }
20722082 HRESULT WINAPI glDirectDrawSurface4::SetOverlayPosition(LONG lX, LONG lY)
20732083 {
2074 - if(!this) return DDERR_INVALIDPARAMS;
 2084+ if(!this) return DDERR_INVALIDOBJECT;
20752085 return glDDS7->SetOverlayPosition(lX,lY);
20762086 }
20772087 HRESULT WINAPI glDirectDrawSurface4::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
20782088 {
2079 - if(!this) return DDERR_INVALIDPARAMS;
 2089+ if(!this) return DDERR_INVALIDOBJECT;
20802090 return glDDS7->SetPalette(lpDDPalette);
20812091 }
20822092 HRESULT WINAPI glDirectDrawSurface4::Unlock(LPRECT lpRect)
20832093 {
2084 - if(!this) return DDERR_INVALIDPARAMS;
 2094+ if(!this) return DDERR_INVALIDOBJECT;
20852095 return glDDS7->Unlock2(lpRect);
20862096 }
20872097 HRESULT WINAPI glDirectDrawSurface4::UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE4 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx)
20882098 {
2089 - if(!this) return DDERR_INVALIDPARAMS;
 2099+ if(!this) return DDERR_INVALIDOBJECT;
20902100 return glDDS7->UpdateOverlay(lpSrcRect,(LPDIRECTDRAWSURFACE7)lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFx);
20912101 }
20922102 HRESULT WINAPI glDirectDrawSurface4::UpdateOverlayDisplay(DWORD dwFlags)
20932103 {
2094 - if(!this) return DDERR_INVALIDPARAMS;
 2104+ if(!this) return DDERR_INVALIDOBJECT;
20952105 return glDDS7->UpdateOverlayDisplay(dwFlags);
20962106 }
20972107 HRESULT WINAPI glDirectDrawSurface4::UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSReference)
20982108 {
2099 - if(!this) return DDERR_INVALIDPARAMS;
 2109+ if(!this) return DDERR_INVALIDOBJECT;
21002110 return glDDS7->UpdateOverlayZOrder(dwFlags,(LPDIRECTDRAWSURFACE7)lpDDSReference);
21012111 }
21022112 HRESULT WINAPI glDirectDrawSurface4::GetDDInterface(LPVOID FAR *lplpDD)
21032113 {
2104 - if(!this) return DDERR_INVALIDPARAMS;
 2114+ if(!this) return DDERR_INVALIDOBJECT;
21052115 return glDDS7->GetDDInterface(lplpDD);
21062116 }
21072117 HRESULT WINAPI glDirectDrawSurface4::PageLock(DWORD dwFlags)
21082118 {
2109 - if(!this) return DDERR_INVALIDPARAMS;
 2119+ if(!this) return DDERR_INVALIDOBJECT;
21102120 return glDDS7->PageLock(dwFlags);
21112121 }
21122122 HRESULT WINAPI glDirectDrawSurface4::PageUnlock(DWORD dwFlags)
21132123 {
2114 - if(!this) return DDERR_INVALIDPARAMS;
 2124+ if(!this) return DDERR_INVALIDOBJECT;
21152125 return glDDS7->PageUnlock(dwFlags);
21162126 }
21172127 HRESULT WINAPI glDirectDrawSurface4::SetSurfaceDesc(LPDDSURFACEDESC2 lpddsd, DWORD dwFlags)
21182128 {
2119 - if(!this) return DDERR_INVALIDPARAMS;
 2129+ if(!this) return DDERR_INVALIDOBJECT;
21202130 return glDDS7->SetSurfaceDesc(lpddsd,dwFlags);
21212131 }
21222132 HRESULT WINAPI glDirectDrawSurface4::SetPrivateData(REFGUID guidTag, LPVOID lpData, DWORD cbSize, DWORD dwFlags)
21232133 {
2124 - if(!this) return DDERR_INVALIDPARAMS;
 2134+ if(!this) return DDERR_INVALIDOBJECT;
21252135 return glDDS7->SetPrivateData(guidTag,lpData,cbSize,dwFlags);
21262136 }
21272137 HRESULT WINAPI glDirectDrawSurface4::GetPrivateData(REFGUID guidTag, LPVOID lpBuffer, LPDWORD lpcbBufferSize)
21282138 {
2129 - if(!this) return DDERR_INVALIDPARAMS;
 2139+ if(!this) return DDERR_INVALIDOBJECT;
21302140 return glDDS7->GetPrivateData(guidTag,lpBuffer,lpcbBufferSize);
21312141 }
21322142 HRESULT WINAPI glDirectDrawSurface4::FreePrivateData(REFGUID guidTag)
21332143 {
2134 - if(!this) return DDERR_INVALIDPARAMS;
 2144+ if(!this) return DDERR_INVALIDOBJECT;
21352145 return glDDS7->FreePrivateData(guidTag);
21362146 }
21372147 HRESULT WINAPI glDirectDrawSurface4::GetUniquenessValue(LPDWORD lpValue)
21382148 {
2139 - if(!this) return DDERR_INVALIDPARAMS;
 2149+ if(!this) return DDERR_INVALIDOBJECT;
21402150 return glDDS7->GetUniquenessValue(lpValue);
21412151 }
21422152 HRESULT WINAPI glDirectDrawSurface4::ChangeUniquenessValue()
21432153 {
2144 - if(!this) return DDERR_INVALIDPARAMS;
 2154+ if(!this) return DDERR_INVALIDOBJECT;
21452155 return glDDS7->ChangeUniquenessValue();
21462156 }