Вопрос Как получить данные сообщения GCClient-а?

Начинающий
Статус
Оффлайн
Регистрация
8 Ноя 2023
Сообщения
4
Реакции[?]
0
Поинты[?]
0
Подскажите как получить данные прото сообщения? в частности CMsgDOTAClaimEventAction
нашел этот тред, но там через IDA с которым я почти незнаком, да и такое ощущение будто это "по воробьям из пушки". Мне ведь только event_id и action_id из этого типа сообщения надо вытащить(один раз)
 
Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
774
Реакции[?]
330
Поинты[?]
62K
интерфейс DOTA_CLIENT_GCCLIENT в клиент длл, там на 0x18 лежит ISteamGameCoordinator
C++:
//====== Copyright ©, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to the game coordinator for this application
//
//=============================================================================

#ifndef ISTEAMGAMECOORDINATOR
#define ISTEAMGAMECOORDINATOR
#ifdef _WIN32
#pragma once
#endif

#include "steam_api_common.h"


// list of possible return values from the ISteamGameCoordinator API
enum EGCResults
{
    k_EGCResultOK = 0,
    k_EGCResultNoMessage = 1,            // There is no message in the queue
    k_EGCResultBufferTooSmall = 2,        // The buffer is too small for the requested message
    k_EGCResultNotLoggedOn = 3,            // The client is not logged onto Steam
    k_EGCResultInvalidMessage = 4,        // Something was wrong with the message being sent with SendMessage
};


//-----------------------------------------------------------------------------
// Purpose: Functions for sending and receiving messages from the Game Coordinator
//            for this application
//-----------------------------------------------------------------------------
class ISteamGameCoordinator
{
public:

    // sends a message to the Game Coordinator
    virtual EGCResults SendMessage( uint32 unMsgType, const void *pubData, uint32 cubData ) = 0;

    // returns true if there is a message waiting from the game coordinator
    virtual bool IsMessageAvailable( uint32 *pcubMsgSize ) = 0;

    // fills the provided buffer with the first message in the queue and returns k_EGCResultOK or
    // returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size.
    // If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned
    // and the message remains at the head of the queue.
    virtual EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;

};
#define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001"

// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif

// callback notification - A new message is available for reading from the message queue
struct GCMessageAvailable_t
{
    enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 };
    uint32 m_nMessageSize;
};

// callback notification - A message failed to make it to the GC. It may be down temporarily
struct GCMessageFailed_t
{
    enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 };
};

#pragma pack( pop )

#endif // ISTEAMGAMECOORDINATOR
хукни там сенд.
там мсгтайп это айди в енумке типов сообщений и мсб(most significant bit) стоит(уберешь его нахуй &~ (1<<31))
pubData это ProtoBufMsgHeader_t(загуглишь/на этом форуме поищи), cubData это полный размер всего сообщения с заголовком
 
Пользователь
Статус
Оффлайн
Регистрация
8 Апр 2022
Сообщения
656
Реакции[?]
102
Поинты[?]
65K
Пожалуйста, авторизуйтесь для просмотра ссылки.
Basyncsendproto там уже распаршенное сообщение есть
А если тебе нужно читать полученное от сервака сообщение, то тебе нужно его вручную распарсить (
Пожалуйста, авторизуйтесь для просмотра ссылки.
)
 
Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
774
Реакции[?]
330
Поинты[?]
62K
Пожалуйста, авторизуйтесь для просмотра ссылки.
Basyncsendproto там уже распаршенное сообщение есть
А если тебе нужно читать полученное от сервака сообщение, то тебе нужно его вручную распарсить (
Пожалуйста, авторизуйтесь для просмотра ссылки.
)
если это твой код, то
Пожалуйста, авторизуйтесь для просмотра ссылки.
C++:
    auto body_data = (void*)( ( (std::uintptr_t)pubDest ) + 8 );
    auto body_size = *pcubMsgSize - 8;
там не так просто это работает. +8 это только если m_cubProtoBufExtHdr равен нулю. в противном случае там +8 + m_cubProtoBufExtHdr. и размер тоже соответственно - 8 - m_cubProtoBufExtHdr
C++:
struct ProtoBufMsgHeader_t
{
    std::uint32_t            m_EMsgFlagged;            // High bit should be set to indicate this message header type is in use.  The rest of the bits indicate message type.
    std::uint32_t            m_cubProtoBufExtHdr;    // Size of the extended header which is a serialized protobuf object.  Indicates where it ends and the serialized body protobuf begins.

