您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetLocaleByName函数代码示例

51自学网 2021-06-01 21:10:13
  C++
这篇教程C++ GetLocaleByName函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetLocaleByName函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLocaleByName函数的具体用法?C++ GetLocaleByName怎么用?C++ GetLocaleByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: DEBUG_LOG

//.........这里部分代码省略.........    memcpy(hash, sha.GetDigest(), 20);    sha.Initialize();    sha.UpdateBigNumbers(&g, NULL);    sha.Finalize();    for (int i = 0; i < 20; ++i)    {        hash[i] ^= sha.GetDigest()[i];    }    BigNumber t3;    t3.SetBinary(hash, 20);    sha.Initialize();    sha.UpdateData(_login);    sha.Finalize();    uint8 t4[SHA_DIGEST_LENGTH];    memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH);    sha.Initialize();    sha.UpdateBigNumbers(&t3, NULL);    sha.UpdateData(t4, SHA_DIGEST_LENGTH);    sha.UpdateBigNumbers(&s, &A, &B, &K, NULL);    sha.Finalize();    BigNumber M;    M.SetBinary(sha.GetDigest(), 20);    ///- Check if SRP6 results match (password is correct), else send an error    if (!memcmp(M.AsByteArray(), lp.M1, 20))    {        BASIC_LOG("User '%s' successfully authenticated", _login.c_str());        ///- Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account        // No SQL injection (escaped user name) and IP address as received by socket        const char* K_hex = K.AsHexStr();        LoginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', os = '%s', failed_logins = 0 WHERE username = '%s'", K_hex, get_remote_address().c_str(), GetLocaleByName(_localizationName), _os.c_str(), _safelogin.c_str() );        OPENSSL_free((void*)K_hex);        ///- Finish SRP6 and send the final result to the client        sha.Initialize();        sha.UpdateBigNumbers(&A, &M, &K, NULL);        sha.Finalize();        SendProof(sha);        ///- Set _authed to true!        _authed = true;    }    else    {        if (_build > 6005)                                  // > 1.12.2        {            char data[4] = { CMD_AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0};            send(data, sizeof(data));        }        else        {            // 1.x not react incorrectly at 4-byte message use 3 as real error            char data[2] = { CMD_AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT};            send(data, sizeof(data));        }        BASIC_LOG("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str ());        uint32 MaxWrongPassCount = sConfig.GetIntDefault("WrongPass.MaxCount", 0);        if(MaxWrongPassCount > 0)        {            //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP            LoginDatabase.PExecute("UPDATE account SET failed_logins = failed_logins + 1 WHERE username = '%s'",_safelogin.c_str());
开发者ID:hodobaj,项目名称:StrawberryCore_v2,代码行数:67,


示例2: TC_LOG_DEBUG

