Ignore:
Timestamp:
Mar 14, 2001, 12:13:28 AM (24 years ago)
Author:
hugh
Message:

Synced with WINE

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:06 hugh Exp $
     1// $Id: name_server.cpp,v 1.4 2001-03-13 23:13:27 hugh Exp $
    22/* DPLAYX.DLL name server implementation
    33 *
     
    1818#include "winbase.h"
    1919#include "winuser.h"
     20#include "winnls.h"
     21#include "wine/unicode.h"
    2022#include "debugtools.h"
    2123#include "heap.h"
     
    8284                                       LPVOID                    lpNSInfo )
    8385{
     86  DWORD len;
    8487  lpNSCache     lpCache = (lpNSCache)lpNSInfo;
    8588  lpNSCacheData lpCacheNode;
     
    128131
    129132  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();
    135139
    136140  DPQ_INSERT(lpCache->first, lpCacheNode, next );
     
    199203}
    200204
     205/* Delete a name server node which has been allocated on the heap */
    201206DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData )
    202207{
     
    209214}
    210215
    211 
    212 
    213216/* Render all data in a session cache invalid */
    214217void NS_InvalidateSessionCache( LPVOID lpNSInfo )
     
    257260void NS_ResetSessionEnumeration( LPVOID lpNSInfo )
    258261{
    259 
    260262  ((lpNSCache)lpNSInfo)->present = ((lpNSCache)lpNSInfo)->first.lpQHFirst;
    261263}
     
    285287 * older than the criteria. If so, just delete that information.
    286288 */
     289/* FIXME: This needs to be called by some periodic timer */
    287290void NS_PruneSessionCache( LPVOID lpNSInfo )
    288291{
     
    337340}
    338341
    339 
    340 
    341 /* Message stuff */
     342/* NAME SERVER Message stuff */
    342343void NS_ReplyToEnumSessionsRequest( LPVOID lpMsg,
    343344                                    LPDPSP_REPLYDATA lpReplyData,
     
    347348  DWORD dwVariableSize;
    348349  DWORD dwVariableLen;
    349   LPWSTR string;
    350350  /* LPDPMSG_ENUMSESSIONSREQUEST msg = (LPDPMSG_ENUMSESSIONSREQUEST)lpMsg; */
    351351  BOOL bAnsi = TRUE; /* FIXME: This needs to be in the DPLAY interface */
     
    353353  FIXME( ": few fixed + need to check request for response\n" );
    354354
    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;
    357361
    358362  dwVariableSize = dwVariableLen * sizeof( WCHAR );
     
    374378  rmsg->dwUnknown = 0x0000005c;
    375379  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 );
    381382  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.