Changeset 5311 for trunk/src/DPlayX/name_server.cpp
- Timestamp:
- Mar 14, 2001, 12:13:28 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/DPlayX/name_server.cpp
r4446 r5311 1 // $Id: name_server.cpp,v 1. 3 2000-10-06 19:49:06hugh Exp $1 // $Id: name_server.cpp,v 1.4 2001-03-13 23:13:27 hugh Exp $ 2 2 /* DPLAYX.DLL name server implementation 3 3 * … … 18 18 #include "winbase.h" 19 19 #include "winuser.h" 20 #include "winnls.h" 21 #include "wine/unicode.h" 20 22 #include "debugtools.h" 21 23 #include "heap.h" … … 82 84 LPVOID lpNSInfo ) 83 85 { 86 DWORD len; 84 87 lpNSCache lpCache = (lpNSCache)lpNSInfo; 85 88 lpNSCacheData lpCacheNode; … … 128 131 129 132 CopyMemory( lpCacheNode->data, &lpMsg->sd, sizeof( *lpCacheNode->data ) ); 130 lpCacheNode->data->sess.lpszSessionNameA = HEAP_strdupWtoA( GetProcessHeap(), 131 HEAP_ZERO_MEMORY, 132 (LPWSTR)(lpMsg+1) ); 133 134 lpCacheNode->dwTime = GetTickCount(); 133 len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1, NULL, 0, NULL, NULL ); 134 if ((lpCacheNode->data->u1.lpszSessionNameA = (LPSTR)HeapAlloc( GetProcessHeap(), 0, len ))) 135 WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1, 136 lpCacheNode->data->u1.lpszSessionNameA, len, NULL, NULL ); 137 138 lpCacheNode->dwTime = timeGetTime(); 135 139 136 140 DPQ_INSERT(lpCache->first, lpCacheNode, next ); … … 199 203 } 200 204 205 /* Delete a name server node which has been allocated on the heap */ 201 206 DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData ) 202 207 { … … 209 214 } 210 215 211 212 213 216 /* Render all data in a session cache invalid */ 214 217 void NS_InvalidateSessionCache( LPVOID lpNSInfo ) … … 257 260 void NS_ResetSessionEnumeration( LPVOID lpNSInfo ) 258 261 { 259 260 262 ((lpNSCache)lpNSInfo)->present = ((lpNSCache)lpNSInfo)->first.lpQHFirst; 261 263 } … … 285 287 * older than the criteria. If so, just delete that information. 286 288 */ 289 /* FIXME: This needs to be called by some periodic timer */ 287 290 void NS_PruneSessionCache( LPVOID lpNSInfo ) 288 291 { … … 337 340 } 338 341 339 340 341 /* Message stuff */ 342 /* NAME SERVER Message stuff */ 342 343 void NS_ReplyToEnumSessionsRequest( LPVOID lpMsg, 343 344 LPDPSP_REPLYDATA lpReplyData, … … 347 348 DWORD dwVariableSize; 348 349 DWORD dwVariableLen; 349 LPWSTR string;350 350 /* LPDPMSG_ENUMSESSIONSREQUEST msg = (LPDPMSG_ENUMSESSIONSREQUEST)lpMsg; */ 351 351 BOOL bAnsi = TRUE; /* FIXME: This needs to be in the DPLAY interface */ … … 353 353 FIXME( ": few fixed + need to check request for response\n" ); 354 354 355 dwVariableLen = bAnsi ? lstrlenA( lpDP->dp2->lpSessionDesc->sess.lpszSessionNameA ) + 1 356 : lstrlenW( lpDP->dp2->lpSessionDesc->sess.lpszSessionName ) + 1; 355 if (bAnsi) 356 dwVariableLen = MultiByteToWideChar( CP_ACP, 0, 357 lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, 358 -1, NULL, 0 ); 359 else 360 dwVariableLen = strlenW( lpDP->dp2->lpSessionDesc->u1.lpszSessionName ) + 1; 357 361 358 362 dwVariableSize = dwVariableLen * sizeof( WCHAR ); … … 374 378 rmsg->dwUnknown = 0x0000005c; 375 379 if( bAnsi ) 376 { 377 string = HEAP_strdupAtoW( GetProcessHeap(), 0, 378 lpDP->dp2->lpSessionDesc->sess.lpszSessionNameA ); 379 /* FIXME: Memory leak */ 380 } 380 MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, -1, 381 (LPWSTR)(rmsg+1), dwVariableLen ); 381 382 else 382 { 383 string = lpDP->dp2->lpSessionDesc->sess.lpszSessionName; 384 } 385 386 lstrcpyW( (LPWSTR)(rmsg+1), string ); 387 388 } 389 383 strcpyW( (LPWSTR)(rmsg+1), lpDP->dp2->lpSessionDesc->u1.lpszSessionName ); 384 }
Note:
See TracChangeset
for help on using the changeset viewer.