ReactOS 0.4.16-dev-122-g325d74c
shell32_test.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lnk_desc_t
 

Macros

#define create_lnk(a, b, c)   create_lnk_(__LINE__, (a), (b), (c))
 

Functions

void create_lnk_ (int, const WCHAR *, lnk_desc_t *, int)
 

Macro Definition Documentation

◆ create_lnk

#define create_lnk (   a,
  b,
  c 
)    create_lnk_(__LINE__, (a), (b), (c))

Definition at line 37 of file shell32_test.h.

Function Documentation

◆ create_lnk_()

void create_lnk_ ( int  line,
const WCHAR path,
lnk_desc_t desc,
int  save_fails 
)

Definition at line 416 of file shelllink.c.

417{
418 HRESULT r;
419 IShellLinkA *sl;
420 IPersistFile *pf;
421
422 r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
423 &IID_IShellLinkA, (LPVOID*)&sl);
424 lok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
425 if (r != S_OK)
426 return;
427
428 if (desc->description)
429 {
430 r = IShellLinkA_SetDescription(sl, desc->description);
431 lok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
432 }
433 if (desc->workdir)
434 {
435 r = IShellLinkA_SetWorkingDirectory(sl, desc->workdir);
436 lok(r == S_OK, "SetWorkingDirectory failed (0x%08x)\n", r);
437 }
438 if (desc->path)
439 {
440 r = IShellLinkA_SetPath(sl, desc->path);
441 lok(SUCCEEDED(r), "SetPath failed (0x%08x)\n", r);
442 }
443 if (desc->pidl)
444 {
445 r = IShellLinkA_SetIDList(sl, desc->pidl);
446 lok(r == S_OK, "SetIDList failed (0x%08x)\n", r);
447 }
448 if (desc->arguments)
449 {
450 r = IShellLinkA_SetArguments(sl, desc->arguments);
451 lok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
452 }
453 if (desc->showcmd)
454 {
455 r = IShellLinkA_SetShowCmd(sl, desc->showcmd);
456 lok(r == S_OK, "SetShowCmd failed (0x%08x)\n", r);
457 }
458 if (desc->icon)
459 {
460 r = IShellLinkA_SetIconLocation(sl, desc->icon, desc->icon_id);
461 lok(r == S_OK, "SetIconLocation failed (0x%08x)\n", r);
462 }
463 if (desc->hotkey)
464 {
465 r = IShellLinkA_SetHotkey(sl, desc->hotkey);
466 lok(r == S_OK, "SetHotkey failed (0x%08x)\n", r);
467 }
468
469 r = IShellLinkA_QueryInterface(sl, &IID_IPersistFile, (void**)&pf);
470 lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
471 if (r == S_OK)
472 {
474
475 if (0)
476 {
477 /* crashes on XP */
478 IPersistFile_GetCurFile(pf, NULL);
479 }
480
481 /* test GetCurFile before ::Save */
482 str = (LPWSTR)0xdeadbeef;
483 r = IPersistFile_GetCurFile(pf, &str);
484 lok(r == S_FALSE ||
485 broken(r == S_OK), /* shell32 < 5.0 */
486 "got 0x%08x\n", r);
487 lok(str == NULL, "got %p\n", str);
488
489 r = IPersistFile_Save(pf, path, TRUE);
490 todo_wine_if (save_fails)
491 lok(r == S_OK, "save failed (0x%08x)\n", r);
492
493 /* test GetCurFile after ::Save */
494 r = IPersistFile_GetCurFile(pf, &str);
495 lok(r == S_OK, "got 0x%08x\n", r);
496 lok(str != NULL ||
497 broken(str == NULL), /* shell32 < 5.0 */
498 "Didn't expect NULL\n");
499 if (str != NULL)
500 {
502
503 lok(!winetest_strcmpW(path, str), "Expected %s, got %s\n",
505
507 IMalloc_Free(pmalloc, str);
508 }
509 else
510 win_skip("GetCurFile fails on shell32 < 5.0\n");
511
512 IPersistFile_Release(pf);
513 }
514
515 IShellLinkA_Release(sl);
516}
#define broken(x)
Definition: atltest.h:178
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:285
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define wine_dbgstr_w
Definition: kernel32.h:34
static const WCHAR desc[]
Definition: protectdata.c:36
#define todo_wine_if(is_todo)
Definition: custom.c:86
static void *__cdecl * pmalloc(unsigned int)
static LPOLESTR
Definition: stg_prop.c:27
const GUID IID_IPersistFile
const WCHAR * str
#define win_skip
Definition: test.h:163
static int winetest_strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: test.h:97
#define S_FALSE
Definition: winerror.h:2357
WCHAR * LPWSTR
Definition: xmlstorage.h:184