[PATCH 1/2] mstask: Implement SetTargetComputer [try 2]

Detlef Riekenberg wine.dev at web.de
Wed Nov 7 17:12:47 CST 2012


try 2 without a static buffer for the computername

--
By by ... Detlef
---
 dlls/mstask/task_scheduler.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index 44609b8..721b2c4 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -85,8 +85,27 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer(
         ITaskScheduler* iface,
         LPCWSTR pwszComputer)
 {
-    FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer));
-    return E_NOTIMPL;
+    TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
+    WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 3];  /* extra space for two '\' and a zero */
+    DWORD len = MAX_COMPUTERNAME_LENGTH + 1;    /* extra space for a zero */
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(pwszComputer));
+
+    /* NULL is an alias for the local computer */
+    if (!pwszComputer)
+        return S_OK;
+
+    buffer[0] = '\\';
+    buffer[1] = '\\';
+    if (GetComputerNameW(buffer + 2, &len))
+    {
+        if (!lstrcmpiW(buffer, pwszComputer) ||    /* full unc name */
+            !lstrcmpiW(buffer + 2, pwszComputer))  /* name without backslash */
+        return S_OK;
+    }
+
+    FIXME("remote computer %s not supported\n", debugstr_w(pwszComputer));
+    return HRESULT_FROM_WIN32(ERROR_BAD_NETPATH);
 }
 
 static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer(
-- 
1.7.5.4




More information about the wine-patches mailing list