diff --git a/Message/MsgDef.cpp b/Message/MsgDef.cpp index 90b7e91e..daf731d6 100644 --- a/Message/MsgDef.cpp +++ b/Message/MsgDef.cpp @@ -340,7 +340,7 @@ byte* MSG_RVC::GetMachineAddress() const return (byte*)(m_ComCommandList[0].data()); } -void MSG_RVC::SetMachineAddress( byte* in_byte_ptr, size_t len ) +void MSG_RVC::SetMachineAddress(const byte* in_byte_ptr, size_t len ) { if (in_byte_ptr == NULL) { @@ -426,7 +426,7 @@ void MSG_AVC::SetCaptchaType(byte in_byte) m_ComCommandList[1].push_back(in_byte); } -void MSG_AVC::SetCaptcha(byte* in_byte_ptr,size_t len) +void MSG_AVC::SetCaptcha(const byte* in_byte_ptr,size_t len) { if (in_byte_ptr == NULL) { @@ -497,7 +497,7 @@ byte* MSG_RLI::GetPassword() const return (byte*)(m_ComCommandList[0].data()); } -void MSG_RLI::SetVerificationCode( byte* in_byte_ptr,size_t len ) +void MSG_RLI::SetVerificationCode(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -512,7 +512,7 @@ void MSG_RLI::SetVerificationCode( byte* in_byte_ptr,size_t len ) } } -void MSG_RLI::SetAccountNumber( byte* in_byte_ptr,size_t len ) +void MSG_RLI::SetAccountNumber(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -527,7 +527,7 @@ void MSG_RLI::SetAccountNumber( byte* in_byte_ptr,size_t len ) } } -void MSG_RLI::SetPassword( byte* in_byte_ptr,size_t len ) +void MSG_RLI::SetPassword(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -605,7 +605,7 @@ void MSG_ALI::SetLoginResult( byte in_byte ) m_ComCommandList[2].push_back(in_byte); } -void MSG_ALI::SetToken( byte* in_byte_ptr, size_t len /*= 4*/) +void MSG_ALI::SetToken(const byte* in_byte_ptr, size_t len /*= 4*/) { if (in_byte_ptr == NULL) { @@ -620,7 +620,7 @@ void MSG_ALI::SetToken( byte* in_byte_ptr, size_t len /*= 4*/) } } -void MSG_ALI::SetATLGUID( byte* in_byte_ptr, size_t len /*= 16*/ ) +void MSG_ALI::SetATLGUID(const byte* in_byte_ptr, size_t len /*= 16*/ ) { if (in_byte_ptr == NULL) { @@ -722,7 +722,7 @@ void MSG_RPS::SetRank( byte in_byte ) } -void MSG_RPS::SetNickname( byte* in_byte_ptr,size_t len ) +void MSG_RPS::SetNickname(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -738,7 +738,7 @@ void MSG_RPS::SetNickname( byte* in_byte_ptr,size_t len ) } -void MSG_RPS::SetAutograph( byte* in_byte_ptr,size_t len ) +void MSG_RPS::SetAutograph(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -760,7 +760,7 @@ void MSG_RPS::SetHeadForm( byte in_byte ) m_ComCommandList[1].push_back(in_byte); } -void MSG_RPS::SetHeadPortrait( byte* in_byte_ptr,size_t len ) +void MSG_RPS::SetHeadPortrait(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { @@ -812,7 +812,7 @@ byte* MSG_APS::GetMessageSynchro() const return (byte*)(m_ComCommandList[0].data()); } -void MSG_APS::SetMessageSynchro( byte* in_byte_ptr,size_t len ) +void MSG_APS::SetMessageSynchro(const byte* in_byte_ptr,size_t len ) { if (in_byte_ptr == NULL) { diff --git a/Message/MsgDef.h b/Message/MsgDef.h index e44c7293..424b2709 100644 --- a/Message/MsgDef.h +++ b/Message/MsgDef.h @@ -221,7 +221,7 @@ class MSG_RVC: public CMessage //机器地址 byte* GetMachineAddress() const; - void SetMachineAddress(byte* in_byte_ptr, size_t len); + void SetMachineAddress(const byte* in_byte_ptr, size_t len); int GetMachineAddressLen()const{ return m_MachineAddressLen; @@ -284,7 +284,7 @@ class MSG_AVC: public CMessage void SetCaptchaType(byte in_byte); - void SetCaptcha(byte* in_byte_ptr,size_t len); + void SetCaptcha(const byte* in_byte_ptr,size_t len); // @@ -349,11 +349,11 @@ class MSG_RLI:public CMessage byte* GetPassword() const; - void SetVerificationCode(byte* in_byte_ptr,size_t len); + void SetVerificationCode(const byte* in_byte_ptr,size_t len); - void SetAccountNumber(byte* in_byte_ptr,size_t len); + void SetAccountNumber(const byte* in_byte_ptr,size_t len); - void SetPassword(byte* in_byte_ptr,size_t len); + void SetPassword(const byte* in_byte_ptr,size_t len); int GetVerificationCodeLen() const{ @@ -426,9 +426,9 @@ class MSG_ALI:public CMessage void SetLoginResult(byte in_byte); - void SetToken(byte* in_byte_ptr,size_t len = 4); + void SetToken(const byte* in_byte_ptr,size_t len = 4); - void SetATLGUID(byte* in_byte_ptr, size_t len = 16); + void SetATLGUID(const byte* in_byte_ptr, size_t len = 16); int GetATLGUIDLen() const{ @@ -502,13 +502,13 @@ class MSG_RPS:public CMessage void SetRank(byte in_byte); - void SetNickname(byte* in_byte_ptr,size_t len); + void SetNickname(const byte* in_byte_ptr,size_t len); - void SetAutograph(byte* in_byte_ptr,size_t len); + void SetAutograph(const byte* in_byte_ptr,size_t len); void SetHeadForm(byte in_byte); - void SetHeadPortrait(byte* in_byte_ptr,size_t len); + void SetHeadPortrait(const byte* in_byte_ptr,size_t len); int GetNicknameLen() const{ @@ -575,7 +575,7 @@ class MSG_APS:public CMessage //个人信息同步通知 byte* GetMessageSynchro() const; - void SetMessageSynchro(byte* in_byte_ptr,size_t len); + void SetMessageSynchro(const byte* in_byte_ptr,size_t len); int GetMessageSynchroLen() const{ return m_MessageSynchroLen; diff --git a/VNOC/VNOC/VNOCLoginDlg.cpp b/VNOC/VNOC/VNOCLoginDlg.cpp index c356e899..047e7fa3 100644 --- a/VNOC/VNOC/VNOCLoginDlg.cpp +++ b/VNOC/VNOC/VNOCLoginDlg.cpp @@ -121,13 +121,9 @@ void CVNOCLoginDlg::OnBnClickedOk() ATLASSERT(pInet); if (pInet) { - byte Name[MAX_NAME_LEN] = {0}; - byte Password[MAX_PASSWORD_LEN] = {0}; - memcpy(Password,(LPCTSTR)m_strPassword,lstrlen((LPCTSTR)m_strPassword )*(sizeof(TCHAR))+1); - memcpy(Name,(LPCTSTR)m_strUsername,lstrlen((LPCTSTR)m_strUsername)*(sizeof(TCHAR))+1); MSG_RLI mRli; - mRli.SetAccountNumber(Name,lstrlen((LPCTSTR)m_strUsername)*(sizeof(TCHAR))+1); - mRli.SetPassword(Password,lstrlen((LPCTSTR)m_strUsername)*(sizeof(TCHAR))+1); + mRli.SetAccountNumber((const byte*)(LPCTSTR)m_strUsername,m_strUsername.GetLength()*sizeof(TCHAR)); + mRli.SetPassword((const byte*)(LPCTSTR)m_strPassword,m_strUsername.GetLength()*sizeof(TCHAR)); pInet->SendServer(mRli); //mRli.SetVerificationCode() _SetVerifyState(TRUE); @@ -163,7 +159,7 @@ BOOL CVNOCLoginDlg::Refresh() HRESULT CVNOCLoginDlg::OnMessage( const CMessage& msg ) { Global->Log(LogFile_Net,_T("接收到网络包")); - if (msg.GetMessageType() == MSG_AVC_TYPE) + if (msg.GetMessageType() == MSG_ALI_TYPE) { const MSG_ALI* ma = dynamic_cast(&msg); if (ma->GetLoginResult() == 1)