Paul Vriens : advapi/service: Simplify DeleteService by using
RegDeleteTree .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 12 08:32:23 CDT 2007
Module: wine
Branch: master
Commit: 05fec6c871f0c8c44cfb8752a81164c57f00a125
URL: http://source.winehq.org/git/wine.git/?a=commit;h=05fec6c871f0c8c44cfb8752a81164c57f00a125
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Wed Jul 11 19:36:00 2007 +0200
advapi/service: Simplify DeleteService by using RegDeleteTree.
---
dlls/advapi32/service.c | 25 +++++--------------------
1 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 7bded19..462abdb 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -1422,11 +1422,6 @@ CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
BOOL WINAPI DeleteService( SC_HANDLE hService )
{
struct sc_service *hsvc;
- HKEY hKey;
- WCHAR valname[MAX_PATH+1];
- INT index = 0;
- LONG rc;
- DWORD size;
hsvc = sc_handle_get_handle_data(hService, SC_HTYPE_SERVICE);
if (!hsvc)
@@ -1434,24 +1429,14 @@ BOOL WINAPI DeleteService( SC_HANDLE hService )
SetLastError( ERROR_INVALID_HANDLE );
return FALSE;
}
- hKey = hsvc->hkey;
- size = MAX_PATH+1;
- /* Clean out the values */
- rc = RegEnumValueW(hKey, index, valname,&size,0,0,0,0);
- while (rc == ERROR_SUCCESS)
- {
- RegDeleteValueW(hKey,valname);
- index++;
- size = MAX_PATH+1;
- rc = RegEnumValueW(hKey, index, valname, &size,0,0,0,0);
- }
+ /* Close the key to the service */
+ RegCloseKey(hsvc->hkey);
- RegCloseKey(hKey);
- hsvc->hkey = NULL;
+ /* Delete the service under the Service Control Manager key */
+ RegDeleteTreeW(hsvc->scm->hkey, hsvc->name);
- /* delete the key */
- RegDeleteKeyW(hsvc->scm->hkey, hsvc->name);
+ hsvc->hkey = NULL;
return TRUE;
}
More information about the wine-cvs
mailing list