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.

143 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. COxid.hxx
  5. Abstract:
  6. CClientOxid objects represent OXIDs which are in use by one or more clients
  7. on this machine. These are referenced by
  8. is pinging the server of the OXID. These objects maybe kept around
  9. after the last client reference to improve performance.
  10. Author:
  11. Mario Goertzel [MarioGo]
  12. Revision History:
  13. MarioGo 02-16-95 Bits 'n pieces
  14. MarioGo 04-04-95 Split client and server.
  15. MarioGo 01-06-96 Locally unique IDs
  16. --*/
  17. #ifndef __COXID_HXX
  18. #define __COXID_HXX
  19. class CClientOxid : public CId2TableElement
  20. /*++
  21. Class Description:
  22. Represtents an OXID on some machine.
  23. Members:
  24. _plist - Embedded CPList element used to store CClientOxids
  25. in gpOxidPList.
  26. _oxidInfo - Static information about this OXID and its
  27. string + security bindings.
  28. _pMid - Pointer to the machine ID for this OXID, we
  29. own a reference.
  30. _fLocal - non-Zero if this OXID is on this machine. Need only 1 bit.
  31. _fApartment - non-Zero if this process is prefers apartment model.
  32. Meaning less for non-local OXIDs. Need only 1 bit.
  33. --*/
  34. {
  35. private:
  36. CPListElement _plist;
  37. OXID_INFO _oxidInfo;
  38. CMid *_pMid;
  39. USHORT _wProtseq; // 0 means local
  40. USHORT _iStringBinding; // ~0 means unknown
  41. BOOL _fApartment:8;
  42. WCHAR * _pMachineName;
  43. public:
  44. CClientOxid(OXID &oxid,
  45. CMid *pMid,
  46. USHORT wProtseq,
  47. WCHAR *pMachineName,
  48. BOOL fApartment) :
  49. CId2TableElement(oxid, pMid->Id()),
  50. _pMid(pMid), // We get a refernce.
  51. _wProtseq(wProtseq),
  52. _pMachineName(NULL),
  53. _iStringBinding(0xFFFF),
  54. _fApartment(fApartment)
  55. {
  56. WCHAR * pSB = pMid->GetStringBinding();
  57. if (pMachineName)
  58. {
  59. // use the ones passed in
  60. _pMachineName = new WCHAR[lstrlenW(pMachineName) + 1];
  61. if (_pMachineName)
  62. lstrcpyW(_pMachineName, pMachineName);
  63. }
  64. else if (pSB)
  65. {
  66. // use protseq and machine name from the mid
  67. _wProtseq = *pSB;
  68. _pMachineName = ExtractMachineName(pSB);
  69. }
  70. _oxidInfo.psa = 0;
  71. ASSERT(wProtseq != 0 || pMid->IsLocal());
  72. // ASSERT(wProtseq == 0 || pMachineName != NULL);
  73. }
  74. ~CClientOxid()
  75. {
  76. if (_pMachineName) delete [] _pMachineName;
  77. ASSERT(gpClientLock->HeldExclusive());
  78. gpClientOxidTable->Remove(this);
  79. delete _oxidInfo.psa;
  80. _pMid->Release();
  81. }
  82. ORSTATUS GetInfo(BOOL fApartment,
  83. OXID_INFO *);
  84. ORSTATUS UpdateInfo(OXID_INFO *);
  85. CMid *GetMid() {
  86. return(_pMid);
  87. }
  88. void Reference();
  89. DWORD Release();
  90. static CClientOxid *ContainingRecord(CListElement *ple) {
  91. return CONTAINING_RECORD(ple, CClientOxid, _plist);
  92. }
  93. void Insert() {
  94. gpClientOxidPList->Insert(&_plist);
  95. }
  96. CPListElement *Remove() {
  97. return(gpClientOxidPList->Remove(&_plist));
  98. }
  99. void Reset() {
  100. gpClientOxidPList->Reset(&_plist);
  101. }
  102. BOOL IsLocal() {
  103. return(_wProtseq == 0);
  104. }
  105. };
  106. #endif // __COXID_HXX