Assorted spelling fixes & co.
[wine] / dlls / quartz / tests / filtermapper.c
1 /*
2  * Filtermapper unit tests for Quartz
3  *
4  * Copyright (C) 2008 Alexander Dorofeyev
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #define COBJMACROS
22
23 #include "wine/test.h"
24 #include "winbase.h"
25 #include "initguid.h"
26 #include "dshow.h"
27
28 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
29
30 /* Helper function, checks if filter with given name was enumerated. */
31 static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
32 {
33     IMoniker *pMoniker = NULL;
34     BOOL found = FALSE;
35     ULONG nb;
36     HRESULT hr;
37     static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
38
39     while(!found && IEnumMoniker_Next(pEnum, 1, &pMoniker, &nb) == S_OK)
40     {
41         IPropertyBag * pPropBagCat = NULL;
42         VARIANT var;
43
44         VariantInit(&var);
45
46         hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
47         ok(SUCCEEDED(hr), "IMoniker_BindToStorage failed with %x\n", hr);
48         if (FAILED(hr) || !pPropBagCat)
49         {
50             VariantClear(&var);
51             IMoniker_Release(pMoniker);
52             continue;
53         }
54
55         hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, &var, NULL);
56         ok(SUCCEEDED(hr), "IPropertyBag_Read failed with %x\n", hr);
57
58         if (SUCCEEDED(hr))
59         {
60             CHAR val1[512], val2[512];
61
62             WideCharToMultiByte(CP_ACP, 0, V_UNION(&var, bstrVal), -1, val1, sizeof(val1), 0, 0);
63             WideCharToMultiByte(CP_ACP, 0, wszFilterName, -1, val2, sizeof(val2), 0, 0);
64             if (!lstrcmpA(val1, val2)) found = TRUE;
65         }
66
67         IPropertyBag_Release(pPropBagCat);
68         IMoniker_Release(pMoniker);
69         VariantClear(&var);
70     }
71
72     return found;
73 }
74
75 static void test_fm2_enummatchingfilters(void)
76 {
77     IFilterMapper2 *pMapper = NULL;
78     HRESULT hr;
79     REGFILTER2 rgf2;
80     REGFILTERPINS2 rgPins2[2];
81     REGPINTYPES rgPinType;
82     static const WCHAR wszFilterName1[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '1', 0 };
83     static const WCHAR wszFilterName2[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '2', 0 };
84     CLSID clsidFilter1;
85     CLSID clsidFilter2;
86     IEnumMoniker *pEnum = NULL;
87     BOOL found;
88
89     ZeroMemory(&rgf2, sizeof(rgf2));
90
91     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
92             &IID_IFilterMapper2, (LPVOID*)&pMapper);
93     ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
94     if (FAILED(hr)) goto out;
95
96     hr = CoCreateGuid(&clsidFilter1);
97     ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
98     hr = CoCreateGuid(&clsidFilter2);
99     ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
100
101     /* Test that a test renderer filter is returned when enumerating filters with bRender=FALSE */
102     rgf2.dwVersion = 2;
103     rgf2.dwMerit = MERIT_UNLIKELY;
104     S1(U(rgf2)).cPins2 = 1;
105     S1(U(rgf2)).rgPins2 = rgPins2;
106
107     rgPins2[0].dwFlags = REG_PINFLAG_B_RENDERER;
108     rgPins2[0].cInstances = 1;
109     rgPins2[0].nMediaTypes = 1;
110     rgPins2[0].lpMediaType = &rgPinType;
111     rgPins2[0].nMediums = 0;
112     rgPins2[0].lpMedium = NULL;
113     rgPins2[0].clsPinCategory = NULL;
114
115     rgPinType.clsMajorType = &GUID_NULL;
116     rgPinType.clsMinorType = &GUID_NULL;
117
118     hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1, NULL,
119                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
120     if (hr == E_ACCESSDENIED)
121         skip("Not authorized to register filters\n");
122     else
123     {
124         ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
125
126         rgPins2[0].dwFlags = 0;
127
128         rgPins2[1].dwFlags = REG_PINFLAG_B_OUTPUT;
129         rgPins2[1].cInstances = 1;
130         rgPins2[1].nMediaTypes = 1;
131         rgPins2[1].lpMediaType = &rgPinType;
132         rgPins2[1].nMediums = 0;
133         rgPins2[1].lpMedium = NULL;
134         rgPins2[1].clsPinCategory = NULL;
135
136         S1(U(rgf2)).cPins2 = 2;
137
138         hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2, NULL,
139                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
140         ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
141
142         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
143                 0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
144         ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
145         if (SUCCEEDED(hr) && pEnum)
146         {
147             found = enum_find_filter(wszFilterName1, pEnum);
148             ok(found, "EnumMatchingFilters failed to return the test filter 1\n");
149         }
150
151         if (pEnum) IEnumMoniker_Release(pEnum);
152         pEnum = NULL;
153
154         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
155                 0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
156         ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
157         if (SUCCEEDED(hr) && pEnum)
158         {
159             found = enum_find_filter(wszFilterName2, pEnum);
160             ok(found, "EnumMatchingFilters failed to return the test filter 2\n");
161         }
162
163         if (pEnum) IEnumMoniker_Release(pEnum);
164         pEnum = NULL;
165
166         /* Non renderer must not be returned with bRender=TRUE */
167
168         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
169                 0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
170         ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
171
172         if (SUCCEEDED(hr) && pEnum)
173         {
174             found = enum_find_filter(wszFilterName1, pEnum);
175             ok(found, "EnumMatchingFilters failed to return the test filter 1\n");
176         }
177     }
178
179     if (pEnum) IEnumMoniker_Release(pEnum);
180     pEnum = NULL;
181
182     hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
183                 0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
184     ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
185
186     if (SUCCEEDED(hr) && pEnum)
187     {
188         found = enum_find_filter(wszFilterName2, pEnum);
189         ok(!found, "EnumMatchingFilters should not return the test filter 2\n");
190     }
191
192     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
193             &clsidFilter1);
194     ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
195
196     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
197             &clsidFilter2);
198     ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
199
200     out:
201
202     if (pEnum) IEnumMoniker_Release(pEnum);
203     if (pMapper) IFilterMapper2_Release(pMapper);
204 }
205
206 static void test_legacy_filter_registration(void)
207 {
208     IFilterMapper2 *pMapper2 = NULL;
209     IFilterMapper *pMapper = NULL;
210     HRESULT hr;
211     static const WCHAR wszFilterName[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', 0 };
212     static const CHAR szFilterName[] = "Testfilter";
213     static const WCHAR wszPinName[] = {'P', 'i', 'n', '1', 0 };
214     CLSID clsidFilter;
215     CHAR szRegKey[MAX_PATH];
216     static const CHAR szClsid[] = "CLSID";
217     WCHAR wszGuidstring[MAX_PATH];
218     CHAR szGuidstring[MAX_PATH];
219     LONG lRet;
220     HKEY hKey = NULL;
221     IEnumMoniker *pEnum = NULL;
222     BOOL found;
223     IEnumRegFilters *pRegEnum = NULL;
224
225     /* Test if legacy filter registration scheme works (filter is added to HKCR\Filter). IFilterMapper_RegisterFilter
226      * registers in this way. Filters so registered must then be accessible through both IFilterMapper_EnumMatchingFilters
227      * and IFilterMapper2_EnumMatchingFilters. */
228     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
229             &IID_IFilterMapper2, (LPVOID*)&pMapper2);
230     ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
231     if (FAILED(hr)) goto out;
232
233     hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterMapper, (LPVOID)&pMapper);
234     ok(hr == S_OK, "IFilterMapper2_QueryInterface failed with %x\n", hr);
235     if (FAILED(hr)) goto out;
236
237     /* Register a test filter. */
238     hr = CoCreateGuid(&clsidFilter);
239     ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
240
241     lRet = StringFromGUID2(&clsidFilter, wszGuidstring, MAX_PATH);
242     ok(lRet > 0, "StringFromGUID2 failed\n");
243     if (!lRet) goto out;
244     WideCharToMultiByte(CP_ACP, 0, wszGuidstring, -1, szGuidstring, MAX_PATH, 0, 0);
245
246     lstrcpyA(szRegKey, szClsid);
247     lstrcatA(szRegKey, "\\");
248     lstrcatA(szRegKey, szGuidstring);
249
250     /* Register---- functions need a filter class key to write pin and pin media type data to. Create a bogus
251      * class key for it. */
252     lRet = RegCreateKeyExA(HKEY_CLASSES_ROOT, szRegKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
253     if (lRet == ERROR_ACCESS_DENIED)
254         skip("Not authorized to register filters\n");
255     else
256     {
257         ok(lRet == ERROR_SUCCESS, "RegCreateKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
258
259         /* Set default value - this is interpreted as "friendly name" later. */
260         lRet = RegSetValueExA(hKey, NULL, 0, REG_SZ, (LPBYTE)szFilterName, lstrlenA(szFilterName) + 1);
261         ok(lRet == ERROR_SUCCESS, "RegSetValueExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
262
263         if (hKey) RegCloseKey(hKey);
264         hKey = NULL;
265
266         hr = IFilterMapper_RegisterFilter(pMapper, clsidFilter, wszFilterName, MERIT_UNLIKELY);
267         ok(hr == S_OK, "IFilterMapper_RegisterFilter failed with %x\n", hr);
268
269         hr = IFilterMapper_RegisterPin(pMapper, clsidFilter, wszPinName, TRUE, FALSE, FALSE, FALSE, GUID_NULL, NULL);
270         ok(hr == S_OK, "IFilterMapper_RegisterPin failed with %x\n", hr);
271
272         hr = IFilterMapper_RegisterPinType(pMapper, clsidFilter, wszPinName, GUID_NULL, GUID_NULL);
273         ok(hr == S_OK, "IFilterMapper_RegisterPinType failed with %x\n", hr);
274
275         hr = IFilterMapper2_EnumMatchingFilters(pMapper2, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
276                 0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
277         ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
278         if (SUCCEEDED(hr) && pEnum)
279         {
280             found = enum_find_filter(wszFilterName, pEnum);
281             ok(found, "IFilterMapper2_EnumMatchingFilters failed to return the test filter\n");
282         }
283
284         if (pEnum) IEnumMoniker_Release(pEnum);
285         pEnum = NULL;
286
287         found = FALSE;
288         hr = IFilterMapper_EnumMatchingFilters(pMapper, &pRegEnum, MERIT_UNLIKELY, TRUE, GUID_NULL, GUID_NULL,
289             FALSE, FALSE, GUID_NULL, GUID_NULL);
290         ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed with %x\n", hr);
291         if (SUCCEEDED(hr) && pRegEnum)
292         {
293             ULONG cFetched;
294             REGFILTER *prgf;
295
296             while(!found && IEnumRegFilters_Next(pRegEnum, 1, &prgf, &cFetched) == S_OK)
297             {
298                 CHAR val[512];
299
300                 WideCharToMultiByte(CP_ACP, 0, prgf->Name, -1, val, sizeof(val), 0, 0);
301                 if (!lstrcmpA(val, szFilterName)) found = TRUE;
302
303                 CoTaskMemFree(prgf);
304             }
305
306             IEnumRegFilters_Release(pRegEnum);
307         }
308         ok(found, "IFilterMapper_EnumMatchingFilters failed to return the test filter\n");
309
310         hr = IFilterMapper_UnregisterFilter(pMapper, clsidFilter);
311         ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
312
313         lRet = RegOpenKeyExA(HKEY_CLASSES_ROOT, szClsid, 0, KEY_WRITE | DELETE, &hKey);
314         ok(lRet == ERROR_SUCCESS, "RegOpenKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
315
316         lRet = RegDeleteKeyA(hKey, szGuidstring);
317         ok(lRet == ERROR_SUCCESS, "RegDeleteKeyA failed with %x\n", HRESULT_FROM_WIN32(lRet));
318     }
319
320     if (hKey) RegCloseKey(hKey);
321     hKey = NULL;
322
323     out:
324
325     if (pMapper) IFilterMapper_Release(pMapper);
326     if (pMapper2) IFilterMapper2_Release(pMapper2);
327 }
328
329 static ULONG getRefcount(IUnknown *iface)
330 {
331     IUnknown_AddRef(iface);
332     return IUnknown_Release(iface);
333 }
334
335 static void test_ifiltermapper_from_filtergraph(void)
336 {
337     IFilterGraph2* pgraph2 = NULL;
338     IFilterMapper2 *pMapper2 = NULL;
339     IFilterGraph *filtergraph = NULL;
340     HRESULT hr;
341     ULONG refcount;
342
343     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2);
344     ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
345     if (!pgraph2) goto out;
346
347     hr = IFilterGraph2_QueryInterface(pgraph2, &IID_IFilterMapper2, (LPVOID*)&pMapper2);
348     ok(hr == S_OK, "IFilterGraph2_QueryInterface failed with %08x\n", hr);
349     if (!pMapper2) goto out;
350
351     refcount = getRefcount((IUnknown*)pgraph2);
352     ok(refcount == 2, "unexpected reference count: %u\n", refcount);
353     refcount = getRefcount((IUnknown*)pMapper2);
354     ok(refcount == 2, "unexpected reference count: %u\n", refcount);
355
356     IFilterMapper2_AddRef(pMapper2);
357     refcount = getRefcount((IUnknown*)pgraph2);
358     ok(refcount == 3, "unexpected reference count: %u\n", refcount);
359     refcount = getRefcount((IUnknown*)pMapper2);
360     ok(refcount == 3, "unexpected reference count: %u\n", refcount);
361     IFilterMapper2_Release(pMapper2);
362
363     hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (LPVOID*)&filtergraph);
364     ok(hr == S_OK, "IFilterMapper2_QueryInterface failed with %08x\n", hr);
365     if (!filtergraph) goto out;
366
367     IFilterMapper2_Release(pMapper2);
368     pMapper2 = NULL;
369     IFilterGraph_Release(filtergraph);
370     filtergraph = NULL;
371
372     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pMapper2);
373     ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
374     if (!pMapper2) goto out;
375
376     hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (LPVOID*)&filtergraph);
377     ok(hr == E_NOINTERFACE, "IFilterMapper2_QueryInterface unexpected result: %08x\n", hr);
378
379     out:
380
381     if (pMapper2) IFilterMapper2_Release(pMapper2);
382     if (filtergraph) IFilterGraph_Release(filtergraph);
383     if (pgraph2) IFilterGraph2_Release(pgraph2);
384 }
385
386 static void test_register_filter_with_null_clsMinorType(void)
387 {
388     IFilterMapper2 *pMapper = NULL;
389     HRESULT hr;
390     REGFILTER2 rgf2;
391     REGFILTERPINS rgPins;
392     REGFILTERPINS2 rgPins2;
393     REGPINTYPES rgPinType;
394     static WCHAR wszPinName[] = {'P', 'i', 'n', 0 };
395     static const WCHAR wszFilterName1[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '1', 0 };
396     static const WCHAR wszFilterName2[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '2', 0 };
397     CLSID clsidFilter1;
398     CLSID clsidFilter2;
399
400     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
401             &IID_IFilterMapper2, (LPVOID*)&pMapper);
402     ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
403     if (FAILED(hr)) goto out;
404
405     hr = CoCreateGuid(&clsidFilter1);
406     ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
407     hr = CoCreateGuid(&clsidFilter2);
408     ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
409
410     rgPinType.clsMajorType = &GUID_NULL;
411     /* Make sure quartz accepts it without crashing */
412     rgPinType.clsMinorType = NULL;
413
414     /* Test with pin descript version 1 */
415     ZeroMemory(&rgf2, sizeof(rgf2));
416     rgf2.dwVersion = 1;
417     rgf2.dwMerit = MERIT_UNLIKELY;
418     S(U(rgf2)).cPins = 1;
419     S(U(rgf2)).rgPins = &rgPins;
420
421     rgPins.strName = wszPinName;
422     rgPins.bRendered = 1;
423     rgPins.bOutput = 0;
424     rgPins.bZero = 0;
425     rgPins.bMany = 0;
426     rgPins.clsConnectsToFilter = NULL;
427     rgPins.strConnectsToPin = NULL;
428     rgPins.nMediaTypes = 1;
429     rgPins.lpMediaType = &rgPinType;
430
431     hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1, NULL,
432                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
433     if (hr == E_ACCESSDENIED)
434     {
435         skip("Not authorized to register filters\n");
436         goto out;
437     }
438     ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
439
440     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter1);
441     ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
442
443     /* Test with pin descript version 2 */
444     ZeroMemory(&rgf2, sizeof(rgf2));
445     rgf2.dwVersion = 2;
446     rgf2.dwMerit = MERIT_UNLIKELY;
447     S1(U(rgf2)).cPins2 = 1;
448     S1(U(rgf2)).rgPins2 = &rgPins2;
449
450     rgPins2.dwFlags = REG_PINFLAG_B_RENDERER;
451     rgPins2.cInstances = 1;
452     rgPins2.nMediaTypes = 1;
453     rgPins2.lpMediaType = &rgPinType;
454     rgPins2.nMediums = 0;
455     rgPins2.lpMedium = NULL;
456     rgPins2.clsPinCategory = NULL;
457
458     hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2, NULL,
459                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
460     ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
461
462     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter2);
463     ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
464
465     out:
466
467     if (pMapper) IFilterMapper2_Release(pMapper);
468 }
469
470
471 START_TEST(filtermapper)
472 {
473     CoInitialize(NULL);
474
475     test_fm2_enummatchingfilters();
476     test_legacy_filter_registration();
477     test_ifiltermapper_from_filtergraph();
478     test_register_filter_with_null_clsMinorType();
479
480     CoUninitialize();
481 }