//.........这里部分代码省略.........                //set expired bans to inactive                LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS));                // If the account is banned, reject the logon attempt                stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED);                stmt->setUInt32(0, fields[1].GetUInt32());                PreparedQueryResult banresult = LoginDatabase.Query(stmt);                if (banresult)                {                    if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32())                    {                        pkt << uint8(WOW_FAIL_BANNED);                        TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());                    }                    else                    {                        pkt << uint8(WOW_FAIL_SUSPENDED);                        TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());                    }                }                else                {                    // Get the password from the account table, upper it, and make the SRP6 calculation                    std::string rI = fields[0].GetString();                    // Don't calculate (v, s) if there are already some in the database                    std::string databaseV = fields[6].GetString();                    std::string databaseS = fields[7].GetString();                    TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str());                    // multiply with 2 since bytes are stored as hexstring                    if (databaseV.size() != s_BYTE_SIZE * 2 || databaseS.size() != s_BYTE_SIZE * 2)                        _SetVSFields(rI);                    else                    {                        s.SetHexStr(databaseS.c_str());                        v.SetHexStr(databaseV.c_str());                    }                    b.SetRand(19 * 8);                    BigNumber gmod = g.ModExp(b, N);                    B = ((v * 3) + gmod) % N;                    ASSERT(gmod.GetNumBytes() <= 32);                    BigNumber unk3;                    unk3.SetRand(16 * 8);                    // Fill the response packet with the result                    if (!AuthHelper::IsAcceptedClientBuild(_build) && !patcher.PossiblePatching(_build, _localizationName))                        pkt << uint8(WOW_FAIL_VERSION_INVALID);                    else                        pkt << uint8(WOW_SUCCESS);                    // B may be calculated < 32B so we force minimal length to 32B                    pkt.append(B.AsByteArray(32), 32);      // 32 bytes                    pkt << uint8(1);                    pkt.append(g.AsByteArray(), 1);                    pkt << uint8(32);                    pkt.append(N.AsByteArray(32), 32);                    pkt.append(s.AsByteArray(), s.GetNumBytes());   // 32 bytes                    pkt.append(unk3.AsByteArray(16), 16);                    uint8 securityFlags = 0;                    pkt << uint8(securityFlags);            // security flags (0x0...0x04)                    if (securityFlags & 0x01)               // PIN input                    {                        pkt << uint32(0);                        pkt << uint64(0) << uint64(0);      // 16 bytes hash?                    }                    if (securityFlags & 0x02)               // Matrix input                    {                        pkt << uint8(0);                        pkt << uint8(0);                        pkt << uint8(0);                        pkt << uint8(0);                        pkt << uint64(0);                    }                    if (securityFlags & 0x04)               // Security token input                        pkt << uint8(1);                    uint8 secLevel = fields[5].GetUInt8();                    _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR;                    TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),                            _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)                        );                }            }        }        else                                                //no account            pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT);    }    socket().send((char const*)pkt.contents(), pkt.size());    return true;}
开发者ID:RaitoBezarius,项目名称:TrinityCore,代码行数:101,


示例3: socket

//.........这里部分代码省略.........    for (int i = 0; i < 20; ++i)        hash[i] ^= sha.GetDigest()[i];    BigNumber t3;    t3.SetBinary(hash, 20);    sha.Initialize();    sha.UpdateData(_login);    sha.Finalize();    uint8 t4[SHA_DIGEST_LENGTH];    memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH);    sha.Initialize();    sha.UpdateBigNumbers(&t3, NULL);    sha.UpdateData(t4, SHA_DIGEST_LENGTH);    sha.UpdateBigNumbers(&s, &A, &B, &K, NULL);    sha.Finalize();    BigNumber M;    M.SetBinary(sha.GetDigest(), 20);    // Check if SRP6 results match (password is correct), else send an error    if (!memcmp(M.AsByteArray(), lp.M1, 20))    {        sLog->outBasic("User '%s' successfully authenticated", _login.c_str());        // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account        // No SQL injection (escaped user name) and IP address as received by socket        const char *K_hex = K.AsHexStr();        PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SET_LOGONPROOF);        stmt->setString(0, K_hex);        stmt->setString(1, socket().get_remote_address().c_str());        stmt->setUInt32(2, GetLocaleByName(_localizationName));        stmt->setString(3, _login);        LoginDatabase.Execute(stmt);        OPENSSL_free((void*)K_hex);        // Finish SRP6 and send the final result to the client        sha.Initialize();        sha.UpdateBigNumbers(&A, &M, &K, NULL);        sha.Finalize();        if (_expversion & POST_BC_EXP_FLAG)                 // 2.x and 3.x clients        {            sAuthLogonProof_S proof;            memcpy(proof.M2, sha.GetDigest(), 20);            proof.cmd = AUTH_LOGON_PROOF;            proof.error = 0;            proof.unk1 = 0x00800000;            proof.unk2 = 0x00;            proof.unk3 = 0x00;            socket().send((char *)&proof, sizeof(proof));        }        else        {            sAuthLogonProof_S_Old proof;            memcpy(proof.M2, sha.GetDigest(), 20);            proof.cmd = AUTH_LOGON_PROOF;            proof.error = 0;            proof.unk2 = 0x00;            socket().send((char *)&proof, sizeof(proof));        }        _authed = true;
开发者ID:Atreyos,项目名称:FaceCore,代码行数:67,


