Commit f2e98544 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

qmgr: Implement Get/SetNotifyInterface().

parent fb3c5890
...@@ -77,6 +77,8 @@ static ULONG WINAPI BackgroundCopyJob_Release(IBackgroundCopyJob2 *iface) ...@@ -77,6 +77,8 @@ static ULONG WINAPI BackgroundCopyJob_Release(IBackgroundCopyJob2 *iface)
{ {
This->cs.DebugInfo->Spare[0] = 0; This->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->cs); DeleteCriticalSection(&This->cs);
if (This->callback)
IBackgroundCopyCallback2_Release(This->callback);
HeapFree(GetProcessHeap(), 0, This->displayName); HeapFree(GetProcessHeap(), 0, This->displayName);
HeapFree(GetProcessHeap(), 0, This->description); HeapFree(GetProcessHeap(), 0, This->description);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
...@@ -418,6 +420,7 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags( ...@@ -418,6 +420,7 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags(
TRACE("(%p)->(0x%x)\n", This, Val); TRACE("(%p)->(0x%x)\n", This, Val);
if (is_job_done(This)) return BG_E_INVALID_STATE;
if (Val & ~valid_flags) return E_NOTIMPL; if (Val & ~valid_flags) return E_NOTIMPL;
This->notify_flags = Val; This->notify_flags = Val;
return S_OK; return S_OK;
...@@ -443,8 +446,29 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface( ...@@ -443,8 +446,29 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface(
IUnknown *Val) IUnknown *Val)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, Val); HRESULT hr = S_OK;
return E_NOTIMPL;
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( static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface(
...@@ -452,8 +476,16 @@ static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface( ...@@ -452,8 +476,16 @@ static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface(
IUnknown **pVal) IUnknown **pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); 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( static HRESULT WINAPI BackgroundCopyJob_SetMinimumRetryDelay(
...@@ -705,6 +737,8 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID ...@@ -705,6 +737,8 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
This->state = BG_JOB_STATE_SUSPENDED; This->state = BG_JOB_STATE_SUSPENDED;
This->description = NULL; This->description = NULL;
This->notify_flags = BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED; This->notify_flags = BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED;
This->callback = NULL;
This->callback2 = FALSE;
*job = This; *job = This;
......
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
#define __QMGR_H__ #define __QMGR_H__
#include "windef.h" #include "windef.h"
#include "objbase.h"
#define COBJMACROS #define COBJMACROS
#include "objbase.h"
#include "bits1_5.h" #include "bits1_5.h"
#include "bits3_0.h"
#include <string.h> #include <string.h>
#include "wine/list.h" #include "wine/list.h"
...@@ -44,6 +46,8 @@ typedef struct ...@@ -44,6 +46,8 @@ typedef struct
BG_JOB_PROGRESS jobProgress; BG_JOB_PROGRESS jobProgress;
BG_JOB_STATE state; BG_JOB_STATE state;
ULONG notify_flags; ULONG notify_flags;
IBackgroundCopyCallback2 *callback;
BOOL callback2; /* IBackgroundCopyCallback2 is supported in addition to IBackgroundCopyCallback */
/* Protects file list, and progress */ /* Protects file list, and progress */
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
struct list entryFromQmgr; struct list entryFromQmgr;
......
...@@ -22,3 +22,4 @@ ...@@ -22,3 +22,4 @@
#define DO_NO_IMPORTS #define DO_NO_IMPORTS
#include "bits1_5.idl" #include "bits1_5.idl"
#include "bits3_0.idl"
...@@ -446,6 +446,17 @@ static void test_NotifyFlags(void) ...@@ -446,6 +446,17 @@ static void test_NotifyFlags(void)
ok(flags == (BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED), "flags 0x%08x\n", flags); 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); typedef void (*test_t)(void);
START_TEST(job) START_TEST(job)
...@@ -458,6 +469,7 @@ START_TEST(job) ...@@ -458,6 +469,7 @@ START_TEST(job)
test_GetState, test_GetState,
test_ResumeEmpty, test_ResumeEmpty,
test_NotifyFlags, test_NotifyFlags,
test_NotifyInterface,
0 0
}; };
static const test_t tests_bits20[] = { static const test_t tests_bits20[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment