forked from 84634E1A607A/Desktop-Tidiness-Helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDesktop Tidiness Helper.h
130 lines (97 loc) · 2.56 KB
/
Desktop Tidiness Helper.h
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
#pragma once
#include "framework.h"
// Structs
struct FILEINFO
{
TCHAR szFullPath[MAX_PATH];
int nNameIndex;
DWORD dwSize = 0;
inline const TCHAR* Name() const
{
return &(szFullPath[nNameIndex]);
}
FILEINFO(LPTSTR _szPath, DWORD _dwSize) :dwSize(_dwSize)
{
lstrcpy(szFullPath, _szPath);
InitName();
}
FILEINFO() :szFullPath(TEXT("")), nNameIndex(0), dwSize(0){}
bool operator< (const FILEINFO FileInfo) const
{
return lstrcmp(Name(), FileInfo.Name()) < 0;
}
bool operator== (const FILEINFO FileInfo) const
{
return (!lstrcmp(Name(), FileInfo.Name())) && dwSize == FileInfo.dwSize;
}
FILEINFO operator=(const FILEINFO FileInfo)
{
lstrcpy(szFullPath, FileInfo.szFullPath);
nNameIndex = FileInfo.nNameIndex;
dwSize = FileInfo.dwSize;
return *this;
}
void InitName()
{
int nLength = static_cast<int>(lstrlen(szFullPath)), nIndex;
if (nLength == 0)
{
nNameIndex = 0;
return;
}
for (nIndex = nLength - 1; szFullPath[nIndex] != TEXT('\\'); nIndex--)
{
if (nIndex < 0) break;
}
nNameIndex = nIndex + 1;
}
};
struct DRIVE
{
DWORD dwUUID = 0;
TCHAR szPath[MAX_PATH] = TEXT("");
TCHAR szLetter[3] = TEXT("");
vector<FILEINFO> vFiles;
volatile bool bIsAvailable = false;
DRIVE* pNext = NULL;
} driveHead, curDriveHead;
struct EXEMPT
{
TCHAR szName[MAX_PATH] = TEXT("");
EXEMPT* pNext = NULL;
} exemptHead;
void WriteLog();
const LPWSTR CurTime();
void MoveQueue();
void Trim(LPTSTR szString);
bool CheckSingleInstance();
template<typename _Ptr>
void DeleteList(_Ptr pListHead)
{
_Ptr pThis = pListHead->pNext;
while (pThis)
{
pListHead->pNext = pThis->pNext;
delete pThis;
pThis = pListHead->pNext;
}
}
void LoadExempt(LPTSTR szExempt);
void ReadConfig();
DWORD WINAPI Monitor(LPVOID lpParameter);
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow);
void ExitInstance();
vector<FILEINFO> IndexerWorker(LPTSTR szDir, DRIVE* pDrive);
DWORD WINAPI Indexer(LPVOID lpParameter);
DWORD WINAPI ConfigEditHandler(LPVOID lpParameter);
DWORD WINAPI CopyUDisk(LPVOID pDrive);
void DeviceArrivalHandler(int nVolumeIndex);
DWORD WINAPI FindFileDlg(LPVOID lpUnused);
INT_PTR CALLBACK FindDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
bool ProcessRegex(LPCTSTR szRegex, LPCTSTR szTarget);
vector<wstring> FindInUDisk(LPCTSTR szFileName);
void CopyToClipBoard(LPCTSTR szFileName);
void OpenIn(LPCTSTR szExeName, LPCTSTR szCmdLine);
void GetFileInfo(LPCTSTR szFileName, LPTSTR szInfo);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
ATOM MyRegisterClass(HINSTANCE hInstance);