Nlohmann json getting exception

  c++, json, libcurl

I’m using libcurl to download a json file and then I want to get the hwids of the json by using nlohmann json and there is where the exception happens and I can’t figure it out on my own.

I’m pretty new to c++ so please don’t bomb me away thanks.

Screenshot of the Exception

My application gets detected as Virus, I think it’s because of fopen, would be nice if someone could fix this.
Also I would really appreciate, if you could optimize my code thanks!

My Utils.cpp

#include <fcntl.h>
#include <io.h>
#include <filesystem>

#include "HWID.h"

#define PathAppendW
#define SHGetFolderPathW
#include "curl/curl.h";

namespace fs = std::filesystem;

static size_t write_data(void* ptr, size_t size, size_t nmemb, void* stream)
    size_t written = fwrite(ptr, size, nmemb, (FILE*)stream);
    return written;

void savefile(std::string path) {

    char c[MAX_PATH];

    strcpy(c, path.c_str());

    CURL* curl_handle;
    static const char* pagefilename = c;


    /* init the curl session */
    curl_handle = curl_easy_init();

    /* set URL to get here */
    curl_easy_setopt(curl_handle, CURLOPT_URL, "");

    /* Switch on full protocol/debug output while testing */
    curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);

    /* disable progress meter, set to 0L to enable it */
    curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L);

    /* send all data to this function  */
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);

    /* open the file */
    FILE* pagefile = fopen(pagefilename, "w");
    if (pagefile) {

        /* write the page body to this file handle */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, pagefile);

        /* get it! */

        /* close the header file */

    /* cleanup curl stuff */


int main()
    std::string appdata = getenv("APPDATA");
    const std::string dir = appdata + "AnixCSGO";

    std::string file = dir + "hwids.json";


    HWID hwid;
    if (hwid.isinList(file)) hwid.printHWID();


My HWID.cpp

#include "HWID.h"

void HWID::hwidList(std::string file) {

    std::ifstream reader(file);
    json j;
    reader >> j;

    for (int i = 0; i < j["csgo"].size(); i++) {

void HWID::getHWID() {
    TCHAR volumeName[MAX_PATH + 1] = {}; // catch info of harddrive
    TCHAR systemName[MAX_PATH + 1] = { 0 };
    DWORD maxlen = 0; // max length of hwid
    DWORD systemflags = 0; // user infos
    if (GetVolumeInformation(_T("C:"), volumeName, ARRAYSIZE(volumeName), &hwidnum, &maxlen, &systemflags, systemName, ARRAYSIZE(systemName)));

boolean HWID::isinList(std::string file) {


    if (find(hwids.begin(), hwids.end(), std::to_string(hwidnum)) != hwids.end()) { // check if hwid is on the list
        return true;
    return false;

void HWID::printHWID() {
    std::cout << "Your HWID: " << hwidnum << "n";

Source: Windows Questions C++