ReactOS 0.4.16-dev-122-g325d74c
IACLCustomMRU.cpp File Reference
#include <apitest.h>
#include <shlobj.h>
#include <atlbase.h>
#include <atlstr.h>
#include <atlcom.h>
#include <atlwin.h>
#include <shellutils.h>
#include <shlwapi.h>
#include <strsafe.h>
#include <initguid.h>
Include dependency graph for IACLCustomMRU.cpp:

Go to the source code of this file.

Macros

#define _UNICODE
 
#define UNICODE
 
#define ok_hex2(file, line, key, expression, result)
 
#define ok_wstri(x, y)    ok(lstrcmpiW(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
 
#define INTERFACE   IACLCustomMRU
 
#define verify_mru(mru, ...)   verify_mru_(__FILE__, __LINE__, mru, __VA_ARGS__, NULL)
 
#define TYPED_URLS_KEY   L"Software\\Microsoft\\Internet Explorer\\TypedURLs"
 
#define INVALID_LPOLESTR   ((LPOLESTR)(LONG_PTR)0xDEADBEEF)
 

Functions

ULONG DbgPrint (PCH Format,...)
 
 DEFINE_GUID (IID_IACLCustomMRU, 0xf729fc5e, 0x8769, 0x4f3e, 0xbd, 0xb2, 0xd7, 0xb5, 0x0f, 0xd2, 0x27, 0x5b)
 
 DECLARE_INTERFACE_IID_ (IACLCustomMRU, IUnknown, "F729FC5E-8769-4F3E-BDB2-D7B50FD2275B")
 
static void Cleanup_Testdata ()
 
static void verify_mru_ (const char *file, int line, IACLCustomMRU *mru, PCWSTR MRUString,...)
 
static void test_IACLCustomMRU_Basics ()
 
static void FillDefault (IACLCustomMRU *CustomMRU)
 
static void test_IACLCustomMRU_UpdateOrder ()
 
static void test_IACLCustomMRU_ExtraChars ()
 
static void test_IACLCustomMRU_Continue ()
 
static void RestoreTypedURLs (const CStringW &url1, const CStringW &url2)
 
static void test_IACLCustomMRU_TypedURLs ()
 
 START_TEST (IACLCustomMRU)
 

Variables

static const WCHAR szTestPath [] = L"TESTPATH_BROWSEUI_APITEST"
 

Macro Definition Documentation

◆ _UNICODE

#define _UNICODE

Definition at line 8 of file IACLCustomMRU.cpp.

◆ INTERFACE

#define INTERFACE   IACLCustomMRU

Definition at line 40 of file IACLCustomMRU.cpp.

◆ INVALID_LPOLESTR

#define INVALID_LPOLESTR   ((LPOLESTR)(LONG_PTR)0xDEADBEEF)

◆ ok_hex2

#define ok_hex2 (   file,
  line,
  key,
  expression,
  result 
)
Value:
do { \
int _value = (expression); \
ok_(file, line)(_value == (result), "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x for %c\n", \
#expression, (int)(result), _value, (char)key); \
} while (0)
GLuint64EXT * result
Definition: glext.h:11304
Definition: fci.c:127
Definition: copy.c:22
Definition: parser.c:49

Definition at line 25 of file IACLCustomMRU.cpp.

◆ ok_wstri

#define ok_wstri (   x,
  y 
)     ok(lstrcmpiW(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)

Definition at line 32 of file IACLCustomMRU.cpp.

◆ TYPED_URLS_KEY

#define TYPED_URLS_KEY   L"Software\\Microsoft\\Internet Explorer\\TypedURLs"

Definition at line 398 of file IACLCustomMRU.cpp.

◆ UNICODE

Definition at line 9 of file IACLCustomMRU.cpp.

◆ verify_mru

#define verify_mru (   mru,
  ... 
)    verify_mru_(__FILE__, __LINE__, mru, __VA_ARGS__, NULL)

Definition at line 63 of file IACLCustomMRU.cpp.

Function Documentation

◆ Cleanup_Testdata()

static void Cleanup_Testdata ( )
static

Definition at line 56 of file IACLCustomMRU.cpp.

