ReactOS 0.4.15-dev-8236-g99f0937
hotplug.c File Reference
#include "hotplug.h"
#include <debug.h>
Include dependency graph for hotplug.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static DWORD GetHotPlugFlags (VOID)
 
static DWORD SetHotPlugFlags (_In_ DWORD dwFlags)
 
static VOID UpdateDialog (_In_ HWND hwndDlg)
 
static VOID ShowContextMenu (HWND hwndDlg, HWND hwndTreeView, PHOTPLUG_DATA pHotplugData)
 
static DEVINST GetSelectedDeviceInst (_In_ PHOTPLUG_DATA pHotplugData)
 
static VOID ShowDeviceProperties (_In_ HWND hwndParent, _In_ DEVINST DevInst)
 
INT_PTR CALLBACK SafeRemovalDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
LONG APIENTRY InitApplet (HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
LONG CALLBACK CPlApplet (HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
INT WINAPI DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE hApplet = 0
 
APPLET Applets [NUM_APPLETS]
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file hotplug.c.

Function Documentation

◆ CPlApplet()

LONG CALLBACK CPlApplet ( HWND  hwndCPl,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 399 of file hotplug.c.

404{
405 UINT i = (UINT)lParam1;
406
407 switch(uMsg)
408 {
409 case CPL_INIT:
410 return TRUE;
411
412 case CPL_GETCOUNT:
413 return NUM_APPLETS;
414
415 case CPL_INQUIRE:
416 if (i < NUM_APPLETS)
417 {
418 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
419 CPlInfo->lData = 0;
420 CPlInfo->idIcon = Applets[i].idIcon;
421 CPlInfo->idName = Applets[i].idName;
422 CPlInfo->idInfo = Applets[i].idDescription;
423 }
424 else
425 {
426 return TRUE;
427 }
428 break;
429
430 case CPL_DBLCLK:
431 if (i < NUM_APPLETS)
432 Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
433 else
434 return TRUE;
435 break;
436
437 case CPL_STARTWPARMSW:
438 if (i < NUM_APPLETS)
439 return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
440 break;
441 }
442 return FALSE;
443}
#define CPL_INQUIRE
Definition: cpl.h:14
#define CPL_DBLCLK
Definition: cpl.h:16
#define CPL_STARTWPARMSW
Definition: cpl.h:21
#define CPL_INIT
Definition: cpl.h:12
#define CPL_GETCOUNT
Definition: cpl.h:13
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NUM_APPLETS
Definition: access.c:14
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
APPLET Applets[NUM_APPLETS]
Definition: hotplug.c:18
unsigned int UINT
Definition: ndis.h:50
int idDescription
Definition: hotplug.h:37
int idName
Definition: hotplug.h:36
int idIcon
Definition: hotplug.h:35
APPLET_PROC AppletProc
Definition: hotplug.h:38
Definition: cpl.h:24
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
int idInfo
Definition: cpl.h:27
int idIcon
Definition: cpl.h:25

◆ DllMain()

INT WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  dwReason,
LPVOID  lpvReserved 
)

Definition at line 447 of file hotplug.c.

451{
453
454 switch (dwReason)
455 {
458 hApplet = hinstDLL;
459 break;
460 }
461 return TRUE;
462}
DWORD dwReason
Definition: misc.cpp:154
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_THREAD_ATTACH
Definition: compat.h:132
HINSTANCE hApplet
Definition: hotplug.c:15
static IN DWORD IN LPVOID lpvReserved
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ GetHotPlugFlags()

static DWORD GetHotPlugFlags ( VOID  )
static

Definition at line 25 of file hotplug.c.

26{
27 HKEY hKey = NULL;
28 DWORD dwFlags = 0;
29 DWORD dwSize, dwError;
30
33 0,
35 &hKey);
36 if (dwError != ERROR_SUCCESS)
37 goto done;
38
39 dwSize = sizeof(dwFlags);
40 dwError = RegQueryValueExW(hKey,
41 L"HotPlugFlags",
42 NULL,
43 NULL,
45 &dwSize);
46 if (dwError != ERROR_SUCCESS)
47 dwFlags = 0;
48
49done:
50 if (hKey != NULL)
52
53 return dwFlags;
54}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
#define REGSTR_PATH_SYSTRAY
Definition: regstr.h:531
unsigned char * LPBYTE
Definition: typedefs.h:53
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by SafeRemovalDlgProc().

◆ GetSelectedDeviceInst()

static DEVINST GetSelectedDeviceInst ( _In_ PHOTPLUG_DATA  pHotplugData)
static

Definition at line 139 of file hotplug.c.

141{
142 HTREEITEM hTreeItem;
144
145 hTreeItem = TreeView_GetSelection(pHotplugData->hwndDeviceTree);
146 if (hTreeItem == NULL)
147 return 0;
148
149 ZeroMemory(&item, sizeof(item));
150 item.mask = TVIF_PARAM;
151 item.hItem = hTreeItem;
152
153 TreeView_GetItem(pHotplugData->hwndDeviceTree, &item);
154
155 return item.lParam;
156}
static ATOM item
Definition: dde.c:856
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define TVIF_PARAM
Definition: commctrl.h:3268
#define ZeroMemory
Definition: winbase.h:1712

Referenced by SafeRemovalDlgProc().

◆ InitApplet()

LONG APIENTRY InitApplet ( HWND  hwnd,
UINT  uMsg,
LPARAM  wParam,
LPARAM  lParam 
)

Definition at line 380 of file hotplug.c.

385{
386 DPRINT("InitApplet()\n");
387
390 hwnd,
392
393 // TODO
394 return TRUE;
395}
#define IDD_SAFE_REMOVE_HARDWARE_DIALOG
Definition: resource.h:9
INT_PTR CALLBACK SafeRemovalDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hotplug.c:202
#define DPRINT
Definition: sndvol32.h:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5770

◆ SafeRemovalDlgProc()

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

Definition at line 202 of file hotplug.c.

207{
208 PHOTPLUG_DATA pHotplugData;
209
210 pHotplugData = (PHOTPLUG_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
211
212 switch (uMsg)
213 {
214 case WM_INITDIALOG:
215 pHotplugData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HOTPLUG_DATA));
216 if (pHotplugData != NULL)
217 {
218 WCHAR szWindowTitle[MAX_PATH];
219
220 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pHotplugData);
221
224 szWindowTitle,
225 ARRAYSIZE(szWindowTitle)))
226 {
227 SetWindowTextW(hwndDlg, szWindowTitle);
228 }
229
230 pHotplugData->hIcon = (HICON)LoadImageW(hApplet,
236 pHotplugData->hIconSm = (HICON)LoadImageW(hApplet,
242 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)pHotplugData->hIcon);
243 SendMessageW(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)pHotplugData->hIconSm);
244
245 pHotplugData->ImageListData.cbSize = sizeof(pHotplugData->ImageListData);
247
249 pHotplugData->hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE);
250 pHotplugData->dwFlags = GetHotPlugFlags();
251
252 if (pHotplugData->dwFlags & HOTPLUG_DISPLAY_DEVICE_COMPONENTS)
254
256 pHotplugData->ImageListData.ImageList,
258
259 EnumHotpluggedDevices(pHotplugData);
260 UpdateDialog(hwndDlg);
261 }
262 return TRUE;
263
264 case WM_COMMAND:
265 switch (LOWORD(wParam))
266 {
267 case IDCLOSE:
268 KillTimer(hwndDlg, 1);
269 EndDialog(hwndDlg, TRUE);
270 break;
271
273 if (HIWORD(wParam) == BN_CLICKED)
274 {
275 if (pHotplugData != NULL)
276 {
279 else
280 pHotplugData->dwFlags &= ~HOTPLUG_DISPLAY_DEVICE_COMPONENTS;
281
282 SetHotPlugFlags(pHotplugData->dwFlags);
283
284 EnumHotpluggedDevices(pHotplugData);
285 UpdateDialog(hwndDlg);
286 }
287 }
288 break;
289
291 case IDM_PROPERTIES:
292 ShowDeviceProperties(hwndDlg, GetSelectedDeviceInst(pHotplugData));
293 break;
294
296 case IDM_STOP:
297 {
298 if (pHotplugData != NULL)
299 {
302 hwndDlg,
304 (LPARAM)pHotplugData);
305 }
306
307 break;
308 }
309 }
310 break;
311
312 case WM_DEVICECHANGE:
313 switch (wParam)
314 {
316 SetTimer(hwndDlg, 1, 500, NULL);
317 break;
318 }
319 break;
320
321 case WM_TIMER:
322 if (wParam == 1)
323 {
324 KillTimer(hwndDlg, 1);
325
326 if (pHotplugData != NULL)
327 {
328 EnumHotpluggedDevices(pHotplugData);
329 UpdateDialog(hwndDlg);
330 }
331 }
332 break;
333
334 case WM_NOTIFY:
336 {
337 if (((LPNMHDR)lParam)->code == NM_RCLICK)
338 {
339 if (pHotplugData != NULL)
340 {
341 ShowContextMenu(hwndDlg,
342 ((LPNMHDR)lParam)->hwndFrom,
343 pHotplugData);
344 return TRUE;
345 }
346 }
347 }
348 break;
349
350 case WM_CLOSE:
351 KillTimer(hwndDlg, 1);
352 EndDialog(hwndDlg, TRUE);
353 break;
354
355 case WM_DESTROY:
356 if (pHotplugData != NULL)
357 {
358 if (pHotplugData->hPopupMenu != NULL)
359 DestroyMenu(pHotplugData->hPopupMenu);
360
362
363 if (pHotplugData->hIconSm)
364 DestroyIcon(pHotplugData->hIconSm);
365
366 if (pHotplugData->hIcon)
367 DestroyIcon(pHotplugData->hIcon);
368
369 HeapFree(GetProcessHeap(), 0, pHotplugData);
371 }
372 break;
373 }
374
375 return FALSE;
376}
#define IDM_PROPERTIES
Definition: resources.h:9
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DBT_DEVNODES_CHANGED
Definition: dbt.h:28
#define IDS_CPLNAME
Definition: resource.h:8
VOID EnumHotpluggedDevices(_In_ PHOTPLUG_DATA pHotplugData)
Definition: enum.c:150
#define IDM_POPUP_DEVICE_TREE
Definition: resource.h:21
#define IDD_CONFIRM_STOP_HARDWARE_DIALOG
Definition: resource.h:17
#define IDC_SAFE_REMOVE_DEVICE_TREE
Definition: resource.h:11
#define IDC_SAFE_REMOVE_DISPLAY_COMPONENTS
Definition: resource.h:15
#define IDC_SAFE_REMOVE_PROPERTIES
Definition: resource.h:13
#define IDM_STOP
Definition: resource.h:22
#define IDC_SAFE_REMOVE_STOP
Definition: resource.h:14
#define IDI_HOTPLUG
Definition: resource.h:4
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:322
INT_PTR CALLBACK ConfirmRemovalDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: eject.c:84
static VOID ShowContextMenu(HWND hwndDlg, HWND hwndTreeView, PHOTPLUG_DATA pHotplugData)
Definition: hotplug.c:110
static DEVINST GetSelectedDeviceInst(_In_ PHOTPLUG_DATA pHotplugData)
Definition: hotplug.c:139
static VOID ShowDeviceProperties(_In_ HWND hwndParent, _In_ DEVINST DevInst)
Definition: hotplug.c:160
static DWORD SetHotPlugFlags(_In_ DWORD dwFlags)
Definition: hotplug.c:58
static DWORD GetHotPlugFlags(VOID)
Definition: hotplug.c:25
static VOID UpdateDialog(_In_ HWND hwndDlg)
Definition: hotplug.c:92
struct _HOTPLUG_DATA * PHOTPLUG_DATA
#define HOTPLUG_DISPLAY_DEVICE_COMPONENTS
Definition: hotplug.h:24
static HICON
Definition: imagelist.c:84
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define NM_RCLICK
Definition: commctrl.h:133
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
#define WM_NOTIFY
Definition: richedit.h:61
HMENU hPopupMenu
Definition: hotplug.h:46
HWND hwndDeviceTree
Definition: hotplug.h:47
HICON hIcon
Definition: hotplug.h:43
DWORD dwFlags
Definition: hotplug.h:48
HICON hIconSm
Definition: hotplug.h:44
SP_CLASSIMAGELIST_DATA ImageListData
Definition: hotplug.h:45
Definition: inflate.c:139
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LPARAM
Definition: windef.h:208
#define Button_GetCheck(hwndCtl)
Definition: windowsx.h:31
#define Button_SetCheck(hwndCtl, check)
Definition: windowsx.h:35
#define WM_CLOSE
Definition: winuser.h:1621
#define DWLP_USER
Definition: winuser.h:872
#define IMAGE_ICON
Definition: winuser.h:212
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1740
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2234
#define SM_CYSMICON
Definition: winuser.h:1013
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_DEVICECHANGE
Definition: winuser.h:1811
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define SM_CXSMICON
Definition: winuser.h:1012
#define SM_CYICON
Definition: winuser.h:973
#define WM_TIMER
Definition: winuser.h:1742
#define LoadMenu
Definition: winuser.h:5826
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define BN_CLICKED
Definition: winuser.h:1925
#define WM_DESTROY
Definition: winuser.h:1609
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SM_CXICON
Definition: winuser.h:972
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2084
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by InitApplet().

