mstask: Implement GetTargetComputer.

This commit is contained in:
Detlef Riekenberg 2012-11-06 00:20:12 +01:00 committed by Alexandre Julliard
parent d2607ff6c9
commit 493d858988
1 changed files with 24 additions and 2 deletions

View File

@ -93,8 +93,30 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer(
ITaskScheduler* iface,
LPWSTR *ppwszComputer)
{
FIXME("%p, %p: stub\n", iface, ppwszComputer);
return E_NOTIMPL;
TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
LPWSTR buffer;
DWORD len = MAX_COMPUTERNAME_LENGTH + 1; /* extra space for the zero */
TRACE("(%p)->(%p)\n", This, ppwszComputer);
if (!ppwszComputer)
return E_INVALIDARG;
/* extra space for two '\' and a zero */
buffer = CoTaskMemAlloc((MAX_COMPUTERNAME_LENGTH + 3) * sizeof(WCHAR));
if (buffer)
{
buffer[0] = '\\';
buffer[1] = '\\';
if (GetComputerNameW(buffer + 2, &len))
{
*ppwszComputer = buffer;
return S_OK;
}
CoTaskMemFree(buffer);
}
*ppwszComputer = NULL;
return HRESULT_FROM_WIN32(GetLastError());
}
static HRESULT WINAPI MSTASK_ITaskScheduler_Enum(