我已经在互联网上搜索了很长一段时间,以找到解决我的问题的方法,但没有一个能奏效。因此,如果您能提供帮助,我将非常感谢!
我已经编译了jsoncpp.lib和libcurl.lib并将其包含在链接器设置下的C ++项目中,并确保将它们放置在包含的目录中,我还将在2中包括curl.h和json.h头文件各自的子目录,以及项目所需的所有头文件。每次构建项目时,从这些库中对函数的引用中都会得到16个未解析的外部符号。
这是我的预编译头文件:
#pragma once
#include <xtl.h>
#include <xboxmath.h>
#include <curl\curl.h>
#include <json\json.h>
#include "kernel.h"
#include "tools.h"
#include "detour.h"
#include "net.h"
#include "auth.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdint>
#include <memory>
#include <string>
#define memecpy memcpy
#define memecmp memcmp
#pragma comment(lib, "jsoncpp")
#pragma comment(lib, "libcurl")
这是我的auth.cpp
Response_Buffer userData;
namespace
{
std::size_t callback(
const char* in,
std::size_t size,
std::size_t num,
std::string* out)
{
const std::size_t totalBytes(size * num);
out->append(in, totalBytes);
return totalBytes;
}
}
BOOL MenuEnabled = FALSE;
char* GetCpuKey(char* cpureq) {
BYTE step1[16];
BYTE step2[16];
BYTE step3[16];
ZeroMemory(step1, 16);
ZeroMemory(step2, 16);
ZeroMemory(step3, 16);
HRESULT success = HV::Peek::HvPeekBytes(0x20, step1, 0x10);
if(success != ERROR_SUCCESS)
return NULL;
BYTE part1[8];
memecpy(part1, (BYTE*)HV::HvGetFuseLine(3), 8);
BYTE part2[8];
memecpy(part2, (BYTE*)HV::HvGetFuseLine(5), 8);
memecpy(step2, part1, 8);
memecpy(step2 + 8, part2, 8);
if(memcmp(step1, step2, 16) != 0)
return NULL;
BYTE part3[8];
memecpy(part3, (BYTE*)HV::HvGetFuseLine(4), 8);
BYTE part4[8];
memecpy(part4, (BYTE*)HV::HvGetFuseLine(6), 8);
memecpy(step3, part3, 8);
memcpy(step3 + 8, part4, 8);
if(memcmp(step1, step3, 16) != 0)
return NULL;
if(memcmp(step2, step3, 16) != 0)
return NULL;
memecpy((void*)cpureq, step3, 16);
if(memecmp((void*)cpureq, step1, 16) != 0)
return NULL;
std::string out = "";
for (int i = 0; i < 0x10; i++, ++cpureq) {
char tmp[5] = { 0 };
sprintf(tmp, "%02X", (unsigned char)*cpureq);
out += tmp;
}
return _strdup(out.c_str());
}
BOOL Authenticate()
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl){
curl_easy_setopt(curl, CURLOPT_URL, "http://xbonline.live/annoyance.php");
char* post;
sprintf(post, "cpukey=%s", GetCpuKey(NULL));
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
int httpCode;
std::unique_ptr<std::string> httpData(new std::string());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
if (httpCode == 200){
Json::Value jsonData;
Json::Reader jsonReader;
if(jsonReader.parse(*httpData, jsonData)){
memecpy(userData.name, jsonData["username"].asCString(), jsonData["username"].asString().length());
memecpy((VOID*)userData.days, (VOID*)(jsonData["lifetime"].asBool() ? 999 : jsonData["days"].asInt()), sizeof((jsonData["lifetime"].asBool() ? 999 : jsonData["days"].asInt())));
memecpy((VOID*)userData.status, (VOID*)jsonData["status"].asInt(), sizeof((VOID*)jsonData["status"].asInt()));
memecpy((VOID*)userData.status, (VOID*)jsonData["status"].asInt(), sizeof((VOID*)jsonData["status"].asInt()));
memecpy((VOID*)userData.banned, (VOID*)((jsonData["days"].asInt() == -1) ? TRUE : FALSE), sizeof(BOOL));
curl_global_cleanup();
return true;
}
curl_global_cleanup();
return false;
}
curl_global_cleanup();
}
}
VOID HookAuthLoop() {
for(;;){
if(Authenticate()) MenuEnabled = TRUE;
else MenuEnabled = FALSE;
}
}