    MsgType_t GetEMsg() const noexcept
    {
        return static_cast<MsgType_t>(m_EMsgFlagged & (~k_EMsgProtoBufFlag));//clear MSB
    }
    void* GetHeaderStart() const noexcept
    {
        return reinterpret_cast<void*>
            (reinterpret_cast<std::uintptr_t>(this) + sizeof(ProtoBufMsgHeader_t));
    }
    auto HasHeader() const noexcept
    {
        return m_cubProtoBufExtHdr != 0;
    }
    auto GetHeader() const
    {
        CMsgProtoBufHeader header;
        ParseMessageFromArray(header, GetHeaderStart(), m_cubProtoBufExtHdr);
        return header;
    }
    void* GetMessageStart() const  noexcept
    {
        return reinterpret_cast<void*>
            (reinterpret_cast<std::uintptr_t>(this) + sizeof(ProtoBufMsgHeader_t) + m_cubProtoBufExtHdr);
    }
    std::uint32_t GetMessageLength(std::uint32_t TotalBufferSize) const noexcept
    {
        return TotalBufferSize - sizeof(ProtoBufMsgHeader_t) - m_cubProtoBufExtHdr;
    }

    template<typename T>
    T GetMessageBody(std::uint32_t buffer_size) const
    {
        T message;
        ParseMessageFromArray(message, GetMessageStart(), GetMessageLength(buffer_size));
        return message;
    }
};
 
Пользователь
Статус
Оффлайн
Регистрация
8 Апр 2022
Сообщения
656
Реакции[?]
102
Поинты[?]
65K
если это твой код, то
Пожалуйста, авторизуйтесь для просмотра ссылки.
C++:
    auto body_data = (void*)( ( (std::uintptr_t)pubDest ) + 8 );
    auto body_size = *pcubMsgSize - 8;
там не так просто это работает. +8 это только если m_cubProtoBufExtHdr равен нулю. в противном случае там +8 + m_cubProtoBufExtHdr. и размер тоже соответственно - 8 - m_cubProtoBufExtHdr
C++:
struct ProtoBufMsgHeader_t
{
    std::uint32_t            m_EMsgFlagged;            // High bit should be set to indicate this message header type is in use.  The rest of the bits indicate message type.
    std::uint32_t            m_cubProtoBufExtHdr;    // Size of the extended header which is a serialized protobuf object.  Indicates where it ends and the serialized body protobuf begins.

    MsgType_t GetEMsg() const noexcept
    {
        return static_cast<MsgType_t>(m_EMsgFlagged & (~k_EMsgProtoBufFlag));//clear MSB
    }
    void* GetHeaderStart() const noexcept
    {
        return reinterpret_cast<void*>
            (reinterpret_cast<std::uintptr_t>(this) + sizeof(ProtoBufMsgHeader_t));
    }
    auto HasHeader() const noexcept
    {
        return m_cubProtoBufExtHdr != 0;
    }
    auto GetHeader() const
    {
        CMsgProtoBufHeader header;
        ParseMessageFromArray(header, GetHeaderStart(), m_cubProtoBufExtHdr);
        return header;
    }
    void* GetMessageStart() const  noexcept
    {
        return reinterpret_cast<void*>
            (reinterpret_cast<std::uintptr_t>(this) + sizeof(ProtoBufMsgHeader_t) + m_cubProtoBufExtHdr);
    }
    std::uint32_t GetMessageLength(std::uint32_t TotalBufferSize) const noexcept
    {
        return TotalBufferSize - sizeof(ProtoBufMsgHeader_t) - m_cubProtoBufExtHdr;
    }

    template<typename T>
    T GetMessageBody(std::uint32_t buffer_size) const
    {
        T message;
        ParseMessageFromArray(message, GetMessageStart(), GetMessageLength(buffer_size));
        return message;
    }
};
да это мой код я давно очень делал, нихуя не получалось я считай на рандом там подбирал)))
 
Сверху Снизу