示例4: socket

//.........这里部分代码省略.........    sha.Initialize();    sha.UpdateBigNumbers(&g, NULL);    sha.Finalize();    for (int i = 0; i < 20; ++i)        hash[i] ^= sha.GetDigest()[i];    BigNumber t3;    t3.SetBinary(hash, 20);    sha.Initialize();    sha.UpdateData(_login);    sha.Finalize();    uint8 t4[SHA_DIGEST_LENGTH];    memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH);    sha.Initialize();    sha.UpdateBigNumbers(&t3, NULL);    sha.UpdateData(t4, SHA_DIGEST_LENGTH);    sha.UpdateBigNumbers(&s, &A, &B, &K, NULL);    sha.Finalize();    BigNumber M;    M.SetBinary(sha.GetDigest(), 20);    // Check if SRP6 results match (password is correct), else send an error    if (!memcmp(M.AsByteArray(), lp.M1, 20))    {        sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());        // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account        // No SQL injection (escaped user name) and IP address as received by socket        const char *K_hex = K.AsHexStr();        LoginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', os = '%s', failed_logins = 0 WHERE username = '%s'", K_hex, socket().getRemoteAddress().c_str(), GetLocaleByName(_localizationName),        _os.c_str(), _login.c_str());        OPENSSL_free((void*)K_hex);        // Finish SRP6 and send the final result to the client        sha.Initialize();        sha.UpdateBigNumbers(&A, &M, &K, NULL);        sha.Finalize();        if ((_expversion & POST_BC_EXP_FLAG) || (_expversion & POST_WOTLK_EXP_FLAG))     // 2.x, 3.x, 4.x        {            sAuthLogonProof_S proof;            memcpy(proof.M2, sha.GetDigest(), 20);            proof.cmd = AUTH_LOGON_PROOF;            proof.error = 0;            proof.unk1 = 0x00800000;            proof.unk2 = 0x00;            proof.unk3 = 0x00;            socket().send((char *)&proof, sizeof(proof));        }        else        {            sAuthLogonProof_S_Old proof;            memcpy(proof.M2, sha.GetDigest(), 20);            proof.cmd = AUTH_LOGON_PROOF;            proof.error = 0;            proof.unk2 = 0x00;            socket().send((char *)&proof, sizeof(proof));        }        _authed = true;    }    else
开发者ID:Cryostorm,项目名称:TBCPvP,代码行数:67,


示例5: DEBUG_LOG

//.........这里部分代码省略.........                    }                    delete banresult;                }                else                {                    ///- Get the password from the account table, upper it, and make the SRP6 calculation                    std::string rI = (*qresult)[0].GetCppString();                    ///- Don't calculate (v, s) if there are already some in the database                    std::string databaseV = (*qresult)[5].GetCppString();                    std::string databaseS = (*qresult)[6].GetCppString();                    DEBUG_LOG("database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str());                    // multiply with 2, bytes are stored as hexstring                    if (databaseV.size() != s_BYTE_SIZE*2 || databaseS.size() != s_BYTE_SIZE*2)                        _SetVSFields(rI);                    else                    {                        s.SetHexStr(databaseS.c_str());                        v.SetHexStr(databaseV.c_str());                    }                    result = WOW_SUCCESS;                    uint8 secLevel = (*qresult)[4].GetUInt8();                    _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR;                    _localizationName.resize(4);                    for (int i = 0; i < 4; ++i)                        _localizationName[i] = ch->country[4-i-1];                    BASIC_LOG("[AuthChallenge] account %s (Id: %u) is using '%c%c%c%c' locale (%u)", _login.c_str (), accId, ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName));                }            }            delete qresult;        }        else if (sConfig.GetBoolDefault("AutoRegistration", false))        {            if (_safelogin.find_first_of("/t/v/b/f/a/n/r///"/'/? <>[](){}_=+-|/[email
C++ GetLocaleInfo函数代码示例
C++ GetLocalTime函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。