SteamPP icon indicating copy to clipboard operation
SteamPP copied to clipboard

Handling/Decompressing Multi messages

Open VuYeK opened this issue 6 years ago • 1 comments

Hi, I used SteamPP in my project and it generally works good but I have problem with Multi messages from Steam, (EMsg::Multi from protobuf). I cannot unzip them correctly. I can't understand what I'm doing wrong.

std::string unzip(std::string &input) {
auto archive = archive_read_new();

auto result = archive_read_support_filter_all(archive);
assert(result == ARCHIVE_OK);

result = archive_read_support_format_zip(archive);
assert(result == ARCHIVE_OK);

result = archive_read_open_memory(archive, &input[0], input.size());
assert(result == ARCHIVE_OK);

archive_entry* entry;
result = archive_read_next_header(archive, &entry);
if (result != ARCHIVE_OK) {
    return "read next header error " + std::to_string(result);
}
assert(result == ARCHIVE_OK);

std::string output;
output.resize(archive_entry_size(entry));

auto length = archive_read_data(archive, &output[0], output.size());
assert(length == output.size());
if (length != output.size()) {
    return "hello world" + std::to_string(length);
}

assert(archive_read_next_header(archive, &entry) == ARCHIVE_EOF);

result = archive_read_free(archive);
assert(result == ARCHIVE_OK);

return output;
}

in this function (libarchive) archive_read_data returns -25 which is an error code and next assert throws error. What is wrong? It's working well in C# SteamKit version and also in node.js version. I have tried also Crypto++ Gunzip but it throws an CryptoPP::Gunzip::HeaderErr exception. DEBUG GIF

VuYeK avatar Mar 29 '18 19:03 VuYeK

I had the same problem

zxcvbnmkl112 avatar Mar 01 '23 03:03 zxcvbnmkl112