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.

104 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: TLSTHK.hxx
  7. //
  8. // Contents: Thunk routine utilities for tls
  9. //
  10. // History: 05-May-94 JohannP Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __TLSTHK_HXX__
  14. #define __TLSTHK_HXX__
  15. //
  16. // The following structures are used by CoRegisterClassObjectDelayed
  17. //
  18. typedef struct tagDelayedRegistration
  19. {
  20. CLSID _clsid;
  21. DWORD _dwRealKey;
  22. LPUNKNOWN _punk;
  23. DWORD _dwClsContext;
  24. DWORD _flags;
  25. } DelayRegistration;
  26. #define MAX_DELAYED_REGISTRATIONS 8
  27. typedef struct tagDelayedRegistrationTable
  28. {
  29. tagDelayedRegistrationTable()
  30. {
  31. memset(&_Entries,0,sizeof(_Entries));
  32. }
  33. DelayRegistration _Entries[MAX_DELAYED_REGISTRATIONS];
  34. } DelayedRegistrationTable;
  35. //
  36. // This is the struct for pUnkOuter holders (used in Aggregation cases)
  37. //
  38. struct SAggHolder
  39. {
  40. PROXYHOLDER *pph;
  41. struct SAggHolder *next;
  42. };
  43. //
  44. // This is the per thread thunk manager state
  45. //
  46. typedef struct tagThreadData
  47. {
  48. tagThreadData(DWORD cbBlock16,
  49. DWORD cbAlign16,
  50. DWORD cbBlock32,
  51. DWORD cbAlign32)
  52. : sa16(&mmodel16Owned, cbBlock16, cbAlign16),
  53. sa32(&mmodel32, cbBlock32, cbAlign32),pDelayedRegs(NULL)
  54. {
  55. }
  56. CStackAllocator sa16;
  57. CStackAllocator sa32;
  58. CThkMgr *pCThkMgr;
  59. DWORD dwAppCompatFlags;
  60. SAggHolder* pAggHolderList;
  61. DelayedRegistrationTable *pDelayedRegs;
  62. } ThreadData, *PThreadData;
  63. HRESULT TlsThkInitialize();
  64. void TlsThkUninitialize();
  65. BOOL TlsThkAlloc();
  66. void TlsThkFree();
  67. #if DBG == 1
  68. PThreadData TlsThkGetData(void);
  69. #else
  70. extern DWORD dwTlsThkIndex;
  71. #define TlsThkGetData() ((PThreadData)TlsGetValue(dwTlsThkIndex))
  72. #endif
  73. #define TlsThkGetStack16() (&TlsThkGetData()->sa16)
  74. #define TlsThkGetStack32() (&TlsThkGetData()->sa32)
  75. #define TlsThkGetThkMgr() (TlsThkGetData()->pCThkMgr)
  76. #define TlsThkSetThkMgr(ptm) ((TlsThkGetData()->pCThkMgr) = (ptm))
  77. #define TlsThkGetAppCompatFlags() (TlsThkGetData()->dwAppCompatFlags)
  78. #define TlsThkSetAppCompatFlags(dw) \
  79. ((TlsThkGetData()->dwAppCompatFlags) = (dw))
  80. #define TlsThkGetAggHolderList() ((TlsThkGetData())->pAggHolderList)
  81. #define TlsThkSetAggHolderList(pNode) ( ((TlsThkGetData())->pAggHolderList) = (pNode))
  82. void TlsThkLinkAggHolder(SAggHolder *);
  83. SAggHolder* TlsThkGetAggHolder(void);
  84. void TlsThkUnlinkAggHolder(void);
  85. #endif // #ifndef __TLSTHK_HXX__