Dmitry Timoshkov : schedsvc: Implement SchRpcDelete.

Alexandre Julliard julliard at winehq.org
Thu Mar 13 14:40:35 CDT 2014


Module: wine
Branch: master
Commit: b6a3e9be42373bf08894680aa3713a55bb7a674a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b6a3e9be42373bf08894680aa3713a55bb7a674a

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Mar  7 12:10:41 2014 +0900

schedsvc: Implement SchRpcDelete.

---

 dlls/schedsvc/schedsvc.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c
index def6367..cc52321 100644
--- a/dlls/schedsvc/schedsvc.c
+++ b/dlls/schedsvc/schedsvc.c
@@ -197,8 +197,28 @@ HRESULT __cdecl SchRpcRun(const WCHAR *path, DWORD n_args, const WCHAR **args, D
 
 HRESULT __cdecl SchRpcDelete(const WCHAR *path, DWORD flags)
 {
-    WINE_FIXME("%s,%#x: stub\n", wine_dbgstr_w(path), flags);
-    return E_NOTIMPL;
+    WCHAR *full_name;
+    HRESULT hr = S_OK;
+
+    WINE_TRACE("%s,%#x\n", wine_dbgstr_w(path), flags);
+
+    if (flags) return E_INVALIDARG;
+
+    while (*path == '\\' || *path == '/') path++;
+    if (!*path) return E_ACCESSDENIED;
+
+    full_name = get_full_name(path, NULL);
+    if (!full_name) return E_OUTOFMEMORY;
+
+    if (!RemoveDirectoryW(full_name))
+    {
+        hr = HRESULT_FROM_WIN32(GetLastError());
+        if (hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY))
+            hr = DeleteFileW(full_name) ? S_OK : HRESULT_FROM_WIN32(GetLastError());
+    }
+
+    heap_free(full_name);
+    return hr;
 }
 
 HRESULT __cdecl SchRpcRename(const WCHAR *path, const WCHAR *name, DWORD flags)




More information about the wine-cvs mailing list