explicit LogonInfoVersion1_Recv(InStream & stream) : cbDomain(0), cbUserName(0), SessionId(0) { memset(Domain, 0, sizeof(Domain)); memset(UserName, 0, sizeof(UserName)); unsigned expected = 4; // cbDomain(4) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "Truncated Logon Info Version 1 (data): expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_DATA_TRUNCATED); } this->cbDomain = stream.in_uint32_le(); expected = 52 + // Domain(52) 4; // cbUserName(4) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "Truncated Logon Info Version 1 (data): expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_DATA_TRUNCATED); } stream.in_uni_to_ascii_str(this->Domain, this->cbDomain, sizeof(this->Domain)); stream.in_skip_bytes(52 - // Domain(52) this->cbDomain); this->cbUserName = stream.in_uint32_le(); expected = 512 + // UserName(512) 4; // SessionId(4) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "Truncated Logon Info Version 1 (data): expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_DATA_TRUNCATED); } stream.in_uni_to_ascii_str(this->UserName, this->cbUserName, sizeof(this->UserName)); stream.in_skip_bytes(512 - // UserName(512) this->cbUserName); this->SessionId = stream.in_uint32_le(); LOG(LOG_INFO, "Logon Info Version 1 (data): Domain=\"%s\" UserName=\"%s\" SessionId=%d", this->Domain, this->UserName, this->SessionId); } // LogonInfoVersion1_Recv(InStream & stream)
explicit LogonInfoVersion2_Recv(InStream & stream) : Version(0), Size(0), SessionId(0), cbDomain(0), cbUserName(0) { memset(Pad, 0, sizeof(Pad)); memset(Domain, 0, sizeof(Domain)); memset(UserName, 0, sizeof(UserName)); unsigned expected = 2 + // Version(2) 4 + // Size(4) 4 + // SessionId(4) 4 + // cbDomain(4) 4 + // cbUserName(4) 558; // Pad(558) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "Truncated Logon Info Version 2 (data): expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_DATA_TRUNCATED); } this->Version = stream.in_uint16_le(); this->Size = stream.in_uint32_le(); this->SessionId = stream.in_uint32_le(); this->cbDomain = stream.in_uint32_le(); this->cbUserName = stream.in_uint32_le(); stream.in_copy_bytes(this->Pad, sizeof(this->Pad)); expected = this->cbDomain + this->cbUserName; // SessionId(4) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "Truncated Logon Info Version 2 (data): expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_DATA_TRUNCATED); } stream.in_uni_to_ascii_str(this->Domain, this->cbDomain, sizeof(this->Domain)); stream.in_uni_to_ascii_str(this->UserName, this->cbUserName, sizeof(this->UserName)); LOG(LOG_INFO, "Logon Info Version 2 (data): Domain=\"%s\" UserName=\"%s\" SessionId=%d", this->Domain, this->UserName, this->SessionId); } // LogonInfoVersion2_Recv(InStream & stream)