Commit 5cbd28aa authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

qmgr: Implement AddFile() with AddFileSet().

parent 5092ecf6
...@@ -95,46 +95,48 @@ static HRESULT WINAPI BackgroundCopyJob_AddFileSet( ...@@ -95,46 +95,48 @@ static HRESULT WINAPI BackgroundCopyJob_AddFileSet(
BG_FILE_INFO *pFileSet) BG_FILE_INFO *pFileSet)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
HRESULT hr = S_OK;
ULONG i; ULONG i;
TRACE("(%p)->(%d %p)\n", This, cFileCount, pFileSet); 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,
pFileSet[i].LocalName);
if (FAILED(hr))
return hr;
}
return S_OK;
}
static HRESULT WINAPI BackgroundCopyJob_AddFile(
IBackgroundCopyJob2 *iface,
LPCWSTR RemoteUrl,
LPCWSTR LocalName)
{
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
BackgroundCopyFileImpl *file; BackgroundCopyFileImpl *file;
HRESULT res;
TRACE("(%p)->(%s %s)\n", This, debugstr_w(RemoteUrl), debugstr_w(LocalName));
/* We should return E_INVALIDARG in these cases. */ /* We should return E_INVALIDARG in these cases. */
FIXME("Check for valid filenames and supported protocols\n"); FIXME("Check for valid filenames and supported protocols\n");
res = BackgroundCopyFileConstructor(This, RemoteUrl, LocalName, &file); hr = BackgroundCopyFileConstructor(This, pFileSet[i].RemoteName, pFileSet[i].LocalName, &file);
if (res != S_OK) if (hr != S_OK) break;
return res;
/* Add a reference to the file to file list */ /* Add a reference to the file to file list */
IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface); IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
EnterCriticalSection(&This->cs);
list_add_head(&This->files, &file->entryFromJob); list_add_head(&This->files, &file->entryFromJob);
This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN; This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN;
++This->jobProgress.FilesTotal; ++This->jobProgress.FilesTotal;
}
LeaveCriticalSection(&This->cs); LeaveCriticalSection(&This->cs);
return S_OK; return hr;
}
static HRESULT WINAPI BackgroundCopyJob_AddFile(
IBackgroundCopyJob2 *iface,
LPCWSTR RemoteUrl,
LPCWSTR LocalName)
{
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
BG_FILE_INFO file;
TRACE("(%p)->(%s %s)\n", This, debugstr_w(RemoteUrl), debugstr_w(LocalName));
file.RemoteName = (LPWSTR)RemoteUrl;
file.LocalName = (LPWSTR)LocalName;
return IBackgroundCopyJob2_AddFileSet(iface, 1, &file);
} }
static HRESULT WINAPI BackgroundCopyJob_EnumFiles( static HRESULT WINAPI BackgroundCopyJob_EnumFiles(
......
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