1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 2001.
//
// File: B I N D V I E W . H
//
// Contents: Function Prototypes
//
// Notes:
//
// Author: Alok Sinha 15-May-01
//
//----------------------------------------------------------------------------
#ifndef _BINDVIEW_H_INCLUDED
#define _BINDVIEW_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <windowsx.h>
#include <wchar.h>
#include <commctrl.h> // For common controls, e.g. Tree
#include <commdlg.h>
#include <setupapi.h>
#include <devguid.h>
#include "NetCfgAPI.h"
#include "resource.h"
#include <strsafe.h>
__user_code; // Annotation to specify PreFast analysis mode
#define celems(_x) (sizeof(_x) / sizeof(_x[0]))
#define ID_STATUS 100
#define APP_NAME L"BindView"
#define CLIENTS_SELECTED 0
#define SERVICES_SELECTED 1
#define PROTOCOLS_SELECTED 2
#define ADAPTERS_SELECTED 3
#define ITEM_NET_COMPONENTS 1
#define ITEM_NET_BINDINGS 2
#define ITEM_NET_ADAPTERS 4
#define DEFAULT_COMPONENT_SELECTED CLIENTS_SELECTED
#define WM_NO_COMPONENTS WM_USER+1
#define MENUITEM_ENABLE L"Enable"
#define MENUITEM_DISABLE L"Disable"
extern HINSTANCE hInstance;
extern const GUID *pguidNetClass [];
extern LPWSTR lpszNetClass [];
typedef struct _BIND_UNBIND_INFO {
LPWSTR lpszInfId;
BOOL fBindTo;
} BIND_UNBIND_INFO, *LPBIND_UNBIND_INFO;
//
// Functions defined in bindview.cpp
//
INT_PTR CALLBACK MainDlgProc (HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK BindComponentDlg (HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK InstallDlg (HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK UninstallDlg (HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
VOID DumpBindings ( _In_ LPWSTR lpszFile);
VOID InstallSelectedComponentType (HWND hwndDlg,
_In_opt_ LPWSTR lpszInfFile);
HRESULT GetPnpID ( _In_ LPWSTR lpszInfFile,
_Outptr_ LPWSTR *lppszPnpID);
HRESULT GetKeyValue (HINF hInf,
_In_ LPCWSTR lpszSection,
_In_opt_ LPCWSTR lpszKey,
DWORD dwIndex,
_Outptr_ LPWSTR *lppszValue);
VOID UninstallSelectedComponent (HWND hwndDlg);
VOID ExpandCollapseAll (HWND hwndTree,
HTREEITEM hTreeItem,
UINT uiFlag);
BOOL GetFileName (HWND hwndDlg,
_In_opt_ LPWSTR lpszFilter,
_In_ LPWSTR lpszTitle,
DWORD dwFlags,
_Out_writes_(MAX_PATH+1) LPWSTR lpszFile,
_In_opt_ LPWSTR lpszDefExt,
BOOL fSave);
VOID ProcessRightClick (LPNMHDR lpnm);
VOID ShowComponentMenu (HWND hwndOwner,
HTREEITEM hItem,
LPARAM lParam);
VOID ShowBindingPathMenu (HWND hwndOwner,
HTREEITEM hItem,
LPARAM lParam,
BOOL fEnabled);
BOOL GetItemInfo (HWND hwndTree,
HTREEITEM hItem,
LPARAM *lParam,
LPDWORD lpdwItemType,
BOOL *fEnabled);
HTREEITEM AddBindNameToTree (INetCfgBindingPath *pncbp,
HWND hwndTree,
HTREEITEM hParent,
ULONG ulIndex);
HTREEITEM AddToTree (HWND hwndTree,
HTREEITEM hParent,
INetCfgComponent *pncc);
HTREEITEM AddToTreeEx (HWND hwndTree,
HTREEITEM hParent,
INetCfgComponent *pncc,
BOOL fUsePnpId);
VOID RefreshAll (HWND hwndDlg);
VOID RefreshItemState (HWND hwndTree,
HTREEITEM hItem,
BOOL fEnable);
VOID RefreshBindings (HWND hwndTree,
_In_ LPWSTR lpszInfId);
VOID ReleaseMemory (HWND hwndTree,
HTREEITEM hTreeItem);
VOID DeleteChildren (HWND hwndTree,
HTREEITEM hTreeItem);
HTREEITEM InsertItem (HWND hwndTree,
UINT uiType);
BOOL UpdateComponentTypeList (HWND hwndTypeList);
VOID ErrMsg (HRESULT hr,
LPCWSTR lpFmt,
...);
//
// Functions defined in component.cpp
//
VOID HandleComponentOperation (HWND hwndOwner,
ULONG ulSelection,
HTREEITEM hItem,
LPARAM lParam);
VOID BindUnbindComponents( HWND hwndOwner,
HTREEITEM hItem,
_In_ LPWSTR lpszInfId,
BOOL fBindTo);
HRESULT InstallComponent (HWND hwndDlg,
const GUID *pguidClass);
HRESULT InstallSpecifiedComponent ( _In_ LPWSTR lpszInfFile,
_In_ LPWSTR lpszPnpID,
const GUID *pguidClass);
DWORD ListCompToBindUnbind ( _In_ LPWSTR lpszInfId,
UINT uiType,
HWND hwndTree,
BOOL fBound);
BOOL BindUnbind ( _In_ LPWSTR lpszInfId,
HWND hwndTree,
BOOL fBind);
VOID ListInstalledComponents (HWND hwndTree,
const GUID *pguidClass);
HRESULT UninstallComponent ( _In_ LPWSTR lpszInfId);
//
// Functions defined in binding.cpp
//
VOID WriteBindings (FILE *fp);
VOID WriteBindingPath (FILE *fp,
INetCfgComponent *pncc);
VOID WriteInterfaces (FILE *fp,
INetCfgBindingPath *pncbp);
BOOL EnumNetBindings (HWND hwndTree,
UINT uiTypeSelected);
VOID ListBindings (INetCfgComponent *pncc,
HWND hwndTree,
HTREEITEM hTreeItemRoot);
VOID ListInterfaces (INetCfgBindingPath *pncbp,
HWND hwndTree,
HTREEITEM hTreeItemRoot);
VOID HandleBindingPathOperation (HWND hwndOwner,
ULONG ulSelection,
HTREEITEM hItem,
LPARAM lParam);
VOID EnableBindingPath (HWND hwndOwner,
HTREEITEM hItem,
_In_ LPWSTR lpszTokenPath,
BOOL fEnable);
LPWSTR GetComponentId (HWND hwndTree,
HTREEITEM hItem);
INetCfgBindingPath *FindBindingPath (INetCfg *pnc,
_In_ LPWSTR lpszInfId,
_In_ LPWSTR lpszPathTokenSelected);
#endif
|