mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +00:00
[OLE32_WINETEST]
* Sync with Wine 1.5.19. svn path=/trunk/; revision=57896
This commit is contained in:
parent
5acb061f2b
commit
ee729eb861
12 changed files with 522 additions and 56 deletions
|
@ -1,7 +1,5 @@
|
|||
|
||||
add_definitions(
|
||||
-D__ROS_LONG64__
|
||||
-D_DLL -D__USE_CRTIMP)
|
||||
add_definitions(-D__ROS_LONG64__)
|
||||
|
||||
list(APPEND SOURCE
|
||||
clipboard.c
|
||||
|
|
|
@ -740,7 +740,7 @@ static void test_cf_dataobject(IDataObject *data)
|
|||
break;
|
||||
}
|
||||
cfs_seen[count] = fmt.cfFormat;
|
||||
ok(fmt_ptr->first_use_of_cf == seen_cf ? FALSE : TRUE, "got %08x expected %08x\n",
|
||||
ok(fmt_ptr->first_use_of_cf != seen_cf, "got %08x expected %08x\n",
|
||||
fmt_ptr->first_use_of_cf, !seen_cf);
|
||||
ok(fmt_ptr->res[0] == 0, "got %08x\n", fmt_ptr->res[1]);
|
||||
ok(fmt_ptr->res[1] == 0, "got %08x\n", fmt_ptr->res[2]);
|
||||
|
|
|
@ -43,6 +43,7 @@ static HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv);
|
|||
static HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject);
|
||||
static HRESULT (WINAPI * pCoGetTreatAsClass)(REFCLSID clsidOld, LPCLSID pClsidNew);
|
||||
static HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token);
|
||||
static LONG (WINAPI * pRegOverridePredefKey)(HKEY key, HKEY override);
|
||||
|
||||
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
|
||||
#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
|
||||
|
@ -385,6 +386,8 @@ static void test_CoGetClassObject(void)
|
|||
IUnknown *pUnk;
|
||||
struct info info;
|
||||
REFCLSID rclsid = &CLSID_InternetZoneManager;
|
||||
HKEY hkey;
|
||||
LONG res;
|
||||
|
||||
hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
|
||||
|
@ -429,6 +432,30 @@ static void test_CoGetClassObject(void)
|
|||
CloseHandle(thread);
|
||||
CloseHandle(info.wait);
|
||||
CloseHandle(info.stop);
|
||||
|
||||
pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
|
||||
hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
IUnknown_Release(pUnk);
|
||||
|
||||
res = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &hkey);
|
||||
ok(!res, "RegOpenKeyExA returned %d\n", res);
|
||||
|
||||
res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
|
||||
ok(!res, "RegOverridePredefKey returned %d\n", res);
|
||||
|
||||
hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
|
||||
|
||||
res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
|
||||
ok(!res, "RegOverridePredefKey returned %d\n", res);
|
||||
|
||||
if (hr == S_OK) IUnknown_Release(pUnk);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
static ATOM register_dummy_class(void)
|
||||
|
@ -717,6 +744,8 @@ static void test_CoGetPSClsid(void)
|
|||
{
|
||||
HRESULT hr;
|
||||
CLSID clsid;
|
||||
HKEY hkey;
|
||||
LONG res;
|
||||
|
||||
hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
|
||||
ok(hr == CO_E_NOTINITIALIZED,
|
||||
|
@ -738,6 +767,28 @@ static void test_CoGetPSClsid(void)
|
|||
"CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
|
||||
hr);
|
||||
|
||||
if (!pRegOverridePredefKey)
|
||||
{
|
||||
win_skip("RegOverridePredefKey not available\n");
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
|
||||
ok_ole_success(hr, "CoGetPSClsid");
|
||||
|
||||
res = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &hkey);
|
||||
ok(!res, "RegOpenKeyExA returned %d\n", res);
|
||||
|
||||
res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
|
||||
ok(!res, "RegOverridePredefKey returned %d\n", res);
|
||||
|
||||
hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
|
||||
ok_ole_success(hr, "CoGetPSClsid");
|
||||
|
||||
res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
|
||||
ok(!res, "RegOverridePredefKey returned %d\n", res);
|
||||
|
||||
RegCloseKey(hkey);
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1163,7 @@ static DWORD CALLBACK free_libraries_thread(LPVOID p)
|
|||
|
||||
static inline BOOL is_module_loaded(const char *module)
|
||||
{
|
||||
return GetModuleHandle(module) ? TRUE : FALSE;
|
||||
return GetModuleHandle(module) != 0;
|
||||
}
|
||||
|
||||
static void test_CoFreeUnusedLibraries(void)
|
||||
|
@ -1514,10 +1565,12 @@ static void test_CoInitializeEx(void)
|
|||
START_TEST(compobj)
|
||||
{
|
||||
HMODULE hOle32 = GetModuleHandle("ole32");
|
||||
HMODULE hAdvapi32 = GetModuleHandle("advapi32");
|
||||
pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
|
||||
pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
|
||||
pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass");
|
||||
pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
|
||||
pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
|
||||
if (!(pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx")))
|
||||
{
|
||||
trace("You need DCOM95 installed to run this test\n");
|
||||
|
|
|
@ -43,7 +43,7 @@ static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget* iface, REFIID riid,
|
|||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDropTarget))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
IDropTarget_AddRef(iface);
|
||||
*ppvObject = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -47,10 +47,15 @@ static void test_error_info(void)
|
|||
static WCHAR wszDescription[] = {'F','a','i','l','e','d',' ','S','p','r','o','c','k','e','t',0};
|
||||
static WCHAR wszHelpFile[] = {'s','p','r','o','c','k','e','t','.','h','l','p',0};
|
||||
static WCHAR wszSource[] = {'s','p','r','o','c','k','e','t',0};
|
||||
IUnknown *unk;
|
||||
|
||||
hr = CreateErrorInfo(&pCreateErrorInfo);
|
||||
ok_ole_success(hr, "CreateErrorInfo");
|
||||
|
||||
hr = ICreateErrorInfo_QueryInterface(pCreateErrorInfo, &IID_IUnknown, (void**)&unk);
|
||||
ok_ole_success(hr, "QI");
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = ICreateErrorInfo_SetDescription(pCreateErrorInfo, NULL);
|
||||
ok_ole_success(hr, "ICreateErrorInfo_SetDescription");
|
||||
|
||||
|
@ -78,6 +83,10 @@ static void test_error_info(void)
|
|||
hr = ICreateErrorInfo_QueryInterface(pCreateErrorInfo, &IID_IErrorInfo, (void **)&pErrorInfo);
|
||||
ok_ole_success(hr, "ICreateErrorInfo_QueryInterface");
|
||||
|
||||
hr = IErrorInfo_QueryInterface(pErrorInfo, &IID_IUnknown, (void**)&unk);
|
||||
ok_ole_success(hr, "QI");
|
||||
IUnknown_Release(unk);
|
||||
|
||||
ICreateErrorInfo_Release(pCreateErrorInfo);
|
||||
|
||||
hr = SetErrorInfo(0, pErrorInfo);
|
||||
|
|
|
@ -299,7 +299,7 @@ static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, voi
|
|||
IsEqualIID(riid, &IID_IStream))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
IStream_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = NULL;
|
||||
|
|
|
@ -1331,6 +1331,9 @@ static void test_disconnect_stub(void)
|
|||
CoDisconnectObject((IUnknown*)&Test_ClassFactory, 0);
|
||||
|
||||
ok_no_locks();
|
||||
|
||||
hr = CoDisconnectObject(NULL, 0);
|
||||
ok( hr == E_INVALIDARG, "wrong status %x\n", hr );
|
||||
}
|
||||
|
||||
/* tests failure case of a same-thread marshal and unmarshal twice */
|
||||
|
@ -1439,7 +1442,7 @@ static DWORD CALLBACK bad_thread_proc(LPVOID p)
|
|||
trace("call to proxy's QueryInterface from wrong apartment returned 0x%08x\n", hr);
|
||||
|
||||
/* now be really bad and release the proxy from the wrong apartment */
|
||||
IUnknown_Release(cf);
|
||||
IClassFactory_Release(cf);
|
||||
|
||||
CoUninitialize();
|
||||
|
||||
|
@ -1472,7 +1475,7 @@ static void test_proxy_used_in_wrong_thread(void)
|
|||
ok_more_than_one_lock();
|
||||
|
||||
/* do a call that will fail, but result in IRemUnknown being used by the proxy */
|
||||
IClassFactory_QueryInterface(pProxy, &IID_IStream, (LPVOID *)&pStream);
|
||||
IUnknown_QueryInterface(pProxy, &IID_IStream, (LPVOID *)&pStream);
|
||||
|
||||
/* create a thread that we can misbehave in */
|
||||
thread = CreateThread(NULL, 0, bad_thread_proc, pProxy, 0, &tid2);
|
||||
|
@ -1497,7 +1500,7 @@ static HRESULT WINAPI MessageFilter_QueryInterface(IMessageFilter *iface, REFIID
|
|||
IsEqualGUID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppvObj = iface;
|
||||
IClassFactory_AddRef(iface);
|
||||
IMessageFilter_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -2346,7 +2349,7 @@ static HRESULT WINAPI Test_SMI_QueryInterface(
|
|||
IsEqualGUID(riid, &IID_IStdMarshalInfo))
|
||||
{
|
||||
*ppvObj = iface;
|
||||
IClassFactory_AddRef(iface);
|
||||
IStdMarshalInfo_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -2468,10 +2471,10 @@ static void test_client_security(void)
|
|||
ok_ole_success(hr, "CoUnmarshalInterface");
|
||||
IStream_Release(pStream);
|
||||
|
||||
hr = IUnknown_QueryInterface(pProxy, &IID_IUnknown, (LPVOID*)&pUnknown1);
|
||||
hr = IClassFactory_QueryInterface(pProxy, &IID_IUnknown, (LPVOID*)&pUnknown1);
|
||||
ok_ole_success(hr, "IUnknown_QueryInterface IID_IUnknown");
|
||||
|
||||
hr = IUnknown_QueryInterface(pProxy, &IID_IRemUnknown, (LPVOID*)&pProxy2);
|
||||
hr = IClassFactory_QueryInterface(pProxy, &IID_IRemUnknown, (LPVOID*)&pProxy2);
|
||||
ok_ole_success(hr, "IUnknown_QueryInterface IID_IStream");
|
||||
|
||||
hr = IUnknown_QueryInterface(pProxy2, &IID_IUnknown, (LPVOID*)&pUnknown2);
|
||||
|
@ -2479,10 +2482,10 @@ static void test_client_security(void)
|
|||
|
||||
ok(pUnknown1 == pUnknown2, "both proxy's IUnknowns should be the same - %p, %p\n", pUnknown1, pUnknown2);
|
||||
|
||||
hr = IUnknown_QueryInterface(pProxy, &IID_IMarshal, (LPVOID*)&pMarshal);
|
||||
hr = IClassFactory_QueryInterface(pProxy, &IID_IMarshal, (LPVOID*)&pMarshal);
|
||||
ok_ole_success(hr, "IUnknown_QueryInterface IID_IMarshal");
|
||||
|
||||
hr = IUnknown_QueryInterface(pProxy, &IID_IClientSecurity, (LPVOID*)&pCliSec);
|
||||
hr = IClassFactory_QueryInterface(pProxy, &IID_IClientSecurity, (LPVOID*)&pCliSec);
|
||||
ok_ole_success(hr, "IUnknown_QueryInterface IID_IClientSecurity");
|
||||
|
||||
hr = IClientSecurity_QueryBlanket(pCliSec, (IUnknown *)pProxy, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
@ -2850,8 +2853,10 @@ static void test_globalinterfacetable(void)
|
|||
|
||||
static void test_manualresetevent(void)
|
||||
{
|
||||
ISynchronizeHandle *sync_handle;
|
||||
ISynchronize *psync1, *psync2;
|
||||
IUnknown *punk;
|
||||
HANDLE handle;
|
||||
LONG ref;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -2884,6 +2889,17 @@ static void test_manualresetevent(void)
|
|||
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||
ok(!!psync2, "Got NULL.\n");
|
||||
ok(psync1 != psync2, "psync1 == psync2.\n");
|
||||
|
||||
hr = ISynchronize_QueryInterface(psync2, &IID_ISynchronizeHandle, (void**)&sync_handle);
|
||||
ok(hr == S_OK, "QueryInterface(IID_ISynchronizeHandle) failed: %08x\n", hr);
|
||||
|
||||
handle = NULL;
|
||||
hr = ISynchronizeHandle_GetHandle(sync_handle, &handle);
|
||||
ok(hr == S_OK, "GetHandle failed: %08x\n", hr);
|
||||
ok(handle != NULL && handle != INVALID_HANDLE_VALUE, "handle = %p\n", handle);
|
||||
|
||||
ISynchronizeHandle_Release(sync_handle);
|
||||
|
||||
hr = ISynchronize_Wait(psync2, 0, 5);
|
||||
ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr);
|
||||
|
||||
|
@ -2939,7 +2955,7 @@ static HRESULT WINAPI TestChannelHook_QueryInterface(IChannelHook *iface, REFIID
|
|||
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IChannelHook))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
IChannelHook_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -723,7 +723,7 @@ static HRESULT WINAPI ParseDisplayName_QueryInterface(IParseDisplayName *iface,
|
|||
IsEqualIID(riid, &IID_IParseDisplayName))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
IParseDisplayName_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = NULL;
|
||||
|
|
|
@ -616,7 +616,7 @@ static HRESULT WINAPI OleObjectCF_QueryInterface(IClassFactory *iface, REFIID ri
|
|||
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
IClassFactory_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = NULL;
|
||||
|
@ -726,6 +726,84 @@ static IRunnableObject OleObjectRunnable = { &OleObjectRunnableVtbl };
|
|||
|
||||
static const CLSID CLSID_Equation3 = {0x0002CE02, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };
|
||||
|
||||
static HRESULT WINAPI viewobject_QueryInterface(IViewObject *iface, REFIID riid, void **obj)
|
||||
{
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IViewObject))
|
||||
{
|
||||
*obj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI viewobject_AddRef(IViewObject *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI viewobject_Release(IViewObject *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_Draw(IViewObject *iface, DWORD aspect, LONG index,
|
||||
void *paspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw,
|
||||
LPCRECTL bounds, LPCRECTL wbounds, BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
|
||||
ULONG_PTR dwContinue)
|
||||
{
|
||||
ok(index == -1, "index=%d\n", index);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_GetColorSet(IViewObject *iface, DWORD draw_aspect, LONG index,
|
||||
void *aspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **colorset)
|
||||
{
|
||||
ok(0, "unexpected call GetColorSet\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_Freeze(IViewObject *iface, DWORD draw_aspect, LONG index,
|
||||
void *aspect, DWORD *freeze)
|
||||
{
|
||||
ok(0, "unexpected call Freeze\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_Unfreeze(IViewObject *iface, DWORD freeze)
|
||||
{
|
||||
ok(0, "unexpected call Unfreeze\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_SetAdvise(IViewObject *iface, DWORD aspects, DWORD advf, IAdviseSink *sink)
|
||||
{
|
||||
ok(0, "unexpected call SetAdvise\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI viewobject_GetAdvise(IViewObject *iface, DWORD *aspects, DWORD *advf,
|
||||
IAdviseSink **sink)
|
||||
{
|
||||
ok(0, "unexpected call GetAdvise\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const struct IViewObjectVtbl viewobjectvtbl = {
|
||||
viewobject_QueryInterface,
|
||||
viewobject_AddRef,
|
||||
viewobject_Release,
|
||||
viewobject_Draw,
|
||||
viewobject_GetColorSet,
|
||||
viewobject_Freeze,
|
||||
viewobject_Unfreeze,
|
||||
viewobject_SetAdvise,
|
||||
viewobject_GetAdvise
|
||||
};
|
||||
|
||||
static IViewObject viewobject = { &viewobjectvtbl };
|
||||
|
||||
static void test_OleCreate(IStorage *pStorage)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -997,7 +1075,7 @@ static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid,
|
|||
if (IsEqualIID(riid, &IID_IAdviseSink) || IsEqualIID(riid, &IID_IUnknown))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
IAdviseSink_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = NULL;
|
||||
|
@ -1279,11 +1357,11 @@ static void test_data_cache(void)
|
|||
hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
|
||||
ok_ole_success(hr, "CreateDataCache");
|
||||
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
|
||||
|
||||
hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
|
||||
|
@ -1299,16 +1377,16 @@ static void test_data_cache(void)
|
|||
ok_ole_success(hr, "IPersistStorage_GetClassID");
|
||||
ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
|
||||
|
||||
hr = IOleCache_Uncache(pOleCache, 0xdeadbeef);
|
||||
hr = IOleCache2_Uncache(pOleCache, 0xdeadbeef);
|
||||
ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
|
||||
|
||||
/* Both tests crash on NT4 and below. StgCreatePropSetStg is only available on w2k and above. */
|
||||
if (GetProcAddress(GetModuleHandleA("ole32.dll"), "StgCreatePropSetStg"))
|
||||
{
|
||||
hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, NULL, 0, &dwConnection);
|
||||
ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
|
||||
hr = IOleCache_Cache(pOleCache, NULL, 0, NULL);
|
||||
hr = IOleCache2_Cache(pOleCache, NULL, 0, NULL);
|
||||
ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
}
|
||||
else
|
||||
|
@ -1323,7 +1401,7 @@ static void test_data_cache(void)
|
|||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
fmtetc.tymed = 1 << i;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
if ((fmtetc.cfFormat == CF_METAFILEPICT && fmtetc.tymed == TYMED_MFPICT) ||
|
||||
(fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
|
||||
(fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
|
||||
|
@ -1340,7 +1418,7 @@ static void test_data_cache(void)
|
|||
fmtetc.cfFormat, fmtetc.tymed, hr);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = IOleCache_Uncache(pOleCache, dwConnection);
|
||||
hr = IOleCache2_Uncache(pOleCache, dwConnection);
|
||||
ok_ole_success(hr, "IOleCache_Uncache");
|
||||
}
|
||||
}
|
||||
|
@ -1349,13 +1427,13 @@ static void test_data_cache(void)
|
|||
fmtetc.cfFormat = CF_BITMAP;
|
||||
fmtetc.dwAspect = DVASPECT_THUMBNAIL;
|
||||
fmtetc.tymed = TYMED_GDI;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok_ole_success(hr, "IOleCache_Cache");
|
||||
|
||||
fmtetc.cfFormat = 0;
|
||||
fmtetc.dwAspect = DVASPECT_ICON;
|
||||
fmtetc.tymed = TYMED_MFPICT;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok_ole_success(hr, "IOleCache_Cache");
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
|
||||
|
@ -1368,11 +1446,11 @@ static void test_data_cache(void)
|
|||
stgmedium.pUnkForRelease = NULL;
|
||||
|
||||
fmtetc.dwAspect = DVASPECT_CONTENT;
|
||||
hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
|
||||
hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
|
||||
ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
|
||||
|
||||
fmtetc.dwAspect = DVASPECT_ICON;
|
||||
hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
|
||||
hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
|
||||
ok_ole_success(hr, "IOleCache_SetData");
|
||||
ReleaseStgMedium(&stgmedium);
|
||||
|
||||
|
@ -1421,7 +1499,7 @@ static void test_data_cache(void)
|
|||
|
||||
IPersistStorage_Release(pPS);
|
||||
IViewObject_Release(pViewObject);
|
||||
IOleCache_Release(pOleCache);
|
||||
IOleCache2_Release(pOleCache);
|
||||
IOleCacheControl_Release(pOleCacheControl);
|
||||
|
||||
CHECK_NO_EXTRA_METHODS();
|
||||
|
@ -1433,9 +1511,9 @@ static void test_data_cache(void)
|
|||
hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
|
||||
ok_ole_success(hr, "CreateDataCache");
|
||||
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
|
||||
|
||||
hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
|
||||
|
@ -1452,7 +1530,7 @@ static void test_data_cache(void)
|
|||
fmtetc.lindex = -1;
|
||||
fmtetc.ptd = NULL;
|
||||
fmtetc.tymed = TYMED_MFPICT;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
|
||||
|
||||
rcBounds.left = 0;
|
||||
|
@ -1486,13 +1564,13 @@ static void test_data_cache(void)
|
|||
DeleteDC(hdcMem);
|
||||
|
||||
todo_wine {
|
||||
hr = IOleCache_InitCache(pOleCache, &DataObject);
|
||||
hr = IOleCache2_InitCache(pOleCache, &DataObject);
|
||||
ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
IPersistStorage_Release(pPS);
|
||||
IViewObject_Release(pViewObject);
|
||||
IOleCache_Release(pOleCache);
|
||||
IOleCache2_Release(pOleCache);
|
||||
|
||||
todo_wine {
|
||||
CHECK_NO_EXTRA_METHODS();
|
||||
|
@ -1503,16 +1581,16 @@ static void test_data_cache(void)
|
|||
|
||||
expected_method_list = methods_cachethenrun;
|
||||
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IDataObject)");
|
||||
hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
|
||||
hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
|
||||
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
|
||||
|
||||
fmtetc.cfFormat = CF_METAFILEPICT;
|
||||
fmtetc.dwAspect = DVASPECT_CONTENT;
|
||||
fmtetc.tymed = TYMED_MFPICT;
|
||||
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok_ole_success(hr, "IOleCache_Cache");
|
||||
|
||||
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
|
||||
|
@ -1522,14 +1600,14 @@ static void test_data_cache(void)
|
|||
fmtetc.dwAspect = DVASPECT_CONTENT;
|
||||
fmtetc.tymed = TYMED_HGLOBAL;
|
||||
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
|
||||
|
||||
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
|
||||
ok(hr == OLE_E_BLANK, "got %08x\n", hr);
|
||||
|
||||
fmtetc.cfFormat = cf_test_2;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
|
||||
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
|
||||
|
||||
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
|
||||
|
@ -1539,7 +1617,7 @@ static void test_data_cache(void)
|
|||
ok_ole_success(hr, "IOleCacheControl_OnRun");
|
||||
|
||||
fmtetc.cfFormat = cf_test_3;
|
||||
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
|
||||
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
|
||||
|
||||
fmtetc.cfFormat = cf_test_1;
|
||||
|
@ -1557,7 +1635,7 @@ static void test_data_cache(void)
|
|||
|
||||
IOleCacheControl_Release(pOleCacheControl);
|
||||
IDataObject_Release(pCacheDataObject);
|
||||
IOleCache_Release(pOleCache);
|
||||
IOleCache2_Release(pOleCache);
|
||||
|
||||
CHECK_NO_EXTRA_METHODS();
|
||||
|
||||
|
@ -1853,6 +1931,21 @@ static void test_OleLockRunning(void)
|
|||
ok(hr == S_OK, "OleLockRunning failed 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
static void test_OleDraw(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
|
||||
hr = OleDraw((IUnknown*)&viewobject, 0, (HDC)0x1, NULL);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = OleDraw(NULL, 0, (HDC)0x1, NULL);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
|
||||
hr = OleDraw(NULL, 0, (HDC)0x1, &rect);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
START_TEST(ole2)
|
||||
{
|
||||
DWORD dwRegister;
|
||||
|
@ -1889,6 +1982,7 @@ START_TEST(ole2)
|
|||
test_default_handler();
|
||||
test_runnable();
|
||||
test_OleLockRunning();
|
||||
test_OleDraw();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ static const struct valid_mapping
|
|||
{ PROP_V1 | PROP_TODO , PROP_V1 | PROP_TODO , PROP_INV, PROP_V1 | PROP_TODO }, /* VT_UNKNOWN */
|
||||
{ PROP_V1 , PROP_V1 | PROP_TODO , PROP_INV, PROP_V1 | PROP_TODO }, /* VT_DECIMAL */
|
||||
{ PROP_INV, PROP_INV, PROP_INV, PROP_INV }, /* 15 */
|
||||
{ PROP_V1 | PROP_TODO , PROP_V1 | PROP_TODO , PROP_V1 | PROP_TODO , PROP_V1 | PROP_TODO }, /* VT_I1 */
|
||||
{ PROP_V1 , PROP_V1 | PROP_TODO , PROP_V1 , PROP_V1 | PROP_TODO }, /* VT_I1 */
|
||||
{ PROP_V0 , PROP_V1 | PROP_TODO , PROP_V0 , PROP_V1 | PROP_TODO }, /* VT_UI1 */
|
||||
{ PROP_V0 , PROP_V1 | PROP_TODO , PROP_V0 , PROP_V1 | PROP_TODO }, /* VT_UI2 */
|
||||
{ PROP_V0 , PROP_V1 | PROP_TODO , PROP_V0 , PROP_V1 | PROP_TODO }, /* VT_UI4 */
|
||||
|
@ -245,8 +245,267 @@ static void test_copy(void)
|
|||
memset(&propvarSrc, 0, sizeof(propvarSrc));
|
||||
}
|
||||
|
||||
struct _PMemoryAllocator_vtable {
|
||||
void *Allocate; /* virtual void* Allocate(ULONG cbSize); */
|
||||
void *Free; /* virtual void Free(void *pv); */
|
||||
};
|
||||
|
||||
typedef struct _PMemoryAllocator {
|
||||
struct _PMemoryAllocator_vtable *vt;
|
||||
} PMemoryAllocator;
|
||||
|
||||
#ifdef __i386__
|
||||
#define __thiscall __stdcall
|
||||
#else
|
||||
#define __thiscall __cdecl
|
||||
#endif
|
||||
|
||||
static void * __thiscall PMemoryAllocator_Allocate(PMemoryAllocator *_this, ULONG cbSize)
|
||||
{
|
||||
return CoTaskMemAlloc(cbSize);
|
||||
}
|
||||
|
||||
static void __thiscall PMemoryAllocator_Free(PMemoryAllocator *_this, void *pv)
|
||||
{
|
||||
CoTaskMemFree(pv);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
#include "pshpack1.h"
|
||||
typedef struct
|
||||
{
|
||||
BYTE pop_eax; /* popl %eax */
|
||||
BYTE push_ecx; /* pushl %ecx */
|
||||
BYTE push_eax; /* pushl %eax */
|
||||
BYTE jmp_func; /* jmp $func */
|
||||
DWORD func;
|
||||
} THISCALL_TO_STDCALL_THUNK;
|
||||
#include "poppack.h"
|
||||
|
||||
static THISCALL_TO_STDCALL_THUNK *wrapperCodeMem = NULL;
|
||||
|
||||
static void fill_thunk(THISCALL_TO_STDCALL_THUNK *thunk, void *fn)
|
||||
{
|
||||
thunk->pop_eax = 0x58;
|
||||
thunk->push_ecx = 0x51;
|
||||
thunk->push_eax = 0x50;
|
||||
thunk->jmp_func = 0xe9;
|
||||
thunk->func = (char*)fn - (char*)(&thunk->func + 1);
|
||||
}
|
||||
|
||||
static void setup_vtable(struct _PMemoryAllocator_vtable *vtable)
|
||||
{
|
||||
wrapperCodeMem = VirtualAlloc(NULL, 2 * sizeof(*wrapperCodeMem),
|
||||
MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
|
||||
fill_thunk(&wrapperCodeMem[0], PMemoryAllocator_Allocate);
|
||||
fill_thunk(&wrapperCodeMem[1], PMemoryAllocator_Free);
|
||||
|
||||
vtable->Allocate = &wrapperCodeMem[0];
|
||||
vtable->Free = &wrapperCodeMem[1];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setup_vtable(struct _PMemoryAllocator_vtable *vtable)
|
||||
{
|
||||
vtable->Allocate = PMemoryAllocator_Allocate;
|
||||
vtable->Free = PMemoryAllocator_Free;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const char serialized_empty[] = {
|
||||
0,0, /* VT_EMPTY */
|
||||
0,0, /* padding */
|
||||
};
|
||||
|
||||
static const char serialized_null[] = {
|
||||
1,0, /* VT_NULL */
|
||||
0,0, /* padding */
|
||||
};
|
||||
|
||||
static const char serialized_i4[] = {
|
||||
3,0, /* VT_I4 */
|
||||
0,0, /* padding */
|
||||
0xef,0xcd,0xab,0xfe
|
||||
};
|
||||
|
||||
static const char serialized_bstr_wc[] = {
|
||||
8,0, /* VT_BSTR */
|
||||
0,0, /* padding */
|
||||
10,0,0,0, /* size */
|
||||
't',0,'e',0,
|
||||
's',0,'t',0,
|
||||
0,0,0,0
|
||||
};
|
||||
|
||||
static const char serialized_bstr_mb[] = {
|
||||
8,0, /* VT_BSTR */
|
||||
0,0, /* padding */
|
||||
5,0,0,0, /* size */
|
||||
't','e','s','t',
|
||||
0,0,0,0
|
||||
};
|
||||
|
||||
static void test_propertytovariant(void)
|
||||
{
|
||||
HANDLE hole32;
|
||||
BOOLEAN (__stdcall *pStgConvertPropertyToVariant)(const SERIALIZEDPROPERTYVALUE*,USHORT,PROPVARIANT*,PMemoryAllocator*);
|
||||
PROPVARIANT propvar;
|
||||
PMemoryAllocator allocator;
|
||||
struct _PMemoryAllocator_vtable vtable;
|
||||
BOOLEAN ret;
|
||||
static const WCHAR test_string[] = {'t','e','s','t',0};
|
||||
|
||||
hole32 = GetModuleHandleA("ole32");
|
||||
|
||||
pStgConvertPropertyToVariant = (void*)GetProcAddress(hole32, "StgConvertPropertyToVariant");
|
||||
|
||||
if (!pStgConvertPropertyToVariant)
|
||||
{
|
||||
win_skip("StgConvertPropertyToVariant not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
setup_vtable(&vtable);
|
||||
allocator.vt = &vtable;
|
||||
|
||||
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_empty,
|
||||
CP_WINUNICODE, &propvar, &allocator);
|
||||
|
||||
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
|
||||
ok(propvar.vt == VT_EMPTY, "unexpected vt %x\n", propvar.vt);
|
||||
|
||||
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_null,
|
||||
CP_WINUNICODE, &propvar, &allocator);
|
||||
|
||||
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
|
||||
ok(propvar.vt == VT_NULL, "unexpected vt %x\n", propvar.vt);
|
||||
|
||||
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_i4,
|
||||
CP_WINUNICODE, &propvar, &allocator);
|
||||
|
||||
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
|
||||
ok(propvar.vt == VT_I4, "unexpected vt %x\n", propvar.vt);
|
||||
ok(U(propvar).lVal == 0xfeabcdef, "unexpected lVal %x\n", U(propvar).lVal);
|
||||
|
||||
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_bstr_wc,
|
||||
CP_WINUNICODE, &propvar, &allocator);
|
||||
|
||||
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
|
||||
ok(propvar.vt == VT_BSTR, "unexpected vt %x\n", propvar.vt);
|
||||
ok(!lstrcmpW(U(propvar).bstrVal, test_string), "unexpected string value\n");
|
||||
PropVariantClear(&propvar);
|
||||
|
||||
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_bstr_mb,
|
||||
CP_UTF8, &propvar, &allocator);
|
||||
|
||||
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
|
||||
ok(propvar.vt == VT_BSTR, "unexpected vt %x\n", propvar.vt);
|
||||
ok(!lstrcmpW(U(propvar).bstrVal, test_string), "unexpected string value\n");
|
||||
PropVariantClear(&propvar);
|
||||
}
|
||||
|
||||
static void test_varianttoproperty(void)
|
||||
{
|
||||
HANDLE hole32;
|
||||
PROPVARIANT propvar;
|
||||
SERIALIZEDPROPERTYVALUE *propvalue, *own_propvalue;
|
||||
SERIALIZEDPROPERTYVALUE* (__stdcall *pStgConvertVariantToProperty)(
|
||||
const PROPVARIANT*,USHORT,SERIALIZEDPROPERTYVALUE*,ULONG*,PROPID,BOOLEAN,ULONG*);
|
||||
ULONG len;
|
||||
static const WCHAR test_string[] = {'t','e','s','t',0};
|
||||
BSTR test_string_bstr;
|
||||
|
||||
hole32 = GetModuleHandleA("ole32");
|
||||
|
||||
pStgConvertVariantToProperty = (void*)GetProcAddress(hole32, "StgConvertVariantToProperty");
|
||||
|
||||
if (!pStgConvertVariantToProperty)
|
||||
{
|
||||
win_skip("StgConvertVariantToProperty not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
own_propvalue = HeapAlloc(GetProcessHeap(), 0, sizeof(SERIALIZEDPROPERTYVALUE) + 20);
|
||||
|
||||
PropVariantInit(&propvar);
|
||||
|
||||
propvar.vt = VT_I4;
|
||||
U(propvar).lVal = 0xfeabcdef;
|
||||
|
||||
len = 0xdeadbeef;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_WINUNICODE, NULL, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == NULL, "got nonnull propvalue\n");
|
||||
todo_wine ok(len == 8, "unexpected length %d\n", len);
|
||||
|
||||
if (len == 0xdeadbeef)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, own_propvalue);
|
||||
return;
|
||||
}
|
||||
|
||||
len = 20;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_WINUNICODE, own_propvalue, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
|
||||
ok(len == 8, "unexpected length %d\n", len);
|
||||
ok(!memcmp(propvalue, serialized_i4, 8), "got wrong data\n");
|
||||
|
||||
propvar.vt = VT_EMPTY;
|
||||
len = 20;
|
||||
own_propvalue->dwType = 0xdeadbeef;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_WINUNICODE, own_propvalue, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
|
||||
ok(len == 4 || broken(len == 0) /* before Vista */, "unexpected length %d\n", len);
|
||||
if (len) ok(!memcmp(propvalue, serialized_empty, 4), "got wrong data\n");
|
||||
else ok(propvalue->dwType == 0xdeadbeef, "unexpected type %d\n", propvalue->dwType);
|
||||
|
||||
propvar.vt = VT_NULL;
|
||||
len = 20;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_WINUNICODE, own_propvalue, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
|
||||
ok(len == 4, "unexpected length %d\n", len);
|
||||
ok(!memcmp(propvalue, serialized_null, 4), "got wrong data\n");
|
||||
|
||||
test_string_bstr = SysAllocString(test_string);
|
||||
|
||||
propvar.vt = VT_BSTR;
|
||||
U(propvar).bstrVal = test_string_bstr;
|
||||
len = 20;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_WINUNICODE, own_propvalue, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
|
||||
ok(len == 20, "unexpected length %d\n", len);
|
||||
ok(!memcmp(propvalue, serialized_bstr_wc, 20), "got wrong data\n");
|
||||
|
||||
len = 20;
|
||||
propvalue = pStgConvertVariantToProperty(&propvar, CP_UTF8, own_propvalue, &len,
|
||||
0, FALSE, 0);
|
||||
|
||||
ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
|
||||
ok(len == 16, "unexpected length %d\n", len);
|
||||
ok(!memcmp(propvalue, serialized_bstr_mb, 16), "got wrong data\n");
|
||||
|
||||
SysFreeString(test_string_bstr);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, own_propvalue);
|
||||
}
|
||||
|
||||
START_TEST(propvariant)
|
||||
{
|
||||
test_validtypes();
|
||||
test_copy();
|
||||
test_propertytovariant();
|
||||
test_varianttoproperty();
|
||||
}
|
||||
|
|
|
@ -315,6 +315,7 @@ static void test_storage_stream(void)
|
|||
LARGE_INTEGER pos;
|
||||
ULARGE_INTEGER p;
|
||||
unsigned char buffer[0x100];
|
||||
IUnknown *unk;
|
||||
|
||||
DeleteFileA(filenameA);
|
||||
|
||||
|
@ -347,6 +348,13 @@ static void test_storage_stream(void)
|
|||
/* now really create a stream and delete it */
|
||||
r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm );
|
||||
ok(r==S_OK, "IStorage->CreateStream failed\n");
|
||||
|
||||
/* test for support interfaces */
|
||||
r = IStream_QueryInterface(stm, &IID_IPersist, (void**)&unk);
|
||||
ok(r==E_NOINTERFACE, "got 0x%08x\n", r);
|
||||
r = IStream_QueryInterface(stm, &IID_IPersistStream, (void**)&unk);
|
||||
ok(r==E_NOINTERFACE, "got 0x%08x\n", r);
|
||||
|
||||
r = IStream_Release(stm);
|
||||
ok(r == 0, "wrong ref count\n");
|
||||
r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm );
|
||||
|
@ -1324,7 +1332,7 @@ static void test_substorage_share(void)
|
|||
ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r);
|
||||
|
||||
if (r == S_OK)
|
||||
IStorage_Release(stm);
|
||||
IStream_Release(stm);
|
||||
|
||||
IStorage_Release(stg2);
|
||||
}
|
||||
|
@ -1339,13 +1347,13 @@ static void test_substorage_share(void)
|
|||
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
|
||||
|
||||
if (r == S_OK)
|
||||
IStorage_Release(stm2);
|
||||
IStream_Release(stm2);
|
||||
|
||||
r = IStorage_OpenStream(stg, stmname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm2);
|
||||
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
|
||||
|
||||
if (r == S_OK)
|
||||
IStorage_Release(stm2);
|
||||
IStream_Release(stm2);
|
||||
|
||||
/* cannot rename the stream while it's open */
|
||||
r = IStorage_RenameElement(stg, stmname, othername);
|
||||
|
@ -1359,7 +1367,7 @@ static void test_substorage_share(void)
|
|||
r = IStream_Write(stm, "this shouldn't work\n", 20, NULL);
|
||||
ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
|
||||
|
||||
IStorage_Release(stm);
|
||||
IStream_Release(stm);
|
||||
}
|
||||
|
||||
IStorage_Release(stg);
|
||||
|
@ -1513,7 +1521,7 @@ static void test_revert(void)
|
|||
ok(r==S_OK, "IStream_Write should succeed %08x\n", r);
|
||||
|
||||
IStream_Release(stm);
|
||||
IStream_Release(stg);
|
||||
IStorage_Release(stg);
|
||||
|
||||
r = DeleteFileA(filenameA);
|
||||
ok( r == TRUE, "deleted file\n");
|
||||
|
@ -1643,7 +1651,7 @@ static void test_nonroot_transacted(void)
|
|||
r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
|
||||
ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
|
||||
if (r == S_OK)
|
||||
IStream_Release(stg3);
|
||||
IStorage_Release(stg3);
|
||||
|
||||
/* But changes cannot be committed. */
|
||||
r = IStorage_Commit(stg2, 0);
|
||||
|
@ -1695,7 +1703,7 @@ static void test_nonroot_transacted(void)
|
|||
IStorage_Release(stg2);
|
||||
}
|
||||
|
||||
IStream_Release(stg);
|
||||
IStorage_Release(stg);
|
||||
|
||||
r = DeleteFileA(filenameA);
|
||||
ok( r == TRUE, "deleted file\n");
|
||||
|
@ -2001,13 +2009,13 @@ static void test_readonly(void)
|
|||
hr = IStorage_CreateStorage( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
||||
ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%x\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
IStream_Release(stg3);
|
||||
IStorage_Release(stg3);
|
||||
|
||||
/* CreateStorage on read-only storage, name does not exist */
|
||||
hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
|
||||
ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
IStream_Release(stg3);
|
||||
IStorage_Release(stg3);
|
||||
|
||||
/* DestroyElement on read-only storage, name exists */
|
||||
hr = IStorage_DestroyElement( stg2, streamW );
|
||||
|
@ -2995,6 +3003,35 @@ static void test_hglobal_storage_creation(void)
|
|||
ILockBytes_Release(ilb);
|
||||
}
|
||||
|
||||
static void test_convert(void)
|
||||
{
|
||||
static const WCHAR filename[] = {'s','t','o','r','a','g','e','.','s','t','g',0};
|
||||
IStorage *stg;
|
||||
HRESULT hr;
|
||||
|
||||
hr = GetConvertStg(NULL);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||
|
||||
hr = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
|
||||
ok(hr == S_OK, "StgCreateDocfile failed\n");
|
||||
hr = GetConvertStg(stg);
|
||||
ok(hr == STG_E_FILENOTFOUND, "got 0x%08x\n", hr);
|
||||
hr = SetConvertStg(stg, TRUE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = SetConvertStg(stg, TRUE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = GetConvertStg(stg);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = SetConvertStg(stg, FALSE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = GetConvertStg(stg);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
|
||||
IStorage_Release(stg);
|
||||
|
||||
DeleteFileW(filename);
|
||||
}
|
||||
|
||||
START_TEST(storage32)
|
||||
{
|
||||
CHAR temp[MAX_PATH];
|
||||
|
@ -3038,4 +3075,5 @@ START_TEST(storage32)
|
|||
test_copyto_locking();
|
||||
test_copyto_recursive();
|
||||
test_hglobal_storage_creation();
|
||||
test_convert();
|
||||
}
|
||||
|
|
|
@ -551,7 +551,6 @@ static IStream Test_Stream = { &TestStream_Vtbl };
|
|||
ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *, ULONG, ULONG, IUnknown *, REFIID);
|
||||
unsigned char * __RPC_USER WdtpInterfacePointer_UserMarshal(ULONG *, ULONG, unsigned char *, IUnknown *, REFIID);
|
||||
unsigned char * __RPC_USER WdtpInterfacePointer_UserUnmarshal(ULONG *, unsigned char *, IUnknown **, REFIID);
|
||||
void __RPC_USER WdtpInterfacePointer_UserFree(IUnknown *);
|
||||
|
||||
static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx)
|
||||
{
|
||||
|
@ -624,7 +623,7 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx)
|
|||
ok(unk2 != NULL, "IUnknown object didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
|
||||
WdtpInterfacePointer_UserFree(unk2);
|
||||
IUnknown_Release(unk2);
|
||||
}
|
||||
|
||||
static void test_marshal_WdtpInterfacePointer(void)
|
||||
|
|
Loading…
Reference in a new issue