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.

130 lines
3.5 KiB

  1. #ifndef _TUNK_
  2. #define _TUNK_
  3. STDAPI CoGetCallerTID(DWORD *pTIDCaller);
  4. STDAPI CoGetCurrentLogicalThreadId(GUID *pguid);
  5. #include <icube.h>
  6. class CTestUnk : public IParseDisplayName, public IOleWindow,
  7. public IAdviseSink
  8. {
  9. public:
  10. CTestUnk(void);
  11. // IUnknown
  12. STDMETHOD(QueryInterface)(REFIID iid, void FAR * FAR * ppv);
  13. STDMETHOD_(ULONG, AddRef)(void);
  14. STDMETHOD_(ULONG, Release)(void);
  15. // IParseDisplayName
  16. STDMETHODIMP ParseDisplayName(LPBC pbc, LPOLESTR lpszDisplayName,
  17. ULONG *pchEaten, LPMONIKER *ppmkOut);
  18. // IOleWinodw methods
  19. STDMETHODIMP GetWindow(HWND *phwnd);
  20. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  21. // IAdviseSink
  22. STDMETHOD_(void, OnDataChange)(FORMATETC *pFormatetc,
  23. STGMEDIUM *pStgmed);
  24. STDMETHOD_(void, OnViewChange)(DWORD dwAspect,
  25. LONG lindex);
  26. STDMETHOD_(void, OnRename)(IMoniker *pmk);
  27. STDMETHOD_(void, OnSave)();
  28. STDMETHOD_(void, OnClose)();
  29. private:
  30. ~CTestUnk(void);
  31. ULONG _cRefs;
  32. };
  33. // A new instance of this object gets created each time the caller
  34. // does a QI for ICube on the CTestUnk object above (or on the ICube
  35. // interface iteself). The reason for this is to test that the remoting
  36. // layer supports this capability correctly.
  37. class CTestUnkCube : public ICube
  38. {
  39. public:
  40. CTestUnkCube(IUnknown *pUnkCtrl);
  41. // IUnknown
  42. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  43. STDMETHODIMP_(ULONG) AddRef(void);
  44. STDMETHODIMP_(ULONG) Release(void);
  45. // ICube implementation
  46. STDMETHODIMP MoveCube(ULONG xPos, ULONG yPos);
  47. STDMETHODIMP GetCubePos(ULONG *xPos, ULONG *yPos);
  48. STDMETHODIMP Contains(IBalls *pIFDb);
  49. STDMETHODIMP SimpleCall(DWORD pid, DWORD tid, GUID lidCaller);
  50. STDMETHODIMP PrepForInputSyncCall(IUnknown *pUnkIn);
  51. STDMETHODIMP InputSyncCall();
  52. private:
  53. ~CTestUnkCube(void);
  54. ULONG _cRefs;
  55. IUnknown *_pUnkCtrl;
  56. IUnknown *_pUnkIn;
  57. };
  58. class CTestUnkCF : public IClassFactory
  59. {
  60. public:
  61. CTestUnkCF(void);
  62. // IUnknown
  63. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  64. STDMETHODIMP_(ULONG) AddRef(void);
  65. STDMETHODIMP_(ULONG) Release(void);
  66. // IClassFactory
  67. STDMETHOD(CreateInstance)(IUnknown *punkOuter,
  68. REFIID riid,
  69. void **ppunkObject);
  70. STDMETHOD(LockServer)(BOOL fLock);
  71. private:
  72. ULONG _cRefs;
  73. };
  74. class CTestUnkMarshal : public IMarshal
  75. {
  76. public:
  77. CTestUnkMarshal(void);
  78. // IUnknown
  79. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  80. STDMETHODIMP_(ULONG) AddRef(void);
  81. STDMETHODIMP_(ULONG) Release(void);
  82. // IMarshal - IUnknown taken from derived classes
  83. STDMETHOD(GetUnmarshalClass)(REFIID riid, LPVOID pv, DWORD dwDestCtx,
  84. LPVOID pvDestCtx, DWORD mshlflags, LPCLSID pClsid);
  85. STDMETHOD(GetMarshalSizeMax)(REFIID riid, LPVOID pv, DWORD dwDestCtx,
  86. LPVOID pvDestCtx, DWORD mshlflags, LPDWORD pSize);
  87. STDMETHOD(MarshalInterface)(LPSTREAM pStm, REFIID riid, LPVOID pv,
  88. DWORD dwDestCtx, LPVOID pvDestCtx, DWORD mshlflags);
  89. STDMETHOD(UnmarshalInterface)(LPSTREAM pStm, REFIID riid, LPVOID *ppv);
  90. STDMETHOD(ReleaseMarshalData)(LPSTREAM pStm);
  91. STDMETHOD(DisconnectObject)(DWORD dwReserved);
  92. private:
  93. IMarshal *GetStdMarshal(void);
  94. ~CTestUnkMarshal(void);
  95. ULONG _cRefs;
  96. IMarshal *_pIM;
  97. };
  98. #endif // _TUNK_