* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62998
This commit is contained in:
Amine Khaldi 2014-04-26 18:04:41 +00:00
parent a97c2c224d
commit 654ba0eca0
10 changed files with 483 additions and 326 deletions

View file

@ -34,10 +34,12 @@ static inline EnumBackgroundCopyFilesImpl *impl_from_IEnumBackgroundCopyFiles(IE
return CONTAINING_RECORD(iface, EnumBackgroundCopyFilesImpl, IEnumBackgroundCopyFiles_iface); 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) 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)) if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyFiles))
{ {
@ -50,21 +52,23 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_QueryInterface(IEnumBackgrou
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface) static ULONG WINAPI EnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
return ref; return ref;
} }
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface) static ULONG WINAPI EnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
ULONG i; ULONG i;
TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0) if (ref == 0)
{ {
for(i = 0; i < This->numFiles; i++) for(i = 0; i < This->numFiles; i++)
@ -77,7 +81,7 @@ static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFil
} }
/* Return reference to one or more files in the file enumerator */ /* 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) ULONG celt, IBackgroundCopyFile **rgelt, ULONG *pceltFetched)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
@ -85,6 +89,8 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFile
ULONG i; ULONG i;
IBackgroundCopyFile *file; IBackgroundCopyFile *file;
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
/* Despite documented behavior, Windows (tested on XP) is not verifying /* Despite documented behavior, Windows (tested on XP) is not verifying
that the caller set pceltFetched to zero. No check here. */ that the caller set pceltFetched to zero. No check here. */
@ -115,11 +121,13 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFile
} }
/* Skip over one or more files in the file enumerator */ /* 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) ULONG celt)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
TRACE("(%p)->(%d)\n", This, celt);
if (celt > This->numFiles - This->indexFiles) if (celt > This->numFiles - This->indexFiles)
{ {
This->indexFiles = This->numFiles; This->indexFiles = This->numFiles;
@ -130,38 +138,43 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(IEnumBackgroundCopyFile
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface) static HRESULT WINAPI EnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
TRACE("(%p)\n", This);
This->indexFiles = 0; This->indexFiles = 0;
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface, static HRESULT WINAPI EnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface,
IEnumBackgroundCopyFiles **ppenum) IEnumBackgroundCopyFiles **ppenum)
{ {
FIXME("Not implemented\n"); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
FIXME("(%p)->(%p): stub\n", This, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface, static HRESULT WINAPI EnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface,
ULONG *puCount) ULONG *puCount)
{ {
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface); EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
TRACE("(%p)->(%p)\n", This, puCount);
*puCount = This->numFiles; *puCount = This->numFiles;
return S_OK; return S_OK;
} }
static const IEnumBackgroundCopyFilesVtbl BITS_IEnumBackgroundCopyFiles_Vtbl = static const IEnumBackgroundCopyFilesVtbl EnumBackgroundCopyFilesVtbl =
{ {
BITS_IEnumBackgroundCopyFiles_QueryInterface, EnumBackgroundCopyFiles_QueryInterface,
BITS_IEnumBackgroundCopyFiles_AddRef, EnumBackgroundCopyFiles_AddRef,
BITS_IEnumBackgroundCopyFiles_Release, EnumBackgroundCopyFiles_Release,
BITS_IEnumBackgroundCopyFiles_Next, EnumBackgroundCopyFiles_Next,
BITS_IEnumBackgroundCopyFiles_Skip, EnumBackgroundCopyFiles_Skip,
BITS_IEnumBackgroundCopyFiles_Reset, EnumBackgroundCopyFiles_Reset,
BITS_IEnumBackgroundCopyFiles_Clone, EnumBackgroundCopyFiles_Clone,
BITS_IEnumBackgroundCopyFiles_GetCount EnumBackgroundCopyFiles_GetCount
}; };
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBackgroundCopyFiles **enum_files) HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBackgroundCopyFiles **enum_files)
@ -176,7 +189,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBack
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IEnumBackgroundCopyFiles_iface.lpVtbl = &BITS_IEnumBackgroundCopyFiles_Vtbl; This->IEnumBackgroundCopyFiles_iface.lpVtbl = &EnumBackgroundCopyFilesVtbl;
This->ref = 1; This->ref = 1;
/* Create array of files */ /* Create array of files */

View file

