Commit 04f3c2bb authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

qmgr: Update to IBackgroundCopyFile2.

parent e1f9b916
......@@ -27,7 +27,7 @@ typedef struct
{
IEnumBackgroundCopyFiles IEnumBackgroundCopyFiles_iface;
LONG ref;
IBackgroundCopyFile **files;
IBackgroundCopyFile2 **files;
ULONG numFiles;
ULONG indexFiles;
} EnumBackgroundCopyFilesImpl;
......@@ -75,7 +75,7 @@ static ULONG WINAPI EnumBackgroundCopyFiles_Release(IEnumBackgroundCopyFiles *if
if (ref == 0)
{
for(i = 0; i < This->numFiles; i++)
IBackgroundCopyFile_Release(This->files[i]);
IBackgroundCopyFile2_Release(This->files[i]);
HeapFree(GetProcessHeap(), 0, This->files);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -90,7 +90,7 @@ static HRESULT WINAPI EnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *ifa
EnumBackgroundCopyFilesImpl *This = impl_from_IEnumBackgroundCopyFiles(iface);
ULONG fetched;
ULONG i;
IBackgroundCopyFile *file;
IBackgroundCopyFile2 *file;
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
......@@ -116,8 +116,8 @@ static HRESULT WINAPI EnumBackgroundCopyFiles_Next(IEnumBackgroundCopyFiles *ifa
for (i = 0; i < fetched; i++)
{
file = This->files[This->indexFiles++];
IBackgroundCopyFile_AddRef(file);
rgelt[i] = file;
IBackgroundCopyFile2_AddRef(file);
rgelt[i] = (IBackgroundCopyFile *)file;
}
return fetched == celt ? S_OK : S_FALSE;
......@@ -215,8 +215,8 @@ HRESULT EnumBackgroundCopyFilesConstructor(BackgroundCopyJobImpl *job, IEnumBack
i = 0;
LIST_FOR_EACH_ENTRY(file, &job->files, BackgroundCopyFileImpl, entryFromJob)
{
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
This->files[i] = &file->IBackgroundCopyFile_iface;
IBackgroundCopyFile2_AddRef(&file->IBackgroundCopyFile2_iface);
This->files[i] = &file->IBackgroundCopyFile2_iface;
++i;
}
LeaveCriticalSection(&job->cs);
......
......@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "qmgr.h"
#include "wine/debug.h"
......
......@@ -20,69 +20,72 @@
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
#define COBJMACROS
#include "urlmon.h"
#include "qmgr.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static inline BackgroundCopyFileImpl *impl_from_IBackgroundCopyFile(IBackgroundCopyFile *iface)
static inline BackgroundCopyFileImpl *impl_from_IBackgroundCopyFile2(
IBackgroundCopyFile2 *iface)
{
return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile_iface);
return CONTAINING_RECORD(iface, BackgroundCopyFileImpl, IBackgroundCopyFile2_iface);
}
static HRESULT WINAPI BackgroundCopyFile_QueryInterface(
IBackgroundCopyFile* iface,
IBackgroundCopyFile2 *iface,
REFIID riid,
void **obj)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
TRACE("(%p)->(%s %p)\n", file, debugstr_guid(riid), obj);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IBackgroundCopyFile))
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IBackgroundCopyFile) ||
IsEqualGUID(riid, &IID_IBackgroundCopyFile2))
{
*obj = iface;
IBackgroundCopyFile_AddRef(iface);
return S_OK;
}
else
{
*obj = NULL;
return E_NOINTERFACE;
}
*obj = NULL;
return E_NOINTERFACE;
IBackgroundCopyFile2_AddRef(iface);
return S_OK;
}
static ULONG WINAPI BackgroundCopyFile_AddRef(IBackgroundCopyFile* iface)
static ULONG WINAPI BackgroundCopyFile_AddRef(
IBackgroundCopyFile2 *iface)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
ULONG ref = InterlockedIncrement(&file->ref);
TRACE("(%p)->(%d)\n", file, ref);
return ref;
}
static ULONG WINAPI BackgroundCopyFile_Release(
IBackgroundCopyFile* iface)
IBackgroundCopyFile2 *iface)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
ULONG ref = InterlockedDecrement(&This->ref);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
ULONG ref = InterlockedDecrement(&file->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("(%p)->(%d)\n", file, ref);
if (ref == 0)
{
IBackgroundCopyJob2_Release(&This->owner->IBackgroundCopyJob2_iface);
HeapFree(GetProcessHeap(), 0, This->info.LocalName);
HeapFree(GetProcessHeap(), 0, This->info.RemoteName);
HeapFree(GetProcessHeap(), 0, This);
IBackgroundCopyJob2_Release(&file->owner->IBackgroundCopyJob2_iface);
HeapFree(GetProcessHeap(), 0, file->info.LocalName);
HeapFree(GetProcessHeap(), 0, file->info.RemoteName);
HeapFree(GetProcessHeap(), 0, file);
}
return ref;
......@@ -90,52 +93,73 @@ static ULONG WINAPI BackgroundCopyFile_Release(
/* Get the remote name of a background copy file */
static HRESULT WINAPI BackgroundCopyFile_GetRemoteName(
IBackgroundCopyFile* iface,
IBackgroundCopyFile2 *iface,
LPWSTR *pVal)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
TRACE("(%p)->(%p)\n", file, pVal);
return return_strval(This->info.RemoteName, pVal);
return return_strval(file->info.RemoteName, pVal);
}
static HRESULT WINAPI BackgroundCopyFile_GetLocalName(
IBackgroundCopyFile* iface,
IBackgroundCopyFile2 *iface,
LPWSTR *pVal)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
TRACE("(%p)->(%p)\n", file, pVal);
return return_strval(This->info.LocalName, pVal);
return return_strval(file->info.LocalName, pVal);
}
static HRESULT WINAPI BackgroundCopyFile_GetProgress(
IBackgroundCopyFile* iface,
IBackgroundCopyFile2 *iface,
BG_FILE_PROGRESS *pVal)
{
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
TRACE("(%p)->(%p)\n", This, pVal);
TRACE("(%p)->(%p)\n", file, pVal);
EnterCriticalSection(&This->owner->cs);
pVal->BytesTotal = This->fileProgress.BytesTotal;
pVal->BytesTransferred = This->fileProgress.BytesTransferred;
pVal->Completed = This->fileProgress.Completed;
LeaveCriticalSection(&This->owner->cs);
EnterCriticalSection(&file->owner->cs);
pVal->BytesTotal = file->fileProgress.BytesTotal;
pVal->BytesTransferred = file->fileProgress.BytesTransferred;
pVal->Completed = file->fileProgress.Completed;
LeaveCriticalSection(&file->owner->cs);
return S_OK;
}
static const IBackgroundCopyFileVtbl BackgroundCopyFileVtbl =
static HRESULT WINAPI BackgroundCopyFile_GetFileRanges(
IBackgroundCopyFile2 *iface,
DWORD *RangeCount,
BG_FILE_RANGE **Ranges)
{
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
FIXME("(%p)->(%p %p)\n", file, RangeCount, Ranges);
return E_NOTIMPL;
}
static HRESULT WINAPI BackgroundCopyFile_SetRemoteName(
IBackgroundCopyFile2 *iface,
LPCWSTR Val)
{
BackgroundCopyFileImpl *file = impl_from_IBackgroundCopyFile2(iface);
FIXME("(%p)->(%s)\n", file, debugstr_w(Val));
return E_NOTIMPL;
}
static const IBackgroundCopyFile2Vtbl BackgroundCopyFile2Vtbl =
{
BackgroundCopyFile_QueryInterface,
BackgroundCopyFile_AddRef,
BackgroundCopyFile_Release,
BackgroundCopyFile_GetRemoteName,
BackgroundCopyFile_GetLocalName,
BackgroundCopyFile_GetProgress
BackgroundCopyFile_GetProgress,
BackgroundCopyFile_GetFileRanges,
BackgroundCopyFile_SetRemoteName
};
HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
......@@ -170,7 +194,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
}
memcpy(This->info.LocalName, localName, n);
This->IBackgroundCopyFile_iface.lpVtbl = &BackgroundCopyFileVtbl;
This->IBackgroundCopyFile2_iface.lpVtbl = &BackgroundCopyFile2Vtbl;
This->ref = 1;
This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
......@@ -255,7 +279,7 @@ static ULONG WINAPI DLBindStatusCallback_Release(IBindStatusCallback *iface)
if (ref == 0)
{
IBackgroundCopyFile_Release(&This->file->IBackgroundCopyFile_iface);
IBackgroundCopyFile2_Release(&This->file->IBackgroundCopyFile2_iface);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -365,7 +389,7 @@ static DLBindStatusCallback *DLBindStatusCallbackConstructor(
return NULL;
This->IBindStatusCallback_iface.lpVtbl = &DLBindStatusCallback_Vtbl;
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
IBackgroundCopyFile2_AddRef(&file->IBackgroundCopyFile2_iface);
This->file = file;
This->ref = 1;
return This;
......
......@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "qmgr.h"
#include "wine/debug.h"
......
......@@ -22,11 +22,11 @@
#define __QMGR_H__
#include "windef.h"
#define COBJMACROS
#include "objbase.h"
#include "bits.h"
#include "bits1_5.h"
#include "bits2_0.h"
#include "bits2_5.h"
#include "bits3_0.h"
#include <string.h>
......@@ -56,7 +56,7 @@ typedef struct
/* Background copy file vtbl and related data */
typedef struct
{
IBackgroundCopyFile IBackgroundCopyFile_iface;
IBackgroundCopyFile2 IBackgroundCopyFile2_iface;
LONG ref;
BG_FILE_INFO info;
BG_FILE_PROGRESS fileProgress;
......
......@@ -22,4 +22,6 @@
#define DO_NO_IMPORTS
#include "bits1_5.idl"
#include "bits2_0.idl"
#include "bits2_5.idl"
#include "bits3_0.idl"
......@@ -23,6 +23,7 @@
#include <stdio.h>
#define COBJMACROS
#include "objbase.h"
#include "winuser.h"
#include "winreg.h"
......@@ -30,10 +31,7 @@
#include "olectl.h"
#include "rpcproxy.h"
#include "winsvc.h"
#include "bits.h"
#include "qmgr.h"
#include "initguid.h"
#include "wine/debug.h"
......
......@@ -19,10 +19,7 @@
*/
#include "windef.h"
#include "objbase.h"
#include "winsvc.h"
#include "bits.h"
#include "qmgr.h"
#include "wine/debug.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment