| 1338 | } |
| 1339 | |
| 1340 | void ShellBrowser::OnDeviceChange(WPARAM wParam, LPARAM lParam) |
| 1341 | { |
| 1342 | /* Note changes made here may have no effect. Since |
| 1343 | the icon for the cd/dvd/etc. may not have been |
| 1344 | updated by the time this function is called, it's |
| 1345 | possible this may not change anything. */ |
| 1346 | |
| 1347 | /* If we are currently not in my computer, this |
| 1348 | message can be safely ignored (drives are only |
| 1349 | shown in my computer). */ |
| 1350 | if (CompareVirtualFolders(CSIDL_DRIVES)) |
| 1351 | { |
| 1352 | switch (wParam) |
| 1353 | { |
| 1354 | /* Device has being added/inserted into the system. Update the |
| 1355 | drives toolbar as necessary. */ |
| 1356 | case DBT_DEVICEARRIVAL: |
| 1357 | { |
| 1358 | DEV_BROADCAST_HDR *dbh = nullptr; |
| 1359 | |
| 1360 | dbh = (DEV_BROADCAST_HDR *) lParam; |
| 1361 | |
| 1362 | if (dbh->dbch_devicetype == DBT_DEVTYP_VOLUME) |
| 1363 | { |
| 1364 | DEV_BROADCAST_VOLUME *pdbv = nullptr; |
| 1365 | TCHAR chDrive; |
| 1366 | TCHAR szDrive[4]; |
| 1367 | |
| 1368 | pdbv = (DEV_BROADCAST_VOLUME *) dbh; |
| 1369 | |
| 1370 | /* Build a string that will form the drive name. */ |
| 1371 | chDrive = GetDriveLetterFromMask(pdbv->dbcv_unitmask); |
| 1372 | StringCchPrintf(szDrive, SIZEOF_ARRAY(szDrive), _T("%c:\\"), chDrive); |
| 1373 | |
| 1374 | if (pdbv->dbcv_flags & DBTF_MEDIA) |
| 1375 | { |
| 1376 | UpdateDriveIcon(szDrive); |
| 1377 | } |
| 1378 | else |
| 1379 | { |
| 1380 | OnFileActionAdded(szDrive); |
| 1381 | } |
| 1382 | } |
| 1383 | } |
| 1384 | break; |
| 1385 | |
| 1386 | case DBT_DEVICEREMOVECOMPLETE: |
| 1387 | { |
| 1388 | DEV_BROADCAST_HDR *dbh = nullptr; |
| 1389 | |
| 1390 | dbh = (DEV_BROADCAST_HDR *) lParam; |
| 1391 | |
| 1392 | if (dbh->dbch_devicetype == DBT_DEVTYP_VOLUME) |
| 1393 | { |
| 1394 | DEV_BROADCAST_VOLUME *pdbv = nullptr; |
| 1395 | TCHAR chDrive; |
| 1396 | TCHAR szDrive[4]; |
| 1397 |
nothing calls this directly
no test coverage detected