Platform SDK: DirectX

DirectPlay4.SecureOpen

The DirectPlay4.SecureOpen method creates or joins a secure session. When joining a secure session, use this method to supply logon credentials.

When creating a new session, the host computer can specify an alternate security package to use. When joining a session, a computer can specify a user name and password.

object.SecureOpen(sessionDesc DirectPlaySessionData, _
    flags As CONST_DPOPENFLAGS, _
    security As DPSECURITYDESC, 
    credentials As DPCREDENTIALS)) 

Parameters

object
Object expression that resolves to a DirectPlay4 object.
sessionDesc
DirectPlaySessionData object describing the session to be created or joined. If a session is to be joined, then only the SetGuidInstance and SetSessionPassword methods need to be called to initialize the object. The password need only be supplied if the enumerated session had the DPSESSION_PASSWORDREQUIRED flag set.

If a session is to be created, then the application must completely initialize the DirectPlaySessionData object with the properties of the session to be created, except for the instance GUID, which DirectPlay will supply.

The DPSESSION_SECURESERVER flag must be set to indicate that all computers attempting to open the session must be authenticated. If you don't specify the DPSESSION_SECURESERVER flag, SecureOpen will open an unsecured session, just as if you had called DirectPlay4.Open.

flags
Flags from the CONST_DPOPENFLAGS enumeration.
security
DPSECURITYDESC type containing the security package to use. Initialize all members of this type to 0 in order to use the default security package (NTLM) and CryptoAPI package (Microsoft RSA Base Cryptographic Provider). Relevant only when creating a session. You may pass an uninitialized structure when joining a session.
credentials
DPCREDENTIALS type containing the logon name, password, and domain to be authenticated on the server. Initialize the members of this type to 0 if there are no credentials. Credentials are ignored when creating a session.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DPERR_ACCESSDENIED
DPERR_ALREADYINITIALIZED
DPERR_AUTHENTICATIONFAILED
DPERR_CANNOTCREATESERVER
DPERR_CANTLOADCAPI
DPERR_CANTLOADSECURITYPACKAGE
DPERR_CANTLOADSSPI
DPERR_CONNECTING
DPERR_CONNECTIONLOST
DPERR_ENCRYPTIONFAILED
DPERR_INVALIDFLAGS
DPERR_INVALIDPARAMS
DPERR_INVALIDPASSWORD
DPERR_LOGONDENIED
DPERR_NOCONNECTION
DPERR_NONEWPLAYERS
DPERR_SIGNFAILED
DPERR_TIMEOUT
DPERR_UNINITIALIZED
DPERR_USERCANCEL

This method returns DPERR_LOGONDENIED after being called with invalid credentials or without credentials when credentials are required. The application must collect the user's credentials and call SecureOpen again.

Remarks

When joining a session, first call SecureOpen with no credentials. If the method returns DPERR_LOGONDENIED, then the application must collect the user name and password from the user and call SecureOpen again, passing in the user's credentials through the credentials parameter. If the method returns DP_OK, then the player was able to log on with the credentials he or she had specified earlier during system log-on (network log-on in NTLM).