Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/apphelp/tests/apphelp.c
4389 views
1
/*
2
* Copyright 2012 Detlef Riekenberg
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
#define COBJMACROS
20
21
#include <stdarg.h>
22
#include <stdio.h>
23
#include <initguid.h>
24
#include <exdisp.h>
25
#include <shlobj.h>
26
#include <urlmon.h>
27
28
#include "wine/test.h"
29
30
static HMODULE hdll;
31
static BOOL (WINAPI *pApphelpCheckShellObject)(REFCLSID, BOOL, ULONGLONG *);
32
33
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
34
35
DEFINE_GUID(test_Microsoft_Browser_Architecture, 0xa5e46e3a, 0x8849, 0x11d1, 0x9d, 0x8c, 0x00, 0xc0, 0x4f, 0xc9, 0x9d, 0x61);
36
DEFINE_GUID(CLSID_MenuBand, 0x5b4dae26, 0xb807, 0x11d0, 0x98, 0x15, 0x00, 0xc0, 0x4f, 0xd9, 0x19, 0x72);
37
DEFINE_GUID(test_UserAssist, 0xdd313e04, 0xfeff, 0x11d1, 0x8e, 0xcd, 0x00, 0x00, 0xf8, 0x7a, 0x47, 0x0c);
38
39
static const CLSID * objects[] = {
40
&GUID_NULL,
41
/* used by IE */
42
&test_Microsoft_Browser_Architecture,
43
&CLSID_MenuBand,
44
&CLSID_ShellLink,
45
&CLSID_ShellWindows,
46
&CLSID_InternetSecurityManager,
47
&test_UserAssist,
48
NULL,};
49
50
static void test_ApphelpCheckShellObject(void)
51
{
52
ULONGLONG flags;
53
BOOL res;
54
int i;
55
56
if (!pApphelpCheckShellObject)
57
{
58
win_skip("ApphelpCheckShellObject not available\n");
59
return;
60
}
61
62
for (i = 0; objects[i]; i++)
63
{
64
flags = 0xdeadbeef;
65
SetLastError(0xdeadbeef);
66
res = pApphelpCheckShellObject(objects[i], FALSE, &flags);
67
ok(res && (flags == 0), "%s 0: got %d and %s with 0x%lx (expected TRUE and 0)\n",
68
wine_dbgstr_guid(objects[i]), res, wine_dbgstr_longlong(flags), GetLastError());
69
70
flags = 0xdeadbeef;
71
SetLastError(0xdeadbeef);
72
res = pApphelpCheckShellObject(objects[i], TRUE, &flags);
73
ok(res && (flags == 0), "%s 1: got %d and %s with 0x%lx (expected TRUE and 0)\n",
74
wine_dbgstr_guid(objects[i]), res, wine_dbgstr_longlong(flags), GetLastError());
75
76
}
77
78
/* NULL as pointer to flags is checked */
79
SetLastError(0xdeadbeef);
80
res = pApphelpCheckShellObject(&GUID_NULL, FALSE, NULL);
81
ok(res, "%s 0: got %d with 0x%lx (expected != FALSE)\n", wine_dbgstr_guid(&GUID_NULL), res, GetLastError());
82
83
/* NULL as CLSID* crash on Windows */
84
if (0)
85
{
86
flags = 0xdeadbeef;
87
SetLastError(0xdeadbeef);
88
res = pApphelpCheckShellObject(NULL, FALSE, &flags);
89
trace("NULL as CLSID*: got %d and %s with 0x%lx\n", res, wine_dbgstr_longlong(flags), GetLastError());
90
}
91
}
92
93
START_TEST(apphelp)
94
{
95
96
hdll = LoadLibraryA("apphelp.dll");
97
if (!hdll) {
98
win_skip("apphelp.dll not available\n");
99
return;
100
}
101
pApphelpCheckShellObject = (void *) GetProcAddress(hdll, "ApphelpCheckShellObject");
102
103
test_ApphelpCheckShellObject();
104
}
105
106