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.

70 lines
1.8 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. DWORD dwThreadId;
  26. SERVER_CACHE_ITEM(LPWSTR a,
  27. IMSAdminBase * b,
  28. DWORD dwId,
  29. BOOL & Success
  30. ) :
  31. pAdminBase(b),
  32. dwThreadId(dwId)
  33. {
  34. Success = TRUE;
  35. ServerName = new WCHAR[wcslen(a)+1];
  36. if (NULL == ServerName)
  37. {
  38. Success = FALSE;
  39. return;
  40. }
  41. if (NULL == wcscpy(ServerName, a))
  42. {
  43. Success = FALSE;
  44. return;
  45. }
  46. }
  47. VOID UpdateAdminBase(IMSAdminBase *b, DWORD dwId) {
  48. dwThreadId = dwId;
  49. pAdminBase = b;
  50. }
  51. };
  52. NEW_SDICT(SERVER_CACHE_ITEM);
  53. class SERVER_CACHE
  54. {
  55. SERVER_CACHE_ITEM_DICT Cache;
  56. public:
  57. BOOL Insert(SERVER_CACHE_ITEM * item);
  58. SERVER_CACHE_ITEM * Delete(LPWSTR ServerName, DWORD dwId);
  59. SERVER_CACHE_ITEM * Find(LPWSTR ServerName, DWORD dwId);
  60. };
  61. #endif