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.

106 lines
4.1 KiB

  1. /*****************************************************************************
  2. * Module Name: fntcache.hxx
  3. *
  4. * Font Cahce for NT font engine.
  5. *
  6. * History:
  7. *
  8. * 4-3-98 Yung-Jen Tony Tsai Wrote it.
  9. *
  10. * Copyright (c) 1998-1999 Microsoft Corporation
  11. *****************************************************************************/
  12. #ifndef _FNTCACHE_
  13. #define _FNTCACHE_
  14. #define FNTCACHE_MAX_BUCKETS 61
  15. // If change the sequence the code need to be changed too.
  16. #define FNT_DUMMY_DRV 0
  17. #define FNT_TT_DRV 1
  18. #define FNT_BMP_DRV 2
  19. #define FNT_VT_DRV 3
  20. #define FNT_OT_DRV 4
  21. // For system fonts do not include in font reg
  22. #define FNTCACHE_EXTRA_LINKS 40
  23. #define FNT_CACHE_CHECKSUM_CONFLICT 1
  24. typedef struct _FNTCHECKSUM
  25. {
  26. ULONG ulFastCheckSum;
  27. ULONG ulCheckSum;
  28. } FNTCHECKSUM, *PFNTCHECKSUM;
  29. typedef struct _FNTHLINK {
  30. ULONG ulFastCheckSum;
  31. ULONG ulUFI;
  32. DWORD iNext;
  33. ULONG ulDrvMode;
  34. ULONG cjData; // the total size of data cached for this font file only
  35. DWORD dpData; // offset to the data for this font file
  36. ULONG flLink; // ChecksumConflict only for now
  37. } FNTHLINK;
  38. typedef struct _FNTCACHEHEADER {
  39. ULONG CheckSum;
  40. ULONG ulNTBuildNumber;
  41. ULONG ulNTSvcPack;
  42. ULONG ulCodePage;
  43. ULONG ulMaxFonts; // max # of hlinks in this cache file, not all of them used
  44. ULONG ulTotalLinks; // number of used hlinks, some of them may correspond to the
  45. // fonts that have been RFR'd but not yet purged from boot cache
  46. ULONG ulFileSize; // total size of fntcache.dat
  47. ULONG cjDataAll; // total size of data cached for all fonts
  48. ULONG cjDataExtra; // extra "free" size at the bottom of the cache
  49. ULONG cjDataUsed; // total size of data used in cjDataAll
  50. LARGE_INTEGER Win32kLWT;
  51. LARGE_INTEGER AtmfdLWT;
  52. LARGE_INTEGER FntRegLWT;
  53. LARGE_INTEGER T1RegLWT;
  54. DWORD aiBuckets [FNTCACHE_MAX_BUCKETS];
  55. FNTHLINK ahlnk[1];
  56. } FNTCACHEHEADER;
  57. typedef struct _FNTCACHE
  58. {
  59. FNTCACHEHEADER *pTable;
  60. void *pSection; // kernel mode pointer to the section object
  61. ULONG ulCurrentHlink; // next available HLINK to write to
  62. FLONG flPrevBoot; // The state of the cache at the previous boot time
  63. FLONG flThisBoot; // The state of the cache at this boot time
  64. PBYTE pCacheBufStart; // read pointers point to the old table
  65. PBYTE pCacheBuf; // read pointers point to the old table
  66. PBYTE pCacheBufEnd; // read pointers point to the old table
  67. PPDEV hDev[5]; // pdev array for the 4 font drivers + dummy driver
  68. BOOL bWrite; // need to recalc. the check sum, the file changed
  69. } FNTCACHE;
  70. #define SZ_TT_CACHE 768
  71. #define SZ_T1_CACHE 2048
  72. #define QWORD_ALIGN(x) (((x) + 7L) & ~7L)
  73. #define SZ_FNTCACHE(cFonts) QWORD_ALIGN((offsetof(FNTCACHEHEADER,ahlnk) + (cFonts)*sizeof(FNTHLINK)))
  74. #define SZ_FNTIFICACHE(cTTFonts, cT1Fonts) ((cTTFonts) * SZ_TT_CACHE + (cT1Fonts) * SZ_T1_CACHE)
  75. // 3 modes of font boot cache operation
  76. #define FNT_CACHE_LOOKUP_MODE 0x1
  77. #define FNT_CACHE_CREATE_MODE 0x2
  78. #define FNT_CACHE_MASK (FNT_CACHE_LOOKUP_MODE | FNT_CACHE_CREATE_MODE)
  79. #define FNT_CACHE_STATE_ERROR 0x1
  80. #define FNT_CACHE_STATE_FULL 0x2
  81. #define FNT_CACHE_STATE_OVERFLOW 0x4
  82. VOID InitFNTCache();
  83. ULONG LookUpFNTCacheTable(ULONG cwc, PWSZ pwszPathname, PULONG ulFastCheckSum, PFONTFILEVIEW *ppfv,ULONG cFiles,
  84. PPDEV * pppDevCache, DESIGNVECTOR *pdv, ULONG cjDV);
  85. VOID PutFNTCacheCheckSum(ULONG ulFastCheckSum, ULONG ulCheckSum);
  86. VOID FntCacheHDEV(PPDEV hdev, ULONG ulDrv);
  87. VOID PutFntCacheDrv(ULONG ulFastCheckSum, PPDEV hdev);
  88. #endif