Nikolay Sivov : qmgr: Implement Get/SetNotifyFlags().

Alexandre Julliard julliard at winehq.org
Wed Nov 27 14:50:06 CST 2013


Module: wine
Branch: master
Commit: 76c3f0cffb793511f0bb76bd10749102aebb9709
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=76c3f0cffb793511f0bb76bd10749102aebb9709

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Nov 27 16:49:55 2013 +0400

qmgr: Implement Get/SetNotifyFlags().

---

 dlls/qmgr/job.c       |   24 ++++++++++++++++++++----
 dlls/qmgr/qmgr.h      |    1 +
 dlls/qmgr/tests/job.c |   13 +++++++++++++
 include/bits.idl      |    1 +
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index ac7deaf..52c7b7f 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -410,8 +410,17 @@ static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags(
     ULONG Val)
 {
     BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
-    FIXME("(%p)->(%d): stub\n", This, Val);
-    return E_NOTIMPL;
+    static const ULONG valid_flags = BG_NOTIFY_JOB_TRANSFERRED |
+                                     BG_NOTIFY_JOB_ERROR |
+                                     BG_NOTIFY_DISABLE |
+                                     BG_NOTIFY_JOB_MODIFICATION |
+                                     BG_NOTIFY_FILE_TRANSFERRED;
+
+    TRACE("(%p)->(0x%x)\n", This, Val);
+
+    if (Val & ~valid_flags) return E_NOTIMPL;
+    This->notify_flags = Val;
+    return S_OK;
 }
 
 static HRESULT WINAPI BackgroundCopyJob_GetNotifyFlags(
@@ -419,8 +428,14 @@ static HRESULT WINAPI BackgroundCopyJob_GetNotifyFlags(
     ULONG *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 = This->notify_flags;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface(
@@ -689,6 +704,7 @@ 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;
 
     *job = This;
 
diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h
index 63d9f91..eb982a0 100644
--- a/dlls/qmgr/qmgr.h
+++ b/dlls/qmgr/qmgr.h
@@ -43,6 +43,7 @@ typedef struct
     struct list files;
     BG_JOB_PROGRESS jobProgress;
     BG_JOB_STATE state;
+    ULONG notify_flags;
     /* Protects file list, and progress */
     CRITICAL_SECTION cs;
     struct list entryFromQmgr;
diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c
index 1979140..f311235 100644
--- a/dlls/qmgr/tests/job.c
+++ b/dlls/qmgr/tests/job.c
@@ -414,6 +414,18 @@ static void test_CompleteLocalURL(void)
     HeapFree(GetProcessHeap(), 0, urlB);
 }
 
+static void test_NotifyFlags(void)
+{
+    ULONG flags;
+    HRESULT hr;
+
+    /* check default flags */
+    flags = 0;
+    hr = IBackgroundCopyJob_GetNotifyFlags(test_job, &flags);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(flags == (BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED), "flags 0x%08x\n", flags);
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(job)
@@ -425,6 +437,7 @@ START_TEST(job)
         test_GetProgress_preTransfer,
         test_GetState,
         test_ResumeEmpty,
+        test_NotifyFlags,
         0
     };
     static const test_t tests_bits20[] = {
diff --git a/include/bits.idl b/include/bits.idl
index 2eed38d..0e3362c 100644
--- a/include/bits.idl
+++ b/include/bits.idl
@@ -29,6 +29,7 @@ cpp_quote("#define BG_NOTIFY_JOB_TRANSFERRED 0x0001")
 cpp_quote("#define BG_NOTIFY_JOB_ERROR 0x0002")
 cpp_quote("#define BG_NOTIFY_DISABLE 0x0004")
 cpp_quote("#define BG_NOTIFY_JOB_MODIFICATION 0x0008")
+cpp_quote("#define BG_NOTIFY_FILE_TRANSFERRED 0x0010")
 
 cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
 cpp_quote("#undef EnumJobs")




More information about the wine-cvs mailing list