cleanup: dropped a lot of unused code
[TortoiseGit.git] / src / TortoiseShell / ShellCache.h
blobe78a2b79d99f3df6f451b135f8ee6218391f1c58
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 typedef CComCritSecLock<CComCriticalSection> Locker;
34 /**
35 * \ingroup TortoiseShell
36 * Helper class which caches access to the registry. Also provides helper methods
37 * for checks against the settings stored in the registry.
39 class ShellCache
41 public:
42 enum CacheType
44 none,
45 exe,
46 dll,
47 dllFull,// same as dll except it uses commandline git tool with all status modes supported
49 ShellCache()
51 cachetype = CRegStdDWORD(_T("Software\\TortoiseGit\\CacheType"), GetSystemMetrics(SM_REMOTESESSION) ? dll : exe);
52 showrecursive = CRegStdDWORD(_T("Software\\TortoiseGit\\RecursiveOverlay"), TRUE);
53 folderoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\FolderOverlay"), TRUE);
54 driveremote = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemote"));
55 drivefixed = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFixed"), TRUE);
56 drivecdrom = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskCDROM"));
57 driveremove = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRemovable"));
58 drivefloppy = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskFloppy"));
59 driveram = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskRAM"));
60 driveunknown = CRegStdDWORD(_T("Software\\TortoiseGit\\DriveMaskUnknown"));
61 excludelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayExcludeList"));
62 includelist = CRegStdString(_T("Software\\TortoiseGit\\OverlayIncludeList"));
63 simplecontext = CRegStdDWORD(_T("Software\\TortoiseGit\\SimpleContext"), FALSE);
64 unversionedasmodified = CRegStdDWORD(_T("Software\\TortoiseGit\\UnversionedAsModified"), FALSE);
65 hidemenusforunversioneditems = CRegStdDWORD(_T("Software\\TortoiseGit\\HideMenusForUnversionedItems"), FALSE);
66 showunversionedoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowUnversionedOverlay"), TRUE);
67 showignoredoverlay = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowIgnoredOverlay"), TRUE);
68 getlocktop = CRegStdDWORD(_T("Software\\TortoiseGit\\GetLockTop"), TRUE);
69 excludedasnormal = CRegStdDWORD(_T("Software\\TortoiseGit\\ShowExcludedAsNormal"), TRUE);
70 cachetypeticker = GetTickCount();
71 recursiveticker = cachetypeticker;
72 folderoverlayticker = cachetypeticker;
73 driveticker = cachetypeticker;
74 drivetypeticker = cachetypeticker;
75 langticker = cachetypeticker;
76 columnrevformatticker = cachetypeticker;
77 excludelistticker = cachetypeticker;
78 includelistticker = cachetypeticker;
79 simplecontextticker = cachetypeticker;
80 unversionedasmodifiedticker = cachetypeticker;
81 showunversionedoverlayticker = cachetypeticker;
82 showignoredoverlayticker = cachetypeticker;
83 admindirticker = cachetypeticker;
84 columnseverywhereticker = cachetypeticker;
85 getlocktopticker = cachetypeticker;
86 excludedasnormalticker = cachetypeticker;
87 hidemenusforunversioneditemsticker = cachetypeticker;
88 excontextticker = cachetypeticker;
90 unsigned __int64 entries = MENUSYNC|MENUCREATEREPOS|MENUCLONE|MENUCOMMIT;
91 menulayoutlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntries"), entries&0xFFFFFFFF);
92 menulayouthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntrieshigh"), entries>>32);
94 unsigned __int64 ext=(MENUSVNIGNORE|MENUREFLOG|MENUREFBROWSE|MENUSTASHAPPLY|MENUSUBSYNC);
95 menuextlow = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesLow"), ext&0xFFFFFFFF );
96 menuexthigh = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuExtEntriesHigh"), ext>>32 );
98 menumasklow_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0, FALSE, HKEY_LOCAL_MACHINE);
99 menumaskhigh_lm = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0, FALSE, HKEY_LOCAL_MACHINE);
100 menumasklow_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskLow"), 0);
101 menumaskhigh_cu = CRegStdDWORD(_T("Software\\TortoiseGit\\ContextMenuEntriesMaskHigh"), 0);
102 langid = CRegStdDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
103 blockstatus = CRegStdDWORD(_T("Software\\TortoiseGit\\BlockStatus"), 0);
104 columnseverywhere = CRegStdDWORD(_T("Software\\TortoiseGit\\ColumnsEveryWhere"), FALSE);
105 for (int i=0; i<27; i++)
107 drivetypecache[i] = (UINT)-1;
109 // A: and B: are floppy disks
110 drivetypecache[0] = DRIVE_REMOVABLE;
111 drivetypecache[1] = DRIVE_REMOVABLE;
112 TCHAR szBuffer[5];
113 columnrevformatticker = GetTickCount();
114 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
115 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
116 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
117 columnrevformat.lpDecimalSep = szDecSep;
118 columnrevformat.lpThousandSep = szThousandsSep;
119 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
120 columnrevformat.Grouping = _ttoi(szBuffer);
121 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
122 columnrevformat.NegativeOrder = _ttoi(szBuffer);
123 sAdminDirCacheKey.reserve(MAX_PATH); // MAX_PATH as buffer reservation ok.
124 nocontextpaths = CRegStdString(_T("Software\\TortoiseGit\\NoContextPaths"), _T(""));
125 m_critSec.Init();
127 void ForceRefresh()
129 cachetype.read();
130 showrecursive.read();
131 folderoverlay.read();
132 driveremote.read();
133 drivefixed.read();
134 drivecdrom.read();
135 driveremove.read();
136 drivefloppy.read();
137 driveram.read();
138 driveunknown.read();
139 excludelist.read();
140 includelist.read();
141 simplecontext.read();
142 unversionedasmodified.read();
143 showunversionedoverlay.read();
144 showignoredoverlay.read();
145 excludedasnormal.read();
146 hidemenusforunversioneditems.read();
147 menulayoutlow.read();
148 menulayouthigh.read();
149 langid.read();
150 blockstatus.read();
151 columnseverywhere.read();
152 getlocktop.read();
153 menumasklow_lm.read();
154 menumaskhigh_lm.read();
155 menumasklow_cu.read();
156 menumaskhigh_cu.read();
157 nocontextpaths.read();
159 CacheType GetCacheType()
161 if ((GetTickCount() - REGISTRYTIMEOUT) > cachetypeticker)
163 cachetypeticker = GetTickCount();
164 cachetype.read();
166 return CacheType(DWORD((cachetype)));
168 DWORD BlockStatus()
170 if ((GetTickCount() - REGISTRYTIMEOUT) > blockstatusticker)
172 blockstatusticker = GetTickCount();
173 blockstatus.read();
175 return (blockstatus);
177 unsigned __int64 GetMenuLayout()
179 if ((GetTickCount() - REGISTRYTIMEOUT) > layoutticker)
181 layoutticker = GetTickCount();
182 menulayoutlow.read();
183 menulayouthigh.read();
185 unsigned __int64 temp = unsigned __int64(DWORD(menulayouthigh))<<32;
186 temp |= unsigned __int64(DWORD(menulayoutlow));
187 return temp;
190 unsigned __int64 GetMenuExt()
192 if ((GetTickCount() - REGISTRYTIMEOUT) > exticker)
194 exticker = GetTickCount();
195 menuextlow.read();
196 menuexthigh.read();
198 unsigned __int64 temp = unsigned __int64(DWORD(menuexthigh))<<32;
199 temp |= unsigned __int64(DWORD(menuextlow));
200 return temp;
203 unsigned __int64 GetMenuMask()
205 if ((GetTickCount() - REGISTRYTIMEOUT) > menumaskticker)
207 menumaskticker = GetTickCount();
208 menumasklow_lm.read();
209 menumaskhigh_lm.read();
210 menumasklow_cu.read();
211 menumaskhigh_cu.read();
213 DWORD low = (DWORD)menumasklow_lm | (DWORD)menumasklow_cu;
214 DWORD high = (DWORD)menumaskhigh_lm | (DWORD)menumaskhigh_cu;
215 unsigned __int64 temp = unsigned __int64(high)<<32;
216 temp |= unsigned __int64(low);
217 return temp;
219 BOOL IsRecursive()
221 if ((GetTickCount() - REGISTRYTIMEOUT)>recursiveticker)
223 recursiveticker = GetTickCount();
224 showrecursive.read();
226 return (showrecursive);
228 BOOL IsFolderOverlay()
230 if ((GetTickCount() - REGISTRYTIMEOUT)>folderoverlayticker)
232 folderoverlayticker = GetTickCount();
233 folderoverlay.read();
235 return (folderoverlay);
237 BOOL IsSimpleContext()
239 if ((GetTickCount() - REGISTRYTIMEOUT)>simplecontextticker)
241 simplecontextticker = GetTickCount();
242 simplecontext.read();
244 return (simplecontext!=0);
246 BOOL IsUnversionedAsModified()
248 if ((GetTickCount() - REGISTRYTIMEOUT)>unversionedasmodifiedticker)
250 unversionedasmodifiedticker = GetTickCount();
251 unversionedasmodified.read();
253 return (unversionedasmodified);
255 BOOL ShowUnversionedOverlay()
257 if ((GetTickCount() - REGISTRYTIMEOUT)>showunversionedoverlayticker)
259 showunversionedoverlayticker = GetTickCount();
260 showunversionedoverlay.read();
262 return (showunversionedoverlay);
264 BOOL ShowIgnoredOverlay()
266 if ((GetTickCount() - REGISTRYTIMEOUT)>showignoredoverlayticker)
268 showignoredoverlayticker = GetTickCount();
269 showignoredoverlay.read();
271 return (showignoredoverlay);
273 BOOL IsGetLockTop()
275 if ((GetTickCount() - REGISTRYTIMEOUT)>getlocktopticker)
277 getlocktopticker = GetTickCount();
278 getlocktop.read();
280 return (getlocktop);
282 BOOL ShowExcludedAsNormal()
284 if ((GetTickCount() - REGISTRYTIMEOUT)>excludedasnormalticker)
286 excludedasnormalticker = GetTickCount();
287 excludedasnormal.read();
289 return (excludedasnormal);
291 BOOL ShellCache::HideMenusForUnversionedItems()
293 if ((GetTickCount() - hidemenusforunversioneditemsticker)>REGISTRYTIMEOUT)
295 hidemenusforunversioneditemsticker = GetTickCount();
296 hidemenusforunversioneditems.read();
298 return (hidemenusforunversioneditems);
300 BOOL IsRemote()
302 DriveValid();
303 return (driveremote);
305 BOOL IsFixed()
307 DriveValid();
308 return (drivefixed);
310 BOOL IsCDRom()
312 DriveValid();
313 return (drivecdrom);
315 BOOL IsRemovable()
317 DriveValid();
318 return (driveremove);
320 BOOL IsRAM()
322 DriveValid();
323 return (driveram);
325 BOOL IsUnknown()
327 DriveValid();
328 return (driveunknown);
330 BOOL IsContextPathAllowed(LPCTSTR path)
332 Locker lock(m_critSec);
333 ExcludeContextValid();
334 for (std::vector<stdstring>::iterator I = excontextvector.begin(); I != excontextvector.end(); ++I)
336 if (I->empty())
337 continue;
338 if (I->size() && I->at(I->size()-1)=='*')
340 stdstring str = I->substr(0, I->size()-1);
341 if (_tcsnicmp(str.c_str(), path, str.size())==0)
342 return FALSE;
344 else if (_tcsicmp(I->c_str(), path)==0)
345 return FALSE;
347 return TRUE;
349 BOOL IsPathAllowed(LPCTSTR path)
351 Locker lock(m_critSec);
352 IncludeListValid();
353 for (std::vector<stdstring>::iterator I = invector.begin(); I != invector.end(); ++I)
355 if (I->empty())
356 continue;
357 if (I->at(I->size()-1)=='*')
359 stdstring str = I->substr(0, I->size()-1);
360 if (_tcsnicmp(str.c_str(), path, str.size())==0)
361 return TRUE;
362 if (str.size() && (str.at(str.size()-1) == '\\') && (_tcsnicmp(str.c_str(), path, str.size()-1)==0))
363 return TRUE;
365 else if (_tcsicmp(I->c_str(), path)==0)
366 return TRUE;
367 else if ((I->at(I->size()-1) == '\\') &&
368 ((_tcsnicmp(I->c_str(), path, I->size())==0) || (_tcsicmp(I->c_str(), path)==0)) )
369 return TRUE;
372 UINT drivetype = 0;
373 int drivenumber = PathGetDriveNumber(path);
374 if ((drivenumber >=0)&&(drivenumber < 25))
376 drivetype = drivetypecache[drivenumber];
377 if ((drivetype == -1)||((GetTickCount() - DRIVETYPETIMEOUT)>drivetypeticker))
379 if ((drivenumber == 0)||(drivenumber == 1))
380 drivetypecache[drivenumber] = DRIVE_REMOVABLE;
381 else
383 drivetypeticker = GetTickCount();
384 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathStripToRoot works with partial paths too.
385 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
386 PathStripToRoot(pathbuf);
387 PathAddBackslash(pathbuf);
388 ATLTRACE2(_T("GetDriveType for %s, Drive %d\n"), pathbuf, drivenumber);
389 drivetype = GetDriveType(pathbuf);
390 drivetypecache[drivenumber] = drivetype;
394 else
396 TCHAR pathbuf[MAX_PATH+4]; // MAX_PATH ok here. PathIsUNCServer works with partial paths too.
397 _tcsncpy_s(pathbuf, MAX_PATH+4, path, MAX_PATH+3);
398 if (PathIsUNCServer(pathbuf))
399 drivetype = DRIVE_REMOTE;
400 else
402 PathStripToRoot(pathbuf);
403 PathAddBackslash(pathbuf);
404 if (_tcsncmp(pathbuf, drivetypepathcache, MAX_PATH-1)==0) // MAX_PATH ok.
405 drivetype = drivetypecache[26];
406 else
408 ATLTRACE2(_T("GetDriveType for %s\n"), pathbuf);
409 drivetype = GetDriveType(pathbuf);
410 drivetypecache[26] = drivetype;
411 _tcsncpy_s(drivetypepathcache, MAX_PATH, pathbuf, MAX_PATH); // MAX_PATH ok.
415 if ((drivetype == DRIVE_REMOVABLE)&&(!IsRemovable()))
416 return FALSE;
417 if ((drivetype == DRIVE_REMOVABLE)&&(drivefloppy == 0)&&((drivenumber==0)||(drivenumber==1)))
418 return FALSE;
419 if ((drivetype == DRIVE_FIXED)&&(!IsFixed()))
420 return FALSE;
421 if (((drivetype == DRIVE_REMOTE)||(drivetype == DRIVE_NO_ROOT_DIR))&&(!IsRemote()))
422 return FALSE;
423 if ((drivetype == DRIVE_CDROM)&&(!IsCDRom()))
424 return FALSE;
425 if ((drivetype == DRIVE_RAMDISK)&&(!IsRAM()))
426 return FALSE;
427 if ((drivetype == DRIVE_UNKNOWN)&&(IsUnknown()))
428 return FALSE;
430 ExcludeListValid();
431 for (std::vector<stdstring>::iterator I = exvector.begin(); I != exvector.end(); ++I)
433 if (I->empty())
434 continue;
435 if (I->size() && I->at(I->size()-1)=='*')
437 stdstring str = I->substr(0, I->size()-1);
438 if (_tcsnicmp(str.c_str(), path, str.size())==0)
439 return FALSE;
441 else if (_tcsicmp(I->c_str(), path)==0)
442 return FALSE;
444 return TRUE;
446 DWORD GetLangID()
448 if ((GetTickCount() - REGISTRYTIMEOUT) > langticker)
450 langticker = GetTickCount();
451 langid.read();
453 return (langid);
455 NUMBERFMT * GetNumberFmt()
457 if ((GetTickCount() - NUMBERFMTTIMEOUT) > columnrevformatticker)
459 TCHAR szBuffer[5];
460 columnrevformatticker = GetTickCount();
461 SecureZeroMemory(&columnrevformat, sizeof(NUMBERFMT));
462 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, &szDecSep[0], _countof(szDecSep));
463 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, &szThousandsSep[0], _countof(szThousandsSep));
464 columnrevformat.lpDecimalSep = szDecSep;
465 columnrevformat.lpThousandSep = szThousandsSep;
466 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, &szBuffer[0], _countof(szBuffer));
467 columnrevformat.Grouping = _ttoi(szBuffer);
468 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, &szBuffer[0], _countof(szBuffer));
469 columnrevformat.NegativeOrder = _ttoi(szBuffer);
471 return &columnrevformat;
473 BOOL HasGITAdminDir(LPCTSTR path, BOOL bIsDir, CString *ProjectTopDir = NULL)
475 size_t len = _tcslen(path);
476 TCHAR * buf = new TCHAR[len+1];
477 _tcscpy_s(buf, len+1, path);
478 if (! bIsDir)
480 TCHAR * ptr = _tcsrchr(buf, '\\');
481 if (ptr != 0)
483 *ptr = 0;
486 if ((GetTickCount() - ADMINDIRTIMEOUT) < admindirticker)
488 std::map<stdstring, AdminDir_s>::iterator iter;
489 sAdminDirCacheKey.assign(buf);
490 if ((iter = admindircache.find(sAdminDirCacheKey)) != admindircache.end())
492 delete [] buf;
493 if (ProjectTopDir && iter->second.bHasAdminDir)
494 *ProjectTopDir = iter->second.sProjectRoot.c_str();
495 return iter->second.bHasAdminDir;
498 CString sProjectRoot;
499 BOOL hasAdminDir = g_GitAdminDir.HasAdminDir(buf, true, &sProjectRoot);
500 admindirticker = GetTickCount();
501 Locker lock(m_critSec);
503 AdminDir_s &ad = admindircache[buf];
504 ad.bHasAdminDir = hasAdminDir;
505 if (hasAdminDir)
507 ad.sProjectRoot.assign(sProjectRoot);
509 if (ProjectTopDir)
510 *ProjectTopDir = sProjectRoot;
513 delete [] buf;
514 return hasAdminDir;
516 bool IsColumnsEveryWhere()
518 if ((GetTickCount() - REGISTRYTIMEOUT) > columnseverywhereticker)
520 columnseverywhereticker = GetTickCount();
521 columnseverywhere.read();
523 return !!(DWORD)columnseverywhere;
525 private:
526 void DriveValid()
528 if ((GetTickCount() - REGISTRYTIMEOUT)>driveticker)
530 driveticker = GetTickCount();
531 driveremote.read();
532 drivefixed.read();
533 drivecdrom.read();
534 driveremove.read();
535 drivefloppy.read();
538 void ExcludeContextValid()
540 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excontextticker)
542 Locker lock(m_critSec);
543 excontextticker = GetTickCount();
544 nocontextpaths.read();
545 if (excludecontextstr.compare((stdstring)nocontextpaths)==0)
546 return;
547 excludecontextstr = (stdstring)nocontextpaths;
548 excontextvector.clear();
549 size_t pos = 0, pos_ant = 0;
550 pos = excludecontextstr.find(_T("\n"), pos_ant);
551 while (pos != stdstring::npos)
553 stdstring token = excludecontextstr.substr(pos_ant, pos-pos_ant);
554 excontextvector.push_back(token);
555 pos_ant = pos+1;
556 pos = excludecontextstr.find(_T("\n"), pos_ant);
558 if (!excludecontextstr.empty())
560 excontextvector.push_back(excludecontextstr.substr(pos_ant, excludecontextstr.size()-1));
562 excludecontextstr = (stdstring)nocontextpaths;
565 void ExcludeListValid()
567 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>excludelistticker)
569 Locker lock(m_critSec);
570 excludelistticker = GetTickCount();
571 excludelist.read();
572 if (excludeliststr.compare((stdstring)excludelist)==0)
573 return;
574 excludeliststr = (stdstring)excludelist;
575 exvector.clear();
576 size_t pos = 0, pos_ant = 0;
577 pos = excludeliststr.find(_T("\n"), pos_ant);
578 while (pos != stdstring::npos)
580 stdstring token = excludeliststr.substr(pos_ant, pos-pos_ant);
581 exvector.push_back(token);
582 pos_ant = pos+1;
583 pos = excludeliststr.find(_T("\n"), pos_ant);
585 if (!excludeliststr.empty())
587 exvector.push_back(excludeliststr.substr(pos_ant, excludeliststr.size()-1));
589 excludeliststr = (stdstring)excludelist;
592 void IncludeListValid()
594 if ((GetTickCount() - EXCLUDELISTTIMEOUT)>includelistticker)
596 Locker lock(m_critSec);
597 includelistticker = GetTickCount();
598 includelist.read();
599 if (includeliststr.compare((stdstring)includelist)==0)
600 return;
601 includeliststr = (stdstring)includelist;
602 invector.clear();
603 size_t pos = 0, pos_ant = 0;
604 pos = includeliststr.find(_T("\n"), pos_ant);
605 while (pos != stdstring::npos)
607 stdstring token = includeliststr.substr(pos_ant, pos-pos_ant);
608 invector.push_back(token);
609 pos_ant = pos+1;
610 pos = includeliststr.find(_T("\n"), pos_ant);
612 if (!includeliststr.empty())
614 invector.push_back(includeliststr.substr(pos_ant, includeliststr.size()-1));
616 includeliststr = (stdstring)includelist;
620 struct AdminDir_s
622 BOOL bHasAdminDir;
623 stdstring sProjectRoot;
625 public:
626 CRegStdDWORD cachetype;
627 CRegStdDWORD blockstatus;
628 CRegStdDWORD langid;
629 CRegStdDWORD showrecursive;
630 CRegStdDWORD folderoverlay;
631 CRegStdDWORD getlocktop;
632 CRegStdDWORD driveremote;
633 CRegStdDWORD drivefixed;
634 CRegStdDWORD drivecdrom;
635 CRegStdDWORD driveremove;
636 CRegStdDWORD drivefloppy;
637 CRegStdDWORD driveram;
638 CRegStdDWORD driveunknown;
639 CRegStdDWORD menulayoutlow; /* Fist level mask */
640 CRegStdDWORD menulayouthigh;
641 CRegStdDWORD menuextlow; /* ext menu mask */
642 CRegStdDWORD menuexthigh;
643 CRegStdDWORD simplecontext;
644 CRegStdDWORD menumasklow_lm;
645 CRegStdDWORD menumaskhigh_lm;
646 CRegStdDWORD menumasklow_cu;
647 CRegStdDWORD menumaskhigh_cu;
648 CRegStdDWORD unversionedasmodified;
649 CRegStdDWORD showunversionedoverlay;
650 CRegStdDWORD showignoredoverlay;
651 CRegStdDWORD excludedasnormal;
652 CRegStdString excludelist;
653 CRegStdDWORD hidemenusforunversioneditems;
654 CRegStdDWORD columnseverywhere;
655 stdstring excludeliststr;
656 std::vector<stdstring> exvector;
657 CRegStdString includelist;
658 stdstring includeliststr;
659 std::vector<stdstring> invector;
660 DWORD cachetypeticker;
661 DWORD recursiveticker;
662 DWORD folderoverlayticker;
663 DWORD getlocktopticker;
664 DWORD driveticker;
665 DWORD drivetypeticker;
666 DWORD layoutticker;
667 DWORD exticker;
668 DWORD menumaskticker;
669 DWORD langticker;
670 DWORD blockstatusticker;
671 DWORD columnrevformatticker;
672 DWORD excludelistticker;
673 DWORD includelistticker;
674 DWORD simplecontextticker;
675 DWORD unversionedasmodifiedticker;
676 DWORD showunversionedoverlayticker;
677 DWORD showignoredoverlayticker;
678 DWORD excludedasnormalticker;
679 DWORD hidemenusforunversioneditemsticker;
680 DWORD columnseverywhereticker;
681 UINT drivetypecache[27];
682 TCHAR drivetypepathcache[MAX_PATH]; // MAX_PATH ok.
683 NUMBERFMT columnrevformat;
684 TCHAR szDecSep[5];
685 TCHAR szThousandsSep[5];
686 std::map<stdstring, AdminDir_s> admindircache;
687 stdstring sAdminDirCacheKey;
688 CRegStdString nocontextpaths;
689 stdstring excludecontextstr;
690 std::vector<stdstring> excontextvector;
691 DWORD excontextticker;
692 DWORD admindirticker;
693 CComCriticalSection m_critSec;