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