ReactOS 0.4.17-dev-1190-g4c812f4
IShellFolderHelpers.cpp File Reference
#include <apitest.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <versionhelpers.h>
#include <shlwapi_undoc.h>
#include <ishellfolder_helpers.h>
Include dependency graph for IShellFolderHelpers.cpp:

Go to the source code of this file.

Classes

class  CTestShellFolder
 

Typedefs

typedef HRESULT(WINAPI * FN_IShellFolder_CompareIDs) (_In_ IShellFolder *psf, _In_ LPARAM lParam, _In_ PCUIDLIST_RELATIVE pidl1, _In_ PCUIDLIST_RELATIVE pidl2)
 

Functions

static void Test_GetDisplayNameOf (void)
 
static void Test_ParseDisplayName (void)
 
static void Test_CompareIDs (void)
 
 START_TEST (IShellFolderHelpers)
 

Variables

static INT s_nStep = 0
 

Typedef Documentation

◆ FN_IShellFolder_CompareIDs

typedef HRESULT(WINAPI * FN_IShellFolder_CompareIDs) (_In_ IShellFolder *psf, _In_ LPARAM lParam, _In_ PCUIDLIST_RELATIVE pidl1, _In_ PCUIDLIST_RELATIVE pidl2)

Definition at line 277 of file IShellFolderHelpers.cpp.

Function Documentation

◆ START_TEST()

START_TEST ( IShellFolderHelpers  )

Definition at line 333 of file IShellFolderHelpers.cpp.

334{
335 HRESULT hrCoInit = ::CoInitialize(NULL);
336
340
341 if (SUCCEEDED(hrCoInit))
343}
static void Test_CompareIDs(void)
static void Test_ParseDisplayName(void)
static void Test_GetDisplayNameOf(void)
#define NULL
Definition: types.h:112
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ Test_CompareIDs()

static void Test_CompareIDs ( void  )
static

Definition at line 283 of file IShellFolderHelpers.cpp.

284{
285 FN_IShellFolder_CompareIDs fnIShellFolder_CompareIDs;
286 fnIShellFolder_CompareIDs =
289
291 {
292 skip("Vista+\n");
293 ok(fnIShellFolder_CompareIDs == NULL, "Vista+ has no IShellFolder_CompareIDs\n");
294 return;
295 }
296
298 HRESULT hr;
299
300 s_nStep = 11;
301 hr = fnIShellFolder_CompareIDs(
302 psf,
303 0xFFFF1234,
304 NULL,
305 NULL);
306 ok_long(hr, 0xFEEDF00D);
307 ok_int(s_nStep, 13);
308
309 s_nStep = 13;
310 hr = fnIShellFolder_CompareIDs(
311 psf,
312 0x00005678,
313 NULL,
314 NULL);
315 ok_long(hr, 0xFEEDF00D);
316 ok_int(s_nStep, 14);
317
318 psf->m_QISF2 = -1; // No IShellFolder2 support, flags should be masked away
319 s_nStep = 12;
320 hr = fnIShellFolder_CompareIDs(psf, 0xFFFF1234, NULL, NULL);
321 ok_long(hr, 0xFEEDF00D);
322 psf->m_QISF2 = 0;
323
324 psf->m_QISF2 = 1; // "Implements" IShellFolder2, we can handle all flags
325 s_nStep = 99;
326 hr = fnIShellFolder_CompareIDs(psf, 0x87654321, NULL, NULL);
327 ok_long(hr, 0x87654321);
328 psf->m_QISF2 = 0;
329
330 delete psf;
331}
static INT s_nStep
HRESULT(WINAPI * FN_IShellFolder_CompareIDs)(_In_ IShellFolder *psf, _In_ LPARAM lParam, _In_ PCUIDLIST_RELATIVE pidl1, _In_ PCUIDLIST_RELATIVE pidl2)
#define ok_long(expression, result)
Definition: atltest.h:133
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
HRESULT hr
Definition: delayimp.cpp:582
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
VERSIONHELPERAPI IsWindowsVistaOrGreater()

Referenced by START_TEST().

◆ Test_GetDisplayNameOf()

static void Test_GetDisplayNameOf ( void  )
static

Definition at line 227 of file IShellFolderHelpers.cpp.

228{
230 HRESULT hr;
231
233 psf,
234 NULL,
235 SHGDN_FOREDITING | SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | SHGDN_INFOLDER,
236 NULL,
237 0);
238 ok_long(hr, E_FAIL);
239 ok_int(s_nStep, 4);
240
242 psf,
243 NULL,
244 SHGDN_FOREDITING | SHGDN_FORADDRESSBAR | SHGDN_INFOLDER,
245 NULL,
246 0);
247 ok_long(hr, E_FAIL);
248 ok_int(s_nStep, 10);
249
250 if (s_nStep != 10)
251 skip("s_nStep value is wrong\n");
252
253 delete psf;
254}
#define E_FAIL
Definition: ddrawi.h:102
#define IShellFolder_GetDisplayNameOf
Definition: utils.cpp:13

Referenced by START_TEST().

◆ Test_ParseDisplayName()

static void Test_ParseDisplayName ( void  )
static

Definition at line 256 of file IShellFolderHelpers.cpp.

257{
259 HRESULT hr;
260
261 s_nStep = 10;
262 LPITEMIDLIST pidl = (LPITEMIDLIST)UlongToPtr(0xDEADDEAD);
264 psf,
265 NULL,
266 NULL,
267 NULL,
268 NULL,
269 &pidl,
270 NULL);
271 ok_long(hr, 0xDEADFACE);
272 ok_int(s_nStep, 11);
273
274 delete psf;
275}
#define IShellFolder_ParseDisplayName
Definition: utils.cpp:14
#define UlongToPtr(u)
Definition: config.h:106
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by START_TEST().

Variable Documentation

◆ s_nStep