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.

96 lines
3.0 KiB

  1. /****************************************************************************/
  2. // chdisp.h
  3. //
  4. // Cache Handler display driver specific header
  5. //
  6. // (C) 1997-2000 Microsoft Corp.
  7. /****************************************************************************/
  8. #ifndef _H_CHDISP
  9. #define _H_CHDISP
  10. #include <achapi.h>
  11. #include <cbchash.h>
  12. /*
  13. * Prototypes.
  14. */
  15. void RDPCALL CH_InitCache(
  16. PCHCACHEDATA pCacheData,
  17. unsigned NumEntries,
  18. void *pContext,
  19. BOOLEAN bNotifyRemoveLRU,
  20. BOOLEAN bQueryRemoveLRU,
  21. CHCACHECALLBACK pfnCacheCallback);
  22. BOOLEAN RDPCALL CH_SearchCache(
  23. CHCACHEHANDLE hCache,
  24. UINT32 Key1,
  25. UINT32 Key2,
  26. void **pUserDefined,
  27. unsigned *piCacheEntry);
  28. unsigned RDPCALL CH_CacheKey(
  29. CHCACHEHANDLE hCache,
  30. UINT32 Key1,
  31. UINT32 Key2,
  32. void *UserDefined);
  33. void RDPCALL CH_ForceCacheKeyAtIndex(
  34. CHCACHEHANDLE hCache,
  35. unsigned CacheEntryIndex,
  36. UINT32 Key1,
  37. UINT32 Key2,
  38. void *UserDefined);
  39. void RDPCALL CH_RemoveCacheEntry(CHCACHEHANDLE hCache, unsigned CacheEntryIndex);
  40. void RDPCALL CH_ClearCache(CHCACHEHANDLE hCache);
  41. UINT RDPCALL CH_CalculateCacheSize(UINT cacheEntries);
  42. void RDPCALL CH_TouchCacheEntry(CHCACHEHANDLE hCache, unsigned CacheEntryIndex);
  43. unsigned RDPCALL CH_GetLRUCacheEntry(CHCACHEHANDLE hCache);
  44. /****************************************************************************/
  45. // Generates a cache key for the given data. The First function is for the
  46. // 1st block in a series, the Next for the next in the series. We wrap the
  47. // CBC64 functions in order to provide asserts.
  48. /****************************************************************************/
  49. typedef CBC64Context CHDataKeyContext;
  50. //__inline void __fastcall CH_CreateKeyFromFirstData(
  51. // CHDataKeyContext *pContext,
  52. // BYTE *pData,
  53. // unsigned DataSize)
  54. #define CH_CreateKeyFromFirstData(pContext, pData, DataSize) \
  55. { \
  56. TRC_ASSERT((((UINT_PTR)(pData) % sizeof(UINT32)) == 0), \
  57. (TB,"Data pointer not DWORD aligned")); \
  58. TRC_ASSERT(((DataSize % sizeof(UINT32)) == 0), \
  59. (TB,"Data size not multiple of DWORD")); \
  60. \
  61. FirstCBC64((pContext), (UINT32 *)(pData), (DataSize) / sizeof(UINT32)); \
  62. }
  63. //__inline void __fastcall CH_CreateKeyFromNextData(
  64. // CHDataKeyContext *pContext,
  65. // BYTE *pData,
  66. // unsigned DataSize)
  67. #define CH_CreateKeyFromNextData(pContext, pData, DataSize) \
  68. { \
  69. TRC_ASSERT((((UINT_PTR)(pData) % sizeof(UINT32)) == 0), \
  70. (TB,"Data pointer not DWORD aligned")); \
  71. TRC_ASSERT(((DataSize % sizeof(UINT32)) == 0), \
  72. (TB,"Data size not multiple of DWORD")); \
  73. \
  74. NextCBC64((pContext), (UINT32 *)(pData), (DataSize) / sizeof(UINT32)); \
  75. }
  76. #endif // _H_CHDISP