mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 08:30:21 +00:00
[SDK] Define CCoInit in shellutils
This commit is contained in:
parent
8083ef9ad7
commit
d82185f104
7 changed files with 30 additions and 59 deletions
|
@ -75,18 +75,11 @@ STDAPI DllUnregisterServer()
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hres = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
|
||||
HRESULT hres;
|
||||
};
|
||||
|
||||
EXTERN_C
|
||||
BOOL WINAPI GetExeFromLnk(PCWSTR pszLnk, PWSTR pszExe, size_t cchSize)
|
||||
{
|
||||
CCoInit init;
|
||||
if (FAILED_UNEXPECTEDLY(init.hres))
|
||||
if (FAILED_UNEXPECTEDLY(init.hr))
|
||||
return FALSE;
|
||||
|
||||
CComPtr<IShellLinkW> spShellLink;
|
||||
|
|
|
@ -1430,24 +1430,14 @@ end:
|
|||
return r;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hres = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
|
||||
HRESULT hres;
|
||||
};
|
||||
}
|
||||
|
||||
static HRESULT shellex_load_object_and_run(HKEY hkey, LPCGUID guid, LPSHELLEXECUTEINFOW sei)
|
||||
{
|
||||
TRACE("%p %s %p\n", hkey, debugstr_guid(guid), sei);
|
||||
|
||||
CCoInit coInit;
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(coInit.hres))
|
||||
return coInit.hres;
|
||||
if (FAILED_UNEXPECTEDLY(coInit.hr))
|
||||
return coInit.hr;
|
||||
|
||||
CComPtr<IShellExtInit> obj;
|
||||
HRESULT hr = CoCreateInstance(*guid, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -1519,8 +1509,8 @@ static HRESULT ShellExecute_ContextMenuVerb(LPSHELLEXECUTEINFOW sei)
|
|||
|
||||
CCoInit coInit;
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(coInit.hres))
|
||||
return coInit.hres;
|
||||
if (FAILED_UNEXPECTEDLY(coInit.hr))
|
||||
return coInit.hr;
|
||||
|
||||
CComPtr<IContextMenu> cm;
|
||||
HRESULT hr = shellex_get_contextmenu(sei, cm);
|
||||
|
|
|
@ -722,19 +722,12 @@ static void GetEnvStatus()
|
|||
trace("Show hidden folders: %s\n", g_ShowHidden ? "yes" : "no");
|
||||
}
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hres = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
|
||||
HRESULT hres;
|
||||
};
|
||||
|
||||
START_TEST(ACListISF)
|
||||
{
|
||||
GetEnvStatus();
|
||||
CCoInit init;
|
||||
ok_hr(init.hres, S_OK);
|
||||
if (!SUCCEEDED(init.hres))
|
||||
ok_hr(init.hr, S_OK);
|
||||
if (!SUCCEEDED(init.hr))
|
||||
{
|
||||
skip("CoInitialize failed\n");
|
||||
return;
|
||||
|
|
|
@ -32,13 +32,6 @@ ULONG DbgPrint(PCH Format,...);
|
|||
#define ok_wstri(x, y) \
|
||||
ok(lstrcmpiW(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hres = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
|
||||
HRESULT hres;
|
||||
};
|
||||
|
||||
|
||||
DEFINE_GUID(IID_IACLCustomMRU, 0xf729fc5e, 0x8769, 0x4f3e, 0xbd, 0xb2, 0xd7, 0xb5, 0x0f, 0xd2, 0x27, 0x5b);
|
||||
static const WCHAR szTestPath[] = L"TESTPATH_BROWSEUI_APITEST";
|
||||
|
@ -551,8 +544,8 @@ test_IACLCustomMRU_TypedURLs() // TypedURLs is special case
|
|||
START_TEST(IACLCustomMRU)
|
||||
{
|
||||
CCoInit init;
|
||||
ok_hex(init.hres, S_OK);
|
||||
if (!SUCCEEDED(init.hres))
|
||||
ok_hex(init.hr, S_OK);
|
||||
if (!SUCCEEDED(init.hr))
|
||||
return;
|
||||
|
||||
test_IACLCustomMRU_Basics();
|
||||
|
|
|
@ -14,20 +14,13 @@
|
|||
#include <stdio.h>
|
||||
#include <shellutils.h>
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hres = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
|
||||
HRESULT hres;
|
||||
};
|
||||
|
||||
START_TEST(IACLHistory)
|
||||
{
|
||||
CCoInit init;
|
||||
ok_hex(init.hres, S_OK);
|
||||
if (FAILED(init.hres))
|
||||
ok_hex(init.hr, S_OK);
|
||||
if (FAILED(init.hr))
|
||||
{
|
||||
skip("CoInitialize failed with 0x%08lX\n", init.hres);
|
||||
skip("CoInitialize failed with 0x%08lX\n", init.hr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <atlsimpcoll.h>
|
||||
#include <shlwapi.h>
|
||||
#include <strsafe.h>
|
||||
#include <shellutils.h>
|
||||
|
||||
//#define MANUAL_DEBUGGING
|
||||
|
||||
|
@ -23,13 +24,6 @@
|
|||
#define ok_wstri(x, y) \
|
||||
ok(lstrcmpiW(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit() { hr = CoInitialize(NULL); }
|
||||
~CCoInit() { if (SUCCEEDED(hr)) { CoUninitialize(); } }
|
||||
HRESULT hr;
|
||||
};
|
||||
|
||||
// create an EDIT control
|
||||
static HWND MyCreateEditCtrl(INT x, INT y, INT cx, INT cy)
|
||||
{
|
||||
|
|
|
@ -129,9 +129,8 @@ IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
|
|||
#define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
|
||||
public: \
|
||||
typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
template <class Base>
|
||||
class CComDebugObject : public Base
|
||||
{
|
||||
|
@ -538,6 +537,22 @@ void DumpIdList(LPCITEMIDLIST pcidl)
|
|||
DbgPrint("End IDList Dump.\n");
|
||||
}
|
||||
|
||||
struct CCoInit
|
||||
{
|
||||
CCoInit()
|
||||
{
|
||||
hr = CoInitialize(NULL);
|
||||
}
|
||||
~CCoInit()
|
||||
{
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
HRESULT hr;
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define S_LESSTHAN 0xffff
|
||||
|
|
Loading…
Reference in a new issue