shlexec.cpp (9b716539) shlexec.cpp (d82185f1)
1/*
2 * Shell Library Functions
3 *
4 * Copyright 1998 Marcus Meissner
5 * Copyright 2002 Eric Pouech
6 * Copyright 2018-2019 Katayama Hirofumi MZ
7 *
8 * This library is free software; you can redistribute it and/or

--- 1416 unchanged lines hidden (view full) ---

1425 TRACE("invoke command returned %08x\n", r);
1426
1427end:
1428 if (hmenu)
1429 DestroyMenu( hmenu );
1430 return r;
1431}
1432
1/*
2 * Shell Library Functions
3 *
4 * Copyright 1998 Marcus Meissner
5 * Copyright 2002 Eric Pouech
6 * Copyright 2018-2019 Katayama Hirofumi MZ
7 *
8 * This library is free software; you can redistribute it and/or

--- 1416 unchanged lines hidden (view full) ---

1425 TRACE("invoke command returned %08x\n", r);
1426
1427end:
1428 if (hmenu)
1429 DestroyMenu( hmenu );
1430 return r;
1431}
1432
1433namespace
1434{
1435 struct CCoInit
1436 {
1437 CCoInit() { hres = CoInitialize(NULL); }
1438 ~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
1439 HRESULT hres;
1440 };
1441}
1442
1443static HRESULT shellex_load_object_and_run(HKEY hkey, LPCGUID guid, LPSHELLEXECUTEINFOW sei)
1444{
1445 TRACE("%p %s %p\n", hkey, debugstr_guid(guid), sei);
1446
1447 CCoInit coInit;
1448
1433static HRESULT shellex_load_object_and_run(HKEY hkey, LPCGUID guid, LPSHELLEXECUTEINFOW sei)
1434{
1435 TRACE("%p %s %p\n", hkey, debugstr_guid(guid), sei);
1436
1437 CCoInit coInit;
1438
1449 if (FAILED_UNEXPECTEDLY(coInit.hres))
1450 return coInit.hres;
1439 if (FAILED_UNEXPECTEDLY(coInit.hr))
1440 return coInit.hr;
1451
1452 CComPtr<IShellExtInit> obj;
1453 HRESULT hr = CoCreateInstance(*guid, NULL, CLSCTX_INPROC_SERVER,
1454 IID_PPV_ARG(IShellExtInit, &obj));
1455 if (FAILED_UNEXPECTEDLY(hr))
1456 return hr;
1457
1458 CComPtr<IDataObject> dataobj;

--- 55 unchanged lines hidden (view full) ---

1514}
1515
1516static HRESULT ShellExecute_ContextMenuVerb(LPSHELLEXECUTEINFOW sei)
1517{
1518 TRACE("%p\n", sei);
1519
1520 CCoInit coInit;
1521
1441
1442 CComPtr<IShellExtInit> obj;
1443 HRESULT hr = CoCreateInstance(*guid, NULL, CLSCTX_INPROC_SERVER,
1444 IID_PPV_ARG(IShellExtInit, &obj));
1445 if (FAILED_UNEXPECTEDLY(hr))
1446 return hr;
1447
1448 CComPtr<IDataObject> dataobj;

--- 55 unchanged lines hidden (view full) ---

1504}
1505
1506static HRESULT ShellExecute_ContextMenuVerb(LPSHELLEXECUTEINFOW sei)
1507{
1508 TRACE("%p\n", sei);
1509
1510 CCoInit coInit;
1511
1522 if (FAILED_UNEXPECTEDLY(coInit.hres))
1523 return coInit.hres;
1512 if (FAILED_UNEXPECTEDLY(coInit.hr))
1513 return coInit.hr;
1524
1525 CComPtr<IContextMenu> cm;
1526 HRESULT hr = shellex_get_contextmenu(sei, cm);
1527 if (FAILED_UNEXPECTEDLY(hr))
1528 return hr;
1529
1530 CComHeapPtr<char> verb, parameters;
1531 __SHCloneStrWtoA(&verb, sei->lpVerb);

--- 1114 unchanged lines hidden ---
1514
1515 CComPtr<IContextMenu> cm;
1516 HRESULT hr = shellex_get_contextmenu(sei, cm);
1517 if (FAILED_UNEXPECTEDLY(hr))
1518 return hr;
1519
1520 CComHeapPtr<char> verb, parameters;
1521 __SHCloneStrWtoA(&verb, sei->lpVerb);

--- 1114 unchanged lines hidden ---