Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/atl110/tests/atl.c
4393 views
1
/*
2
* Copyright 2022 Zhiyi Zhang for CodeWeavers
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17
*/
18
19
#include <stdarg.h>
20
#include <stdio.h>
21
22
#define COBJMACROS
23
#define CONST_VTABLE
24
25
#include <windef.h>
26
#include <winbase.h>
27
#include <winuser.h>
28
#include <atlbase.h>
29
30
#include <wine/test.h>
31
32
static void test_AtlComModuleGetClassObject(void)
33
{
34
_ATL_OBJMAP_ENTRY_EX *null_entry = NULL;
35
_ATL_COM_MODULE module;
36
HRESULT hr;
37
void *ret;
38
39
/* Test NULL module */
40
hr = AtlComModuleGetClassObject(NULL, &GUID_NULL, &IID_NULL, &ret);
41
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
42
43
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
44
module.cbSize = sizeof(module);
45
module.m_ppAutoObjMapFirst = NULL;
46
module.m_ppAutoObjMapLast = NULL;
47
hr = AtlComModuleGetClassObject(&module, &GUID_NULL, &IID_NULL, &ret);
48
ok(hr == CLASS_E_CLASSNOTAVAILABLE, "Unexpected hr %#lx.\n", hr);
49
50
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
51
module.cbSize = sizeof(module);
52
module.m_ppAutoObjMapFirst = &null_entry;
53
module.m_ppAutoObjMapLast = &null_entry;
54
hr = AtlComModuleGetClassObject(&module, &GUID_NULL, &IID_NULL, &ret);
55
ok(hr == CLASS_E_CLASSNOTAVAILABLE, "Unexpected hr %#lx.\n", hr);
56
}
57
58
static void test_AtlComModuleRegisterClassObjects(void)
59
{
60
_ATL_OBJMAP_ENTRY_EX *null_entry = NULL;
61
_ATL_COM_MODULE module;
62
HRESULT hr;
63
64
/* Test NULL module */
65
hr = AtlComModuleRegisterClassObjects(NULL, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE);
66
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
67
68
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
69
module.cbSize = sizeof(module);
70
module.m_ppAutoObjMapFirst = NULL;
71
module.m_ppAutoObjMapLast = NULL;
72
hr = AtlComModuleRegisterClassObjects(&module, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE);
73
todo_wine_if(hr == S_OK)
74
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
75
76
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
77
module.cbSize = sizeof(module);
78
module.m_ppAutoObjMapFirst = &null_entry;
79
module.m_ppAutoObjMapLast = &null_entry;
80
hr = AtlComModuleRegisterClassObjects(&module, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE);
81
todo_wine_if(hr == S_OK)
82
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
83
}
84
85
static void test_AtlComModuleRevokeClassObjects(void)
86
{
87
_ATL_OBJMAP_ENTRY_EX *null_entry = NULL;
88
_ATL_COM_MODULE module;
89
HRESULT hr;
90
91
/* Test NULL module */
92
hr = AtlComModuleRevokeClassObjects(NULL);
93
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
94
95
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
96
module.cbSize = sizeof(module);
97
module.m_ppAutoObjMapFirst = NULL;
98
module.m_ppAutoObjMapLast = NULL;
99
hr = AtlComModuleRevokeClassObjects(&module);
100
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
101
102
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
103
module.cbSize = sizeof(module);
104
module.m_ppAutoObjMapFirst = &null_entry;
105
module.m_ppAutoObjMapLast = &null_entry;
106
hr = AtlComModuleRevokeClassObjects(&module);
107
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
108
}
109
110
START_TEST(atl)
111
{
112
CoInitialize(NULL);
113
114
test_AtlComModuleGetClassObject();
115
test_AtlComModuleRegisterClassObjects();
116
test_AtlComModuleRevokeClassObjects();
117
118
CoUninitialize();
119
}
120
121