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.

152 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. soxid.hxx
  5. Abstract:
  6. CServerOxid objects represent OXIDs which are owned (registered) by processes
  7. on this machine. These always contain a pointer to a local process and may not
  8. be deleted until the local process has exited and all CServerOids have released
  9. them.
  10. Author:
  11. Mario Goertzel [MarioGo]
  12. Revision History:
  13. MarioGo 02-16-95 Bits 'n pieces
  14. MarioGo 04-03-95 Split client and server
  15. --*/
  16. #ifndef __SOXID_HXX
  17. #define __SOXID_HXX
  18. class CServerOxid : public CIdTableElement
  19. /*++
  20. Class Description:
  21. Each instance of this class represents an OXID (object exporter,
  22. a process or an apartment model thread). Each OXID is owned,
  23. referenced, by the owning process and the OIDs registered by
  24. that process for this OXID.
  25. Members:
  26. _pProcess - Pointer to the process instance which owns this oxid.
  27. _dwRundownCallsInProgress - # of currently running async rundown
  28. calls to this oxid.
  29. _hRpcRundownHandle - rpc handle used for making rundown calls. All
  30. outstanding rundown calls use this handle. When no calls are
  31. running the handle is closed.
  32. _info - Info registered by the process for this oxid.
  33. _fApartment - Server is aparment model if non-zero
  34. _fRunning - Process has not released this oxid if non-zero.
  35. _fRundownInProgress - TRUE if an asynchronous rundown call is
  36. currently in-progress, FALSE otherwise.
  37. --*/
  38. {
  39. friend CProcess;
  40. private:
  41. CProcess *_pProcess;
  42. DWORD _dwRundownCallsInProgress;
  43. RPC_BINDING_HANDLE _hRpcRundownHandle;
  44. OXID_INFO _info;
  45. BOOL _fApartment:1;
  46. BOOL _fRunning:1;
  47. RPC_STATUS EnsureRundownHandle();
  48. void ReleaseRundownHandle();
  49. static DWORD WINAPI RundownHelperThreadProc(LPVOID pv);
  50. public:
  51. CServerOxid(CProcess *pProcess,
  52. BOOL fApartment,
  53. OXID_INFO *poxidInfo,
  54. ID id) :
  55. CIdTableElement(id),
  56. _pProcess(pProcess),
  57. _dwRundownCallsInProgress(0),
  58. _hRpcRundownHandle(NULL),
  59. _fApartment(fApartment),
  60. _fRunning(TRUE)
  61. {
  62. _info.dwTid = poxidInfo->dwTid;
  63. _info.dwPid = poxidInfo->dwPid;
  64. _info.dwAuthnHint = poxidInfo->dwAuthnHint;
  65. _info.version = poxidInfo->version;
  66. _info.ipidRemUnknown = poxidInfo->ipidRemUnknown;
  67. _info.psa = 0;
  68. _pProcess->Reference();
  69. }
  70. ~CServerOxid(void);
  71. void ProcessRundownResults(ULONG cOids,
  72. CServerOid* aOids[],
  73. BYTE aRundownStatus[]);
  74. DWORD GetTid() {
  75. return(_info.dwTid);
  76. }
  77. BOOL IsRunning() {
  78. return(_fRunning);
  79. }
  80. BOOL Apartment() {
  81. return(_fApartment);
  82. }
  83. BOOL OkayForMoreRundownCalls() {
  84. return (_dwRundownCallsInProgress < MAX_SIMULTANEOUS_RUNDOWNS_PER_APT);
  85. }
  86. ORSTATUS GetInfo(OXID_INFO *,
  87. BOOL fLocal);
  88. IPID GetIPID() {
  89. return _info.ipidRemUnknown;
  90. }
  91. void RundownOids(ULONG cOids,
  92. CServerOid* aOids[]);
  93. ORSTATUS GetRemoteInfo(OXID_INFO *,
  94. USHORT,
  95. USHORT[]);
  96. ORSTATUS LazyUseProtseq(USHORT, USHORT[]);
  97. protected:
  98. void ProcessRelease(void);
  99. void ProcessRundownResultsInternal(BOOL fAsyncReturn,
  100. ULONG cOids,
  101. CServerOid* aOids[],
  102. BYTE aRundownStatus[]);
  103. };
  104. #endif // __SOXID_HXX