@ -34,10 +34,12 @@ static inline EnumBackgroundCopyJobsImpl *impl_from_IEnumBackgroundCopyJobs(IEnu
return CONTAINING_RECORD(iface, EnumBackgroundCopyJobsImpl, IEnumBackgroundCopyJobs_iface); 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) 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)) if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs))
{ {
@ -50,23 +52,23 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_QueryInterface(IEnumBackgroun
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface) static ULONG WINAPI EnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
return ref; return ref;
} }
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface) static ULONG WINAPI EnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
ULONG i; ULONG i;
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0) { if (ref == 0) {
for(i = 0; i < This->numJobs; i++) for(i = 0; i < This->numJobs; i++)
@ -78,7 +80,7 @@ static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs
return ref; 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) IBackgroundCopyJob **rgelt, ULONG *pceltFetched)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
@ -86,6 +88,8 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs
ULONG i; ULONG i;
IBackgroundCopyJob *job; IBackgroundCopyJob *job;
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
fetched = min(celt, This->numJobs - This->indexJobs); fetched = min(celt, This->numJobs - This->indexJobs);
if (pceltFetched) if (pceltFetched)
*pceltFetched = fetched; *pceltFetched = fetched;
@ -112,10 +116,12 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs
return fetched == celt ? S_OK : S_FALSE; return fetched == celt ? S_OK : S_FALSE;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt) static HRESULT WINAPI EnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
TRACE("(%p)->(%d)\n", This, celt);
if (This->numJobs - This->indexJobs < celt) if (This->numJobs - This->indexJobs < celt)
{ {
This->indexJobs = This->numJobs; This->indexJobs = This->numJobs;
@ -126,38 +132,45 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface) static HRESULT WINAPI EnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
TRACE("(%p)\n", This);
This->indexJobs = 0; This->indexJobs = 0;
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface, static HRESULT WINAPI EnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface,
IEnumBackgroundCopyJobs **ppenum) IEnumBackgroundCopyJobs **ppenum)
{ {
FIXME("Not implemented\n"); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
FIXME("(%p)->(%p): stub\n", This, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface, static HRESULT WINAPI EnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface,
ULONG *puCount) ULONG *puCount)
{ {
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface); EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
TRACE("(%p)->(%p)\n", This, puCount);
*puCount = This->numJobs; *puCount = This->numJobs;
return S_OK; return S_OK;
} }
static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl = static const IEnumBackgroundCopyJobsVtbl EnumBackgroundCopyJobsVtbl =
{ {
BITS_IEnumBackgroundCopyJobs_QueryInterface, EnumBackgroundCopyJobs_QueryInterface,
BITS_IEnumBackgroundCopyJobs_AddRef, EnumBackgroundCopyJobs_AddRef,
BITS_IEnumBackgroundCopyJobs_Release, EnumBackgroundCopyJobs_Release,
BITS_IEnumBackgroundCopyJobs_Next, EnumBackgroundCopyJobs_Next,
BITS_IEnumBackgroundCopyJobs_Skip, EnumBackgroundCopyJobs_Skip,
BITS_IEnumBackgroundCopyJobs_Reset, EnumBackgroundCopyJobs_Reset,
BITS_IEnumBackgroundCopyJobs_Clone, EnumBackgroundCopyJobs_Clone,
BITS_IEnumBackgroundCopyJobs_GetCount EnumBackgroundCopyJobs_GetCount
}; };
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob) HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob)
@ -171,7 +184,7 @@ HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCop
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This); This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IEnumBackgroundCopyJobs_iface.lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl; This->IEnumBackgroundCopyJobs_iface.lpVtbl = &EnumBackgroundCopyJobsVtbl;
This->ref = 1; This->ref = 1;
/* Create array of jobs */ /* Create array of jobs */

View file

@ -57,7 +57,7 @@ BITS_IClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REF
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
res = BackgroundCopyManagerConstructor(pUnkOuter, (LPVOID*) &punk); res = BackgroundCopyManagerConstructor((LPVOID*) &punk);
if (FAILED(res)) if (FAILED(res))
return res; return res;

View file

