Subversion Repositories spacemission

Rev

Rev 4 | Rev 13 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. unit DirectPlay;
  2.  
  3. (*==========================================================================;
  4.  *
  5.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  6.  *
  7.  *  File:       dplay.h dplobby.h
  8.  *  Content:    DirectPlay include files
  9.  *
  10.  *  DirectX 7 Delphi adaptation by Erik Unger
  11.  *
  12.  *  Modified: 4-Jun-2000
  13.  *
  14.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  15.  *  E-Mail: DelphiDirectX@next-reality.com
  16.  *
  17.  ***************************************************************************)
  18.  
  19. interface
  20.  
  21. {$INCLUDE DelphiXcfg.inc}
  22.  
  23. {$IFNDEF UseDirectPlay} // Daniel Marschall 12.04.2024 Added to avoid Windows showing "This app requires DirectPlay"
  24. {$MESSAGE ERROR 'If you want to use DXPlay.pas, please enable the IFDEF UseDirectPlay in DelphiXcfg.inc'}
  25. {$ENDIF}
  26.  
  27. {$MINENUMSIZE 4}
  28. {$ALIGN ON}
  29.  
  30. uses
  31.   Windows;
  32.  
  33. type
  34. {$IFDEF UNICODE}
  35.   PCharAW = PWideChar;
  36. {$ELSE}
  37.   PCharAW = PAnsiChar;
  38. {$ENDIF}
  39.  
  40. var
  41.   DPlayDLL: HMODULE = 0;
  42.  
  43. (*==========================================================================;
  44.  *
  45.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  46.  *
  47.  *  File:       dplay.h
  48.  *  Content:    DirectPlay include file
  49.  *
  50.  ***************************************************************************)
  51.  
  52. function DPErrorString(Value: HResult): string;
  53.  
  54. const
  55. // {D1EB6D20-8923-11d0-9D97-00A0C90A43CB}
  56.   CLSID_DirectPlay: TGUID =
  57.   (D1: $D1EB6D20; D2: $8923; D3: $11D0; D4: ($9D, $97, $00, $A0, $C9, $A, $43, $CB));
  58.  
  59. (*
  60.  * GUIDS used by Service Providers shipped with DirectPlay
  61.  * Use these to identify Service Provider returned by EnumConnections
  62.  *)
  63.  
  64. // GUID for IPX service provider
  65. // {685BC400-9D2C-11cf-A9CD-00AA006886E3}
  66.   DPSPGUID_IPX: TGUID =
  67.   (D1: $685BC400; D2: $9D2C; D3: $11CF; D4: ($A9, $CD, $00, $AA, $00, $68, $86, $E3));
  68.  
  69. // GUID for TCP/IP service provider
  70. // 36E95EE0-8577-11cf-960C-0080C7534E82
  71.   DPSPGUID_TCPIP: TGUID =
  72.   (D1: $36E95EE0; D2: $8577; D3: $11CF; D4: ($96, $0C, $00, $80, $C7, $53, $4E, $82));
  73.  
  74. // GUID for Serial service provider
  75. // {0F1D6860-88D9-11cf-9C4E-00A0C905425E}
  76.   DPSPGUID_SERIAL: TGUID =
  77.   (D1: $F1D6860; D2: $88D9; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $05, $42, $5E));
  78.  
  79. // GUID for Modem service provider
  80. // {44EAA760-CB68-11cf-9C4E-00A0C905425E}
  81.   DPSPGUID_MODEM: TGUID =
  82.   (D1: $44EAA760; D2: $CB68; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $05, $42, $5E));
  83.  
  84. (****************************************************************************
  85.  *
  86.  * DirectPlay Structures
  87.  *
  88.  * Various structures used to invoke DirectPlay.
  89.  *
  90.  ****************************************************************************)
  91.  
  92. type
  93. (*
  94.  * TDPID
  95.  * DirectPlay player and group ID
  96.  *)
  97.   TDPID = DWORD;
  98.   PDPID = ^TDPID;
  99.  
  100. const
  101. (*
  102.  * DPID that system messages come from
  103.  *)
  104.   DPID_SYSMSG = 0;
  105.  
  106. (*
  107.  * DPID representing all players in the session
  108.  *)
  109.   DPID_ALLPLAYERS = 0;
  110.  
  111. (*
  112.  * DPID representing the server player
  113.  *)
  114.   DPID_SERVERPLAYER = 1;
  115.  
  116. (*
  117.  * DPID representing the maximum ID in the range of DPID's reserved for
  118.  * use by DirectPlay.
  119.  *)
  120.   DPID_RESERVEDRANGE = 100;
  121.  
  122. (*
  123.  * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
  124.  *)
  125.   DPID_UNKNOWN = $FFFFFFFF;
  126.  
  127. type
  128. (*
  129.  * DPCAPS
  130.  * Used to obtain the capabilities of a DirectPlay object
  131.  *)
  132.   PDPCaps = ^TDPCaps;
  133.   TDPCaps = packed record
  134.     dwSize: DWORD; // Size of structure, in bytes
  135.     dwFlags: DWORD; // DPCAPS_xxx flags
  136.     dwMaxBufferSize: DWORD; // Maximum message size, in bytes,  for this service provider
  137.     dwMaxQueueSize: DWORD; // Obsolete.
  138.     dwMaxPlayers: DWORD; // Maximum players/groups (local + remote)
  139.     dwHundredBaud: DWORD; // Bandwidth in 100 bits per second units;
  140.                                 // i.e. 24 is 2400, 96 is 9600, etc.
  141.     dwLatency: DWORD; // Estimated latency; 0 = unknown
  142.     dwMaxLocalPlayers: DWORD; // Maximum # of locally created players allowed
  143.     dwHeaderLength: DWORD; // Maximum header length, in bytes, on messages
  144.                                 // added by the service provider
  145.     dwTimeout: DWORD; // Service provider's suggested timeout value
  146.                                 // This is how long DirectPlay will wait for
  147.                                 // responses to system messages
  148.   end;
  149.  
  150. const
  151. (*
  152.  * This DirectPlay object is the session host.  If the host exits the
  153.  * session, another application will become the host and receive a
  154.  * DPSYS_HOST system message.
  155.  *)
  156.   DPCAPS_ISHOST = $00000002;
  157.  
  158. (*
  159.  * The service provider bound to this DirectPlay object can optimize
  160.  * group messaging.
  161.  *)
  162.   DPCAPS_GROUPOPTIMIZED = $00000008;
  163.  
  164. (*
  165.  * The service provider bound to this DirectPlay object can optimize
  166.  * keep alives (see DPSESSION_KEEPALIVE)
  167.  *)
  168.   DPCAPS_KEEPALIVEOPTIMIZED = $00000010;
  169.  
  170. (*
  171.  * The service provider bound to this DirectPlay object can optimize
  172.  * guaranteed message delivery.
  173.  *)
  174.   DPCAPS_GUARANTEEDOPTIMIZED = $00000020;
  175.  
  176. (*
  177.  * This DirectPlay object supports guaranteed message delivery.
  178.  *)
  179.   DPCAPS_GUARANTEEDSUPPORTED = $00000040;
  180.  
  181. (*
  182.  * This DirectPlay object supports digital signing of messages.
  183.  *)
  184.   DPCAPS_SIGNINGSUPPORTED = $00000080;
  185.  
  186. (*
  187.  * This DirectPlay object supports encryption of messages.
  188.  *)
  189.   DPCAPS_ENCRYPTIONSUPPORTED = $00000100;
  190.  
  191. (*
  192.  * This DirectPlay player was created on this machine
  193.  *)
  194.   DPPLAYERCAPS_LOCAL = $00000800;
  195.  
  196. (*
  197.  * Current Open settings supports all forms of Cancel
  198.  *)
  199.   DPCAPS_ASYNCCANCELSUPPORTED = $00001000;
  200.  
  201. (*
  202.  * Current Open settings supports CancelAll, but not Cancel
  203.  *)
  204.   DPCAPS_ASYNCCANCELALLSUPPORTED = $00002000;
  205.  
  206. (*
  207.  * Current Open settings supports Send Timeouts for sends
  208.  *)
  209.   DPCAPS_SENDTIMEOUTSUPPORTED = $00004000;
  210.  
  211. (*
  212.  * Current Open settings supports send priority
  213.  *)
  214.   DPCAPS_SENDPRIORITYSUPPORTED = $00008000;
  215.  
  216. (*
  217.  * Current Open settings supports DPSEND_ASYNC flag
  218.  *)
  219.   DPCAPS_ASYNCSUPPORTED = $00010000;
  220.  
  221. type
  222. (*
  223.  * TDPSessionDesc2
  224.  * Used to describe the properties of a DirectPlay
  225.  * session instance
  226.  *)
  227.   PDPSessionDesc2 = ^TDPSessionDesc2;
  228.   TDPSessionDesc2 = packed record
  229.     dwSize: DWORD; // Size of structure
  230.     dwFlags: DWORD; // DPSESSION_xxx flags
  231.     guidInstance: TGUID; // ID for the session instance
  232.     guidApplication: TGUID; // GUID of the DirectPlay application.
  233.                                // GUID_NULL for all applications.
  234.     dwMaxPlayers: DWORD; // Maximum # players allowed in session
  235.     dwCurrentPlayers: DWORD; // Current # players in session (read only)
  236.     case Integer of
  237.       0: (
  238.         lpszSessionName: PCharAW; // Name of the session
  239.         lpszPassword: PCharAW; // Password of the session (optional)
  240.         dwReserved1: DWORD; // Reserved for future MS use.
  241.         dwReserved2: DWORD;
  242.         dwUser1: DWORD; // For use by the application
  243.         dwUser2: DWORD;
  244.         dwUser3: DWORD;
  245.         dwUser4: DWORD;
  246.         );
  247.       1: (
  248.         lpszSessionNameA: PAnsiChar; // Name of the session
  249.         lpszPasswordA: PAnsiChar // Password of the session (optional)
  250.         );
  251.       2: (
  252.         lpszSessionNameW: PWideChar;
  253.         lpszPasswordW: PWideChar
  254.         );
  255.   end;
  256.  
  257. const
  258. (*
  259.  * Applications cannot create new players in this session.
  260.  *)
  261.   DPSESSION_NEWPLAYERSDISABLED = $00000001;
  262.  
  263. (*
  264.  * If the DirectPlay object that created the session, the host,
  265.  * quits, then the host will attempt to migrate to another
  266.  * DirectPlay object so that new players can continue to be created
  267.  * and new applications can join the session.
  268.  *)
  269.   DPSESSION_MIGRATEHOST = $00000004;
  270.  
  271. (*
  272.  * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom
  273.  * fields in player messages.  This cuts two DWORD's off the message
  274.  * overhead.
  275.  *)
  276.   DPSESSION_NOMESSAGEID = $00000008;
  277.  
  278. (*
  279.  * This flag tells DirectPlay to not allow any new applications to
  280.  * join the session.  Applications already in the session can still
  281.  * create new players.
  282.  *)
  283.   DPSESSION_JOINDISABLED = $00000020;
  284.  
  285. (*
  286.  * This flag tells DirectPlay to detect when remote players
  287.  * exit abnormally (e.g. their computer or modem gets unplugged)
  288.  *)
  289.   DPSESSION_KEEPALIVE = $00000040;
  290.  
  291. (*
  292.  * This flag tells DirectPlay not to send a message to all players
  293.  * when a players remote data changes
  294.  *)
  295.   DPSESSION_NODATAMESSAGES = $00000080;
  296.  
  297. (*
  298.  * This flag indicates that the session belongs to a secure server
  299.  * and needs user authentication
  300.  *)
  301.   DPSESSION_SECURESERVER = $00000100;
  302.  
  303. (*
  304.  * This flag indicates that the session is private and requirs a password
  305.  * for EnumSessions as well as Open.
  306.  *)
  307.   DPSESSION_PRIVATE = $00000200;
  308.  
  309. (*
  310.  * This flag indicates that the session requires a password for joining.
  311.  *)
  312.   DPSESSION_PASSWORDREQUIRED = $00000400;
  313.  
  314. (*
  315.  * This flag tells DirectPlay to route all messages through the server
  316.  *)
  317.   DPSESSION_MULTICASTSERVER = $00000800;
  318.  
  319. (*
  320.  * This flag tells DirectPlay to only download information about the
  321.  * DPPLAYER_SERVERPLAYER.
  322.  *)
  323.   DPSESSION_CLIENTSERVER = $00001000;
  324.  
  325. (*
  326.  * This flag tells DirectPlay to use the protocol built into dplay
  327.  * for reliability and statistics all the time.  When this bit is
  328.  * set, only other sessions with this bit set can join or be joined.
  329.  *)
  330.   DPSESSION_DIRECTPLAYPROTOCOL = $00002000;
  331.  
  332. (*
  333.  * This flag tells DirectPlay that preserving order of received
  334.  * packets is not important, when using reliable delivery.  This
  335.  * will allow messages to be indicated out of order if preceding
  336.  * messages have not yet arrived.  Otherwise DPLAY will wait for
  337.  * earlier messages before delivering later reliable messages.
  338.  *)
  339.   DPSESSION_NOPRESERVEORDER = $00004000;
  340.  
  341. (*
  342.  * This flag tells DirectPlay to optimize communication for latency
  343.  *)
  344.   DPSESSION_OPTIMIZELATENCY = $00008000;
  345.  
  346. type
  347. (*
  348.  * TDPName
  349.  * Used to hold the name of a DirectPlay entity
  350.  * like a player or a group
  351.  *)
  352.   PDPName = ^TDPName;
  353.   TDPName = packed record
  354.     dwSize: DWORD; // Size of structure
  355.     dwFlags: DWORD; // Not used. Must be zero.
  356.     case Integer of
  357.       0: (
  358.         lpszShortName: PCharAW; // The short or friendly name
  359.         lpszLongName: PCharAW; // The long or formal name
  360.         );
  361.       1: (
  362.         lpszShortNameA: PAnsiChar;
  363.         lpszLongNameA: PAnsiChar;
  364.         );
  365.       2: (
  366.         lpszShortNameW: PWideChar;
  367.         lpszLongNameW: PWideChar;
  368.         );
  369.   end;
  370.  
  371. (*
  372.  * TDPCredentials
  373.  * Used to hold the user name and password of a DirectPlay user
  374.  *)
  375.  
  376.   PDPCredentials = ^TDPCredentials;
  377.   TDPCredentials = packed record
  378.     dwSize: DWORD; // Size of structure
  379.     dwFlags: DWORD; // Not used. Must be zero.
  380.     case Integer of
  381.       0: (
  382.         lpszUsername: PCharAW; // User name of the account
  383.         lpszPassword: PCharAW; // Password of the account
  384.         lpszDomain: PCharAW; // Domain name of the account
  385.         );
  386.       1: (
  387.         lpszUsernameA: PAnsiChar; // User name of the account
  388.         lpszPasswordA: PAnsiChar; // Password of the account
  389.         lpszDomainA: PAnsiChar; // Domain name of the account
  390.         );
  391.       2: (
  392.         lpszUsernameW: PWideChar; // User name of the account
  393.         lpszPasswordW: PWideChar; // Password of the account
  394.         lpszDomainW: PWideChar; // Domain name of the account
  395.         );
  396.   end;
  397.  
  398. (*
  399.  * TDPSecurityDesc
  400.  * Used to describe the security properties of a DirectPlay
  401.  * session instance
  402.  *)
  403.   PDPSecurityDesc = ^TDPSecurityDesc;
  404.   TDPSecurityDesc = packed record
  405.     dwSize: DWORD; // Size of structure
  406.     dwFlags: DWORD; // Not used. Must be zero.
  407.     case Integer of
  408.       0: (
  409.         lpszSSPIProvider: PCharAW; // SSPI provider name
  410.         lpszCAPIProvider: PCharAW; // CAPI provider name
  411.         dwCAPIProviderType: DWORD; // Crypto Service Provider type
  412.         dwEncryptionAlgorithm: DWORD; // Encryption Algorithm type
  413.         );
  414.       1: (
  415.         lpszSSPIProviderA: PAnsiChar; // SSPI provider name
  416.         lpszCAPIProviderA: PAnsiChar; // CAPI provider name
  417.         );
  418.       2: (
  419.         lpszSSPIProviderW: PWideChar; // SSPI provider name
  420.         lpszCAPIProviderW: PWideChar; // CAPI provider name
  421.         );
  422.   end;
  423.  
  424. (*
  425.  * DPACCOUNTDESC
  426.  * Used to describe a user membership account
  427.  *)
  428.  
  429.   PDPAccountDesc = ^TDPAccountDesc;
  430.   TDPAccountDesc = packed record
  431.     dwSize: DWORD; // Size of structure
  432.     dwFlags: DWORD; // Not used. Must be zero.
  433.     case Integer of
  434.       0: (lpszAccountID: PCharAW); // Account identifier
  435.       1: (lpszAccountIDA: PAnsiChar);
  436.       2: (lpszAccountIDW: PWideChar);
  437.   end;
  438.  
  439. (*
  440.  * TDPLConnection
  441.  * Used to hold all in the informaion needed to connect
  442.  * an application to a session or create a session
  443.  *)
  444.   PDPLConnection = ^TDPLConnection;
  445.   TDPLConnection = packed record
  446.     dwSize: DWORD; // Size of this structure
  447.     dwFlags: DWORD; // Flags specific to this structure
  448.     lpSessionDesc: PDPSessionDesc2; // Pointer to session desc to use on connect
  449.     lpPlayerName: PDPName; // Pointer to Player name structure
  450.     guidSP: TGUID; // GUID of the DPlay SP to use
  451.     lpAddress: Pointer; // Address for service provider
  452.     dwAddressSize: DWORD; // Size of address data
  453.   end;
  454.  
  455. (*
  456.  * TDPChat
  457.  * Used to hold the a DirectPlay chat message
  458.  *)
  459.   PDPChat = ^TDPChat;
  460.   TDPChat = packed record
  461.     dwSize: DWORD;
  462.     dwFlags: DWORD;
  463.     case Integer of
  464.       0: (lpszMessage: PCharAW); // Message string
  465.       1: (lpszMessageA: PAnsiChar);
  466.       2: (lpszMessageW: PWideChar);
  467.   end;
  468.  
  469. (*
  470.  * TSGBuffer
  471.  * Scatter Gather Buffer used for SendEx
  472.  *)
  473.   PSGBuffer = ^TSGBuffer;
  474.   TSGBuffer = packed record
  475.     len: UINT;
  476.     pData: PUCHAR;
  477.   end;
  478.  
  479. (****************************************************************************
  480.  *
  481.  * Prototypes for DirectPlay callback functions
  482.  *
  483.  ****************************************************************************)
  484.  
  485. (*
  486.  * Callback for IDirectPlay2::EnumSessions
  487.  *)
  488.   TDPEnumSessionsCallback2 = function(lpThisSD: PDPSessionDesc2;
  489.     var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  490.  
  491. const
  492. (*
  493.  * This flag is set on the EnumSessions callback dwFlags parameter when
  494.  * the time out has occurred. There will be no session data for this
  495.  * callback. If *lpdwTimeOut is set to a non-zero value and the
  496.  * EnumSessionsCallback function returns TRUE then EnumSessions will
  497.  * continue waiting until the next timeout occurs. Timeouts are in
  498.  * milliseconds.
  499.  *)
  500.   DPESC_TIMEDOUT = $00000001;
  501.  
  502. type
  503. (*
  504.  * Callback for IDirectPlay2.EnumPlayers
  505.  *              IDirectPlay2.EnumGroups
  506.  *              IDirectPlay2.EnumGroupPlayers
  507.  *)
  508.   TDPEnumPlayersCallback2 = function(DPID: TDPID; dwPlayerType: DWORD;
  509.     const lpName: TDPName; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  510.  
  511. (*
  512.  * ANSI callback for DirectPlayEnumerate
  513.  * This callback prototype will be used if compiling
  514.  * for ANSI strings
  515.  *)
  516.   TDPEnumDPCallbackA = function(const lpguidSP: TGUID; lpSPName: PAnsiChar;
  517.     dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer): BOOL; stdcall;
  518.  
  519. (*
  520.  * Unicode callback for DirectPlayEnumerate
  521.  * This callback prototype will be used if compiling
  522.  * for Unicode strings
  523.  *)
  524.   TDPEnumDPCallbackW = function(const lpguidSP: TGUID; lpSPName: PWideChar;
  525.     dwMajorVersion: DWORD; dwMinorVersion: DWORD; lpContext: Pointer): BOOL; stdcall;
  526.  
  527. (*
  528.  * Callback for DirectPlayEnumerate
  529.  *)
  530. {$IFDEF UNICODE}
  531.   TDPEnumDPCallback = TDPEnumDPCallbackW;
  532. {$ELSE}
  533.   TDPEnumDPCallback = TDPEnumDPCallbackA;
  534. {$ENDIF}
  535.  
  536. (*
  537.  * Callback for IDirectPlay3(A/W).EnumConnections
  538.  *)
  539.   TDPEnumConnectionsCallback = function(const lpguidSP: TGUID;
  540.     lpConnection: Pointer; dwConnectionSize: DWORD; const lpName: TDPName;
  541.     dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  542.  
  543. (*
  544.  * API's
  545.  *)
  546.  
  547. var
  548.   DirectPlayEnumerate: function(lpEnumDPCallback: TDPEnumDPCallback;
  549.     lpContext: Pointer): HResult; stdcall;
  550.   DirectPlayEnumerateA: function(lpEnumDPCallback: TDPEnumDPCallbackA;
  551.     lpContext: Pointer): HResult; stdcall;
  552.   DirectPlayEnumerateW: function(lpEnumDPCallback: TDPEnumDPCallbackW;
  553.     lpContext: Pointer): HResult; stdcall;
  554.  
  555. (****************************************************************************
  556.  *
  557.  * IDirectPlay2 (and IDirectPlay2A) Interface
  558.  *
  559.  ****************************************************************************)
  560.  
  561. type
  562.   IDirectPlay2AW = interface(IUnknown)
  563.     (*** IDirectPlay2 methods ***)
  564.     function AddPlayerToGroup(idGroup: TDPID; idPlayer: TDPID): HResult; stdcall;
  565.     function Close: HResult; stdcall;
  566.     function CreateGroup(out lpidGroup: TDPID; lpGroupName: PDPName;
  567.       lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  568.     function CreatePlayer(out lpidPlayer: TDPID; pPlayerName: PDPName;
  569.       hEvent: THandle; lpData: Pointer; dwDataSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  570.     function DeletePlayerFromGroup(idGroup: TDPID; idPlayer: TDPID): HResult; stdcall;
  571.     function DestroyGroup(idGroup: TDPID): HResult; stdcall;
  572.     function DestroyPlayer(idPlayer: TDPID): HResult; stdcall;
  573.     function EnumGroupPlayers(idGroup: TDPID; lpguidInstance: PGUID;
  574.       lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  575.       dwFlags: DWORD): HResult; stdcall;
  576.     function EnumGroups(lpguidInstance: PGUID; lpEnumPlayersCallback2:
  577.       TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  578.     function EnumPlayers(lpguidInstance: PGUID; lpEnumPlayersCallback2:
  579.       TDPEnumPlayersCallback2; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  580.     function EnumSessions(const lpsd: TDPSessionDesc2; dwTimeout: DWORD;
  581.       lpEnumSessionsCallback2: TDPEnumSessionsCallback2; lpContext: Pointer;
  582.       dwFlags: DWORD): HResult; stdcall;
  583.     function GetCaps(var lpDPCaps: TDPCaps; dwFlags: DWORD): HResult; stdcall;
  584.     function GetGroupData(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
  585.       dwFlags: DWORD): HResult; stdcall;
  586.     function GetGroupName(idGroup: TDPID; lpData: Pointer; var lpdwDataSize: DWORD):
  587.       HResult; stdcall;
  588.     function GetMessageCount(idPlayer: TDPID; var lpdwCount: DWORD): HResult; stdcall;
  589.     function GetPlayerAddress(idPlayer: TDPID; lpAddress: Pointer;
  590.       var lpdwAddressSize: DWORD): HResult; stdcall;
  591.     function GetPlayerCaps(idPlayer: TDPID; var lpPlayerCaps: TDPCaps;
  592.       dwFlags: DWORD): HResult; stdcall;
  593.     function GetPlayerData(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD;
  594.       dwFlags: DWORD): HResult; stdcall;
  595.     function GetPlayerName(idPlayer: TDPID; lpData: Pointer; var lpdwDataSize: DWORD): HResult; stdcall;
  596.     function GetSessionDesc(lpData: Pointer; var lpdwDataSize: DWORD): HResult; stdcall;
  597.     function Initialize(const lpGUID: TGUID): HResult; stdcall;
  598.     function Open(var lpsd: TDPSessionDesc2; dwFlags: DWORD): HResult; stdcall;
  599.     function Receive(var lpidFrom: TDPID; var lpidTo: TDPID; dwFlags: DWORD;
  600.       lpData: Pointer; var lpdwDataSize: DWORD): HResult; stdcall;
  601.     function Send(idFrom: TDPID; lpidTo: TDPID; dwFlags: DWORD; var lpData;
  602.       lpdwDataSize: DWORD): HResult; stdcall;
  603.     function SetGroupData(idGroup: TDPID; lpData: Pointer; dwDataSize: DWORD;
  604.       dwFlags: DWORD): HResult; stdcall;
  605.     function SetGroupName(idGroup: TDPID; lpGroupName: PDPName;
  606.       dwFlags: DWORD): HResult; stdcall;
  607.     function SetPlayerData(idPlayer: TDPID; lpData: Pointer; dwDataSize: DWORD;
  608.       dwFlags: DWORD): HResult; stdcall;
  609.     function SetPlayerName(idPlayer: TDPID; lpPlayerName: PDPName;
  610.       dwFlags: DWORD): HResult; stdcall;
  611.     function SetSessionDesc(var lpSessDesc: TDPSessionDesc2; dwFlags: DWORD):
  612.       HResult; stdcall;
  613.   end;
  614.  
  615.   IDirectPlay2W = interface(IDirectPlay2AW)
  616.     ['{2B74F7C0-9154-11CF-A9CD-00AA006886E3}']
  617.   end;
  618.   IDirectPlay2A = interface(IDirectPlay2AW)
  619.     ['{9d460580-a822-11cf-960c-0080c7534e82}']
  620.   end;
  621.  
  622. {$IFDEF UNICODE}
  623.   IDirectPlay2 = IDirectPlay2W;
  624. {$ELSE}
  625.   IDirectPlay2 = IDirectPlay2A;
  626. {$ENDIF}
  627.  
  628. (****************************************************************************
  629.  *
  630.  * IDirectPlay3 (and IDirectPlay3A) Interface
  631.  *
  632.  ****************************************************************************)
  633.  
  634.   IDirectPlay3AW = interface(IDirectPlay2AW)
  635.     (*** IDirectPlay3 methods ***)
  636.     function AddGroupToGroup(idParentGroup: TDPID; idGroup: TDPID): HResult; stdcall;
  637.     function CreateGroupInGroup(idParentGroup: TDPID; var lpidGroup: TDPID;
  638.       lpGroupName: PDPName; lpData: Pointer; dwDataSize: DWORD;
  639.       dwFlags: DWORD): HResult; stdcall;
  640.     function DeleteGroupFromGroup(idParentGroup: TDPID; idGroup: TDPID): HResult; stdcall;
  641.     function EnumConnections(lpguidApplication: PGUID;
  642.       lpEnumCallback: TDPEnumConnectionsCallback; lpContext: Pointer;
  643.       dwFlags: DWORD): HResult; stdcall;
  644.     function EnumGroupsInGroup(idGroup: TDPID; lpguidInstance: PGUID;
  645.       lpEnumPlayersCallback2: TDPEnumPlayersCallback2; lpContext: Pointer;
  646.       dwFlags: DWORD): HResult; stdcall;
  647.     function GetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  648.       lpData: Pointer; var lpdwDataSize: DWORD): HResult; stdcall;
  649.     function InitializeConnection(lpConnection: Pointer; dwFlags: DWORD): HResult; stdcall;
  650.     function SecureOpen(var lpsd: TDPSessionDesc2; dwFlags: DWORD;
  651.       var lpSecurity: TDPSecurityDesc; var lpCredentials: TDPCredentials): HResult; stdcall;
  652.     function SendChatMessage(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  653.       var lpChatMessage: TDPChat): HResult; stdcall;
  654.     function SetGroupConnectionSettings(dwFlags: DWORD; idGroup: TDPID;
  655.       var lpConnection: TDPLConnection): HResult; stdcall;
  656.     function StartSession(dwFlags: DWORD; idGroup: TDPID): HResult; stdcall;
  657.     function GetGroupFlags(idGroup: TDPID; out lpdwFlags: DWORD): HResult; stdcall;
  658.     function GetGroupParent(idGroup: TDPID; out lpidParent: TDPID): HResult; stdcall;
  659.     function GetPlayerAccount(idPlayer: TDPID; dwFlags: DWORD; var lpData;
  660.       var lpdwDataSize: DWORD): HResult; stdcall;
  661.     function GetPlayerFlags(idPlayer: TDPID; out lpdwFlags: DWORD): HResult; stdcall;
  662.   end;
  663.  
  664.   IDirectPlay3W = interface(IDirectPlay3AW)
  665.     ['{133EFE40-32DC-11D0-9CFB-00A0C90A43CB}']
  666.   end;
  667.   IDirectPlay3A = interface(IDirectPlay3AW)
  668.     ['{133efe41-32dc-11d0-9cfb-00a0c90a43cb}']
  669.   end;
  670.  
  671. {$IFDEF UNICODE}
  672.   IDirectPlay3 = IDirectPlay3W;
  673. {$ELSE}
  674.   IDirectPlay3 = IDirectPlay3A;
  675. {$ENDIF}
  676.  
  677. (****************************************************************************
  678.  *
  679.  * IDirectPlay4 (and IDirectPlay4A) Interface
  680.  *
  681.  ****************************************************************************)
  682.  
  683.   IDirectPlay4AW = interface(IDirectPlay3AW)
  684.     (*** IDirectPlay4 methods ***)
  685.     function GetGroupOwner(idGroup: TDPID; out idOwner: TDPID): HResult; stdcall;
  686.     function SetGroupOwner(idGroup: TDPID; idOwner: TDPID): HResult; stdcall;
  687.     function SendEx(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD; lpData: Pointer;
  688.       dwDataSize: DWORD; dwPriority: DWORD; dwTimeout: DWORD;
  689.       lpContext: Pointer; lpdwMsgId: PDWORD): HResult; stdcall;
  690.     function GetMessageQueue(idFrom: TDPID; idTo: TDPID; dwFlags: DWORD;
  691.       lpdwNumMsgs: PDWORD; lpdwNumBytes: PDWORD): HResult; stdcall;
  692.     function CancelMessage(dwMessageID: DWORD; dwFlags: DWORD): HResult; stdcall;
  693.     function CancelPriority(dwMinPriority: DWORD; dwMaxPriority: DWORD; dwFlags: DWORD): HResult; stdcall;
  694.   end;
  695.  
  696.   IDirectPlay4W = interface(IDirectPlay4AW)
  697.     ['{0ab1c530-4745-11D1-a7a1-0000f803abfc}']
  698.   end;
  699.   IDirectPlay4A = interface(IDirectPlay4AW)
  700.     ['{0ab1c531-4745-11D1-a7a1-0000f803abfc}']
  701.   end;
  702.  
  703. {$IFDEF UNICODE}
  704.   IDirectPlay4 = IDirectPlay4W;
  705. {$ELSE}
  706.   IDirectPlay4 = IDirectPlay4A;
  707. {$ENDIF}
  708.  
  709. const
  710. (****************************************************************************
  711.  *
  712.  * EnumConnections API flags
  713.  *
  714.  ****************************************************************************)
  715.  
  716. (*
  717.  * Enumerate Service Providers
  718.  *)
  719.   DPCONNECTION_DIRECTPLAY = $00000001;
  720.  
  721. (*
  722.  * Enumerate Lobby Providers
  723.  *)
  724.   DPCONNECTION_DIRECTPLAYLOBBY = $00000002;
  725.  
  726. (****************************************************************************
  727.  *
  728.  * EnumPlayers API flags
  729.  *
  730.  ****************************************************************************)
  731.  
  732. (*
  733.  * Enumerate all players in the current session
  734.  *)
  735.   DPENUMPLAYERS_ALL = $00000000;
  736.   DPENUMGROUPS_ALL = DPENUMPLAYERS_ALL;
  737.  
  738. (*
  739.  * Enumerate only local (created by this application) players
  740.  * or groups
  741.  *)
  742.   DPENUMPLAYERS_LOCAL = $00000008;
  743.   DPENUMGROUPS_LOCAL = DPENUMPLAYERS_LOCAL;
  744.  
  745. (*
  746.  * Enumerate only remote (non-local) players
  747.  * or groups
  748.  *)
  749.   DPENUMPLAYERS_REMOTE = $00000010;
  750.   DPENUMGROUPS_REMOTE = DPENUMPLAYERS_REMOTE;
  751.  
  752. (*
  753.  * Enumerate groups along with the players
  754.  *)
  755.   DPENUMPLAYERS_GROUP = $00000020;
  756.  
  757. (*
  758.  * Enumerate players or groups in another session
  759.  * (must supply lpguidInstance)
  760.  *)
  761.   DPENUMPLAYERS_SESSION = $00000080;
  762.   DPENUMGROUPS_SESSION = DPENUMPLAYERS_SESSION;
  763.  
  764. (*
  765.  * Enumerate server players
  766.  *)
  767.   DPENUMPLAYERS_SERVERPLAYER = $00000100;
  768.  
  769. (*
  770.  * Enumerate spectator players
  771.  *)
  772.   DPENUMPLAYERS_SPECTATOR = $00000200;
  773.  
  774. (*
  775.  * Enumerate shortcut groups
  776.  *)
  777.   DPENUMGROUPS_SHORTCUT = $00000400;
  778.  
  779. (*
  780.  * Enumerate staging area groups
  781.  *)
  782.   DPENUMGROUPS_STAGINGAREA = $00000800;
  783.  
  784. (*
  785.  * Enumerate hidden groups
  786.  *)
  787.   DPENUMGROUPS_HIDDEN = $00001000;
  788.  
  789. (*
  790.  * Enumerate the group's owner
  791.  *)
  792.   DPENUMPLAYERS_OWNER = $00002000;
  793.  
  794. (****************************************************************************
  795.  *
  796.  * CreatePlayer API flags
  797.  *
  798.  ****************************************************************************)
  799.  
  800. (*
  801.  * This flag indicates that this player should be designated
  802.  * the server player. The app should specify this at CreatePlayer.
  803.  *)
  804.   DPPLAYER_SERVERPLAYER = DPENUMPLAYERS_SERVERPLAYER;
  805.  
  806. (*
  807.  * This flag indicates that this player should be designated
  808.  * a spectator. The app should specify this at CreatePlayer.
  809.  *)
  810.   DPPLAYER_SPECTATOR = DPENUMPLAYERS_SPECTATOR;
  811.  
  812. (*
  813.  * This flag indicates that this player was created locally.
  814.  * (returned from GetPlayerFlags)
  815.  *)
  816.   DPPLAYER_LOCAL = DPENUMPLAYERS_LOCAL;
  817.  
  818. (*
  819.  * This flag indicates that this player is the group's owner
  820.  * (Only returned in EnumGroupPlayers)
  821.  *)
  822.   DPPLAYER_OWNER = DPENUMPLAYERS_OWNER;
  823.  
  824. (****************************************************************************
  825.  *
  826.  * CreateGroup API flags
  827.  *
  828.  ****************************************************************************)
  829.  
  830. (*
  831.  * This flag indicates that the StartSession can be called on the group.
  832.  * The app should specify this at CreateGroup, or CreateGroupInGroup.
  833.  *)
  834.   DPGROUP_STAGINGAREA = DPENUMGROUPS_STAGINGAREA;
  835.  
  836. (*
  837.  * This flag indicates that this group was created locally.
  838.  * (returned from GetGroupFlags)
  839.  *)
  840.   DPGROUP_LOCAL = DPENUMGROUPS_LOCAL;
  841.  
  842. (*
  843.  * This flag indicates that this group was created hidden.
  844.  *)
  845.   DPGROUP_HIDDEN = DPENUMGROUPS_HIDDEN;
  846.  
  847. (****************************************************************************
  848.  *
  849.  * EnumSessions API flags
  850.  *
  851.  ****************************************************************************)
  852.  
  853. (*
  854.  * Enumerate sessions which can be joined
  855.  *)
  856.   DPENUMSESSIONS_AVAILABLE = $00000001;
  857.  
  858. (*
  859.  * Enumerate all sessions even if they can't be joined.
  860.  *)
  861.   DPENUMSESSIONS_ALL = $00000002;
  862.  
  863. (*
  864.  * Start an asynchronous enum sessions
  865.  *)
  866.   DPENUMSESSIONS_ASYNC = $00000010;
  867.  
  868. (*
  869.  * Stop an asynchronous enum sessions
  870.  *)
  871.   DPENUMSESSIONS_STOPASYNC = $00000020;
  872.  
  873. (*
  874.  * Enumerate sessions even if they require a password
  875.  *)
  876.   DPENUMSESSIONS_PASSWORDREQUIRED = $00000040;
  877.  
  878. (*
  879.  * Return status about progress of enumeration instead of
  880.  * showing any status dialogs.
  881.  *)
  882.   DPENUMSESSIONS_RETURNSTATUS = $00000080;
  883.  
  884. (****************************************************************************
  885.  *
  886.  * GetCaps and GetPlayerCaps API flags
  887.  *
  888.  ****************************************************************************)
  889.  
  890. (*
  891.  * The latency returned should be for guaranteed message sending.
  892.  * Default is non-guaranteed messaging.
  893.  *)
  894.   DPGETCAPS_GUARANTEED = $00000001;
  895.  
  896. (****************************************************************************
  897.  *
  898.  * GetGroupData, GetPlayerData API flags
  899.  * Remote and local Group/Player data is maintained separately.
  900.  * Default is DPGET_REMOTE.
  901.  *
  902.  ****************************************************************************)
  903.  
  904. (*
  905.  * Get the remote data (set by any DirectPlay object in
  906.  * the session using DPSET_REMOTE)
  907.  *)
  908.   DPGET_REMOTE = $00000000;
  909.  
  910. (*
  911.  * Get the local data (set by this DirectPlay object
  912.  * using DPSET_LOCAL)
  913.  *)
  914.   DPGET_LOCAL = $00000001;
  915.  
  916. (****************************************************************************
  917.  *
  918.  * Open API flags
  919.  *
  920.  ****************************************************************************)
  921.  
  922. (*
  923.  * Join the session that is described by the DPSESSIONDESC2 structure
  924.  *)
  925.   DPOPEN_JOIN = $00000001;
  926.  
  927. (*
  928.  * Create a new session as described by the DPSESSIONDESC2 structure
  929.  *)
  930.   DPOPEN_CREATE = $00000002;
  931.  
  932. (*
  933.  * Return status about progress of open instead of showing
  934.  * any status dialogs.
  935.  *)
  936.   DPOPEN_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  937.  
  938. (****************************************************************************
  939.  *
  940.  * DPLCONNECTION flags
  941.  *
  942.  ****************************************************************************)
  943.  
  944. (*
  945.  * This application should create a new session as
  946.  * described by the DPSESIONDESC structure
  947.  *)
  948.   DPLCONNECTION_CREATESESSION = DPOPEN_CREATE;
  949.  
  950. (*
  951.  * This application should join the session described by
  952.  * the DPSESIONDESC structure with the lpAddress data
  953.  *)
  954.   DPLCONNECTION_JOINSESSION = DPOPEN_JOIN;
  955.  
  956. (****************************************************************************
  957.  *
  958.  * Receive API flags
  959.  * Default is DPRECEIVE_ALL
  960.  *
  961.  ****************************************************************************)
  962.  
  963. (*
  964.  * Get the first message in the queue
  965.  *)
  966.   DPRECEIVE_ALL = $00000001;
  967.  
  968. (*
  969.  * Get the first message in the queue directed to a specific player
  970.  *)
  971.   DPRECEIVE_TOPLAYER = $00000002;
  972.  
  973. (*
  974.  * Get the first message in the queue from a specific player
  975.  *)
  976.   DPRECEIVE_FROMPLAYER = $00000004;
  977.  
  978. (*
  979.  * Get the message but don't remove it from the queue
  980.  *)
  981.   DPRECEIVE_PEEK = $00000008;
  982.  
  983. (****************************************************************************
  984.  *
  985.  * Send API flags
  986.  *
  987.  ****************************************************************************)
  988.  
  989. (*
  990.  * Send the message using a guaranteed send method.
  991.  * Default is non-guaranteed.
  992.  *)
  993.   DPSEND_GUARANTEED = $00000001;
  994.  
  995. (*
  996.  * This flag is obsolete. It is ignored by DirectPlay
  997.  *)
  998.   DPSEND_HIGHPRIORITY = $00000002;
  999.  
  1000. (*
  1001.  * This flag is obsolete. It is ignored by DirectPlay
  1002.  *)
  1003.   DPSEND_OPENSTREAM = $00000008;
  1004.  
  1005. (*
  1006.  * This flag is obsolete. It is ignored by DirectPlay
  1007.  *)
  1008.   DPSEND_CLOSESTREAM = $00000010;
  1009.  
  1010. (*
  1011.  * Send the message digitally signed to ensure authenticity.
  1012.  *)
  1013.   DPSEND_SIGNED = $00000020;
  1014.  
  1015. (*
  1016.  * Send the message with encryption to ensure privacy.
  1017.  *)
  1018.   DPSEND_ENCRYPTED = $00000040;
  1019.  
  1020. (*
  1021.  * The message is a lobby system message
  1022.  *)
  1023.   DPSEND_LOBBYSYSTEMMESSAGE = $00000080;
  1024.  
  1025. (*
  1026.  * andyco - added this so we can make addforward async.
  1027.  * needs to be sanitized when we add / expose full async
  1028.  * support.  8/3/97.
  1029.  *)
  1030.   DPSEND_ASYNC = $00000200;
  1031.  
  1032. (*
  1033.  * When a message is completed, don't tell me.
  1034.  * by default the application is notified with a system message.
  1035.  *)
  1036.   DPSEND_NOSENDCOMPLETEMSG = $00000400;
  1037.  
  1038. (*
  1039.  * Maximum priority for sends available to applications
  1040.  *)
  1041.   DPSEND_MAX_PRI = $0000FFFF;
  1042.   DPSEND_MAX_PRIORITY = DPSEND_MAX_PRI;
  1043.  
  1044. (****************************************************************************
  1045.  *
  1046.  * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
  1047.  * SetSessionDesc API flags.
  1048.  * Default is DPSET_REMOTE.
  1049.  *
  1050.  ****************************************************************************)
  1051.  
  1052. (*
  1053.  * Propagate the data to all players in the session
  1054.  *)
  1055.   DPSET_REMOTE = $00000000;
  1056.  
  1057. (*
  1058.  * Do not propagate the data to other players
  1059.  *)
  1060.   DPSET_LOCAL = $00000001;
  1061.  
  1062. (*
  1063.  * Used with DPSET_REMOTE, use guaranteed message send to
  1064.  * propagate the data
  1065.  *)
  1066.   DPSET_GUARANTEED = $00000002;
  1067.  
  1068. (****************************************************************************
  1069.  *
  1070.  * GetMessageQueue API flags.
  1071.  * Default is DPMESSAGEQUEUE_SEND
  1072.  *
  1073.  ****************************************************************************)
  1074.  
  1075. (*
  1076.  * Get Send Queue - requires Service Provider Support
  1077.  *)
  1078.   DPMESSAGEQUEUE_SEND = $00000001;
  1079.  
  1080. (*
  1081.  * Get Receive Queue
  1082.  *)
  1083.   DPMESSAGEQUEUE_RECEIVE = $00000002;
  1084.  
  1085. (****************************************************************************
  1086.  *
  1087.  * Connect API flags
  1088.  *
  1089.  ****************************************************************************)
  1090.  
  1091. (*
  1092.  * Start an asynchronous connect which returns status codes
  1093.  *)
  1094.   DPCONNECT_RETURNSTATUS = DPENUMSESSIONS_RETURNSTATUS;
  1095.  
  1096. (****************************************************************************
  1097.  *
  1098.  * DirectPlay system messages and message data structures
  1099.  *
  1100.  * All system message come 'From' player DPID_SYSMSG.  To determine what type
  1101.  * of message it is, cast the lpData from Receive to TDPMsg_Generic and check
  1102.  * the dwType member against one of the following DPSYS_xxx constants. Once
  1103.  * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
  1104.  * structures to access the data of the message.
  1105.  *
  1106.  ****************************************************************************)
  1107.  
  1108. (*
  1109.  * A new player or group has been created in the session
  1110.  * Use TDPMsg_CreatePlayerOrGroup.  Check dwPlayerType to see if it
  1111.  * is a player or a group.
  1112.  *)
  1113.   DPSYS_CREATEPLAYERORGROUP = $0003;
  1114.  
  1115. (*
  1116.  * A player has been deleted from the session
  1117.  * Use TDPMsg_DestroyPlayerOrGroup
  1118.  *)
  1119.   DPSYS_DESTROYPLAYERORGROUP = $0005;
  1120.  
  1121. (*
  1122.  * A player has been added to a group
  1123.  * Use DPMSG_ADDPLAYERTOGROUP
  1124.  *)
  1125.   DPSYS_ADDPLAYERTOGROUP = $0007;
  1126.  
  1127. (*
  1128.  * A player has been removed from a group
  1129.  * Use DPMSG_DELETEPLAYERFROMGROUP
  1130.  *)
  1131.   DPSYS_DELETEPLAYERFROMGROUP = $0021;
  1132.  
  1133. (*
  1134.  * This DirectPlay object lost its connection with all the
  1135.  * other players in the session.
  1136.  * Use DPMSG_SESSIONLOST.
  1137.  *)
  1138.   DPSYS_SESSIONLOST = $0031;
  1139.  
  1140. (*
  1141.  * The current host has left the session.
  1142.  * This DirectPlay object is now the host.
  1143.  * Use DPMSG_HOST.
  1144.  *)
  1145.   DPSYS_HOST = $0101;
  1146.  
  1147. (*
  1148.  * The remote data associated with a player or
  1149.  * group has changed. Check dwPlayerType to see
  1150.  * if it is a player or a group
  1151.  * Use DPMSG_SETPLAYERORGROUPDATA
  1152.  *)
  1153.   DPSYS_SETPLAYERORGROUPDATA = $0102;
  1154.  
  1155. (*
  1156.  * The name of a player or group has changed.
  1157.  * Check dwPlayerType to see if it is a player
  1158.  * or a group.
  1159.  * Use TDPMsg_SetPlayerOrGroupName
  1160.  *)
  1161.   DPSYS_SETPLAYERORGROUPNAME = $0103;
  1162.  
  1163. (*
  1164.  * The session description has changed.
  1165.  * Use DPMSG_SETSESSIONDESC
  1166.  *)
  1167.   DPSYS_SETSESSIONDESC = $0104;
  1168.  
  1169. (*
  1170.  * A group has been added to a group
  1171.  * Use TDPMsg_AddGroupToGroup
  1172.  *)
  1173.   DPSYS_ADDGROUPTOGROUP = $0105;
  1174.  
  1175. (*
  1176.  * A group has been removed from a group
  1177.  * Use DPMsg_DeleteGroupFromGroup
  1178.  *)
  1179.   DPSYS_DELETEGROUPFROMGROUP = $0106;
  1180.  
  1181. (*
  1182.  * A secure player-player message has arrived.
  1183.  * Use DPMSG_SECUREMESSAGE
  1184.  *)
  1185.   DPSYS_SECUREMESSAGE = $0107;
  1186.  
  1187. (*
  1188.  * Start a new session.
  1189.  * Use DPMSG_STARTSESSION
  1190.  *)
  1191.   DPSYS_STARTSESSION = $0108;
  1192.  
  1193. (*
  1194.  * A chat message has arrived
  1195.  * Use DPMSG_CHAT
  1196.  *)
  1197.   DPSYS_CHAT = $0109;
  1198.  
  1199. (*
  1200.  * The owner of a group has changed
  1201.  * Use DPMSG_SETGROUPOWNER
  1202.  *)
  1203.   DPSYS_SETGROUPOWNER = $010A;
  1204.  
  1205. (*
  1206.  * An async send has finished, failed or been cancelled
  1207.  * Use DPMSG_SENDCOMPLETE
  1208.  *)
  1209.   DPSYS_SENDCOMPLETE = $010D;
  1210.  
  1211. (*
  1212.  * Used in the dwPlayerType field to indicate if it applies to a group
  1213.  * or a player
  1214.  *)
  1215.   DPPLAYERTYPE_GROUP = $00000000;
  1216.   DPPLAYERTYPE_PLAYER = $00000001;
  1217.  
  1218. type
  1219. (*
  1220.  * TDPMsg_Generic
  1221.  * Generic message structure used to identify the message type.
  1222.  *)
  1223.   PDPMsg_Generic = ^TDPMsg_Generic;
  1224.   TDPMsg_Generic = packed record
  1225.     dwType: DWORD; // Message type
  1226.   end;
  1227.  
  1228. (*
  1229.  * TDPMsg_CreatePlayerOrGroup
  1230.  * System message generated when a new player or group
  1231.  * created in the session with information about it.
  1232.  *)
  1233.   PDPMsg_CreatePlayerOrGroup = ^TDPMsg_CreatePlayerOrGroup;
  1234.   TDPMsg_CreatePlayerOrGroup = packed record
  1235.     dwType: DWORD; // Message type
  1236.     dwPlayerType: DWORD; // Is it a player or group
  1237.     DPID: TDPID; // ID of the player or group
  1238.     dwCurrentPlayers: DWORD; // current # players & groups in session
  1239.     lpData: Pointer; // pointer to remote data
  1240.     dwDataSize: DWORD; // size of remote data
  1241.     dpnName: TDPName; // structure with name info
  1242.                                // the following fields are only available when using
  1243.                                // the IDirectPlay3 interface or greater
  1244.     dpIdParent: TDPID; // id of parent group
  1245.     dwFlags: DWORD; // player or group flags
  1246.   end;
  1247.  
  1248. (*
  1249.  * TDPMsg_DestroyPlayerOrGroup
  1250.  * System message generated when a player or group is being
  1251.  * destroyed in the session with information about it.
  1252.  *)
  1253.   PDPMsg_DestroyPlayerOrGroup = ^TDPMsg_DestroyPlayerOrGroup;
  1254.   TDPMsg_DestroyPlayerOrGroup = packed record
  1255.     dwType: DWORD; // Message type
  1256.     dwPlayerType: DWORD; // Is it a player or group
  1257.     DPID: TDPID; // player ID being deleted
  1258.     lpLocalData: Pointer; // copy of players local data
  1259.     dwLocalDataSize: DWORD; // sizeof local data
  1260.     lpRemoteData: Pointer; // copy of players remote data
  1261.     dwRemoteDataSize: DWORD; // sizeof remote data
  1262.                                // the following fields are only available when using
  1263.                                // the IDirectPlay3 interface or greater
  1264.     dpnName: TDPName; // structure with name info
  1265.     dpIdParent: TDPID; // id of parent group
  1266.     dwFlags: DWORD; // player or group flags
  1267.   end;
  1268.  
  1269. (*
  1270.  * DPMSG_ADDPLAYERTOGROUP
  1271.  * System message generated when a player is being added
  1272.  * to a group.
  1273.  *)
  1274.   PDPMsg_AddPlayerToGroup = ^TDPMsg_AddPlayerToGroup;
  1275.   TDPMsg_AddPlayerToGroup = packed record
  1276.     dwType: DWORD; // Message type
  1277.     dpIdGroup: TDPID; // group ID being added to
  1278.     dpIdPlayer: TDPID; // player ID being added
  1279.   end;
  1280.  
  1281. (*
  1282.  * DPMSG_DELETEPLAYERFROMGROUP
  1283.  * System message generated when a player is being
  1284.  * removed from a group
  1285.  *)
  1286.   PDPMsg_DeletePlayerFromGroup = ^TDPMsg_DeletePlayerFromGroup;
  1287.   TDPMsg_DeletePlayerFromGroup = TDPMsg_AddPlayerToGroup;
  1288.  
  1289. (*
  1290.  * TDPMsg_AddGroupToGroup
  1291.  * System message generated when a group is being added
  1292.  * to a group.
  1293.  *)
  1294.   PDPMsg_AddGroupToGroup = ^TDPMsg_AddGroupToGroup;
  1295.   TDPMsg_AddGroupToGroup = packed record
  1296.     dwType: DWORD; // Message type
  1297.     dpIdParentGroup: TDPID; // group ID being added to
  1298.     dpIdGroup: TDPID; // group ID being added
  1299.   end;
  1300.  
  1301. (*
  1302.  * DPMsg_DeleteGroupFromGroup
  1303.  * System message generated when a GROUP is being
  1304.  * removed from a group
  1305.  *)
  1306.   PDPMsg_DeleteGroupFromGroup = ^TDPMsg_DeleteGroupFromGroup;
  1307.   TDPMsg_DeleteGroupFromGroup = TDPMsg_AddGroupToGroup;
  1308.  
  1309. (*
  1310.  * DPMSG_SETPLAYERORGROUPDATA
  1311.  * System message generated when remote data for a player or
  1312.  * group has changed.
  1313.  *)
  1314.   PDPMsg_SetPlayerOrGroupData = ^TDPMsg_SetPlayerOrGroupData;
  1315.   TDPMsg_SetPlayerOrGroupData = packed record
  1316.     dwType: DWORD; // Message type
  1317.     dwPlayerType: DWORD; // Is it a player or group
  1318.     DPID: TDPID; // ID of player or group
  1319.     lpData: Pointer; // pointer to remote data
  1320.     dwDataSize: DWORD; // size of remote data
  1321.   end;
  1322.  
  1323. (*
  1324.  * DPMSG_SETPLAYERORGROUPNAME
  1325.  * System message generated when the name of a player or
  1326.  * group has changed.
  1327.  *)
  1328.   PDPMsg_SetPlayerOrGroupName = ^TDPMsg_SetPlayerOrGroupName;
  1329.   TDPMsg_SetPlayerOrGroupName = packed record
  1330.     dwType: DWORD; // Message type
  1331.     dwPlayerType: DWORD; // Is it a player or group
  1332.     DPID: TDPID; // ID of player or group
  1333.     dpnName: TDPName; // structure with new name info
  1334.   end;
  1335.  
  1336. (*
  1337.  * DPMSG_SETSESSIONDESC
  1338.  * System message generated when session desc has changed
  1339.  *)
  1340.   PDPMsg_SetSessionDesc = ^TDPMsg_SetSessionDesc;
  1341.   TDPMsg_SetSessionDesc = packed record
  1342.     dwType: DWORD; // Message type
  1343.     dpDesc: TDPSessionDesc2; // Session desc
  1344.   end;
  1345.  
  1346. (*
  1347.  * DPMSG_HOST
  1348.  * System message generated when the host has migrated to this
  1349.  * DirectPlay object.
  1350.  *
  1351.  *)
  1352.   PDPMsg_Host = ^TDPMsg_Host;
  1353.   TDPMsg_Host = TDPMsg_Generic;
  1354.  
  1355. (*
  1356.  * DPMSG_SESSIONLOST
  1357.  * System message generated when the connection to the session is lost.
  1358.  *
  1359.  *)
  1360.   PDPMsg_SessionLost = ^TDPMsg_SessionLost;
  1361.   TDPMsg_SessionLost = TDPMsg_Generic;
  1362.  
  1363. (*
  1364.  * DPMSG_SECUREMESSAGE
  1365.  * System message generated when a player requests a secure send
  1366.  *)
  1367.   PDPMsg_SecureMessage = ^TDPMsg_SecureMessage;
  1368.   TDPMsg_SecureMessage = packed record
  1369.     dwType: DWORD; // Message Type
  1370.     dwFlags: DWORD; // Signed/Encrypted
  1371.     dpIdFrom: TDPID; // ID of Sending Player
  1372.     lpData: Pointer; // Player message
  1373.     dwDataSize: DWORD; // Size of player message
  1374.   end;
  1375.  
  1376. (*
  1377.  * DPMSG_STARTSESSION
  1378.  * System message containing all information required to
  1379.  * start a new session
  1380.  *)
  1381.   PDPMsg_StartSession = ^TDPMsg_StartSession;
  1382.   TDPMsg_StartSession = packed record
  1383.     dwType: DWORD; // Message type
  1384.     lpConn: PDPLConnection; // TDPLConnection structure
  1385.   end;
  1386.  
  1387. (*
  1388.  * DPMSG_CHAT
  1389.  * System message containing a chat message
  1390.  *)
  1391.   PDPMsg_Chat = ^TDPMsg_Chat;
  1392.   TDPMsg_Chat = packed record
  1393.     dwType: DWORD; // Message type
  1394.     dwFlags: DWORD; // Message flags
  1395.     idFromPlayer: TDPID; // ID of the Sending Player
  1396.     idToPlayer: TDPID; // ID of the To Player
  1397.     idToGroup: TDPID; // ID of the To Group
  1398.     lpChat: PDPChat; // Pointer to a structure containing the chat message
  1399.   end;
  1400.  
  1401. (*
  1402.  * DPMSG_SETGROUPOWNER
  1403.  * System message generated when the owner of a group has changed
  1404.  *)
  1405.   PDPMsg_SetGroupOwner = ^TDPMsg_SetGroupOwner;
  1406.   TDPMsg_SetGroupOwner = packed record
  1407.     dwType: DWORD; // Message type
  1408.     idGroup: TDPID; // ID of the group
  1409.     idNewOwner: TDPID; // ID of the player that is the new owner
  1410.     idOldOwner: TDPID; // ID of the player that used to be the owner
  1411.   end;
  1412.  
  1413. (*
  1414.  * DPMSG_SENDCOMPLETE
  1415.  * System message generated when finished with an Async Send message
  1416.  *
  1417.  * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't
  1418.  *                change this message w/o changing SENDPARMS.
  1419.  *)
  1420.   PDPMsg_SendComplete = ^TDPMsg_SendComplete;
  1421.   TDPMsg_SendComplete = packed record
  1422.     dwType: DWORD; // Message type
  1423.     idFrom: TDPID;
  1424.     idTo: TDPID;
  1425.     dwFlags: DWORD;
  1426.     dwPriority: DWORD;
  1427.     dwTimeout: DWORD;
  1428.     lpvContext: Pointer;
  1429.     dwMsgID: DWORD;
  1430.     hr: HRESULT;
  1431.     dwSendTime: DWORD;
  1432.   end;
  1433.  
  1434. (****************************************************************************
  1435.  *
  1436.  * DIRECTPLAY ERRORS
  1437.  *
  1438.  * Errors are represented by negative values and cannot be combined.
  1439.  *
  1440.  ****************************************************************************)
  1441. const
  1442.   MAKE_DPHRESULT = HResult($88770000);
  1443.  
  1444.   DP_OK = S_OK;
  1445.   DPERR_ALREADYINITIALIZED = MAKE_DPHRESULT + 5;
  1446.   DPERR_ACCESSDENIED = MAKE_DPHRESULT + 10;
  1447.   DPERR_ACTIVEPLAYERS = MAKE_DPHRESULT + 20;
  1448.   DPERR_BUFFERTOOSMALL = MAKE_DPHRESULT + 30;
  1449.   DPERR_CANTADDPLAYER = MAKE_DPHRESULT + 40;
  1450.   DPERR_CANTCREATEGROUP = MAKE_DPHRESULT + 50;
  1451.   DPERR_CANTCREATEPLAYER = MAKE_DPHRESULT + 60;
  1452.   DPERR_CANTCREATESESSION = MAKE_DPHRESULT + 70;
  1453.   DPERR_CAPSNOTAVAILABLEYET = MAKE_DPHRESULT + 80;
  1454.   DPERR_EXCEPTION = MAKE_DPHRESULT + 90;
  1455.   DPERR_GENERIC = E_FAIL;
  1456.   DPERR_INVALIDFLAGS = MAKE_DPHRESULT + 120;
  1457.   DPERR_INVALIDOBJECT = MAKE_DPHRESULT + 130;
  1458.   DPERR_INVALIDPARAM = E_INVALIDARG;
  1459.   DPERR_INVALIDPARAMS = DPERR_INVALIDPARAM;
  1460.   DPERR_INVALIDPLAYER = MAKE_DPHRESULT + 150;
  1461.   DPERR_INVALIDGROUP = MAKE_DPHRESULT + 155;
  1462.   DPERR_NOCAPS = MAKE_DPHRESULT + 160;
  1463.   DPERR_NOCONNECTION = MAKE_DPHRESULT + 170;
  1464.   DPERR_NOMEMORY = E_OUTOFMEMORY;
  1465.   DPERR_OUTOFMEMORY = DPERR_NOMEMORY;
  1466.   DPERR_NOMESSAGES = MAKE_DPHRESULT + 190;
  1467.   DPERR_NONAMESERVERFOUND = MAKE_DPHRESULT + 200;
  1468.   DPERR_NOPLAYERS = MAKE_DPHRESULT + 210;
  1469.   DPERR_NOSESSIONS = MAKE_DPHRESULT + 220;
  1470.   DPERR_PENDING = E_PENDING;
  1471.   DPERR_SENDTOOBIG = MAKE_DPHRESULT + 230;
  1472.   DPERR_TIMEOUT = MAKE_DPHRESULT + 240;
  1473.   DPERR_UNAVAILABLE = MAKE_DPHRESULT + 250;
  1474.   DPERR_UNSUPPORTED = E_NOTIMPL;
  1475.   DPERR_BUSY = MAKE_DPHRESULT + 270;
  1476.   DPERR_USERCANCEL = MAKE_DPHRESULT + 280;
  1477.   DPERR_NOINTERFACE = E_NOINTERFACE;
  1478.   DPERR_CANNOTCREATESERVER = MAKE_DPHRESULT + 290;
  1479.   DPERR_PLAYERLOST = MAKE_DPHRESULT + 300;
  1480.   DPERR_SESSIONLOST = MAKE_DPHRESULT + 310;
  1481.   DPERR_UNINITIALIZED = MAKE_DPHRESULT + 320;
  1482.   DPERR_NONEWPLAYERS = MAKE_DPHRESULT + 330;
  1483.   DPERR_INVALIDPASSWORD = MAKE_DPHRESULT + 340;
  1484.   DPERR_CONNECTING = MAKE_DPHRESULT + 350;
  1485.   DPERR_CONNECTIONLOST = MAKE_DPHRESULT + 360;
  1486.   DPERR_UNKNOWNMESSAGE = MAKE_DPHRESULT + 370;
  1487.   DPERR_CANCELFAILED = MAKE_DPHRESULT + 380;
  1488.   DPERR_INVALIDPRIORITY = MAKE_DPHRESULT + 390;
  1489.   DPERR_NOTHANDLED = MAKE_DPHRESULT + 400;
  1490.   DPERR_CANCELLED = MAKE_DPHRESULT + 410;
  1491.   DPERR_ABORTED = MAKE_DPHRESULT + 420;
  1492.  
  1493.   DPERR_BUFFERTOOLARGE = MAKE_DPHRESULT + 1000;
  1494.   DPERR_CANTCREATEPROCESS = MAKE_DPHRESULT + 1010;
  1495.   DPERR_APPNOTSTARTED = MAKE_DPHRESULT + 1020;
  1496.   DPERR_INVALIDINTERFACE = MAKE_DPHRESULT + 1030;
  1497.   DPERR_NOSERVICEPROVIDER = MAKE_DPHRESULT + 1040;
  1498.   DPERR_UNKNOWNAPPLICATION = MAKE_DPHRESULT + 1050;
  1499.   DPERR_NOTLOBBIED = MAKE_DPHRESULT + 1070;
  1500.   DPERR_SERVICEPROVIDERLOADED = MAKE_DPHRESULT + 1080;
  1501.   DPERR_ALREADYREGISTERED = MAKE_DPHRESULT + 1090;
  1502.   DPERR_NOTREGISTERED = MAKE_DPHRESULT + 1100;
  1503.  
  1504. //
  1505. // Security related errors
  1506. //
  1507.   DPERR_AUTHENTICATIONFAILED = MAKE_DPHRESULT + 2000;
  1508.   DPERR_CANTLOADSSPI = MAKE_DPHRESULT + 2010;
  1509.   DPERR_ENCRYPTIONFAILED = MAKE_DPHRESULT + 2020;
  1510.   DPERR_SIGNFAILED = MAKE_DPHRESULT + 2030;
  1511.   DPERR_CANTLOADSECURITYPACKAGE = MAKE_DPHRESULT + 2040;
  1512.   DPERR_ENCRYPTIONNOTSUPPORTED = MAKE_DPHRESULT + 2050;
  1513.   DPERR_CANTLOADCAPI = MAKE_DPHRESULT + 2060;
  1514.   DPERR_NOTLOGGEDIN = MAKE_DPHRESULT + 2070;
  1515.   DPERR_LOGONDENIED = MAKE_DPHRESULT + 2080;
  1516.  
  1517. (****************************************************************************
  1518.  *
  1519.  *      dplay 1.0 obsolete structures + interfaces
  1520.  *      Included for compatibility only. New apps should
  1521.  *      use IDirectPlay2
  1522.  *
  1523.  ****************************************************************************)
  1524.  
  1525.   DPOPEN_OPENSESSION = DPOPEN_JOIN;
  1526.   DPOPEN_CREATESESSION = DPOPEN_CREATE;
  1527.  
  1528.   DPENUMSESSIONS_PREVIOUS = $00000004;
  1529.  
  1530.   DPENUMPLAYERS_PREVIOUS = $00000004;
  1531.  
  1532.   DPSEND_GUARANTEE = DPSEND_GUARANTEED;
  1533.   DPSEND_TRYONCE = $00000004;
  1534.  
  1535.   DPCAPS_NAMESERVICE = $00000001;
  1536.   DPCAPS_NAMESERVER = DPCAPS_ISHOST;
  1537.   DPCAPS_GUARANTEED = $00000004;
  1538.  
  1539.   DPLONGNAMELEN = 52;
  1540.   DPSHORTNAMELEN = 20;
  1541.   DPSESSIONNAMELEN = 32;
  1542.   DPPASSWORDLEN = 16;
  1543.   DPUSERRESERVED = 16;
  1544.  
  1545.   DPSYS_ADDPLAYER = $0003;
  1546.   DPSYS_DELETEPLAYER = $0005;
  1547.  
  1548.   DPSYS_DELETEGROUP = $0020;
  1549.   DPSYS_DELETEPLAYERFROMGRP = $0021;
  1550.   DPSYS_CONNECT = $484B;
  1551.  
  1552. type
  1553.   PDPMsg_AddPlayer = ^TDPMsg_AddPlayer;
  1554.   TDPMsg_AddPlayer = packed record
  1555.     dwType: DWORD;
  1556.     dwPlayerType: DWORD;
  1557.     DPID: TDPID;
  1558.     szLongName: array[0..DPLONGNAMELEN - 1] of Char;
  1559.     szShortName: array[0..DPSHORTNAMELEN - 1] of Char;
  1560.     dwCurrentPlayers: DWORD;
  1561.   end;
  1562.  
  1563.   PDPMsg_AddGroup = ^TDPMsg_AddGroup;
  1564.   TDPMsg_AddGroup = TDPMsg_AddPlayer;
  1565.  
  1566.   PDPMsg_GroupAdd = ^TDPMsg_GroupAdd;
  1567.   TDPMsg_GroupAdd = packed record
  1568.     dwType: DWORD;
  1569.     dpIdGroup: TDPID;
  1570.     dpIdPlayer: TDPID;
  1571.   end;
  1572.  
  1573.   PDPMsg_GroupDelete = ^TDPMsg_GroupDelete;
  1574.   TDPMsg_GroupDelete = TDPMsg_GroupAdd;
  1575.  
  1576.   PDPMsg_DeletePlayer = ^TDPMsg_DeletePlayer;
  1577.   TDPMsg_DeletePlayer = packed record
  1578.     dwType: DWORD;
  1579.     DPID: TDPID;
  1580.   end;
  1581.  
  1582.   TDPEnumPlayersCallback = function(dpId: TDPID; lpFriendlyName: PChar;
  1583.     lpFormalName: PChar; dwFlags: DWORD; lpContext: Pointer): BOOL; stdcall;
  1584.  
  1585.   PDPSessionDesc = ^TDPSessionDesc;
  1586.   TDPSessionDesc = packed record
  1587.     dwSize: DWORD;
  1588.     guidSession: TGUID;
  1589.     dwSession: DWORD;
  1590.     dwMaxPlayers: DWORD;
  1591.     dwCurrentPlayers: DWORD;
  1592.     dwFlags: DWORD;
  1593.     szSessionName: array[0..DPSESSIONNAMELEN - 1] of Char;
  1594.     szUserField: array[0..DPUSERRESERVED - 1] of Char;
  1595.     dwReserved1: DWORD;
  1596.     szPassword: array[0..DPPASSWORDLEN - 1] of Char;
  1597.     dwReserved2: DWORD;
  1598.     dwUser1: DWORD;
  1599.     dwUser2: DWORD;
  1600.     dwUser3: DWORD;
  1601.     dwUser4: DWORD;
  1602.   end;
  1603.  
  1604.   TDPEnumSessionsCallback = function(const lpDPSessionDesc: TDPSessionDesc;
  1605.     lpContext: Pointer; var lpdwTimeOut: DWORD; dwFlags: DWORD): BOOL; stdcall;
  1606.  
  1607. type
  1608.   IDirectPlay = interface(IUnknown)
  1609.     ['{5454e9a0-db65-11ce-921c-00aa006c4972}']
  1610.     (*** IDirectPlay methods ***)
  1611.     function AddPlayerToGroup(pidGroup: TDPID; pidPlayer: TDPID): HResult; stdcall;
  1612.     function Close: HResult; stdcall;
  1613.     function CreatePlayer(out lppidID: TDPID; lpPlayerFriendlyName: PChar;
  1614.       lpPlayerFormalName: PChar; lpEvent: PHandle): HResult; stdcall;
  1615.     function CreateGroup(out lppidID: TDPID; lpGroupFriendlyName: PChar;
  1616.       lpGroupFormalName: PChar): HResult; stdcall;
  1617.     function DeletePlayerFromGroup(pidGroup: TDPID; pidPlayer: TDPID): HResult; stdcall;
  1618.     function DestroyPlayer(pidID: TDPID): HResult; stdcall;
  1619.     function DestroyGroup(pidID: TDPID): HResult; stdcall;
  1620.     function EnableNewPlayers(bEnable: BOOL): HResult; stdcall;
  1621.     function EnumGroupPlayers(pidGroupPID: TDPID; lpEnumPlayersCallback:
  1622.       TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  1623.     function EnumGroups(dwSessionID: DWORD; lpEnumPlayersCallback:
  1624.       TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  1625.     function EnumPlayers(dwSessionId: DWORD; lpEnumPlayersCallback:
  1626.       TDPEnumPlayersCallback; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  1627.     function EnumSessions(var lpSDesc: TDPSessionDesc; dwTimeout: DWORD;
  1628.       lpEnumSessionsCallback: TDPEnumSessionsCallback; lpContext: Pointer;
  1629.       dwFlags: DWORD): HResult; stdcall;
  1630.     function GetCaps(var lpDPCaps: TDPCaps): HResult; stdcall;
  1631.     function GetMessageCount(pidID: TDPID; var lpdwCount: DWORD): HResult; stdcall;
  1632.     function GetPlayerCaps(pidID: TDPID; var lpDPPlayerCaps: TDPCaps): HResult; stdcall;
  1633.     function GetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
  1634.       var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: PChar;
  1635.       var lpdwFormalNameLength: DWORD): HResult; stdcall;
  1636.     function Initialize(const lpGUID: TGUID): HResult; stdcall;
  1637.     function Open(var lpSDesc: TDPSessionDesc): HResult; stdcall;
  1638.     function Receive(var lppidFrom, lppidTo: TDPID; dwFlags: DWORD;
  1639.       var lpvBuffer; var lpdwSize: DWORD): HResult; stdcall;
  1640.     function SaveSession(lpSessionName: PChar): HResult; stdcall;
  1641.     function Send(pidFrom: TDPID; pidTo: TDPID; dwFlags: DWORD;
  1642.       var lpvBuffer; dwBuffSize: DWORD): HResult; stdcall;
  1643.     function SetPlayerName(pidID: TDPID; lpPlayerFriendlyName: PChar;
  1644.       lpPlayerFormalName: PChar): HResult; stdcall;
  1645.   end;
  1646.  
  1647. (*
  1648.  * GUIDS used by DirectPlay objects
  1649.  *)
  1650.   IID_IDirectPlay2W = IDirectPlay2W;
  1651.   IID_IDirectPlay2A = IDirectPlay2A;
  1652.   IID_IDirectPlay2 = IDirectPlay2;
  1653.  
  1654.   IID_IDirectPlay3W = IDirectPlay3W;
  1655.   IID_IDirectPlay3A = IDirectPlay3A;
  1656.   IID_IDirectPlay3 = IDirectPlay3;
  1657.  
  1658.   IID_IDirectPlay4W = IDirectPlay4W;
  1659.   IID_IDirectPlay4A = IDirectPlay4A;
  1660.   IID_IDirectPlay4 = IDirectPlay4;
  1661.  
  1662.   IID_IDirectPlay = IDirectPlay;
  1663.  
  1664. var
  1665.   DirectPlayCreate: function(lpGUID: PGUID; out lplpDP: IDirectPlay;
  1666.     pUnk: IUnknown): HResult; stdcall;
  1667.  
  1668. (*==========================================================================;
  1669.  *
  1670.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  1671.  *
  1672.  *  File:       dplobby.h
  1673.  *  Content:    DirectPlayLobby include file
  1674.  ***************************************************************************)
  1675.  
  1676. (*
  1677.  * GUIDS used by DirectPlay objects
  1678.  *)
  1679.  
  1680. const
  1681. (* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} *)
  1682.   CLSID_DirectPlayLobby: TGUID =
  1683.   (D1: $2FE8F810; D2: $B2A5; D3: $11D0; D4: ($A7, $87, $00, $00, $F8, $3, $AB, $FC));
  1684.  
  1685. (****************************************************************************
  1686.  *
  1687.  * IDirectPlayLobby Structures
  1688.  *
  1689.  * Various structures used to invoke DirectPlayLobby.
  1690.  *
  1691.  ****************************************************************************)
  1692.  
  1693. type
  1694. (*
  1695.  * TDPLAppInfo
  1696.  * Used to hold information about a registered DirectPlay
  1697.  * application
  1698.  *)
  1699.   PDPLAppInfo = ^TDPLAppInfo;
  1700.   TDPLAppInfo = packed record
  1701.     dwSize: DWORD; // Size of this structure
  1702.     guidApplication: TGUID; // GUID of the Application
  1703.     case Integer of // Pointer to the Application Name
  1704.       0: (lpszAppName: PCharAW);
  1705.       1: (lpszAppNameW: PWideChar);
  1706.       3: (lpszAppNameA: PChar);
  1707.   end;
  1708.  
  1709. (*
  1710.  * TDPCompoundAddressElement
  1711.  *
  1712.  * An array of these is passed to CreateCompoundAddresses()
  1713.  *)
  1714.   PDPCompoundAddressElement = ^TDPCompoundAddressElement;
  1715.   TDPCompoundAddressElement = packed record
  1716.     guidDataType: TGUID;
  1717.     dwDataSize: DWORD;
  1718.     lpData: Pointer;
  1719.   end;
  1720.  
  1721. (*
  1722.  * TDPApplicationDesc
  1723.  * Used to register a DirectPlay application
  1724.  *)
  1725.   PDPApplicationDesc = ^TDPApplicationDesc;
  1726.   TDPApplicationDesc = packed record
  1727.     dwSize: DWORD;
  1728.     dwFlags: DWORD;
  1729.     case Integer of
  1730.       0: (lpszApplicationName: PCharAW;
  1731.         guidApplication: TGUID;
  1732.         lpszFilename: PCharAW;
  1733.         lpszCommandLine: PCharAW;
  1734.         lpszPath: PCharAW;
  1735.         lpszCurrentDirectory: PCharAW;
  1736.         lpszDescriptionA: PAnsiChar;
  1737.         lpszDescriptionW: PWideChar);
  1738.       1: (lpszApplicationNameA: PAnsiChar;
  1739.         filler1: TGUID;
  1740.         lpszFilenameA: PAnsiChar;
  1741.         lpszCommandLineA: PAnsiChar;
  1742.         lpszPathA: PAnsiChar;
  1743.         lpszCurrentDirectoryA: PAnsiChar);
  1744.       2: (lpszApplicationNameW: PWideChar;
  1745.         filler2: TGUID;
  1746.         lpszFilenameW: PWideChar;
  1747.         lpszCommandLineW: PWideChar;
  1748.         lpszPathW: PWideChar;
  1749.         lpszCurrentDirectoryW: PWideChar);
  1750.   end;
  1751.  
  1752. (*
  1753.  * TDPApplicationDesc2
  1754.  * Used to register a DirectPlay application
  1755.  *)
  1756.   PDPApplicationDesc2 = ^TDPApplicationDesc2;
  1757.   TDPApplicationDesc2 = packed record
  1758.     dwSize: DWORD;
  1759.     dwFlags: DWORD;
  1760.     case Integer of
  1761.       0: (lpszApplicationName: PCharAW;
  1762.         guidApplication: TGUID;
  1763.         lpszFilename: PCharAW;
  1764.         lpszCommandLine: PCharAW;
  1765.         lpszPath: PCharAW;
  1766.         lpszCurrentDirectory: PCharAW;
  1767.         lpszDescriptionA: PAnsiChar;
  1768.         lpszDescriptionW: PWideChar;
  1769.         lpszAppLauncherName: PCharAW);
  1770.       1: (lpszApplicationNameA: PAnsiChar;
  1771.         filler1: TGUID;
  1772.         lpszFilenameA: PAnsiChar;
  1773.         lpszCommandLineA: PAnsiChar;
  1774.         lpszPathA: PAnsiChar;
  1775.         lpszCurrentDirectoryA: PAnsiChar;
  1776.         filler3: PChar;
  1777.         filler4: PChar;
  1778.         lpszAppLauncherNameA: PAnsiChar);
  1779.       2: (lpszApplicationNameW: PWideChar;
  1780.         filler2: TGUID;
  1781.         lpszFilenameW: PWideChar;
  1782.         lpszCommandLineW: PWideChar;
  1783.         lpszPathW: PWideChar;
  1784.         lpszCurrentDirectoryW: PWideChar;
  1785.         filler5: PChar;
  1786.         filler6: PChar;
  1787.         lpszAppLauncherNameW: PWideChar);
  1788.   end;
  1789.  
  1790. (****************************************************************************
  1791.  *
  1792.  * Enumeration Method Callback Prototypes
  1793.  *
  1794.  ****************************************************************************)
  1795.  
  1796. (*
  1797.  * Callback for EnumAddress()
  1798.  *)
  1799.   TDPEnumAdressCallback = function(const guidDataType: TGUID;
  1800.     dwDataSize: DWORD; lpData: Pointer; lpContext: Pointer): BOOL; stdcall;
  1801.  
  1802. (*
  1803.  * Callback for EnumAddressTypes()
  1804.  *)
  1805.   TDPLEnumAddressTypesCallback = function(const guidDataType: TGUID;
  1806.     lpContext: Pointer; dwFlags: DWORD): BOOL; stdcall;
  1807.  
  1808. (*
  1809.  * Callback for EnumLocalApplications()
  1810.  *)
  1811.   TDPLEnumLocalApplicationsCallback = function(const lpAppInfo: TDPLAppInfo;
  1812.     lpContext: Pointer; dwFlags: DWORD): BOOL; stdcall;
  1813.  
  1814. (****************************************************************************
  1815.  *
  1816.  * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
  1817.  *
  1818.  ****************************************************************************)
  1819.  
  1820. type
  1821.   IDirectPlayLobbyAW = interface(IUnknown)
  1822.     (*** IDirectPlayLobby methods ***)
  1823.     function Connect(dwFlags: DWORD; out lplpDP: IDirectPlay2;
  1824.       pUnk: IUnknown): HResult; stdcall;
  1825.     function CreateAddress(const guidSP, guidDataType: TGUID; var lpData;
  1826.       dwDataSize: DWORD; var lpAddress; var lpdwAddressSize: DWORD): HResult; stdcall;
  1827.     function EnumAddress(lpEnumAddressCallback: TDPEnumAdressCallback;
  1828.       var lpAddress; dwAddressSize: DWORD; lpContext: Pointer): HResult; stdcall;
  1829.     function EnumAddressTypes(lpEnumAddressTypeCallback:
  1830.       TDPLEnumAddressTypesCallback; const guidSP: TGUID; lpContext: Pointer;
  1831.       dwFlags: DWORD): HResult; stdcall;
  1832.     function EnumLocalApplications(lpEnumLocalAppCallback: TDPLEnumLocalApplicationsCallback;
  1833.       lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  1834.     function GetConnectionSettings(dwAppID: DWORD; lpData: PDPLConnection;
  1835.       var lpdwDataSize: DWORD): HResult; stdcall;
  1836.     function ReceiveLobbyMessage(dwFlags: DWORD; dwAppID: DWORD;
  1837.       var lpdwMessageFlags: DWORD; lpData: Pointer; var lpdwDataSize: DWORD): HResult; stdcall;
  1838.     function RunApplication(dwFlags: DWORD; var lpdwAppId: DWORD;
  1839.       const lpConn: TDPLConnection; hReceiveEvent: THandle): HResult; stdcall;
  1840.     function SendLobbyMessage(dwFlags: DWORD; dwAppID: DWORD; const lpData;
  1841.       dwDataSize: DWORD): HResult; stdcall;
  1842.     function SetConnectionSettings(dwFlags: DWORD; dwAppID: DWORD;
  1843.       var lpConn: TDPLConnection): HResult; stdcall;
  1844.     function SetLobbyMessageEvent(dwFlags: DWORD; dwAppID: DWORD;
  1845.       hReceiveEvent: THandle): HResult; stdcall;
  1846.   end;
  1847.  
  1848.   IDirectPlayLobbyW = interface(IDirectPlayLobbyAW)
  1849.     ['{AF465C71-9588-11CF-A020-00AA006157AC}']
  1850.   end;
  1851.   IDirectPlayLobbyA = interface(IDirectPlayLobbyAW)
  1852.     ['{26C66A70-B367-11cf-A024-00AA006157AC}']
  1853.   end;
  1854.  
  1855. {$IFDEF UNICODE}
  1856.   IDirectPlayLobby = IDirectPlayLobbyW;
  1857. {$ELSE}
  1858.   IDirectPlayLobby = IDirectPlayLobbyA;
  1859. {$ENDIF}
  1860.  
  1861. (****************************************************************************
  1862.  *
  1863.  * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface
  1864.  *
  1865.  ****************************************************************************)
  1866.  
  1867.   IDirectPlayLobby2AW = interface(IDirectPlayLobbyAW)
  1868.     (*** IDirectPlayLobby2 methods ***)
  1869.     function CreateCompoundAddress(const lpElements: TDPCompoundAddressElement;
  1870.       dwElementCount: DWORD; lpAddress: Pointer; var lpdwAddressSize: DWORD): HResult; stdcall;
  1871.   end;
  1872.  
  1873.   IDirectPlayLobby2W = interface(IDirectPlayLobby2AW)
  1874.     ['{0194C220-A303-11D0-9C4F-00A0C905425E}']
  1875.   end;
  1876.   IDirectPlayLobby2A = interface(IDirectPlayLobby2AW)
  1877.     ['{1BB4AF80-A303-11d0-9C4F-00A0C905425E}']
  1878.   end;
  1879.  
  1880. {$IFDEF UNICODE}
  1881.   IDirectPlayLobby2 = IDirectPlayLobby2W;
  1882. {$ELSE}
  1883.   IDirectPlayLobby2 = IDirectPlayLobby2A;
  1884. {$ENDIF}
  1885.  
  1886. (****************************************************************************
  1887.  *
  1888.  * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface
  1889.  *
  1890.  ****************************************************************************)
  1891.  
  1892.   IDirectPlayLobby3AW = interface(IDirectPlayLobby2AW)
  1893.     (*** IDirectPlayLobby3 methods ***)
  1894.     function ConnectEx(dwFlags: DWORD; const riid: TGUID;
  1895.       out lplpDP; pUnk: IUnknown): HResult; stdcall;
  1896.     function RegisterApplication(dwFlags: DWORD;
  1897.       var lpAppDesc: TDPApplicationDesc): HResult; stdcall;
  1898.     function UnregisterApplication(dwFlags: DWORD;
  1899.       const guidApplication: TGUID): HResult; stdcall;
  1900.     function WaitForConnectionSettings(dwFlags: DWORD): HResult; stdcall;
  1901.   end;
  1902.  
  1903.   IDirectPlayLobby3W = interface(IDirectPlayLobby3AW)
  1904.     ['{2DB72490-652C-11d1-A7A8-0000F803ABFC}']
  1905.   end;
  1906.   IDirectPlayLobby3A = interface(IDirectPlayLobby3AW)
  1907.     ['{2DB72491-652C-11d1-A7A8-0000F803ABFC}']
  1908.   end;
  1909.  
  1910. {$IFDEF UNICODE}
  1911.   IDirectPlayLobby3 = IDirectPlayLobby3W;
  1912. {$ELSE}
  1913.   IDirectPlayLobby3 = IDirectPlayLobby3A;
  1914. {$ENDIF}
  1915.  
  1916.   IID_IDirectPlayLobbyW = IDirectPlayLobbyW;
  1917.   IID_IDirectPlayLobbyA = IDirectPlayLobbyA;
  1918.   IID_IDirectPlayLobby = IDirectPlayLobby;
  1919.  
  1920.   IID_IDirectPlayLobby2W = IDirectPlayLobby2W;
  1921.   IID_IDirectPlayLobby2A = IDirectPlayLobby2A;
  1922.   IID_IDirectPlayLobby2 = IDirectPlayLobby2;
  1923.  
  1924.   IID_IDirectPlayLobby3W = IDirectPlayLobby3W;
  1925.   IID_IDirectPlayLobby3A = IDirectPlayLobby3A;
  1926.   IID_IDirectPlayLobby3 = IDirectPlayLobby3;
  1927.  
  1928. (****************************************************************************
  1929.  *
  1930.  * DirectPlayLobby API Prototypes
  1931.  *
  1932.  ****************************************************************************)
  1933.  
  1934. var
  1935.   DirectPlayLobbyCreateW: function(lpguidSP: PGUID; out lplpDPL:
  1936.     IDirectPlayLobbyW; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  1937.   DirectPlayLobbyCreateA: function(lpguidSP: PGUID; out lplpDPL:
  1938.     IDirectPlayLobbyA; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  1939.   DirectPlayLobbyCreate: function(lpguidSP: PGUID; out lplpDPL:
  1940.     IDirectPlayLobby; lpUnk: IUnknown; lpData: Pointer; dwDataSize: DWORD): HResult; stdcall;
  1941.  
  1942. const
  1943. (****************************************************************************
  1944.  *
  1945.  * DirectPlayLobby Flags
  1946.  *
  1947.  ****************************************************************************)
  1948.  
  1949. (*
  1950.  *  This flag is used by IDirectPlayLobby.WaitForConnectionSettings to
  1951.  *  cancel a current wait that is in progress.
  1952.  *)
  1953.   DPLWAIT_CANCEL = $00000001;
  1954.  
  1955. (*
  1956.  *      This is a message flag used by ReceiveLobbyMessage.  It can be
  1957.  *      returned in the dwMessageFlags parameter to indicate a message from
  1958.  *      the system.
  1959.  *)
  1960.   DPLMSG_SYSTEM = $00000001;
  1961.  
  1962. (*
  1963.  *      This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage.
  1964.  *  It is used to indicate that the message is a standard lobby message.
  1965.  *  TDPLMsg_SetProperty, TDPLMsg_SetPropertyResponse, TDPLMsg_GetProperty,
  1966.  *      TDPLMsg_GetPropertyResponse
  1967.  *)
  1968.   DPLMSG_STANDARD = $00000002;
  1969.  
  1970. type
  1971. (****************************************************************************
  1972.  *
  1973.  * DirectPlayLobby messages and message data structures
  1974.  *
  1975.  * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned
  1976.  * from a call to ReceiveLobbyMessage.
  1977.  *
  1978.  * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned
  1979.  * from a call to ReceiveLobbyMessage.
  1980.  *
  1981.  ****************************************************************************)
  1982.  
  1983. (*
  1984.  * TDPLMsg_Generic
  1985.  * Generic message structure used to identify the message type.
  1986.  *)
  1987.   PDPLMsg_Generic = ^TDPLMsg_Generic;
  1988.   TDPLMsg_Generic = packed record
  1989.     dwType: DWORD; // Message type
  1990.   end;
  1991.  
  1992. (*
  1993.  * TDPLMsg_SystemMessage
  1994.  * Generic message format for all system messages --
  1995.  * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED,
  1996.  * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS
  1997.  *)
  1998.   PDPLMsg_SystemMessage = ^TDPLMsg_SystemMessage;
  1999.   TDPLMsg_SystemMessage = packed record
  2000.     dwType: DWORD; // Message type
  2001.     guidInstance: TGUID; // Instance GUID of the dplay session the message corresponds to
  2002.   end;
  2003.  
  2004. (*
  2005.  *  TDPLMsg_SetProperty
  2006.  *  Standard message sent by an application to a lobby to set a
  2007.  *  property
  2008.  *)
  2009.   PDPLMsg_SetProperty = ^TDPLMsg_SetProperty;
  2010.   TDPLMsg_SetProperty = packed record
  2011.     dwType: DWORD; // Message type
  2012.     dwRequestID: DWORD; // Request ID (DPL_NOCONFIRMATION if no confirmation desired)
  2013.     guidPlayer: TGUID; // Player GUID
  2014.     guidPropertyTag: TGUID; // Property GUID
  2015.     dwDataSize: DWORD; // Size of data
  2016.     dwPropertyData: array[0..0] of DWORD; // Buffer containing data
  2017.   end;
  2018.  
  2019. const
  2020.   DPL_NOCONFIRMATION = 0;
  2021.  
  2022. type
  2023. (*
  2024.  *  TDPLMsg_SetPropertyResponse
  2025.  *  Standard message returned by a lobby to confirm a
  2026.  *  TDPLMsg_SetProperty message.
  2027.  *)
  2028.   PDPLMsg_SetPropertyResponse = ^TDPLMsg_SetPropertyResponse;
  2029.   TDPLMsg_SetPropertyResponse = packed record
  2030.     dwType: DWORD; // Message type
  2031.     dwRequestID: DWORD; // Request ID
  2032.     guidPlayer: TGUID; // Player GUID
  2033.     guidPropertyTag: TGUID; // Property GUID
  2034.     hr: HResult; // Return Code
  2035.   end;
  2036.  
  2037. (*
  2038.  *  TDPLMsg_GetProperty
  2039.  *  Standard message sent by an application to a lobby to request
  2040.  *      the current value of a property
  2041.  *)
  2042.   PDPLMsg_GetProperty = ^TDPLMsg_GetProperty;
  2043.   TDPLMsg_GetProperty = packed record
  2044.     dwType: DWORD; // Message type
  2045.     dwRequestID: DWORD; // Request ID
  2046.     guidPlayer: TGUID; // Player GUID
  2047.     guidPropertyTag: TGUID; // Property GUID
  2048.   end;
  2049.   LPDPLMSG_GETPROPERTY = ^TDPLMsg_GetProperty;
  2050.  
  2051. (*
  2052.  *  TDPLMsg_GetPropertyResponse
  2053.  *  Standard message returned by a lobby in response to a
  2054.  *      TDPLMsg_GetProperty message.
  2055.  *)
  2056.   PDPLMsg_GetPropertyResponse = ^TDPLMsg_GetPropertyResponse;
  2057.   TDPLMsg_GetPropertyResponse = packed record
  2058.     dwType: DWORD; // Message type
  2059.     dwRequestID: DWORD; // Request ID
  2060.     guidPlayer: TGUID; // Player GUID
  2061.     guidPropertyTag: TGUID; // Property GUID
  2062.     hr: HResult; // Return Code
  2063.     dwDataSize: DWORD; // Size of data
  2064.     dwPropertyData: array[0..0] of DWORD; // Buffer containing data
  2065.   end;
  2066.  
  2067. (*
  2068.  *  TDPLMsg_NewSessionHost
  2069.  *  Standard message returned by a lobby in response to a
  2070.  *  the session host migrating to a new client
  2071.  *)
  2072.   PDPLMsg_NewSessionHost = ^TDPLMsg_NewSessionHost;
  2073.   TDPLMsg_NewSessionHost = packed record
  2074.     dwType: DWORD; // Message type
  2075.     guidInstance: TGUID; // Property GUID
  2076.   end;
  2077.  
  2078. const
  2079. (******************************************
  2080.  *
  2081.  *      DirectPlay Lobby message dwType values
  2082.  *
  2083.  *****************************************)
  2084.  
  2085. (*
  2086.  *  The application has read the connection settings.
  2087.  *  It is now O.K. for the lobby client to release
  2088.  *  its IDirectPlayLobby interface.
  2089.  *)
  2090.   DPLSYS_CONNECTIONSETTINGSREAD = $00000001;
  2091.  
  2092. (*
  2093.  *  The application's call to DirectPlayConnect failed
  2094.  *)
  2095.   DPLSYS_DPLAYCONNECTFAILED = $00000002;
  2096.  
  2097. (*
  2098.  *  The application has created a DirectPlay session.
  2099.  *)
  2100.   DPLSYS_DPLAYCONNECTSUCCEEDED = $00000003;
  2101.  
  2102. (*
  2103.  *  The application has terminated.
  2104.  *)
  2105.   DPLSYS_APPTERMINATED = $00000004;
  2106.  
  2107. (*
  2108.  *  The message is a TDPLMsg_SetProperty message.
  2109.  *)
  2110.   DPLSYS_SETPROPERTY = $00000005;
  2111.  
  2112. (*
  2113.  *  The message is a TDPLMsg_SetPropertyResponse message.
  2114.  *)
  2115.   DPLSYS_SETPROPERTYRESPONSE = $00000006;
  2116.  
  2117. (*
  2118.  *  The message is a TDPLMsg_GetProperty message.
  2119.  *)
  2120.   DPLSYS_GETPROPERTY = $00000007;
  2121.  
  2122. (*
  2123.  *  The message is a TDPLMsg_GetPropertyResponse message.
  2124.  *)
  2125.   DPLSYS_GETPROPERTYRESPONSE = $00000008;
  2126.  
  2127. (*
  2128.  *  The message is a TDPLMsg_NewSessionHost message.
  2129.  *)
  2130.   DPLSYS_NEWSESSIONHOST = $00000009;
  2131.  
  2132. (*
  2133.  *  New connection settings are available.
  2134.  *)
  2135.   DPLSYS_NEWCONNECTIONSETTINGS = $0000000A;
  2136.  
  2137. (****************************************************************************
  2138.  *
  2139.  * DirectPlay defined property GUIDs and associated data structures
  2140.  *
  2141.  ****************************************************************************)
  2142.  
  2143. (*
  2144.  * DPLPROPERTY_MessagesSupported
  2145.  *
  2146.  * Request whether the lobby supports standard.  Lobby with respond with either
  2147.  * TRUE or FALSE or may not respond at all.
  2148.  *
  2149.  * Property data is a single BOOL with TRUE or FALSE
  2150.  *)
  2151. // {762CCDA1-D916-11d0-BA39-00C04FD7ED67}
  2152.   DPLPROPERTY_MessagesSupported: TGUID =
  2153.   (D1: $762CCDA1; D2: $D916; D3: $11D0; D4: ($BA, $39, $00, $C0, $4F, $D7, $ED, $67));
  2154.  
  2155. (*
  2156.  * DPLPROPERTY_LobbyGuid
  2157.  *
  2158.  * Request the GUID that identifies the lobby software that the application
  2159.  * is communicating with.
  2160.  *
  2161.  * Property data is a single GUID.
  2162.  *)
  2163. // {F56920A0-D218-11d0-BA39-00C04FD7ED67}
  2164.   DPLPROPERTY_LobbyGuid: TGUID =
  2165.   (D1: $F56920A0; D2: $D218; D3: $11D0; D4: ($BA, $39, $00, $C0, $4F, $D7, $ED, $67));
  2166.  
  2167. (*
  2168.  * DPLPROPERTY_PlayerGuid
  2169.  *
  2170.  * Request the GUID that identifies the player on this machine for sending
  2171.  * property data back to the lobby.
  2172.  *
  2173.  * Property data is the DPLDATA_PLAYERDATA structure
  2174.  *)
  2175. // {B4319322-D20D-11d0-BA39-00C04FD7ED67}
  2176.   DPLPROPERTY_PlayerGuid: TGUID =
  2177.   (D1: $B4319322; D2: $D20D; D3: $11D0; D4: ($BA, $39, $00, $C0, $4F, $D7, $ED, $67));
  2178.  
  2179. type
  2180. (*
  2181.  * TDPLData_PlayerGUID
  2182.  *
  2183.  * Data structure to hold the GUID of the player and player creation flags
  2184.  * from the lobby.
  2185.  *)
  2186.   PDPLData_PlayerGUID = ^TDPLData_PlayerGUID;
  2187.   TDPLData_PlayerGUID = packed record
  2188.     guidPlayer: TGUID;
  2189.     dwPlayerFlags: DWORD;
  2190.   end;
  2191.  
  2192. const
  2193. (*
  2194.  * DPLPROPERTY_PlayerScore
  2195.  *
  2196.  * Used to send an array of long integers to the lobby indicating the
  2197.  * score of a player.
  2198.  *
  2199.  * Property data is the TDPLData_PlayerScore structure.
  2200.  *)
  2201. // {48784000-D219-11d0-BA39-00C04FD7ED67}
  2202.   DPLPROPERTY_PlayerScore: TGUID =
  2203.   (D1: $48784000; D2: $D219; D3: $11D0; D4: ($BA, $39, $00, $C0, $4F, $D7, $ED, $67));
  2204.  
  2205. type
  2206. (*
  2207.  * TDPLData_PlayerScore
  2208.  *
  2209.  * Data structure to hold an array of long integers representing a player score.
  2210.  * Application must allocate enough memory to hold all the scores.
  2211.  *)
  2212.   PDPLData_PlayerScore = ^TDPLData_PlayerScore;
  2213.   TDPLData_PlayerScore = packed record
  2214.     dwScoreCount: DWORD;
  2215.     Score: array[0..0] of Longint;
  2216.   end;
  2217.  
  2218. (****************************************************************************
  2219.  *
  2220.  * DirectPlay Address ID's
  2221.  *
  2222.  ****************************************************************************)
  2223.  
  2224. (* DirectPlay Address
  2225.  *
  2226.  * A DirectPlay address consists of multiple chunks of data, each tagged
  2227.  * with a GUID signifying the type of data in the chunk. The chunk also
  2228.  * has a length so that unknown chunk types can be skipped.
  2229.  *
  2230.  * The EnumAddress() function is used to parse these address data chunks.
  2231.  *)
  2232.  
  2233. (*
  2234.  * TDPAddress
  2235.  *
  2236.  * Header for block of address data elements
  2237.  *)
  2238.   PDPAddress = ^TDPAddress;
  2239.   TDPAddress = packed record
  2240.     guidDataType: TGUID;
  2241.     dwDataSize: DWORD;
  2242.   end;
  2243.  
  2244. const
  2245. (*
  2246.  * DPAID_TotalSize
  2247.  *
  2248.  * Chunk is a DWORD containing size of entire TDPAddress structure
  2249.  *)
  2250.  
  2251. // {1318F560-912C-11d0-9DAA-00A0C90A43CB}
  2252.   DPAID_TotalSize: TGUID =
  2253.   (D1: $1318F560; D2: $912C; D3: $11D0; D4: ($9D, $AA, $00, $A0, $C9, $A, $43, $CB));
  2254.  
  2255. (*
  2256.  * DPAID_ServiceProvider
  2257.  *
  2258.  * Chunk is a GUID describing the service provider that created the chunk.
  2259.  * All addresses must contain this chunk.
  2260.  *)
  2261.  
  2262. // {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
  2263.   DPAID_ServiceProvider: TGUID =
  2264.   (D1: $7D916C0; D2: $E0AF; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $5, $42, $5E));
  2265.  
  2266. (*
  2267.  * DPAID_LobbyProvider
  2268.  *
  2269.  * Chunk is a GUID describing the lobby provider that created the chunk.
  2270.  * All addresses must contain this chunk.
  2271.  *)
  2272.  
  2273. // {59B95640-9667-11d0-A77D-0000F803ABFC}
  2274.   DPAID_LobbyProvider: TGUID =
  2275.   (D1: $59B95640; D2: $9667; D3: $11D0; D4: ($A7, $7D, $00, $00, $F8, $3, $AB, $FC));
  2276.  
  2277. (*
  2278.  * DPAID_Phone and DPAID_PhoneW
  2279.  *
  2280.  * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
  2281.  * in ANSI or UNICODE format
  2282.  *)
  2283.  
  2284. // {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
  2285.   DPAID_Phone: TGUID =
  2286.   (D1: $78EC89A0; D2: $E0AF; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $5, $42, $5E));
  2287.  
  2288. // {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E}
  2289.   DPAID_PhoneW: TGUID =
  2290.   (D1: $BA5A7A70; D2: $9DBF; D3: $11D0; D4: ($9C, $C1, $00, $A0, $C9, $5, $42, $5E));
  2291.  
  2292. (*
  2293.  * DPAID_Modem and DPAID_ModemW
  2294.  *
  2295.  * Chunk is a string containing a modem name registered with TAPI
  2296.  * in ANSI or UNICODE format
  2297.  *)
  2298.  
  2299. // {F6DCC200-A2FE-11d0-9C4F-00A0C905425E}
  2300.   DPAID_Modem: TGUID =
  2301.   (D1: $F6DCC200; D2: $A2FE; D3: $11D0; D4: ($9C, $4F, $00, $A0, $C9, $5, $42, $5E));
  2302.  
  2303. // {01FD92E0-A2FF-11d0-9C4F-00A0C905425E}
  2304.   DPAID_ModemW: TGUID =
  2305.   (D1: $1FD92E0; D2: $A2FF; D3: $11D0; D4: ($9C, $4F, $00, $A0, $C9, $5, $42, $5E));
  2306.  
  2307. (*
  2308.  * DPAID_Inet and DPAID_InetW
  2309.  *
  2310.  * Chunk is a string containing a TCP/IP host name or an IP address
  2311.  * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format
  2312.  *)
  2313.  
  2314. // {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
  2315.   DPAID_INet: TGUID =
  2316.   (D1: $C4A54DA0; D2: $E0AF; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $5, $42, $5E));
  2317.  
  2318. // {E63232A0-9DBF-11d0-9CC1-00A0C905425E}
  2319.   DPAID_INetW: TGUID =
  2320.   (D1: $E63232A0; D2: $9DBF; D3: $11D0; D4: ($9C, $C1, $00, $A0, $C9, $5, $42, $5E));
  2321.  
  2322. (*
  2323.  * DPAID_InetPort
  2324.  *
  2325.  * Chunk is the port number used for creating the apps TCP and UDP sockets.
  2326.  * WORD value (i.e. 47624)
  2327.  *)
  2328.  
  2329. // {E4524541-8EA5-11d1-8A96-006097B01411}
  2330.   DPAID_INetPort: TGUID =
  2331.   (D1: $E4524541; D2: $8EA5; D3: $11D1; D4: ($8A, $96, $00, $60, $97, $B0, $14, $11));
  2332.  
  2333. //@@BEGIN_MSINTERNAL
  2334. (*
  2335.  * DPAID_MaxMessageSize
  2336.  *
  2337.  * Tells DPLAY what the maximum allowed message size is.  Enables SPs to
  2338.  *      combat Denial of Service attacks
  2339.  *)
  2340.  
  2341.  // this terrible hack is needed so the SP can work with the Elmer build.
  2342.  // it can be removed when the MSINTERNAL stuff is removed
  2343. {$DEFINE MAXMSGSIZEGUIDDEFINED}
  2344.  
  2345. // {F5D09980-F0C4-11d1-8326-006097B01411}
  2346.   DPAID_MaxMessageSize: TGUID =
  2347.   (D1: $F5D09980; D2: $F0C4; D3: $11D1; D4: ($83, $26, $00, $60, $97, $B0, $14, $11));
  2348. //@@END_MSINTERNAL
  2349.  
  2350. (*
  2351.  * TDPComPortAddress
  2352.  *
  2353.  * Used to specify com port settings. The constants that define baud rate,
  2354.  * stop bits and parity are defined in WINBASE.H. The constants for flow
  2355.  * control are given below.
  2356.  *)
  2357.  
  2358.   DPCPA_NOFLOW = 0; // no flow control
  2359.   DPCPA_XONXOFFFLOW = 1; // software flow control
  2360.   DPCPA_RTSFLOW = 2; // hardware flow control with RTS
  2361.   DPCPA_DTRFLOW = 3; // hardware flow control with DTR
  2362.   DPCPA_RTSDTRFLOW = 4; // hardware flow control with RTS and DTR
  2363.  
  2364. type
  2365.   PDPComPortAddress = ^TDPComPortAddress;
  2366.   TDPComPortAddress = packed record
  2367.     dwComPort: DWORD; // COM port to use (1-4)
  2368.     dwBaudRate: DWORD; // baud rate (100-256k)
  2369.     dwStopBits: DWORD; // no. stop bits (1-2)
  2370.     dwParity: DWORD; // parity (none, odd, even, mark)
  2371.     dwFlowControl: DWORD; // flow control (none, xon/xoff, rts, dtr)
  2372.   end;
  2373.  
  2374. const
  2375. (*
  2376.  * DPAID_ComPort
  2377.  *
  2378.  * Chunk contains a TDPComPortAddress structure defining the serial port.
  2379.  *)
  2380.  
  2381. // {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
  2382.   DPAID_ComPort: TGUID =
  2383.   (D1: $F2F0CE00; D2: $E0AF; D3: $11CF; D4: ($9C, $4E, $00, $A0, $C9, $5, $42, $5E));
  2384.  
  2385. (****************************************************************************
  2386.  *
  2387.  *      dplobby 1.0 obsolete definitions
  2388.  *      Included for compatibility only.
  2389.  *
  2390.  ****************************************************************************)
  2391.  
  2392.   DPLAD_SYSTEM = DPLMSG_SYSTEM;
  2393.  
  2394. implementation
  2395.  
  2396. (*==========================================================================;
  2397.  *
  2398.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  2399.  *
  2400.  *  File:       dplay.h
  2401.  *  Content:    DirectPlay include file
  2402.  *
  2403.  ***************************************************************************)
  2404.  
  2405. function DPErrorString(Value: HResult): string;
  2406. begin
  2407.   case Value of
  2408.     CLASS_E_NOAGGREGATION: Result := 'A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.';
  2409.     DPERR_ACCESSDENIED: Result := 'The session is full or an incorrect password was supplied.';
  2410.     DPERR_ACTIVEPLAYERS: Result := 'The requested operation cannot be performed because there are existing active players.';
  2411.     DPERR_ALREADYINITIALIZED: Result := 'This object is already initialized.';
  2412.     DPERR_APPNOTSTARTED: Result := 'The application has not been started yet.';
  2413.     DPERR_AUTHENTICATIONFAILED: Result := 'The password or credentials supplied could not be authenticated.';
  2414.     DPERR_BUFFERTOOLARGE: Result := 'The data buffer is too large to store.';
  2415.     DPERR_BUSY: Result := 'A message cannot be sent because the transmission medium is busy.';
  2416.     DPERR_BUFFERTOOSMALL: Result := 'The supplied buffer is not large enough to contain the requested data.';
  2417.     DPERR_CANTADDPLAYER: Result := 'The player cannot be added to the session.';
  2418.     DPERR_CANTCREATEGROUP: Result := 'A new group cannot be created.';
  2419.     DPERR_CANTCREATEPLAYER: Result := 'A new player cannot be created.';
  2420.     DPERR_CANTCREATEPROCESS: Result := 'Cannot start the application.';
  2421.     DPERR_CANTCREATESESSION: Result := 'A new session cannot be created.';
  2422.     DPERR_CANTLOADCAPI: Result := 'No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded.';
  2423.     DPERR_CANTLOADSECURITYPACKAGE: Result := 'The software security package cannot be loaded.';
  2424.     DPERR_CANTLOADSSPI: Result := 'No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded.';
  2425.     DPERR_CAPSNOTAVAILABLEYET: Result := 'The capabilities of the DirectPlay object have not been determined yet. This error will occur if the DirectPlay object is implemented on a connectivity solution that requires polling to determine available bandwidth and latency.';
  2426.     DPERR_CONNECTING: Result := 'The method is in the process of connecting to the network. The application should keep calling the method until it returns DP_OK, indicating successful completion, or it returns a different error.';
  2427.     DPERR_ENCRYPTIONFAILED: Result := 'The requested information could not be digitally encrypted. Encryption is used for message privacy. This error is only relevant in a secure session.';
  2428.     DPERR_EXCEPTION: Result := 'An exception occurred when processing the request.';
  2429.     DPERR_GENERIC: Result := 'An undefined error condition occurred.';
  2430. //    DPERR_INVALIDCREDENTIALS: Result := 'The credentials supplied (as to IDirectPlay3::SecureOpen) were not valid.';
  2431.     DPERR_INVALIDFLAGS: Result := 'The flags passed to this method are invalid.';
  2432.     DPERR_INVALIDGROUP: Result := 'The group ID is not recognized as a valid group ID for this game session.';
  2433.     DPERR_INVALIDINTERFACE: Result := 'The interface parameter is invalid.';
  2434.     DPERR_INVALIDOBJECT: Result := 'The DirectPlay object pointer is invalid.';
  2435.     DPERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the method are invalid.';
  2436.     DPERR_INVALIDPASSWORD: Result := 'An invalid password was supplied when attempting to join a session that requires a password.';
  2437.     DPERR_INVALIDPLAYER: Result := 'The player ID is not recognized as a valid player ID for this game session.';
  2438.     DPERR_LOGONDENIED: Result := 'The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid.';
  2439.     DPERR_NOCAPS: Result := 'The communication link that DirectPlay is attempting to use is not capable of this function.';
  2440.     DPERR_NOCONNECTION: Result := 'No communication link was established.';
  2441.     DPERR_NOINTERFACE: Result := 'The interface is not supported.';
  2442.     DPERR_NOMESSAGES: Result := 'There are no messages in the receive queue.';
  2443.     DPERR_NONAMESERVERFOUND: Result := 'No name server (host) could be found or created. A host must exist to create a player.';
  2444.     DPERR_NONEWPLAYERS: Result := 'The session is not accepting any new players.';
  2445.     DPERR_NOPLAYERS: Result := 'There are no active players in the session.';
  2446.     DPERR_NOSESSIONS: Result := 'There are no existing sessions for this game.';
  2447.     DPERR_NOTLOBBIED: Result := 'Returned by the IDirectPlayLobby2::Connect method if the application was not started by using the IDirectPlayLobby2::RunApplication method or if there is no DPLCONNECTION structure currently initialized for this DirectPlayLobby object.';
  2448.     DPERR_NOTLOGGEDIN: Result := 'An action cannot be performed because a player or client application is not logged in. Returned by the IDirectPlay3::Send method when the client application tries to send a secure message without being logged in.';
  2449.     DPERR_OUTOFMEMORY: Result := 'There is insufficient memory to perform the requested operation.';
  2450.     DPERR_PLAYERLOST: Result := 'A player has lost the connection to the session.';
  2451.     DPERR_SENDTOOBIG: Result := 'The message being sent by the IDirectPlay3::Send method is too large.';
  2452.     DPERR_SESSIONLOST: Result := 'The connection to the session has been lost.';
  2453.     DPERR_SIGNFAILED: Result := 'The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages.';
  2454.     DPERR_TIMEOUT: Result := 'The operation could not be completed in the specified time.';
  2455.     DPERR_UNAVAILABLE: Result := 'The requested function is not available at this time.';
  2456.     DPERR_UNINITIALIZED: Result := 'The requested object has not been initialized.';
  2457.     DPERR_UNKNOWNAPPLICATION: Result := 'An unknown application was specified.';
  2458.     DPERR_UNSUPPORTED: Result := 'The function is not available in this implementation. Returned from IDirectPlay3::GetGroupConnectionSettings and IDirectPlay3::SetGroupConnectionSettings if they are called from a session that is not a lobby session.';
  2459.     DPERR_USERCANCEL: Result := 'Can be returned in two ways. 1) The user canceled the connection process during a call to the IDirectPlay3::Open method. 2) The user clicked Cancel in one of the DirectPlay service provider dialog boxes during a call to IDirectPlay3::EnumSessions.';
  2460.   else Result := 'Unrecognized Error';
  2461.   end;
  2462. end;
  2463.  
  2464. function IsNTandDelphiRunning : boolean;
  2465. var
  2466.   OSVersion  : TOSVersionInfo;
  2467.   AppName    : array[0..255] of char;
  2468. begin
  2469.   OSVersion.dwOsVersionInfoSize := sizeof(OSVersion);
  2470.   GetVersionEx(OSVersion);
  2471.   // Not running in NT or program is not Delphi itself ?
  2472.   AppName[0] := #0;
  2473.   lstrcat(AppName, PChar(ParamStr(0)));  // ParamStr(0) = Application.ExeName
  2474.   {$IFDEF UNICODE}
  2475.   CharUpperBuff(AppName, High(AppName) + 1);
  2476.   {$ELSE}
  2477.   CharUpperBuff(AppName, SizeOf(AppName));
  2478.   {$ENDIF}
  2479.   result := ( (OSVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) and
  2480.               (Pos('DELPHI32.EXE', AppName) = Length(AppName) - Length('DELPHI32.EXE') + 1) );
  2481. end;
  2482.  
  2483. initialization
  2484.   begin
  2485.     if not IsNTandDelphiRunning then
  2486.     begin
  2487.       DPlayDLL := LoadLibrary('DPlayX.dll');
  2488.  
  2489.       DirectPlayEnumerateA := GetProcAddress(DPlayDLL, 'DirectPlayEnumerateA');
  2490.       DirectPlayEnumerateW := GetProcAddress(DPlayDLL, 'DirectPlayEnumerateW');
  2491. {$IFDEF UNICODE}
  2492.       DirectPlayEnumerate := DirectPlayEnumerateW;
  2493. {$ELSE}
  2494.       DirectPlayEnumerate := DirectPlayEnumerateA;
  2495. {$ENDIF}
  2496.  
  2497.       DirectPlayCreate := GetProcAddress(DPlayDLL, 'DirectPlayCreate');
  2498.  
  2499. //  File:       dplay.h
  2500.  
  2501.       DirectPlayLobbyCreateW := GetProcAddress(DPlayDLL, 'DirectPlayLobbyCreateW');
  2502.       DirectPlayLobbyCreateA := GetProcAddress(DPlayDLL, 'DirectPlayLobbyCreateA');
  2503. {$IFDEF UNICODE}
  2504.       DirectPlayLobbyCreate := DirectPlayLobbyCreateW;
  2505. {$ELSE}
  2506.       DirectPlayLobbyCreate := DirectPlayLobbyCreateA;
  2507. {$ENDIF}
  2508.  
  2509.     end;
  2510.   end;
  2511.  
  2512. finalization
  2513.   begin
  2514.     if DPlayDLL <> 0 then FreeLibrary(DPlayDLL);
  2515.   end;
  2516.  
  2517. end.
  2518.