◆ SetHotPlugFlags()

static DWORD SetHotPlugFlags ( _In_ DWORD  dwFlags)
static

Definition at line 58 of file hotplug.c.

60{
61 HKEY hKey = NULL;
62 DWORD dwError;
63
66 0,
67 NULL,
70 NULL,
71 &hKey,
72 NULL);
73 if (dwError != ERROR_SUCCESS)
74 goto done;
75
76 dwError = RegSetValueExW(hKey,
77 L"HotPlugFlags",
78 0,
81 sizeof(dwFlags));
82
83done:
84 if (hKey != NULL)
86
87 return dwError;
88}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by SafeRemovalDlgProc().

◆ ShowContextMenu()

static VOID ShowContextMenu ( HWND  hwndDlg,
HWND  hwndTreeView,
PHOTPLUG_DATA  pHotplugData 
)
static

Definition at line 110 of file hotplug.c.

114{
115 HTREEITEM hTreeItem;
116 RECT rc;
117 POINT pt;
118
120 if (hTreeItem == NULL)
121 return;
122
123 TreeView_GetItemRect(hwndTreeView, hTreeItem, &rc, TRUE);
124
125 pt.x = (rc.left + rc.right) / 2;
126 pt.y = (rc.top + rc.bottom) / 2;
128 TrackPopupMenu(GetSubMenu(pHotplugData->hPopupMenu, 0),
130 pt.x,
131 pt.y,
132 0,
133 hwndDlg,
134 NULL);
135}
#define pt(x, y)
Definition: drawing.c:79
HWND hwndTreeView
Definition: eventvwr.c:65
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3429
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define TPM_TOPALIGN
Definition: winuser.h:2383
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define TPM_LEFTALIGN
Definition: winuser.h:2377
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)

