ReactOS 0.4.16-dev-1875-g3000d45
CMyComputer.cpp File Reference
#include "shelltest.h"
#include <debug.h>
#include <stdio.h>
#include <shellutils.h>
Include dependency graph for CMyComputer.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)
 

Functions

static VOID TestShellFolder (_In_ IShellFolder2 *psf2)
 
VOID TestInitialize (_In_ IShellFolder2 *psf2)
 
 START_TEST (CMyComputer)
 

Macro Definition Documentation

◆ INVALID_POINTER

#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)

Definition at line 15 of file CMyComputer.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file CMyComputer.cpp.

Function Documentation

◆ START_TEST()

START_TEST ( CMyComputer  )

Definition at line 77 of file CMyComputer.cpp.

78{
79 HRESULT hr;
80 CComPtr<IShellFolder2> psf2;
81 CComPtr<IShellFolder2> psf2_2;
82 CComPtr<IShellFolder> psf;
83
85
86 hr = CoCreateInstance(CLSID_MyComputer,
87 NULL,
88 CLSCTX_INPROC_SERVER,
90 ok(hr == S_OK, "hr = %lx\n", hr);
91 if (FAILED(hr))
92 {
93 skip("Could not instantiate CShellDesktop\n");
94 return;
95 }
96
98 {
99 /* NT5.x returns a pointer to the same object but not NT6.x and newer. */
100 hr = CoCreateInstance(CLSID_MyComputer,
101 NULL,
102 CLSCTX_INPROC_SERVER,
103 IID_PPV_ARG(IShellFolder2, &psf2_2));
104 ok(hr == S_OK, "hr = %lx\n", hr);
105 ok(psf2 == psf2_2, "Expected %p == %p\n", static_cast<PVOID>(psf2), static_cast<PVOID>(psf2_2));
106 }
107
108 TestShellFolder(psf2);
109 TestInitialize(psf2);
110}
static VOID TestShellFolder(_In_ IShellFolder2 *psf2)
Definition: CMyComputer.cpp:19
#define GetNTVersion()
Definition: apitest.h:19
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#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 FAILED(hr)
Definition: intsafe.h:51
VOID TestInitialize()
Definition: CFSFolder.cpp:105
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

◆ TestInitialize()

VOID TestInitialize ( _In_ IShellFolder2 psf2)

Definition at line 55 of file CMyComputer.cpp.

56{
57 CComPtr<IPersistFolder2> ppf2;
59 ok(hr == S_OK, "hr = %lx\n", hr);
60
62 {
63 hr = ppf2->Initialize(NULL);
64 ok(hr == S_OK, "hr = %lx\n", hr);
65
66 hr = ppf2->Initialize((LPCITEMIDLIST)INVALID_POINTER);
67 ok(hr == S_OK, "hr = %lx\n", hr);
68
69 CComHeapPtr<ITEMIDLIST> pidl;
70 hr = ppf2->GetCurFolder(&pidl);
71 ok(hr == S_OK, "hr = %lx\n", hr);
72 // 0 in early win10, 14 in xp; crashes on late win10
73 ok(pidl->mkid.cb == 0x14, "expected empty pidl got cb = %x\n", pidl->mkid.cb);
74 }
75}
#define INVALID_POINTER
Definition: CMyComputer.cpp:15
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42

◆ TestShellFolder()

static VOID TestShellFolder ( _In_ IShellFolder2 psf2)
static

Definition at line 19 of file CMyComputer.cpp.

21{
22 HRESULT hr;
23 CComPtr<IDropTarget> pdt;
24 CComPtr<IDropTarget> pdt_2;
25 CComPtr<IContextMenu> pcm;
26 CComPtr<IContextMenu> pcm_2;
27 CComPtr<IShellView> psv;
28 CComPtr<IShellView> psv_2;
29
30 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pdt));
31 ok(hr == S_OK, "hr = %lx\n", hr);
32
33 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pdt_2));
34 ok(hr == S_OK, "hr = %lx\n", hr);
35 ok(pdt != pdt_2, "Expected %p != %p\n", static_cast<PVOID>(pdt), static_cast<PVOID>(pdt_2));
36
38 {
39 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm));
40 ok(hr == S_OK, "hr = %lx\n", hr);
41
42 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm_2));
43 ok(hr == S_OK, "hr = %lx\n", hr);
44 ok(pcm != pcm_2, "Expected %p != %p\n", static_cast<PVOID>(pcm), static_cast<PVOID>(pcm_2));
45
46 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv));
47 ok(hr == S_OK, "hr = %lx\n", hr);
48
49 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv_2));
50 ok(hr == S_OK, "hr = %lx\n", hr);
51 ok(psv != psv_2, "Expected %p != %p\n", static_cast<PVOID>(psv), static_cast<PVOID>(psv_2));
52 }
53}

Referenced by START_TEST().