当前位置: 首页>>代码示例>>C++>>正文


C++ InStream::in_uni_to_ascii_str方法代码示例

本文整理汇总了C++中InStream::in_uni_to_ascii_str方法的典型用法代码示例。如果您正苦于以下问题:C++ InStream::in_uni_to_ascii_str方法的具体用法?C++ InStream::in_uni_to_ascii_str怎么用?C++ InStream::in_uni_to_ascii_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InStream的用法示例。


在下文中一共展示了InStream::in_uni_to_ascii_str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Error

    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)
开发者ID:gvsurenderreddy,项目名称:redemption,代码行数:55,代码来源:SaveSessionInfoPDU.hpp


注:本文中的InStream::in_uni_to_ascii_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。