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 HRESULT WINAPI BackgroundCopyFile_GetLocalName( IBackgroundCopyFile* iface, LPWSTR *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); TRACE("(%p)->(%p)\n", This, pVal); return return_strval(This->info.LocalName, pVal); }
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName( IBackgroundCopyFile* iface, LPWSTR *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR); *pVal = CoTaskMemAlloc(n); if (!*pVal) return E_OUTOFMEMORY; memcpy(*pVal, This->info.LocalName, n); return S_OK; }
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress( IBackgroundCopyFile* iface, BG_FILE_PROGRESS *pVal) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); EnterCriticalSection(&This->owner->cs); pVal->BytesTotal = This->fileProgress.BytesTotal; pVal->BytesTransferred = This->fileProgress.BytesTransferred; pVal->Completed = This->fileProgress.Completed; LeaveCriticalSection(&This->owner->cs); return S_OK; }
static ULONG WINAPI BITS_IBackgroundCopyFile_Release( IBackgroundCopyFile* iface) { BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p)->(%d)\n", This, 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); } return ref; }
static HRESULT WINAPI BITS_IBackgroundCopyFile_QueryInterface( IBackgroundCopyFile* iface, REFIID riid, void **obj) { 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)) { *obj = iface; IBackgroundCopyFile_AddRef(iface); return S_OK; } *obj = NULL; return E_NOINTERFACE; }