qmgr: Implement IBackgroundCopyJob::GetDescription().

This commit is contained in:
Nikolay Sivov 2013-11-25 10:42:50 +04:00 committed by Alexandre Julliard
parent eeb05e6ef9
commit b8771368c6
1 changed files with 24 additions and 11 deletions

View File

@ -34,6 +34,23 @@ static inline BOOL is_job_done(const BackgroundCopyJobImpl *job)
return job->state == BG_JOB_STATE_CANCELLED || job->state == BG_JOB_STATE_ACKNOWLEDGED; return job->state == BG_JOB_STATE_CANCELLED || job->state == BG_JOB_STATE_ACKNOWLEDGED;
} }
static HRESULT return_strval(const WCHAR *str, WCHAR **ret)
{
int len;
if (!ret) return E_INVALIDARG;
len = strlenW(str);
*ret = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
if (!*ret) return E_OUTOFMEMORY;
if (len)
strcpyW(*ret, str);
else
**ret = 0;
return S_OK;
}
static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface) static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface)
{ {
return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface); return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface);
@ -313,17 +330,10 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
LPWSTR *pVal) LPWSTR *pVal)
{ {
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
int n;
if (!pVal) TRACE("(%p)->(%p)\n", This, pVal);
return E_INVALIDARG;
n = (strlenW(This->displayName) + 1) * sizeof **pVal; return return_strval(This->displayName, pVal);
*pVal = CoTaskMemAlloc(n);
if (*pVal == NULL)
return E_OUTOFMEMORY;
memcpy(*pVal, This->displayName, n);
return S_OK;
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription( static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription(
@ -366,8 +376,11 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDescription(
IBackgroundCopyJob2 *iface, IBackgroundCopyJob2 *iface,
LPWSTR *pVal) LPWSTR *pVal)
{ {
FIXME("Not implemented\n"); BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pVal);
return return_strval(This->description, pVal);
} }
static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority( static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority(