mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
[QMGR]
* Sync with Wine 1.5.26. svn path=/trunk/; revision=59226
This commit is contained in:
@@ -18,6 +18,7 @@ list(APPEND SOURCE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/qmgr.def)
|
||||
|
||||
add_library(qmgr SHARED ${SOURCE})
|
||||
set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/qmgr.inf)
|
||||
add_idl_headers(qmgr_idlheader qmgr_local.idl)
|
||||
set_module_type(qmgr win32dll)
|
||||
target_link_libraries(qmgr uuid wine)
|
||||
|
||||
@@ -23,64 +23,67 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
static void EnumBackgroundCopyFilesDestructor(EnumBackgroundCopyFilesImpl *This)
|
||||
typedef struct
|
||||
{
|
||||
ULONG i;
|
||||
IEnumBackgroundCopyFiles IEnumBackgroundCopyFiles_iface;
|
||||
LONG ref;
|
||||
IBackgroundCopyFile **files;
|
||||
ULONG numFiles;
|
||||
ULONG indexFiles;
|
||||
} EnumBackgroundCopyFilesImpl;
|
||||
|
||||
for(i = 0; i < This->numFiles; i++)
|
||||
IBackgroundCopyFile_Release(This->files[i]);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->files);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
static inline EnumBackgroundCopyFilesImpl *impl_from_IEnumBackgroundCopyFiles(IEnumBackgroundCopyFiles *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, EnumBackgroundCopyFilesImpl, IEnumBackgroundCopyFiles_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_AddRef(
|
||||
IEnumBackgroundCopyFiles* iface)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_QueryInterface(IEnumBackgroundCopyFiles *iface,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_QueryInterface(
|
||||
IEnumBackgroundCopyFiles* iface,
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
TRACE("IID: %s\n", debugstr_guid(riid));
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IEnumBackgroundCopyFiles))
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyFiles))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
BITS_IEnumBackgroundCopyFiles_AddRef(iface);
|
||||
*ppv = iface;
|
||||
IEnumBackgroundCopyFiles_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = NULL;
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(
|
||||
IEnumBackgroundCopyFiles* iface)
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_AddRef(IEnumBackgroundCopyFiles *iface)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *iface)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
ULONG i;
|
||||
|
||||
if (ref == 0)
|
||||
EnumBackgroundCopyFilesDestructor(This);
|
||||
{
|
||||
for(i = 0; i < This->numFiles; i++)
|
||||
IBackgroundCopyFile_Release(This->files[i]);
|
||||
HeapFree(GetProcessHeap(), 0, This->files);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* Return reference to one or more files in the file enumerator */
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(
|
||||
IEnumBackgroundCopyFiles* iface,
|
||||
ULONG celt,
|
||||
IBackgroundCopyFile **rgelt,
|
||||
ULONG *pceltFetched)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *iface,
|
||||
ULONG celt, IBackgroundCopyFile **rgelt, ULONG *pceltFetched)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
ULONG fetched;
|
||||
ULONG i;
|
||||
IBackgroundCopyFile *file;
|
||||
@@ -115,11 +118,10 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(
|
||||
}
|
||||
|
||||
/* Skip over one or more files in the file enumerator */
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(
|
||||
IEnumBackgroundCopyFiles* iface,
|
||||
ULONG celt)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(IEnumBackgroundCopyFiles *iface,
|
||||
ULONG celt)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
|
||||
if (celt > This->numFiles - This->indexFiles)
|
||||
{
|
||||
@@ -131,27 +133,24 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Reset(
|
||||
IEnumBackgroundCopyFiles* iface)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Reset(IEnumBackgroundCopyFiles *iface)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
This->indexFiles = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Clone(
|
||||
IEnumBackgroundCopyFiles* iface,
|
||||
IEnumBackgroundCopyFiles **ppenum)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Clone(IEnumBackgroundCopyFiles *iface,
|
||||
IEnumBackgroundCopyFiles **ppenum)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_GetCount(
|
||||
IEnumBackgroundCopyFiles* iface,
|
||||
ULONG *puCount)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_GetCount(IEnumBackgroundCopyFiles *iface,
|
||||
ULONG *puCount)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
|
||||
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
|
||||
*puCount = This->numFiles;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -168,20 +167,19 @@ static const IEnumBackgroundCopyFilesVtbl BITS_IEnumBackgroundCopyFiles_Vtbl =
|
||||
BITS_IEnumBackgroundCopyFiles_GetCount
|
||||
};
|
||||
|
||||
HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob2 *iCopyJob)
|
||||
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBackgroundCopyFiles **enum_files)
|
||||
{
|
||||
EnumBackgroundCopyFilesImpl *This;
|
||||
BackgroundCopyFileImpl *file;
|
||||
BackgroundCopyJobImpl *job = (BackgroundCopyJobImpl *) iCopyJob;
|
||||
ULONG i;
|
||||
|
||||
TRACE("%p, %p)\n", ppObj, job);
|
||||
TRACE("%p, %p)\n", job, enum_files);
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->lpVtbl = &BITS_IEnumBackgroundCopyFiles_Vtbl;
|
||||
This->IEnumBackgroundCopyFiles_iface.lpVtbl = &BITS_IEnumBackgroundCopyFiles_Vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
/* Create array of files */
|
||||
@@ -204,12 +202,12 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob2 *i
|
||||
i = 0;
|
||||
LIST_FOR_EACH_ENTRY(file, &job->files, BackgroundCopyFileImpl, entryFromJob)
|
||||
{
|
||||
file->lpVtbl->AddRef((IBackgroundCopyFile *) file);
|
||||
This->files[i] = (IBackgroundCopyFile *) file;
|
||||
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
|
||||
This->files[i] = &file->IBackgroundCopyFile_iface;
|
||||
++i;
|
||||
}
|
||||
LeaveCriticalSection(&job->cs);
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
*enum_files = &This->IEnumBackgroundCopyFiles_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -23,63 +23,68 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
static void EnumBackgroundCopyJobsDestructor(EnumBackgroundCopyJobsImpl *This)
|
||||
typedef struct
|
||||
{
|
||||
ULONG i;
|
||||
IEnumBackgroundCopyJobs IEnumBackgroundCopyJobs_iface;
|
||||
LONG ref;
|
||||
IBackgroundCopyJob **jobs;
|
||||
ULONG numJobs;
|
||||
ULONG indexJobs;
|
||||
} EnumBackgroundCopyJobsImpl;
|
||||
|
||||
for(i = 0; i < This->numJobs; i++)
|
||||
IBackgroundCopyJob_Release(This->jobs[i]);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->jobs);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
static inline EnumBackgroundCopyJobsImpl *impl_from_IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobs *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, EnumBackgroundCopyJobsImpl, IEnumBackgroundCopyJobs_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_AddRef(
|
||||
IEnumBackgroundCopyJobs* iface)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_QueryInterface(IEnumBackgroundCopyJobs *iface,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_QueryInterface(
|
||||
IEnumBackgroundCopyJobs* iface,
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
TRACE("IID: %s\n", debugstr_guid(riid));
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs))
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumBackgroundCopyJobs))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
BITS_IEnumBackgroundCopyJobs_AddRef(iface);
|
||||
*ppv = iface;
|
||||
IEnumBackgroundCopyJobs_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = NULL;
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(
|
||||
IEnumBackgroundCopyJobs* iface)
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_AddRef(IEnumBackgroundCopyJobs *iface)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
if (ref == 0)
|
||||
EnumBackgroundCopyJobsDestructor(This);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(
|
||||
IEnumBackgroundCopyJobs* iface,
|
||||
ULONG celt,
|
||||
IBackgroundCopyJob **rgelt,
|
||||
ULONG *pceltFetched)
|
||||
static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(IEnumBackgroundCopyJobs *iface)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
ULONG i;
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
for(i = 0; i < This->numJobs; i++)
|
||||
IBackgroundCopyJob_Release(This->jobs[i]);
|
||||
HeapFree(GetProcessHeap(), 0, This->jobs);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(IEnumBackgroundCopyJobs *iface, ULONG celt,
|
||||
IBackgroundCopyJob **rgelt, ULONG *pceltFetched)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
ULONG fetched;
|
||||
ULONG i;
|
||||
IBackgroundCopyJob *job;
|
||||
@@ -110,11 +115,9 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Next(
|
||||
return fetched == celt ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(
|
||||
IEnumBackgroundCopyJobs* iface,
|
||||
ULONG celt)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(IEnumBackgroundCopyJobs *iface, ULONG celt)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
|
||||
if (This->numJobs - This->indexJobs < celt)
|
||||
{
|
||||
@@ -126,27 +129,24 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(
|
||||
IEnumBackgroundCopyJobs* iface)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(IEnumBackgroundCopyJobs *iface)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
This->indexJobs = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(
|
||||
IEnumBackgroundCopyJobs* iface,
|
||||
IEnumBackgroundCopyJobs **ppenum)
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(IEnumBackgroundCopyJobs *iface,
|
||||
IEnumBackgroundCopyJobs **ppenum)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(
|
||||
IEnumBackgroundCopyJobs* iface,
|
||||
static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(IEnumBackgroundCopyJobs *iface,
|
||||
ULONG *puCount)
|
||||
{
|
||||
EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
|
||||
EnumBackgroundCopyJobsImpl *This = impl_from_IEnumBackgroundCopyJobs(iface);
|
||||
*puCount = This->numJobs;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -163,20 +163,18 @@ static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl =
|
||||
BITS_IEnumBackgroundCopyJobs_GetCount
|
||||
};
|
||||
|
||||
HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
|
||||
IBackgroundCopyManager* copyManager)
|
||||
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr, IEnumBackgroundCopyJobs **enumjob)
|
||||
{
|
||||
BackgroundCopyManagerImpl *qmgr = (BackgroundCopyManagerImpl *) copyManager;
|
||||
EnumBackgroundCopyJobsImpl *This;
|
||||
BackgroundCopyJobImpl *job;
|
||||
ULONG i;
|
||||
|
||||
TRACE("%p, %p)\n", ppObj, copyManager);
|
||||
TRACE("%p, %p)\n", qmgr, enumjob);
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
This->lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl;
|
||||
This->IEnumBackgroundCopyJobs_iface.lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
/* Create array of jobs */
|
||||
@@ -202,12 +200,12 @@ HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
|
||||
i = 0;
|
||||
LIST_FOR_EACH_ENTRY(job, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
|
||||
{
|
||||
IBackgroundCopyJob *iJob = (IBackgroundCopyJob *) job;
|
||||
IBackgroundCopyJob_AddRef(iJob);
|
||||
This->jobs[i++] = iJob;
|
||||
IBackgroundCopyJob *job_iface = (IBackgroundCopyJob*)&job->IBackgroundCopyJob2_iface;
|
||||
IBackgroundCopyJob_AddRef(job_iface);
|
||||
This->jobs[i++] = job_iface;
|
||||
}
|
||||
LeaveCriticalSection(&qmgr->cs);
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
*enumjob = &This->IEnumBackgroundCopyJobs_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -26,20 +26,17 @@
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
static ULONG WINAPI
|
||||
BITS_IClassFactory_AddRef(LPCLASSFACTORY iface)
|
||||
BITS_IClassFactory_AddRef(IClassFactory *iface)
|
||||
{
|
||||
return 2;
|
||||
return 2; /* non-heap based object */
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
BITS_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
BITS_IClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppvObj)
|
||||
{
|
||||
ClassFactoryImpl *This = (ClassFactoryImpl *) iface;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppvObj = &This->lpVtbl;
|
||||
*ppvObj = &BITS_ClassFactory.IClassFactory_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -48,14 +45,14 @@ BITS_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
BITS_IClassFactory_Release(LPCLASSFACTORY iface)
|
||||
BITS_IClassFactory_Release(IClassFactory *iface)
|
||||
{
|
||||
return 1;
|
||||
return 1; /* non-heap based object */
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
BITS_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
|
||||
REFIID riid, LPVOID *ppvObj)
|
||||
BITS_IClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid,
|
||||
void **ppvObj)
|
||||
{
|
||||
HRESULT res;
|
||||
IUnknown *punk = NULL;
|
||||
@@ -75,7 +72,7 @@ BITS_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
BITS_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
|
||||
BITS_IClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
@@ -92,5 +89,5 @@ static const IClassFactoryVtbl BITS_IClassFactory_Vtbl =
|
||||
|
||||
ClassFactoryImpl BITS_ClassFactory =
|
||||
{
|
||||
&BITS_IClassFactory_Vtbl
|
||||
{ &BITS_IClassFactory_Vtbl }
|
||||
};
|
||||
|
||||
@@ -39,48 +39,55 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
static void BackgroundCopyFileDestructor(BackgroundCopyFileImpl *This)
|
||||
static inline BackgroundCopyFileImpl *impl_from_IBackgroundCopyFile(IBackgroundCopyFile *iface)
|
||||
{
|
||||
IBackgroundCopyJob_Release((IBackgroundCopyJob *) This->owner);
|
||||
HeapFree(GetProcessHeap(), 0, This->info.LocalName);
|
||||
HeapFree(GetProcessHeap(), 0, This->info.RemoteName);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface(
|
||||
IBackgroundCopyFile* iface,
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
void **obj)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IBackgroundCopyFile))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
BITS_IBackgroundCopyFile_AddRef(iface);
|
||||
*obj = iface;
|
||||
IBackgroundCopyFile_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = NULL;
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p)->(%d)\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyFile_Release(
|
||||
IBackgroundCopyFile* iface)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(%d)\n", This, ref);
|
||||
|
||||
if (ref == 0)
|
||||
BackgroundCopyFileDestructor(This);
|
||||
{
|
||||
IBackgroundCopyJob2_Release(&This->owner->IBackgroundCopyJob2_iface);
|
||||
HeapFree(GetProcessHeap(), 0, This->info.LocalName);
|
||||
HeapFree(GetProcessHeap(), 0, This->info.RemoteName);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
@@ -90,7 +97,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetRemoteName(
|
||||
IBackgroundCopyFile* iface,
|
||||
LPWSTR *pVal)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
int n = (lstrlenW(This->info.RemoteName) + 1) * sizeof(WCHAR);
|
||||
|
||||
*pVal = CoTaskMemAlloc(n);
|
||||
@@ -105,7 +112,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName(
|
||||
IBackgroundCopyFile* iface,
|
||||
LPWSTR *pVal)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR);
|
||||
|
||||
*pVal = CoTaskMemAlloc(n);
|
||||
@@ -120,7 +127,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
|
||||
IBackgroundCopyFile* iface,
|
||||
BG_FILE_PROGRESS *pVal)
|
||||
{
|
||||
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
|
||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||
|
||||
EnterCriticalSection(&This->owner->cs);
|
||||
pVal->BytesTotal = This->fileProgress.BytesTotal;
|
||||
@@ -143,13 +150,12 @@ static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
|
||||
|
||||
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
|
||||
LPCWSTR remoteName, LPCWSTR localName,
|
||||
LPVOID *ppObj)
|
||||
BackgroundCopyFileImpl **file)
|
||||
{
|
||||
BackgroundCopyFileImpl *This;
|
||||
int n;
|
||||
|
||||
TRACE("(%s,%s,%p)\n", debugstr_w(remoteName),
|
||||
debugstr_w(localName), ppObj);
|
||||
TRACE("(%s, %s, %p)\n", debugstr_w(remoteName), debugstr_w(localName), file);
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||
if (!This)
|
||||
@@ -174,16 +180,16 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
|
||||
}
|
||||
memcpy(This->info.LocalName, localName, n);
|
||||
|
||||
This->lpVtbl = &BITS_IBackgroundCopyFile_Vtbl;
|
||||
This->IBackgroundCopyFile_iface.lpVtbl = &BITS_IBackgroundCopyFile_Vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
|
||||
This->fileProgress.BytesTransferred = 0;
|
||||
This->fileProgress.Completed = FALSE;
|
||||
This->owner = owner;
|
||||
IBackgroundCopyJob_AddRef((IBackgroundCopyJob *) owner);
|
||||
IBackgroundCopyJob2_AddRef(&owner->IBackgroundCopyJob2_iface);
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
*file = This;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -217,25 +223,30 @@ static DWORD CALLBACK copyProgressCallback(LARGE_INTEGER totalSize,
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const IBindStatusCallbackVtbl *lpVtbl;
|
||||
IBindStatusCallback IBindStatusCallback_iface;
|
||||
BackgroundCopyFileImpl *file;
|
||||
LONG ref;
|
||||
} DLBindStatusCallback;
|
||||
|
||||
static inline DLBindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCallback *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, DLBindStatusCallback, IBindStatusCallback_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DLBindStatusCallback_AddRef(IBindStatusCallback *iface)
|
||||
{
|
||||
DLBindStatusCallback *This = (DLBindStatusCallback *) iface;
|
||||
DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DLBindStatusCallback_Release(IBindStatusCallback *iface)
|
||||
{
|
||||
DLBindStatusCallback *This = (DLBindStatusCallback *) iface;
|
||||
DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
IBackgroundCopyFile_Release((IBackgroundCopyFile *) This->file);
|
||||
IBackgroundCopyFile_Release(&This->file->IBackgroundCopyFile_iface);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
@@ -247,12 +258,12 @@ static HRESULT WINAPI DLBindStatusCallback_QueryInterface(
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
DLBindStatusCallback *This = (DLBindStatusCallback *) iface;
|
||||
DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IBindStatusCallback))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
*ppvObject = &This->IBindStatusCallback_iface;
|
||||
DLBindStatusCallback_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
@@ -308,7 +319,7 @@ static HRESULT WINAPI DLBindStatusCallback_OnProgress(
|
||||
ULONG statusCode,
|
||||
LPCWSTR statusText)
|
||||
{
|
||||
DLBindStatusCallback *This = (DLBindStatusCallback *) iface;
|
||||
DLBindStatusCallback *This = impl_from_IBindStatusCallback(iface);
|
||||
BackgroundCopyFileImpl *file = This->file;
|
||||
BackgroundCopyJobImpl *job = file->owner;
|
||||
ULONG64 diff;
|
||||
@@ -363,8 +374,8 @@ static DLBindStatusCallback *DLBindStatusCallbackConstructor(
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
This->lpVtbl = &DLBindStatusCallback_Vtbl;
|
||||
IBackgroundCopyFile_AddRef((IBackgroundCopyFile *) file);
|
||||
This->IBindStatusCallback_iface.lpVtbl = &DLBindStatusCallback_Vtbl;
|
||||
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
|
||||
This->file = file;
|
||||
This->ref = 1;
|
||||
return This;
|
||||
@@ -373,7 +384,7 @@ static DLBindStatusCallback *DLBindStatusCallbackConstructor(
|
||||
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job)
|
||||
{
|
||||
static const WCHAR prefix[] = {'B','I','T', 0};
|
||||
IBindStatusCallback *callbackObj;
|
||||
DLBindStatusCallback *callbackObj;
|
||||
WCHAR tmpDir[MAX_PATH];
|
||||
WCHAR tmpName[MAX_PATH];
|
||||
HRESULT hr;
|
||||
@@ -394,7 +405,7 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
callbackObj = (IBindStatusCallback *) DLBindStatusCallbackConstructor(file);
|
||||
callbackObj = DLBindStatusCallbackConstructor(file);
|
||||
if (!callbackObj)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
@@ -416,8 +427,9 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job)
|
||||
transitionJobState(job, BG_JOB_STATE_QUEUED, BG_JOB_STATE_TRANSFERRING);
|
||||
|
||||
DeleteUrlCacheEntryW(file->info.RemoteName);
|
||||
hr = URLDownloadToFileW(NULL, file->info.RemoteName, tmpName, 0, callbackObj);
|
||||
IBindStatusCallback_Release(callbackObj);
|
||||
hr = URLDownloadToFileW(NULL, file->info.RemoteName, tmpName, 0,
|
||||
&callbackObj->IBindStatusCallback_iface);
|
||||
IBindStatusCallback_Release(&callbackObj->IBindStatusCallback_iface);
|
||||
if (hr == INET_E_DOWNLOAD_FAILURE)
|
||||
{
|
||||
TRACE("URLDownload failed, trying local file copy\n");
|
||||
|
||||
@@ -28,45 +28,53 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
static void BackgroundCopyJobDestructor(BackgroundCopyJobImpl *This)
|
||||
static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
DeleteCriticalSection(&This->cs);
|
||||
HeapFree(GetProcessHeap(), 0, This->displayName);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_QueryInterface(
|
||||
IBackgroundCopyJob2 *iface, REFIID riid, LPVOID *ppvObject)
|
||||
IBackgroundCopyJob2 *iface, REFIID riid, void **obj)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
TRACE("IID: %s\n", debugstr_guid(riid));
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IBackgroundCopyJob)
|
||||
|| IsEqualGUID(riid, &IID_IBackgroundCopyJob2))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
BITS_IBackgroundCopyJob_AddRef(iface);
|
||||
*obj = iface;
|
||||
IBackgroundCopyJob2_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = NULL;
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyJob_AddRef(IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p)->(%d)\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyJob_Release(IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(%d)\n", This, ref);
|
||||
|
||||
if (ref == 0)
|
||||
BackgroundCopyJobDestructor(This);
|
||||
{
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
HeapFree(GetProcessHeap(), 0, This->displayName);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
@@ -81,7 +89,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFileSet(
|
||||
ULONG i;
|
||||
for (i = 0; i < cFileCount; ++i)
|
||||
{
|
||||
HRESULT hr = IBackgroundCopyJob_AddFile(iface, pFileSet[i].RemoteName,
|
||||
HRESULT hr = IBackgroundCopyJob2_AddFile(iface, pFileSet[i].RemoteName,
|
||||
pFileSet[i].LocalName);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
@@ -94,21 +102,19 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile(
|
||||
LPCWSTR RemoteUrl,
|
||||
LPCWSTR LocalName)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
IBackgroundCopyFile *pFile;
|
||||
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, (LPVOID *) &pFile);
|
||||
res = BackgroundCopyFileConstructor(This, RemoteUrl, LocalName, &file);
|
||||
if (res != S_OK)
|
||||
return res;
|
||||
|
||||
/* Add a reference to the file to file list */
|
||||
IBackgroundCopyFile_AddRef(pFile);
|
||||
file = (BackgroundCopyFileImpl *) pFile;
|
||||
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
|
||||
EnterCriticalSection(&This->cs);
|
||||
list_add_head(&This->files, &file->entryFromJob);
|
||||
This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN;
|
||||
@@ -120,10 +126,11 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile(
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_EnumFiles(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
IEnumBackgroundCopyFiles **ppEnum)
|
||||
IEnumBackgroundCopyFiles **enum_files)
|
||||
{
|
||||
TRACE("\n");
|
||||
return EnumBackgroundCopyFilesConstructor((LPVOID *) ppEnum, iface);
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
TRACE("(%p)->(%p)\n", This, enum_files);
|
||||
return EnumBackgroundCopyFilesConstructor(This, enum_files);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend(
|
||||
@@ -136,7 +143,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend(
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
|
||||
IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
HRESULT rv = S_OK;
|
||||
|
||||
EnterCriticalSection(&globalMgr.cs);
|
||||
@@ -170,7 +177,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel(
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_Complete(
|
||||
IBackgroundCopyJob2 *iface)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
HRESULT rv = S_OK;
|
||||
|
||||
EnterCriticalSection(&This->cs);
|
||||
@@ -213,7 +220,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
GUID *pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
*pVal = This->jobId;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -222,7 +229,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
BG_JOB_TYPE *pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
|
||||
if (!pVal)
|
||||
return E_INVALIDARG;
|
||||
@@ -235,7 +242,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
BG_JOB_PROGRESS *pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
|
||||
if (!pVal)
|
||||
return E_INVALIDARG;
|
||||
@@ -262,7 +269,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
BG_JOB_STATE *pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
|
||||
if (!pVal)
|
||||
return E_INVALIDARG;
|
||||
@@ -300,7 +307,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
|
||||
IBackgroundCopyJob2 *iface,
|
||||
LPWSTR *pVal)
|
||||
{
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
|
||||
int n;
|
||||
|
||||
if (!pVal)
|
||||
@@ -562,21 +569,22 @@ static const IBackgroundCopyJob2Vtbl BITS_IBackgroundCopyJob_Vtbl =
|
||||
BITS_IBackgroundCopyJob_RemoveCredentials
|
||||
};
|
||||
|
||||
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
||||
GUID *pJobId, LPVOID *ppObj)
|
||||
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID *job_id, BackgroundCopyJobImpl **job)
|
||||
{
|
||||
HRESULT hr;
|
||||
BackgroundCopyJobImpl *This;
|
||||
int n;
|
||||
|
||||
TRACE("(%s,%d,%p)\n", debugstr_w(displayName), type, ppObj);
|
||||
TRACE("(%s,%d,%p)\n", debugstr_w(displayName), type, job);
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->lpVtbl = &BITS_IBackgroundCopyJob_Vtbl;
|
||||
This->IBackgroundCopyJob2_iface.lpVtbl = &BITS_IBackgroundCopyJob_Vtbl;
|
||||
InitializeCriticalSection(&This->cs);
|
||||
This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BackgroundCopyJobImpl.cs");
|
||||
|
||||
This->ref = 1;
|
||||
This->type = type;
|
||||
|
||||
@@ -584,6 +592,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
||||
This->displayName = HeapAlloc(GetProcessHeap(), 0, n);
|
||||
if (!This->displayName)
|
||||
{
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return E_OUTOFMEMORY;
|
||||
@@ -593,12 +602,13 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
||||
hr = CoCreateGuid(&This->jobId);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
This->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->cs);
|
||||
HeapFree(GetProcessHeap(), 0, This->displayName);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return hr;
|
||||
}
|
||||
*pJobId = This->jobId;
|
||||
*job_id = This->jobId;
|
||||
|
||||
list_init(&This->files);
|
||||
This->jobProgress.BytesTotal = 0;
|
||||
@@ -608,7 +618,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
||||
|
||||
This->state = BG_JOB_STATE_SUSPENDED;
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
*job = This;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,93 +23,72 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||
|
||||
/* Add a reference to the iface pointer */
|
||||
static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(
|
||||
IBackgroundCopyManager* iface)
|
||||
BackgroundCopyManagerImpl globalMgr;
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(IBackgroundCopyManager *iface,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBackgroundCopyManager))
|
||||
{
|
||||
*ppv = iface;
|
||||
IBackgroundCopyManager_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(IBackgroundCopyManager *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Attempt to provide a new interface to interact with iface */
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(
|
||||
IBackgroundCopyManager* iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObject)
|
||||
{
|
||||
BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *)iface;
|
||||
|
||||
TRACE("IID: %s\n", debugstr_guid(riid));
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IBackgroundCopyManager))
|
||||
{
|
||||
*ppvObject = &This->lpVtbl;
|
||||
BITS_IBackgroundCopyManager_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ppvObject = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* Release an interface to iface */
|
||||
static ULONG WINAPI BITS_IBackgroundCopyManager_Release(
|
||||
IBackgroundCopyManager* iface)
|
||||
static ULONG WINAPI BITS_IBackgroundCopyManager_Release(IBackgroundCopyManager *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*** IBackgroundCopyManager interface methods ***/
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(
|
||||
IBackgroundCopyManager* iface,
|
||||
LPCWSTR DisplayName,
|
||||
BG_JOB_TYPE Type,
|
||||
GUID *pJobId,
|
||||
IBackgroundCopyJob **ppJob)
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_CreateJob(IBackgroundCopyManager *iface,
|
||||
LPCWSTR DisplayName, BG_JOB_TYPE Type, GUID *pJobId, IBackgroundCopyJob **ppJob)
|
||||
{
|
||||
BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *) iface;
|
||||
BackgroundCopyJobImpl *job;
|
||||
HRESULT hres;
|
||||
TRACE("\n");
|
||||
|
||||
hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId,
|
||||
(LPVOID *) ppJob);
|
||||
hres = BackgroundCopyJobConstructor(DisplayName, Type, pJobId, &job);
|
||||
if (FAILED(hres))
|
||||
return hres;
|
||||
|
||||
/* Add a reference to the job to job list */
|
||||
*ppJob = (IBackgroundCopyJob*)&job->IBackgroundCopyJob2_iface;
|
||||
IBackgroundCopyJob_AddRef(*ppJob);
|
||||
job = (BackgroundCopyJobImpl *) *ppJob;
|
||||
EnterCriticalSection(&This->cs);
|
||||
list_add_head(&This->jobs, &job->entryFromQmgr);
|
||||
LeaveCriticalSection(&This->cs);
|
||||
EnterCriticalSection(&globalMgr.cs);
|
||||
list_add_head(&globalMgr.jobs, &job->entryFromQmgr);
|
||||
LeaveCriticalSection(&globalMgr.cs);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(
|
||||
IBackgroundCopyManager* iface,
|
||||
REFGUID jobID,
|
||||
IBackgroundCopyJob **ppJob)
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetJob(IBackgroundCopyManager *iface,
|
||||
REFGUID jobID, IBackgroundCopyJob **ppJob)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs(
|
||||
IBackgroundCopyManager* iface,
|
||||
DWORD dwFlags,
|
||||
IEnumBackgroundCopyJobs **ppEnum)
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs(IBackgroundCopyManager *iface,
|
||||
DWORD dwFlags, IEnumBackgroundCopyJobs **ppEnum)
|
||||
{
|
||||
TRACE("\n");
|
||||
return EnumBackgroundCopyJobsConstructor((LPVOID *) ppEnum, iface);
|
||||
return enum_copy_job_create(&globalMgr, ppEnum);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(
|
||||
IBackgroundCopyManager* iface,
|
||||
HRESULT hResult,
|
||||
DWORD LanguageId,
|
||||
LPWSTR *pErrorDescription)
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(IBackgroundCopyManager *iface,
|
||||
HRESULT hResult, DWORD LanguageId, LPWSTR *pErrorDescription)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
@@ -128,7 +107,7 @@ static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
|
||||
};
|
||||
|
||||
BackgroundCopyManagerImpl globalMgr = {
|
||||
&BITS_IBackgroundCopyManager_Vtbl,
|
||||
{ &BITS_IBackgroundCopyManager_Vtbl },
|
||||
{ NULL, -1, 0, 0, 0, 0 },
|
||||
NULL,
|
||||
LIST_INIT(globalMgr.jobs)
|
||||
@@ -161,7 +140,7 @@ DWORD WINAPI fileTransfer(void *param)
|
||||
LIST_FOR_EACH_ENTRY_SAFE(job, jobCur, &qmgr->jobs, BackgroundCopyJobImpl, entryFromQmgr)
|
||||
{
|
||||
list_remove(&job->entryFromQmgr);
|
||||
IBackgroundCopyJob_Release((IBackgroundCopyJob *) job);
|
||||
IBackgroundCopyJob2_Release(&job->IBackgroundCopyJob2_iface);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -176,7 +155,7 @@ DWORD WINAPI fileTransfer(void *param)
|
||||
if (job->state == BG_JOB_STATE_ACKNOWLEDGED || job->state == BG_JOB_STATE_CANCELLED)
|
||||
{
|
||||
list_remove(&job->entryFromQmgr);
|
||||
IBackgroundCopyJob_Release((IBackgroundCopyJob *) job);
|
||||
IBackgroundCopyJob2_Release(&job->IBackgroundCopyJob2_iface);
|
||||
}
|
||||
else if (job->state == BG_JOB_STATE_QUEUED)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* Background copy job vtbl and related data */
|
||||
typedef struct
|
||||
{
|
||||
const IBackgroundCopyJob2Vtbl *lpVtbl;
|
||||
IBackgroundCopyJob2 IBackgroundCopyJob2_iface;
|
||||
LONG ref;
|
||||
LPWSTR displayName;
|
||||
BG_JOB_TYPE type;
|
||||
@@ -53,30 +53,10 @@ typedef struct
|
||||
struct list entryFromQmgr;
|
||||
} BackgroundCopyJobImpl;
|
||||
|
||||
/* Enum background copy jobs vtbl and related data */
|
||||
typedef struct
|
||||
{
|
||||
const IEnumBackgroundCopyJobsVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IBackgroundCopyJob **jobs;
|
||||
ULONG numJobs;
|
||||
ULONG indexJobs;
|
||||
} EnumBackgroundCopyJobsImpl;
|
||||
|
||||
/* Enum background copy files vtbl and related data */
|
||||
typedef struct
|
||||
{
|
||||
const IEnumBackgroundCopyFilesVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IBackgroundCopyFile **files;
|
||||
ULONG numFiles;
|
||||
ULONG indexFiles;
|
||||
} EnumBackgroundCopyFilesImpl;
|
||||
|
||||
/* Background copy file vtbl and related data */
|
||||
typedef struct
|
||||
{
|
||||
const IBackgroundCopyFileVtbl *lpVtbl;
|
||||
IBackgroundCopyFile IBackgroundCopyFile_iface;
|
||||
LONG ref;
|
||||
BG_FILE_INFO info;
|
||||
BG_FILE_PROGRESS fileProgress;
|
||||
@@ -88,7 +68,7 @@ typedef struct
|
||||
/* Background copy manager vtbl and related data */
|
||||
typedef struct
|
||||
{
|
||||
const IBackgroundCopyManagerVtbl *lpVtbl;
|
||||
IBackgroundCopyManager IBackgroundCopyManager_iface;
|
||||
/* Protects job list, job states, and jobEvent */
|
||||
CRITICAL_SECTION cs;
|
||||
HANDLE jobEvent;
|
||||
@@ -97,26 +77,25 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
IClassFactory IClassFactory_iface;
|
||||
} ClassFactoryImpl;
|
||||
|
||||
extern HANDLE stop_event;
|
||||
extern ClassFactoryImpl BITS_ClassFactory;
|
||||
extern BackgroundCopyManagerImpl globalMgr;
|
||||
extern HANDLE stop_event DECLSPEC_HIDDEN;
|
||||
extern ClassFactoryImpl BITS_ClassFactory DECLSPEC_HIDDEN;
|
||||
extern BackgroundCopyManagerImpl globalMgr DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj);
|
||||
HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||
HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
||||
GUID *pJobId, LPVOID *ppObj);
|
||||
HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
|
||||
IBackgroundCopyManager* copyManager);
|
||||
GUID *pJobId, BackgroundCopyJobImpl **job) DECLSPEC_HIDDEN;
|
||||
HRESULT enum_copy_job_create(BackgroundCopyManagerImpl *qmgr,
|
||||
IEnumBackgroundCopyJobs **enumjob) DECLSPEC_HIDDEN;
|
||||
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
|
||||
LPCWSTR remoteName, LPCWSTR localName,
|
||||
LPVOID *ppObj);
|
||||
HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj,
|
||||
IBackgroundCopyJob2 *copyJob);
|
||||
DWORD WINAPI fileTransfer(void *param);
|
||||
void processJob(BackgroundCopyJobImpl *job);
|
||||
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job);
|
||||
BackgroundCopyFileImpl **file) DECLSPEC_HIDDEN;
|
||||
HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl*, IEnumBackgroundCopyFiles**) DECLSPEC_HIDDEN;
|
||||
DWORD WINAPI fileTransfer(void *param) DECLSPEC_HIDDEN;
|
||||
void processJob(BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
||||
BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Little helper functions */
|
||||
static inline char *
|
||||
|
||||
@@ -95,9 +95,8 @@ StartCount(void)
|
||||
return FALSE;
|
||||
|
||||
hr = CoRegisterClassObject(&CLSID_BackgroundCopyManager,
|
||||
(IUnknown *) &BITS_ClassFactory,
|
||||
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE,
|
||||
&dwReg);
|
||||
(IUnknown *) &BITS_ClassFactory.IClassFactory_iface,
|
||||
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwReg);
|
||||
if (FAILED(hr))
|
||||
return FALSE;
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ reactos/dll/win32/powrprof # Forked at Wine-1.0rc5
|
||||
reactos/dll/win32/printui # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/propsys # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/pstorec # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/qmgr # Synced to Wine-1.2-rc5?
|
||||
reactos/dll/win32/qmgr # Synced to Wine-1.5-26
|
||||
reactos/dll/win32/qmgrprxy # Synced to Wine-1.14?
|
||||
reactos/dll/win32/query # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/rasapi32 # Synced to Wine-1.5.4
|
||||
|
||||
Reference in New Issue
Block a user