- Timestamp:
- Oct 6, 2000, 9:49:06 PM (25 years ago)
- Location:
- trunk/src/DPlayX
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/DPlayX/dplay.cpp
r4317 r4446 1 // $Id: dplay.cpp,v 1. 2 2000-09-24 22:47:36hugh Exp $1 // $Id: dplay.cpp,v 1.3 2000-10-06 19:49:03 hugh Exp $ 2 2 /* Direct Play 2,3,4 Implementation 3 3 * … … 32 32 DEFAULT_DEBUG_CHANNEL(dplay) 33 33 34 #undef debugstr_guid 34 35 #define debugstr_guid(a) a 35 36 … … 274 275 This->dp2->spData.dwSPVersion = DPSP_MAJORVERSION; 275 276 276 This->dp2->spData.lpCB = (LPDPSP_SPCALLBACKS)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 277 sizeof( *This->dp2->spData.lpCB ) ); 277 This->dp2->spData.lpCB = (DPSP_SPCALLBACKS*)HeapAlloc( GetProcessHeap(), 278 HEAP_ZERO_MEMORY, 279 sizeof( *This->dp2->spData.lpCB ) ); 278 280 This->dp2->spData.lpCB->dwSize = sizeof( *This->dp2->spData.lpCB ); 279 281 This->dp2->spData.lpCB->dwVersion = DPSP_MAJORVERSION; … … 634 636 wVersion ); 635 637 638 DebugBreak(); 639 636 640 switch( wCommandId ) 637 641 { … … 650 654 *lpdwMsgSize ); 651 655 652 FIXME( "Ignoring dwFlags in msg\n" ); 656 FIXME( "Ignoring dwFlags in request msg\n" ); 657 658 #if 0 659 /* This is just a test. See how large the SPData is and send it */ 660 { 661 LPVOID lpData; 662 DWORD dwDataSize; 663 HRESULT hr; 664 665 hr = IDirectPlaySP_GetSPData( This->dp2->spData.lpISP, &lpData, 666 &dwDataSize, DPSET_REMOTE ); 667 668 if( FAILED(hr) ) 669 { 670 ERR( "Unable to get remote SPData %s\n", DPLAYX_HresultToString(hr) ); 671 } 672 673 } 674 #endif 653 675 654 676 /* Setup the reply */ … … 660 682 lpReply->envelope.wVersion = DPMSGVER_DP6; 661 683 662 #if 0663 /* FIXME: Need to know the proper contents of the message! */664 684 lpReply->dpidNewPlayerId = DP_NextObjectId(); 665 #endif 685 686 TRACE( "Allocating new playerid 0x%08lx from remote request\n", 687 lpReply->dpidNewPlayerId ); 666 688 667 689 break; … … 670 692 case DPMSGCMD_NEWPLAYERIDREPLY: 671 693 { 672 673 DebugBreak();674 694 675 695 if( This->dp2->hMsgReceipt ) … … 684 704 else 685 705 { 686 ERR( "No receipt event set \n" );706 ERR( "No receipt event set - only expecting in reply mode\n" ); 687 707 } 688 708 … … 1316 1336 BOOL bAnsi ) 1317 1337 { 1338 HANDLE hr = DP_OK; 1318 1339 lpPlayerData lpPData; 1319 1340 lpPlayerList lpPList; … … 1353 1374 else 1354 1375 { 1355 HRESULThr = DP_MSG_SendRequestPlayerId( This, dwFlags, lpidPlayer );1376 hr = DP_MSG_SendRequestPlayerId( This, dwFlags, lpidPlayer ); 1356 1377 1357 1378 if( FAILED(hr) ) … … 1421 1442 data.lpISP = This->dp2->spData.lpISP; 1422 1443 1423 (*This->dp2->spData.lpCB->CreatePlayer)( &data ); 1444 hr = (*This->dp2->spData.lpCB->CreatePlayer)( &data ); 1445 } 1446 1447 if( FAILED(hr) ) 1448 { 1449 ERR( "Failed to create player with sp: %s\n", DPLAYX_HresultToString(hr) ); 1450 return hr; 1451 } 1452 1453 /* Now let the SP know that this player is a member of the system group */ 1454 if( This->dp2->spData.lpCB->AddPlayerToGroup ) 1455 { 1456 DPSP_ADDPLAYERTOGROUPDATA data; 1457 1458 data.idPlayer = *lpidPlayer; 1459 data.idGroup = DPID_SYSTEM_GROUP; 1460 data.lpISP = This->dp2->spData.lpISP; 1461 1462 TRACE( "Calling SP AddPlayerToGroup (sys group)\n" ); 1463 1464 hr = (*This->dp2->spData.lpCB->AddPlayerToGroup)( &data ); 1465 } 1466 1467 if( FAILED(hr) ) 1468 { 1469 ERR( "Failed to add player to sys groupwith sp: %s\n", 1470 DPLAYX_HresultToString(hr) ); 1471 return hr; 1424 1472 } 1425 1473 … … 1447 1495 /* FIXME: Should size include data w/ message or just message "header" */ 1448 1496 /* FIXME: Check return code */ 1449 DP_SendEx( This, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, sizeof( msg ),1450 0, 0, NULL, NULL, bAnsi );1451 } 1452 1453 return DP_OK;1497 hr = DP_SendEx( This, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, 1498 sizeof( msg ), 0, 0, NULL, NULL, bAnsi ); 1499 } 1500 1501 return hr; 1454 1502 } 1455 1503 … … 1947 1995 1948 1996 FIXME( ": not checking for conditions\n" ); 1997 1998 /* Not sure if this should be pruning but it's convenient */ 1999 NS_PruneSessionCache( lpNSInfo ); 1949 2000 1950 2001 NS_ResetSessionEnumeration( lpNSInfo ); … … 2675 2726 if( dwFlags & DPOPEN_JOIN ) 2676 2727 { 2677 DPID dpidServerId = DPID_ SERVERPLAYER;2728 DPID dpidServerId = DPID_UNKNOWN; 2678 2729 2679 2730 /* Create the server player for this interface. This way we can receive … … 2697 2748 } 2698 2749 2750 if( FAILED(hr) ) 2751 { 2752 ERR( "Couldn't create name server/system player: %s\n", 2753 DPLAYX_HresultToString(hr) ); 2754 } 2755 2699 2756 return hr; 2700 2757 } … … 3406 3463 } 3407 3464 3408 if( (LPVOID)lpEnumCallback==NULL || *(int*)lpEnumCallback==NULL)3465 if( lpEnumCallback==NULL || *(DWORD*)lpEnumCallback==0 ) 3409 3466 { 3410 3467 return DPERR_INVALIDPARAMS; … … 3460 3517 } 3461 3518 3462 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,3519 if( RegQueryValueExA( hkServiceProvider, (LPSTR)guidDataSubKey, 3463 3520 NULL, &returnTypeGUID, (LPBYTE)returnBuffer, 3464 3521 &sizeOfReturnBuffer ) != ERROR_SUCCESS ) … … 3469 3526 3470 3527 /* FIXME: Check return types to ensure we're interpreting data right */ 3471 lpWGUIDString = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)returnBuffer );3528 lpWGUIDString = HEAP_strdupAtoW( GetProcessHeap(), 0, returnBuffer ); 3472 3529 CLSIDFromString( (LPCOLESTR)lpWGUIDString, &serviceProviderGUID ); 3473 3530 HeapFree( GetProcessHeap(), 0, lpWGUIDString ); … … 3566 3623 } 3567 3624 3568 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,3625 if( RegQueryValueExA( hkServiceProvider, (LPSTR)guidDataSubKey, 3569 3626 NULL, &returnTypeGUID, (LPBYTE)returnBuffer, 3570 3627 &sizeOfReturnBuffer ) != ERROR_SUCCESS ) … … 3910 3967 * The rest will be done in DP_LoadSP 3911 3968 */ 3912 This->dp2->spData.lpAddress = ( LPDPADDRESS)lpConnection;3969 This->dp2->spData.lpAddress = (DPADDRESS*)lpConnection; 3913 3970 This->dp2->spData.dwAddressSize = dwAddrSize; 3914 3971 This->dp2->spData.lpGuid = &guidSP; -
trunk/src/DPlayX/dplaysp.cpp
r4317 r4446 1 // $Id: dplaysp.cpp,v 1. 2 2000-09-24 22:47:37hugh Exp $1 // $Id: dplaysp.cpp,v 1.3 2000-10-06 19:49:04 hugh Exp $ 2 2 /* This contains the implementation of the interface Service 3 3 * Providers require to communicate with Direct Play … … 28 28 DEFAULT_DEBUG_CHANNEL(dplay); 29 29 30 #undef debugstr_guid 30 31 #define debugstr_guid(a) a 31 32 … … 380 381 This, idPlayer, lplpData, lpdwDataSize, dwFlags ); 381 382 383 /* What to do in the case where there is nothing set yet? */ 384 382 385 *lplpData = This->sp->lpPlayerData; 383 386 *lpdwDataSize = This->sp->dwPlayerDataSize; … … 451 454 } 452 455 456 case DPMSGCMD_GETNAMETABLE: 457 case DPMSGCMD_GETNAMETABLEREPLY: 453 458 case DPMSGCMD_NEWPLAYERIDREPLY: 454 459 case DPMSGCMD_REQUESTNEWPLAYERID: -
trunk/src/DPlayX/dplayx_global.cpp
r4317 r4446 1 // $Id: dplayx_global.cpp,v 1. 2 2000-09-24 22:47:37hugh Exp $1 // $Id: dplayx_global.cpp,v 1.3 2000-10-06 19:49:05 hugh Exp $ 2 2 /* dplayx.dll global data implementation. 3 3 * … … 32 32 DEFAULT_DEBUG_CHANNEL(dplay); 33 33 34 #undef debugstr_guid 34 35 #define debugstr_guid(a) a 35 36 -
trunk/src/DPlayX/dplayx_messages.cpp
r4317 r4446 1 // $Id: dplayx_messages.cpp,v 1. 2 2000-09-24 22:47:38hugh Exp $1 // $Id: dplayx_messages.cpp,v 1.3 2000-10-06 19:49:05 hugh Exp $ 2 2 /* DirectPlay & DirectPlayLobby messaging implementation 3 3 * … … 26 26 DEFAULT_DEBUG_CHANNEL(dplay) 27 27 28 #undef debugstr_guid 28 29 #define debugstr_guid(a) a 29 30 … … 158 159 HRESULT hr = DP_OK; 159 160 160 FIXME( "semi stub\n" );161 162 DebugBreak();163 164 161 dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody ); 165 162 … … 195 192 This->dp2->hMsgReceipt = CreateEventA( NULL, FALSE, FALSE, NULL ); 196 193 194 TRACE( "Sending request for player id\n" ); 195 197 196 hr = (*This->dp2->spData.lpCB->Send)( &data ); 198 197 … … 201 200 ERR( "Request for new playerID send failed: %s\n", 202 201 DPLAYX_HresultToString( hr ) ); 202 return DPERR_NOCONNECTION; 203 203 } 204 204 } … … 208 208 { 209 209 ERR( "Wait failed 0x%08lx\n", dwWaitReturn ); 210 hr = DPERR_TIMEOUT; 210 211 } 211 212 … … 214 215 215 216 /* Need to examine the data and extract the new player id */ 216 /* I just hope that dplay doesn't return the whole new player! */ 217 if( !FAILED(hr) ) 218 { 219 LPCDPMSG_NEWPLAYERIDREPLY lpcReply; 220 221 lpcReply = (LPCDPMSG_NEWPLAYERIDREPLY)This->dp2->lpMsgReceived; 222 223 *lpdpidAllocatedId = lpcReply->dpidNewPlayerId; 224 225 TRACE( "Received reply for id = 0x%08lx\n", lpcReply->dpidNewPlayerId ); 226 227 /* FIXME: I think that the rest of the message has something to do 228 * with remote data for the player that perhaps I need to setup. 229 */ 230 #if 0 231 /* Set the passed service provider data */ 232 IDirectPlaySP_SetSPData( This->dp2->spData.lpISP, data, 233 msgsize, DPSET_REMOTE ); 234 235 #endif 236 237 HeapFree( GetProcessHeap(), 0, This->dp2->lpMsgReceived ); 238 This->dp2->lpMsgReceived = NULL; 239 } 217 240 218 241 return hr; -
trunk/src/DPlayX/dplayx_messages.h
r4317 r4446 1 // $Id: dplayx_messages.h,v 1. 2 2000-09-24 22:47:39hugh Exp $1 // $Id: dplayx_messages.h,v 1.3 2000-10-06 19:49:06 hugh Exp $ 2 2 3 3 #ifndef __WINE_DPLAYX_MESSAGES__ … … 21 21 #define DPMSGCMD_ENUMSESSIONSREQUEST 2 22 22 23 #define DPMSGCMD_GETSETNAMETABLE 3 /* Request info from NS about24 existing players/groups etc. Is25 also used for reply */26 23 27 24 #define DPMSGCMD_REQUESTNEWPLAYERID 5 … … 36 33 #define DPMSGCMD_ENUMGROUPS 17 37 34 38 #define DPMSGCMD_FORWARDCREATEPLAYER 19 /* This may be a get name table req */ 35 #define DPMSGCMD_GETNAMETABLE 19 36 37 #define DPMSGCMD_GETNAMETABLEREPLY 29 39 38 40 39 /* This is what DP 6 defines it as. Don't know what it means. All messages … … 50 49 */ 51 50 52 /* Size is 4bytes */51 /* Size is 8 bytes */ 53 52 typedef struct tagDPMSG_SENDENVELOPE 54 53 { … … 128 127 typedef const DPMSG_REQUESTNEWPLAYERID* LPCDPMSG_REQUESTNEWPLAYERID; 129 128 130 /* 64 byte - ~18 header ~= 46bytes msg */129 /* 48 bytes msg */ 131 130 typedef struct tagDPMSG_NEWPLAYERIDREPLY 132 131 { 133 132 DPMSG_SENDENVELOPE envelope; 134 133 135 #if 0136 134 DPID dpidNewPlayerId; 137 #else 138 BYTE unknown[38]; 135 #if 1 136 /* Assume that this is data that is tacked on to the end of the message 137 * that comes from the SP remote data stored that needs to be propagated. 138 */ 139 BYTE unknown[36]; /* This appears to always be 0 - not sure though */ 139 140 #endif 140 141 -
trunk/src/DPlayX/dplayx_queue.h
r4317 r4446 1 // $Id: dplayx_queue.h,v 1. 2 2000-09-24 22:47:39hugh Exp $1 // $Id: dplayx_queue.h,v 1.3 2000-10-06 19:49:06 hugh Exp $ 2 2 /* A queue definition based on sys/queue.h TAILQ definitions 3 3 * … … 79 79 #define DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\ 80 80 do { \ 81 (rc) = (head).lpQHFirst; /* NULL head? */\81 (rc) = DPQ_FIRST(head); /* NULL head? */ \ 82 82 \ 83 83 while( rc ) \ … … 100 100 /* head - pointer to DPQ_HEAD struct 101 101 * elm - how to find the next element 102 * field - to be concatenated to rc to compare with fieldToCompare 103 * fieldToCompare - The value that we're comparing against 104 * compare_cb - Callback to invoke to determine if comparision should continue. 105 * Callback must be defined with DPQ_DECL_COMPARECB. 106 * rc - Variable to put the return code. Same type as (head).lpQHFirst 107 */ 108 #define DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\ 109 do { \ 110 (rc) = DPQ_FIRST(head); /* NULL head? */ \ 111 \ 112 while( rc ) \ 113 { \ 114 /* What we're searching for? */ \ 115 if( compare_cb( &((rc)->field), &(fieldToCompare) ) ) \ 116 { \ 117 break; /* no more */ \ 118 } \ 119 \ 120 /* End of list check */ \ 121 if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst ) \ 122 { \ 123 rc = NULL; \ 124 break; \ 125 } \ 126 } \ 127 } while(0) 128 129 /* How to define the method to be passed to DPQ_DELETEQ */ 130 #define DPQ_DECL_COMPARECB( name, type ) BOOL name( const type* elem1, const type* elem2 ) 131 132 133 /* head - pointer to DPQ_HEAD struct 134 * elm - how to find the next element 102 135 * field - to be concatenated to rc to compare with fieldToEqual 103 136 * fieldToCompare - The value that we're comparing against … … 117 150 } while(0) 118 151 152 /* head - pointer to DPQ_HEAD struct 153 * elm - how to find the next element 154 * field - to be concatenated to rc to compare with fieldToCompare 155 * fieldToCompare - The value that we're comparing against 156 * compare_cb - Callback to invoke to determine if comparision should continue. 157 * Callback must be defined with DPQ_DECL_COMPARECB. 158 * rc - Variable to put the return code. Same type as (head).lpQHFirst 159 */ 160 #define DPQ_REMOVE_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\ 161 do { \ 162 DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc );\ 163 \ 164 /* Was the element found? */ \ 165 if( rc ) \ 166 { \ 167 DPQ_REMOVE( head, rc, elm ); \ 168 } \ 169 } while(0) 170 171 119 172 /* Delete the entire queue 120 173 * head - pointer to the head of the queue … … 123 176 * df - a delete function to be called. Declared with DPQ_DECL_DELETECB. 124 177 */ 125 #define DPQ_DELETEQ( head, field, type, df ) \ 126 while( !DPQ_IS_EMPTY(head) ) \ 127 { \ 128 type holder = (head).lpQHFirst; \ 129 DPQ_REMOVE( head, holder, field ); \ 130 df( holder ); \ 131 } 178 #define DPQ_DELETEQ( head, field, type, df ) \ 179 do \ 180 { \ 181 while( !DPQ_IS_EMPTY(head) ) \ 182 { \ 183 type holder = DPQ_FIRST(head); \ 184 DPQ_REMOVE( head, holder, field ); \ 185 df( holder ); \ 186 } \ 187 } while(0) 132 188 133 189 /* How to define the method to be passed to DPQ_DELETEQ */ -
trunk/src/DPlayX/dplobby.cpp
r4317 r4446 1 // $Id: dplobby.cpp,v 1. 2 2000-09-24 22:47:38hugh Exp $1 // $Id: dplobby.cpp,v 1.3 2000-10-06 19:49:05 hugh Exp $ 2 2 /* Direct Play Lobby 2 & 3 Implementation 3 3 * … … 28 28 DEFAULT_DEBUG_CHANNEL(dplay) 29 29 30 #undef debugstr_guid 30 31 #define debugstr_guid(a) a 31 32 … … 1148 1149 { 1149 1150 /* These are the handles for the created process */ 1150 HANDLE hAppStart, hAppDeath, hAppRead ;1151 HANDLE hAppStart, hAppDeath, hAppRead, hTemp;; 1151 1152 SECURITY_ATTRIBUTES s_attrib; 1152 1153 … … 1156 1157 1157 1158 /* FIXME: Is there a handle leak here? */ 1158 *lphStart = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1159 *lphDeath = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1160 *lphRead = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1159 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1160 *lphStart = ConvertToGlobalHandle( hTemp ); 1161 1162 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1163 *lphDeath = ConvertToGlobalHandle( hTemp ); 1164 1165 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); 1166 *lphRead = ConvertToGlobalHandle( hTemp ); 1161 1167 1162 1168 if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart, -
trunk/src/DPlayX/makefile
r4315 r4446 1 # $Id: makefile,v 1.1 0 2000-09-24 22:28:35hugh Exp $1 # $Id: makefile,v 1.11 2000-10-06 19:49:06 hugh Exp $ 2 2 3 3 # … … 70 70 $(PDWIN32_LIB)/user32.lib 71 71 $(PDWIN32_LIB)/ole32.lib 72 $(PDWIN32_LIB)/winmm.lib 72 73 $(PDWIN32_LIB)/ntdll.lib 73 74 $(PDWIN32_LIB)/msvfw32.lib -
trunk/src/DPlayX/name_server.cpp
r4317 r4446 1 // $Id: name_server.cpp,v 1. 2 2000-09-24 22:47:38hugh Exp $1 // $Id: name_server.cpp,v 1.3 2000-10-06 19:49:06 hugh Exp $ 2 2 /* DPLAYX.DLL name server implementation 3 3 * … … 21 21 #include "heap.h" 22 22 #include "heapstring.h" 23 #include "mmsystem.h" 23 24 24 25 #include "dplayx_global.h" … … 32 33 DEFAULT_DEBUG_CHANNEL(dplay); 33 34 35 #undef debugstr_guid 34 36 #define debugstr_guid(a) a 35 37 … … 54 56 }; 55 57 typedef struct NSCache NSCache, *lpNSCache; 58 59 /* Function prototypes */ 60 DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData ); 56 61 57 62 /* Name Server functions … … 61 66 { 62 67 #if 0 68 /* FIXME: Remove this method? */ 63 69 DPLAYX_SetLocalSession( lpsd ); 64 70 #endif 71 } 72 73 DPQ_DECL_COMPARECB( cbUglyPig, GUID ) 74 { 75 return IsEqualGUID( elem1, elem2 ); 65 76 } 66 77 … … 77 88 78 89 /* FIXME: Should check to see if the reply is for an existing session. If 79 * so we just update the contents and update the timestamp.90 * so we remove the old and add the new so oldest is at front. 80 91 */ 92 93 /* See if we can find this session. If we can, remove it as it's a dup */ 94 DPQ_REMOVE_ENTRY_CB( lpCache->first, next, data->guidInstance, cbUglyPig, 95 lpMsg->sd.guidInstance, lpCacheNode ); 96 97 if( lpCacheNode != NULL ) 98 { 99 TRACE( "Duplicate session entry for %s removed - updated version kept\n", 100 debugstr_guid( &lpCacheNode->data->guidInstance ) ); 101 cbDeleteNSNodeFromHeap( lpCacheNode ); 102 } 103 104 /* Add this to the list */ 81 105 lpCacheNode = (lpNSCacheData)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 82 106 sizeof( *lpCacheNode ) ); … … 128 152 /* Ok. Cheat and don't search for the correct stuff just take the first. 129 153 * FIXME: In the future how are we to know what is _THE_ enum we used? 154 * This is going to have to go into dplay somehow. Perhaps it 155 * comes back with app server id for the join command! Oh...that 156 * must be it. That would make this method obsolete once that's 157 * in place. 130 158 */ 131 159 … … 171 199 } 172 200 173 DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData );174 201 DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData ) 175 202 { 203 /* NOTE: This proc doesn't deal with the walking pointer */ 204 176 205 /* FIXME: Memory leak on data (contained ptrs) */ 177 206 HeapFree( GetProcessHeap(), 0, elem->data ); … … 259 288 { 260 289 lpNSCache lpCache = (lpNSCache)lpNSInfo; 261 lpNSCacheData lpCacheEntry; 262 263 DWORD dwPresentTime = GetTickCount(); 264 #if defined( HACK_TIMEGETTIME ) 265 DWORD dwPruneTime = dwPresentTime - 2; /* One iteration with safety */ 266 #else 267 DWORD dwPruneTime = dwPresentTime - 10000 /* 10 secs? */; 268 #endif 269 270 FIXME( ": semi stub\n" ); 271 272 /* FIXME: This doesn't handle time roll over correctly */ 273 /* FIXME: Session memory leak on delete */ 274 do 275 { 276 DPQ_FIND_ENTRY( lpCache->first, next, dwTime, <=, dwPruneTime, lpCacheEntry ); 277 } 278 while( lpCacheEntry != NULL ); 290 291 const DWORD dwPresentTime = timeGetTime(); 292 const DWORD dwPrunePeriod = 60000; /* is 60 secs enough? */ 293 const DWORD dwPruneTime = dwPresentTime - dwPrunePeriod; 294 295 /* This silly little algorithm is based on the fact we keep entries in 296 * the queue in a time based order. It also assumes that it is not possible 297 * to wrap around over yourself (which is not unreasonable). 298 * The if statements verify if the first entry in the queue is less 299 * than dwPrunePeriod old depending on the "clock" roll over. 300 */ 301 for( ;; ) 302 { 303 lpNSCacheData lpFirstData; 304 305 if( DPQ_IS_EMPTY(lpCache->first) ) 306 { 307 /* Nothing to prune */ 308 break; 309 } 310 311 if( dwPruneTime > dwPresentTime ) /* 0 <= dwPresentTime <= dwPrunePeriod */ 312 { 313 if( ( DPQ_FIRST(lpCache->first)->dwTime <= dwPresentTime ) || 314 ( DPQ_FIRST(lpCache->first)->dwTime > dwPruneTime ) 315 ) 316 { 317 /* Less than dwPrunePeriod old - keep */ 318 break; 319 } 320 } 321 else /* dwPrunePeriod <= dwPresentTime <= max dword */ 322 { 323 if( ( DPQ_FIRST(lpCache->first)->dwTime <= dwPresentTime ) && 324 ( DPQ_FIRST(lpCache->first)->dwTime > dwPruneTime ) 325 ) 326 { 327 /* Less than dwPrunePeriod old - keep */ 328 break; 329 } 330 } 331 332 lpFirstData = DPQ_FIRST(lpCache->first); 333 DPQ_REMOVE( lpCache->first, DPQ_FIRST(lpCache->first), next ); 334 cbDeleteNSNodeFromHeap( lpFirstData ); 335 } 279 336 280 337 }
Note:
See TracChangeset
for help on using the changeset viewer.