ReactOS 0.4.15-dev-7928-g68a8619
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 75 of file CMyComputer.cpp.

76{
77 HRESULT hr;
78 CComPtr<IShellFolder2> psf2;
79 CComPtr<IShellFolder2> psf2_2;
80 CComPtr<IShellFolder> psf;
81
83
84 hr = CoCreateInstance(CLSID_MyComputer,
85 NULL,
86 CLSCTX_INPROC_SERVER,
88 ok(hr == S_OK, "hr = %lx\n", hr);
89 if (FAILED(hr))
90 {
91 skip("Could not instantiate CShellDesktop\n");
92 return;
93 }
94
95 /* second create should give us a pointer to the same object */
96 hr = CoCreateInstance(CLSID_MyComputer,
97 NULL,
98 CLSCTX_INPROC_SERVER,
99 IID_PPV_ARG(IShellFolder2, &psf2_2));
100 ok(hr == S_OK, "hr = %lx\n", hr);
101 ok(psf2 == psf2_2, "Expected %p == %p\n", static_cast<PVOID>(psf2), static_cast<PVOID>(psf2_2));
102
103 TestShellFolder(psf2);
104 TestInitialize(psf2);
105}
static VOID TestShellFolder(_In_ IShellFolder2 *psf2)
Definition: CMyComputer.cpp: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
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

◆ TestInitialize()

VOID TestInitialize ( _In_ IShellFolder2 psf2)

Definition at line 52 of file CMyComputer.cpp.

53{
54 CComPtr<IPersistFolder2> ppf2;
56 ok(hr == S_OK, "hr = %lx\n", hr);
57
58 hr = ppf2->Initialize(NULL);
59 ok(hr == S_OK, "hr = %lx\n", hr);
60
61 hr = ppf2->Initialize((LPCITEMIDLIST)INVALID_POINTER);
62 ok(hr == S_OK, "hr = %lx\n", hr);
63
64 //crashes in xp
65 //hr = ppf2->GetCurFolder(NULL);
66 //ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
67
68 CComHeapPtr<ITEMIDLIST> pidl;
69 hr = ppf2->GetCurFolder(&pidl);
70 ok(hr == S_OK, "hr = %lx\n", hr);
71 // 0 in win10, 14 in xp
72 ok(pidl->mkid.cb == 0x14, "expected empty pidl got cb = %x\n", pidl->mkid.cb);
73}
#define INVALID_POINTER
Definition: CMyComputer.cpp:15
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
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
37 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm));
38 ok(hr == S_OK, "hr = %lx\n", hr);
39
40 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm_2));
41 ok(hr == S_OK, "hr = %lx\n", hr);
42 ok(pcm != pcm_2, "Expected %p != %p\n", static_cast<PVOID>(pcm), static_cast<PVOID>(pcm_2));
43
44 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv));
45 ok(hr == S_OK, "hr = %lx\n", hr);
46
47 hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv_2));
48 ok(hr == S_OK, "hr = %lx\n", hr);
49 ok(psv != psv_2, "Expected %p != %p\n", static_cast<PVOID>(psv), static_cast<PVOID>(psv_2));
50}

Referenced by START_TEST().