Module: wine Branch: master Commit: fee1e38e5618a9d3592943bdbbfd5b552d00897e URL: http://source.winehq.org/git/wine.git/?a=commit;h=fee1e38e5618a9d3592943bdbb...
Author: Stefan Leichter Stefan.Leichter@camline.com Date: Thu Aug 23 18:03:39 2007 +0200
ole32: Remove 'recursive registry key delete' function.
---
dlls/ole32/regsvr.c | 80 ++++----------------------------------------------- 1 files changed, 6 insertions(+), 74 deletions(-)
diff --git a/dlls/ole32/regsvr.c b/dlls/ole32/regsvr.c index fdb45c8..51b4f06 100644 --- a/dlls/ole32/regsvr.c +++ b/dlls/ole32/regsvr.c @@ -112,9 +112,6 @@ static LONG register_key_defvalueA(HKEY base, WCHAR const *name, char const *value); static LONG register_progid(WCHAR const *clsid, char const *progid, char const *name); -static LONG recursive_delete_key(HKEY key); -static LONG recursive_delete_keyA(HKEY base, char const *name); -
/*********************************************************************** * register_interfaces @@ -201,22 +198,12 @@ static HRESULT unregister_interfaces(struct regsvr_interface const *list)
for (; res == ERROR_SUCCESS && list->iid; ++list) { WCHAR buf[39]; - HKEY iid_key;
StringFromGUID2(list->iid, buf, 39); - res = RegOpenKeyExW(interface_key, buf, 0, - KEY_READ | KEY_WRITE, &iid_key); - if (res == ERROR_FILE_NOT_FOUND) { - res = ERROR_SUCCESS; - continue; - } - if (res != ERROR_SUCCESS) goto error_close_interface_key; - res = recursive_delete_key(iid_key); - RegCloseKey(iid_key); - if (res != ERROR_SUCCESS) goto error_close_interface_key; + res = RegDeleteTreeW(interface_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; }
-error_close_interface_key: RegCloseKey(interface_key); error_return: return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; @@ -308,22 +295,15 @@ static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
for (; res == ERROR_SUCCESS && list->clsid; ++list) { WCHAR buf[39]; - HKEY clsid_key;
StringFromGUID2(list->clsid, buf, 39); - res = RegOpenKeyExW(coclass_key, buf, 0, - KEY_READ | KEY_WRITE, &clsid_key); - if (res == ERROR_FILE_NOT_FOUND) { - res = ERROR_SUCCESS; - continue; - } - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - res = recursive_delete_key(clsid_key); - RegCloseKey(clsid_key); + res = RegDeleteTreeW(coclass_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->progid) { - res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid); + res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; if (res != ERROR_SUCCESS) goto error_close_coclass_key; } } @@ -418,54 +398,6 @@ error_close_progid_key: }
/*********************************************************************** - * recursive_delete_key - */ -static LONG recursive_delete_key(HKEY key) -{ - LONG res; - WCHAR subkey_name[MAX_PATH]; - DWORD cName; - HKEY subkey; - - for (;;) { - cName = sizeof(subkey_name) / sizeof(WCHAR); - res = RegEnumKeyExW(key, 0, subkey_name, &cName, - NULL, NULL, NULL, NULL); - if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { - res = ERROR_SUCCESS; /* presumably we're done enumerating */ - break; - } - res = RegOpenKeyExW(key, subkey_name, 0, - KEY_READ | KEY_WRITE, &subkey); - if (res == ERROR_FILE_NOT_FOUND) continue; - if (res != ERROR_SUCCESS) break; - - res = recursive_delete_key(subkey); - RegCloseKey(subkey); - if (res != ERROR_SUCCESS) break; - } - - if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0); - return res; -} - -/*********************************************************************** - * recursive_delete_keyA - */ -static LONG recursive_delete_keyA(HKEY base, char const *name) -{ - LONG res; - HKEY key; - - res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key); - if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS; - if (res != ERROR_SUCCESS) return res; - res = recursive_delete_key(key); - RegCloseKey(key); - return res; -} - -/*********************************************************************** * coclass list */ static GUID const CLSID_StdOleLink = {