00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define IDIRECTPLAY2_OR_GREATER
00023
00024 #include <Windows.H>
00025 #include <Assert.h>
00026
00027 #include <dplay.h>
00028 #include <dplobby.h>
00029 #include <Stdio.h>
00030
00031 #include "netplay.h"
00032 #include "ErrorLog.h"
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 LPGUID glpGuid;
00044
00045 SP_DESC GlobalSP;
00046 SESSION_DESC *GlobalSession;
00047 DWORD gSessionCnt;
00048 BOOL FoundSP = FALSE;
00049 BOOL FoundSession = FALSE;
00050
00051
00052 LPDIRECTPLAY4A g_lpDP = NULL;
00053
00054 BOOL FoundConnection = FALSE;
00055 LPVOID lpConnectionBuffer = NULL;
00056
00057
00058
00059
00060 HRESULT DPlayCreateSession(LPTSTR lptszSessionName, DWORD MaxPlayers);
00061 HRESULT DPlayOpenSession(LPGUID lpSessionGuid);
00062 BOOL WINAPI EnumSession(LPCDPSESSIONDESC2 lpDPSessionDesc, LPDWORD lpdwTimeOut, DWORD dwFlags,
00063 LPVOID lpContext);
00064 HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback,
00065 LPVOID lpContext, DWORD dwFlags);
00066 HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent,
00067 LPVOID lpData, DWORD dwDataSize);
00068 HRESULT DPlayDestroyPlayer(DPID pid);
00069 HRESULT DPlayRelease(void);
00070
00071 static HRESULT DPlayCreate(void );
00072
00073
00074 BOOL FAR PASCAL DPEnumConnectionsCallback(
00075 LPCGUID lpguidSP,
00076 LPVOID lpConnection,
00077 DWORD dwSize,
00078 LPCDPNAME lpName,
00079 DWORD dwFlags,
00080 LPVOID lpContext);
00081
00082 static void DoDPError(HRESULT Hr);
00083
00084 FILE *DebugF;
00085
00086
00087
00088
00089
00090 BOOL InitNetPlay(LPGUID lpGuid)
00091 {
00092 HRESULT Hr;
00093
00094 glpGuid = lpGuid;
00095
00096 FoundSP = FALSE;
00097
00098 Hr = DPlayCreate();
00099
00100 if (Hr != DP_OK)
00101 {
00102 DoDPError(Hr);
00103 return FALSE;
00104 }
00105
00106 IDirectPlayX_EnumConnections( g_lpDP, glpGuid, DPEnumConnectionsCallback, NULL, 0);
00107
00108 if (!FoundConnection)
00109 {
00110 geErrorLog_AddString(-1, "InitNetPlay: No connections available.\n", NULL);
00111 return FALSE;
00112 }
00113
00114 return TRUE;
00115 }
00116
00117
00118
00119
00120 BOOL NetPlayEnumSession(LPSTR IPAdress, SESSION_DESC **SessionList, DWORD *SessionNum)
00121 {
00122 HRESULT hr;
00123
00124 #if 1
00125 char tempBuf[1024];
00126 DWORD tempLng = 1024;
00127 LPDIRECTPLAYLOBBY2A lpDPL = NULL;
00128
00129
00130 if(lpConnectionBuffer )
00131 {
00132 free( lpConnectionBuffer );
00133 lpConnectionBuffer = NULL;
00134 }
00135
00136 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER,
00137 &IID_IDirectPlayLobby3A, (LPVOID *) &lpDPL );
00138
00139 if (hr != DP_OK)
00140 {
00141 DoDPError(hr);
00142 return( FALSE );
00143 }
00144
00145 hr = IDirectPlayLobby_CreateAddress(lpDPL, &DPSPGUID_TCPIP, &DPAID_INet, (LPVOID)IPAdress, strlen(IPAdress), tempBuf, &tempLng);
00146
00147 if (hr != DP_OK)
00148 {
00149 DoDPError(hr);
00150 return( FALSE );
00151 }
00152
00153 if (lpDPL)
00154 {
00155 hr = IDirectPlayLobby_Release(lpDPL);
00156
00157 if (hr != DP_OK)
00158 {
00159 DoDPError(hr);
00160 return( FALSE );
00161 }
00162 lpDPL = NULL;
00163 }
00164
00165 hr = IDirectPlayX_InitializeConnection( g_lpDP, tempBuf, 0);
00166 #else
00167 hr = IDirectPlayX_InitializeConnection( g_lpDP, lpConnectionBuffer, 0);
00168 #endif
00169
00170 if (hr != DP_OK)
00171 {
00172 DoDPError(hr);
00173 return( FALSE );
00174 }
00175
00176 GlobalSession = NULL;
00177 gSessionCnt = 0;
00178
00179 hr = DPlayEnumSessions(0, EnumSession, NULL, 0);
00180
00181 *SessionList = GlobalSession;
00182 *SessionNum = gSessionCnt;
00183
00184 return( TRUE );
00185
00186 }
00187
00188
00189
00190
00191 BOOL NetPlayCreateSession(LPSTR SessionName, DWORD MaxPlayers)
00192 {
00193 HRESULT Hr;
00194
00195 assert(g_lpDP);
00196 assert(lpConnectionBuffer);
00197
00198 Hr = IDirectPlayX_InitializeConnection(g_lpDP, lpConnectionBuffer, 0);
00199
00200 if (Hr != DP_OK)
00201 {
00202 DoDPError(Hr);
00203 return FALSE;
00204 }
00205
00206 Hr = DPlayCreateSession(SessionName, MaxPlayers);
00207
00208 if (Hr != DP_OK)
00209 {
00210 DoDPError(Hr);
00211 return FALSE;
00212 }
00213
00214 return TRUE;
00215 }
00216
00217
00218
00219
00220 BOOL NetPlayJoinSession(SESSION_DESC *Session)
00221 {
00222 HRESULT Hr;
00223
00224 Hr = DPlayOpenSession(&Session->Guid);
00225
00226 if (Hr != DP_OK)
00227 {
00228 DoDPError(Hr);
00229 return FALSE;
00230 }
00231
00232 return TRUE;
00233 }
00234
00235
00236
00237
00238
00239 BOOL NetPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, LPVOID lpData, DWORD dwDataSize, geBoolean ServerPlayer)
00240 {
00241 HRESULT hr = DPERR_GENERIC;
00242 DPNAME name;
00243 DWORD Flags;
00244
00245 assert(g_lpDP);
00246
00247 ZeroMemory(&name,sizeof(name));
00248 name.dwSize = sizeof(DPNAME);
00249
00250 #ifdef UNICODE
00251 name.lpszShortName = lptszPlayerName;
00252 #else
00253 name.lpszShortNameA = lptszPlayerName;
00254 #endif
00255
00256 Flags = 0;
00257
00258
00259
00260
00261 hr = IDirectPlayX_CreatePlayer(g_lpDP, lppidID, &name, hEvent, lpData, dwDataSize, Flags);
00262
00263 if (hr != DP_OK)
00264 {
00265 DoDPError(hr);
00266 return FALSE;
00267 }
00268
00269 return TRUE;
00270 }
00271
00272
00273
00274
00275 BOOL NetPlayDestroyPlayer(DPID pid)
00276 {
00277 HRESULT Hr = DPlayDestroyPlayer(pid);
00278
00279 if (Hr != DP_OK)
00280 {
00281 DoDPError(Hr);
00282 return FALSE;
00283 }
00284
00285 return TRUE;
00286 }
00287
00288
00289
00290
00291 HRESULT NetPlayReceive(LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize)
00292 {
00293 HRESULT Hr;
00294 assert(g_lpDP);
00295
00296 Hr = IDirectPlayX_Receive(g_lpDP, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize);
00297
00298 if (Hr != DP_OK)
00299 {
00300 if (Hr != DPERR_NOMESSAGES)
00301 DoDPError(Hr);
00302 }
00303
00304 return Hr;
00305 }
00306
00307
00308
00309
00310 HRESULT NetPlaySend(DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, DWORD dwDataSize)
00311 {
00312 HRESULT Hr;
00313
00314 assert(g_lpDP);
00315
00316 #if 0
00317 dwFlags |= DPSEND_ASYNC;
00318 Hr = IDirectPlayX_SendEx(g_lpDP, idFrom, idTo, dwFlags, lpData, dwDataSize, 0, 0, NULL, NULL);
00319 #else
00320 Hr = IDirectPlayX_Send(g_lpDP, idFrom, idTo, dwFlags, lpData, dwDataSize);
00321 #endif
00322
00323 if (Hr != DP_OK)
00324 {
00325 if (Hr == DPERR_PENDING)
00326 return DP_OK;
00327
00328 DoDPError(Hr);
00329 }
00330
00331 return Hr;
00332 }
00333
00334
00335
00336
00337 BOOL DeInitNetPlay(void)
00338 {
00339 HRESULT Hr;
00340
00341 if (lpConnectionBuffer)
00342 {
00343 free(lpConnectionBuffer);
00344 lpConnectionBuffer = NULL;
00345 }
00346
00347 FoundConnection = FALSE;
00348 FoundSP = FALSE;
00349
00350 Hr = DPlayRelease();
00351
00352 if (Hr != DP_OK)
00353 {
00354 DoDPError(Hr);
00355 return FALSE;
00356 }
00357
00358 return TRUE;
00359 }
00360
00361
00362
00363
00364 geBoolean NetPlayGetNumMessages(int32 *NumMsgSend, int32 *NumBytesSend, int32 *NumMsgRec, int32 *NumBytesRec)
00365 {
00366 HRESULT Hr;
00367 DPID IdFrom, IdTo;
00368
00369 IdFrom = IdTo = 0;
00370
00371 Hr = IDirectPlayX_GetMessageQueue(g_lpDP, IdFrom, IdTo, DPMESSAGEQUEUE_SEND, NumMsgSend, NumBytesSend);
00372
00373 if (Hr != DP_OK)
00374 {
00375 geErrorLog_AddString(-1, "NetPlayGetNumMessages: IDirectPlayX_GetMessageQueue failed.\n", NULL);
00376 DoDPError(Hr);
00377 return GE_FALSE;
00378 }
00379
00380 Hr = IDirectPlayX_GetMessageQueue(g_lpDP, IdFrom, IdTo, DPMESSAGEQUEUE_RECEIVE, NumMsgRec, NumBytesRec);
00381
00382 if (Hr != DP_OK)
00383 {
00384 geErrorLog_AddString(-1, "NetPlayGetNumMessages: IDirectPlayX_GetMessageQueue failed.\n", NULL);
00385 DoDPError(Hr);
00386 return GE_FALSE;
00387 }
00388
00389 return GE_TRUE;
00390 }
00391
00392
00393
00394
00395
00396
00397
00398 HRESULT DPlayCreate( void )
00399 {
00400 HRESULT hr=E_FAIL;
00401 LPDIRECTPLAY lpDP=NULL;
00402
00403 CoInitialize( NULL );
00404
00405 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
00406 &IID_IDirectPlay4A, (LPVOID *) &g_lpDP );
00407
00408
00409
00410 return hr;
00411 }
00412
00413
00414
00415
00416 HRESULT DPlayCreateSession(LPTSTR lptszSessionName, DWORD MaxPlayers)
00417 {
00418 HRESULT hr = E_FAIL;
00419 DPSESSIONDESC2 dpDesc;
00420
00421 assert(g_lpDP);
00422
00423 ZeroMemory(&dpDesc, sizeof(dpDesc));
00424 dpDesc.dwSize = sizeof(dpDesc);
00425
00426 dpDesc.dwFlags = DPSESSION_KEEPALIVE;
00427
00428 #if 0 // Just keeping these here for reference...
00429 dpDesc.dwFlags |= DPSESSION_CLIENTSERVER;
00430 dpDesc.dwFlags |= DPSESSION_MIGRATEHOST;
00431 dpDesc.dwFlags |= DPSESSION_OPTIMIZELATENCY;
00432 dpDesc.dwFlags |= DPSESSION_DIRECTPLAYPROTOCOL;
00433 #endif
00434
00435 dpDesc.dwMaxPlayers = MaxPlayers;
00436
00437 #ifdef UNICODE
00438 dpDesc.lpszSessionName = lptszSessionName;
00439 #else
00440 dpDesc.lpszSessionNameA = lptszSessionName;
00441 #endif
00442
00443
00444 if (glpGuid)
00445 dpDesc.guidApplication = *glpGuid;
00446
00447 hr = IDirectPlayX_Open(g_lpDP, &dpDesc, DPOPEN_CREATE);
00448
00449 if (hr != DP_OK)
00450 {
00451 DoDPError(hr);
00452 }
00453
00454 return hr;
00455 }
00456
00457
00458
00459
00460 HRESULT DPlayOpenSession(LPGUID lpSessionGuid)
00461 {
00462 HRESULT hr = E_FAIL;
00463 DPSESSIONDESC2 dpDesc;
00464
00465 assert(g_lpDP);
00466
00467 ZeroMemory(&dpDesc, sizeof(dpDesc));
00468 dpDesc.dwSize = sizeof(dpDesc);
00469
00470
00471
00472
00473 if (lpSessionGuid)
00474 dpDesc.guidInstance = *lpSessionGuid;
00475
00476
00477 if (glpGuid)
00478 dpDesc.guidApplication = *glpGuid;
00479
00480
00481 hr = IDirectPlayX_Open(g_lpDP, &dpDesc, DPOPEN_JOIN);
00482
00483 return hr;
00484 }
00485
00486
00487
00488
00489 HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback,
00490 LPVOID lpContext, DWORD dwFlags)
00491 {
00492 HRESULT hr = E_FAIL;
00493 DPSESSIONDESC2 dpDesc;
00494
00495 ZeroMemory(&dpDesc, sizeof(dpDesc));
00496 dpDesc.dwSize = sizeof(dpDesc);
00497
00498 if (glpGuid)
00499 dpDesc.guidApplication = *glpGuid;
00500
00501 if (g_lpDP)
00502 hr = IDirectPlayX_EnumSessions(g_lpDP, &dpDesc, dwTimeout, lpEnumCallback,
00503 lpContext, dwFlags);
00504 return hr;
00505 }
00506
00507
00508
00509
00510 BOOL WINAPI EnumSession(LPCDPSESSIONDESC2 lpDPSessionDesc, LPDWORD lpdwTimeOut, DWORD dwFlags,
00511 LPVOID lpContext)
00512 {
00513 HWND hWnd = (HWND) lpContext;
00514 LPSTR Str = NULL;
00515
00516 if(dwFlags & DPESC_TIMEDOUT)
00517 return FALSE;
00518
00519 gSessionCnt++;
00520
00521 if( GlobalSession )
00522 GlobalSession = realloc( GlobalSession, gSessionCnt * sizeof(SESSION_DESC));
00523 else
00524 GlobalSession = malloc( sizeof( SESSION_DESC ) );
00525
00526 GlobalSession[gSessionCnt-1].Guid = lpDPSessionDesc->guidInstance;
00527
00528 #ifdef UNICODE
00529 strcpy(GlobalSession[gSessionCnt-1].SessionName, lpDPSessionDesc->lpszSessionName);
00530 #else
00531 strcpy(GlobalSession[gSessionCnt-1].SessionName, lpDPSessionDesc->lpszSessionNameA);
00532 #endif
00533
00534 return(TRUE);
00535 }
00536
00537
00538
00539
00540 HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent,
00541 LPVOID lpData, DWORD dwDataSize)
00542 {
00543 HRESULT hr = DPERR_GENERIC;
00544 DPNAME name;
00545
00546 assert(g_lpDP);
00547
00548 ZeroMemory(&name,sizeof(name));
00549 name.dwSize = sizeof(DPNAME);
00550
00551 #ifdef UNICODE
00552 name.lpszShortName = lptszPlayerName;
00553 #else
00554 name.lpszShortNameA = lptszPlayerName;
00555 #endif
00556
00557 hr = IDirectPlayX_CreatePlayer(g_lpDP, lppidID, &name, hEvent, lpData, dwDataSize, DPPLAYER_SERVERPLAYER);
00558
00559 return hr;
00560 }
00561
00562
00563
00564
00565 HRESULT DPlayDestroyPlayer(DPID pid)
00566 {
00567 HRESULT hr=E_FAIL;
00568
00569 assert(g_lpDP);
00570
00571 hr = IDirectPlayX_DestroyPlayer(g_lpDP, pid);
00572
00573 return hr;
00574 }
00575
00576
00577
00578
00579 HRESULT DPlayRelease(void)
00580 {
00581 HRESULT hr = DP_OK;
00582
00583 if (g_lpDP)
00584 {
00585 IDirectPlayX_Close(g_lpDP );
00586
00587 hr = IDirectPlayX_Release(g_lpDP);
00588 g_lpDP = NULL;
00589 }
00590
00591 CoUninitialize();
00592
00593 return hr;
00594 }
00595
00596
00597
00598
00599 BOOL FAR PASCAL DPEnumConnectionsCallback(
00600 LPCGUID lpguidSP,
00601 LPVOID lpConnection,
00602 DWORD dwSize,
00603 LPCDPNAME lpName,
00604 DWORD dwFlags,
00605 LPVOID lpContext)
00606 {
00607 LPSTR Str;
00608
00609 if (FoundConnection)
00610 return TRUE;
00611
00612 Str = lpName->lpszShortNameA;
00613
00614
00615 while (strlen(Str) > 0)
00616 {
00617 if (!strnicmp(Str, "TCP", 3))
00618
00619 {
00620
00621 if (lpConnectionBuffer)
00622 {
00623 free(lpConnectionBuffer);
00624 lpConnectionBuffer = NULL;
00625 }
00626
00627
00628 lpConnectionBuffer = (char*)malloc(dwSize);
00629 if (lpConnectionBuffer == NULL)
00630 goto FAILURE;
00631
00632 memcpy(lpConnectionBuffer, lpConnection, dwSize);
00633 FoundConnection = TRUE;
00634 break;
00635 }
00636 Str++;
00637 }
00638
00639 FAILURE:
00640 return (TRUE);
00641 }
00642
00643
00644
00645
00646
00647 static void DoDPError(HRESULT Hr)
00648 {
00649 switch (Hr)
00650 {
00651 case CLASS_E_NOAGGREGATION:
00652 geErrorLog_AddString(-1, "A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.\n", NULL);
00653 break;
00654
00655 case DP_OK:
00656 geErrorLog_AddString(-1, "The request completed successfully.\n", NULL);
00657 break;
00658
00659 case DPERR_ACCESSDENIED:
00660 geErrorLog_AddString(-1, "The session is full or an incorrect password was supplied.\n", NULL);
00661 break;
00662
00663 case DPERR_ACTIVEPLAYERS:
00664 geErrorLog_AddString(-1, "The requested operation cannot be performed because there are existing active players.\n", NULL);
00665 break;
00666
00667 case DPERR_ALREADYINITIALIZED:
00668 geErrorLog_AddString(-1, "This object is already initialized. \n", NULL);
00669 break;
00670
00671 case DPERR_APPNOTSTARTED:
00672 geErrorLog_AddString(-1, "The application has not been started yet.\n", NULL);
00673 break;
00674
00675 case DPERR_AUTHENTICATIONFAILED:
00676 geErrorLog_AddString(-1, "The password or credentials supplied could not be authenticated. \n", NULL);
00677 break;
00678
00679 case DPERR_BUFFERTOOLARGE:
00680 geErrorLog_AddString(-1, "The data buffer is too large to store. \n", NULL);
00681 break;
00682
00683 case DPERR_BUSY:
00684 geErrorLog_AddString(-1, "A message cannot be sent because the transmission medium is busy. \n", NULL);
00685 break;
00686
00687 case DPERR_BUFFERTOOSMALL:
00688 geErrorLog_AddString(-1, "The supplied buffer is not large enough to contain the requested data. \n", NULL);
00689 break;
00690
00691 case DPERR_CANTADDPLAYER:
00692 geErrorLog_AddString(-1, "The player cannot be added to the session. \n", NULL);
00693 break;
00694
00695 case DPERR_CANTCREATEGROUP:
00696 geErrorLog_AddString(-1, "A new group cannot be created. \n", NULL);
00697 break;
00698
00699 case DPERR_CANTCREATEPLAYER:
00700 geErrorLog_AddString(-1, "A new player cannot be created. \n", NULL);
00701 break;
00702
00703 case DPERR_CANTCREATEPROCESS:
00704 geErrorLog_AddString(-1, "Cannot start the application. \n", NULL);
00705 break;
00706
00707 case DPERR_CANTCREATESESSION:
00708 geErrorLog_AddString(-1, "A new session cannot be created. \n", NULL);
00709 break;
00710
00711 case DPERR_CANTLOADCAPI:
00712 geErrorLog_AddString(-1, "No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded. \n", NULL);
00713 break;
00714
00715 case DPERR_CANTLOADSECURITYPACKAGE:
00716 geErrorLog_AddString(-1, "The software security package cannot be loaded. \n", NULL);
00717 break;
00718
00719 case DPERR_CANTLOADSSPI:
00720 geErrorLog_AddString(-1, "No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded. \n", NULL);
00721 break;
00722
00723 case DPERR_CAPSNOTAVAILABLEYET:
00724 geErrorLog_AddString(-1, "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. \n", NULL);
00725 break;
00726
00727 case DPERR_CONNECTING:
00728 geErrorLog_AddString(-1, "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. \n", NULL);
00729 break;
00730
00731 case DPERR_ENCRYPTIONFAILED:
00732 geErrorLog_AddString(-1, "The requested information could not be digitally encrypted. Encryption is used for message privacy. This error is only relevant in a secure session. \n", NULL);
00733 break;
00734
00735 case DPERR_EXCEPTION:
00736 geErrorLog_AddString(-1, "An exception occurred when processing the request. \n", NULL);
00737 break;
00738
00739 case DPERR_GENERIC:
00740 geErrorLog_AddString(-1, "An undefined error condition occurred. \n", NULL);
00741 break;
00742
00743 case DPERR_INVALIDFLAGS:
00744 geErrorLog_AddString(-1, "The flags passed to this method are invalid. \n", NULL);
00745 break;
00746
00747 case DPERR_INVALIDGROUP:
00748 geErrorLog_AddString(-1, "The group ID is not recognized as a valid group ID for this game session. \n", NULL);
00749 break;
00750
00751 case DPERR_INVALIDINTERFACE:
00752 geErrorLog_AddString(-1, "The interface parameter is invalid. \n", NULL);
00753 break;
00754
00755 case DPERR_INVALIDOBJECT:
00756 geErrorLog_AddString(-1, "The DirectPlay object pointer is invalid. \n", NULL);
00757 break;
00758
00759 case DPERR_INVALIDPARAMS:
00760 geErrorLog_AddString(-1, "One or more of the parameters passed to the method are invalid. \n", NULL);
00761 break;
00762
00763 case DPERR_INVALIDPASSWORD:
00764 geErrorLog_AddString(-1, "An invalid password was supplied when attempting to join a session that requires a password. \n", NULL);
00765 break;
00766
00767 case DPERR_INVALIDPLAYER:
00768 geErrorLog_AddString(-1, "The player ID is not recognized as a valid player ID for this game session. \n", NULL);
00769 break;
00770
00771 case DPERR_LOGONDENIED:
00772 geErrorLog_AddString(-1, "The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid. \n", NULL);
00773 break;
00774
00775 case DPERR_NOCAPS:
00776 geErrorLog_AddString(-1, "The communication link that DirectPlay is attempting to use is not capable of this function. \n", NULL);
00777 break;
00778
00779 case DPERR_NOCONNECTION:
00780 geErrorLog_AddString(-1, "No communication link was established. \n", NULL);
00781 break;
00782
00783 case DPERR_NOINTERFACE:
00784 geErrorLog_AddString(-1, "The interface is not supported. \n", NULL);
00785 break;
00786
00787 case DPERR_NOMESSAGES:
00788 geErrorLog_AddString(-1, "There are no messages in the receive queue. \n", NULL);
00789 break;
00790
00791 case DPERR_NONAMESERVERFOUND:
00792 geErrorLog_AddString(-1, "No name server (host) could be found or created. A host must exist to create a player. \n", NULL);
00793 break;
00794
00795 case DPERR_NONEWPLAYERS:
00796 geErrorLog_AddString(-1, "The session is not accepting any new players. \n", NULL);
00797 break;
00798
00799 case DPERR_NOPLAYERS:
00800 geErrorLog_AddString(-1, "There are no active players in the session. \n", NULL);
00801 break;
00802
00803 case DPERR_NOSESSIONS:
00804 geErrorLog_AddString(-1, "There are no existing sessions for this game. \n", NULL);
00805 break;
00806
00807 case DPERR_NOTLOBBIED:
00808 geErrorLog_AddString(-1, "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. \n", NULL);
00809 break;
00810
00811 case DPERR_NOTLOGGEDIN:
00812 geErrorLog_AddString(-1, "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. \n", NULL);
00813 break;
00814
00815 case DPERR_OUTOFMEMORY:
00816 geErrorLog_AddString(-1, "There is insufficient memory to perform the requested operation. \n", NULL);
00817 break;
00818
00819 case DPERR_PLAYERLOST:
00820 geErrorLog_AddString(-1, "A player has lost the connection to the session. \n", NULL);
00821 break;
00822
00823 case DPERR_SENDTOOBIG:
00824 geErrorLog_AddString(-1, "The message being sent by the IDirectPlay3::Send method is too large. \n", NULL);
00825 break;
00826
00827 case DPERR_SESSIONLOST:
00828 geErrorLog_AddString(-1, "The connection to the session has been lost. \n", NULL);
00829 break;
00830
00831 case DPERR_SIGNFAILED:
00832 geErrorLog_AddString(-1, "The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages. \n", NULL);
00833 break;
00834
00835 case DPERR_TIMEOUT:
00836 geErrorLog_AddString(-1, "The operation could not be completed in the specified time. \n", NULL);
00837 break;
00838
00839 case DPERR_UNAVAILABLE:
00840 geErrorLog_AddString(-1, "The requested function is not available at this time. \n", NULL);
00841 break;
00842
00843 case DPERR_UNINITIALIZED:
00844 geErrorLog_AddString(-1, "The requested object has not been initialized. \n", NULL);
00845 break;
00846
00847 case DPERR_UNKNOWNAPPLICATION:
00848 geErrorLog_AddString(-1, "An unknown application was specified. \n", NULL);
00849 break;
00850
00851 case DPERR_UNSUPPORTED:
00852 geErrorLog_AddString(-1, "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. \n", NULL);
00853 break;
00854
00855 case DPERR_USERCANCEL:
00856 geErrorLog_AddString(-1, "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. \n", NULL);
00857 break;
00858
00859 default:
00860 geErrorLog_AddString(-1, "NetPlayError: Don't know this one...\n", NULL);
00861 break;
00862 }
00863 }