Improve swedish translations and add new translations to swedish.
[reactos.git] / base / applications / mscutils / servman / dependencies_tv2.c
index d8ddc0e..6f23197 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * PROJECT:     ReactOS Services
  * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/mscutils/servman/tv2_dependencies.c
+ * FILE:        base/applications/mscutils/servman/dependencies_tv2.c
  * PURPOSE:     Helper functions for service dependents
  * COPYRIGHT:   Copyright 2009 Ged Murphy <gedmurphy@reactos.org>
  *
@@ -17,14 +17,14 @@ TV2_HasDependantServices(LPWSTR lpServiceName)
     DWORD dwBytesNeeded, dwCount;
     BOOL bRet = FALSE;
 
-    hSCManager = OpenSCManager(NULL,
-                               NULL,
-                               SC_MANAGER_ALL_ACCESS);
+    hSCManager = OpenSCManagerW(NULL,
+                                NULL,
+                                SC_MANAGER_ALL_ACCESS);
     if (hSCManager)
     {
-        hService = OpenService(hSCManager,
-                               lpServiceName,
-                               SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS);
+        hService = OpenServiceW(hSCManager,
+                                lpServiceName,
+                                SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS);
         if (hService)
         {
             /* Does this have any dependencies? */
@@ -41,6 +41,8 @@ TV2_HasDependantServices(LPWSTR lpServiceName)
                      bRet = TRUE;
                  }
             }
+
+            CloseServiceHandle(hService);
         }
 
         CloseServiceHandle(hSCManager);
@@ -116,13 +118,13 @@ TV2_GetDependants(LPWSTR lpServiceName,
 }
 
 VOID
-TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo,
+TV2_AddDependantsToTree(PDEPENDDATA pDependData,
                         HTREEITEM hParent,
-                        LPTSTR lpServiceName)
+                        LPWSTR lpServiceName)
 {
 
     LPENUM_SERVICE_STATUSW lpServiceStatus;
-    LPTSTR lpNoDepends;
+    LPWSTR lpNoDepends;
     DWORD count, i;
     BOOL bHasChildren;
 
@@ -136,7 +138,7 @@ TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo,
             bHasChildren = TV2_HasDependantServices(lpServiceStatus[i].lpServiceName);
 
             /* Add it */
-            AddItemToTreeView(pDlgInfo->hDependsTreeView2,
+            AddItemToTreeView(pDependData->hDependsTreeView2,
                               hParent,
                               lpServiceStatus[i].lpDisplayName,
                               lpServiceStatus[i].lpServiceName,
@@ -156,43 +158,41 @@ TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo,
             /* Load the 'No dependencies' string */
             AllocAndLoadString(&lpNoDepends, hInstance, IDS_NO_DEPENDS);
 
-            AddItemToTreeView(pDlgInfo->hDependsTreeView2,
+            AddItemToTreeView(pDependData->hDependsTreeView2,
                               NULL,
                               lpNoDepends,
                               NULL,
                               0,
                               FALSE);
 
-            HeapFree(ProcessHeap,
-                     0,
-                     lpNoDepends);
+            LocalFree(lpNoDepends);
 
             /* Disable the window */
-            EnableWindow(pDlgInfo->hDependsTreeView2, FALSE);
+            EnableWindow(pDependData->hDependsTreeView2, FALSE);
         }
     }
 }
 
 BOOL
-TV2_Initialize(PSERVICEPROPSHEET pDlgInfo,
-               LPTSTR lpServiceName)
+TV2_Initialize(PDEPENDDATA pDependData,
+               LPWSTR lpServiceName)
 {
     BOOL bRet = FALSE;
 
-    /* Accociate the imagelist with TV2 */
-    pDlgInfo->hDependsTreeView2 = GetDlgItem(pDlgInfo->hDependsWnd, IDC_DEPEND_TREE2);
-    if (!pDlgInfo->hDependsTreeView2)
+    /* Associate the imagelist with TV2 */
+    pDependData->hDependsTreeView2 = GetDlgItem(pDependData->hDependsWnd, IDC_DEPEND_TREE2);
+    if (!pDependData->hDependsTreeView2)
     {
-        ImageList_Destroy(pDlgInfo->hDependsImageList);
-        pDlgInfo->hDependsImageList = NULL;
+        ImageList_Destroy(pDependData->hDependsImageList);
+        pDependData->hDependsImageList = NULL;
         return FALSE;
     }
-    (void)TreeView_SetImageList(pDlgInfo->hDependsTreeView2,
-                                pDlgInfo->hDependsImageList,
+    (void)TreeView_SetImageList(pDependData->hDependsTreeView2,
+                                pDependData->hDependsImageList,
                                 TVSIL_NORMAL);
 
     /* Set the first items in the control */
-    TV2_AddDependantsToTree(pDlgInfo, NULL, lpServiceName);
+    TV2_AddDependantsToTree(pDependData, NULL, lpServiceName);
 
     return bRet;
 }