From 493d85898889e4d67e1d2e65c8fb6e7abdef7cae Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Tue, 6 Nov 2012 00:20:12 +0100 Subject: [PATCH] mstask: Implement GetTargetComputer. --- dlls/mstask/task_scheduler.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index 1d2ac219cf8..44609b82ee4 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -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(