57{
58 CRegKey tmp;
61}
static const WCHAR szTestPath[]
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
LONG DeleteSubKey(LPCTSTR lpszSubKey) noexcept
Definition: atlbase.h:1407
#define NULL
Definition: types.h:112
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by FillDefault(), START_TEST(), test_IACLCustomMRU_Basics(), test_IACLCustomMRU_Continue(), test_IACLCustomMRU_ExtraChars(), and test_IACLCustomMRU_UpdateOrder().

◆ DbgPrint()

ULONG DbgPrint ( PCH  Format,
  ... 
)

◆ DECLARE_INTERFACE_IID_()

DECLARE_INTERFACE_IID_ ( IACLCustomMRU  ,
IUnknown  ,
"F729FC5E-8769-4F3E-BDB2-D7B50FD2275B"   
)

Definition at line 43 of file IACLCustomMRU.cpp.

44{
45 // *** IUnknown methods ***
49
50 // *** IACLCustomMRU methods ***
51 STDMETHOD(Initialize) (THIS_ LPCWSTR pwszMRURegKey, DWORD dwMax) PURE;
53};
#define PURE
Definition: basetyps.h:64
#define THIS_
Definition: basetyps.h:65
#define THIS
Definition: basetyps.h:66
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
#define STDMETHOD(m)
Definition: basetyps.h:62
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define AddMRUString
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define REFIID
Definition: guiddef.h:118
uint32_t ULONG
Definition: typedefs.h:59
static void Initialize()
Definition: xlate.c:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IACLCustomMRU  ,
0xf729fc5e  ,
0x8769  ,
0x4f3e  ,
0xbd  ,
0xb2  ,
0xd7  ,
0xb5  ,
0x0f  ,
0xd2  ,
0x27  ,
0x5b   
)

◆ FillDefault()

static void FillDefault ( IACLCustomMRU *  CustomMRU)
static

Definition at line 151 of file IACLCustomMRU.cpp.

152{
154 HRESULT hr = CustomMRU->Initialize(szTestPath, 3);
155 ok_hex(hr, S_OK);
156 hr = CustomMRU->AddMRUString(L"FIRST_ENTRY");
157 ok_hex(hr, S_OK);
158 hr = CustomMRU->AddMRUString(L"SECOND_ENTRY");
159 ok_hex(hr, S_OK);
160 hr = CustomMRU->AddMRUString(L"THIRD_ENTRY");
161 ok_hex(hr, S_OK);
162}
static void Cleanup_Testdata()
#define ok_hex(expression, result)
Definition: atltest.h:94
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183

Referenced by test_IACLCustomMRU_Continue(), and test_IACLCustomMRU_UpdateOrder().

◆ RestoreTypedURLs()

static void RestoreTypedURLs ( const CStringW url1,
const CStringW url2 
)
static

Definition at line 401 of file IACLCustomMRU.cpp.

402{
403 CRegKey key;
405 if (url1 != L"")
406 key.SetStringValue(L"url1", url1);
407 else
408 key.DeleteValue(L"url1");
409 if (url2 != L"")
410 key.SetStringValue(L"url2", url2);
411 else
412 key.DeleteValue(L"url2");
413}
#define TYPED_URLS_KEY
static const WCHAR url1[]
Definition: misc.c:300
static const WCHAR url2[]
Definition: misc.c:302

Referenced by test_IACLCustomMRU_TypedURLs().

◆ START_TEST()

START_TEST ( IACLCustomMRU  )

Definition at line 544 of file IACLCustomMRU.cpp.

545{
546 CCoInit init;
547 ok_hex(init.hr, S_OK);
548 if (!SUCCEEDED(init.hr))
549 return;
550
556
558}
static void test_IACLCustomMRU_ExtraChars()
static void test_IACLCustomMRU_UpdateOrder()
static void test_IACLCustomMRU_Continue()
static void test_IACLCustomMRU_TypedURLs()
static void test_IACLCustomMRU_Basics()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static int init
Definition: wintirpc.c:33

◆ test_IACLCustomMRU_Basics()

static void test_IACLCustomMRU_Basics ( )
static

Definition at line 105 of file IACLCustomMRU.cpp.

