2007-11-29 12:54:54 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2013-09-14 19:00:31 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2007-11-29 12:54:54 +00:00
|
|
|
|
2013-09-14 19:00:31 +00:00
|
|
|
#define COBJMACROS
|
2007-11-29 12:54:54 +00:00
|
|
|
|
2013-09-14 19:00:31 +00:00
|
|
|
#include <wine/test.h>
|
2007-11-29 12:54:54 +00:00
|
|
|
|
2013-09-14 19:00:31 +00:00
|
|
|
//#include <stdio.h>
|
|
|
|
//#include <initguid.h>
|
|
|
|
//#include <windows.h>
|
|
|
|
#include <winreg.h>
|
|
|
|
//#include "objbase.h"
|
|
|
|
#include <ole2.h>
|
|
|
|
#include <comcat.h>
|
2007-11-29 12:54:54 +00:00
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
|
2007-11-29 12:54:54 +00:00
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
static BOOL register_testentry(void)
|
2007-11-29 12:54:54 +00:00
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
HKEY hkey = 0, hkey2 = 0;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
ret = RegCreateKeyA(HKEY_CLASSES_ROOT,"CLSID\\{deadcafe-beed-bead-dead-cafebeaddead}", &hkey);
|
|
|
|
if (!ret) ret = RegSetValueA(hkey,NULL,REG_SZ,"ComCat Test key",16);
|
|
|
|
if (!ret) ret = RegCreateKeyA(hkey,
|
|
|
|
"Implemented Categories\\{deadcafe-0000-0000-0000-000000000000}",
|
|
|
|
&hkey2);
|
2007-11-29 12:54:54 +00:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
RegCloseKey(hkey2);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
return !ret;
|
2007-11-29 12:54:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void unregister_testentry(void)
|
|
|
|
{
|
|
|
|
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}");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void do_enum(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
REFCLSID rclsid = &CLSID_StdComponentCategoriesMgr;
|
|
|
|
ICatInformation *pICat = (ICatInformation*)0xdeadbeef;
|
|
|
|
GUID the_guid[1];
|
|
|
|
GUID the_cat[1];
|
|
|
|
GUID wanted_guid;
|
|
|
|
ULONG fetched = -1;
|
2014-04-30 12:01:03 +00:00
|
|
|
|
|
|
|
static const WCHAR szCatID[] = {
|
2007-11-29 12:54:54 +00:00
|
|
|
'{',
|
|
|
|
'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};
|
2014-04-30 12:01:03 +00:00
|
|
|
static const WCHAR szGuid[] = {
|
2007-11-29 12:54:54 +00:00
|
|
|
'{',
|
|
|
|
'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;
|
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
CLSIDFromString(szCatID,the_cat);
|
|
|
|
CLSIDFromString(szGuid,&wanted_guid);
|
|
|
|
|
2007-11-29 12:54:54 +00:00
|
|
|
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);
|
2012-01-23 16:04:06 +00:00
|
|
|
ok (hr == S_FALSE,"Expected S_FALSE, got 0x%08x\n", hr);
|
2007-11-29 12:54:54 +00:00
|
|
|
ok (fetched == 0,"Fetched wrong number of guids %u\n",fetched);
|
|
|
|
IEnumGUID_Release(pIEnum);
|
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
if (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);
|
2012-01-23 16:04:06 +00:00
|
|
|
ok (hr == S_OK,"Expected S_OK, got 0x%08x\n", hr);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
ok (fetched == 1,"Fetched wrong number of guids %u\n",fetched);
|
|
|
|
ok (IsEqualGUID(the_guid,&wanted_guid),"Guids do not match\n");
|
|
|
|
|
|
|
|
IEnumGUID_Release(pIEnum);
|
|
|
|
unregister_testentry();
|
|
|
|
}
|
|
|
|
else skip( "Could not register the test category\n" );
|
2007-11-29 12:54:54 +00:00
|
|
|
|
|
|
|
ICatInformation_Release(pICat);
|
|
|
|
|
|
|
|
OleUninitialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
START_TEST(comcat)
|
|
|
|
{
|
|
|
|
do_enum();
|
|
|
|
}
|