Fixed issue #1571: Warn author not set when editing notes
[TortoiseGit.git] / src / TortoiseShell / ShellCache.h
blobddf55d871e159550e3a7a791018ac326dd3b4399
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 #include "registry.h"
21 #include "Globals.h"
22 #include "GitAdminDir.h"
23 #include "Git.h"
25 #define REGISTRYTIMEOUT 2000
26 #define EXCLUDELISTTIMEOUT 5000
27 #define ADMINDIRTIMEOUT 10000
28 #define DRIVETYPETIMEOUT 300000 // 5 min
29 #define NUMBERFMTTIMEOUT 300000
30 #define MENUTIMEOUT 100
32 #define DEFAULTMENUTOPENTRIES MENUSYNC|MENUCREATEREPOS|MENUCLONE|MENUCOMMIT
33 #define DEFAULTMENUEXTENTRIES MENUSVNIGNORE|MENUREFLOG|MENUREFBROWSE|MENUSTASHAPPLY|MENUSUBSYNC
35 typedef CComCritSecLock<CComCriticalSection> Locker;
37 /**
38 * \ingroup TortoiseShell
39 * Helper class which caches access to the registry. Also provides helper methods
40 * for checks against the settings stored in the registry.
42 class ShellCache
44 public:
45 enum CacheType
47 none,
48 exe,
49 dll,
50 dllFull,// same as dll except it uses commandline git tool with all status modes supported
52 ShellCache()
54 cachetype = CRegStdDWORD(_T("Software\\TortoiseGit\\CacheType"), GetSystemMetrics(SM_REMOTESESSION) ? dll : exe);
55 showrecursive = CRegStdDWORD(_T("Software\\TortoiseGit\\RecursiveOverlay"), TRUE);
56 folderoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\FolderOverlay"), TRUE);
57 driveremote = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemote"));
58 drivefixed = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFixed"), TRUE);
59 drivecdrom = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskCDROM"));
60 driveremove = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemovable"));
61 drivefloppy = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFloppy"));
62 driveram = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRAM"));
63 driveunknown = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskUnknown"));
64 excludelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayExcludeList"));
65 includelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayIncludeList"));
66 simplecontext = CRegStdDWORD(_T("Software\\TortoiseGit\\SimpleContext"), FALSE);
67 unversionedasmodified = CRegStdDWORD(_T("Software\\TortoiseGit\\UnversionedAsModified"), FALSE);
68 hidemenusforunversioneditems = CRegStdDWORD(_T("Software\\TortoiseGit\\HideMenusForUnversionedItems"), FALSE);
69 showunversionedoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowUnversionedOverlay"), TRUE);
70 showignoredoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowIgnoredOverlay"), TRUE);
71 getlocktop = CRegStdDWORD(_T("Software\\TortoiseGit\\GetLockTop"), TRUE);
72 excludedasnormal = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowExcludedAsNormal"), TRUE);
73 cachetypeticker = GetTickCount();
74 recursiveticker = cachetypeticker;
75 folderoverlayticker = cachetypeticker;
76 driveticker = cachetypeticker;
77 drivetypeticker = cachetypeticker;
78 langticker = cachetypeticker;
79 columnrevformatticker = cachetypeticker;
80 excludelistticker = cachetypeticker;
81 includelistticker = cachetypeticker;
82 simplecontextticker = cachetypeticker;
83 unversionedasmodifiedticker = cachetypeticker;
84 showunversionedoverlayticker = cachetypeticker;
85 showignoredoverlayticker = cachetypeticker;
86 admindirticker = cachetypeticker;
87 columnseverywhereticker = cachetypeticker;
88 getlocktopticker = cachetypeticker;
89 excludedasnormalticker = cachetypeticker;
90 hidemenusforunversioneditemsticker = cachetypeticker;
91 excontextticker = cachetypeticker;
93 unsigned __int64 entries = (DEFAULTMENUTOPENTRIES);
94 menulayoutlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntries"), entries&0xFFFFFFFF);
95 menulayouthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntrieshigh"), entries>>32);
97 unsigned __int64 ext = (DEFAULTMENUEXTENTRIES);
98 menuextlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesLow"), ext&0xFFFFFFFF );
99 menuexthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesHigh"), ext>>32 );
101 menumasklow_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0, FALSE, HKEY_LOCAL_MACHINE);
102 menumaskhigh_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0, FALSE, HKEY_LOCAL_MACHINE);
103 menumasklow_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0);
104 menumaskhigh_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0);
105 langid = CRegStdDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
106 blockstatus = CRegStdDWORD(_T("Software\\TortoiseGit\\BlockStatus"), 0);
107 columnseverywhere = CRegStdDWORD(_T("Software\\TortoiseGit\\ColumnsEveryWhere"), FALSE);
108 for (int i=0; i<27; i++)
110 drivetypecache[i] = (UINT)-1;
112 // A: and B: are floppy disks
113 drivetypecache[0] = DRIVE_REMOVABLE;
114 drivetypecache[1] = DRIVE_REMOVABLE;
115 TCHAR szBuffer[5];
116 columnrevformatticker = GetTickCount();
117 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
118 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
119 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
120 columnrevformat.lpDecimalSep = szDecSep;
121 columnrevformat.lpThousandSep = szThousandsSep;
122 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
123 columnrevformat.Grouping = _ttoi(szBuffer);
124 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
125 columnrevformat.NegativeOrder = _ttoi(szBuffer);
126 sAdminDirCacheKey.reserve(MAX_PATH); // MAX_PATH as buffer reservation ok.
127 nocontextpaths = CRegStdString(_T("Software\\TortoiseGit\\NoContextPaths"), _T(""));
128 m_critSec.Init();
130 void ForceRefresh()
132 cachetype.read();
133 showrecursive.read();
134 folderoverlay.read();
135 driveremote.read();
136 drivefixed.read();
137 drivecdrom.read();
138 driveremove.read();
139 drivefloppy.read();
140 driveram.read();
141 driveunknown.read();
142 excludelist.read();
143 includelist.read();
144 simplecontext.read();
145 unversionedasmodified.read();
146 showunversionedoverlay.read();
147 showignoredoverlay.read();
148 excludedasnormal.read();
149 hidemenusforunversioneditems.read();
150 menulayoutlow.read();
151 menulayouthigh.read();
152 langid.read();
153 blockstatus.read();
154 columnseverywhere.read();
155 getlocktop.read();
156 menumasklow_lm.read();
157 menumaskhigh_lm.read();
158 menumasklow_cu.read();
159 menumaskhigh_cu.read();
160 nocontextpaths.read();
162 CacheType GetCacheType()
164 if ((GetTickCount() - REGISTRYTIMEOUT) > cachetypeticker)
166 cachetypeticker = GetTickCount();
167 cachetype.read();
169 return CacheType(DWORD((cachetype)));
171 DWORD BlockStatus()
173 if ((GetTickCount() - REGISTRYTIMEOUT) > blockstatusticker)
175 blockstatusticker = GetTickCount();
176 blockstatus.read();
178 return (blockstatus);
180 unsigned __int64 GetMenuLayout()
182 if ((GetTickCount() - REGISTRYTIMEOUT) > layoutticker)
184 layoutticker = GetTickCount();
185 menulayoutlow.read();
186 menulayouthigh.read();
188 unsigned __int64 temp = unsigned __int64(DWORD(menulayouthigh))<<32;
189 temp |= unsigned __int64(DWORD(menulayoutlow));
190 return temp;
193 unsigned __int64 GetMenuExt()
195 if ((GetTickCount() - REGISTRYTIMEOUT) > exticker)
197 exticker = GetTickCount();
198 menuextlow.read();
199 menuexthigh.read();
201 unsigned __int64 temp = unsigned __int64(DWORD(menuexthigh))<<32;
202 temp |= unsigned __int64(DWORD(menuextlow));
203 return temp;
206 unsigned __int64 GetMenuMask()
208 if ((GetTickCount() - REGISTRYTIMEOUT) > menumaskticker)
210 menumaskticker = GetTickCount();
211 menumasklow_lm.read();
212 menumaskhigh_lm.read();
213 menumasklow_cu.read();
214 menumaskhigh_cu.read();
216 DWORD low = (DWORD)menumasklow_lm | (DWORD)menumasklow_cu;
217 DWORD high = (DWORD)menumaskhigh_lm | (DWORD)menumaskhigh_cu;
218 unsigned __int64 temp = unsigned __int64(high)<<32;
219 temp |= unsigned __int64(low);
220 return temp;
222 BOOL IsRecursive()
224 if ((GetTickCount() - REGISTRYTIMEOUT)>recursiveticker)
226 recursiveticker = GetTickCount();
227 showrecursive.read();
229 return (showrecursive);
231 BOOL IsFolderOverlay()
233 if ((GetTickCount() - REGISTRYTIMEOUT)>folderoverlayticker)
235 folderoverlayticker = GetTickCount();
236 folderoverlay.read();
238 return (folderoverlay);
240 BOOL IsSimpleContext()
242 if ((GetTickCount() - REGISTRYTIMEOUT)>simplecontextticker)
244 simplecontextticker = GetTickCount();
245 simplecontext.read();
247 return (simplecontext!=0);
249 BOOL IsUnversionedAsModified()
251 if ((GetTickCount() - REGISTRYTIMEOUT)>unversionedasmodifiedticker)
253 unversionedasmodifiedticker = GetTickCount();
254 unversionedasmodified.read();
256 return (unversionedasmodified);
258 BOOL ShowUnversionedOverlay()
260 if ((GetTickCount() - REGISTRYTIMEOUT)>showunversionedoverlayticker)
262 showunversionedoverlayticker = GetTickCount();
263 showunversionedoverlay.read();
265 return (showunversionedoverlay);
267 BOOL ShowIgnoredOverlay()
269 if ((GetTickCount() - REGISTRYTIMEOUT)>showignoredoverlayticker)
271 showignoredoverlayticker = GetTickCount();
272 showignoredoverlay.read();
274 return (showignoredoverlay);
276 BOOL IsGetLockTop()
278 if ((GetTickCount() - REGISTRYTIMEOUT)>getlocktopticker)
280 getlocktopticker = GetTickCount();
281 getlocktop.read();
283 return (getlocktop);
285 BOOL ShowExcludedAsNormal()
287 if ((GetTickCount() - REGISTRYTIMEOUT)>excludedasnormalticker)
289 excludedasnormalticker = GetTickCount();
290 excludedasnormal.read();
292 return (excludedasnormal);
294 BOOL ShellCache::HideMenusForUnversionedItems()
296 if ((GetTickCount() - hidemenusforunversioneditemsticker)>REGISTRYTIMEOUT)
298 hidemenusforunversioneditemsticker = GetTickCount();
299 hidemenusforunversioneditems.read();
301 return (hidemenusforunversioneditems);
303 BOOL IsRemote()
305 DriveValid();
306 return (driveremote);
308 BOOL IsFixed()
310 DriveValid();
311 return (drivefixed);
313 BOOL IsCDRom()
315 DriveValid();
316 return (drivecdrom);
318 BOOL IsRemovable()
320 DriveValid();
321 return (driveremove);
323 BOOL IsRAM()
325 DriveValid();
326 return (driveram);
328 BOOL IsUnknown()
330 DriveValid();
331 return (driveunknown);
333 BOOL IsContextPathAllowed(LPCTSTR path)
335 Locker lock(m_critSec);
336 ExcludeContextValid();
337 for (std::vector<stdstring>::iterator I = excontextvector.begin(); I != excontextvector.end(); ++I)
339 if (I->empty())
340 continue;
341 if (I->size() && I->at(I->size()-1)=='*')
343 stdstring str = I->substr(0, I->size()-1);
344 if (_tcsnicmp(str.c_str(), path, str.size())==0)
345 return FALSE;
347 else if (_tcsicmp(I->c_str(), path)==0)
348 return FALSE;
350 return TRUE;
352 BOOL IsPathAllowed(LPCTSTR path)
354 Locker lock(m_critSec);
355 IncludeListValid();
356 for (std::vector<stdstring>::iterator I = invector.begin(); I != invector.end(); ++I)
358 if (I->empty())
359 continue;
360 if (I->at(I->size()-1)=='*')
362 stdstring str = I->substr(0, I->size()-1);
363 if (_tcsnicmp(str.c_str(), path, str.size())==0)
364 return TRUE;
365 if (!str.empty() && (str.at(str.size()-1) == '\\') && (_tcsnicmp(str.c_str(), path, str.size()-1)==0))
366 return TRUE;
368 else if (_tcsicmp(I->c_str(), path)==0)
369 return TRUE;
370 else if ((I->at(I->size()-1) == '\\') &&
371 ((_tcsnicmp(I->c_str(), path, I->size())==0) || (_tcsicmp(I->c_str(), path)==0)) )
372 return TRUE;
375 UINT drivetype = 0;
376 int drivenumber = PathGetDriveNumber(path);
377 if ((drivenumber >=0)&&(drivenumber < 25))
379 drivetype = drivetypecache[drivenumber];
380 if ((drivetype == -1)||((GetTickCount() - DRIVETYPETIMEOUT)>drivetypeticker))
382 if ((drivenumber == 0)||(drivenumber == 1))
383 drivetypecache[drivenumber] = DRIVE_REMOVABLE;
384 else
386 drivetypeticker = GetTickCount();
387 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathStripToRoot works with partial paths too.
388 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
389 PathStripToRoot(pathbuf);
390 PathAddBackslash(pathbuf);
391 ATLTRACE2(_T("GetDriveType for %s, Drive %d\n"), pathbuf, drivenumber);
392 drivetype = GetDriveType(pathbuf);
393 drivetypecache[drivenumber] = drivetype;
397 else
399 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathIsUNCServer works with partial paths too.
400 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
401 if (PathIsUNCServer(pathbuf))
402 drivetype = DRIVE_REMOTE;
403 else
405 PathStripToRoot(pathbuf);
406 PathAddBackslash(pathbuf);
407 if (_tcsncmp(pathbuf, drivetypepathcache, MAX_PATH-1)==0) // MAX_PATH ok.
408 drivetype = drivetypecache[26];
409 else
411 ATLTRACE2(_T("GetDriveType for %s\n"), pathbuf);
412 drivetype = GetDriveType(pathbuf);
413 drivetypecache[26] = drivetype;
414 _tcsncpy_s(drivetypepathcache, MAX_PATH, pathbuf, MAX_PATH); // MAX_PATH ok.
418 if ((drivetype == DRIVE_REMOVABLE)&&(!IsRemovable()))
419 return FALSE;
420 if ((drivetype == DRIVE_REMOVABLE)&&(drivefloppy == 0)&&((drivenumber==0)||(drivenumber==1)))
421 return FALSE;
422 if ((drivetype == DRIVE_FIXED)&&(!IsFixed()))
423 return FALSE;
424 if (((drivetype == DRIVE_REMOTE)||(drivetype == DRIVE_NO_ROOT_DIR))&&(!IsRemote()))
425 return FALSE;
426 if ((drivetype == DRIVE_CDROM)&&(!IsCDRom()))
427 return FALSE;
428 if ((drivetype == DRIVE_RAMDISK)&&(!IsRAM()))
429 return FALSE;
430 if ((drivetype == DRIVE_UNKNOWN)&&(IsUnknown()))
431 return FALSE;
433 ExcludeListValid();
434 for (std::vector<stdstring>::iterator I = exvector.begin(); I != exvector.end(); ++I)
436 if (I->empty())
437 continue;
438 if (I->size() && I->at(I->size()-1)=='*')
440 stdstring str = I->substr(0, I->size()-1);
441 if (_tcsnicmp(str.c_str(), path, str.size())==0)
442 return FALSE;
444 else if (_tcsicmp(I->c_str(), path)==0)
445 return FALSE;
447 return TRUE;
449 DWORD GetLangID()
451 if ((GetTickCount() - REGISTRYTIMEOUT) > langticker)
453 langticker = GetTickCount();
454 langid.read();
456 return (langid);
458 NUMBERFMT * GetNumberFmt()
460 if ((GetTickCount() - NUMBERFMTTIMEOUT) > columnrevformatticker)
462 TCHAR szBuffer[5];
463 columnrevformatticker = GetTickCount();
464 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
465 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
466 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
467 columnrevformat.lpDecimalSep = szDecSep;
468 columnrevformat.lpThousandSep = szThousandsSep;
469 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
470 columnrevformat.Grouping = _ttoi(szBuffer);
471 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
472 columnrevformat.NegativeOrder = _ttoi(szBuffer);
474 return &columnrevformat;
476 BOOL HasGITAdminDir(LPCTSTR path, BOOL bIsDir, CString *ProjectTopDir = NULL)
478 size_t len = _tcslen(path);
479 TCHAR * buf = new TCHAR[len+1];
480 _tcscpy_s(buf, len+1, path);
481 if (! bIsDir)
483 TCHAR * ptr = _tcsrchr(buf, '\\');
484 if (ptr != 0)
486 *ptr = 0;
489 if ((GetTickCount() - ADMINDIRTIMEOUT) < admindirticker)
491 std::map<stdstring, AdminDir_s>::iterator iter;
492 sAdminDirCacheKey.assign(buf);
493 if ((iter = admindircache.find(sAdminDirCacheKey)) != admindircache.end())
495 delete [] buf;
496 if (ProjectTopDir && iter->second.bHasAdminDir)
497 *ProjectTopDir = iter->second.sProjectRoot.c_str();
498 return iter->second.bHasAdminDir;
501 CString sProjectRoot;
502 BOOL hasAdminDir = g_GitAdminDir.HasAdminDir(buf, true, &sProjectRoot);
503 admindirticker = GetTickCount();
504 Locker lock(m_critSec);
506 AdminDir_s &ad = admindircache[buf];
507 ad.bHasAdminDir = hasAdminDir;
508 if (hasAdminDir)
510 ad.sProjectRoot.assign(sProjectRoot);
512 if (ProjectTopDir)
513 *ProjectTopDir = sProjectRoot;
516 delete [] buf;
517 return hasAdminDir;
519 bool IsColumnsEveryWhere()
521 if ((GetTickCount() - REGISTRYTIMEOUT) > columnseverywhereticker)
523 columnseverywhereticker = GetTickCount();
524 columnseverywhere.read();
526 return !!(DWORD)columnseverywhere;
528 private:
529 void DriveValid()
531 if ((GetTickCount() - REGISTRYTIMEOUT)>driveticker)
533 driveticker = GetTickCount();
534 driveremote.read();
535 drivefixed.read();
536 drivecdrom.read();
537 driveremove.read();
538 drivefloppy.read();
541 void ExcludeContextValid()
543 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excontextticker)
545 Locker lock(m_critSec);
546 excontextticker = GetTickCount();
547 nocontextpaths.read();
548 if (excludecontextstr.compare((stdstring)nocontextpaths)==0)
549 return;
550 excludecontextstr = (stdstring)nocontextpaths;
551 excontextvector.clear();
552 size_t pos = 0, pos_ant = 0;
553 pos = excludecontextstr.find(_T("\n"), pos_ant);
554 while (pos != stdstring::npos)
556 stdstring token = excludecontextstr.substr(pos_ant, pos-pos_ant);
557 excontextvector.push_back(token);
558 pos_ant = pos+1;
559 pos = excludecontextstr.find(_T("\n"), pos_ant);
561 if (!excludecontextstr.empty())
563 excontextvector.push_back(excludecontextstr.substr(pos_ant, excludecontextstr.size()-1));
565 excludecontextstr = (stdstring)nocontextpaths;
568 void ExcludeListValid()
570 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excludelistticker)
572 Locker lock(m_critSec);
573 excludelistticker = GetTickCount();
574 excludelist.read();
575 if (excludeliststr.compare((stdstring)excludelist)==0)
576 return;
577 excludeliststr = (stdstring)excludelist;
578 exvector.clear();
579 size_t pos = 0, pos_ant = 0;
580 pos = excludeliststr.find(_T("\n"), pos_ant);
581 while (pos != stdstring::npos)
583 stdstring token = excludeliststr.substr(pos_ant, pos-pos_ant);
584 exvector.push_back(token);
585 pos_ant = pos+1;
586 pos = excludeliststr.find(_T("\n"), pos_ant);
588 if (!excludeliststr.empty())
590 exvector.push_back(excludeliststr.substr(pos_ant, excludeliststr.size()-1));
592 excludeliststr = (stdstring)excludelist;
595 void IncludeListValid()
597 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>includelistticker)
599 Locker lock(m_critSec);
600 includelistticker = GetTickCount();
601 includelist.read();
602 if (includeliststr.compare((stdstring)includelist)==0)
603 return;
604 includeliststr = (stdstring)includelist;
605 invector.clear();
606 size_t pos = 0, pos_ant = 0;
607 pos = includeliststr.find(_T("\n"), pos_ant);
608 while (pos != stdstring::npos)
610 stdstring token = includeliststr.substr(pos_ant, pos-pos_ant);
611 invector.push_back(token);
612 pos_ant = pos+1;
613 pos = includeliststr.find(_T("\n"), pos_ant);
615 if (!includeliststr.empty())
617 invector.push_back(includeliststr.substr(pos_ant, includeliststr.size()-1));
619 includeliststr = (stdstring)includelist;
623 struct AdminDir_s
625 BOOL bHasAdminDir;
626 stdstring sProjectRoot;
628 public:
629 CRegStdDWORD cachetype;
630 CRegStdDWORD blockstatus;
631 CRegStdDWORD langid;
632 CRegStdDWORD showrecursive;
633 CRegStdDWORD folderoverlay;
634 CRegStdDWORD getlocktop;
635 CRegStdDWORD driveremote;
636 CRegStdDWORD drivefixed;
637 CRegStdDWORD drivecdrom;
638 CRegStdDWORD driveremove;
639 CRegStdDWORD drivefloppy;
640 CRegStdDWORD driveram;
641 CRegStdDWORD driveunknown;
642 CRegStdDWORD menulayoutlow; /* Fist level mask */
643 CRegStdDWORD menulayouthigh;
644 CRegStdDWORD menuextlow; /* ext menu mask */
645 CRegStdDWORD menuexthigh;
646 CRegStdDWORD simplecontext;
647 CRegStdDWORD menumasklow_lm;
648 CRegStdDWORD menumaskhigh_lm;
649 CRegStdDWORD menumasklow_cu;
650 CRegStdDWORD menumaskhigh_cu;
651 CRegStdDWORD unversionedasmodified;
652 CRegStdDWORD showunversionedoverlay;
653 CRegStdDWORD showignoredoverlay;
654 CRegStdDWORD excludedasnormal;
655 CRegStdString excludelist;
656 CRegStdDWORD hidemenusforunversioneditems;
657 CRegStdDWORD columnseverywhere;
658 stdstring excludeliststr;
659 std::vector<stdstring> exvector;
660 CRegStdString includelist;
661 stdstring includeliststr;
662 std::vector<stdstring> invector;
663 DWORD cachetypeticker;
664 DWORD recursiveticker;
665 DWORD folderoverlayticker;
666 DWORD getlocktopticker;
667 DWORD driveticker;
668 DWORD drivetypeticker;
669 DWORD layoutticker;
670 DWORD exticker;
671 DWORD menumaskticker;
672 DWORD langticker;
673 DWORD blockstatusticker;
674 DWORD columnrevformatticker;
675 DWORD excludelistticker;
676 DWORD includelistticker;
677 DWORD simplecontextticker;
678 DWORD unversionedasmodifiedticker;
679 DWORD showunversionedoverlayticker;
680 DWORD showignoredoverlayticker;
681 DWORD excludedasnormalticker;
682 DWORD hidemenusforunversioneditemsticker;
683 DWORD columnseverywhereticker;
684 UINT drivetypecache[27];
685 TCHAR drivetypepathcache[MAX_PATH]; // MAX_PATH ok.
686 NUMBERFMT columnrevformat;
687 TCHAR szDecSep[5];
688 TCHAR szThousandsSep[5];
689 std::map<stdstring, AdminDir_s> admindircache;
690 stdstring sAdminDirCacheKey;
691 CRegStdString nocontextpaths;
692 stdstring excludecontextstr;
693 std::vector<stdstring> excontextvector;
694 DWORD excontextticker;
695 DWORD admindirticker;
696 CComCriticalSection m_critSec;