Source code of Windows XP (NT5)
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.

112 lines
4.3 KiB

  1. #include "resource.h" // main symbols
  2. #include "dplay8.h"
  3. #define typedef__dxj_DirectPlayClient IDirectPlay8Client*
  4. //Forward declare the class
  5. class C_dxj_DirectPlayClientObject;
  6. /////////////////////////////////////////////////////////////////////////////
  7. // Direct Net Peer
  8. //REVIEW -- using pointers to ID's is necessary because some compilers don't like
  9. //references as template arguments.
  10. class C_dxj_DirectPlayClientObject :
  11. #ifdef USING_IDISPATCH
  12. public CComDualImpl<I_dxj_DirectPlayClient, &IID_I_dxj_DirectPlayClient, &LIBID_DIRECTLib>,
  13. public ISupportErrorInfo,
  14. #else
  15. public I_dxj_DirectPlayClient,
  16. #endif
  17. public CComObjectRoot
  18. {
  19. public:
  20. C_dxj_DirectPlayClientObject() ;
  21. virtual ~C_dxj_DirectPlayClientObject() ;
  22. BEGIN_COM_MAP(C_dxj_DirectPlayClientObject)
  23. COM_INTERFACE_ENTRY(I_dxj_DirectPlayClient)
  24. #ifdef USING_IDISPATCH
  25. COM_INTERFACE_ENTRY(IDispatch)
  26. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  27. #endif
  28. END_COM_MAP()
  29. DECLARE_AGGREGATABLE(C_dxj_DirectPlayClientObject)
  30. #ifdef USING_IDISPATCH
  31. // ISupportsErrorInfo
  32. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  33. #endif
  34. // I_dxj_DirectPlayClient
  35. public:
  36. /* [hidden] */ HRESULT STDMETHODCALLTYPE InternalSetObject(
  37. /* [in] */ IUnknown __RPC_FAR *lpdd);
  38. /* [hidden] */ HRESULT STDMETHODCALLTYPE InternalGetObject(
  39. /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *lpdd);
  40. HRESULT STDMETHODCALLTYPE RegisterMessageHandler(I_dxj_DirectPlayEvent *event);
  41. HRESULT STDMETHODCALLTYPE EnumHosts(DPN_APPLICATION_DESC_CDESC *ApplicationDesc,I_dxj_DirectPlayAddress *AddrHost,I_dxj_DirectPlayAddress *DeviceInfo,long lRetryCount, long lRetryInterval, long lTimeOut,long lFlags, void *UserData, long UserDataSize, long *lAsync);
  42. HRESULT STDMETHODCALLTYPE GetCountServiceProviders(long lFlags, long *ret);
  43. HRESULT STDMETHODCALLTYPE GetServiceProvider(long lIndex, DPN_SERVICE_PROVIDER_INFO_CDESC *ret);
  44. HRESULT STDMETHODCALLTYPE CancelAsyncOperation(long lAsyncHandle, long lFlags);
  45. HRESULT STDMETHODCALLTYPE Connect(DPN_APPLICATION_DESC_CDESC *AppDesc,I_dxj_DirectPlayAddress *Address,I_dxj_DirectPlayAddress *DeviceInfo, long lFlags, void *UserData, long UserDataSize, long *hAsyncHandle);
  46. HRESULT STDMETHODCALLTYPE Send(SAFEARRAY **Buffer, long lTimeOut,long lFlags, long *hAsyncHandle);
  47. HRESULT STDMETHODCALLTYPE GetSendQueueInfo(long *lNumMsgs, long *lNumBytes, long lFlags);
  48. HRESULT STDMETHODCALLTYPE GetApplicationDesc(long lFlags, DPN_APPLICATION_DESC_CDESC *ret);
  49. HRESULT STDMETHODCALLTYPE SetClientInfo(DPN_PLAYER_INFO_CDESC *PlayerInfo,long lFlags, long *hAsyncHandle);
  50. HRESULT STDMETHODCALLTYPE GetServerInfo(long lFlags, DPN_PLAYER_INFO_CDESC *layerInfo);
  51. HRESULT STDMETHODCALLTYPE Close(long lFlags);
  52. HRESULT STDMETHODCALLTYPE ReturnBuffer(long lBufferHandle);
  53. HRESULT STDMETHODCALLTYPE GetCaps(long lFlags, DPNCAPS_CDESC *ret);
  54. HRESULT STDMETHODCALLTYPE SetCaps(DPNCAPS_CDESC *Caps, long lFlags);
  55. HRESULT STDMETHODCALLTYPE RegisterLobby(long dpnHandle, I_dxj_DirectPlayLobbiedApplication *LobbyApp, long lFlags);
  56. HRESULT STDMETHODCALLTYPE GetConnectionInfo(long lFlags, DPN_CONNECTION_INFO_CDESC *pdpConnectionInfo);
  57. HRESULT STDMETHODCALLTYPE GetServerAddress(long lFlags, I_dxj_DirectPlayAddress **pAddress);
  58. HRESULT STDMETHODCALLTYPE SetSPCaps(BSTR guidSP, DPN_SP_CAPS_CDESC *spCaps, long lFlags);
  59. HRESULT STDMETHODCALLTYPE GetSPCaps(BSTR guidSP, long lFlags, DPN_SP_CAPS_CDESC *spCaps);
  60. HRESULT STDMETHODCALLTYPE GetUserData(void *UserData, long *UserDataSize);
  61. HRESULT STDMETHODCALLTYPE UnRegisterMessageHandler();
  62. ////////////////////////////////////////////////////////////////////////
  63. //
  64. // note: this is public for the callbacks
  65. DECL_VARIABLE(_dxj_DirectPlayClient);
  66. private:
  67. DPN_SERVICE_PROVIDER_INFO *m_SPInfo;
  68. DWORD m_dwSPCount;
  69. BOOL m_fInit;
  70. HRESULT STDMETHODCALLTYPE GetSP(long lFlags);
  71. HRESULT STDMETHODCALLTYPE FlushBuffer(LONG dwNumMessagesLeft);
  72. public:
  73. DX3J_GLOBAL_LINKS(_dxj_DirectPlayClient);
  74. DWORD InternalAddRef();
  75. DWORD InternalRelease();
  76. // We need these for our user data vars
  77. void *m_pUserData;
  78. DWORD m_dwUserDataSize;
  79. // For our reply data
  80. void *m_pReplyData;
  81. DWORD m_dwReplyDataSize;
  82. BOOL m_fHandleEvents;
  83. IStream *m_pEventStream;
  84. //We need to keep a count of the messages
  85. LONG m_dwMsgCount;
  86. };