mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
Recurse the tree and clean up all the strings tagged to the items. Servman now has working dependency tracking
svn path=/trunk/; revision=44681
This commit is contained in:
parent
1ebe1b0e18
commit
41cc052638
1 changed files with 79 additions and 31 deletions
|
@ -27,8 +27,9 @@ AddItemToTreeView(HWND hTreeView,
|
||||||
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_CHILDREN;
|
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_CHILDREN;
|
||||||
tvi.pszText = lpDisplayName;
|
tvi.pszText = lpDisplayName;
|
||||||
tvi.cchTextMax = _tcslen(lpDisplayName);
|
tvi.cchTextMax = _tcslen(lpDisplayName);
|
||||||
tvi.cChildren = bHasChildren; //I_CHILDRENCALLBACK;
|
tvi.cChildren = bHasChildren;
|
||||||
|
|
||||||
|
/* Select the image for this service */
|
||||||
switch (ServiceType)
|
switch (ServiceType)
|
||||||
{
|
{
|
||||||
case SERVICE_WIN32_OWN_PROCESS:
|
case SERVICE_WIN32_OWN_PROCESS:
|
||||||
|
@ -49,13 +50,16 @@ AddItemToTreeView(HWND hTreeView,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach the service name */
|
if (lpServiceName)
|
||||||
tvi.lParam = (LPARAM)(LPTSTR)HeapAlloc(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
(_tcslen(lpServiceName) + 1) * sizeof(TCHAR));
|
|
||||||
if (tvi.lParam)
|
|
||||||
{
|
{
|
||||||
_tcscpy((LPTSTR)tvi.lParam, lpServiceName);
|
/* Attach the service name */
|
||||||
|
tvi.lParam = (LPARAM)(LPTSTR)HeapAlloc(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
(_tcslen(lpServiceName) + 1) * sizeof(TCHAR));
|
||||||
|
if (tvi.lParam)
|
||||||
|
{
|
||||||
|
_tcscpy((LPTSTR)tvi.lParam, lpServiceName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tvins.item = tvi;
|
tvins.item = tvi;
|
||||||
|
@ -64,30 +68,6 @@ AddItemToTreeView(HWND hTreeView,
|
||||||
return TreeView_InsertItem(hTreeView, &tvins);
|
return TreeView_InsertItem(hTreeView, &tvins);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
|
||||||
DestroyTreeView(HWND hTreeView)
|
|
||||||
{
|
|
||||||
//FIXME: traverse the nodes and free the strings
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static BOOL
|
|
||||||
TreeView_GetItemText(HWND hTreeView,
|
|
||||||
HTREEITEM hItem,
|
|
||||||
LPTSTR lpBuffer,
|
|
||||||
DWORD cbBuffer)
|
|
||||||
{
|
|
||||||
TVITEM tv = {0};
|
|
||||||
|
|
||||||
tv.mask = TVIF_TEXT | TVIF_HANDLE;
|
|
||||||
tv.hItem = hItem;
|
|
||||||
tv.pszText = lpBuffer;
|
|
||||||
tv.cchTextMax = (int)cbBuffer;
|
|
||||||
|
|
||||||
return TreeView_GetItem(hTreeView, &tv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static LPARAM
|
static LPARAM
|
||||||
TreeView_GetItemParam(HWND hTreeView,
|
TreeView_GetItemParam(HWND hTreeView,
|
||||||
HTREEITEM hItem)
|
HTREEITEM hItem)
|
||||||
|
@ -105,6 +85,74 @@ TreeView_GetItemParam(HWND hTreeView,
|
||||||
|
|
||||||
return lParam;
|
return lParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
DestroyItem(HWND hTreeView,
|
||||||
|
HTREEITEM hItem)
|
||||||
|
{
|
||||||
|
HTREEITEM hChildItem;
|
||||||
|
LPTSTR lpServiceName;
|
||||||
|
|
||||||
|
/* Does this item have any children */
|
||||||
|
hChildItem = TreeView_GetChild(hTreeView, hItem);
|
||||||
|
if (hChildItem)
|
||||||
|
{
|
||||||
|
/* It does, recurse to that one */
|
||||||
|
DestroyItem(hTreeView, hChildItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the string and free it */
|
||||||
|
lpServiceName = (LPTSTR)TreeView_GetItemParam(hTreeView, hItem);
|
||||||
|
if (lpServiceName)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpServiceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
DestroyTreeView(HWND hTreeView)
|
||||||
|
{
|
||||||
|
HTREEITEM hItem;
|
||||||
|
|
||||||
|
/* Get the first item in the top level */
|
||||||
|
hItem = TreeView_GetFirstVisible(hTreeView);
|
||||||
|
if (hItem)
|
||||||
|
{
|
||||||
|
/* Kill it and all children */
|
||||||
|
DestroyItem(hTreeView, hItem);
|
||||||
|
|
||||||
|
/* Kill all remaining top level items */
|
||||||
|
while (hItem)
|
||||||
|
{
|
||||||
|
/* Are there any more items at the top level */
|
||||||
|
hItem = TreeView_GetNextSibling(hTreeView, hItem);
|
||||||
|
if (hItem)
|
||||||
|
{
|
||||||
|
/* Kill it and all children */
|
||||||
|
DestroyItem(hTreeView, hItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static BOOL
|
||||||
|
TreeView_GetItemText(HWND hTreeView,
|
||||||
|
HTREEITEM hItem,
|
||||||
|
LPTSTR lpBuffer,
|
||||||
|
DWORD cbBuffer)
|
||||||
|
{
|
||||||
|
TVITEM tv = {0};
|
||||||
|
|
||||||
|
tv.mask = TVIF_TEXT | TVIF_HANDLE;
|
||||||
|
tv.hItem = hItem;
|
||||||
|
tv.pszText = lpBuffer;
|
||||||
|
tv.cchTextMax = (int)cbBuffer;
|
||||||
|
|
||||||
|
return TreeView_GetItem(hTreeView, &tv);
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
|
Loading…
Reference in a new issue