@ -28,7 +28,7 @@ static inline BackgroundCopyFileImpl *impl_from_IBackgroundCopyFile(IBackgroundC
return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface); return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface);
} }
static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface( static HRESULT WINAPI BackgroundCopyFile_QueryInterface(
IBackgroundCopyFile* iface, IBackgroundCopyFile* iface,
REFIID riid, REFIID riid,
void **obj) void **obj)
@ -49,7 +49,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface(
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface) static ULONG WINAPI BackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
{ {
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
@ -57,7 +57,7 @@ static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
return ref; return ref;
} }
static ULONG WINAPI BITS_IBackgroundCopyFile_Release( static ULONG WINAPI BackgroundCopyFile_Release(
IBackgroundCopyFile* iface) IBackgroundCopyFile* iface)
{ {
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
@ -77,42 +77,36 @@ static ULONG WINAPI BITS_IBackgroundCopyFile_Release(
} }
/* Get the remote name of a background copy file */ /* Get the remote name of a background copy file */
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetRemoteName( static HRESULT WINAPI BackgroundCopyFile_GetRemoteName(
IBackgroundCopyFile* iface, IBackgroundCopyFile* iface,
LPWSTR *pVal) LPWSTR *pVal)
{ {
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
int n = (lstrlenW(This->info.RemoteName) + 1) * sizeof(WCHAR);
*pVal = CoTaskMemAlloc(n); TRACE("(%p)->(%p)\n", This, pVal);
if (!*pVal)
return E_OUTOFMEMORY;
memcpy(*pVal, This->info.RemoteName, n); return return_strval(This->info.RemoteName, pVal);
return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName( static HRESULT WINAPI BackgroundCopyFile_GetLocalName(
IBackgroundCopyFile* iface, IBackgroundCopyFile* iface,
LPWSTR *pVal) LPWSTR *pVal)
{ {
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR);
*pVal = CoTaskMemAlloc(n); TRACE("(%p)->(%p)\n", This, pVal);
if (!*pVal)
return E_OUTOFMEMORY;
memcpy(*pVal, This->info.LocalName, n); return return_strval(This->info.LocalName, pVal);
return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress( static HRESULT WINAPI BackgroundCopyFile_GetProgress(
IBackgroundCopyFile* iface, IBackgroundCopyFile* iface,
BG_FILE_PROGRESS *pVal) BG_FILE_PROGRESS *pVal)
{ {
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
TRACE("(%p)->(%p)\n", This, pVal);
EnterCriticalSection(&This->owner->cs); EnterCriticalSection(&This->owner->cs);
pVal->BytesTotal = This->fileProgress.BytesTotal; pVal->BytesTotal = This->fileProgress.BytesTotal;
pVal->BytesTransferred = This->fileProgress.BytesTransferred; pVal->BytesTransferred = This->fileProgress.BytesTransferred;
@ -122,14 +116,14 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
return S_OK; return S_OK;
} }
static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl = static const IBackgroundCopyFileVtbl BackgroundCopyFileVtbl =
{ {
BITS_IBackgroundCopyFile_QueryInterface, BackgroundCopyFile_QueryInterface,
BITS_IBackgroundCopyFile_AddRef, BackgroundCopyFile_AddRef,
BITS_IBackgroundCopyFile_Release, BackgroundCopyFile_Release,
BITS_IBackgroundCopyFile_GetRemoteName, BackgroundCopyFile_GetRemoteName,
BITS_IBackgroundCopyFile_GetLocalName, BackgroundCopyFile_GetLocalName,
BITS_IBackgroundCopyFile_GetProgress BackgroundCopyFile_GetProgress
}; };
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
@ -164,7 +158,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
} }
memcpy(This->info.LocalName, localName, n); memcpy(This->info.LocalName, localName, n);
This->IBackgroundCopyFile_iface.lpVtbl = &BITS_IBackgroundCopyFile_Vtbl; This->IBackgroundCopyFile_iface.lpVtbl = &BackgroundCopyFileVtbl;
This->ref = 1; This->ref = 1;
This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN; This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
@ -217,6 +211,25 @@ static inline DLBindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCal
return CONTAINING_RECORD(iface, DLBindStatusCallback, IBindStatusCallback_iface); 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) static ULONG WINAPI DLBindStatusCallback_AddRef(IBindStatusCallback *iface)
{ {
DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface); DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
@ -237,25 +250,6 @@ static ULONG WINAPI DLBindStatusCallback_Release(IBindStatusCallback *iface)
return ref; 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( static HRESULT WINAPI DLBindStatusCallback_GetBindInfo(
IBindStatusCallback *iface, IBindStatusCallback *iface,
DWORD *grfBINDF, DWORD *grfBINDF,

View file

@ -20,12 +20,17 @@
#include "qmgr.h" #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) static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface)
{ {
return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, 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) IBackgroundCopyJob2 *iface, REFIID riid, void **obj)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
@ -45,7 +50,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_QueryInterface(
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface) static ULONG WINAPI BackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
@ -53,7 +58,7 @@ static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface)
return ref; return ref;
} }
static ULONG WINAPI BITS_IBackgroundCopyJob_Release(IBackgroundCopyJob2 *iface) static ULONG WINAPI BackgroundCopyJob_Release(IBackgroundCopyJob2 *iface)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
@ -64,7 +69,10 @@ static ULONG WINAPI BITS_IBackgroundCopyJob_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); HeapFree(GetProcessHeap(), 0, This);
} }
@ -73,50 +81,56 @@ static ULONG WINAPI BITS_IBackgroundCopyJob_Release(IBackgroundCopyJob2 *iface)
/*** IBackgroundCopyJob methods ***/ /*** IBackgroundCopyJob methods ***/
static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFileSet( static HRESULT WINAPI BackgroundCopyJob_AddFileSet(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG cFileCount, ULONG cFileCount,
BG_FILE_INFO *pFileSet) BG_FILE_INFO *pFileSet)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
HRESULT hr = S_OK;
ULONG i; ULONG i;
TRACE("(%p)->(%d %p)\n", This, cFileCount, pFileSet);
EnterCriticalSection(&This->cs);
for (i = 0; i < cFileCount; ++i) for (i = 0; i < cFileCount; ++i)
{ {
HRESULT hr = IBackgroundCopyJob2_AddFile(iface, pFileSet[i].RemoteName, BackgroundCopyFileImpl *file;
pFileSet[i].LocalName);
if (FAILED(hr)) /* We should return E_INVALIDARG in these cases. */
return hr; 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;
} }
return S_OK;
LeaveCriticalSection(&This->cs);
return hr;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile( static HRESULT WINAPI BackgroundCopyJob_AddFile(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPCWSTR RemoteUrl, LPCWSTR RemoteUrl,
LPCWSTR LocalName) LPCWSTR LocalName)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
BackgroundCopyFileImpl *file; BG_FILE_INFO file;
HRESULT res;
/* We should return E_INVALIDARG in these cases. */ TRACE("(%p)->(%s %s)\n", This, debugstr_w(RemoteUrl), debugstr_w(LocalName));
FIXME("Check for valid filenames and supported protocols\n");
res = BackgroundCopyFileConstructor(This, RemoteUrl, LocalName, &file); file.RemoteName = (LPWSTR)RemoteUrl;
if (res != S_OK) file.LocalName = (LPWSTR)LocalName;
return res; return IBackgroundCopyJob2_AddFileSet(iface, 1, &file);
/* 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( static HRESULT WINAPI BackgroundCopyJob_EnumFiles(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
IEnumBackgroundCopyFiles **enum_files) IEnumBackgroundCopyFiles **enum_files)
{ {
@ -125,22 +139,24 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_EnumFiles(
return EnumBackgroundCopyFilesConstructor(This, enum_files); return EnumBackgroundCopyFilesConstructor(This, enum_files);
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend( static HRESULT WINAPI BackgroundCopyJob_Suspend(
IBackgroundCopyJob2 *iface) IBackgroundCopyJob2 *iface)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume( static HRESULT WINAPI BackgroundCopyJob_Resume(
IBackgroundCopyJob2 *iface) IBackgroundCopyJob2 *iface)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
HRESULT rv = S_OK; HRESULT rv = S_OK;
TRACE("(%p)\n", This);
EnterCriticalSection(&globalMgr.cs); EnterCriticalSection(&globalMgr.cs);
if (This->state == BG_JOB_STATE_CANCELLED if (is_job_done(This))
|| This->state == BG_JOB_STATE_ACKNOWLEDGED)
{ {
rv = BG_E_INVALID_STATE; rv = BG_E_INVALID_STATE;
} }
@ -159,23 +175,25 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
return rv; return rv;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel( static HRESULT WINAPI BackgroundCopyJob_Cancel(
IBackgroundCopyJob2 *iface) IBackgroundCopyJob2 *iface)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete( static HRESULT WINAPI BackgroundCopyJob_Complete(
IBackgroundCopyJob2 *iface) IBackgroundCopyJob2 *iface)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
HRESULT rv = S_OK; HRESULT rv = S_OK;
TRACE("(%p)\n", This);
EnterCriticalSection(&This->cs); EnterCriticalSection(&This->cs);
if (This->state == BG_JOB_STATE_CANCELLED if (is_job_done(This))
|| This->state == BG_JOB_STATE_ACKNOWLEDGED)
{ {
rv = BG_E_INVALID_STATE; rv = BG_E_INVALID_STATE;
} }
@ -208,21 +226,24 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete(
return rv; return rv;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId( static HRESULT WINAPI BackgroundCopyJob_GetId(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
GUID *pVal) GUID *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
*pVal = This->jobId; *pVal = This->jobId;
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType( static HRESULT WINAPI BackgroundCopyJob_GetType(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_TYPE *pVal) BG_JOB_TYPE *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) if (!pVal)
return E_INVALIDARG; return E_INVALIDARG;
@ -230,12 +251,14 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType(
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress( static HRESULT WINAPI BackgroundCopyJob_GetProgress(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_PROGRESS *pVal) BG_JOB_PROGRESS *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) if (!pVal)
return E_INVALIDARG; return E_INVALIDARG;
@ -249,20 +272,23 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetTimes( static HRESULT WINAPI BackgroundCopyJob_GetTimes(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_TIMES *pVal) BG_JOB_TIMES *pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, pVal);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState( static HRESULT WINAPI BackgroundCopyJob_GetState(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_STATE *pVal) BG_JOB_STATE *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) if (!pVal)
return E_INVALIDARG; return E_INVALIDARG;
@ -271,113 +297,191 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetError( static HRESULT WINAPI BackgroundCopyJob_GetError(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
IBackgroundCopyError **ppError) IBackgroundCopyError **ppError)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, ppError);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetOwner( static HRESULT WINAPI BackgroundCopyJob_GetOwner(
IBackgroundCopyJob2 *iface,
LPWSTR *pVal)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDisplayName(
IBackgroundCopyJob2 *iface,
LPCWSTR Val)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPWSTR *pVal) LPWSTR *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
int n; FIXME("(%p)->(%p): stub\n", This, pVal);
return E_NOTIMPL;
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( static HRESULT WINAPI BackgroundCopyJob_SetDisplayName(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPCWSTR Val) LPCWSTR Val)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(Val));
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDescription( static HRESULT WINAPI BackgroundCopyJob_GetDisplayName(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPWSTR *pVal) LPWSTR *pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pVal);
return return_strval(This->displayName, pVal);
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority( static HRESULT WINAPI BackgroundCopyJob_SetDescription(
IBackgroundCopyJob2 *iface,
LPCWSTR Val)
{
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)
{
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, IBackgroundCopyJob2 *iface,
BG_JOB_PRIORITY Val) BG_JOB_PRIORITY Val)
{ {
FIXME("(%p,0x%08x) stub\n", iface, Val); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%d): stub\n", This, Val);
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetPriority( static HRESULT WINAPI BackgroundCopyJob_GetPriority(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_PRIORITY *pVal) BG_JOB_PRIORITY *pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, pVal);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyFlags( static HRESULT WINAPI BackgroundCopyJob_SetNotifyFlags(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG Val) ULONG Val)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
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 (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 BITS_IBackgroundCopyJob_GetNotifyFlags( static HRESULT WINAPI BackgroundCopyJob_GetNotifyFlags(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG *pVal) ULONG *pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pVal);
if (!pVal) return E_INVALIDARG;
*pVal = This->notify_flags;
return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyInterface( static HRESULT WINAPI BackgroundCopyJob_SetNotifyInterface(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
IUnknown *Val) IUnknown *Val)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
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 BITS_IBackgroundCopyJob_GetNotifyInterface( static HRESULT WINAPI BackgroundCopyJob_GetNotifyInterface(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
IUnknown **pVal) IUnknown **pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
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 BITS_IBackgroundCopyJob_SetMinimumRetryDelay( static HRESULT WINAPI BackgroundCopyJob_SetMinimumRetryDelay(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG Seconds) ULONG Seconds)
{ {
@ -385,180 +489,195 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_SetMinimumRetryDelay(
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetMinimumRetryDelay( static HRESULT WINAPI BackgroundCopyJob_GetMinimumRetryDelay(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG *Seconds) ULONG *Seconds)
{ {
FIXME("%p\n", Seconds); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, Seconds);
*Seconds = 30; *Seconds = 30;
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNoProgressTimeout( static HRESULT WINAPI BackgroundCopyJob_SetNoProgressTimeout(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG Seconds) ULONG Seconds)
{ {
FIXME("%u\n", Seconds); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%d): stub\n", This, Seconds);
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNoProgressTimeout( static HRESULT WINAPI BackgroundCopyJob_GetNoProgressTimeout(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG *Seconds) ULONG *Seconds)
{ {
FIXME("%p\n", Seconds); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, Seconds);
*Seconds = 900; *Seconds = 900;
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetErrorCount( static HRESULT WINAPI BackgroundCopyJob_GetErrorCount(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
ULONG *Errors) ULONG *Errors)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, Errors);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetProxySettings( static HRESULT WINAPI BackgroundCopyJob_SetProxySettings(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_PROXY_USAGE ProxyUsage, BG_JOB_PROXY_USAGE ProxyUsage,
const WCHAR *ProxyList, const WCHAR *ProxyList,
const WCHAR *ProxyBypassList) const WCHAR *ProxyBypassList)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%d %s %s): stub\n", This, ProxyUsage, debugstr_w(ProxyList), debugstr_w(ProxyBypassList));
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProxySettings( static HRESULT WINAPI BackgroundCopyJob_GetProxySettings(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_PROXY_USAGE *pProxyUsage, BG_JOB_PROXY_USAGE *pProxyUsage,
LPWSTR *pProxyList, LPWSTR *pProxyList,
LPWSTR *pProxyBypassList) LPWSTR *pProxyBypassList)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p %p %p): stub\n", This, pProxyUsage, pProxyList, pProxyBypassList);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_TakeOwnership( static HRESULT WINAPI BackgroundCopyJob_TakeOwnership(
IBackgroundCopyJob2 *iface) IBackgroundCopyJob2 *iface)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetNotifyCmdLine( static HRESULT WINAPI BackgroundCopyJob_SetNotifyCmdLine(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPCWSTR prog, LPCWSTR prog,
LPCWSTR params) LPCWSTR params)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%s %s): stub\n", This, debugstr_w(prog), debugstr_w(params));
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetNotifyCmdLine( static HRESULT WINAPI BackgroundCopyJob_GetNotifyCmdLine(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPWSTR *prog, LPWSTR *prog,
LPWSTR *params) LPWSTR *params)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p %p): stub\n", This, prog, params);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyProgress( static HRESULT WINAPI BackgroundCopyJob_GetReplyProgress(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_JOB_REPLY_PROGRESS *progress) BG_JOB_REPLY_PROGRESS *progress)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, progress);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyData( static HRESULT WINAPI BackgroundCopyJob_GetReplyData(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
byte **pBuffer, byte **pBuffer,
UINT64 *pLength) UINT64 *pLength)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p %p): stub\n", This, pBuffer, pLength);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetReplyFileName( static HRESULT WINAPI BackgroundCopyJob_SetReplyFileName(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPCWSTR filename) LPCWSTR filename)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(filename));
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetReplyFileName( static HRESULT WINAPI BackgroundCopyJob_GetReplyFileName(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPWSTR *pFilename) LPWSTR *pFilename)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, pFilename);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetCredentials( static HRESULT WINAPI BackgroundCopyJob_SetCredentials(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_AUTH_CREDENTIALS *cred) BG_AUTH_CREDENTIALS *cred)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%p): stub\n", This, cred);
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_RemoveCredentials( static HRESULT WINAPI BackgroundCopyJob_RemoveCredentials(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
BG_AUTH_TARGET target, BG_AUTH_TARGET target,
BG_AUTH_SCHEME scheme) BG_AUTH_SCHEME scheme)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
FIXME("(%p)->(%d %d): stub\n", This, target, scheme);
return S_OK; return S_OK;
} }
static const IBackgroundCopyJob2Vtbl BITS_IBackgroundCopyJob_Vtbl = static const IBackgroundCopyJob2Vtbl BackgroundCopyJobVtbl =
{ {
BITS_IBackgroundCopyJob_QueryInterface, BackgroundCopyJob_QueryInterface,
BITS_IBackgroundCopyJob_AddRef, BackgroundCopyJob_AddRef,
BITS_IBackgroundCopyJob_Release, BackgroundCopyJob_Release,
BITS_IBackgroundCopyJob_AddFileSet, BackgroundCopyJob_AddFileSet,
BITS_IBackgroundCopyJob_AddFile, BackgroundCopyJob_AddFile,
BITS_IBackgroundCopyJob_EnumFiles, BackgroundCopyJob_EnumFiles,
BITS_IBackgroundCopyJob_Suspend, BackgroundCopyJob_Suspend,
BITS_IBackgroundCopyJob_Resume, BackgroundCopyJob_Resume,
BITS_IBackgroundCopyJob_Cancel, BackgroundCopyJob_Cancel,
BITS_IBackgroundCopyJob_Complete, BackgroundCopyJob_Complete,
BITS_IBackgroundCopyJob_GetId, BackgroundCopyJob_GetId,
BITS_IBackgroundCopyJob_GetType, BackgroundCopyJob_GetType,
BITS_IBackgroundCopyJob_GetProgress, BackgroundCopyJob_GetProgress,
BITS_IBackgroundCopyJob_GetTimes, BackgroundCopyJob_GetTimes,
BITS_IBackgroundCopyJob_GetState, BackgroundCopyJob_GetState,
BITS_IBackgroundCopyJob_GetError, BackgroundCopyJob_GetError,
BITS_IBackgroundCopyJob_GetOwner, BackgroundCopyJob_GetOwner,
BITS_IBackgroundCopyJob_SetDisplayName, BackgroundCopyJob_SetDisplayName,
BITS_IBackgroundCopyJob_GetDisplayName, BackgroundCopyJob_GetDisplayName,
BITS_IBackgroundCopyJob_SetDescription, BackgroundCopyJob_SetDescription,
BITS_IBackgroundCopyJob_GetDescription, BackgroundCopyJob_GetDescription,
BITS_IBackgroundCopyJob_SetPriority, BackgroundCopyJob_SetPriority,
BITS_IBackgroundCopyJob_GetPriority, BackgroundCopyJob_GetPriority,
BITS_IBackgroundCopyJob_SetNotifyFlags, BackgroundCopyJob_SetNotifyFlags,
BITS_IBackgroundCopyJob_GetNotifyFlags, BackgroundCopyJob_GetNotifyFlags,
BITS_IBackgroundCopyJob_SetNotifyInterface, BackgroundCopyJob_SetNotifyInterface,
BITS_IBackgroundCopyJob_GetNotifyInterface, BackgroundCopyJob_GetNotifyInterface,
BITS_IBackgroundCopyJob_SetMinimumRetryDelay, BackgroundCopyJob_SetMinimumRetryDelay,
BITS_IBackgroundCopyJob_GetMinimumRetryDelay, BackgroundCopyJob_GetMinimumRetryDelay,
BITS_IBackgroundCopyJob_SetNoProgressTimeout, BackgroundCopyJob_SetNoProgressTimeout,
BITS_IBackgroundCopyJob_GetNoProgressTimeout, BackgroundCopyJob_GetNoProgressTimeout,
BITS_IBackgroundCopyJob_GetErrorCount, BackgroundCopyJob_GetErrorCount,
BITS_IBackgroundCopyJob_SetProxySettings, BackgroundCopyJob_SetProxySettings,
BITS_IBackgroundCopyJob_GetProxySettings, BackgroundCopyJob_GetProxySettings,
BITS_IBackgroundCopyJob_TakeOwnership, BackgroundCopyJob_TakeOwnership,
BITS_IBackgroundCopyJob_SetNotifyCmdLine, BackgroundCopyJob_SetNotifyCmdLine,
BITS_IBackgroundCopyJob_GetNotifyCmdLine, BackgroundCopyJob_GetNotifyCmdLine,
BITS_IBackgroundCopyJob_GetReplyProgress, BackgroundCopyJob_GetReplyProgress,
BITS_IBackgroundCopyJob_GetReplyData, BackgroundCopyJob_GetReplyData,
BITS_IBackgroundCopyJob_SetReplyFileName, BackgroundCopyJob_SetReplyFileName,
BITS_IBackgroundCopyJob_GetReplyFileName, BackgroundCopyJob_GetReplyFileName,
BITS_IBackgroundCopyJob_SetCredentials, BackgroundCopyJob_SetCredentials,
BITS_IBackgroundCopyJob_RemoveCredentials BackgroundCopyJob_RemoveCredentials
}; };
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *job_id, BackgroundCopyJobImpl **job) HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *job_id, BackgroundCopyJobImpl **job)
@ -573,14 +692,14 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IBackgroundCopyJob2_iface.lpVtbl = &BITS_IBackgroundCopyJob_Vtbl; This->IBackgroundCopyJob2_iface.lpVtbl = &BackgroundCopyJobVtbl;
InitializeCriticalSection(&This->cs); InitializeCriticalSection(&This->cs);
This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BackgroundCopyJobImpl.cs"); This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BackgroundCopyJobImpl.cs");
This->ref = 1; This->ref = 1;
This->type = type; This->type = type;
n = (lstrlenW(displayName) + 1) * sizeof *displayName; n = (strlenW(displayName) + 1) * sizeof *displayName;
This->displayName = HeapAlloc(GetProcessHeap(), 0, n); This->displayName = HeapAlloc(GetProcessHeap(), 0, n);
if (!This->displayName) if (!This->displayName)
{ {
@ -609,8 +728,15 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
This->jobProgress.FilesTransferred = 0; This->jobProgress.FilesTransferred = 0;
This->state = BG_JOB_STATE_SUSPENDED; 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; *job = This;
TRACE("created job %s:%p\n", debugstr_guid(&This->jobId), This);
return S_OK; return S_OK;
} }

View file

@ -22,10 +22,10 @@
BackgroundCopyManagerImpl globalMgr; BackgroundCopyManagerImpl globalMgr;
static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface, static HRESULT WINAPI BackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface,
REFIID riid, void **ppv) 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)) if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBackgroundCopyManager))
{ {
@ -38,24 +38,25 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(IBackgroundCopy
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(IBackgroundCopyManager *iface) static ULONG WINAPI BackgroundCopyManager_AddRef(IBackgroundCopyManager *iface)
{ {
return 2; return 2;
} }
static ULONG WINAPI BITS_IBackgroundCopyManager_Release(IBackgroundCopyManager *iface) static ULONG WINAPI BackgroundCopyManager_Release(IBackgroundCopyManager *iface)
{ {
return 1; return 1;
} }
/*** IBackgroundCopyManager interface methods ***/ /*** 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) LPCWSTR DisplayName, BG_JOB_TYPE Type, GUID *pJobId, IBackgroundCopyJob **ppJob)
{ {
BackgroundCopyJobImpl *job; BackgroundCopyJobImpl *job;
HRESULT hres; HRESULT hres;
TRACE("\n");
TRACE("(%s %d %p %p)\n", debugstr_w(DisplayName), Type, pJobId, ppJob);
hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId, &job); hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId, &job);
if (FAILED(hres)) if (FAILED(hres))
@ -70,50 +71,73 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(IBackgroundCopyManag
return S_OK; return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(IBackgroundCopyManager *iface, static HRESULT WINAPI BackgroundCopyManager_GetJob(IBackgroundCopyManager *iface,
REFGUID jobID, IBackgroundCopyJob **ppJob) REFGUID jobID, IBackgroundCopyJob **job)
{ {
FIXME("Not implemented\n"); BackgroundCopyManagerImpl *qmgr = &globalMgr;
return E_NOTIMPL; 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 BITS_IBackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface, static HRESULT WINAPI BackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface,
DWORD dwFlags, IEnumBackgroundCopyJobs **ppEnum) DWORD flags, IEnumBackgroundCopyJobs **ppEnum)
{ {
TRACE("\n"); TRACE("(0x%x %p)\n", flags, ppEnum);
return enum_copy_job_create(&globalMgr, ppEnum); return enum_copy_job_create(&globalMgr, ppEnum);
} }
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface, static HRESULT WINAPI BackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface,
HRESULT hResult, DWORD LanguageId, LPWSTR *pErrorDescription) HRESULT hr, DWORD langid, LPWSTR *error_description)
{ {
FIXME("Not implemented\n"); FIXME("(0x%08x 0x%x %p): stub\n", hr, langid, error_description);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const IBackgroundCopyManagerVtbl BackgroundCopyManagerVtbl =
static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
{ {
BITS_IBackgroundCopyManager_QueryInterface, BackgroundCopyManager_QueryInterface,
BITS_IBackgroundCopyManager_AddRef, BackgroundCopyManager_AddRef,
BITS_IBackgroundCopyManager_Release, BackgroundCopyManager_Release,
BITS_IBackgroundCopyManager_CreateJob, BackgroundCopyManager_CreateJob,
BITS_IBackgroundCopyManager_GetJob, BackgroundCopyManager_GetJob,
BITS_IBackgroundCopyManager_EnumJobs, BackgroundCopyManager_EnumJobs,
BITS_IBackgroundCopyManager_GetErrorDescription BackgroundCopyManager_GetErrorDescription
}; };
BackgroundCopyManagerImpl globalMgr = { BackgroundCopyManagerImpl globalMgr = {
{ &BITS_IBackgroundCopyManager_Vtbl }, { &BackgroundCopyManagerVtbl },
{ NULL, -1, 0, 0, 0, 0 }, { NULL, -1, 0, 0, 0, 0 },
NULL, NULL,
LIST_INIT(globalMgr.jobs) LIST_INIT(globalMgr.jobs)
}; };
/* Constructor for instances of background copy manager */ /* Constructor for instances of background copy manager */
HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj) HRESULT BackgroundCopyManagerConstructor(LPVOID *ppObj)
{ {
TRACE("(%p,%p)\n", pUnkOuter, ppObj); TRACE("(%p)\n", ppObj);
*ppObj = &globalMgr; *ppObj = &globalMgr;
return S_OK; return S_OK;
} }

