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);
}
add setupapi test for stringtable functions. At this time they only pass
on Ros and Windows 2000. I will fix the test to pass on later versions
of Windows soon.
Modified: trunk/reactos/regtests/winetests/directory.xml
Added: trunk/reactos/regtests/winetests/setupapi/
Added: trunk/reactos/regtests/winetests/setupapi/setupapi.xml
Added: trunk/reactos/regtests/winetests/setupapi/stringtable.c
Added: trunk/reactos/regtests/winetests/setupapi/testlist.c
_____
Modified: trunk/reactos/regtests/winetests/directory.xml
--- trunk/reactos/regtests/winetests/directory.xml 2005-08-08
14:54:24 UTC (rev 17202)
+++ trunk/reactos/regtests/winetests/directory.xml 2005-08-08
15:01:03 UTC (rev 17203)
@@ -20,6 +20,9 @@
<directory name="psapi">
<xi:include href="psapi/psapi.xml" />
</directory>
+<directory name="setupapi">
+ <xi:include href="setupapi/setupapi.xml" />
+</directory>
<directory name="shlwapi">
<xi:include href="shlwapi/shlwapi.xml" />
</directory>
_____
Added: trunk/reactos/regtests/winetests/setupapi/setupapi.xml
--- trunk/reactos/regtests/winetests/setupapi/setupapi.xml
2005-08-08 14:54:24 UTC (rev 17202)
+++ trunk/reactos/regtests/winetests/setupapi/setupapi.xml
2005-08-08 15:01:03 UTC (rev 17203)
@@ -0,0 +1,8 @@
+<module name="setupapi_winetest" type="win32cui" installbase="bin"
installname="setupapi_winetest.exe" warnings="true">
+ <include base="setupapi_winetest">.</include>
+ <define name="__USE_W32API" />
+ <library>ntdll</library>
+ <library>setupapi</library>
+ <file>testlist.c</file>
+ <file>stringtable.c</file>
+</module>
_____
Added: trunk/reactos/regtests/winetests/setupapi/stringtable.c
--- trunk/reactos/regtests/winetests/setupapi/stringtable.c
2005-08-08 14:54:24 UTC (rev 17202)
+++ trunk/reactos/regtests/winetests/setupapi/stringtable.c
2005-08-08 15:01:03 UTC (rev 17203)
@@ -0,0 +1,97 @@
+/*
+ * Unit test suite for StringTable functions
+ *
+ * Copyright 2005 Steven Edwards for ReactOS
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+/* TODO:
+ * Add case sensitivity test for
StringTableAddString/StringTableLookupString
+ * Add test for StringTableStringFromIdEx
+ *
+ * BUGS:
+ * These functions are undocumented and exported under another name on
+ * Windows XP and Windows Server 2003. This test assumes the Windows
2000
+ * implementation.
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "setupapi.h"
+
+#include "wine/test.h"
+
+HANDLE table, table2; /* Handles pointing to our tables */
+static WCHAR string[] = {'s','t','r','i','n','g',0};
+
+static void test_StringTableInitialize()
+{
+ table=StringTableInitialize();
+ ok(table!=NULL,"Failed to Initialize String Table\n");
+}
+
+static void test_StringTableAddString()
+{
+ DWORD retval;
+
+ retval=StringTableAddString(table,string,0);
+ ok(retval!=-1,"Failed to add string to String Table\n");
+}
+
+static void test_StringTableDuplicate()
+{
+ table2=StringTableDuplicate(table);
+ ok(table2!=NULL,"Failed to duplicate String Table\n");
+}
+
+static void test_StringTableLookUpString()
+{
+ DWORD retval, retval2;
+
+ retval=StringTableLookUpString(table,string,0);
+ ok(retval!=-1,"Failed find string in String Table 1\n");
+
+ retval2=StringTableLookUpString(table2,string,0);
+ ok(retval2!=-1,"Failed find string in String Table 2\n");
+}
+
+static void test_StringTableStringFromId()
+{
+ WCHAR *string2;
+ int result;
+
+ string2=StringTableStringFromId(table,0);
+ ok(string2!=NULL,"Failed to look up string by ID from String
Table\n");
+
+ result=lstrcmpiW(string, string2);
+ ok(result==0,"String %p does not match requested StringID
%p\n",string,string2);
+}
+
+START_TEST(stringtable)
+{
+ test_StringTableInitialize();
+ test_StringTableAddString();
+ test_StringTableDuplicate();
+ test_StringTableLookUpString();
+ test_StringTableStringFromId();
+
+ /* Cleanup */
+ StringTableDestroy(table);
+}
Property changes on:
trunk/reactos/regtests/winetests/setupapi/stringtable.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: trunk/reactos/regtests/winetests/setupapi/testlist.c
--- trunk/reactos/regtests/winetests/setupapi/testlist.c
2005-08-08 14:54:24 UTC (rev 17202)
+++ trunk/reactos/regtests/winetests/setupapi/testlist.c
2005-08-08 15:01:03 UTC (rev 17203)
@@ -0,0 +1,25 @@
+/* Automatically generated file; DO NOT EDIT!! */
+
+/* stdarg.h is needed for Winelib */
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "windef.h"
+#include "winbase.h"
+
+extern void func_stringtable(void);
+
+struct test
+{
+ const char *name;
+ void (*func)(void);
+};
+
+static const struct test winetest_testlist[] =
+{
+ { "stringtable", func_stringtable },
+ { 0, 0 }
+};
+
+#define WINETEST_WANT_MAIN
+#include "wine/test.h"
Property changes on:
trunk/reactos/regtests/winetests/setupapi/testlist.c
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native