ReactOS
0.4.17-dev-806-gffa4164
GetDisplayNameOf.cpp
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS API tests
3
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4
* PURPOSE: Test for GetDisplayNameOf
5
* COPYRIGHT: Copyright 2023 Mark Jansen <mark.jansen@reactos.org>
6
* Copyright 2023 Doug Lyons <douglyons@douglyons.com>
7
*/
8
9
#include "
shelltest.h
"
10
#include <stdio.h>
11
#include <
shellutils.h
>
12
13
START_TEST
(
GetDisplayNameOf
)
14
{
15
HRESULT
hr
;
16
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
17
18
CComPtr<IShellFolder> spPanel;
19
20
hr
=
CoCreateInstance
(CLSID_ControlPanel,
NULL
, CLSCTX_ALL,
21
IID_PPV_ARG
(
IShellFolder
, &spPanel));
22
ok_hr
(
hr
,
S_OK
);
23
if
(
SUCCEEDED
(
hr
))
24
{
25
STRRET
ret
,
expected
;
26
27
memset
(&
ret
,
'a'
,
sizeof
(
ret
));
28
memset
(&
expected
,
'a'
,
sizeof
(
expected
));
29
hr
= spPanel->GetDisplayNameOf(
NULL
, SHGDN_NORMAL, &
ret
);
30
31
/* Return value is expected to be 'S_FALSE', which is out-of-spec behavior.
32
* The data after function call is expected to be unchanged. */
33
ok_hex
(
hr
,
S_FALSE
);
34
ok
(
memcmp
(&
ret
, &
expected
,
sizeof
(
ret
)) == 0,
"Data was changed!\n"
);
35
36
/* Repeat the same test with SHGDN_FORPARSING */
37
memset
(&
ret
,
'a'
,
sizeof
(
ret
));
38
memset
(&
expected
,
'a'
,
sizeof
(
expected
));
39
hr
= spPanel->GetDisplayNameOf(
NULL
, SHGDN_FORPARSING, &
ret
);
40
41
ok_hex
(
hr
,
S_FALSE
);
42
ok
(
memcmp
(&
ret
, &
expected
,
sizeof
(
ret
)) == 0,
"Data was changed!\n"
);
43
}
44
}
ok_hr
#define ok_hr(status, expected)
Definition:
ACListISF.cpp:31
IID_PPV_ARG
#define IID_PPV_ARG(Itype, ppType)
Definition:
CSnapinCacheEntry.cpp:13
ok_hex
#define ok_hex(expression, result)
Definition:
atltest.h:94
ok
#define ok(value,...)
Definition:
atltest.h:57
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
hr
HRESULT hr
Definition:
delayimp.cpp:582
NULL
#define NULL
Definition:
types.h:112
CoInitializeEx
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition:
combase.c:2803
CoCreateInstance
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition:
combase.c:1685
memcmp
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition:
string.c:2807
ret
return ret
Definition:
mutex.c:147
GetDisplayNameOf
static HRESULT WINAPI GetDisplayNameOf(IShellFolder *This, PCUITEMID_CHILD pidl, SHGDNF uFlags, STRRET *pSR)
Definition:
inetfolder.c:261
HRESULT
Definition:
metahost.idl:58
IShellFolder
Definition:
shobjidl.idl:156
S_OK
#define S_OK
Definition:
intsafe.h:52
SUCCEEDED
#define SUCCEEDED(hr)
Definition:
intsafe.h:50
expected
BOOL expected
Definition:
store.c:2000
COINIT_APARTMENTTHREADED
@ COINIT_APARTMENTTHREADED
Definition:
objbase.h:279
memset
#define memset(x, y, z)
Definition:
compat.h:39
shelltest.h
shellutils.h
_STRRET
Definition:
shtypes.idl:92
S_FALSE
#define S_FALSE
Definition:
winerror.h:3451
modules
rostests
apitests
shell32
GetDisplayNameOf.cpp
Generated on Fri Sep 11 2026 06:10:36 for ReactOS by
1.9.6