wxThread::ExitCode CVolumeDescriptionEnumeratorThread::Entry() { if (!GetDrives()) m_failure = true; m_running = false; wxCommandEvent evt(fzEVT_VOLUMESENUMERATED); m_pEvtHandler->AddPendingEvent(evt); return 0; }
// ---------------------------------------------------------------------------- // Indicates USB device state change to personality. // There is no need to Cancel, because Confirm unload can not be ongoing // before Address state. // ---------------------------------------------------------------------------- // void CUsbActiveMscHandler::StateChangeNotify( TUsbDeviceState aState ) { FTRACE( FPrint( _L( "[USBWATCHER]\tCUsbActiveMscHandler::StateChangeNotify aState = %d" ), aState ) ); switch( aState ) { //Note that Address state may be caused also by cable disconnection. case EUsbDeviceStateAddress: { //Do not start mounting if already ongoing //e.g. fast state changes Address-->Suspended-->Address if ( !iMountChanged && (GetDrives() == KErrNone) ) { if (iDrives.Count()) { iDriveIndex = iDrives.Count(); StartDismountFat(); } else { if ( GlobalSystemState() == EUsbGSStateCategoryNormal ) { iIsQueryNoteShown = ETrue; // if the error is something abnormal, note still needs to be shown iQueryParams().iQuery = EUSBStorageMediaFailure; iPersonalityParams.PersonalityNotifier().ShowQuery( KQueriesNotifier, iQueryParams, iDummy); } } } } break; case EUsbDeviceStateUndefined: { if (iMountChanged) { UnmountMassStorage(); iMscState = EUsbMscStateIdle; } } break; default: break; } FLOG(_L("[USBWATCHER]\tCUsbActiveMscHandler::StateChangeNotify completed")); }
void CRecBinViewer::InstallShellNotify () { SHChangeNotifyEntry stPIDL; LPITEMIDLIST ppidl; int iPos = 0; TCHAR szPath[MAX_PATH]; WIN32_FIND_DATA findData; HANDLE hFindData = INVALID_HANDLE_VALUE; HRESULT hr = S_OK; CDriveArray ar; GetDrives (ar); for (unsigned int i = 0; i < ar.size (); i++) { if (ar[i].m_nType != DRIVE_FIXED) continue; SHQUERYRBINFO qrbi; ZeroMemory (&qrbi, sizeof (qrbi)); qrbi.cbSize = sizeof (qrbi); hr = SHQueryRecycleBin (ar[i].m_Path, &qrbi); if (SUCCEEDED (hr)) { ZeroMemory (&findData, sizeof (findData)); wsprintf (szPath, _T("%sRecycler"), static_cast<LPCWSTR>(ar[i].m_Path)); hFindData = FindFirstFile (szPath, &findData); if (INVALID_HANDLE_VALUE != hFindData) { ppidl = SHSimpleIDListFromPath (szPath); stPIDL.pidl = ppidl; m_pidlDrives[iPos] = ppidl; m_hNotifyDrives[iPos] = SHChangeNotifyRegister (m_hWnd, SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS, SHCNE_RMDIR | SHCNE_RENAMEFOLDER | SHCNE_DELETE | SHCNE_RENAMEITEM, WM_SHELLNOTIFYRBINDIR, 1, &stPIDL); iPos ++; FindClose (hFindData); } else { ZeroMemory (&findData, sizeof (findData)); wsprintf (szPath, _T("%sRecycled"), static_cast<LPCWSTR>(ar[i].m_Path)); hFindData = FindFirstFile (szPath, &findData); if (INVALID_HANDLE_VALUE != hFindData) { ppidl = SHSimpleIDListFromPath (szPath); stPIDL.pidl = ppidl; m_pidlDrives[iPos] = ppidl; m_hNotifyDrives[iPos] = SHChangeNotifyRegister (m_hWnd, SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS, SHCNE_RMDIR | SHCNE_RENAMEFOLDER | SHCNE_DELETE | SHCNE_RENAMEITEM, WM_SHELLNOTIFYRBINDIR, 1, &stPIDL); iPos ++; FindClose (hFindData); } } } } }