ole32: Stub for IDirectWriterLock.
This commit is contained in:
parent
c29f3dff8c
commit
a06db6cce5
|
@ -71,6 +71,11 @@ static inline StorageBaseImpl *impl_from_IStorage( IStorage *iface )
|
|||
return CONTAINING_RECORD(iface, StorageBaseImpl, IStorage_iface);
|
||||
}
|
||||
|
||||
static inline StorageBaseImpl *impl_from_IDirectWriterLock( IDirectWriterLock *iface )
|
||||
{
|
||||
return CONTAINING_RECORD(iface, StorageBaseImpl, IDirectWriterLock_iface);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Storage32InternalImpl definitions.
|
||||
*
|
||||
|
@ -380,6 +385,12 @@ static HRESULT WINAPI StorageBaseImpl_QueryInterface(
|
|||
{
|
||||
*ppvObject = &This->IPropertySetStorage_iface;
|
||||
}
|
||||
/* locking interface is report for writer only */
|
||||
else if (IsEqualGUID(&IID_IDirectWriterLock, riid) &&
|
||||
(This->openFlags == (STGM_DIRECT_SWMR|STGM_READWRITE|STGM_SHARE_DENY_WRITE)))
|
||||
{
|
||||
*ppvObject = &This->IDirectWriterLock_iface;
|
||||
}
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
|
||||
|
@ -2648,6 +2659,55 @@ static HRESULT StorageImpl_GetFilename(StorageBaseImpl* iface, LPWSTR *result)
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI directwriterlock_QueryInterface(IDirectWriterLock *iface, REFIID riid, void **obj)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
return IStorage_QueryInterface(&This->IStorage_iface, riid, obj);
|
||||
}
|
||||
|
||||
static ULONG WINAPI directwriterlock_AddRef(IDirectWriterLock *iface)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
return IStorage_AddRef(&This->IStorage_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI directwriterlock_Release(IDirectWriterLock *iface)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
return IStorage_Release(&This->IStorage_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI directwriterlock_WaitForWriteAccess(IDirectWriterLock *iface, DWORD timeout)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
FIXME("(%p)->(%d): stub\n", This, timeout);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI directwriterlock_ReleaseWriteAccess(IDirectWriterLock *iface)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
FIXME("(%p): stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI directwriterlock_HaveWriteAccess(IDirectWriterLock *iface)
|
||||
{
|
||||
StorageBaseImpl *This = impl_from_IDirectWriterLock(iface);
|
||||
FIXME("(%p): stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IDirectWriterLockVtbl DirectWriterLockVtbl =
|
||||
{
|
||||
directwriterlock_QueryInterface,
|
||||
directwriterlock_AddRef,
|
||||
directwriterlock_Release,
|
||||
directwriterlock_WaitForWriteAccess,
|
||||
directwriterlock_ReleaseWriteAccess,
|
||||
directwriterlock_HaveWriteAccess
|
||||
};
|
||||
|
||||
/*
|
||||
* Virtual function table for the IStorage32Impl class.
|
||||
*/
|
||||
|
@ -2719,6 +2779,7 @@ static HRESULT StorageImpl_Construct(
|
|||
|
||||
This->base.IStorage_iface.lpVtbl = &Storage32Impl_Vtbl;
|
||||
This->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl;
|
||||
This->base.IDirectWriterLock_iface.lpVtbl = &DirectWriterLockVtbl;
|
||||
This->base.baseVtbl = &StorageImpl_BaseVtbl;
|
||||
This->base.openFlags = (openFlags & ~STGM_CREATE);
|
||||
This->base.ref = 1;
|
||||
|
@ -7631,10 +7692,10 @@ HRESULT WINAPI StgOpenStorage(
|
|||
goto end;
|
||||
}
|
||||
|
||||
/* shared reading requires transacted mode */
|
||||
/* shared reading requires transacted or single writer mode */
|
||||
if( STGM_SHARE_MODE(grfMode) == STGM_SHARE_DENY_WRITE &&
|
||||
STGM_ACCESS_MODE(grfMode) == STGM_READWRITE &&
|
||||
!(grfMode&STGM_TRANSACTED) )
|
||||
!(grfMode & STGM_TRANSACTED) && !(grfMode & STGM_DIRECT_SWMR))
|
||||
{
|
||||
hr = STG_E_INVALIDFLAG;
|
||||
goto end;
|
||||
|
|
|
@ -177,6 +177,7 @@ struct StorageBaseImpl
|
|||
{
|
||||
IStorage IStorage_iface;
|
||||
IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */
|
||||
IDirectWriterLock IDirectWriterLock_iface;
|
||||
LONG ref;
|
||||
|
||||
/*
|
||||
|
|
|
@ -3046,6 +3046,55 @@ static void test_convert(void)
|
|||
DeleteFileW(filename);
|
||||
}
|
||||
|
||||
static void test_direct_swmr(void)
|
||||
{
|
||||
static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0};
|
||||
IDirectWriterLock *dwlock;
|
||||
ULONG ref, ref2;
|
||||
IStorage *stg;
|
||||
HRESULT hr;
|
||||
|
||||
/* it's possible to create in writer mode */
|
||||
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_DIRECT_SWMR, 0, &stg);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
if (hr == S_OK) {
|
||||
IStorage_Release(stg);
|
||||
DeleteFileW(fileW);
|
||||
}
|
||||
|
||||
hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
IStorage_Release(stg);
|
||||
|
||||
/* reader mode */
|
||||
hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock);
|
||||
ok(hr == E_NOINTERFACE, "got %08x\n", hr);
|
||||
IStorage_Release(stg);
|
||||
|
||||
/* writer mode */
|
||||
hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READWRITE | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
ref = IStorage_AddRef(stg);
|
||||
IStorage_Release(stg);
|
||||
|
||||
hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
ref2 = IStorage_AddRef(stg);
|
||||
IStorage_Release(stg);
|
||||
ok(ref2 == ref + 1, "got %u\n", ref2);
|
||||
|
||||
IDirectWriterLock_Release(dwlock);
|
||||
IStorage_Release(stg);
|
||||
|
||||
DeleteFileW(fileW);
|
||||
}
|
||||
|
||||
START_TEST(storage32)
|
||||
{
|
||||
CHAR temp[MAX_PATH];
|
||||
|
@ -3090,4 +3139,5 @@ START_TEST(storage32)
|
|||
test_copyto_recursive();
|
||||
test_hglobal_storage_creation();
|
||||
test_convert();
|
||||
test_direct_swmr();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue