Welcome to mirror list, hosted at ThFree Co, Russian Federation.

windirstat.h « windirstat - github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 499b98c61b1b7acaf3bfd25364474f5fecc64cd4 (plain)
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
// windirstat.h - Main header for the windirstat application
//
// WinDirStat - Directory Statistics
// Copyright (C) 2003-2005 Bernhard Seifert
// Copyright (C) 2004-2017 WinDirStat Team (windirstat.net)
// Copyright (C) 2010 Chris Wimmer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

#ifndef __WINDIRSTAT_H_VER__
#define __WINDIRSTAT_H_VER__ 2017112219
#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
#pragma once
#endif /* Check for "#pragma once" support */

#include <Windows.h>
#include "resource.h"
#include "myimagelist.h"
#include "mountpoints.h"
#include "helpmap.h"
#include <common/tracer.h>

typedef CMap<CString, LPCTSTR, COLORREF, COLORREF> CExtensionColorMap;  // ".bmp" -> color

class CMainFrame;
class CDirstatApp;

// Frequently used "globals"
CMainFrame *GetMainFrame();
CDirstatApp *GetWDSApp();
CMyImageList* GetMyImageList();

// Other application related globals
CString GetAuthorEmail();
CString GetWinDirStatHomepage();

#if SUPPORT_ELEVATION
#   define WINDIRSTAT_EVENT_NAME_FMT L"WinDirStat_ElevationEvent_{72D223E3-1539-461D-980E-0863FE480E84}.%s.%s"
#endif // SUPPORT_ELEVATION

//
// CDirstatApp. The MFC application object.
// Knows about RAM Usage, Mount points, Help files and the CMyImageList.
//
class CDirstatApp : public CWinApp
{
    typedef CWinApp Inherited;
public:
    CDirstatApp();
    ~CDirstatApp();

    virtual BOOL InitInstance();
    virtual int ExitInstance();

    LANGID GetBuiltInLanguage();
    LANGID GetLangid();             // Language as selected in PageGeneral
    LANGID GetEffectiveLangid();    // Language to be used for date/time and number formatting

    void ReReadMountPoints();
    bool IsVolumeMountPoint(CString path);
    bool IsFolderJunction(CString path);

    COLORREF AltColor();                    // Coloring of compressed items
    COLORREF AltEncryptionColor();          // Coloring of encrypted items

    CString GetCurrentProcessMemoryInfo();
    CMyImageList* GetMyImageList();
    void UpdateRamUsage();

    void PeriodicalUpdateRamUsage();

    void DoContextHelp(DWORD topic);

    void GetAvailableResourceDllLangids(CArray<LANGID, LANGID>& arr);

    void RestartApplication();

    static bool getDiskFreeSpace(LPCTSTR pszRootPath, ULONGLONG& total, ULONGLONG& unused);

protected:
    CString FindResourceDllPathByLangid(LANGID& langid);
    CString FindHelpfilePathByLangid(LANGID langid);
    CString FindAuxiliaryFileByLangid(LPCTSTR prefix, LPCTSTR suffix, LANGID& langid, bool checkResource);
    bool ScanResourceDllName(LPCTSTR name, LANGID& langid);
    bool ScanAuxiliaryFileName(LPCTSTR prefix, LPCTSTR suffix, LPCTSTR name, LANGID& langid);
#   ifdef _DEBUG
    void TestScanResourceDllName();
#   endif
    bool IsCorrectResourceDll(LPCTSTR path);

    bool UpdateMemoryInfo();

    // Get the alternative color from Explorer configuration
    COLORREF GetAlternativeColor(COLORREF clrDefault, LPCTSTR which);

    virtual BOOL OnIdle(LONG lCount);       // This is, where scanning is done.
#if SUPPORT_ELEVATION
    static BOOL IsUACEnabled();
#endif // SUPPORT_ELEVATION

    CSingleDocTemplate* m_pDocTemplate;     // MFC voodoo.

    LANGID m_langid;                        // Language we are running
    CReparsePoints m_mountPoints;           // Mount point information
    CMyImageList m_myImageList;             // Our central image list
    ULONGLONG m_workingSet;                 // Current working set (RAM usage)
    ULONGLONG m_pageFaults;                 // Page faults so far (unused)
    ULONGLONG m_lastPeriodicalRamUsageUpdate; // Tick count
    COLORREF m_altColor;                    // Coloring of compressed items
    COLORREF m_altEncryptionColor;          // Coloring of encrypted items
#if SUPPORT_ELEVATION
    HANDLE m_ElevationEvent;
    CString m_ElevationEventName;
#endif // SUPPORT_ELEVATION
#ifdef VTRACE_TO_CONSOLE
    CAutoPtr<CWDSTracerConsole> m_vtrace_console;
#endif // VTRACE_TO_CONSOLE

    DECLARE_MESSAGE_MAP()
    afx_msg void OnFileOpen();
#if SUPPORT_ELEVATION
    afx_msg void OnRunElevated();
    afx_msg void OnUpdateRunElevated(CCmdUI *pCmdUI);
#endif // SUPPORT_ELEVATION
    afx_msg void OnHelpManual();
    afx_msg void OnAppAbout();
};

#endif /* __WINDIRSTAT_H_VER__ */