Source code of Windows XP (NT5)
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.

76 lines
1.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997.
  5. //
  6. // File: svrcache.hxx
  7. //
  8. // Contents: Server cache class
  9. //
  10. // Functions:
  11. //
  12. // History: 15-Apr-97 SophiaC Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #ifndef __SERVER_CACHE__HXX__
  16. #define __SERVER_CACHE__HXX__
  17. class SERVER_CACHE;
  18. class SERVER_CACHE_ITEM
  19. {
  20. friend class SERVER_CACHE;
  21. int key;
  22. public:
  23. LPWSTR ServerName;
  24. IMSAdminBase * pAdminBase;
  25. IIsSchema * pSchema;
  26. DWORD dwThreadId;
  27. SERVER_CACHE_ITEM(LPWSTR a,
  28. IMSAdminBase * b,
  29. IIsSchema * c,
  30. DWORD dwId,
  31. BOOL & Success
  32. ) :
  33. pAdminBase(b),
  34. pSchema(c),
  35. dwThreadId(dwId)
  36. {
  37. Success = TRUE;
  38. ServerName = new WCHAR[wcslen(a)+1];
  39. if (NULL == ServerName)
  40. {
  41. Success = FALSE;
  42. return;
  43. }
  44. if (NULL == wcscpy(ServerName, a))
  45. {
  46. Success = FALSE;
  47. return;
  48. }
  49. }
  50. VOID UpdateAdminBase(IMSAdminBase *b, DWORD dwId) {
  51. dwThreadId = dwId;
  52. pAdminBase = b;
  53. }
  54. VOID UpdateSchema(IIsSchema *c) {
  55. pSchema = c;
  56. }
  57. };
  58. NEW_SDICT(SERVER_CACHE_ITEM);
  59. class SERVER_CACHE
  60. {
  61. SERVER_CACHE_ITEM_DICT Cache;
  62. public:
  63. BOOL Insert(SERVER_CACHE_ITEM * item);
  64. SERVER_CACHE_ITEM * Delete(LPWSTR ServerName, DWORD dwId);
  65. SERVER_CACHE_ITEM * Find(LPWSTR ServerName, DWORD dwId);
  66. };
  67. #endif