Estimate the required stack size for getting latest change using libgit2
[TortoiseGit.git] / src / TortoiseShell / ShellCache.h
blobb4f544c1d7396ab56c8a6df565d94bbfede817bb
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012 - TortoiseGit
4 // Copyright (C) 2003-2008 - Stefan Kueng
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
21 #include "registry.h"
22 #include "Globals.h"
23 #include "GitAdminDir.h"
24 #include "Git.h"
26 #define REGISTRYTIMEOUT 2000
27 #define EXCLUDELISTTIMEOUT 5000
28 #define ADMINDIRTIMEOUT 10000
29 #define DRIVETYPETIMEOUT 300000 // 5 min
30 #define NUMBERFMTTIMEOUT 300000
31 #define MENUTIMEOUT 100
33 #define DEFAULTMENUTOPENTRIES MENUSYNC|MENUCREATEREPOS|MENUCLONE|MENUCOMMIT
34 #define DEFAULTMENUEXTENTRIES MENUSVNIGNORE|MENUREFLOG|MENUREFBROWSE|MENUSTASHAPPLY|MENUSUBSYNC
36 typedef CComCritSecLock<CComCriticalSection> Locker;
38 /**
39 * \ingroup TortoiseShell
40 * Helper class which caches access to the registry. Also provides helper methods
41 * for checks against the settings stored in the registry.
43 class ShellCache
45 public:
46 enum CacheType
48 none,
49 exe,
50 dll,
51 dllFull,// same as dll except it uses commandline git tool with all status modes supported
53 ShellCache()
55 cachetype = CRegStdDWORD(_T("Software\\TortoiseGit\\CacheType"), GetSystemMetrics(SM_REMOTESESSION) ? dll : exe);
56 showrecursive = CRegStdDWORD(_T("Software\\TortoiseGit\\RecursiveOverlay"), TRUE);
57 folderoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\FolderOverlay"), TRUE);
58 driveremote = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemote"));
59 drivefixed = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFixed"), TRUE);
60 drivecdrom = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskCDROM"));
61 driveremove = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemovable"));
62 drivefloppy = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFloppy"));
63 driveram = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRAM"));
64 driveunknown = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskUnknown"));
65 excludelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayExcludeList"));
66 includelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayIncludeList"));
67 simplecontext = CRegStdDWORD(_T("Software\\TortoiseGit\\SimpleContext"), FALSE);
68 unversionedasmodified = CRegStdDWORD(_T("Software\\TortoiseGit\\UnversionedAsModified"), FALSE);
69 hidemenusforunversioneditems = CRegStdDWORD(_T("Software\\TortoiseGit\\HideMenusForUnversionedItems"), FALSE);
70 showunversionedoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowUnversionedOverlay"), TRUE);
71 showignoredoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowIgnoredOverlay"), TRUE);
72 getlocktop = CRegStdDWORD(_T("Software\\TortoiseGit\\GetLockTop"), TRUE);
73 excludedasnormal = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowExcludedAsNormal"), TRUE);
74 cachetypeticker = GetTickCount();
75 recursiveticker = cachetypeticker;
76 folderoverlayticker = cachetypeticker;
77 driveticker = cachetypeticker;
78 drivetypeticker = cachetypeticker;
79 langticker = cachetypeticker;
80 columnrevformatticker = cachetypeticker;
81 excludelistticker = cachetypeticker;
82 includelistticker = cachetypeticker;
83 simplecontextticker = cachetypeticker;
84 unversionedasmodifiedticker = cachetypeticker;
85 showunversionedoverlayticker = cachetypeticker;
86 showignoredoverlayticker = cachetypeticker;
87 admindirticker = cachetypeticker;
88 columnseverywhereticker = cachetypeticker;
89 getlocktopticker = cachetypeticker;
90 excludedasnormalticker = cachetypeticker;
91 hidemenusforunversioneditemsticker = cachetypeticker;
92 excontextticker = cachetypeticker;
94 unsigned __int64 entries = (DEFAULTMENUTOPENTRIES);
95 menulayoutlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntries"), entries&0xFFFFFFFF);
96 menulayouthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntrieshigh"), entries>>32);
98 unsigned __int64 ext = (DEFAULTMENUEXTENTRIES);
99 menuextlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesLow"), ext&0xFFFFFFFF );
100 menuexthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesHigh"), ext>>32 );
102 menumasklow_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0, FALSE, HKEY_LOCAL_MACHINE);
103 menumaskhigh_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0, FALSE, HKEY_LOCAL_MACHINE);
104 menumasklow_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0);
105 menumaskhigh_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0);
106 langid = CRegStdDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
107 blockstatus = CRegStdDWORD(_T("Software\\TortoiseGit\\BlockStatus"), 0);
108 columnseverywhere = CRegStdDWORD(_T("Software\\TortoiseGit\\ColumnsEveryWhere"), FALSE);
109 for (int i=0; i<27; i++)
111 drivetypecache[i] = (UINT)-1;
113 // A: and B: are floppy disks
114 drivetypecache[0] = DRIVE_REMOVABLE;
115 drivetypecache[1] = DRIVE_REMOVABLE;
116 TCHAR szBuffer[5];
117 columnrevformatticker = GetTickCount();
118 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
119 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
120 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
121 columnrevformat.lpDecimalSep = szDecSep;
122 columnrevformat.lpThousandSep = szThousandsSep;
123 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
124 columnrevformat.Grouping = _ttoi(szBuffer);
125 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
126 columnrevformat.NegativeOrder = _ttoi(szBuffer);
127 sAdminDirCacheKey.reserve(MAX_PATH); // MAX_PATH as buffer reservation ok.
128 nocontextpaths = CRegStdString(_T("Software\\TortoiseGit\\NoContextPaths"), _T(""));
129 m_critSec.Init();
131 void ForceRefresh()
133 cachetype.read();
134 showrecursive.read();
135 folderoverlay.read();
136 driveremote.read();
137 drivefixed.read();
138 drivecdrom.read();
139 driveremove.read();
140 drivefloppy.read();
141 driveram.read();
142 driveunknown.read();
143 excludelist.read();
144 includelist.read();
145 simplecontext.read();
146 unversionedasmodified.read();
147 showunversionedoverlay.read();
148 showignoredoverlay.read();
149 excludedasnormal.read();
150 hidemenusforunversioneditems.read();
151 menulayoutlow.read();
152 menulayouthigh.read();
153 langid.read();
154 blockstatus.read();
155 columnseverywhere.read();
156 getlocktop.read();
157 menumasklow_lm.read();
158 menumaskhigh_lm.read();
159 menumasklow_cu.read();
160 menumaskhigh_cu.read();
161 nocontextpaths.read();
163 CacheType GetCacheType()
165 if ((GetTickCount() - REGISTRYTIMEOUT) > cachetypeticker)
167 cachetypeticker = GetTickCount();
168 cachetype.read();
170 return CacheType(DWORD((cachetype)));
172 DWORD BlockStatus()
174 if ((GetTickCount() - REGISTRYTIMEOUT) > blockstatusticker)
176 blockstatusticker = GetTickCount();
177 blockstatus.read();
179 return (blockstatus);
181 unsigned __int64 GetMenuLayout()
183 if ((GetTickCount() - REGISTRYTIMEOUT) > layoutticker)
185 layoutticker = GetTickCount();
186 menulayoutlow.read();
187 menulayouthigh.read();
189 unsigned __int64 temp = unsigned __int64(DWORD(menulayouthigh))<<32;
190 temp |= unsigned __int64(DWORD(menulayoutlow));
191 return temp;
194 unsigned __int64 GetMenuExt()
196 if ((GetTickCount() - REGISTRYTIMEOUT) > exticker)
198 exticker = GetTickCount();
199 menuextlow.read();
200 menuexthigh.read();
202 unsigned __int64 temp = unsigned __int64(DWORD(menuexthigh))<<32;
203 temp |= unsigned __int64(DWORD(menuextlow));
204 return temp;
207 unsigned __int64 GetMenuMask()
209 if ((GetTickCount() - REGISTRYTIMEOUT) > menumaskticker)
211 menumaskticker = GetTickCount();
212 menumasklow_lm.read();
213 menumaskhigh_lm.read();
214 menumasklow_cu.read();
215 menumaskhigh_cu.read();
217 DWORD low = (DWORD)menumasklow_lm | (DWORD)menumasklow_cu;
218 DWORD high = (DWORD)menumaskhigh_lm | (DWORD)menumaskhigh_cu;
219 unsigned __int64 temp = unsigned __int64(high)<<32;
220 temp |= unsigned __int64(low);
221 return temp;
223 BOOL IsRecursive()
225 if ((GetTickCount() - REGISTRYTIMEOUT)>recursiveticker)
227 recursiveticker = GetTickCount();
228 showrecursive.read();
230 return (showrecursive);
232 BOOL IsFolderOverlay()
234 if ((GetTickCount() - REGISTRYTIMEOUT)>folderoverlayticker)
236 folderoverlayticker = GetTickCount();
237 folderoverlay.read();
239 return (folderoverlay);
241 BOOL IsSimpleContext()
243 if ((GetTickCount() - REGISTRYTIMEOUT)>simplecontextticker)
245 simplecontextticker = GetTickCount();
246 simplecontext.read();
248 return (simplecontext!=0);
250 BOOL IsUnversionedAsModified()
252 if ((GetTickCount() - REGISTRYTIMEOUT)>unversionedasmodifiedticker)
254 unversionedasmodifiedticker = GetTickCount();
255 unversionedasmodified.read();
257 return (unversionedasmodified);
259 BOOL ShowUnversionedOverlay()
261 if ((GetTickCount() - REGISTRYTIMEOUT)>showunversionedoverlayticker)
263 showunversionedoverlayticker = GetTickCount();
264 showunversionedoverlay.read();
266 return (showunversionedoverlay);
268 BOOL ShowIgnoredOverlay()
270 if ((GetTickCount() - REGISTRYTIMEOUT)>showignoredoverlayticker)
272 showignoredoverlayticker = GetTickCount();
273 showignoredoverlay.read();
275 return (showignoredoverlay);
277 BOOL IsGetLockTop()
279 if ((GetTickCount() - REGISTRYTIMEOUT)>getlocktopticker)
281 getlocktopticker = GetTickCount();
282 getlocktop.read();
284 return (getlocktop);
286 BOOL ShowExcludedAsNormal()
288 if ((GetTickCount() - REGISTRYTIMEOUT)>excludedasnormalticker)
290 excludedasnormalticker = GetTickCount();
291 excludedasnormal.read();
293 return (excludedasnormal);
295 BOOL HideMenusForUnversionedItems()
297 if ((GetTickCount() - hidemenusforunversioneditemsticker)>REGISTRYTIMEOUT)
299 hidemenusforunversioneditemsticker = GetTickCount();
300 hidemenusforunversioneditems.read();
302 return (hidemenusforunversioneditems);
304 BOOL IsRemote()
306 DriveValid();
307 return (driveremote);
309 BOOL IsFixed()
311 DriveValid();
312 return (drivefixed);
314 BOOL IsCDRom()
316 DriveValid();
317 return (drivecdrom);
319 BOOL IsRemovable()
321 DriveValid();
322 return (driveremove);
324 BOOL IsRAM()
326 DriveValid();
327 return (driveram);
329 BOOL IsUnknown()
331 DriveValid();
332 return (driveunknown);
334 BOOL IsContextPathAllowed(LPCTSTR path)
336 Locker lock(m_critSec);
337 ExcludeContextValid();
338 for (std::vector<stdstring>::iterator I = excontextvector.begin(); I != excontextvector.end(); ++I)
340 if (I->empty())
341 continue;
342 if (I->size() && I->at(I->size()-1)=='*')
344 stdstring str = I->substr(0, I->size()-1);
345 if (_tcsnicmp(str.c_str(), path, str.size())==0)
346 return FALSE;
348 else if (_tcsicmp(I->c_str(), path)==0)
349 return FALSE;
351 return TRUE;
353 BOOL IsPathAllowed(LPCTSTR path)
355 Locker lock(m_critSec);
356 IncludeListValid();
357 for (std::vector<stdstring>::iterator I = invector.begin(); I != invector.end(); ++I)
359 if (I->empty())
360 continue;
361 if (I->at(I->size()-1)=='*')
363 stdstring str = I->substr(0, I->size()-1);
364 if (_tcsnicmp(str.c_str(), path, str.size())==0)
365 return TRUE;
366 if (!str.empty() && (str.at(str.size()-1) == '\\') && (_tcsnicmp(str.c_str(), path, str.size()-1)==0))
367 return TRUE;
369 else if (_tcsicmp(I->c_str(), path)==0)
370 return TRUE;
371 else if ((I->at(I->size()-1) == '\\') &&
372 ((_tcsnicmp(I->c_str(), path, I->size())==0) || (_tcsicmp(I->c_str(), path)==0)) )
373 return TRUE;
376 UINT drivetype = 0;
377 int drivenumber = PathGetDriveNumber(path);
378 if ((drivenumber >=0)&&(drivenumber < 25))
380 drivetype = drivetypecache[drivenumber];
381 if ((drivetype == -1)||((GetTickCount() - DRIVETYPETIMEOUT)>drivetypeticker))
383 if ((drivenumber == 0)||(drivenumber == 1))
384 drivetypecache[drivenumber] = DRIVE_REMOVABLE;
385 else
387 drivetypeticker = GetTickCount();
388 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathStripToRoot works with partial paths too.
389 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
390 PathStripToRoot(pathbuf);
391 PathAddBackslash(pathbuf);
392 ATLTRACE2(_T("GetDriveType for %s, Drive %d\n"), pathbuf, drivenumber);
393 drivetype = GetDriveType(pathbuf);
394 drivetypecache[drivenumber] = drivetype;
398 else
400 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathIsUNCServer works with partial paths too.
401 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
402 if (PathIsUNCServer(pathbuf))
403 drivetype = DRIVE_REMOTE;
404 else
406 PathStripToRoot(pathbuf);
407 PathAddBackslash(pathbuf);
408 if (_tcsncmp(pathbuf, drivetypepathcache, MAX_PATH-1)==0) // MAX_PATH ok.
409 drivetype = drivetypecache[26];
410 else
412 ATLTRACE2(_T("GetDriveType for %s\n"), pathbuf);
413 drivetype = GetDriveType(pathbuf);
414 drivetypecache[26] = drivetype;
415 _tcsncpy_s(drivetypepathcache, MAX_PATH, pathbuf, MAX_PATH); // MAX_PATH ok.
419 if ((drivetype == DRIVE_REMOVABLE)&&(!IsRemovable()))
420 return FALSE;
421 if ((drivetype == DRIVE_REMOVABLE)&&(drivefloppy == 0)&&((drivenumber==0)||(drivenumber==1)))
422 return FALSE;
423 if ((drivetype == DRIVE_FIXED)&&(!IsFixed()))
424 return FALSE;
425 if (((drivetype == DRIVE_REMOTE)||(drivetype == DRIVE_NO_ROOT_DIR))&&(!IsRemote()))
426 return FALSE;
427 if ((drivetype == DRIVE_CDROM)&&(!IsCDRom()))
428 return FALSE;
429 if ((drivetype == DRIVE_RAMDISK)&&(!IsRAM()))
430 return FALSE;
431 if ((drivetype == DRIVE_UNKNOWN)&&(IsUnknown()))
432 return FALSE;
434 ExcludeListValid();
435 for (std::vector<stdstring>::iterator I = exvector.begin(); I != exvector.end(); ++I)
437 if (I->empty())
438 continue;
439 if (I->size() && I->at(I->size()-1)=='*')
441 stdstring str = I->substr(0, I->size()-1);
442 if (_tcsnicmp(str.c_str(), path, str.size())==0)
443 return FALSE;
445 else if (_tcsicmp(I->c_str(), path)==0)
446 return FALSE;
448 return TRUE;
450 DWORD GetLangID()
452 if ((GetTickCount() - REGISTRYTIMEOUT) > langticker)
454 langticker = GetTickCount();
455 langid.read();
457 return (langid);
459 NUMBERFMT * GetNumberFmt()
461 if ((GetTickCount() - NUMBERFMTTIMEOUT) > columnrevformatticker)
463 TCHAR szBuffer[5];
464 columnrevformatticker = GetTickCount();
465 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
466 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
467 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
468 columnrevformat.lpDecimalSep = szDecSep;
469 columnrevformat.lpThousandSep = szThousandsSep;
470 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
471 columnrevformat.Grouping = _ttoi(szBuffer);
472 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
473 columnrevformat.NegativeOrder = _ttoi(szBuffer);
475 return &columnrevformat;
477 BOOL HasGITAdminDir(LPCTSTR path, BOOL bIsDir, CString *ProjectTopDir = NULL)
479 size_t len = _tcslen(path);
480 std::unique_ptr<TCHAR[]> buf(new TCHAR[len + 1]);
481 _tcscpy_s(buf.get(), len + 1, path);
482 if (! bIsDir)
484 TCHAR * ptr = _tcsrchr(buf.get(), '\\');
485 if (ptr != 0)
487 *ptr = 0;
490 if ((GetTickCount() - ADMINDIRTIMEOUT) < admindirticker)
492 std::map<stdstring, AdminDir_s>::iterator iter;
493 sAdminDirCacheKey.assign(buf.get());
494 if ((iter = admindircache.find(sAdminDirCacheKey)) != admindircache.end())
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.get(), true, &sProjectRoot);
503 admindirticker = GetTickCount();
504 Locker lock(m_critSec);
506 AdminDir_s &ad = admindircache[buf.get()];
507 ad.bHasAdminDir = hasAdminDir;
508 if (hasAdminDir)
510 ad.sProjectRoot.assign(sProjectRoot);
512 if (ProjectTopDir)
513 *ProjectTopDir = sProjectRoot;
516 return hasAdminDir;
518 bool IsColumnsEveryWhere()
520 if ((GetTickCount() - REGISTRYTIMEOUT) > columnseverywhereticker)
522 columnseverywhereticker = GetTickCount();
523 columnseverywhere.read();
525 return !!(DWORD)columnseverywhere;
527 private:
528 void DriveValid()
530 if ((GetTickCount() - REGISTRYTIMEOUT)>driveticker)
532 driveticker = GetTickCount();
533 driveremote.read();
534 drivefixed.read();
535 drivecdrom.read();
536 driveremove.read();
537 drivefloppy.read();
540 void ExcludeContextValid()
542 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excontextticker)
544 Locker lock(m_critSec);
545 excontextticker = GetTickCount();
546 nocontextpaths.read();
547 if (excludecontextstr.compare((stdstring)nocontextpaths)==0)
548 return;
549 excludecontextstr = (stdstring)nocontextpaths;
550 excontextvector.clear();
551 size_t pos = 0, pos_ant = 0;
552 pos = excludecontextstr.find(_T("\n"), pos_ant);
553 while (pos != stdstring::npos)
555 stdstring token = excludecontextstr.substr(pos_ant, pos-pos_ant);
556 excontextvector.push_back(token);
557 pos_ant = pos+1;
558 pos = excludecontextstr.find(_T("\n"), pos_ant);
560 if (!excludecontextstr.empty())
562 excontextvector.push_back(excludecontextstr.substr(pos_ant, excludecontextstr.size()-1));
564 excludecontextstr = (stdstring)nocontextpaths;
567 void ExcludeListValid()
569 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excludelistticker)
571 Locker lock(m_critSec);
572 excludelistticker = GetTickCount();
573 excludelist.read();
574 if (excludeliststr.compare((stdstring)excludelist)==0)
575 return;
576 excludeliststr = (stdstring)excludelist;
577 exvector.clear();
578 size_t pos = 0, pos_ant = 0;
579 pos = excludeliststr.find(_T("\n"), pos_ant);
580 while (pos != stdstring::npos)
582 stdstring token = excludeliststr.substr(pos_ant, pos-pos_ant);
583 exvector.push_back(token);
584 pos_ant = pos+1;
585 pos = excludeliststr.find(_T("\n"), pos_ant);
587 if (!excludeliststr.empty())
589 exvector.push_back(excludeliststr.substr(pos_ant, excludeliststr.size()-1));
591 excludeliststr = (stdstring)excludelist;
594 void IncludeListValid()
596 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>includelistticker)
598 Locker lock(m_critSec);
599 includelistticker = GetTickCount();
600 includelist.read();
601 if (includeliststr.compare((stdstring)includelist)==0)
602 return;
603 includeliststr = (stdstring)includelist;
604 invector.clear();
605 size_t pos = 0, pos_ant = 0;
606 pos = includeliststr.find(_T("\n"), pos_ant);
607 while (pos != stdstring::npos)
609 stdstring token = includeliststr.substr(pos_ant, pos-pos_ant);
610 invector.push_back(token);
611 pos_ant = pos+1;
612 pos = includeliststr.find(_T("\n"), pos_ant);
614 if (!includeliststr.empty())
616 invector.push_back(includeliststr.substr(pos_ant, includeliststr.size()-1));
618 includeliststr = (stdstring)includelist;
622 struct AdminDir_s
624 BOOL bHasAdminDir;
625 stdstring sProjectRoot;
627 public:
628 CRegStdDWORD cachetype;
629 CRegStdDWORD blockstatus;
630 CRegStdDWORD langid;
631 CRegStdDWORD showrecursive;
632 CRegStdDWORD folderoverlay;
633 CRegStdDWORD getlocktop;
634 CRegStdDWORD driveremote;
635 CRegStdDWORD drivefixed;
636 CRegStdDWORD drivecdrom;
637 CRegStdDWORD driveremove;
638 CRegStdDWORD drivefloppy;
639 CRegStdDWORD driveram;
640 CRegStdDWORD driveunknown;
641 CRegStdDWORD menulayoutlow; /* Fist level mask */
642 CRegStdDWORD menulayouthigh;
643 CRegStdDWORD menuextlow; /* ext menu mask */
644 CRegStdDWORD menuexthigh;
645 CRegStdDWORD simplecontext;
646 CRegStdDWORD menumasklow_lm;
647 CRegStdDWORD menumaskhigh_lm;
648 CRegStdDWORD menumasklow_cu;
649 CRegStdDWORD menumaskhigh_cu;
650 CRegStdDWORD unversionedasmodified;
651 CRegStdDWORD showunversionedoverlay;
652 CRegStdDWORD showignoredoverlay;
653 CRegStdDWORD excludedasnormal;
654 CRegStdString excludelist;
655 CRegStdDWORD hidemenusforunversioneditems;
656 CRegStdDWORD columnseverywhere;
657 stdstring excludeliststr;
658 std::vector<stdstring> exvector;
659 CRegStdString includelist;
660 stdstring includeliststr;
661 std::vector<stdstring> invector;
662 DWORD cachetypeticker;
663 DWORD recursiveticker;
664 DWORD folderoverlayticker;
665 DWORD getlocktopticker;
666 DWORD driveticker;
667 DWORD drivetypeticker;
668 DWORD layoutticker;
669 DWORD exticker;
670 DWORD menumaskticker;
671 DWORD langticker;
672 DWORD blockstatusticker;
673 DWORD columnrevformatticker;
674 DWORD excludelistticker;
675 DWORD includelistticker;
676 DWORD simplecontextticker;
677 DWORD unversionedasmodifiedticker;
678 DWORD showunversionedoverlayticker;
679 DWORD showignoredoverlayticker;
680 DWORD excludedasnormalticker;
681 DWORD hidemenusforunversioneditemsticker;
682 DWORD columnseverywhereticker;
683 UINT drivetypecache[27];
684 TCHAR drivetypepathcache[MAX_PATH]; // MAX_PATH ok.
685 NUMBERFMT columnrevformat;
686 TCHAR szDecSep[5];
687 TCHAR szThousandsSep[5];
688 std::map<stdstring, AdminDir_s> admindircache;
689 stdstring sAdminDirCacheKey;
690 CRegStdString nocontextpaths;
691 stdstring excludecontextstr;
692 std::vector<stdstring> excontextvector;
693 DWORD excontextticker;
694 DWORD admindirticker;
695 CComCriticalSection m_critSec;