dplobby8.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:19k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*==========================================================================
  2.  *
  3.  *  Copyright (C) 2000 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       DPLobby.h
  6.  *  Content:    DirectPlay8 Lobby Include File
  7.  *
  8.  ***************************************************************************/
  9. #ifndef __DPLOBBY_H__
  10. #define __DPLOBBY_H__
  11. #include <ole2.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /****************************************************************************
  16.  *
  17.  * DirectPlay8Lobby CLSIDs
  18.  *
  19.  ****************************************************************************/
  20. // {667955AD-6B3B-43ca-B949-BC69B5BAFF7F}
  21. DEFINE_GUID(CLSID_DirectPlay8LobbiedApplication, 
  22. 0x667955ad, 0x6b3b, 0x43ca, 0xb9, 0x49, 0xbc, 0x69, 0xb5, 0xba, 0xff, 0x7f);
  23. // {3B2B6775-70B6-45af-8DEA-A209C69559F3}
  24. DEFINE_GUID(CLSID_DirectPlay8LobbyClient, 
  25. 0x3b2b6775, 0x70b6, 0x45af, 0x8d, 0xea, 0xa2, 0x9, 0xc6, 0x95, 0x59, 0xf3);
  26. /****************************************************************************
  27.  *
  28.  * DirectPlay8Lobby Interface IIDs
  29.  *
  30.  ****************************************************************************/
  31. // {819074A3-016C-11d3-AE14-006097B01411}
  32. DEFINE_GUID(IID_IDirectPlay8LobbiedApplication,
  33. 0x819074a3, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11);
  34. // {819074A2-016C-11d3-AE14-006097B01411}
  35. DEFINE_GUID(IID_IDirectPlay8LobbyClient,
  36. 0x819074a2, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11);
  37. /****************************************************************************
  38.  *
  39.  * DirectPlay8Lobby Interface Pointer 
  40.  *
  41.  ****************************************************************************/
  42. typedef struct IDirectPlay8LobbiedApplication *PDIRECTPLAY8LOBBIEDAPPLICATION;
  43. typedef struct IDirectPlay8LobbyClient     *PDIRECTPLAY8LOBBYCLIENT;
  44. /****************************************************************************
  45.  *
  46.  * DirectPlay8 Lobby Message IDs
  47.  *
  48.  ****************************************************************************/
  49. #define DPL_MSGID_LOBBY 0x8000
  50. #define DPL_MSGID_RECEIVE (0x0001 | DPL_MSGID_LOBBY)
  51. #define DPL_MSGID_CONNECT (0x0002 | DPL_MSGID_LOBBY)
  52. #define DPL_MSGID_DISCONNECT (0x0003 | DPL_MSGID_LOBBY)
  53. #define DPL_MSGID_SESSION_STATUS (0x0004 | DPL_MSGID_LOBBY)
  54. #define DPL_MSGID_CONNECTION_SETTINGS       (0x0005 | DPL_MSGID_LOBBY)
  55. /****************************************************************************
  56.  *
  57.  * DirectPlay8Lobby Constants
  58.  *
  59.  ****************************************************************************/
  60. //
  61. // Specifies that operation should be performed on all open connections
  62. //
  63. #define DPLHANDLE_ALLCONNECTIONS 0xFFFFFFFF
  64. // 
  65. // The associated game session has suceeded in connecting / hosting
  66. //
  67. #define DPLSESSION_CONNECTED 0x0001
  68. // The associated game session failed connecting / hosting
  69. //
  70. #define DPLSESSION_COULDNOTCONNECT 0x0002
  71. //
  72. // The associated game session has disconnected
  73. //
  74. #define DPLSESSION_DISCONNECTED 0x0003
  75. //
  76. // The associated game session has terminated 
  77. //
  78. #define DPLSESSION_TERMINATED 0x0004
  79. // 
  80. // The associated game session's host has migrated 
  81. //
  82. #define DPLSESSION_HOSTMIGRATED 0x0005
  83. //
  84. // The associated game session's host has migrated to the local client
  85. //
  86. #define DPLSESSION_HOSTMIGRATEDHERE 0x0006
  87. /****************************************************************************
  88.  *
  89.  * DirectPlay8 Lobby Flags
  90.  *
  91.  ****************************************************************************/
  92. //
  93. // Do not automatically make the lobby app unavailable when a connection is established
  94. //
  95. #define DPLAVAILABLE_ALLOWMULTIPLECONNECT   0x0001
  96. //
  97. // Launch a new instance of the application to connect to
  98. // 
  99. #define DPLCONNECT_LAUNCHNEW 0x0001
  100. // 
  101. // Launch a new instance of the application if one is not waiting
  102. //
  103. #define DPLCONNECT_LAUNCHNOTFOUND 0x0002
  104. //
  105. // When starting the associated game session, start it as a host
  106. //
  107. #define DPLCONNECTSETTINGS_HOST             0x0001
  108. // 
  109. // Disable parameter validation
  110. //
  111. #define DPLINITIALIZE_DISABLEPARAMVAL 0x0001
  112. /****************************************************************************
  113.  *
  114.  * DirectPlay8Lobby Structures (Non-Message)
  115.  *
  116.  ****************************************************************************/
  117. // 
  118. // Information on a registered game
  119. //
  120. typedef struct _DPL_APPLICATION_INFO {
  121. GUID guidApplication;            // GUID of the application
  122. PWSTR pwszApplicationName;        // Name of the application
  123. DWORD dwNumRunning;               // # of instances of this application running
  124. DWORD dwNumWaiting;               // # of instances of this application waiting 
  125. DWORD dwFlags;                    // Flags
  126. } DPL_APPLICATION_INFO,  *PDPL_APPLICATION_INFO;
  127. //
  128. // Settings to be used for connecting / hosting a game session
  129. //
  130. typedef struct _DPL_CONNECTION_SETTINGS {
  131.     DWORD                   dwSize;                 // Size of this structure
  132.     DWORD                   dwFlags;                // Connection settings flags (DPLCONNECTSETTINGS_...)
  133.     DPN_APPLICATION_DESC    dpnAppDesc;             // Application desc for the associated DirectPlay session
  134.     IDirectPlay8Address     *pdp8HostAddress;       // Address of host to connect to
  135.     IDirectPlay8Address     **ppdp8DeviceAddresses; // Address of device to connect from / host on
  136.     DWORD                   cNumDeviceAddresses;    // # of addresses specified in ppdp8DeviceAddresses
  137. PWSTR pwszPlayerName;         // Name to give the player
  138. } DPL_CONNECTION_SETTINGS, *PDPL_CONNECTION_SETTINGS;
  139. //
  140. // Information for performing a lobby connect
  141. // (ConnectApplication)
  142. //
  143. typedef struct _DPL_CONNECT_INFO {
  144. DWORD                     dwSize;             // Size of this structure
  145. DWORD                     dwFlags;            // Flags (DPLCONNECT_...)
  146. GUID                     guidApplication;    // GUID of application to launch
  147.     PDPL_CONNECTION_SETTINGS pdplConnectionSettings;
  148.                                                     // Settings application should use
  149. PVOID                     pvLobbyConnectData; // User defined data block
  150. DWORD                     dwLobbyConnectDataSize;
  151.                                                     // Size of user defined data block
  152. } DPL_CONNECT_INFO,  *PDPL_CONNECT_INFO;
  153. //
  154. // Information for registering an application
  155. // (RegisterApplication)
  156. //
  157. typedef struct  _DPL_PROGRAM_DESC {
  158. DWORD dwSize;
  159. DWORD dwFlags;
  160. GUID guidApplication;                 // Application GUID
  161. PWSTR pwszApplicationName;                 // Unicode application name
  162. PWSTR pwszCommandLine;                 // Unicode command line arguments
  163. PWSTR pwszCurrentDirectory;                // Unicode current directory
  164. PWSTR pwszDescription;                 // Unicode application description
  165. PWSTR pwszExecutableFilename;                 // Unicode filename of application executable
  166. PWSTR pwszExecutablePath;                 // Unicode path of application executable
  167. PWSTR pwszLauncherFilename;                 // Unicode filename of launcher executable
  168. PWSTR pwszLauncherPath;                 // Unicode path of launcher executable
  169. } DPL_PROGRAM_DESC, *PDPL_PROGRAM_DESC;
  170. /****************************************************************************
  171.  *
  172.  * DirectPlay8 Lobby Message Structures
  173.  *
  174.  ****************************************************************************/
  175. //
  176. // A connection was established 
  177. // (DPL_MSGID_CONNECT)
  178. //
  179. typedef struct _DPL_MESSAGE_CONNECT
  180. {
  181. DWORD                 dwSize;                     // Size of this structure
  182. DPNHANDLE                 hConnectId;                 // Handle of new connection
  183.     PDPL_CONNECTION_SETTINGS pdplConnectionSettings;     // Connection settings for this connection
  184. PVOID                 pvLobbyConnectData;         // User defined lobby data block
  185. DWORD                 dwLobbyConnectDataSize;     // Size of user defined lobby data block
  186. PVOID pvConnectionContext;        // Context value for this connection (user set)
  187. } DPL_MESSAGE_CONNECT, *PDPL_MESSAGE_CONNECT;
  188. // 
  189. // Connection settings have been updated
  190. // (DPL_MSGID_CONNECTION_SETTINGS)
  191. //
  192. typedef struct _DPL_MESSAGE_CONNECTION_SETTINGS
  193. {
  194.     DWORD                       dwSize;                     // Size of this structure
  195.     DPNHANDLE                   hSender;                    // Handle of the connection for these settings
  196.     PDPL_CONNECTION_SETTINGS    pdplConnectionSettings;     // Connection settings
  197. PVOID     pvConnectionContext;        // Context value for this connection
  198. } DPL_MESSAGE_CONNECTION_SETTINGS, *PDPL_MESSAGE_CONNECTION_SETTINGS;
  199. //
  200. // A connection has been disconnected
  201. // (DPL_MSGID_DISCONNECT)
  202. //
  203. typedef struct _DPL_MESSAGE_DISCONNECT
  204. {
  205. DWORD dwSize;                                     // Size of this structure
  206. DPNHANDLE hDisconnectId;                              // Handle of the connection that was terminated
  207. HRESULT     hrReason;                                   // Reason the connection was broken
  208. PVOID pvConnectionContext;                        // Context value for this connection
  209. } DPL_MESSAGE_DISCONNECT, *PDPL_MESSAGE_DISCONNECT;
  210. //
  211. // Data was received through a connection
  212. // (DPL_MSGID_RECEIVE)
  213. //
  214. typedef struct _DPL_MESSAGE_RECEIVE
  215. {
  216. DWORD dwSize;                                     // Size of this structure
  217. DPNHANDLE hSender;                                    // Handle of the connection that is from
  218. BYTE *pBuffer;                                   // Contents of the message
  219. DWORD dwBufferSize;                               // Size of the message context 
  220. PVOID pvConnectionContext;                        // Context value for this connection
  221. } DPL_MESSAGE_RECEIVE, *PDPL_MESSAGE_RECEIVE;
  222. //
  223. // Current status of the associated connection
  224. // (DPL_MSGID_SESSION_STATUS)
  225. //
  226. typedef struct _DPL_MESSAGE_SESSION_STATUS
  227. {
  228. DWORD dwSize;                                     // Size of this structure
  229. DPNHANDLE hSender;                                    // Handle of the connection that this is from
  230. DWORD dwStatus;                                   // Status (DPLSESSION_...)
  231. PVOID pvConnectionContext;                        // Context value for this connection
  232. } DPL_MESSAGE_SESSION_STATUS, *PDPL_MESSAGE_SESSION_STATUS;
  233. /****************************************************************************
  234.  *
  235.  * DirectPlay8Lobby Create
  236.  *
  237.  ****************************************************************************/
  238.  
  239. /*
  240.  * This function is no longer supported.  It is recommended that CoCreateInstance be used to create 
  241.  * DirectPlay8 lobby objects. 
  242.  *
  243.  * extern HRESULT WINAPI DirectPlay8LobbyCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
  244.  *
  245.  */
  246. /****************************************************************************
  247.  *
  248.  * DirectPlay8 Functions
  249.  *
  250.  ****************************************************************************/
  251. //
  252. // COM definition for DirectPlayLobbyClient
  253. //
  254. #undef INTERFACE // External COM Implementation
  255. #define INTERFACE IDirectPlay8LobbyClient
  256. DECLARE_INTERFACE_(IDirectPlay8LobbyClient,IUnknown)
  257. {
  258.     // IUnknown methods
  259. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
  260. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  261. STDMETHOD_(ULONG,Release) (THIS) PURE;
  262.     // IDirectPlayLobbyClient methods
  263. STDMETHOD(Initialize)             (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,const DWORD dwFlags) PURE;
  264. STDMETHOD(EnumLocalPrograms) (THIS_ GUID *const pGuidApplication,BYTE *const pEnumData,DWORD *const pdwEnumData,DWORD *const pdwItems, const DWORD dwFlags) PURE;
  265. STDMETHOD(ConnectApplication) (THIS_ DPL_CONNECT_INFO *const pdplConnectionInfo,const PVOID pvConnectionContext,DPNHANDLE *const hApplication,const DWORD dwTimeOut,const DWORD dwFlags) PURE;
  266. STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE;
  267. STDMETHOD(ReleaseApplication) (THIS_ const DPNHANDLE hConnection, const DWORD dwFlags ) PURE;
  268. STDMETHOD(Close)     (THIS_ const DWORD dwFlags ) PURE;
  269. STDMETHOD(GetConnectionSettings)    (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE;
  270. STDMETHOD(SetConnectionSettings)    (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE;
  271. };
  272. //
  273. // COM definition for DirectPlayLobbiedApplication
  274. //
  275. #undef INTERFACE // External COM Implementation
  276. #define INTERFACE IDirectPlay8LobbiedApplication
  277. DECLARE_INTERFACE_(IDirectPlay8LobbiedApplication,IUnknown)
  278. {
  279.     // IUnknown methods
  280. STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
  281. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  282. STDMETHOD_(ULONG,Release) (THIS) PURE;
  283.     // IDirectPlayLobbiedApplication methods
  284. STDMETHOD(Initialize)             (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,DPNHANDLE * const pdpnhConnection, const DWORD dwFlags) PURE;
  285. STDMETHOD(RegisterProgram) (THIS_ PDPL_PROGRAM_DESC pdplProgramDesc,const DWORD dwFlags) PURE;
  286. STDMETHOD(UnRegisterProgram) (THIS_ GUID *pguidApplication,const DWORD dwFlags) PURE;
  287. STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE;
  288. STDMETHOD(SetAppAvailable) (THIS_ const BOOL fAvailable, const DWORD dwFlags ) PURE;
  289. STDMETHOD(UpdateStatus) (THIS_ const DPNHANDLE hConnection, const DWORD dwStatus, const DWORD dwFlags ) PURE;
  290. STDMETHOD(Close)     (THIS_ const DWORD dwFlags ) PURE;
  291. STDMETHOD(GetConnectionSettings)    (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE;
  292. STDMETHOD(SetConnectionSettings)    (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE;
  293. };
  294. /****************************************************************************
  295.  *
  296.  * DirectPlayLobby Interface Macros
  297.  *
  298.  ****************************************************************************/
  299. #if !defined(__cplusplus) || defined(CINTERFACE)
  300. #define IDirectPlay8LobbyClient_QueryInterface(p,a,b)             (p)->lpVtbl->QueryInterface(p,a,b)
  301. #define IDirectPlay8LobbyClient_AddRef(p)                         (p)->lpVtbl->AddRef(p)
  302. #define IDirectPlay8LobbyClient_Release(p)         (p)->lpVtbl->Release(p)
  303. #define IDirectPlay8LobbyClient_Initialize(p,a,b,c)                     (p)->lpVtbl->Initialize(p,a,b,c)
  304. #define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e)         (p)->lpVtbl->EnumLocalPrograms(p,a,b,c,d,e)
  305. #define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e)         (p)->lpVtbl->ConnectApplication(p,a,b,c,d,e)
  306. #define IDirectPlay8LobbyClient_Send(p,a,b,c,d)         (p)->lpVtbl->Send(p,a,b,c,d)
  307. #define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b)         (p)->lpVtbl->ReleaseApplication(p,a,b)
  308. #define IDirectPlay8LobbyClient_Close(p,a)         (p)->lpVtbl->Close(p,a)
  309. #define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d)        (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d)
  310. #define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c)          (p)->lpVtbl->SetConnectionSettings(p,a,b,c)
  311. #define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  312. #define IDirectPlay8LobbiedApplication_AddRef(p) (p)->lpVtbl->AddRef(p)
  313. #define IDirectPlay8LobbiedApplication_Release(p) (p)->lpVtbl->Release(p)
  314. #define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d)            (p)->lpVtbl->Initialize(p,a,b,c,d)
  315. #define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->lpVtbl->RegisterProgram(p,a,b)
  316. #define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->lpVtbl->UnRegisterProgram(p,a,b)
  317. #define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->lpVtbl->Send(p,a,b,c,d)
  318. #define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->lpVtbl->SetAppAvailable(p,a,b)
  319. #define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->lpVtbl->UpdateStatus(p,a,b,c)
  320. #define IDirectPlay8LobbiedApplication_Close(p,a) (p)->lpVtbl->Close(p,a)
  321. #define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d)
  322. #define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c)   (p)->lpVtbl->SetConnectionSettings(p,a,b,c)
  323. #else /* C++ */
  324. #define IDirectPlay8LobbyClient_QueryInterface(p,a,b)             (p)->QueryInterface(a,b)
  325. #define IDirectPlay8LobbyClient_AddRef(p)                         (p)->AddRef()
  326. #define IDirectPlay8LobbyClient_Release(p)         (p)->Release()
  327. #define IDirectPlay8LobbyClient_Initialize(p,a,b,c)                     (p)->Initialize(a,b,c)
  328. #define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e)         (p)->EnumLocalPrograms(a,b,c,d,e)
  329. #define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e)         (p)->ConnectApplication(a,b,c,d,e)
  330. #define IDirectPlay8LobbyClient_Send(p,a,b,c,d)         (p)->Send(a,b,c,d)
  331. #define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b)         (p)->ReleaseApplication(a,b)
  332. #define IDirectPlay8LobbyClient_Close(p,a)         (p)->Close(a)
  333. #define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d)        (p)->GetConnectionSettings(a,b,c,d)
  334. #define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c)          (p)->SetConnectionSettings(a,b,c)
  335. #define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
  336. #define IDirectPlay8LobbiedApplication_AddRef(p) (p)->AddRef()
  337. #define IDirectPlay8LobbiedApplication_Release(p) (p)->Release()
  338. #define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d)            (p)->Initialize(a,b,c,d)
  339. #define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->RegisterProgram(a,b)
  340. #define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->UnRegisterProgram(a,b)
  341. #define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->Send(a,b,c,d)
  342. #define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->SetAppAvailable(a,b)
  343. #define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->UpdateStatus(a,b,c)
  344. #define IDirectPlay8LobbiedApplication_Close(p,a) (p)->Close(a)
  345. #define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->GetConnectionSettings(a,b,c,d)
  346. #define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c)   (p)->SetConnectionSettings(a,b,c)
  347. #endif
  348. #ifdef __cplusplus
  349. }
  350. #endif
  351. #endif // __DPLOBBY_H__