ReactOS 0.4.16-dev-303-g11d5cb8
propsheet_depends.c File Reference
#include "precomp.h"
Include dependency graph for propsheet_depends.c:

Go to the source code of this file.

Functions

HTREEITEM AddItemToTreeView (HWND hTreeView, HTREEITEM hParent, LPWSTR lpDisplayName, LPWSTR lpServiceName, ULONG ServiceType, BOOL bHasChildren)
 
static LPARAM TreeView_GetItemParam (HWND hTreeView, HTREEITEM hItem)
 
static VOID DestroyItem (HWND hTreeView, HTREEITEM hItem)
 
static VOID DestroyTreeView (HWND hTreeView)
 
static VOID InitDependPage (PDEPENDDATA pDependData)
 
INT_PTR CALLBACK DependenciesPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ AddItemToTreeView()

HTREEITEM AddItemToTreeView ( HWND  hTreeView,
HTREEITEM  hParent,
LPWSTR  lpDisplayName,
LPWSTR  lpServiceName,
ULONG  ServiceType,
BOOL  bHasChildren 
)

Definition at line 13 of file propsheet_depends.c.

19{
20 TV_ITEM tvi;
21 TV_INSERTSTRUCT tvins;
24
25 ZeroMemory(&tvi, sizeof(tvi));
26 ZeroMemory(&tvins, sizeof(tvins));
27
29 tvi.pszText = lpDisplayName;
30 tvi.cchTextMax = wcslen(lpDisplayName);
31 tvi.cChildren = bHasChildren;
32
33 /* Select the image for this service */
34 switch (ServiceType)
35 {
38 tvi.iImage = IMAGE_SERVICE;
39 tvi.iSelectedImage = IMAGE_SERVICE;
40 break;
41
44 tvi.iImage = IMAGE_DRIVER;
45 tvi.iSelectedImage = IMAGE_DRIVER;
46 break;
47
48 default:
49 tvi.iImage = IMAGE_UNKNOWN;
50 tvi.iSelectedImage = IMAGE_UNKNOWN;
51 break;
52 }
53
54 if (lpServiceName)
55 {
56 dwSize = wcslen(lpServiceName) + 1;
57 /* Attach the service name */
59 0,
60 dwSize * sizeof(WCHAR));
61 if (lpName)
62 {
63 StringCchCopyW(lpName, dwSize, lpServiceName);
64 tvi.lParam = (LPARAM)lpName;
65 }
66 }
67
68 tvins.item = tvi;
69 tvins.hParent = hParent;
70
71 return TreeView_InsertItem(hTreeView, &tvins);
72}
#define IMAGE_SERVICE
Definition: precomp.h:37
#define IMAGE_DRIVER
Definition: precomp.h:38
#define IMAGE_UNKNOWN
Definition: precomp.h:36
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TV_INSERTSTRUCT
Definition: commctrl.h:3382
#define TV_ITEM
Definition: commctrl.h:3305
#define TVIF_PARAM
Definition: commctrl.h:3273
#define TVIF_CHILDREN
Definition: commctrl.h:3277
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3417
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define ZeroMemory
Definition: winbase.h:1737
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2815
_In_ LPCSTR lpName
Definition: winbase.h:2814
LONG_PTR LPARAM
Definition: windef.h:208
#define SERVICE_KERNEL_DRIVER
Definition: cmtypes.h:953
#define SERVICE_WIN32_SHARE_PROCESS
Definition: cmtypes.h:963
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
#define SERVICE_FILE_SYSTEM_DRIVER
Definition: cmtypes.h:954
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by TV1_AddDependantsToTree(), and TV2_AddDependantsToTree().

◆ DependenciesPageProc()

INT_PTR CALLBACK DependenciesPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 183 of file propsheet_depends.c.

