SOCKET CClientSession::OpenStream( u_int nPasPort ) { SOCKADDR_IN addr; addr.sin_family = AF_INET; addr.sin_addr = GetServAddr().m_addrHost; addr.sin_port = htons( (u_short)nPasPort ); SOCKET sock_stream = Socket( PF_INET, SOCK_STREAM, 0 ); ASSERT( sock_stream!=INVALID_SOCKET ); //import, must retry the socket initilization a few times. try{ if( RedundantConnect( sock_stream, addr )!=0 )throw new CSockException(); //open the data stream channel. CMessageBase msg; msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() ); SendMessage( sock_stream, &msg ); CMessageBase* pMsg = RecvMessage<CMessageBase>( sock_stream ); if( pMsg==NULL )throw new CRemoteException(E_BROKENPIPE); CMessageTrash trash(pMsg); if( pMsg->IsFailed() )throw new CRemoteException( pMsg->GetResult() ); }catch( ... ){ CMessageBase msg; msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr(), E_OPENSTREAM ); m_pClntProxy->SendMessage( &msg ); CMessageTrash trash(WaitForMessage( NCF_ACK|NCM_OPENSTREAM ) ); closesocket( sock_stream ); throw; return INVALID_SOCKET; } return sock_stream; }
HRESULT CClientSession::DoGetFile( const string& strFileName ) { //step 1. request passive mode to get the data channel address u_int nPasPort = 0; HRESULT hRet = DoPassive( nPasPort ); if( FAILED(hRet) )return hRet; //step 2. send the put file command. CMessageHead* pMsg = (CMessageHead*)new char[sizeof(CMessageHead)+strFileName.length()+1]; pMsg->Init( NCM_GETFILE, GetAddr(), GetServAddr() ); pMsg->SetLength( sizeof(CMessageHead)+strFileName.length()+1 ); strcpy( pMsg->GetData(), strFileName.c_str() ); m_pClntProxy->SendMessage( pMsg ); CMessage1Param<int>* pMsgAck = (CMessage1Param<int>*)GetMessage( NCF_ACK|NCM_GETFILE ); CMessageTrash trash(pMsgAck->GetMessageHead()); if( !pMsgAck->GetMessageHead()->IsSucceeded() )return pMsgAck->GetMessageHead()->GetResult(); pMsgAck->ntoh(); int nFileMode = pMsgAck->GetParam(); //step 3. now the server agrees on the file transfer, connect the data channel and send file SOCKADDR_IN addr; addr.sin_family = AF_INET; addr.sin_addr = GetServAddr().m_addrHost; addr.sin_port = htons( (u_short)nPasPort ); SOCKET sock_stream; //import, must retry the socket initilization a few times. int i; for( i=0; i<MAXRETRY; i++ ){ sock_stream = Socket( PF_INET, SOCK_STREAM, 0 ); ASSERT( sock_stream!=INVALID_SOCKET ); if( ::connect( sock_stream, (SOCKADDR*)&addr, sizeof(SOCKADDR_IN) )==0 )break; closesocket( sock_stream ); } if( i>=MAXRETRY )throw new CSockException(); //open the data stream channel. CMessageHead msg; msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() ); msg.Send( sock_stream ); pMsg = RecvMessage( sock_stream ); CMessageTrash trash2(pMsg); if( pMsg->IsFailed() ){} //send the file stream int nLen = RecvFileEx( sock_stream, strFileName.c_str(), nFileMode ); closesocket( sock_stream ); //step 4. exchange the error code. msg.Init( NCM_STREAMLENGTH, GetAddr(), GetServAddr(), nLen ); m_pClntProxy->SendMessage( &msg ); pMsg = GetMessage( NCF_ACK|NCM_STREAMLENGTH ); CMessageTrash trash3(pMsg); return pMsg->GetResult(); }
HRESULT CClientSession::DoPutFile( const string& strSrcFile, const string& strDstFile ) { if( !IsFileExist( strSrcFile.c_str() ) ){ return E_NOENT; } //step 1. request passive mode to get the data channel address u_int nPasPort = 0; HRESULT hRet = DoPassive( nPasPort ); if( FAILED(hRet) )return hRet; //step 2. send the put file command. CMessage1Param<char*>* pMsgPut = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strDstFile.length()+1 ); pMsgPut->Init( NCM_PUTFILE, GetAddr(), GetServAddr(), strDstFile.c_str() ); CMessageTrash trash1(pMsgPut); m_pClntProxy->SendMessage( pMsgPut ); CMessage1Param<int>* pMsgAck = (CMessage1Param<int>*)WaitForMessage( NCF_ACK|NCM_PUTFILE ); CMessageTrash trash2(pMsgAck); if( !pMsgAck->IsSucceeded() )return pMsgAck->GetResult(); pMsgAck->ntoh( false ); int nFileMode = pMsgAck->GetParam(); //step 3. now the server agrees on the file transfer, connect the data channel and send file SOCKET sock_stream = OpenStream( nPasPort ); if( sock_stream==INVALID_SOCKET )return E_OPENSTREAM; //open the data stream channel. /* CMessageBase msg; msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() ); SendMessage( sock_stream, &msg ); CMessageBase* pMsg = RecvMessage<CMessageBase>( sock_stream ); if( pMsg==NULL ){ closesocket( sock_stream ); return E_OPENSTREAM; } CMessageTrash trash3(pMsg); if( pMsg->IsFailed() ){ closesocket( sock_stream ); return pMsg->GetResult(); }*/ //send the file stream int nLen = SendFileEx( sock_stream, strSrcFile.c_str(), nFileMode ); shutdown( sock_stream, SD_BOTH ); closesocket( sock_stream ); //step 4. exchange the error code. CMessageBase msg; msg.Init( NCM_STREAMLENGTH, GetAddr(), GetServAddr(), nLen ); m_pClntProxy->SendMessage( &msg ); CMessageBase* pMsg = WaitForMessage( NCF_ACK|NCM_STREAMLENGTH ); CMessageTrash trash4(pMsg); return pMsg->GetResult(); }
HRESULT CClientSession::DoListDir( const string& strPath, EnumNetfEntryProc pEnumProc ) { //step 1. request passive mode to get the data channel address u_int nPasPort = 0; HRESULT hRet = DoPassive( nPasPort ); if( FAILED(hRet) )return hRet; //step 2. send the put file command. CMessage1Param<char*>* pMsgList = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strPath.length()+1 ); pMsgList->Init( NCM_LISTDIR, GetAddr(), GetServAddr(), strPath.c_str() ); CMessageTrash trash1(pMsgList); m_pClntProxy->SendMessage( pMsgList ); CMessageBase* pMsgAck = WaitForMessage( NCF_ACK|NCM_LISTDIR ); CMessageTrash trash2(pMsgAck); if( !pMsgAck->IsSucceeded() )return pMsgAck->GetResult(); //step 3. now the server agrees on the file transfer, connect the data channel and send file SOCKET sock_stream = OpenStream( nPasPort ); if( sock_stream==INVALID_SOCKET )return E_OPENSTREAM; //open the data stream channel. /* CMessageBase msg; msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() ); SendMessage( sock_stream, &msg ); CMessageBase* pMsg = RecvMessage<CMessageBase>( sock_stream ); if( pMsg==NULL ){ closesocket( sock_stream ); return E_OPENSTREAM; } CMessageTrash trash3(pMsg); if( pMsg->IsFailed() ){ closesocket( sock_stream ); return pMsg->GetResult(); }*/ NETF_ENTRY entry; int nLen = 0; while( true ){ if( RecvBuffer( sock_stream, (char*)&entry, sizeof(NETF_ENTRY) )<sizeof(NETF_ENTRY) )break; (*pEnumProc)( &entry ); nLen += sizeof(NETF_ENTRY); } closesocket( sock_stream ); //step 4. exchange the error code. CMessageBase msg; msg.Init( NCM_STREAMLENGTH, GetAddr(), GetServAddr(), nLen ); m_pClntProxy->SendMessage( &msg ); CMessageBase* pMsg = WaitForMessage( NCF_ACK|NCM_STREAMLENGTH ); CMessageTrash trash4(pMsg); return pMsg->GetResult(); }
TBit* C3D_12401::SetChkBx() { TBit* ChkBx = new TBit[C3DChkBox_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&ChkBx[0],C3D_EN); SetAddr(&ChkBx[1],C3D_DEMO); }else if(MainForm->addr_place == 1){ GetAddr(&ChkBx[0],"C3D_EN"); GetAddr(&ChkBx[1],"C3D_DEMO"); } return ChkBx; }
TBit* SP_12401::SetScrollBar() { TBit* ScrlB = new TBit [SPScrollBar_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&ScrlB[0],HORZ_THR); SetAddr(&ScrlB[1],VERT_THR); SetAddr(&ScrlB[2],EDGE_THR); }else if(MainForm->addr_place == 1){ GetAddr(&ScrlB[0],"HORZ_THR"); GetAddr(&ScrlB[1],"VERT_THR"); GetAddr(&ScrlB[2],"EDGE_THR"); } return ScrlB; }
TLUT* CM_12401::Setval() { TLUT* LUT = new TLUT [CMval_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&LUT[0],CM1); SetAddr(&LUT[1],CM2); SetAddr(&LUT[2],CM3); }else if(MainForm->addr_place == 1){ GetAddr(&LUT[0],"CM1"); GetAddr(&LUT[1],"CM2"); GetAddr(&LUT[2],"CM3"); } return LUT; }
/* Let's show requested line(or part of it). */ void ShowLine(int y, int x, int len) { char slbuf[512]; char *ptr, *scr, *attr; int i; unsigned char curattr; ptr=slbuf+3; /* Hack: was used for older version to place 25th string on ** 24th. */ if (y<25) GetAddr(y, x, slbuf); else GetAddr(24, x, slbuf); /* Set some adresses */ curattr=0; scr=VirtualScreen+(y-1)*cols+x-1; attr=ScreenAttr+(y-1)*cols+x-1; /* Let's proceed with string. */ for (i=0; i<len; i++) { /* Attribute has changed ? Let's add codes for changing color */ if (*attr!=curattr) { /* Pss has changed ? Let's change pss. */ if (((*attr)&0x80)!=(curattr&0x80)||(!curattr)) { *ptr++=0x28; *ptr++=0x43; if (*attr>0x80) *ptr++=0xC1; else *ptr++=0xC2; } /* Color has changed ? Let's change it. */ if (((*attr)&0x7F)!=(curattr&0x7F)) { *ptr++=0x28; *ptr++=0x42; if (*attr>0x80) *ptr++=*attr; else *ptr++=*attr+0x80; } curattr=*attr; } *ptr++=*scr; scr++; attr++; } /* Add string to output stream */ AddScrBuf(slbuf, ptr-slbuf); }
TBit* SP_12401::SetChkBx() { TBit* ChkBox = new TBit [SPChkBox_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&ChkBox[0],SP_EN); SetAddr(&ChkBox[1],SP_DEMO); SetAddr(&ChkBox[2],TEXT_DET); }else if(MainForm->addr_place == 1){ GetAddr(&ChkBox[0],"SP_EN"); GetAddr(&ChkBox[1],"SP_DEMO"); GetAddr(&ChkBox[2],"TEXT_DET"); } return ChkBox; }
TLUT* CM_12401::Setofs() { TLUT* LUT = new TLUT [CMofs_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&LUT[0],ofs1); SetAddr(&LUT[1],ofs2); SetAddr(&LUT[2],ofs3); }else if(MainForm->addr_place == 1){ GetAddr(&LUT[0],"ofs1"); GetAddr(&LUT[1],"ofs2"); GetAddr(&LUT[2],"ofs3"); } return LUT; }
//******************************************************************** // Name: MailConnect // Input: None // Output: None // Description: Connect to the mail host and receive the welcome message. // Author/Date: jcar 20/9/96 // History: //******************************************************************** int MailConnect() { int res; TLS_VARS; // Create Socket if ((GLOBAL(sc) = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) return (FAILED_TO_OBTAIN_SOCKET_HANDLE); // Get our own host name if (gethostname(GLOBAL(LocalHost), HOST_NAME_LEN)) return (FAILED_TO_GET_HOSTNAME); // Resolve the servers IP //if (!isdigit(GLOBAL(MailHost)[0])||!gethostbyname(GLOBAL(MailHost))) //{ // return (FAILED_TO_RESOLVE_HOST); //} // Connect to server GLOBAL(sock_in).sin_family = AF_INET; GLOBAL(sock_in).sin_port = htons(25); GLOBAL(sock_in).sin_addr.S_un.S_addr = GetAddr(GLOBAL(MailHost)); if (connect(GLOBAL(sc), (LPSOCKADDR) & GLOBAL(sock_in), sizeof(GLOBAL(sock_in)))) return (FAILED_TO_CONNECT); // receive Server welcome message res = Ack(); return (res); }
TBit *Vend_11307::SetChkBx() { TBit *ChkBox = new TBit[VendChkBox_Nbr]; if (MainForm->addr_place == 0) { SetAddr(&ChkBox[0], SSC_VSYNC_EN); // SetAddr(&ChkBox[1], SSC_CLK_NG_EN); // SetAddr(&ChkBox[2], SSC_CLK_STOP_EN); // SetAddr(&ChkBox[3], PP_CHCD); // } else if (MainForm->addr_place == 1) { GetAddr(&ChkBox[0], "SSC_VSYNC_EN"); GetAddr(&ChkBox[1], "SSC_CLK_NG_EN"); GetAddr(&ChkBox[2], "SSC_CLK_STOP_EN"); GetAddr(&ChkBox[3], "PP_CHCD"); } return ChkBox; }
TBit* CM_12401::SetChkBx() { TBit* ChkBox = new TBit [CMChkBox_Nbr]; //chb = new TBit [CMChkBox_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&ChkBox[0],CM_EN); SetAddr(&ChkBox[1],CM_DEMO); //SetAddr(&ChkBox[2],DEMO_LEFT); }else if(MainForm->addr_place == 1){ GetAddr(&ChkBox[0],"CM_EN"); GetAddr(&ChkBox[1],"CM_DEMO"); //GetAddr(&ChkBox[2],"DEMO_LEFT"); } return ChkBox; }
TLUT* C3D_12401::SetLUT() { TLUT* lut = new TLUT[C3DLUT_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&lut[0],C3D_LUTR); SetAddr(&lut[1],C3D_LUTG); SetAddr(&lut[2],C3D_LUTB); // SetAddr(&lut[3],C3D_LUTW); }else if(MainForm->addr_place == 1){ GetAddr(&lut[0],"C3D_LUTR"); GetAddr(&lut[1],"C3D_LUTG"); GetAddr(&lut[2],"C3D_LUTB"); // GetAddr(&lut[3],"C3D_LUTW"); } return lut; }
std::string VertexProgramDecompiler::Format(const std::string& code) { const std::pair<std::string, std::function<std::string()>> repl_list[] = { { "$$", []() -> std::string { return "$"; } }, { "$0", std::bind(std::mem_fn(&VertexProgramDecompiler::GetSRC), this, 0) }, { "$1", std::bind(std::mem_fn(&VertexProgramDecompiler::GetSRC), this, 1) }, { "$2", std::bind(std::mem_fn(&VertexProgramDecompiler::GetSRC), this, 2) }, { "$s", std::bind(std::mem_fn(&VertexProgramDecompiler::GetSRC), this, 2) }, { "$awm", std::bind(std::mem_fn(&VertexProgramDecompiler::AddAddrRegWithoutMask), this) }, { "$am", std::bind(std::mem_fn(&VertexProgramDecompiler::AddAddrMask), this) }, { "$a", std::bind(std::mem_fn(&VertexProgramDecompiler::AddAddrReg), this) }, { "$t", std::bind(std::mem_fn(&VertexProgramDecompiler::GetTex), this) }, { "$fa", [this]()->std::string { return std::to_string(GetAddr()); } }, { "$f()", std::bind(std::mem_fn(&VertexProgramDecompiler::GetFunc), this) }, { "$ifcond ", [this]() -> std::string { const std::string& cond = GetCond(); if (cond == "true") return ""; return "if(" + cond + ") "; } }, { "$cond", std::bind(std::mem_fn(&VertexProgramDecompiler::GetCond), this) } }; return fmt::replace_all(code, repl_list); }
TBit* CE_12401::SetCboBx() { TBit* CboBox = new TBit [CECboBox_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&CboBox[0],MAXLIMT_SEL); SetAddr(&CboBox[1],PIXHIST_SEL); SetAddr(&CboBox[2],LOWST_SEL); SetAddr(&CboBox[3],JND_SEL); SetAddr(&CboBox[4],ST_SEL); }else if(MainForm->addr_place == 1){ GetAddr(&CboBox[0],"MAXLIMT_SEL"); GetAddr(&CboBox[1],"PIXHIST_SEL"); GetAddr(&CboBox[2],"LOWST_SEL"); GetAddr(&CboBox[3],"JND_SEL"); GetAddr(&CboBox[4],"ST_SEL"); } CboBox[0].choice_nbr = 2; CboBox[0].choice = new String [2]; CboBox[0].choice[0] = "No Limit"; CboBox[0].choice[1] = "Smaller than Max LUT"; CboBox[1].choice_nbr = 2; CboBox[1].choice = new String [2]; CboBox[1].choice[0] = "RGB"; CboBox[1].choice[1] = "Y(Luminance)"; CboBox[2].choice_nbr = 4; CboBox[2].choice = new String [4]; CboBox[2].choice[0] = "Original"; CboBox[2].choice[1] = "Fast"; CboBox[2].choice[2] = "Middle"; CboBox[2].choice[3] = "Slow"; CboBox[3].choice_nbr = 2; CboBox[3].choice = new String [2]; CboBox[3].choice[0] = "JND LUT"; CboBox[3].choice[1] = "Pixel Histogram"; CboBox[4].choice_nbr = 2; CboBox[4].choice = new String [2]; CboBox[4].choice[0] = "ST LUT"; CboBox[4].choice[1] = "Gradual progress Gamma Curve"; return CboBox; }
HRESULT CClientSession::DoFileMode( int nFileMode ) { CMessageHead msg; msg.Init( NCM_PASSIVE, GetAddr(), GetServAddr(), nFileMode ); m_pClntProxy->SendMessage( &msg ); CMessageHead* pAck = GetMessage( NCF_ACK|NCM_PASSIVE ); CMessageTrash trash( pAck ); return pAck->GetResult(); }
TBit* HSV_12401::SetChkBx() { TBit* ChkBx = new TBit[HSVChkBox_Nbr]; if(MainForm->addr_place == 0){ SetAddr(&ChkBx[0],HUE_DEMO); }else if(MainForm->addr_place == 1){ GetAddr(&ChkBx[0],"HUE_DEMO"); } return ChkBx; }
TLUT* HSV_12401::SetLUT() { TLUT* lut = new TLUT[1]; if(MainForm->addr_place == 0){ SetAddr(&lut[0],HSVlut); }else if(MainForm->addr_place == 1){ GetAddr(&lut[0],"HSVlut"); } return lut; }
TLUT* CE_12401::SetMINlut() { TLUT* lut = new TLUT [1]; if(MainForm->addr_place == 0){ SetAddr(&lut[0],MIN_LUT); }else if(MainForm->addr_place == 1){ GetAddr(&lut[0],"MIN_LUT"); } return lut; }
TBit HSV_12401::SetEn() { TBit en; if(MainForm->addr_place == 0){ SetAddr(&en,HUE_EN); }else if(MainForm->addr_place == 1){ GetAddr(&en,"HUE_EN"); } return en; }
TLUT* SP_12401::SetSPLUT() { TLUT* LUT = new TLUT [1]; if(MainForm->addr_place == 0){ SetAddr(&LUT[0],SP_LUT); }else if(MainForm->addr_place == 1){ GetAddr(&LUT[0],"SP_LUT"); } return LUT; }
HRESULT CClientSession::DoFileMode( int nFileMode ) { CMessageBase msg; msg.Init( NCM_FILEMODE, GetAddr(), GetServAddr(), nFileMode ); m_pClntProxy->SendMessage( &msg ); CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_FILEMODE ); CMessageTrash trash( pAck ); return pAck->GetResult(); }
HRESULT CClientSession::DoChMod( const string& strFileName, int nMode ) { CMessage1Param<char*>* pMsg = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strFileName.length()+1 ); pMsg->Init( NCM_CHMOD, GetAddr(), GetServAddr(), strFileName.c_str(), nMode ); CMessageTrash trash(pMsg); m_pClntProxy->SendMessage( pMsg ); CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_CHMOD ); CMessageTrash trash2(pAck); return pAck->GetResult(); }
HRESULT CClientSession::DoChDir( const string& strPath ) { CMessage1Param<char*>* pMsg = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strPath.length()+1 ); pMsg->Init( NCM_CHDIR, GetAddr(), GetServAddr(), strPath.c_str() ); CMessageTrash trash(pMsg); m_pClntProxy->SendMessage( pMsg ); CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_CHDIR ); CMessageTrash trash2( pAck ); return pAck->GetResult(); }
HRESULT CClientSession::DoLogon( const string& strUser, const string& strPassword ) { CMessage2Param<char*, char*>* pMsg = (CMessage2Param<char*, char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strUser.length()+strPassword.length()+2 ); pMsg->Init( NCM_LOGON, GetAddr(), GetServAddr(), strUser.c_str(), strPassword.c_str() ); CMessageTrash trash(pMsg); m_pClntProxy->SendMessage( pMsg ); CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_LOGON ); CMessageTrash trash2( pAck ); return pAck->GetResult(); }
HRESULT CClientSession::DoServerInfo( SERVERINFO& info ) { CMessageBase msg; msg.Init( NCM_SERVERINFO, GetAddr(), GetServAddr() ); m_pClntProxy->SendMessage( &msg ); CMessage1Param<SERVERINFO>* pAck = (CMessage1Param<SERVERINFO>*)WaitForMessage( NCF_ACK|NCM_SERVERINFO ); CMessageTrash trash( pAck ); pAck->ntoh( false ); info = pAck->GetParam(); return pAck->GetResult(); }
HRESULT CClientSession::DoSoftLink( const string& strSrc, const string& strLnk ) { CMessage2Param<char*, char*>* pMsg = (CMessage2Param<char*, char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strSrc.length()+strLnk.length()+2 ); pMsg->Init( NCM_SOFTLINK, GetAddr(), GetServAddr(), strSrc.c_str(), strLnk.c_str() ); CMessageTrash trash(pMsg); m_pClntProxy->SendMessage( pMsg ); CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_SOFTLINK ); CMessageTrash trash2( pAck ); return pAck->GetResult(); }
inline void configure() { uint8_t addr = GetAddr(); // Initialize SMBus SMBusInit(addr); SMBEnable(); conf_TMR0(); conf_motors(); SREG |= _BV(7); /* Enable interrupts */ }
HRESULT CClientSession::DoPassive( u_int& nPasPort ) { CMessageBase msg; msg.Init( NCM_PASSIVE, GetAddr(), GetServAddr() ); m_pClntProxy->SendMessage( &msg ); CMessage1Param<u_int>* pMsg = (CMessage1Param<u_int>*)WaitForMessage( NCF_ACK|NCM_PASSIVE ); CMessageTrash trash( pMsg ); if( pMsg->IsSucceeded() ){ pMsg->ntoh( false ); nPasPort = pMsg->GetParam(); } return pMsg->GetResult(); }