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.

113 lines
2.7 KiB

  1. /*****************************************************************************
  2. * Module Name: fontfilecache.hpp
  3. *
  4. * Font File Cahce for GDI+.
  5. *
  6. * History:
  7. *
  8. * 11-9-99 Yung-Jen Tony Tsai Wrote it.
  9. *
  10. * Copyright (c) 1999-2000 Microsoft Corporation
  11. *****************************************************************************/
  12. #ifndef _FONTFILECACHE_
  13. #if DBG
  14. #include <mmsystem.h>
  15. #endif
  16. #define _FONTFILECACHE_
  17. // For system fonts do not include in font reg
  18. #define QWORD_ALIGN(x) (((x) + 7L) & ~7L)
  19. #define SZ_FONTCACHE_HEADER() QWORD_ALIGN(sizeof(FONTFILECACHEHEADER))
  20. // 3 modes of font boot cache operation
  21. #define FONT_CACHE_CLOSE_MODE 0x0
  22. #define FONT_CACHE_LOOKUP_MODE 0x1
  23. #define FONT_CACHE_CREATE_MODE 0x2
  24. #define FONT_CACHE_ERROR_MODE 0x3
  25. #define FONT_CACHE_MASK (FONT_CACHE_LOOKUP_MODE | FONT_CACHE_CREATE_MODE)
  26. typedef struct _FONTFILECACHEHEADER
  27. {
  28. ULONG CheckSum;
  29. ULONG ulMajorVersionNumber;
  30. ULONG ulMinorVersionNumber;
  31. ULONG ulLanguageID; // For NT5 or later version
  32. ULONG ulFileSize; // total size of fntcache.dat
  33. ULONG ulDataSize;
  34. ULARGE_INTEGER FntRegLWT;
  35. } FONTFILECACHEHEADER;
  36. typedef struct _FONTFILECACHE
  37. {
  38. FONTFILECACHEHEADER *pFile;
  39. HANDLE hFile; // Handle of file of font file cache
  40. HANDLE hFileMapping; // Handle of file mapping
  41. HMODULE hShFolder;
  42. ULONG cjFileSize; // size of font file cache
  43. PBYTE pCacheBuf; // read pointers point to the old table
  44. BOOL bReadFromRegistry;
  45. } FONTFILECACHE;
  46. VOID InitFontFileCache();
  47. FLONG GetFontFileCacheState();
  48. VOID vCloseFontFileCache();
  49. VOID FontFileCacheFault();
  50. PVOID FontFileCacheAlloc(ULONG ulSize);
  51. PVOID FontFileCacheLookUp(ULONG *pcjData);
  52. BOOL FontFileCacheReadRegistry();
  53. #if DBG
  54. class MyTimer
  55. {
  56. public:
  57. MyTimer()
  58. {
  59. // Set the timer resolution to 1ms
  60. timerOn = TRUE;
  61. if (timeBeginPeriod(1) == TIMERR_NOCANDO)
  62. {
  63. WARNING(("The multimedia timer doesn't work"));
  64. timerOn=FALSE;
  65. }
  66. start = timeGetTime();
  67. }
  68. ~MyTimer() {}
  69. DWORD GetElapsedTime(void)
  70. {
  71. DWORD elapsed = 0;
  72. if (timerOn)
  73. {
  74. end = timeGetTime();
  75. elapsed = end-start;
  76. timeEndPeriod(1);
  77. }
  78. return elapsed;
  79. }
  80. BOOL On(void)
  81. {
  82. return (timerOn);
  83. }
  84. private:
  85. BOOL timerOn;
  86. DWORD start, end;
  87. };
  88. #endif
  89. #endif