c++ Unhandled exception at 0x7949FF5C (ucrtbased.dll) in test.exe: 0xC0000005: Access violation reading location 0x006C6365

-2

I've created a test program to test the library I have created; and, after I link my library and test a function, it give me an error in get_name:

Unhandled exception at 0x7949FF5C (ucrtbased.dll) in test.exe: 0xC0000005: Access violation reading location 0x006C6365.

Here is my code:

template<class Ret, class... Args>
std::function<Ret(Args...)> SHN::Call(DWORD Address, std::string Convention)
{
    if (Convention == "__stdcall")
    {
        typedef Ret(__stdcall* Fn_t)(Args...);
        return (Fn_t)Address;
    }
    else if (Convention == "__cdecl")
    {
        typedef Ret(__cdecl* Fn_t)(Args...);
        return (Fn_t)Address;
    }
    else if (Convention == "__fastcall")
    {
        typedef Ret(__fastcall* Fn_t)(Args...);
        return (Fn_t)Address;
    }
    else if (Convention == "__thiscall")
    {
        typedef Ret(__thiscall* Fn_t)(Args...);
        return (Fn_t)Address;
    }
    else {
        return 0;
    }
}

bool SHN::Run(std::string Version)
{
       // if (Version == SHN::ReadWebsite("http://setup.roblox.com/version")) {
            std::string Reply = SHN::ReadWebsite("https://pastebin.com/raw/PW13MZjp");//readwebsite made with libcurl work perfectly
            if (Reply != "")
            {
                const auto rawJsonLength = static_cast<int>((Reply).length());
                JSONCPP_STRING err;
                Json::Value root;

                Json::CharReaderBuilder builder;
                const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
                if (reader->parse((Reply).c_str(), Reply.c_str() + rawJsonLength, &root,
                    &err)) {
                    JSON = root;
                    SHN::SetUp();
                    return true;
                }
                else {
                    MessageBoxA(NULL, "Invalid Reply-2452. Please contact a Support.\n\nError: SHNREPLYFAIL", "Shiny Library", MB_OK);
                    return false;
                }
            }
        /*}
        else {
            MessageBoxA(NULL, "Need to Update, Please contact a Support.\n\nError: SHNUPDATE", "Shiny Library", MB_OK);
            return false;
        }*/
}

bool SHN::CheckLiveJSON()
{
    if (JSON <= EXIT_FAILURE)
        return SHN::Run(SHN::GetVersion());
    return true;
}

void SHN::SetUp(){
if (SHN::CheckLiveJSON()){
  get_name = SHN::Call<std::uintptr_t, std::uintptr_t, std::int32_t>(aslr(base + JSON["addresses"]["lua_tostring"]["addr"].asInt()), JSON["addresses"]["lua_tostring"]["ccv"].asString().c_str());
    get_property = SHN::Call<std::uintptr_t, std::uintptr_t, std::uintptr_t>(aslr(base + JSON["addresses"]["rbx_get_property"]["addr"].asInt()), JSON["addresses"]["rbx_get_property"]["ccv"].asString().c_str());
}
}

In my header:

#include <json/json.h>
#include <functional>
#include <string>
#include <Windows.h>
#include <vector>
std::function<std::uintptr_t(std::uintptr_t, std::int32_t)> get_name;
std::function<std::uintptr_t(std::uintptr_t, std::uintptr_t)> get_property;
Json::Value JSON;

namespace SHN {
   template<class Ret, class... Args>
    std::function<Ret(Args...)> Call(DWORD Address, std::string Convention);
    bool Run(std::string version // ignore this);
    bool CheckLiveJson();
    void SetUp();
}
c++
libcurl
jsoncpp
asked on Stack Overflow Feb 24, 2021 by yFlameBR • edited Feb 24, 2021 by Adrian Mole

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0