ReactOS 0.4.16-dev-117-g38f21f9
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
13START_TEST(GetDisplayNameOf)
14{
15 HRESULT hr;
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 {
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. */
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
42 ok(memcmp(&ret, &expected, sizeof(ret)) == 0, "Data was changed!\n");
43 }
44}
#define ok_hr(status, expected)
Definition: ACListISF.cpp:31
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL expected
Definition: store.c:2063
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
int ret
#define S_FALSE
Definition: winerror.h:2357
#define IID_PPV_ARG(Itype, ppType)