comcat work
Aric Stewart
aric at codeweavers.com
Thu Jul 13 14:16:59 CDT 2006
Here are 2 patches, the first is resending my handing of -1 in
EnumClassesOfCategories, the second patch is a test case for the first
patch.
-aric
-------------- next part --------------
>From nobody Mon Sep 17 00:00:00 2001
From: Aric Stewart <aric at yomiko.localdomain>
Date: Wed Jun 28 14:39:38 2006 -0500
Subject: [PATCH] cImplemented or cRequired of -1 means to match everyting regardless of the
---
dlls/comcat/information.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
3ec25e04835eb7d3ebc0ca73dd599756b3663987
diff --git a/dlls/comcat/information.c b/dlls/comcat/information.c
index 0b84296..90d14ec 100644
--- a/dlls/comcat/information.c
+++ b/dlls/comcat/information.c
@@ -163,6 +163,11 @@ static HRESULT WINAPI COMCAT_ICatInforma
TRACE("\n");
+ if (cImplemented == (ULONG)-1)
+ cImplemented = 0;
+ if (cRequired == (ULONG)-1)
+ cRequired = 0;
+
if (iface == NULL || ppenumCLSID == NULL ||
(cImplemented && rgcatidImpl == NULL) ||
(cRequired && rgcatidReq == NULL)) return E_POINTER;
--
1.2.4
-------------- next part --------------
>From nobody Mon Sep 17 00:00:00 2001
From: Aric Stewart <aric at codeweavers.com>
Date: Thu Jul 13 14:16:00 2006 -0500
Subject: [PATCH] a test for comcat
---
configure.ac | 1
dlls/comcat/Makefile.in | 2 +
dlls/comcat/tests/Makefile.in | 14 ++++
dlls/comcat/tests/comcat.c | 129 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 146 insertions(+), 0 deletions(-)
create mode 100644 dlls/comcat/tests/Makefile.in
create mode 100644 dlls/comcat/tests/comcat.c
e41284b6815a61b3ad399eb365717daad7613c76
diff --git a/configure.ac b/configure.ac
index e69b4b5..f6b6a5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1565,6 +1565,7 @@ dlls/capi2032/Makefile
dlls/cards/Makefile
dlls/cfgmgr32/Makefile
dlls/comcat/Makefile
+dlls/comcat/tests/Makefile
dlls/comctl32/Makefile
dlls/comctl32/tests/Makefile
dlls/comdlg32/Makefile
diff --git a/dlls/comcat/Makefile.in b/dlls/comcat/Makefile.in
index 37689c5..6feb74e 100644
--- a/dlls/comcat/Makefile.in
+++ b/dlls/comcat/Makefile.in
@@ -17,6 +17,8 @@ C_SRCS = \
RC_SRCS = \
version.rc
+SUBDIRS = tests
+
@MAKE_DLL_RULES@
### Dependencies:
diff --git a/dlls/comcat/tests/Makefile.in b/dlls/comcat/tests/Makefile.in
new file mode 100644
index 0000000..0992e19
--- /dev/null
+++ b/dlls/comcat/tests/Makefile.in
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = comcat.dll
+IMPORTS = ole32 advapi32 kernel32
+EXTRALIBS = -luuid
+
+CTESTS = \
+ comcat.c
+
+ at MAKE_TEST_RULES@
+
+### Dependencies:
diff --git a/dlls/comcat/tests/comcat.c b/dlls/comcat/tests/comcat.c
new file mode 100644
index 0000000..67f694f
--- /dev/null
+++ b/dlls/comcat/tests/comcat.c
@@ -0,0 +1,129 @@
+/*
+ * tests for comcat functions
+ *
+ * Copyright 2006 Aric Stewart for CodeWeavers
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include <stdio.h>
+#include <windows.h>
+
+#include "objbase.h"
+#include "comcat.h"
+
+#include "wine/test.h"
+
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08lx \n", hr)
+
+void register_testentry()
+{
+ HKEY hkey,hkey2;
+
+ RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}",
+ &hkey);
+ RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
+ RegCreateKeyA(hkey,
+ "Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
+ &hkey2);
+
+ RegCloseKey(hkey);
+ RegCloseKey(hkey2);
+}
+
+void unregister_testentry()
+{
+ RegDeleteKeyA(HKEY_CLASSES_ROOT,
+ "CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}\\Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}");
+ RegDeleteKeyA(HKEY_CLASSES_ROOT,
+ "CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}\\Implemented Categories");
+ RegDeleteKeyA(HKEY_CLASSES_ROOT,
+ "CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}");
+}
+
+void do_enum()
+{
+ HRESULT hr;
+ REFCLSID rclsid = &CLSID_StdComponentCategoriesMgr;
+ ICatInformation *pICat = (ICatInformation*)0xdeadbeef;
+ GUID the_guid[1];
+ GUID the_cat[1];
+ GUID wanted_guid;
+ ULONG fetched = -1;
+
+ static const WCHAR szCatID[] = {
+ '{',
+ 'd','e','a','d','c','a','f','e',
+ '-','0','0','0','0','-','0','0','0','0',
+ '-','0','0','0','0',
+ '-','0','0','0','0','0','0','0','0','0','0','0','0',
+ '}',0};
+ static const WCHAR szGuid[] = {
+ '{',
+ 'd','e','a','d','c','a','f','e','-',
+ 'b','e','e','d','-',
+ 'b','e','a','d','-',
+ 'd','e','a','d','-',
+ 'c','a','f','e','b','e','a','d','d','e','a','d',
+ '}',0};
+
+ IEnumCLSID *pIEnum =(IEnumCLSID*)0xdeadcafe;
+
+ CLSIDFromString((LPOLESTR)szCatID,the_cat);
+ CLSIDFromString((LPOLESTR)szGuid,&wanted_guid);
+
+ OleInitialize(NULL);
+
+ hr = CoCreateInstance(rclsid,NULL,CLSCTX_INPROC_SERVER,
+ &IID_ICatInformation, (void **)&pICat);
+ ok_ole_success(hr, "CoCreateInstance");
+
+ hr = ICatInformation_EnumClassesOfCategories(pICat, -1, NULL, -1, NULL,
+ &pIEnum);
+ ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
+
+ IEnumGUID_Release(pIEnum);
+
+ hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL,
+ &pIEnum);
+ ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
+
+ hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
+ ok (fetched == 0,"Fetched wrong number of guids %lu\n",fetched);
+ IEnumGUID_Release(pIEnum);
+
+ register_testentry();
+ hr = ICatInformation_EnumClassesOfCategories(pICat, 1, the_cat, -1, NULL,
+ &pIEnum);
+ ok_ole_success(hr,"ICatInformation_EnumClassesOfCategories");
+
+ hr = IEnumGUID_Next(pIEnum,1,the_guid, &fetched);
+ ok (fetched == 1,"Fetched wrong number of guids %lu\n",fetched);
+ ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
+
+ IEnumGUID_Release(pIEnum);
+ ICatInformation_Release(pICat);
+ unregister_testentry();
+
+ OleUninitialize();
+}
+
+
+START_TEST(comcat)
+{
+ do_enum();
+}
--
1.2.4
More information about the wine-patches
mailing list