Referenced by OpenDialogProc(), SafeRemovalDlgProc(), SaveDialogProc(), and VfdPageDlgProc().

◆ ShowDeviceProperties()

static VOID ShowDeviceProperties ( _In_ HWND  hwndParent,
_In_ DEVINST  DevInst 
)
static

Definition at line 160 of file hotplug.c.

163{
164 ULONG ulSize;
165 CONFIGRET cr;
166 LPWSTR pszDevId;
167
168 cr = CM_Get_Device_ID_Size(&ulSize, DevInst, 0);
169 if (cr != CR_SUCCESS || ulSize == 0)
170 return;
171
172 /* Take the terminating NULL into account */
173 ulSize++;
174
175 pszDevId = HeapAlloc(GetProcessHeap(), 0, ulSize * sizeof(WCHAR));
176 if (pszDevId == NULL)
177 return;
178
179 cr = CM_Get_Device_IDW(DevInst, pszDevId, ulSize, 0);
180 if (cr == CR_SUCCESS)
181 {
182 typedef int (WINAPI *PFDEVICEPROPERTIESW)(HWND, LPCWSTR, LPCWSTR, BOOL);
183 HMODULE hDevMgrDll;
184 PFDEVICEPROPERTIESW pDevicePropertiesW;
185
186 hDevMgrDll = LoadLibraryW(L"devmgr.dll");
187 if (hDevMgrDll != NULL)
188 {
189 pDevicePropertiesW = (PFDEVICEPROPERTIESW)GetProcAddress(hDevMgrDll, "DevicePropertiesW");
190 if (pDevicePropertiesW != NULL)
191 pDevicePropertiesW(hwndParent, NULL, pszDevId, FALSE);
192
193 FreeLibrary(hDevMgrDll);
194 }
195 }
196
197 HeapFree(GetProcessHeap(), 0, pszDevId);
198}
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Get_Device_IDW(_In_ DEVINST dnDevInst, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags)
Definition: cfgmgr.c:3676
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:4073
static HWND hwndParent
Definition: cryptui.c:300
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define BOOL
Definition: nt_native.h:43
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by SafeRemovalDlgProc().

◆ UpdateDialog()

static VOID UpdateDialog ( _In_ HWND  hwndDlg)
static

Definition at line 92 of file hotplug.c.

94{
95 HWND hwndDeviceTree;
96 BOOL bHasItem;
97
98 hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE);
99
100 bHasItem = (TreeView_GetCount(hwndDeviceTree) != 0);
101 if (bHasItem)
102 TreeView_SelectItem(hwndDeviceTree, TreeView_GetFirstVisible(hwndDeviceTree));
103
105 EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_STOP), bHasItem);
106}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define TreeView_GetCount(hwnd)
Definition: commctrl.h:3432
#define TreeView_GetFirstVisible(hwnd)
Definition: commctrl.h:3470
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by SafeRemovalDlgProc().

Variable Documentation

◆ Applets

APPLET Applets[NUM_APPLETS]
Initial value:
=
{
}
#define IDS_CPLDESCRIPTION
Definition: resource.h:9
LONG APIENTRY InitApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
Definition: hotplug.c:380

Definition at line 18 of file hotplug.c.

Referenced by CPlApplet().

◆ hApplet

HINSTANCE hApplet = 0

Definition at line 15 of file hotplug.c.

Referenced by DllMain(), InitApplet(), and SafeRemovalDlgProc().