106{
107 CComPtr<IACLCustomMRU> CustomMRU;
108 HRESULT hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
109 ok_hex(hr, S_OK);
110 if (!SUCCEEDED(hr))
111 return;
112
114
115 /* Initialize with a NULL name will cause an AV */
116 //hr = CustomMRU->Initialize(NULL, 0);
117
118 hr = CustomMRU->Initialize(szTestPath, 0);
119 ok_hex(hr, S_OK);
120 /* Adding an entry with a dwMax of 0 will cause an AV */
121
122 /* Calling it again will resize */
123 hr = CustomMRU->Initialize(szTestPath, 3);
124 ok_hex(hr, S_OK);
125 verify_mru(CustomMRU, L"");
126
127 hr = CustomMRU->AddMRUString(L"FIRST_ENTRY");
128 ok_hex(hr, S_OK);
129 verify_mru(CustomMRU, L"a", L"FIRST_ENTRY");
130
131 hr = CustomMRU->AddMRUString(L"SECOND_ENTRY");
132 ok_hex(hr, S_OK);
133 verify_mru(CustomMRU, L"ba", L"FIRST_ENTRY", L"SECOND_ENTRY");
134
135 hr = CustomMRU->AddMRUString(L"THIRD_ENTRY");
136 ok_hex(hr, S_OK);
137 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
138
139 /* First entry is replaced */
140 hr = CustomMRU->AddMRUString(L"FOURTH_ENTRY");
141 ok_hex(hr, S_OK);
142 verify_mru(CustomMRU, L"acb", L"FOURTH_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
143
144 /* Second entry is replaced */
145 hr = CustomMRU->AddMRUString(L"FIFTH_ENTRY");
146 ok_hex(hr, S_OK);
147 verify_mru(CustomMRU, L"bac", L"FOURTH_ENTRY", L"FIFTH_ENTRY", L"THIRD_ENTRY");
148}
#define verify_mru(mru,...)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define IID_PPV_ARG(Itype, ppType)

Referenced by START_TEST().

◆ test_IACLCustomMRU_Continue()

static void test_IACLCustomMRU_Continue ( )
static

Definition at line 243 of file IACLCustomMRU.cpp.

244{
245 CComPtr<IACLCustomMRU> CustomMRU;
246 HRESULT hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
247 ok_hex(hr, S_OK);
248 if (!SUCCEEDED(hr))
249 return;
250
252 FillDefault(CustomMRU);
253 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
254
255 CustomMRU.Release();
256
257 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
258 ok_hex(hr, S_OK);
259 if (!SUCCEEDED(hr))
260 return;
261
262 hr = CustomMRU->Initialize(szTestPath, 3);
263 ok_hex(hr, S_OK);
264
265 /* First entry is replaced */
266 hr = CustomMRU->AddMRUString(L"FOURTH_ENTRY");
267 ok_hex(hr, S_OK);
268 verify_mru(CustomMRU, L"acb", L"FOURTH_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
269
270 CustomMRU.Release();
271
272 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
273 ok_hex(hr, S_OK);
274 if (!SUCCEEDED(hr))
275 return;
276
277 hr = CustomMRU->Initialize(szTestPath, 3);
278 ok_hex(hr, S_OK);
279
280 /* Second entry is replaced */
281 hr = CustomMRU->AddMRUString(L"FIFTH_ENTRY");
282 ok_hex(hr, S_OK);
283 verify_mru(CustomMRU, L"bac", L"FOURTH_ENTRY", L"FIFTH_ENTRY", L"THIRD_ENTRY");
284
285 CustomMRU.Release();
286
287 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
288 ok_hex(hr, S_OK);
289 if (!SUCCEEDED(hr))
290 return;
291
292
293 /* Save some garbage */
294 CRegKey key;
296 key.SetStringValue(L"MRUList", L"b**");
297 key.Close();
298
299 hr = CustomMRU->Initialize(szTestPath, 3);
300 ok_hex(hr, S_OK);
301
302 CustomMRU.Release();
303
304 /* Not cleaned up */
305 verify_mru(CustomMRU, L"b**", L"FOURTH_ENTRY", L"FIFTH_ENTRY", L"THIRD_ENTRY");
306
307 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
308 ok_hex(hr, S_OK);
309 if (!SUCCEEDED(hr))
310 return;
311
312 hr = CustomMRU->Initialize(szTestPath, 3);
313 ok_hex(hr, S_OK);
314
315 /* Now it's just cleaned up */
316 hr = CustomMRU->AddMRUString(L"SIXTH_ENTRY");
317 ok_hex(hr, S_OK);
318 verify_mru(CustomMRU, L"ab", L"SIXTH_ENTRY");
319
320 CustomMRU.Release();
321
322 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
323 ok_hex(hr, S_OK);
324 if (!SUCCEEDED(hr))
325 return;
326
328 FillDefault(CustomMRU);
329 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
330
331 CustomMRU.Release();
332
333 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
334 ok_hex(hr, S_OK);
335 if (!SUCCEEDED(hr))
336 return;
337
339 key.SetStringValue(L"MRUList", L"baccccc");
340 key.Close();
341
342 hr = CustomMRU->Initialize(szTestPath, 3);
343 ok_hex(hr, S_OK);
344 CustomMRU.Release();
345
346 verify_mru(CustomMRU, L"baccccc", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
347
348 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
349 ok_hex(hr, S_OK);
350 if (!SUCCEEDED(hr))
351 return;
352
353 hr = CustomMRU->Initialize(szTestPath, 3);
354 ok_hex(hr, S_OK);
355
356 hr = CustomMRU->AddMRUString(L"FOURTH_ENTRY");
357 ok_hex(hr, S_OK);
358 verify_mru(CustomMRU, L"a", L"FOURTH_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
359
360 CustomMRU.Release();
362
363 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
364 ok_hex(hr, S_OK);
365 if (!SUCCEEDED(hr))
366 return;
367
368 hr = CustomMRU->Initialize(szTestPath, 3);
369 ok_hex(hr, S_OK);
370 if (!SUCCEEDED(hr))
371 return;
372
373 hr = CustomMRU->AddMRUString(L"FIRST_ENTRY");
374 ok_hex(hr, S_OK);
375 verify_mru(CustomMRU, L"a", L"FIRST_ENTRY");
376
377 CustomMRU.Release();
378
380 key.SetStringValue(L"MRUList", L"aaa");
381 key.Close();
382
383 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
384 ok_hex(hr, S_OK);
385 if (!SUCCEEDED(hr))
386 return;
387
388 hr = CustomMRU->Initialize(szTestPath, 3);
389 ok_hex(hr, S_OK);
390 if (!SUCCEEDED(hr))
391 return;
392
393 hr = CustomMRU->AddMRUString(L"SECOND_ENTRY");
394 ok_hex(hr, S_OK);
395 verify_mru(CustomMRU, L"ba", L"FIRST_ENTRY", L"SECOND_ENTRY");
396}
static void FillDefault(IACLCustomMRU *CustomMRU)
void Release()
Definition: atlcomcli.h:170

Referenced by START_TEST().

◆ test_IACLCustomMRU_ExtraChars()

static void test_IACLCustomMRU_ExtraChars ( )
static

Definition at line 211 of file IACLCustomMRU.cpp.

212{
213 CComPtr<IACLCustomMRU> CustomMRU;
214 HRESULT hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
215 ok_hex(hr, S_OK);
216 if (!SUCCEEDED(hr))
217 return;
218
220
221 /* Still returnes success */
222 hr = CustomMRU->Initialize(szTestPath, 30);
223 ok_hex(hr, S_OK);
224
225 for (int n = 0; n < 30; ++n)
226 {
227 CStringW tmp;
228 tmp.Format(L"%d", n);
229
230 hr = CustomMRU->AddMRUString(tmp);
231 ok_hex(hr, S_OK);
232 }
233 /* But is starting to wrap around */
234 verify_mru(CustomMRU, L"a}|{zyxwvutsrqponmlkjihgfedcb", L"29",
235 L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9",
236 L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19",
237 L"20", L"21", L"22", L"23", L"24", L"25", L"26", L"27", L"28");
238
240}
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
GLdouble n
Definition: glext.h:7729

Referenced by START_TEST().

◆ test_IACLCustomMRU_TypedURLs()

static void test_IACLCustomMRU_TypedURLs ( )
static

Definition at line 416 of file IACLCustomMRU.cpp.

417{
418 CStringW url1, url2; // Save values
419 {
420 CRegKey key;
422
425 LSTATUS Status = key.QueryStringValue(L"url1", Value, &cch);
426 if (!Status)
427 url1 = Value;
428
429 cch = _countof(Value);
430 Status = key.QueryStringValue(L"url2", Value, &cch);
431 if (!Status)
432 url2 = Value;
433
434 // Set values
435 key.SetStringValue(L"url1", L"aaa");
436 key.SetStringValue(L"url2", L"bbb");
437 }
438
439 CComPtr<IACLCustomMRU> CustomMRU;
440 HRESULT hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL,
441 IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
442 ok_hex(hr, S_OK);
443 if (FAILED(hr))
444 {
445 skip("IACLCustomMRU was NULL\n");
447 return;
448 }
449
450 CComPtr<IACList> ACList;
451 hr = CustomMRU->QueryInterface(IID_PPV_ARG(IACList, &ACList));
452 ok_hex(hr, S_OK);
453 if (SUCCEEDED(hr))
454 {
455 hr = ACList->Expand(L"C:");
457 hr = ACList->Expand(L"C:\\");
459 hr = ACList->Expand(L"C:\\Program Files");
461 hr = ACList->Expand(L"C:\\Program Files\\");
463 hr = ACList->Expand(L"http://");
465 hr = ACList->Expand(L"https://");
467 hr = ACList->Expand(L"https://google.co.jp/");
469 }
470
471 hr = CustomMRU->Initialize(TYPED_URLS_KEY, 64);
472 ok_hex(hr, S_OK);
473
474 if (ACList)
475 {
476 hr = ACList->Expand(L"C:");
478 hr = ACList->Expand(L"C:\\");
480 hr = ACList->Expand(L"C:\\Program Files");
482 hr = ACList->Expand(L"C:\\Program Files\\");
484 hr = ACList->Expand(L"http://");
486 hr = ACList->Expand(L"https://");
488 hr = ACList->Expand(L"https://google.co.jp/");
490 }
491
493 hr = CustomMRU->QueryInterface(IID_PPV_ARG(IEnumString, &pEnum));
494 ok_hex(hr, S_OK);
495 if (FAILED(hr))
496 {
497 skip("IEnumString was NULL\n");
499 return;
500 }
501
502 CComPtr<IEnumString> pEnumClone;
503 hr = pEnum->Clone(&pEnumClone);
505
506 hr = pEnum->Skip(1);
508
509#define INVALID_LPOLESTR ((LPOLESTR)(LONG_PTR)0xDEADBEEF)
510 LPOLESTR apsz[2] = { NULL, INVALID_LPOLESTR };
511 ULONG c = 0;
512 hr = pEnum->Next(2, apsz, &c);
513 ok_hex(hr, S_OK);
514 ok_wstri(apsz[0], L"aaa");
515 ok_int(c, 1);
516 ok(apsz[1] == INVALID_LPOLESTR, "apsz[1] was '%S'\n", apsz[1]);
517 CoTaskMemFree(apsz[0]);
518
520 c = 0;
521 hr = pEnum->Next(0, &psz, &c);
522 ok_hex(hr, S_OK);
523 ok(psz == INVALID_LPOLESTR, "psz was '%S'\n", psz);
524 ok_int(c, 0);
525
526 psz = NULL;
527 c = 0;
528 hr = pEnum->Next(1, &psz, &c);
529 ok_hex(hr, S_OK);
530 ok_wstri(psz, L"bbb");
531 ok_int(c, 1);
532 CoTaskMemFree(psz);
533
534 hr = CustomMRU->AddMRUString(L"https://google.co.jp");
535 ok_hex(hr, E_FAIL);
536 hr = CustomMRU->AddMRUString(L"C:");
537 ok_hex(hr, E_FAIL);
538 hr = CustomMRU->AddMRUString(L"C:\\");
539 ok_hex(hr, E_FAIL);
540
542}
static void RestoreTypedURLs(const CStringW &url1, const CStringW &url2)
#define ok_wstri(x, y)
#define INVALID_LPOLESTR
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define MAX_PATH
Definition: compat.h:34
Status
Definition: gdiplustypes.h:25
const GLubyte * c
Definition: glext.h:8905
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define FAILED(hr)
Definition: intsafe.h:51
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static LPOLESTR
Definition: stg_prop.c:27
#define _countof(array)
Definition: sndvol32.h:70
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_IACLCustomMRU_UpdateOrder()

static void test_IACLCustomMRU_UpdateOrder ( )
static

Definition at line 165 of file IACLCustomMRU.cpp.

166{
167 CComPtr<IACLCustomMRU> CustomMRU;
168 HRESULT hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
169 ok_hex(hr, S_OK);
170 if (!SUCCEEDED(hr))
171 return;
172
174 FillDefault(CustomMRU);
175 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
176
177 /* Add the first entry again */
178 hr = CustomMRU->AddMRUString(L"FIRST_ENTRY");
179 ok_hex(hr, S_OK);
180 /* No change */
181 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
182
183 CustomMRU.Release();
184 /* Now the order is updated */
185 verify_mru(NULL, L"acb", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
186
187
188 hr = CoCreateInstance(CLSID_ACLCustomMRU, NULL, CLSCTX_ALL, IID_PPV_ARG(IACLCustomMRU, &CustomMRU));
189 ok_hex(hr, S_OK);
190 if (!SUCCEEDED(hr))
191 return;
192
194 FillDefault(CustomMRU);
195 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
196
197
198 /* Add the first entry again */
199 hr = CustomMRU->AddMRUString(L"FIRST_ENTRY");
200 ok_hex(hr, S_OK);
201 /* No change */
202 verify_mru(CustomMRU, L"cba", L"FIRST_ENTRY", L"SECOND_ENTRY", L"THIRD_ENTRY");
203
204 hr = CustomMRU->AddMRUString(L"SOMETHING_ELSE");
205 ok_hex(hr, S_OK);
206 /* Now all changes are persisted */
207 verify_mru(CustomMRU, L"bac", L"FIRST_ENTRY", L"SOMETHING_ELSE", L"THIRD_ENTRY");
208}

Referenced by START_TEST().

◆ verify_mru_()

static void verify_mru_ ( const char file,
int  line,
IACLCustomMRU *  mru,
PCWSTR  MRUString,
  ... 
)
static

Definition at line 64 of file IACLCustomMRU.cpp.

65{
66
69
71 va_start(args, MRUString);
73 WCHAR Key = L'a';
74 while ((Entry = va_arg(args, PCWSTR)))
75 {
77 ULONG nChars = _countof(Value);
78 CStringW tmp;
79 tmp += Key;
80 LSTATUS Status = key.QueryStringValue(tmp, Value, &nChars);
82 if (Status == ERROR_SUCCESS)
83 {
84 ok_(file, line)(!wcscmp(Value, Entry), "Expected value %c to be %S, was %S\n", (char)Key, Entry, Value);
85 }
86 Key++;
87 }
88 va_end(args);
89
90 if (Key != L'a')
91 {
93 ULONG nChars = _countof(Value);
94 LSTATUS Status = key.QueryStringValue(L"MRUList", Value, &nChars);
96 if (Status == ERROR_SUCCESS)
97 {
98 ok_(file, line)(!wcscmp(Value, MRUString), "Expected MRUList to be %S, was %S\n", MRUString, Value);
99 }
100 }
101}
#define ok_hex2(file, line, key, expression, result)
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define va_arg(ap, T)
Definition: acmsvcex.h:89
#define ok_(x1, x2)
Definition: atltest.h:61
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char
Definition: typeof.h:29
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
base of all file and directory entries
Definition: entries.h:83
Definition: match.c:390
const uint16_t * PCWSTR
Definition: typedefs.h:57

Variable Documentation

◆ szTestPath

const WCHAR szTestPath[] = L"TESTPATH_BROWSEUI_APITEST"
static