HTREEITEM
AddItemToTreeView(HWND hTreeView,
HTREEITEM hParent,
- LPTSTR lpDisplayName,
- LPTSTR lpServiceName,
+ LPWSTR lpDisplayName,
+ LPWSTR lpServiceName,
ULONG ServiceType,
BOOL bHasChildren)
{
TV_ITEM tvi;
TV_INSERTSTRUCT tvins;
- LPTSTR lpName;
+ LPWSTR lpName;
DWORD dwSize;
ZeroMemory(&tvi, sizeof(tvi));
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_CHILDREN;
tvi.pszText = lpDisplayName;
- tvi.cchTextMax = _tcslen(lpDisplayName);
+ tvi.cchTextMax = wcslen(lpDisplayName);
tvi.cChildren = bHasChildren;
/* Select the image for this service */
if (lpServiceName)
{
- dwSize = _tcslen(lpServiceName) + 1;
+ dwSize = wcslen(lpServiceName) + 1;
/* Attach the service name */
- lpName = (LPTSTR)HeapAlloc(GetProcessHeap(),
+ lpName = (LPWSTR)HeapAlloc(GetProcessHeap(),
0,
- dwSize * sizeof(TCHAR));
+ dwSize * sizeof(WCHAR));
if (lpName)
{
- _tcscpy_s(lpName, dwSize, lpServiceName);
+ StringCchCopyW(lpName, dwSize, lpServiceName);
tvi.lParam = (LPARAM)lpName;
}
}
HTREEITEM hItem)
{
LPARAM lParam = 0;
- TVITEM tv = {0};
+ TVITEMW tv = {0};
tv.mask = TVIF_PARAM | TVIF_HANDLE;
tv.hItem = hItem;
HTREEITEM hItem)
{
HTREEITEM hChildItem;
- LPTSTR lpServiceName;
+ LPWSTR lpServiceName;
/* Does this item have any children */
hChildItem = TreeView_GetChild(hTreeView, hItem);
}
/* Get the string and free it */
- lpServiceName = (LPTSTR)TreeView_GetItemParam(hTreeView, hItem);
+ lpServiceName = (LPWSTR)TreeView_GetItemParam(hTreeView, hItem);
if (lpServiceName)
{
HeapFree(GetProcessHeap(),
*/
static VOID
-InitDependPage(PSERVICEPROPSHEET pDlgInfo)
+InitDependPage(PDEPENDDATA pDependData)
{
/* Initialize the image list */
- pDlgInfo->hDependsImageList = InitImageList(IDI_NODEPENDS,
- IDI_DRIVER,
- GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CXSMICON),
- IMAGE_ICON);
+ pDependData->hDependsImageList = InitImageList(IDI_NODEPENDS,
+ IDI_DRIVER,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CXSMICON),
+ IMAGE_ICON);
/* Set the first tree view */
- TV1_Initialize(pDlgInfo, pDlgInfo->pService->lpServiceName);
+ TV1_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);
/* Set the second tree view */
- TV2_Initialize(pDlgInfo, pDlgInfo->pService->lpServiceName);
+ TV2_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);
}
/*
WPARAM wParam,
LPARAM lParam)
{
- PSERVICEPROPSHEET pDlgInfo;
+
+ PDEPENDDATA pDependData;
/* Get the window context */
- pDlgInfo = (PSERVICEPROPSHEET)GetWindowLongPtr(hwndDlg,
- GWLP_USERDATA);
- if (pDlgInfo == NULL && uMsg != WM_INITDIALOG)
+ pDependData = (PDEPENDDATA)GetWindowLongPtr(hwndDlg,
+ GWLP_USERDATA);
+ if (pDependData == NULL && uMsg != WM_INITDIALOG)
{
return FALSE;
}
{
case WM_INITDIALOG:
{
- pDlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
- if (pDlgInfo != NULL)
+ pDependData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DEPENDDATA));
+ if (pDependData != NULL)
{
SetWindowLongPtr(hwndDlg,
GWLP_USERDATA,
- (LONG_PTR)pDlgInfo);
+ (LONG_PTR)pDependData);
- pDlgInfo->hDependsWnd = hwndDlg;
+ pDependData->pDlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
+ pDependData->hDependsWnd = hwndDlg;
- InitDependPage(pDlgInfo);
+ InitDependPage(pDependData);
}
}
break;
if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE1)
{
/* Has this node been expanded before */
- if (!TreeView_GetChild(pDlgInfo->hDependsTreeView1, lpnmtv->itemNew.hItem))
+ if (!TreeView_GetChild(pDependData->hDependsTreeView1, lpnmtv->itemNew.hItem))
{
/* It's not, add the children */
- TV1_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPTSTR)lpnmtv->itemNew.lParam);
+ TV1_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
}
}
else if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE2)
{
/* Has this node been expanded before */
- if (!TreeView_GetChild(pDlgInfo->hDependsTreeView2, lpnmtv->itemNew.hItem))
+ if (!TreeView_GetChild(pDependData->hDependsTreeView2, lpnmtv->itemNew.hItem))
{
/* It's not, add the children */
- TV2_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPTSTR)lpnmtv->itemNew.lParam);
+ TV2_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
}
}
}
break;
case WM_DESTROY:
- DestroyTreeView(pDlgInfo->hDependsTreeView1);
- DestroyTreeView(pDlgInfo->hDependsTreeView2);
+ DestroyTreeView(pDependData->hDependsTreeView1);
+ DestroyTreeView(pDependData->hDependsTreeView2);
+
+ if (pDependData->hDependsImageList)
+ ImageList_Destroy(pDependData->hDependsImageList);
- if (pDlgInfo->hDependsImageList)
- ImageList_Destroy(pDlgInfo->hDependsImageList);
+ HeapFree(GetProcessHeap(), 0, pDependData);
}
return FALSE;