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