View file

@ -34,9 +34,11 @@
#include <winsvc.h> #include <winsvc.h>
#include <objbase.h> #include <objbase.h>
#include <bits1_5.h> #include <bits1_5.h>
#include <bits3_0.h>
#include <wine/list.h> #include <wine/list.h>
#include <wine/debug.h> #include <wine/debug.h>
#include <wine/unicode.h>
WINE_DEFAULT_DEBUG_CHANNEL(qmgr); WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
@ -46,11 +48,15 @@ typedef struct
IBackgroundCopyJob2 IBackgroundCopyJob2_iface; IBackgroundCopyJob2 IBackgroundCopyJob2_iface;
LONG ref; LONG ref;
LPWSTR displayName; LPWSTR displayName;
LPWSTR description;
BG_JOB_TYPE type; BG_JOB_TYPE type;
GUID jobId; GUID jobId;
struct list files; struct list files;
BG_JOB_PROGRESS jobProgress; BG_JOB_PROGRESS jobProgress;
BG_JOB_STATE state; BG_JOB_STATE state;
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;
@ -87,7 +93,7 @@ extern HANDLE stop_event DECLSPEC_HIDDEN;
extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN; extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN;
extern BackgroundCopyManagerImpl globalMgr 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, HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN; GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN;
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr,
@ -109,6 +115,19 @@ qmgr_strdup(const char *s)
return d ? memcpy(d, s, n) : NULL; 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 static inline BOOL
transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState, transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState,
BG_JOB_STATE toState) BG_JOB_STATE toState)

View file

@ -16,7 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#pragma makedep ident
#include "bits.idl" #include "bits.idl"
#define DO_NO_IMPORTS #define DO_NO_IMPORTS
#include "bits1_5.idl" #include "bits1_5.idl"
#include "bits3_0.idl"

View file

@ -98,35 +98,6 @@ static void cleanup_register_strtable(STRTABLEA *strtable)
} }
} }
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 */ /* Use an INF file to register or unregister the DLL */
static HRESULT register_server(BOOL do_register) static HRESULT register_server(BOOL do_register)
{ {
@ -138,12 +109,6 @@ static HRESULT register_server(BOOL do_register)
TRACE("(%x)\n", do_register); 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); hAdvpack = LoadLibraryW(wszAdvpack);
pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall"); pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall");

View file

@ -159,7 +159,7 @@ reactos/dll/win32/powrprof # Forked at Wine-1.0rc5
reactos/dll/win32/printui # Synced to Wine-1.7.1 reactos/dll/win32/printui # Synced to Wine-1.7.1
reactos/dll/win32/propsys # Synced to Wine-1.7.17 reactos/dll/win32/propsys # Synced to Wine-1.7.17
reactos/dll/win32/pstorec # Synced to Wine-1.7.1 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/qmgrprxy # Synced to Wine-1.7.1
reactos/dll/win32/query # 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 reactos/dll/win32/rasapi32 # Synced to Wine-1.7.1