source: filezilla/trunk/fuentes/src/interface/volume_enumerator.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 1.8 KB
Line 
1#ifndef __VOLUME_ENUMERATOR_H__
2#define __VOLUME_ENUMERATOR_H__
3
4#include <list>
5
6// Class to enumerate volume labels of volumes assigned
7// a drive letter under MSW.
8// Also gets the full UNC path for drive-mapped network
9// shares.
10
11// Windows has this very exotic concept of drive letters (nowadays called
12// volumes), even if the drive isn't mounted (in the sense of no media
13// inserted).
14// This can result in a long seek time if trying to enumerate the volume
15// labels, especially with legacy floppy drives (why are people still using
16// them?). Worse, even if no floppy drive is installed the BIOS can report
17// one to exist and Windows dutifully displays A:
18
19// Since the local directory tree including the drives is populated at
20// startup, use a background thread to obtain the labels.
21#ifdef __WXMSW__
22
23DECLARE_EVENT_TYPE(fzEVT_VOLUMEENUMERATED, -1)
24DECLARE_EVENT_TYPE(fzEVT_VOLUMESENUMERATED, -1)
25
26class CVolumeDescriptionEnumeratorThread final : protected wxThread
27{
28public:
29        CVolumeDescriptionEnumeratorThread(wxEvtHandler* pEvtHandler);
30        virtual ~CVolumeDescriptionEnumeratorThread();
31
32        bool Failed() const { return m_failure; }
33
34        struct t_VolumeInfo
35        {
36                wxString volume;
37                wxString volumeName;
38        };
39
40        std::list<t_VolumeInfo> GetVolumes();
41
42        static std::list<wxString> GetDrives();
43
44        static long GetDrivesToHide();
45        static bool IsHidden(wxChar const* drive, long noDrives);
46
47protected:
48        bool GetDriveLabels();
49        void ProcessDrive(wxString const& drive);
50        bool GetDriveLabel(wxString const& drive);
51        virtual ExitCode Entry();
52
53        wxEvtHandler* m_pEvtHandler;
54
55        bool m_failure;
56        bool m_stop;
57        bool m_running;
58
59        struct t_VolumeInfoInternal
60        {
61                wxChar* pVolume;
62                wxChar* pVolumeName;
63        };
64
65        std::list<t_VolumeInfoInternal> m_volumeInfo;
66
67        mutex sync_;
68};
69
70#endif //__WXMSW__
71
72#endif //__VOLUME_ENUMERATOR_H__
Note: See TracBrowser for help on using the repository browser.