winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one...
[wine/multimedia.git] / dlls / msdmo / tests / msdmo.c
blob4fc0c3574a19c02f1e6c573d454ad4378c9dbccc
1 /*
2 * MSDMO tests
4 * Copyright 2014 Nikolay Sivov for CodeWeavers
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.
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.
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
21 #include "initguid.h"
22 #include "dmo.h"
23 #include "wine/test.h"
25 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
26 static const GUID GUID_unknowndmo = {0x14d99047,0x441f,0x4cd3,{0xbc,0xa8,0x3e,0x67,0x99,0xaf,0x34,0x75}};
27 static const GUID GUID_unknowncategory = {0x14d99048,0x441f,0x4cd3,{0xbc,0xa8,0x3e,0x67,0x99,0xaf,0x34,0x75}};
29 static void test_DMOUnregister(void)
31 static const WCHAR testdmoW[] = {'t','e','s','t','d','m','o',0};
32 HRESULT hr;
34 hr = DMOUnregister(&GUID_unknowndmo, &GUID_unknowncategory);
35 ok(hr == S_FALSE, "got 0x%08x\n", hr);
37 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
38 ok(hr == S_FALSE, "got 0x%08x\n", hr);
40 /* can't register for all categories */
41 hr = DMORegister(testdmoW, &GUID_unknowndmo, &GUID_NULL, 0, 0, NULL, 0, NULL);
42 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
44 hr = DMORegister(testdmoW, &GUID_unknowndmo, &GUID_unknowncategory, 0, 0, NULL, 0, NULL);
45 if (hr != S_OK) {
46 win_skip("Failed to register DMO. Probably user doesn't have persmissions to do so.\n");
47 return;
50 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
51 ok(hr == S_OK, "got 0x%08x\n", hr);
53 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
54 ok(hr == S_FALSE, "got 0x%08x\n", hr);
57 START_TEST(msdmo)
59 test_DMOUnregister();