Author: akhaldi Date: Sat Apr 26 18:04:41 2014 New Revision: 62998
URL: http://svn.reactos.org/svn/reactos?rev=62998&view=rev Log: [QMGR] * Sync with Wine 1.7.17. CORE-8080
Modified: trunk/reactos/dll/win32/qmgr/enum_files.c trunk/reactos/dll/win32/qmgr/enum_jobs.c trunk/reactos/dll/win32/qmgr/factory.c trunk/reactos/dll/win32/qmgr/file.c trunk/reactos/dll/win32/qmgr/job.c trunk/reactos/dll/win32/qmgr/qmgr.c trunk/reactos/dll/win32/qmgr/qmgr.h trunk/reactos/dll/win32/qmgr/qmgr_local.idl trunk/reactos/dll/win32/qmgr/qmgr_main.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/qmgr/enum_files.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/enum_files.c... ============================================================================== --- trunk/reactos/dll/win32/qmgr/enum_files.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/enum_files.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -34,10 +34,12 @@ return CONTAINING_RECORD(iface, EnumBackgroundCopyFilesImpl, IEnumBackgroundCopyFiles_iface); }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_QueryInterface(IEnumBackgroundCopyFiles *iface, +static HRESULT WINAPI EnumBackgroundCopyFiles_QueryInterface(IEnumBackgroundCopyFiles *iface, REFIID riid, void **ppv) { - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv); + EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); + + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyFiles)) { @@ -50,20 +52,22 @@ return E_NOINTERFACE; }
-static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface) +static ULONG WINAPI EnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface) { EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p) ref=%d\n", This, ref); + TRACE("(%p)->(%d)\n", This, ref); return ref; }
-static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface) +static ULONG WINAPI EnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface) { EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); ULONG ref = InterlockedDecrement(&This->ref); ULONG i; + + TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0) { @@ -77,13 +81,15 @@ }
/* Return reference to one or more files in the file enumerator */ -static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *iface, +static HRESULT WINAPI EnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *iface, ULONG celt, IBackgroundCopyFile **rgelt, ULONG *pceltFetched) { EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); ULONG fetched; ULONG i; IBackgroundCopyFile *file; + + TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
/* Despite documented behavior, Windows (tested on XP) is not verifying that the caller set pceltFetched to zero. No check here. */ @@ -115,10 +121,12 @@ }
/* Skip over one or more files in the file enumerator */ -static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(IEnumBackgroundCopyFiles *iface, +static HRESULT WINAPI EnumBackgroundCopyFiles_Skip(IEnumBackgroundCopyFiles *iface, ULONG celt) { EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); + + TRACE("(%p)->(%d)\n", This, celt);
if (celt > This->numFiles - This->indexFiles) { @@ -130,38 +138,43 @@ return S_OK; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface) -{ - EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); +static HRESULT WINAPI EnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface) +{ + EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); + + TRACE("(%p)\n", This); + This->indexFiles = 0; return S_OK; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface, +static HRESULT WINAPI EnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface, IEnumBackgroundCopyFiles **ppenum) { - FIXME("Not implemented\n"); + EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); + FIXME("(%p)->(%p): stub\n", This, ppenum); return E_NOTIMPL; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface, +static HRESULT WINAPI EnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface, ULONG *puCount) { EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); + TRACE("(%p)->(%p)\n", This, puCount); *puCount = This->numFiles; return S_OK; }
-static const IEnumBackgroundCopyFilesVtbl BITS_IEnumBackgroundCopyFiles_Vtbl = -{ - BITS_IEnumBackgroundCopyFiles_QueryInterface, - BITS_IEnumBackgroundCopyFiles_AddRef, - BITS_IEnumBackgroundCopyFiles_Release, - BITS_IEnumBackgroundCopyFiles_Next, - BITS_IEnumBackgroundCopyFiles_Skip, - BITS_IEnumBackgroundCopyFiles_Reset, - BITS_IEnumBackgroundCopyFiles_Clone, - BITS_IEnumBackgroundCopyFiles_GetCount +static const IEnumBackgroundCopyFilesVtbl EnumBackgroundCopyFilesVtbl = +{ + EnumBackgroundCopyFiles_QueryInterface, + EnumBackgroundCopyFiles_AddRef, + EnumBackgroundCopyFiles_Release, + EnumBackgroundCopyFiles_Next, + EnumBackgroundCopyFiles_Skip, + EnumBackgroundCopyFiles_Reset, + EnumBackgroundCopyFiles_Clone, + EnumBackgroundCopyFiles_GetCount };
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBackgroundCopyFiles **enum_files) @@ -176,7 +189,7 @@ if (!This) return E_OUTOFMEMORY;
- This->IEnumBackgroundCopyFiles_iface.lpVtbl = &BITS_IEnumBackgroundCopyFiles_Vtbl; + This->IEnumBackgroundCopyFiles_iface.lpVtbl = &EnumBackgroundCopyFilesVtbl; This->ref = 1;
/* Create array of files */
Modified: trunk/reactos/dll/win32/qmgr/enum_jobs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/enum_jobs.c?... ============================================================================== --- trunk/reactos/dll/win32/qmgr/enum_jobs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/enum_jobs.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -34,10 +34,12 @@ return CONTAINING_RECORD(iface, EnumBackgroundCopyJobsImpl, IEnumBackgroundCopyJobs_iface); }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_QueryInterface(IEnumBackgroundCopyJobs *iface, +static HRESULT WINAPI EnumBackgroundCopyJobs_QueryInterface(IEnumBackgroundCopyJobs *iface, REFIID riid, void **ppv) { - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv); + EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); + + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs)) { @@ -50,23 +52,23 @@ return E_NOINTERFACE; }
-static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface) +static ULONG WINAPI EnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface) { EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p) ref=%d\n", This, ref); + TRACE("(%p)->(%d)\n", This, ref);
return ref; }
-static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface) +static ULONG WINAPI EnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface) { EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); ULONG ref = InterlockedDecrement(&This->ref); ULONG i;
- TRACE("(%p) ref=%d\n", This, ref); + TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0) { for(i = 0; i < This->numJobs; i++) @@ -78,13 +80,15 @@ return ref; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs *iface, ULONG celt, +static HRESULT WINAPI EnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs *iface, ULONG celt, IBackgroundCopyJob **rgelt, ULONG *pceltFetched) { EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); ULONG fetched; ULONG i; IBackgroundCopyJob *job; + + TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
fetched = min(celt, This->numJobs - This->indexJobs); if (pceltFetched) @@ -112,9 +116,11 @@ return fetched == celt ? S_OK : S_FALSE; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt) -{ - EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); +static HRESULT WINAPI EnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt) +{ + EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); + + TRACE("(%p)->(%d)\n", This, celt);
if (This->numJobs - This->indexJobs < celt) { @@ -126,38 +132,45 @@ return S_OK; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface) -{ - EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); +static HRESULT WINAPI EnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface) +{ + EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); + + TRACE("(%p)\n", This); + This->indexJobs = 0; return S_OK; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface, +static HRESULT WINAPI EnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface, IEnumBackgroundCopyJobs **ppenum) { - FIXME("Not implemented\n"); + EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); + FIXME("(%p)->(%p): stub\n", This, ppenum); return E_NOTIMPL; }
-static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface, +static HRESULT WINAPI EnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface, ULONG *puCount) { EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); + + TRACE("(%p)->(%p)\n", This, puCount); + *puCount = This->numJobs; return S_OK; }
-static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl = -{ - BITS_IEnumBackgroundCopyJobs_QueryInterface, - BITS_IEnumBackgroundCopyJobs_AddRef, - BITS_IEnumBackgroundCopyJobs_Release, - BITS_IEnumBackgroundCopyJobs_Next, - BITS_IEnumBackgroundCopyJobs_Skip, - BITS_IEnumBackgroundCopyJobs_Reset, - BITS_IEnumBackgroundCopyJobs_Clone, - BITS_IEnumBackgroundCopyJobs_GetCount +static const IEnumBackgroundCopyJobsVtbl EnumBackgroundCopyJobsVtbl = +{ + EnumBackgroundCopyJobs_QueryInterface, + EnumBackgroundCopyJobs_AddRef, + EnumBackgroundCopyJobs_Release, + EnumBackgroundCopyJobs_Next, + EnumBackgroundCopyJobs_Skip, + EnumBackgroundCopyJobs_Reset, + EnumBackgroundCopyJobs_Clone, + EnumBackgroundCopyJobs_GetCount };
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob) @@ -171,7 +184,7 @@ This = HeapAlloc(GetProcessHeap(), 0, sizeof *This); if (!This) return E_OUTOFMEMORY; - This->IEnumBackgroundCopyJobs_iface.lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl; + This->IEnumBackgroundCopyJobs_iface.lpVtbl = &EnumBackgroundCopyJobsVtbl; This->ref = 1;
/* Create array of jobs */
Modified: trunk/reactos/dll/win32/qmgr/factory.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/factory.c?re... ============================================================================== --- trunk/reactos/dll/win32/qmgr/factory.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/factory.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -57,7 +57,7 @@ if (pUnkOuter) return CLASS_E_NOAGGREGATION;
- res = BackgroundCopyManagerConstructor(pUnkOuter, (LPVOID*) &punk); + res = BackgroundCopyManagerConstructor((LPVOID*) &punk); if (FAILED(res)) return res;
Modified: trunk/reactos/dll/win32/qmgr/file.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/file.c?rev=6... ============================================================================== --- trunk/reactos/dll/win32/qmgr/file.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/file.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -28,7 +28,7 @@ return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface); }
-static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface( +static HRESULT WINAPI BackgroundCopyFile_QueryInterface( IBackgroundCopyFile* iface, REFIID riid, void **obj) @@ -49,7 +49,7 @@ return E_NOINTERFACE; }
-static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface) +static ULONG WINAPI BackgroundCopyFile_AddRef(IBackgroundCopyFile* iface) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -57,7 +57,7 @@ return ref; }
-static ULONG WINAPI BITS_IBackgroundCopyFile_Release( +static ULONG WINAPI BackgroundCopyFile_Release( IBackgroundCopyFile* iface) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); @@ -77,41 +77,35 @@ }
/* Get the remote name of a background copy file */ -static HRESULT WINAPI BITS_IBackgroundCopyFile_GetRemoteName( +static HRESULT WINAPI BackgroundCopyFile_GetRemoteName( IBackgroundCopyFile* iface, LPWSTR *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); - int n = (lstrlenW(This->info.RemoteName) + 1) * sizeof(WCHAR); - - *pVal = CoTaskMemAlloc(n); - if (!*pVal) - return E_OUTOFMEMORY; - - memcpy(*pVal, This->info.RemoteName, n); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName( + + TRACE("(%p)->(%p)\n", This, pVal); + + return return_strval(This->info.RemoteName, pVal); +} + +static HRESULT WINAPI BackgroundCopyFile_GetLocalName( IBackgroundCopyFile* iface, LPWSTR *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); - int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR); - - *pVal = CoTaskMemAlloc(n); - if (!*pVal) - return E_OUTOFMEMORY; - - memcpy(*pVal, This->info.LocalName, n); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress( + + TRACE("(%p)->(%p)\n", This, pVal); + + return return_strval(This->info.LocalName, pVal); +} + +static HRESULT WINAPI BackgroundCopyFile_GetProgress( IBackgroundCopyFile* iface, BG_FILE_PROGRESS *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); + + TRACE("(%p)->(%p)\n", This, pVal);
EnterCriticalSection(&This->owner->cs); pVal->BytesTotal = This->fileProgress.BytesTotal; @@ -122,14 +116,14 @@ return S_OK; }
-static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl = -{ - BITS_IBackgroundCopyFile_QueryInterface, - BITS_IBackgroundCopyFile_AddRef, - BITS_IBackgroundCopyFile_Release, - BITS_IBackgroundCopyFile_GetRemoteName, - BITS_IBackgroundCopyFile_GetLocalName, - BITS_IBackgroundCopyFile_GetProgress +static const IBackgroundCopyFileVtbl BackgroundCopyFileVtbl = +{ + BackgroundCopyFile_QueryInterface, + BackgroundCopyFile_AddRef, + BackgroundCopyFile_Release, + BackgroundCopyFile_GetRemoteName, + BackgroundCopyFile_GetLocalName, + BackgroundCopyFile_GetProgress };
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, @@ -164,7 +158,7 @@ } memcpy(This->info.LocalName, localName, n);
- This->IBackgroundCopyFile_iface.lpVtbl = &BITS_IBackgroundCopyFile_Vtbl; + This->IBackgroundCopyFile_iface.lpVtbl = &BackgroundCopyFileVtbl; This->ref = 1;
This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN; @@ -217,6 +211,25 @@ return CONTAINING_RECORD(iface, DLBindStatusCallback, IBindStatusCallback_iface); }
+static HRESULT WINAPI DLBindStatusCallback_QueryInterface( + IBindStatusCallback *iface, + REFIID riid, + void **ppvObject) +{ + DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IBindStatusCallback)) + { + *ppvObject = &This->IBindStatusCallback_iface; + IBindStatusCallback_AddRef(iface); + return S_OK; + } + + *ppvObject = NULL; + return E_NOINTERFACE; +} + static ULONG WINAPI DLBindStatusCallback_AddRef(IBindStatusCallback *iface) { DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface); @@ -235,25 +248,6 @@ }
return ref; -} - -static HRESULT WINAPI DLBindStatusCallback_QueryInterface( - IBindStatusCallback *iface, - REFIID riid, - void **ppvObject) -{ - DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface); - - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IBindStatusCallback)) - { - *ppvObject = &This->IBindStatusCallback_iface; - DLBindStatusCallback_AddRef(iface); - return S_OK; - } - - *ppvObject = NULL; - return E_NOINTERFACE; }
static HRESULT WINAPI DLBindStatusCallback_GetBindInfo(
Modified: trunk/reactos/dll/win32/qmgr/job.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/job.c?rev=62... ============================================================================== --- trunk/reactos/dll/win32/qmgr/job.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/job.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -20,12 +20,17 @@
#include "qmgr.h"
+static inline BOOL is_job_done(const BackgroundCopyJobImpl *job) +{ + return job->state == BG_JOB_STATE_CANCELLED || job->state == BG_JOB_STATE_ACKNOWLEDGED; +} + static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface) { return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface); }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_QueryInterface( +static HRESULT WINAPI BackgroundCopyJob_QueryInterface( IBackgroundCopyJob2 *iface, REFIID riid, void **obj) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); @@ -45,7 +50,7 @@ return E_NOINTERFACE; }
-static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface) +static ULONG WINAPI BackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -53,7 +58,7 @@ return ref; }
-static ULONG WINAPI BITS_IBackgroundCopyJob_Release(IBackgroundCopyJob2 *iface) +static ULONG WINAPI BackgroundCopyJob_Release(IBackgroundCopyJob2 *iface) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -64,7 +69,10 @@ { 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); }
@@ -73,50 +81,56 @@
/*** IBackgroundCopyJob methods ***/
-static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFileSet( +static HRESULT WINAPI BackgroundCopyJob_AddFileSet( IBackgroundCopyJob2 *iface, ULONG cFileCount, BG_FILE_INFO *pFileSet) { + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + HRESULT hr = S_OK; ULONG i; + + TRACE("(%p)->(%d %p)\n", This, cFileCount, pFileSet); + + EnterCriticalSection(&This->cs); + for (i = 0; i < cFileCount; ++i) { - HRESULT hr = IBackgroundCopyJob2_AddFile(iface, pFileSet[i].RemoteName, - pFileSet[i].LocalName); - if (FAILED(hr)) - return hr; - } - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile( + BackgroundCopyFileImpl *file; + + /* We should return E_INVALIDARG in these cases. */ + FIXME("Check for valid filenames and supported protocols\n"); + + hr = BackgroundCopyFileConstructor(This, pFileSet[i].RemoteName, pFileSet[i].LocalName, &file); + if (hr != S_OK) break; + + /* Add a reference to the file to file list */ + list_add_head(&This->files, &file->entryFromJob); + This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN; + ++This->jobProgress.FilesTotal; + } + + LeaveCriticalSection(&This->cs); + + return hr; +} + +static HRESULT WINAPI BackgroundCopyJob_AddFile( IBackgroundCopyJob2 *iface, LPCWSTR RemoteUrl, LPCWSTR LocalName) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); - BackgroundCopyFileImpl *file; - HRESULT res; - - /* We should return E_INVALIDARG in these cases. */ - FIXME("Check for valid filenames and supported protocols\n"); - - res = BackgroundCopyFileConstructor(This, RemoteUrl, LocalName, &file); - if (res != S_OK) - return res; - - /* Add a reference to the file to file list */ - IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface); - EnterCriticalSection(&This->cs); - list_add_head(&This->files, &file->entryFromJob); - This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN; - ++This->jobProgress.FilesTotal; - LeaveCriticalSection(&This->cs); - - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_EnumFiles( + BG_FILE_INFO file; + + TRACE("(%p)->(%s %s)\n", This, debugstr_w(RemoteUrl), debugstr_w(LocalName)); + + file.RemoteName = (LPWSTR)RemoteUrl; + file.LocalName = (LPWSTR)LocalName; + return IBackgroundCopyJob2_AddFileSet(iface, 1, &file); +} + +static HRESULT WINAPI BackgroundCopyJob_EnumFiles( IBackgroundCopyJob2 *iface, IEnumBackgroundCopyFiles **enum_files) { @@ -125,22 +139,24 @@ return EnumBackgroundCopyFilesConstructor(This, enum_files); }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend( +static HRESULT WINAPI BackgroundCopyJob_Suspend( IBackgroundCopyJob2 *iface) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_Resume( IBackgroundCopyJob2 *iface) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); HRESULT rv = S_OK;
+ TRACE("(%p)\n", This); + EnterCriticalSection(&globalMgr.cs); - if (This->state == BG_JOB_STATE_CANCELLED - || This->state == BG_JOB_STATE_ACKNOWLEDGED) + if (is_job_done(This)) { rv = BG_E_INVALID_STATE; } @@ -159,23 +175,25 @@ return rv; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel( +static HRESULT WINAPI BackgroundCopyJob_Cancel( IBackgroundCopyJob2 *iface) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_Complete( IBackgroundCopyJob2 *iface) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); HRESULT rv = S_OK;
+ TRACE("(%p)\n", This); + EnterCriticalSection(&This->cs);
- if (This->state == BG_JOB_STATE_CANCELLED - || This->state == BG_JOB_STATE_ACKNOWLEDGED) + if (is_job_done(This)) { rv = BG_E_INVALID_STATE; } @@ -208,20 +226,23 @@ return rv; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId( +static HRESULT WINAPI BackgroundCopyJob_GetId( IBackgroundCopyJob2 *iface, GUID *pVal) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + TRACE("(%p)->(%p)\n", This, pVal); *pVal = This->jobId; return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType( +static HRESULT WINAPI BackgroundCopyJob_GetType( IBackgroundCopyJob2 *iface, BG_JOB_TYPE *pVal) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) return E_INVALIDARG; @@ -230,11 +251,13 @@ return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress( +static HRESULT WINAPI BackgroundCopyJob_GetProgress( IBackgroundCopyJob2 *iface, BG_JOB_PROGRESS *pVal) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) return E_INVALIDARG; @@ -249,19 +272,22 @@ return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetTimes( +static HRESULT WINAPI BackgroundCopyJob_GetTimes( IBackgroundCopyJob2 *iface, BG_JOB_TIMES *pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, pVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetState( IBackgroundCopyJob2 *iface, BG_JOB_STATE *pVal) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) return E_INVALIDARG; @@ -271,113 +297,191 @@ return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetError( +static HRESULT WINAPI BackgroundCopyJob_GetError( IBackgroundCopyJob2 *iface, IBackgroundCopyError **ppError) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetOwner( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, ppError); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetOwner( IBackgroundCopyJob2 *iface, LPWSTR *pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDisplayName( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, pVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetDisplayName( IBackgroundCopyJob2 *iface, LPCWSTR Val) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(Val)); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetDisplayName( IBackgroundCopyJob2 *iface, LPWSTR *pVal) { BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); - int n; - - if (!pVal) - return E_INVALIDARG; - - n = (lstrlenW(This->displayName) + 1) * sizeof **pVal; - *pVal = CoTaskMemAlloc(n); - if (*pVal == NULL) - return E_OUTOFMEMORY; - memcpy(*pVal, This->displayName, n); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription( + + TRACE("(%p)->(%p)\n", This, pVal); + + return return_strval(This->displayName, pVal); +} + +static HRESULT WINAPI BackgroundCopyJob_SetDescription( IBackgroundCopyJob2 *iface, LPCWSTR Val) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDescription( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + static const int max_description_len = 1024; + HRESULT hr = S_OK; + int len; + + TRACE("(%p)->(%s)\n", This, debugstr_w(Val)); + + if (!Val) return E_INVALIDARG; + + len = strlenW(Val); + if (len > max_description_len) return BG_E_STRING_TOO_LONG; + + EnterCriticalSection(&This->cs); + + if (is_job_done(This)) + { + hr = BG_E_INVALID_STATE; + } + else + { + HeapFree(GetProcessHeap(), 0, This->description); + if ((This->description = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)))) + strcpyW(This->description, Val); + else + hr = E_OUTOFMEMORY; + } + + LeaveCriticalSection(&This->cs); + + return hr; +} + +static HRESULT WINAPI BackgroundCopyJob_GetDescription( IBackgroundCopyJob2 *iface, LPWSTR *pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + TRACE("(%p)->(%p)\n", This, pVal); + + return return_strval(This->description, pVal); +} + +static HRESULT WINAPI BackgroundCopyJob_SetPriority( IBackgroundCopyJob2 *iface, BG_JOB_PRIORITY Val) { - FIXME("(%p,0x%08x) stub\n", iface, Val); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetPriority( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%d): stub\n", This, Val); + return S_OK; +} + +static HRESULT WINAPI BackgroundCopyJob_GetPriority( IBackgroundCopyJob2 *iface, BG_JOB_PRIORITY *pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyFlags( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, pVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags( IBackgroundCopyJob2 *iface, ULONG Val) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyFlags( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + 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 (is_job_done(This)) return BG_E_INVALID_STATE; + if (Val & ~valid_flags) return E_NOTIMPL; + This->notify_flags = Val; + return S_OK; +} + +static HRESULT WINAPI BackgroundCopyJob_GetNotifyFlags( IBackgroundCopyJob2 *iface, ULONG *pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyInterface( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + TRACE("(%p)->(%p)\n", This, pVal); + + if (!pVal) return E_INVALIDARG; + + *pVal = This->notify_flags; + + return S_OK; +} + +static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface( IBackgroundCopyJob2 *iface, IUnknown *Val) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyInterface( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + 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( IBackgroundCopyJob2 *iface, IUnknown **pVal) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetMinimumRetryDelay( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + + 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( IBackgroundCopyJob2 *iface, ULONG Seconds) { @@ -385,180 +489,195 @@ return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetMinimumRetryDelay( +static HRESULT WINAPI BackgroundCopyJob_GetMinimumRetryDelay( IBackgroundCopyJob2 *iface, ULONG *Seconds) { - FIXME("%p\n", Seconds); + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, Seconds); *Seconds = 30; return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNoProgressTimeout( +static HRESULT WINAPI BackgroundCopyJob_SetNoProgressTimeout( IBackgroundCopyJob2 *iface, ULONG Seconds) { - FIXME("%u\n", Seconds); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNoProgressTimeout( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%d): stub\n", This, Seconds); + return S_OK; +} + +static HRESULT WINAPI BackgroundCopyJob_GetNoProgressTimeout( IBackgroundCopyJob2 *iface, ULONG *Seconds) { - FIXME("%p\n", Seconds); + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, Seconds); *Seconds = 900; return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyJob_GetErrorCount( +static HRESULT WINAPI BackgroundCopyJob_GetErrorCount( IBackgroundCopyJob2 *iface, ULONG *Errors) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetProxySettings( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, Errors); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetProxySettings( IBackgroundCopyJob2 *iface, BG_JOB_PROXY_USAGE ProxyUsage, const WCHAR *ProxyList, const WCHAR *ProxyBypassList) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProxySettings( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%d %s %s): stub\n", This, ProxyUsage, debugstr_w(ProxyList), debugstr_w(ProxyBypassList)); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetProxySettings( IBackgroundCopyJob2 *iface, BG_JOB_PROXY_USAGE *pProxyUsage, LPWSTR *pProxyList, LPWSTR *pProxyBypassList) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_TakeOwnership( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p %p %p): stub\n", This, pProxyUsage, pProxyList, pProxyBypassList); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_TakeOwnership( IBackgroundCopyJob2 *iface) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyCmdLine( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetNotifyCmdLine( IBackgroundCopyJob2 *iface, LPCWSTR prog, LPCWSTR params) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyCmdLine( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%s %s): stub\n", This, debugstr_w(prog), debugstr_w(params)); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetNotifyCmdLine( IBackgroundCopyJob2 *iface, LPWSTR *prog, LPWSTR *params) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyProgress( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p %p): stub\n", This, prog, params); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetReplyProgress( IBackgroundCopyJob2 *iface, BG_JOB_REPLY_PROGRESS *progress) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyData( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, progress); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetReplyData( IBackgroundCopyJob2 *iface, byte **pBuffer, UINT64 *pLength) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetReplyFileName( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p %p): stub\n", This, pBuffer, pLength); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetReplyFileName( IBackgroundCopyJob2 *iface, LPCWSTR filename) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyFileName( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(filename)); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_GetReplyFileName( IBackgroundCopyJob2 *iface, LPWSTR *pFilename) { - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_SetCredentials( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, pFilename); + return E_NOTIMPL; +} + +static HRESULT WINAPI BackgroundCopyJob_SetCredentials( IBackgroundCopyJob2 *iface, BG_AUTH_CREDENTIALS *cred) { - FIXME("Not implemented\n"); - return S_OK; -} - -static HRESULT WINAPI BITS_IBackgroundCopyJob_RemoveCredentials( + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%p): stub\n", This, cred); + return S_OK; +} + +static HRESULT WINAPI BackgroundCopyJob_RemoveCredentials( IBackgroundCopyJob2 *iface, BG_AUTH_TARGET target, BG_AUTH_SCHEME scheme) { - FIXME("Not implemented\n"); - return S_OK; -} - -static const IBackgroundCopyJob2Vtbl BITS_IBackgroundCopyJob_Vtbl = -{ - BITS_IBackgroundCopyJob_QueryInterface, - BITS_IBackgroundCopyJob_AddRef, - BITS_IBackgroundCopyJob_Release, - BITS_IBackgroundCopyJob_AddFileSet, - BITS_IBackgroundCopyJob_AddFile, - BITS_IBackgroundCopyJob_EnumFiles, - BITS_IBackgroundCopyJob_Suspend, - BITS_IBackgroundCopyJob_Resume, - BITS_IBackgroundCopyJob_Cancel, - BITS_IBackgroundCopyJob_Complete, - BITS_IBackgroundCopyJob_GetId, - BITS_IBackgroundCopyJob_GetType, - BITS_IBackgroundCopyJob_GetProgress, - BITS_IBackgroundCopyJob_GetTimes, - BITS_IBackgroundCopyJob_GetState, - BITS_IBackgroundCopyJob_GetError, - BITS_IBackgroundCopyJob_GetOwner, - BITS_IBackgroundCopyJob_SetDisplayName, - BITS_IBackgroundCopyJob_GetDisplayName, - BITS_IBackgroundCopyJob_SetDescription, - BITS_IBackgroundCopyJob_GetDescription, - BITS_IBackgroundCopyJob_SetPriority, - BITS_IBackgroundCopyJob_GetPriority, - BITS_IBackgroundCopyJob_SetNotifyFlags, - BITS_IBackgroundCopyJob_GetNotifyFlags, - BITS_IBackgroundCopyJob_SetNotifyInterface, - BITS_IBackgroundCopyJob_GetNotifyInterface, - BITS_IBackgroundCopyJob_SetMinimumRetryDelay, - BITS_IBackgroundCopyJob_GetMinimumRetryDelay, - BITS_IBackgroundCopyJob_SetNoProgressTimeout, - BITS_IBackgroundCopyJob_GetNoProgressTimeout, - BITS_IBackgroundCopyJob_GetErrorCount, - BITS_IBackgroundCopyJob_SetProxySettings, - BITS_IBackgroundCopyJob_GetProxySettings, - BITS_IBackgroundCopyJob_TakeOwnership, - BITS_IBackgroundCopyJob_SetNotifyCmdLine, - BITS_IBackgroundCopyJob_GetNotifyCmdLine, - BITS_IBackgroundCopyJob_GetReplyProgress, - BITS_IBackgroundCopyJob_GetReplyData, - BITS_IBackgroundCopyJob_SetReplyFileName, - BITS_IBackgroundCopyJob_GetReplyFileName, - BITS_IBackgroundCopyJob_SetCredentials, - BITS_IBackgroundCopyJob_RemoveCredentials + BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); + FIXME("(%p)->(%d %d): stub\n", This, target, scheme); + return S_OK; +} + +static const IBackgroundCopyJob2Vtbl BackgroundCopyJobVtbl = +{ + BackgroundCopyJob_QueryInterface, + BackgroundCopyJob_AddRef, + BackgroundCopyJob_Release, + BackgroundCopyJob_AddFileSet, + BackgroundCopyJob_AddFile, + BackgroundCopyJob_EnumFiles, + BackgroundCopyJob_Suspend, + BackgroundCopyJob_Resume, + BackgroundCopyJob_Cancel, + BackgroundCopyJob_Complete, + BackgroundCopyJob_GetId, + BackgroundCopyJob_GetType, + BackgroundCopyJob_GetProgress, + BackgroundCopyJob_GetTimes, + BackgroundCopyJob_GetState, + BackgroundCopyJob_GetError, + BackgroundCopyJob_GetOwner, + BackgroundCopyJob_SetDisplayName, + BackgroundCopyJob_GetDisplayName, + BackgroundCopyJob_SetDescription, + BackgroundCopyJob_GetDescription, + BackgroundCopyJob_SetPriority, + BackgroundCopyJob_GetPriority, + BackgroundCopyJob_SetNotifyFlags, + BackgroundCopyJob_GetNotifyFlags, + BackgroundCopyJob_SetNotifyInterface, + BackgroundCopyJob_GetNotifyInterface, + BackgroundCopyJob_SetMinimumRetryDelay, + BackgroundCopyJob_GetMinimumRetryDelay, + BackgroundCopyJob_SetNoProgressTimeout, + BackgroundCopyJob_GetNoProgressTimeout, + BackgroundCopyJob_GetErrorCount, + BackgroundCopyJob_SetProxySettings, + BackgroundCopyJob_GetProxySettings, + BackgroundCopyJob_TakeOwnership, + BackgroundCopyJob_SetNotifyCmdLine, + BackgroundCopyJob_GetNotifyCmdLine, + BackgroundCopyJob_GetReplyProgress, + BackgroundCopyJob_GetReplyData, + BackgroundCopyJob_SetReplyFileName, + BackgroundCopyJob_GetReplyFileName, + BackgroundCopyJob_SetCredentials, + BackgroundCopyJob_RemoveCredentials };
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *job_id, BackgroundCopyJobImpl **job) @@ -573,14 +692,14 @@ if (!This) return E_OUTOFMEMORY;
- This->IBackgroundCopyJob2_iface.lpVtbl = &BITS_IBackgroundCopyJob_Vtbl; + This->IBackgroundCopyJob2_iface.lpVtbl = &BackgroundCopyJobVtbl; InitializeCriticalSection(&This->cs); This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BackgroundCopyJobImpl.cs");
This->ref = 1; This->type = type;
- n = (lstrlenW(displayName) + 1) * sizeof *displayName; + n = (strlenW(displayName) + 1) * sizeof *displayName; This->displayName = HeapAlloc(GetProcessHeap(), 0, n); if (!This->displayName) { @@ -609,8 +728,15 @@ This->jobProgress.FilesTransferred = 0;
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; + + TRACE("created job %s:%p\n", debugstr_guid(&This->jobId), This); + return S_OK; }
Modified: trunk/reactos/dll/win32/qmgr/qmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/qmgr.c?rev=6... ============================================================================== --- trunk/reactos/dll/win32/qmgr/qmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/qmgr.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -22,10 +22,10 @@
BackgroundCopyManagerImpl globalMgr;
-static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface, +static HRESULT WINAPI BackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface, REFIID riid, void **ppv) { - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv); + TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBackgroundCopyManager)) { @@ -38,24 +38,25 @@ return E_NOINTERFACE; }
-static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(IBackgroundCopyManager *iface) +static ULONG WINAPI BackgroundCopyManager_AddRef(IBackgroundCopyManager *iface) { return 2; }
-static ULONG WINAPI BITS_IBackgroundCopyManager_Release(IBackgroundCopyManager *iface) +static ULONG WINAPI BackgroundCopyManager_Release(IBackgroundCopyManager *iface) { return 1; }
/*** IBackgroundCopyManager interface methods ***/
-static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(IBackgroundCopyManager *iface, +static HRESULT WINAPI BackgroundCopyManager_CreateJob(IBackgroundCopyManager *iface, LPCWSTR DisplayName, BG_JOB_TYPE Type, GUID *pJobId, IBackgroundCopyJob **ppJob) { BackgroundCopyJobImpl *job; HRESULT hres; - TRACE("\n"); + + TRACE("(%s %d %p %p)\n", debugstr_w(DisplayName), Type, pJobId, ppJob);
hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId, &job); if (FAILED(hres)) @@ -70,50 +71,73 @@ return S_OK; }
-static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(IBackgroundCopyManager *iface, - REFGUID jobID, IBackgroundCopyJob **ppJob) -{ - FIXME("Not implemented\n"); +static HRESULT WINAPI BackgroundCopyManager_GetJob(IBackgroundCopyManager *iface, + REFGUID jobID, IBackgroundCopyJob **job) +{ + BackgroundCopyManagerImpl *qmgr = &globalMgr; + HRESULT hr = BG_E_NOT_FOUND; + BackgroundCopyJobImpl *cur; + + TRACE("(%s %p)\n", debugstr_guid(jobID), job); + + if (!job || !jobID) return E_INVALIDARG; + + *job = NULL; + + EnterCriticalSection(&qmgr->cs); + + LIST_FOR_EACH_ENTRY(cur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr) + { + if (IsEqualGUID(&cur->jobId, jobID)) + { + *job = (IBackgroundCopyJob*)&cur->IBackgroundCopyJob2_iface; + IBackgroundCopyJob2_AddRef(&cur->IBackgroundCopyJob2_iface); + hr = S_OK; + break; + } + } + + LeaveCriticalSection(&qmgr->cs); + + return hr; +} + +static HRESULT WINAPI BackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface, + DWORD flags, IEnumBackgroundCopyJobs **ppEnum) +{ + TRACE("(0x%x %p)\n", flags, ppEnum); + return enum_copy_job_create(&globalMgr, ppEnum); +} + +static HRESULT WINAPI BackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface, + HRESULT hr, DWORD langid, LPWSTR *error_description) +{ + FIXME("(0x%08x 0x%x %p): stub\n", hr, langid, error_description); return E_NOTIMPL; }
-static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface, - DWORD dwFlags, IEnumBackgroundCopyJobs **ppEnum) -{ - TRACE("\n"); - return enum_copy_job_create(&globalMgr, ppEnum); -} - -static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface, - HRESULT hResult, DWORD LanguageId, LPWSTR *pErrorDescription) -{ - FIXME("Not implemented\n"); - return E_NOTIMPL; -} - - -static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl = -{ - BITS_IBackgroundCopyManager_QueryInterface, - BITS_IBackgroundCopyManager_AddRef, - BITS_IBackgroundCopyManager_Release, - BITS_IBackgroundCopyManager_CreateJob, - BITS_IBackgroundCopyManager_GetJob, - BITS_IBackgroundCopyManager_EnumJobs, - BITS_IBackgroundCopyManager_GetErrorDescription +static const IBackgroundCopyManagerVtbl BackgroundCopyManagerVtbl = +{ + BackgroundCopyManager_QueryInterface, + BackgroundCopyManager_AddRef, + BackgroundCopyManager_Release, + BackgroundCopyManager_CreateJob, + BackgroundCopyManager_GetJob, + BackgroundCopyManager_EnumJobs, + BackgroundCopyManager_GetErrorDescription };
BackgroundCopyManagerImpl globalMgr = { - { &BITS_IBackgroundCopyManager_Vtbl }, + { &BackgroundCopyManagerVtbl }, { NULL, -1, 0, 0, 0, 0 }, NULL, LIST_INIT(globalMgr.jobs) };
/* Constructor for instances of background copy manager */ -HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj) -{ - TRACE("(%p,%p)\n", pUnkOuter, ppObj); +HRESULT BackgroundCopyManagerConstructor(LPVOID *ppObj) +{ + TRACE("(%p)\n", ppObj); *ppObj = &globalMgr; return S_OK; }
Modified: trunk/reactos/dll/win32/qmgr/qmgr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/qmgr.h?rev=6... ============================================================================== --- trunk/reactos/dll/win32/qmgr/qmgr.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/qmgr.h [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -34,9 +34,11 @@ #include <winsvc.h> #include <objbase.h> #include <bits1_5.h> +#include <bits3_0.h>
#include <wine/list.h> #include <wine/debug.h> +#include <wine/unicode.h>
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
@@ -46,11 +48,15 @@ IBackgroundCopyJob2 IBackgroundCopyJob2_iface; LONG ref; LPWSTR displayName; + LPWSTR description; BG_JOB_TYPE type; GUID jobId; struct list files; 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; @@ -87,7 +93,7 @@ extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN; extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN;
-HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; +HRESULT BackgroundCopyManagerConstructor(LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN; HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, @@ -109,6 +115,19 @@ return d ? memcpy(d, s, n) : NULL; }
+static inline HRESULT return_strval(const WCHAR *str, WCHAR **ret) +{ + int len; + + if (!ret) return E_INVALIDARG; + + len = strlenW(str); + *ret = CoTaskMemAlloc((len+1)*sizeof(WCHAR)); + if (!*ret) return E_OUTOFMEMORY; + strcpyW(*ret, str); + return S_OK; +} + static inline BOOL transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState, BG_JOB_STATE toState)
Modified: trunk/reactos/dll/win32/qmgr/qmgr_local.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/qmgr_local.i... ============================================================================== --- trunk/reactos/dll/win32/qmgr/qmgr_local.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/qmgr_local.idl [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -16,7 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#pragma makedep ident + #include "bits.idl"
#define DO_NO_IMPORTS #include "bits1_5.idl" +#include "bits3_0.idl"
Modified: trunk/reactos/dll/win32/qmgr/qmgr_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/qmgr/qmgr_main.c?... ============================================================================== --- trunk/reactos/dll/win32/qmgr/qmgr_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/qmgr/qmgr_main.c [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -98,35 +98,6 @@ } }
-static HRESULT register_service(BOOL do_register) -{ - static const WCHAR name[] = { 'B','I','T','S', 0 }; - static const WCHAR path[] = { 's','v','c','h','o','s','t','.','e','x','e', - ' ','-','k',' ','n','e','t','s','v','c','s', 0 }; - SC_HANDLE scm, service; - - scm = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (!scm) - return SELFREG_E_CLASS; - - if (do_register) - service = CreateServiceW(scm, name, name, SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, - SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, - path, NULL, NULL, NULL, NULL, NULL); - else - service = OpenServiceW(scm, name, DELETE); - - - CloseServiceHandle(scm); - if (service) - { - if (!do_register) DeleteService(service); - CloseServiceHandle(service); - } - return S_OK; -} - /* Use an INF file to register or unregister the DLL */ static HRESULT register_server(BOOL do_register) { @@ -137,12 +108,6 @@ static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
TRACE("(%x)\n", do_register); - - hr = register_service(do_register); - if (FAILED(hr)) { - ERR("register_service failed: %d\n", GetLastError()); - return hr; - }
hAdvpack = LoadLibraryW(wszAdvpack); pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall");
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=6... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Apr 26 18:04:41 2014 @@ -159,7 +159,7 @@ reactos/dll/win32/printui # Synced to Wine-1.7.1 reactos/dll/win32/propsys # Synced to Wine-1.7.17 reactos/dll/win32/pstorec # Synced to Wine-1.7.1 -reactos/dll/win32/qmgr # Synced to Wine-1.7.1 +reactos/dll/win32/qmgr # Synced to Wine-1.7.17 reactos/dll/win32/qmgrprxy # Synced to Wine-1.7.1 reactos/dll/win32/query # Synced to Wine-1.7.1 reactos/dll/win32/rasapi32 # Synced to Wine-1.7.1