187{
188 PDEPENDDATA pDependData;
189
190 /* Get the window context */
191 pDependData = (PDEPENDDATA)GetWindowLongPtr(hwndDlg,
193 if (pDependData == NULL && uMsg != WM_INITDIALOG)
194 {
195 return FALSE;
196 }
197
198 switch (uMsg)
199 {
200 case WM_INITDIALOG:
201 {
202 pDependData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DEPENDDATA));
203 if (pDependData != NULL)
204 {
205 SetWindowLongPtr(hwndDlg,
207 (LONG_PTR)pDependData);
208
209 pDependData->pDlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
210 pDependData->hDependsWnd = hwndDlg;
211
212 InitDependPage(pDependData);
213 }
214 }
215 break;
216
217 case WM_NOTIFY:
218 {
219 switch (((LPNMHDR)lParam)->code)
220 {
222 {
224
225 if (lpnmtv->action == TVE_EXPAND)
226 {
227 if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE1)
228 {
229 /* Has this node been expanded before */
230 if (!TreeView_GetChild(pDependData->hDependsTreeView1, lpnmtv->itemNew.hItem))
231 {
232 /* It's not, add the children */
233 TV1_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
234 }
235 }
236 else if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE2)
237 {
238 /* Has this node been expanded before */
239 if (!TreeView_GetChild(pDependData->hDependsTreeView2, lpnmtv->itemNew.hItem))
240 {
241 /* It's not, add the children */
242 TV2_AddDependantsToTree(pDependData, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam);
243 }
244 }
245 }
246 break;
247 }
248 }
249 break;
250 }
251
252 case WM_COMMAND:
253 switch(LOWORD(wParam))
254 {
255
256 }
257 break;
258
259 case WM_DESTROY:
262
263 if (pDependData->hDependsImageList)
265
266 HeapFree(GetProcessHeap(), 0, pDependData);
267 }
268
269 return FALSE;
270}
struct _DEPENDDATA * PDEPENDDATA
struct _SERVICEPROPSHEET * PSERVICEPROPSHEET
#define IDC_DEPEND_TREE1
Definition: resource.h:175
#define IDC_DEPEND_TREE2
Definition: resource.h:176
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
VOID TV1_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
VOID TV2_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName)
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
static VOID InitDependPage(PDEPENDDATA pDependData)
static VOID DestroyTreeView(HWND hTreeView)
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3471
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define TVE_EXPAND
Definition: commctrl.h:3428
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3743
#define WM_NOTIFY
Definition: richedit.h:61
PSERVICEPROPSHEET pDlgInfo
Definition: precomp.h:138
HWND hDependsTreeView1
Definition: precomp.h:141
HIMAGELIST hDependsImageList
Definition: precomp.h:139
HWND hDependsTreeView2
Definition: precomp.h:142
HWND hDependsWnd
Definition: precomp.h:140
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define WM_DESTROY
Definition: winuser.h:1612

Referenced by PropSheetThread().

◆ DestroyItem()

static VOID DestroyItem ( HWND  hTreeView,
HTREEITEM  hItem 
)
static

Definition at line 93 of file propsheet_depends.c.

95{
96 HTREEITEM hChildItem;
97 LPWSTR lpServiceName;
98
99 /* Does this item have any children */
100 hChildItem = TreeView_GetChild(hTreeView, hItem);
101 if (hChildItem)
102 {
103 /* It does, recurse to that one */
104 DestroyItem(hTreeView, hChildItem);
105 }
106
107 /* Get the string and free it */
108 lpServiceName = (LPWSTR)TreeView_GetItemParam(hTreeView, hItem);
109 if (lpServiceName)
110 {
112 0,
113 lpServiceName);
114 }
115}
static VOID DestroyItem(HWND hTreeView, HTREEITEM hItem)
static LPARAM TreeView_GetItemParam(HWND hTreeView, HTREEITEM hItem)

Referenced by DestroyItem(), and DestroyTreeView().

◆ DestroyTreeView()

static VOID DestroyTreeView ( HWND  hTreeView)
static

Definition at line 118 of file propsheet_depends.c.

119{
121
122 /* Get the first item in the top level */
123 hItem = TreeView_GetFirstVisible(hTreeView);
124 if (hItem)
125 {
126 /* Kill it and all children */
127 DestroyItem(hTreeView, hItem);
128
129 /* Kill all remaining top level items */
130 while (hItem)
131 {
132 /* Are there any more items at the top level */
133 hItem = TreeView_GetNextSibling(hTreeView, hItem);
134 if (hItem)
135 {
136 /* Kill it and all children */
137 DestroyItem(hTreeView, hItem);
138 }
139 }
140 }
141}
#define TreeView_GetFirstVisible(hwnd)
Definition: commctrl.h:3475
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3472
HTREEITEM hItem
Definition: treelist.h:37

Referenced by ChildWndProc(), and DependenciesPageProc().

◆ InitDependPage()

static VOID InitDependPage ( PDEPENDDATA  pDependData)
static

Definition at line 162 of file propsheet_depends.c.

163{
164 /* Initialize the image list */
169 IMAGE_ICON);
170
171 /* Set the first tree view */
172 TV1_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);
173
174 /* Set the second tree view */
175 TV2_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);
176}
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height, ULONG type)
Definition: misc.c:219
#define IDI_NODEPENDS
Definition: resource.h:66
#define IDI_DRIVER
Definition: resource.h:68
BOOL TV1_Initialize(PDEPENDDATA pDependData, LPWSTR lpServiceName)
BOOL TV2_Initialize(PDEPENDDATA pDependData, LPWSTR lpServiceName)
ENUM_SERVICE_STATUS_PROCESS * pService
Definition: precomp.h:132
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CXSMICON
Definition: winuser.h:1015
int WINAPI GetSystemMetrics(_In_ int)

Referenced by DependenciesPageProc().

◆ TreeView_GetItemParam()

static LPARAM TreeView_GetItemParam ( HWND  hTreeView,
HTREEITEM  hItem 
)
static

Definition at line 75 of file propsheet_depends.c.

77{
78 LPARAM lParam = 0;
79 TVITEMW tv = {0};
80
82 tv.hItem = hItem;
83
84 if (TreeView_GetItem(hTreeView, &tv))
85 {
86 lParam = tv.lParam;
87 }
88
89 return lParam;
90}
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3495
#define TVIF_HANDLE
Definition: commctrl.h:3275
HTREEITEM hItem
Definition: commctrl.h:3322
LPARAM lParam
Definition: commctrl.h:3330
UINT mask
Definition: commctrl.h:3321

Referenced by DestroyItem().