Пример #1
0
HRESULT XPCDispObject::COMCreateInstance(XPCCallContext & ccx, BSTR className,
                                         PRBool enforceSecurity,
                                         IDispatch ** result)
{
    NS_ENSURE_ARG_POINTER(result);
    // Turn the string into a CLSID
    _bstr_t bstrName(className);
    CLSID classID = CLSID_NULL;
    HRESULT hr = CLSIDFromString(bstrName, &classID);
    if(FAILED(hr))
        hr = CLSIDFromProgID(bstrName, &classID);
    if(FAILED(hr) || ::IsEqualCLSID(classID, CLSID_NULL))
        return hr;
    
    // If the caller cares about security do the necessary checks
    // This results in the object being instantiated, so we'll use
    // it
    if(enforceSecurity)
        return SecurityCheck(ccx, classID, result);
    
    CComPtr<IDispatch> disp;
#ifdef JAXER
	hr = disp.CoCreateInstance(classID, NULL, CLSCTX_SERVER);
#else
    hr = disp.CoCreateInstance(classID);
#endif /* JAXER */
    if(FAILED(hr))
        return hr;

    disp.CopyTo(result);

    return S_OK;
}
Пример #2
0
int CChatHandler::OnRequestChat()
{
    int iRet = SecurityCheck();
    if(iRet < 0)
    {
        LOGERROR("Security Check Failed: Uin = %u, iRet = %d\n", m_pRequestMsg->m_stmsghead().m_uin(), iRet);
        
        SendFailedResponse(MSGID_ZONE_CHAT_RESPONSE, T_ZONE_SECURITY_CHECK_FAILED, *m_pNetHead);

        return -1;
    }

    unsigned int uiUin = m_pRoleObj->GetUin();
    CGameRoleObj* pstRoleObj = GameTypeK32<CGameRoleObj>::GetByKey(uiUin);
    ASSERT_AND_LOG_RTN_INT(pstRoleObj);

    //玩家聊天操作的处理
    const Zone_Chat_Request& rstRequest = m_pRequestMsg->m_stmsgbody().m_stzone_chat_request();
    CChatUtility::SendChatMsg(*pstRoleObj, rstRequest.ichannel(), rstRequest.strmessage().c_str());

    //处理聊天消息成功,返回
    SendSuccessfulResponse();

    return T_SERVER_SUCESS;
}
Пример #3
0
int CLoginHandler::OnRequestLoginServer()
{
    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    int iRet = SecurityCheck();
    if (iRet < 0)
    {
        LOGERROR("Security Check Failed: Uin = %u, iRet = %d\n", m_pRequestMsg->m_stmsghead().m_uin(), iRet);

        LoginFailed(*m_pNetHead);
        return -1;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    const Zone_LoginServer_Request& rstRequest = m_pRequestMsg->m_stmsgbody().m_stzone_loginserver_request();
    iRet = LoginRole(rstRequest.stroleid(), m_pNetHead, rstRequest);
    if (iRet < 0)
    {
        CHandlerHelper::SetErrorCode(T_ZONE_LOGINSERVER_FAILED);
        LoginFailed(*m_pNetHead);
    }

    return iRet;	
}