Fix some error checking for DireactDrawCreate and DireactDrawCreateEx,
we checking if the param is right or not.
Modified: trunk/reactos/lib/ddraw/main.c
_____
Modified: trunk/reactos/lib/ddraw/main.c
--- trunk/reactos/lib/ddraw/main.c 2005-08-08 15:39:35 UTC (rev
17205)
+++ trunk/reactos/lib/ddraw/main.c 2005-08-08 15:41:02 UTC (rev
17206)
@@ -15,10 +15,7 @@
HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
IUnknown* pUnkOuter, BOOL ex)
-{
- if (pUnkOuter!=NULL)
- return DDERR_INVALIDPARAMS;
-
+{
IDirectDrawImpl* This =
(IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IDirectDrawImpl));
if (This == NULL)
@@ -32,15 +29,33 @@
}
HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD,
LPUNKNOWN pUnkOuter)
-{
+{
+
+ /* check see if pUnkOuter is null or not */
+ if (!pUnkOuter)
+ {
+ /* we do not use same error code as MS, ms use 0x8004110
*/
+ return DDERR_INVALIDPARAMS;
+ }
+
return Create_DirectDraw (lpGUID, lplpDD, pUnkOuter, FALSE);
}
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID
iid, LPUNKNOWN pUnkOuter)
-{
+{
+ /* check see if pUnkOuter is null or not */
+ if (!pUnkOuter)
+ {
+ /* we do not use same error code as MS, ms use 0x8004110
*/
+ return DDERR_INVALIDPARAMS;
+ }
+
+ /* Is it a DirectDraw 7 Request or not */
if (!IsEqualGUID(iid, &IID_IDirectDraw7))
- return DDERR_INVALIDPARAMS;
-
+ {
+ return DDERR_INVALIDPARAMS;
+ }
+
return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, pUnkOuter,
TRUE);
}