CStringA netbios_name::GetANSIName() const { CStringA sName; LPSTR szName = sName.GetBuffer( NCBNAMSZ ); CopyMemory( szName, (LPCSTR)netbiosed.name, NCBNAMSZ - 1 ); szName[ NCBNAMSZ - 1 ] = 0; sName.ReleaseBuffer(); sName.Trim(); sName.OemToAnsi(); return sName; }
bool netbios_name::GetRealSender (UCHAR lsn, CStringA& sRealFrom) const { sRealFrom.Empty (); SESSION_INFO_BLOCK sibSession = {}; UCHAR dwInfoRes = pluginNetBIOS.Stat( *this, &sibSession ); if ( dwInfoRes == NRC_GOODRET ) { for ( int i = 0; i < sibSession.sib_header.num_sess; i++ ) { if ( sibSession.sib_Names [i].lsn == lsn ) { // Наша сессия const char* n = (const char*)sibSession.sib_Names [i].remote_name; BYTE j = NCBNAMSZ - 2; for ( ; j && ( n [ j ] == ' ' ); --j ); sRealFrom.Append( n, j + 1 ); sRealFrom.OemToAnsi(); return true; } } } return false; }