diff --git a/dlls/qmgr/enum_jobs.c b/dlls/qmgr/enum_jobs.c index 7aa93467eec..54ecaabf6aa 100644 --- a/dlls/qmgr/enum_jobs.c +++ b/dlls/qmgr/enum_jobs.c @@ -120,3 +120,20 @@ static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl = BITS_IEnumBackgroundCopyJobs_Clone, BITS_IEnumBackgroundCopyJobs_GetCount }; + +HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj, + IBackgroundCopyManager* copyManager) +{ + EnumBackgroundCopyJobsImpl *This; + + TRACE("%p, %p)\n", ppObj, copyManager); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof *This); + if (!This) + return E_OUTOFMEMORY; + This->lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl; + This->ref = 1; + + *ppObj = &This->lpVtbl; + return S_OK; +} diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c index e2741590d96..c6f3db120f7 100644 --- a/dlls/qmgr/qmgr.c +++ b/dlls/qmgr/qmgr.c @@ -110,8 +110,8 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs( DWORD dwFlags, IEnumBackgroundCopyJobs **ppEnum) { - FIXME("Not implemented\n"); - return E_NOTIMPL; + TRACE("\n"); + return EnumBackgroundCopyJobsConstructor((LPVOID *) ppEnum, iface); } static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription( diff --git a/dlls/qmgr/tests/qmgr.c b/dlls/qmgr/tests/qmgr.c index e36ff36a481..07af5272c6a 100644 --- a/dlls/qmgr/tests/qmgr.c +++ b/dlls/qmgr/tests/qmgr.c @@ -84,10 +84,57 @@ static void test_CreateJob(void) IBackgroundCopyManager_Release(manager); } +static void test_EnumJobs(void) +{ + /* Job Enumerator */ + IEnumBackgroundCopyJobs* enumJobs; + + static const WCHAR copyNameW[] = {'T', 'e', 's', 't', 0}; + IBackgroundCopyManager *manager = NULL; + IBackgroundCopyJob *job = NULL; + HRESULT hres; + GUID tmpId; + ULONG res; + + /* Setup */ + hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, + CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager, + (void **) &manager); + if(hres != S_OK) + { + skip("Unable to create bits instance required for test.\n"); + return; + } + hres = IBackgroundCopyManager_CreateJob(manager, copyNameW, + BG_JOB_TYPE_DOWNLOAD, &tmpId, + &job); + if(hres != S_OK) + { + skip("Unable to create bits job.\n"); + IBackgroundCopyManager_Release(manager); + return; + } + + hres = IBackgroundCopyManager_EnumJobs(manager, 0, &enumJobs); + ok(hres == S_OK, "EnumJobs failed: %08x\n", hres); + if(hres != S_OK) + skip("Unable to create job enumerator.\n"); + else + { + res = IEnumBackgroundCopyJobs_Release(enumJobs); + ok(res == 0, "Bad ref count on release: %u\n", res); + } + + /* Tear down */ + IBackgroundCopyJob_Release(job); + IBackgroundCopyManager_Release(manager); +} + START_TEST(qmgr) { CoInitialize(NULL); test_CreateInstance(); test_CreateJob(); + test_EnumJobs(); CoUninitialize(); }