Module: wine Branch: master Commit: 7e5bd67fc4348125181716cbb5b82a1e6d9bef54 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7e5bd67fc4348125181716cbb5...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Apr 7 13:14:41 2014 +0900
taskschd: Remove registry based task folder management.
---
dlls/taskschd/folder.c | 86 +----------------------------------------------- 1 file changed, 1 insertion(+), 85 deletions(-)
diff --git a/dlls/taskschd/folder.c b/dlls/taskschd/folder.c index 6bb0c38..14f1430 100644 --- a/dlls/taskschd/folder.c +++ b/dlls/taskschd/folder.c @@ -33,8 +33,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(taskschd);
-static const char root[] = "Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree"; - typedef struct { ITaskFolder ITaskFolder_iface; @@ -136,76 +134,6 @@ static HRESULT WINAPI TaskFolder_get_Name(ITaskFolder *iface, BSTR *name) return S_OK; }
-static HRESULT reg_create_folder(const WCHAR *path, HKEY *hfolder) -{ - HKEY hroot; - DWORD ret, disposition; - - ret = RegCreateKeyA(HKEY_LOCAL_MACHINE, root, &hroot); - if (ret) return HRESULT_FROM_WIN32(ret); - - while (*path == '\') path++; - ret = RegCreateKeyExW(hroot, path, 0, NULL, 0, KEY_ALL_ACCESS, NULL, hfolder, &disposition); - if (ret == ERROR_FILE_NOT_FOUND) - ret = ERROR_PATH_NOT_FOUND; - - if (ret == ERROR_SUCCESS && disposition == REG_OPENED_EXISTING_KEY) - { - RegCloseKey(*hfolder); - ret = ERROR_ALREADY_EXISTS; - } - - RegCloseKey(hroot); - - return HRESULT_FROM_WIN32(ret); -} - -static HRESULT reg_open_folder(const WCHAR *path, HKEY *hfolder) -{ - HKEY hroot; - DWORD ret; - - ret = RegCreateKeyA(HKEY_LOCAL_MACHINE, root, &hroot); - if (ret) return HRESULT_FROM_WIN32(ret); - - while (*path == '\') path++; - ret = RegOpenKeyExW(hroot, path, 0, KEY_ALL_ACCESS, hfolder); - if (ret == ERROR_FILE_NOT_FOUND) - ret = ERROR_PATH_NOT_FOUND; - - RegCloseKey(hroot); - - return HRESULT_FROM_WIN32(ret); -} - -static HRESULT reg_delete_folder(const WCHAR *path, const WCHAR *name) -{ - HKEY hroot, hfolder; - DWORD ret; - - ret = RegCreateKeyA(HKEY_LOCAL_MACHINE, root, &hroot); - if (ret) return HRESULT_FROM_WIN32(ret); - - while (*path == '\') path++; - ret = RegOpenKeyExW(hroot, path, 0, DELETE, &hfolder); - - RegCloseKey(hroot); - - while (*name == '\') name++; - if (ret == ERROR_SUCCESS) - { - ret = RegDeleteKeyW(hfolder, name); - RegCloseKey(hfolder); - } - - return HRESULT_FROM_WIN32(ret); -} - -static inline void reg_close_folder(HKEY hfolder) -{ - RegCloseKey(hfolder); -} - static HRESULT WINAPI TaskFolder_get_Path(ITaskFolder *iface, BSTR *path) { TaskFolder *folder = impl_from_ITaskFolder(iface); @@ -328,9 +256,7 @@ static HRESULT WINAPI TaskFolder_DeleteFolder(ITaskFolder *iface, BSTR name, LON
hr = SchRpcDelete(folder_path, 0); heap_free(folder_path); - if (hr != S_OK) return hr; - - return reg_delete_folder(folder->path, name); + return hr; }
static HRESULT WINAPI TaskFolder_GetTask(ITaskFolder *iface, BSTR name, IRegisteredTask **task) @@ -452,7 +378,6 @@ HRESULT TaskFolder_create(const WCHAR *parent, const WCHAR *path, ITaskFolder ** TaskFolder *folder; WCHAR *folder_path; HRESULT hr; - HKEY hfolder;
if (path) { @@ -494,15 +419,6 @@ HRESULT TaskFolder_create(const WCHAR *parent, const WCHAR *path, ITaskFolder ** return hr; }
- hr = create ? reg_create_folder(folder_path, &hfolder) : reg_open_folder(folder_path, &hfolder); - if (hr) - { - heap_free(folder_path); - return hr; - } - - reg_close_folder(hfolder); - folder = heap_alloc(sizeof(*folder)); if (!folder) {