Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

528 lines
18 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. cachedef.h
  5. Abstract:
  6. contains data definitions for cache code.
  7. Author:
  8. Madan Appiah (madana) 12-Apr-1995
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #ifndef _CACHEDEF_
  14. #define _CACHEDEF_
  15. //
  16. // C++ inline code definition for retail build only.
  17. //
  18. #if DBG
  19. #undef CHECKLOCK_NORMAL
  20. #undef CHECKLOCK_PARANOID
  21. #define INLINE
  22. #else
  23. #define INLINE inline
  24. #endif
  25. #define PAGE_SIZE 4096 // Grow memory mapped file by 1 page.
  26. #define ALLOC_PAGES 4 // was 2
  27. #define HEADER_ENTRY_SIZE ALLOC_PAGES * PAGE_SIZE
  28. #define NORMAL_ENTRY_SIZE 128
  29. #define DEFAULT_CLEANUP_FACTOR 10 // % free goal once cache quota exceeded
  30. #define MAX_EXEMPT_PERCENTAGE 70
  31. #define MEMMAP_FILE_NAME TEXT("index.dat")
  32. #define DESKTOPINI_FILE_NAME TEXT("desktop.ini")
  33. #define DEFAULT_FILE_EXTENSION ""
  34. // Cache configuration and signature.
  35. #define CACHE_SIGNATURE_VALUE TEXT("Signature")
  36. #define CACHE_SIGNATURE TEXT("Client UrlCache MMF Ver 5.2")
  37. #define NUM_HEADER_DATA_DWORDS (CACHE_HEADER_DATA_LAST + 1)
  38. #define MAX_SIG_SIZE (sizeof(CACHE_SIGNATURE) / sizeof(TCHAR))
  39. // The following values parametrize the schema for URL entries.
  40. #define ENTRY_COPYSIZE_IE5 \
  41. (sizeof(IE5_URL_FILEMAP_ENTRY) - sizeof(FILEMAP_ENTRY))
  42. #define ENTRY_VERSION_IE5 0
  43. #define ENTRY_COPYSIZE_IE6 \
  44. (sizeof(IE6_URL_FILEMAP_ENTRY) - sizeof(FILEMAP_ENTRY))
  45. #define ENTRY_VERSION_IE6 0x10
  46. #define ENTRY_COPYSIZE_CURRENT ENTRY_COPYSIZE_IE6
  47. #define ENTRY_VERSION_CURRENT ENTRY_VERSION_IE6
  48. // If IE5-IE? sees an entry with low bits of version set, it will be placed
  49. // on async fixup list rather than being destroyed.
  50. #define ENTRY_VERSION_NONCOMPAT_MASK 0x0F
  51. // Roundup
  52. #define ROUNDUPTOPOWEROF2(bytesize, powerof2) (((bytesize) + (powerof2) - 1) & ~((powerof2) - 1))
  53. #define ROUNDUPBLOCKS(bytesize) ((bytesize + NORMAL_ENTRY_SIZE-1) & ~(NORMAL_ENTRY_SIZE-1))
  54. #define ROUNDUPDWORD(bytesize) ((bytesize + sizeof(DWORD)-1) & ~(sizeof(DWORD)-1))
  55. #define ROUNDUPPAGE(bytesize) ((bytesize + PAGE_SIZE-1) & ~(PAGE_SIZE-1))
  56. #define NUMBLOCKS(bytesize) (bytesize / NORMAL_ENTRY_SIZE)
  57. // Power of 2 macros
  58. #define ISPOWEROF2(val) (!((val) & ((val)-1)))
  59. #define ASSERT_ISPOWEROF2(val) INET_ASSERT(ISPOWEROF2(val))
  60. #define URL_CACHE_VERSION_NUM sizeof(CACHE_ENTRY_INFO);
  61. // Default profiles directory under %SystemRoot%.
  62. #define DEFAULT_PROFILES_DIRECTORY TEXT("Profiles")
  63. //
  64. // Registry key and value names for persistent URL management.
  65. //
  66. // BUGBUG - wasting space.
  67. #define MS_BASE TEXT("Software\\Microsoft")
  68. #define CV_BASE MS_BASE TEXT("\\Windows\\CurrentVersion")
  69. #define EX_BASE TEXT("\\Explorer")
  70. #define IS_BASE TEXT("\\Internet Settings")
  71. #define CACHE_T TEXT("\\Cache")
  72. #define SHELL_FOLDER_KEY CV_BASE EX_BASE TEXT("\\Shell Folders")
  73. #define USER_SHELL_FOLDER_KEY CV_BASE EX_BASE TEXT("\\User Shell Folders")
  74. #define CACHE5_KEY CV_BASE IS_BASE TEXT("\\5.0") CACHE_T
  75. #define IDENTITIES_KEY CV_BASE IS_BASE TEXT("\\5.0\\Identities")
  76. #define OLD_CACHE_KEY CV_BASE IS_BASE CACHE_T
  77. #define CACHE_PATHS_FULL_KEY CV_BASE IS_BASE CACHE_T TEXT("\\Paths")
  78. #define RUN_ONCE_KEY CV_BASE TEXT("\\RunOnce")
  79. #define PROFILELESS_USF_KEY TEXT(".Default\\") USER_SHELL_FOLDER_KEY
  80. #define CONTENT_CACHE_HARD_NAME TEXT("Content.IE5")
  81. #define OLD_VERSION_KEY MS_BASE TEXT("\\IE Setup\\SETUP")
  82. #define OLD_VERSION_VALUE TEXT("UpgradeFromIESysFile")
  83. // from wininet\inetui\inetui.rc
  84. #define IDS_CACHE_DEFAULT_SUBDIR "Temporary Internet Files"
  85. #define IDS_COOKIES_DEFAULT_SUBDIR "Cookies"
  86. #define IDS_HISTORY_DEFAULT_SUBDIR "History"
  87. #define IDS_CACHE_DEFAULT_SUBDIR_UNIX "TempInternetFiles"
  88. //
  89. // Cache parameters
  90. //
  91. #ifndef unix
  92. #define PATH_CONNECT_STRING TEXT("\\")
  93. #define PATH_CONNECT_CHAR TEXT('\\')
  94. #define ALLFILES_WILDCARD_STRING TEXT("*.*")
  95. #define UNIX_RETURN_IF_READONLY_CACHE
  96. #define UNIX_RETURN_ERR_IF_READONLY_CACHE(error)
  97. #define UNIX_NORMALIZE_PATH_ALWAYS(szOrigPath, szEnvVar)
  98. #define UNIX_NORMALIZE_IF_CACHE_PATH(szOrigPath, szEnvVar, szKeyName)
  99. #else
  100. #define PATH_CONNECT_STRING TEXT("/")
  101. #define PATH_CONNECT_CHAR TEXT('/')
  102. #define ALLFILES_WILDCARD_STRING TEXT("*")
  103. #define UNIX_RETURN_IF_READONLY_CACHE { \
  104. if (g_ReadOnlyCaches) \
  105. return; \
  106. }
  107. #define UNIX_RETURN_ERR_IF_READONLY_CACHE(error) { \
  108. if (g_ReadOnlyCaches)\
  109. return (error); \
  110. }
  111. #define UNIX_NORMALIZE_PATH_ALWAYS(szOrigPath, szEnvVar) \
  112. UnixNormalisePath(szOrigPath, szEnvVar);
  113. #define UNIX_NORMALIZE_IF_CACHE_PATH(szOrigPath, szEnvVar, szKeyName) \
  114. UnixNormaliseIfCachePath(szOrigPath, szEnvVar, szKeyName);
  115. #define UNIX_SHARED_CACHE_PATH TEXT("%HOME%/.microsoft")
  116. #endif /* !unix */
  117. #define CACHE_PERSISTENT TEXT("Persistent")
  118. // Retrieval methods
  119. #define RETRIEVE_WITHOUT_CHECKS 0
  120. #define RETRIEVE_WITH_CHECKS 1
  121. #define RETRIEVE_WITH_ALLOCATION 2
  122. #define RETRIEVE_ONLY_FILENAME 4
  123. #define RETRIEVE_ONLY_STRUCT_INFO 8
  124. //
  125. // Multiple URL containters can be configured under the above key such
  126. // as :
  127. //
  128. // Cache\Paths\Path1
  129. // Cache\Paths\Path2
  130. // ...
  131. //
  132. // Each containter will have the following two parameters.
  133. //
  134. // CConMgr related defines.
  135. #define CACHE_PATHS_KEY TEXT("Paths")
  136. #define CACHE_PATH_VALUE TEXT("CachePath")
  137. #define CACHE_PATH_VALUE_TYPE REG_SZ
  138. #define CACHE_LIMIT_VALUE TEXT("CacheLimit")
  139. #define CACHE_LIMIT_VALUE_TYPE REG_DWORD
  140. #define CACHE_OPTIONS_VALUE TEXT("CacheOptions")
  141. #define CACHE_OPTIONS_VALUE_TYPE REG_DWORD
  142. #define CACHE_PATCH_VALUE TEXT("CacheRepair")
  143. #define CACHE_PATCH_VALUE_TYPE REG_DWORD
  144. #define EXTENSIBLE_CACHE_PATH_KEY "Extensible Cache"
  145. #define CONTENT_PATH_KEY "Content"
  146. #define COOKIE_PATH_KEY "Cookies"
  147. #define HISTORY_PATH_KEY "History"
  148. #define URL_HISTORY_KEY "Url History"
  149. #define PER_USER_KEY "PerUserItem"
  150. #define PROFILES_ENABLED_VALUE "Network\\Logon"
  151. #define PROFILES_ENABLED "UserProfiles"
  152. #define PROFILES_PATH_VALUE CV_BASE "\\ProfileList"
  153. #define PROFILES_PATH "ProfileImagePath"
  154. #define CONTENT_PREFIX ""
  155. #define COOKIE_PREFIX "Cookie:"
  156. #define HISTORY_PREFIX "Visited:"
  157. #define CONTENT_VERSION_SUBDIR "Content.IE5"
  158. #define IE3_COOKIES_PATH_KEY OLD_CACHE_KEY TEXT("\\Special Paths\\Cookies")
  159. #define IE3_HISTORY_PATH_KEY OLD_CACHE_KEY TEXT("\\Special Paths\\History")
  160. #define IE3_PATCHED_USER_KEY TEXT("Patched User")
  161. #define CACHE_SPECIAL_PATHS_KEY TEXT("Special Paths")
  162. #define CACHE_DIRECTORY_VALUE TEXT("Directory")
  163. #define CACHE_DIRECTORY_TYPE REG_EXPAND_SZ
  164. #define CACHE_NEWDIR_VALUE TEXT("NewDirectory")
  165. #define CACHE_NEWDIR_TYPE REG_EXPAND_SZ
  166. #define CACHE_PREFIX_VALUE TEXT("CachePrefix")
  167. #define CACHE_PREFIX_MAP_VALUE "PrefixMap"
  168. #define CACHE_VOLUME_LABLE_VALUE "VolumeLabel"
  169. #define CACHE_VOLUME_TITLE_VALUE "VolumeTitle"
  170. #define CACHE_PREFIX_TYPE REG_SZ
  171. #define NEW_DIR TEXT("NewDirectory")
  172. #define USER_PROFILE_SZ "%USERPROFILE%"
  173. #define USER_PROFILE_LEN (sizeof(USER_PROFILE_SZ) - 1)
  174. // URL_CONTAINER related defines.
  175. #define DEF_NUM_PATHS 4
  176. #define DEF_CACHE_LIMIT (2048 * DEF_NUM_PATHS)
  177. #define NO_SPECIAL_CONTAINER 0xffffffff
  178. #define MAX_ENTRY_SIZE 0xFFFF
  179. #define LONGLONG_TO_FILETIME( _p_ ) ((FILETIME *)(_p_))
  180. // Content limit defines.
  181. #define OLD_CONTENT_QUOTA_DEFAULT_DISK_FRACTION 64
  182. #define NEW_CONTENT_QUOTA_DEFAULT_DISK_FRACTION 32
  183. #define CONTENT_QUOTA_ADJUST_CHECK "QuotaAdjustCheck"
  184. // CD Container related defines.
  185. #define INTERNET_CACHE_CONTAINER_PREFIXMAP INTERNET_CACHE_CONTAINER_RESERVED1
  186. #define MAX_FILE_SIZE_TO_MIGRATE 50000
  187. #define MAX_EXTENSION_LEN 3
  188. // FileMgr related defines.
  189. #define DEFAULT_DIR_TABLE_GROW_SIZE 4
  190. #define DEFAULT_MAX_DIRS 32
  191. #define MAX_FILES_PER_CACHE_DIRECTORY 1024
  192. #define MAX_COLLISSION_ATTEMPTS 150
  193. #define INSTALLED_DIRECTORY_KEY 0xFF
  194. #define NOT_A_CACHE_SUBDIRECTORY 0XFE
  195. #ifdef CHECKLOCK_PARANOID
  196. void CheckEnterCritical(CRITICAL_SECTION *_cs);
  197. void CheckLeaveCritical(CRITICAL_SECTION *_cs);
  198. #define ENTERCRITICAL CheckEnterCritical
  199. #define LEAVECRITICAL CheckLeaveCritical
  200. #else
  201. #define ENTERCRITICAL EnterCriticalSection
  202. #define LEAVECRITICAL LeaveCriticalSection
  203. #endif
  204. // Cache global variable lock -- this should not be entered while holding
  205. // lower-level locks like URL_CONTAINER::LockContainer cross-process mutex.
  206. #define LOCK_CACHE() ENTERCRITICAL( &GlobalCacheCritSect )
  207. #define UNLOCK_CACHE() LEAVECRITICAL( &GlobalCacheCritSect )
  208. //
  209. // parameter check macros.
  210. //
  211. #define IsBadUrl( _x_ ) IsBadStringPtrA( _x_, (DWORD) -1)
  212. #define IsBadUrlW( _x_ ) IsBadStringPtrW( _x_, (DWORD) -1)
  213. #define IsBadReadFileName( _x_ ) IsBadStringPtr( _x_, MAX_PATH )
  214. #define IsBadWriteFileName( _x_ ) IsBadWritePtr( (PVOID)_x_, MAX_PATH)
  215. #define IsBadWriteBoolPtr( _x_ ) IsBadWritePtr( _x_, sizeof(BOOL))
  216. #define IsBadReadUrlInfo( _x_ ) IsBadReadPtr( _x_, sizeof(CACHE_ENTRY_INFO))
  217. #define IsBadWriteUrlInfo( _x_, _y_ ) IsBadWritePtr( _x_, _y_ )
  218. #define MAX_URL_ENTRIES (BIT_MAP_ARRAY_SIZE * sizeof(DWORD) * 8)
  219. #define OFFSET_TO_POINTER( _ep_, _offset_) \
  220. (LPVOID)((LPBYTE)(_ep_) + (_offset_))
  221. #define FIND_FLAGS_OLD_SEMANTICS 0x1
  222. #define FIND_FLAGS_RETRIEVE_ONLY_STRUCT_INFO 0x2
  223. #define FIND_FLAGS_RETRIEVE_ONLY_FIXED_AND_FILENAME 0x04
  224. //---------------- BUGBUG : for History Only -------------------------------
  225. #define MAX_FILETIME 0x7fffffffffffffff
  226. #define MAX_DOSTIME -1
  227. //---------------- END BUGBUG ----------------------------------------------
  228. //
  229. // ----------------- Allocation entry header -----------------------------//
  230. //
  231. #define SIG_FREE 0xbadf00d
  232. #define SIG_ALLOC 0xdeadbeef
  233. #define SIG_URL ' LRU' // URL_FILEMAP_ENTRY
  234. #define SIG_REDIR 'RDER' // REDR_FILEMAP_ENTRY
  235. #define SIG_LEAK 'KAEL' // URL_FILEMAP_ENTRY
  236. #define SIG_GLIST 'GLST' // LIST_GROUP_ENTRY
  237. // signatures for entries placed on fixup list
  238. #define SIG_UPDATE ' DPU' // URL_FILEMAP_ENTRY
  239. #define SIG_DELETE ' LED' // URL_FILEMAP_ENTRY
  240. enum MemMapStatus
  241. {
  242. MEMMAP_STATUS_OPENED_EXISTING = 0,
  243. MEMMAP_STATUS_REINITIALIZED = 1
  244. };
  245. typedef struct FILEMAP_ENTRY
  246. {
  247. DWORD dwSig;
  248. DWORD nBlocks;
  249. }
  250. *LPFILEMAP_ENTRY;
  251. struct LIST_FILEMAP_ENTRY : FILEMAP_ENTRY
  252. {
  253. DWORD dwNext; // offset to next element in list
  254. DWORD nBlock; // sequence number for this block
  255. };
  256. //
  257. // URL entry
  258. //
  259. struct IE5_URL_FILEMAP_ENTRY : FILEMAP_ENTRY
  260. {
  261. LONGLONG LastModifiedTime; // must be LONGLONG
  262. LONGLONG LastAccessedTime; // should be DWORD
  263. DWORD dostExpireTime;
  264. DWORD dostPostCheckTime;
  265. DWORD dwFileSize;
  266. DWORD dwRedirHashItemOffset; // ask DanpoZ
  267. DWORD dwGroupOffset;
  268. union
  269. {
  270. DWORD dwExemptDelta; // for SIG_URL
  271. DWORD dwNextLeak; // for SIG_LEAK
  272. };
  273. DWORD CopySize; // should be WORD
  274. DWORD UrlNameOffset; // should be WORD
  275. BYTE DirIndex; // subdirectory bucket
  276. BYTE bSyncState; // automatic sync mode state
  277. BYTE bVerCreate; // cache version that created this entry
  278. BYTE bVerUpdate; // cache version last updated this entry (unused)
  279. DWORD InternalFileNameOffset; // should be WORD
  280. DWORD CacheEntryType;
  281. DWORD HeaderInfoOffset; // should be WORD
  282. DWORD HeaderInfoSize; // should be WORD
  283. DWORD FileExtensionOffset; // should be WORD
  284. DWORD dostLastSyncTime;
  285. DWORD NumAccessed; // should be WORD
  286. DWORD NumReferences; // should be WORD
  287. DWORD dostFileCreationTime; // should be LONGLONG?
  288. // Do not extend this structure; use inheritance instead.
  289. };
  290. struct IE6_URL_FILEMAP_ENTRY : IE5_URL_FILEMAP_ENTRY
  291. {
  292. DWORD dwIdentity;
  293. DWORD GetIdentity()
  294. {
  295. return (bVerCreate>=ENTRY_VERSION_IE6) ? dwIdentity : 0;
  296. }
  297. };
  298. typedef IE6_URL_FILEMAP_ENTRY URL_FILEMAP_ENTRY, *LPURL_FILEMAP_ENTRY;
  299. // FILETIME is measured in 100-ns units.
  300. #define FILETIME_SEC ((LONGLONG) 10000000)
  301. #define FILETIME_DAY (FILETIME_SEC * 60 * 60 * 24)
  302. // Possible values for bSyncState:
  303. #define SYNCSTATE_VOLATILE 0 // once zero, stuck at zero
  304. #define SYNCSTATE_IMAGE 1 // eligible to increment after MIN_AGESYNC
  305. #define SYNCSTATE_STATIC 6 // max value
  306. // Parameters controlling transition from _IMAGE to _VOLATILE.
  307. // #define MIN_AGESYNC ((LONGLONG) 5 * 60 * 10000000) // 5 min in filetime
  308. #define MIN_AGESYNC (FILETIME_DAY * 7)
  309. //
  310. // Redirect Entry
  311. //
  312. struct REDIR_FILEMAP_ENTRY : FILEMAP_ENTRY
  313. {
  314. DWORD dwItemOffset; // offset to hash table item of destination URL
  315. DWORD dwHashValue; // destination URL hash value (BUGBUG: collisions?)
  316. char szUrl[4]; // original URL, can occupy more bytes
  317. };
  318. //
  319. // Group Record
  320. //
  321. typedef struct GROUP_ENTRY
  322. {
  323. GROUPID gid;
  324. DWORD dwGroupFlags;
  325. DWORD dwGroupType;
  326. LONGLONG llDiskUsage; // in Bytes (Actual Usage)
  327. DWORD dwDiskQuota; // in KB
  328. DWORD dwGroupNameOffset;
  329. DWORD dwGroupStorageOffset;
  330. }
  331. *LPGROUP_ENTRY;
  332. #define PAGE_SIZE_FOR_GROUPS (PAGE_SIZE - sizeof(FILEMAP_ENTRY))
  333. #define GROUPS_PER_PAGE PAGE_SIZE_FOR_GROUPS / sizeof(GROUP_ENTRY)
  334. typedef struct _GROUP_DATA_ENTRY
  335. {
  336. CHAR szName[GROUPNAME_MAX_LENGTH];
  337. DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE];
  338. DWORD dwOffsetNext;
  339. } GROUP_DATA_ENTRY, *LPGROUP_DATA_ENTRY;
  340. #define GROUPS_DATA_PER_PAGE PAGE_SIZE_FOR_GROUPS / sizeof(GROUP_DATA_ENTRY)
  341. //
  342. // so the sizeof(GROUPS_PAGE_FILEMAP_ENTRY) = PAGE_SIZE
  343. // this is the allocation unit for groups entry
  344. //
  345. typedef struct _GROUPS_ALLOC_FILEMAP_ENTRY : FILEMAP_ENTRY
  346. {
  347. BYTE pGroupBlock[PAGE_SIZE_FOR_GROUPS];
  348. } GROUPS_ALLOC_FILEMAP_ENTRY, *LPGROUPS_ALLOC_FILEMAP_ENTRY;
  349. typedef struct _LIST_GROUP_ENTRY
  350. {
  351. DWORD dwGroupOffset;
  352. DWORD dwNext;
  353. } LIST_GROUP_ENTRY, *LPLIST_GROUP_ENTRY;
  354. #define LIST_GROUPS_PER_PAGE PAGE_SIZE_FOR_GROUPS / sizeof(LIST_GROUP_ENTRY)
  355. #define SIGNATURE_CONTAINER_FIND 0xFAFAFAFA
  356. #define SIG_CACHE_FIND 0XFBFBFBFB
  357. #define SIG_GROUP_FIND 0XFCFCFCFC
  358. typedef struct _CONTAINER_FIND_FIRST_HANDLE
  359. {
  360. DWORD dwSignature;
  361. DWORD dwNumContainers;
  362. DWORD dwContainer;
  363. LPSTR *ppNames;
  364. LPSTR *ppPrefixes;
  365. LPSTR *ppLabels;
  366. LPSTR *ppTitles;
  367. // DATA follows for Names, Prefixes, Volume labels and Volume titles.
  368. } CONTAINER_FIND_FIRST_HANDLE, *LPCONTAINER_FIND_FIRST_HANDLE;
  369. typedef struct _CACHE_FIND_FIRST_HANDLE
  370. {
  371. DWORD dwSig;
  372. BOOL fFixed;
  373. DWORD nIdx;
  374. DWORD dwHandle;
  375. GROUPID GroupId;
  376. DWORD dwFilter;
  377. DWORD dwFlags;
  378. } CACHE_FIND_FIRST_HANDLE, *LPCACHE_FIND_FIRST_HANDLE;
  379. typedef struct _CACHE_STREAM_CONTEXT_HANDLE
  380. {
  381. HANDLE FileHandle;
  382. LPSTR SourceUrlName;
  383. } CACHE_STREAM_CONTEXT_HANDLE, *LPCACHE_STREAM_CONTEXT_HANDLE;
  384. typedef struct _GROUP_FIND_FIRST_HANDLE : CACHE_FIND_FIRST_HANDLE
  385. {
  386. DWORD dwLastItemOffset;
  387. } GROUP_FIND_FIRST_HANDLE, *LPGROUP_FIND_FIRST_HANDLE;
  388. #define OFFSET_NO_MORE_GROUP -1
  389. #define GID_INDEX_TO_NEXT_PAGE -1
  390. #define OFFSET_TO_NEXT_PAGE -1
  391. #define GID_MASK 0x0fffffffffffffff
  392. #define GID_STICKY_BIT 0x1000000000000000
  393. #define IsStickyGroup(gid) (gid & GID_STICKY_BIT)
  394. #define SetStickyBit(gid) (gid | GID_STICKY_BIT)
  395. #define IsInvalidGroup(gid) (gid & 0xE000000000000000)
  396. //
  397. // RealFileSize() - given the actual filesize,
  398. // this macro computes the approximate real space that a file takes up
  399. // on the disk. It only takes care of rounding to the cluster size
  400. // It doesn't take into account any per-file overhead used in the filesystem
  401. //
  402. #define RealFileSize(fs) ((LONGLONG) (fs + _ClusterSizeMinusOne) & _ClusterSizeMask)
  403. #define MUTEX_DBG_TIMEOUT 5 * 1000 // 5 secs.
  404. #define URLCACHE_OP_SET_STICKY 1
  405. #define URLCACHE_OP_UNSET_STICKY 2
  406. #ifdef unix
  407. extern BOOL CreateAtomicCacheLockFile(BOOL *pfReadOnlyCaches, char **pszLockingHost);
  408. extern BOOL DeleteAtomicCacheLockFile();
  409. extern void UnixNormalisePath(LPTSTR pszOrigPath, LPCTSTR pszEnvVar);
  410. extern void UnixNormaliseIfCachePath(LPTSTR pszOrigPath, LPCTSTR pszEnvVar,LPCTSTR szKeyName);
  411. extern int CopyDir(const char* src_dir, const char* dest_dir);
  412. #endif /* unix */
  413. extern VOID FileTime2DosTime(FILETIME, DWORD*);
  414. extern VOID DosTime2FileTime(DWORD, FILETIME*);
  415. #endif // _CACHEDEF_