qmgr: Implement Get/SetNotifyInterface().
This commit is contained in:
parent
fb3c58903d
commit
f2e9854483
|
@ -77,6 +77,8 @@ static ULONG WINAPI BackgroundCopyJob_Release(IBackgroundCopyJob2 *iface)
|
|||
{
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
if (This->callback)
|
||||
IBackgroundCopyCallback2_Release(This->callback);
|
||||
HeapFree(GetProcessHeap(), 0, This->displayName);
|
||||
HeapFree(GetProcessHeap(), 0, This->description);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
@ -418,6 +420,7 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags(
|
|||
|
||||
TRACE("(%p)->(0x%x)\n", This, Val);
|
||||
|
||||
if (is_job_done(This)) return BG_E_INVALID_STATE;
|
||||
if (Val & ~valid_flags) return E_NOTIMPL;
|
||||
This->notify_flags = Val;
|
||||
return S_OK;
|
||||
|
@ -443,8 +446,29 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface(
|
|||
IUnknown *Val)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
FIXME("(%p)->(%p): stub\n", This, Val);
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, Val);
|
||||
|
||||
if (is_job_done(This)) return BG_E_INVALID_STATE;
|
||||
|
||||
if (This->callback)
|
||||
{
|
||||
IBackgroundCopyCallback2_Release(This->callback);
|
||||
This->callback = NULL;
|
||||
This->callback2 = FALSE;
|
||||
}
|
||||
|
||||
if (Val)
|
||||
{
|
||||
hr = IUnknown_QueryInterface(Val, &IID_IBackgroundCopyCallback2, (void**)&This->callback);
|
||||
if (FAILED(hr))
|
||||
hr = IUnknown_QueryInterface(Val, &IID_IBackgroundCopyCallback, (void**)&This->callback);
|
||||
else
|
||||
This->callback2 = TRUE;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface(
|
||||
|
@ -452,8 +476,16 @@ static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface(
|
|||
IUnknown **pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
FIXME("(%p)->(%p): stub\n", This, pVal);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pVal);
|
||||
|
||||
if (!pVal) return E_INVALIDARG;
|
||||
|
||||
*pVal = (IUnknown*)This->callback;
|
||||
if (*pVal)
|
||||
IUnknown_AddRef(*pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BackgroundCopyJob_SetMinimumRetryDelay(
|
||||
|
@ -705,6 +737,8 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
|
|||
This->state = BG_JOB_STATE_SUSPENDED;
|
||||
This->description = NULL;
|
||||
This->notify_flags = BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED;
|
||||
This->callback = NULL;
|
||||
This->callback2 = FALSE;
|
||||
|
||||
*job = This;
|
||||
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
#define __QMGR_H__
|
||||
|
||||
#include "windef.h"
|
||||
#include "objbase.h"
|
||||
|
||||
#define COBJMACROS
|
||||
#include "objbase.h"
|
||||
|
||||
#include "bits1_5.h"
|
||||
#include "bits3_0.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "wine/list.h"
|
||||
|
@ -44,6 +46,8 @@ typedef struct
|
|||
BG_JOB_PROGRESS jobProgress;
|
||||
BG_JOB_STATE state;
|
||||
ULONG notify_flags;
|
||||
IBackgroundCopyCallback2 *callback;
|
||||
BOOL callback2; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
|
||||
/* Protects file list, and progress */
|
||||
CRITICAL_SECTION cs;
|
||||
struct list entryFromQmgr;
|
||||
|
|
|
@ -22,3 +22,4 @@
|
|||
|
||||
#define DO_NO_IMPORTS
|
||||
#include "bits1_5.idl"
|
||||
#include "bits3_0.idl"
|
||||
|
|
|
@ -446,6 +446,17 @@ static void test_NotifyFlags(void)
|
|||
ok(flags == (BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED), "flags 0x%08x\n", flags);
|
||||
}
|
||||
|
||||
static void test_NotifyInterface(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
IUnknown *unk;
|
||||
|
||||
unk = (IUnknown*)0xdeadbeef;
|
||||
hr = IBackgroundCopyJob_GetNotifyInterface(test_job, &unk);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(unk == NULL, "got %p\n", unk);
|
||||
}
|
||||
|
||||
typedef void (*test_t)(void);
|
||||
|
||||
START_TEST(job)
|
||||
|
@ -458,6 +469,7 @@ START_TEST(job)
|
|||
test_GetState,
|
||||
test_ResumeEmpty,
|
||||
test_NotifyFlags,
|
||||
test_NotifyInterface,
|
||||
0
|
||||
};
|
||||
static const test_t tests_bits20[] = {
|
||||
|
|
Loading…
Reference in New Issue