mirror of
https://github.com/Milxnor/Cobalt.git
synced 2026-01-13 02:22:22 +01:00
change curl detour
This commit is contained in:
@@ -145,10 +145,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="curlhook.h" />
|
||||
<ClInclude Include="curldefinitions.h" />
|
||||
<ClInclude Include="exithook.h" />
|
||||
<ClInclude Include="memcury.h" />
|
||||
<ClInclude Include="settings.h" />
|
||||
<ClInclude Include="url.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="curldefinitions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curlhook.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -35,6 +32,9 @@
|
||||
<ClInclude Include="settings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="url.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
//got these definitions from reversing curl
|
||||
#define CURLOPT_URL 0x2712
|
||||
#define CURLOPT_NOPROXY 0x27C1
|
||||
#define CURLOPT_SSL_VERIFYPEER 0x40
|
||||
#define CURLOPT_SSL_VERIFYHOST 0x51
|
||||
#define CURLOPT_PINNEDPUBLICKEY 0x27F6
|
||||
#define CURLOPT_POSTFIELDS 0x271F
|
||||
|
||||
//got from curl includes
|
||||
typedef enum {
|
||||
CURLE_OK = 0,
|
||||
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
|
||||
CURLE_FAILED_INIT, /* 2 */
|
||||
CURLE_URL_MALFORMAT, /* 3 */
|
||||
CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
|
||||
7.17.0, reused in April 2011 for 7.21.5] */
|
||||
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
|
||||
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
|
||||
CURLE_COULDNT_CONNECT, /* 7 */
|
||||
CURLE_WEIRD_SERVER_REPLY, /* 8 */
|
||||
CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
|
||||
due to lack of access - when login fails
|
||||
this is not returned. */
|
||||
CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
|
||||
7.15.4, reused in Dec 2011 for 7.24.0]*/
|
||||
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
|
||||
CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
|
||||
[was obsoleted in August 2007 for 7.17.0,
|
||||
reused in Dec 2011 for 7.24.0]*/
|
||||
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
|
||||
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
|
||||
CURLE_FTP_CANT_GET_HOST, /* 15 */
|
||||
CURLE_HTTP2, /* 16 - A problem in the http2 framing layer.
|
||||
[was obsoleted in August 2007 for 7.17.0,
|
||||
reused in July 2014 for 7.38.0] */
|
||||
CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
|
||||
CURLE_PARTIAL_FILE, /* 18 */
|
||||
CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
|
||||
CURLE_OBSOLETE20, /* 20 - NOT USED */
|
||||
CURLE_QUOTE_ERROR, /* 21 - quote command failure */
|
||||
CURLE_HTTP_RETURNED_ERROR, /* 22 */
|
||||
CURLE_WRITE_ERROR, /* 23 */
|
||||
CURLE_OBSOLETE24, /* 24 - NOT USED */
|
||||
CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
|
||||
CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
|
||||
CURLE_OUT_OF_MEMORY, /* 27 */
|
||||
/* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
|
||||
instead of a memory allocation error if CURL_DOES_CONVERSIONS
|
||||
is defined
|
||||
*/
|
||||
CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
|
||||
CURLE_OBSOLETE29, /* 29 - NOT USED */
|
||||
CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
|
||||
CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
|
||||
CURLE_OBSOLETE32, /* 32 - NOT USED */
|
||||
CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
|
||||
CURLE_HTTP_POST_ERROR, /* 34 */
|
||||
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
|
||||
CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
|
||||
CURLE_FILE_COULDNT_READ_FILE, /* 37 */
|
||||
CURLE_LDAP_CANNOT_BIND, /* 38 */
|
||||
CURLE_LDAP_SEARCH_FAILED, /* 39 */
|
||||
CURLE_OBSOLETE40, /* 40 - NOT USED */
|
||||
CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */
|
||||
CURLE_ABORTED_BY_CALLBACK, /* 42 */
|
||||
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
|
||||
CURLE_OBSOLETE44, /* 44 - NOT USED */
|
||||
CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
|
||||
CURLE_OBSOLETE46, /* 46 - NOT USED */
|
||||
CURLE_TOO_MANY_REDIRECTS, /* 47 - catch endless re-direct loops */
|
||||
CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
|
||||
CURLE_TELNET_OPTION_SYNTAX, /* 49 - Malformed telnet option */
|
||||
CURLE_OBSOLETE50, /* 50 - NOT USED */
|
||||
CURLE_OBSOLETE51, /* 51 - NOT USED */
|
||||
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
|
||||
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
|
||||
CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
|
||||
default */
|
||||
CURLE_SEND_ERROR, /* 55 - failed sending network data */
|
||||
CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
|
||||
CURLE_OBSOLETE57, /* 57 - NOT IN USE */
|
||||
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
|
||||
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
|
||||
CURLE_PEER_FAILED_VERIFICATION, /* 60 - peer's certificate or fingerprint
|
||||
wasn't verified fine */
|
||||
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
|
||||
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
|
||||
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
|
||||
CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
|
||||
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
|
||||
that failed */
|
||||
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
|
||||
CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
|
||||
accepted and we failed to login */
|
||||
CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
|
||||
CURLE_TFTP_PERM, /* 69 - permission problem on server */
|
||||
CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
|
||||
CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
|
||||
CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
|
||||
CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
|
||||
CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
|
||||
CURLE_CONV_FAILED, /* 75 - conversion failed */
|
||||
CURLE_CONV_REQD, /* 76 - caller must register conversion
|
||||
callbacks using curl_easy_setopt options
|
||||
CURLOPT_CONV_FROM_NETWORK_FUNCTION,
|
||||
CURLOPT_CONV_TO_NETWORK_FUNCTION, and
|
||||
CURLOPT_CONV_FROM_UTF8_FUNCTION */
|
||||
CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
|
||||
or wrong format */
|
||||
CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
|
||||
CURLE_SSH, /* 79 - error from the SSH layer, somewhat
|
||||
generic so the error message will be of
|
||||
interest when this has happened */
|
||||
|
||||
CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
|
||||
connection */
|
||||
CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
|
||||
wait till it's ready and try again (Added
|
||||
in 7.18.2) */
|
||||
CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
|
||||
wrong format (Added in 7.19.0) */
|
||||
CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
|
||||
7.19.0) */
|
||||
CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
|
||||
CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
|
||||
CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
|
||||
CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
|
||||
CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
|
||||
CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
|
||||
session will be queued */
|
||||
CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not
|
||||
match */
|
||||
CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */
|
||||
CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer
|
||||
*/
|
||||
CURLE_RECURSIVE_API_CALL, /* 93 - an api function was called from
|
||||
inside a callback */
|
||||
CURLE_AUTH_ERROR, /* 94 - an authentication function returned an
|
||||
error */
|
||||
CURLE_HTTP3, /* 95 - An HTTP/3 layer problem */
|
||||
CURL_LAST /* never use! */
|
||||
} CURLcode;
|
||||
|
||||
typedef void CURL;
|
||||
@@ -3,71 +3,81 @@
|
||||
#include <Windows.h>
|
||||
#include <regex>
|
||||
|
||||
#include "curldefinitions.h"
|
||||
#include "memcury.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "../vendor/cURL/curl.h"
|
||||
#include "url.h"
|
||||
|
||||
// #define HYBRID_ENABLED
|
||||
|
||||
auto (*curl_easy_setopt_original)(CURL* Curl, uintptr_t opt, ...)->CURLcode;
|
||||
inline CURLcode(*CurlSetOpt)(struct Curl_easy*, CURLoption, va_list) = nullptr;
|
||||
inline CURLcode(*CurlEasySetOpt)(struct Curl_easy*, CURLoption, ...) = nullptr;
|
||||
|
||||
//This routine is used for setting up curl. we will be hijacking this to change the values.
|
||||
auto Hijacked_curl_easy_setopt(CURL* Curl, uintptr_t opt, va_list info) -> CURLcode
|
||||
inline CURLcode CurlSetOpt_(struct Curl_easy* data, CURLoption option, ...)
|
||||
{
|
||||
int OFF = 0;
|
||||
switch (opt)
|
||||
{
|
||||
case CURLOPT_NOPROXY:
|
||||
return curl_easy_setopt_original(Curl, opt, "");
|
||||
break;
|
||||
va_list arg;
|
||||
va_start(arg, option);
|
||||
|
||||
case CURLOPT_SSL_VERIFYPEER:
|
||||
return curl_easy_setopt_original(Curl, opt, OFF);
|
||||
break;
|
||||
case CURLOPT_SSL_VERIFYHOST:
|
||||
return curl_easy_setopt_original(Curl, opt, OFF);
|
||||
break;
|
||||
case CURLOPT_PINNEDPUBLICKEY:
|
||||
return CURLcode::CURLE_OK;
|
||||
break;
|
||||
case CURLOPT_URL:
|
||||
std::string url = info;
|
||||
std::regex Host(("(.*).ol.epicgames.com"));
|
||||
#ifdef HYBRID_ENABLED
|
||||
if (std::regex_search(info, std::regex(("/fortnite/api/cloudstorage/system")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
else if (std::regex_search(info, std::regex(("/fortnite/api/v2/versioncheck/")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
else if (std::regex_search(info, std::regex(("/fortnite/api/game/v2/profile")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
else if (std::regex_search(info, std::regex(("/content/api/pages/fortnite-game")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
else if (std::regex_search(info, std::regex(("/affiliate/api/public/affiliates/slug")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
else if (std::regex_search(info, std::regex(("/socialban/api/public/v1")))) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
/* else if (std::regex_search(info, std::regex(ENC("player.platform")))) { // idk if this even works
|
||||
if (version == S13)
|
||||
{
|
||||
url = std::regex_replace(info, Host, "IOS");
|
||||
Log(ENC("Changed Windows to IOS"));
|
||||
}
|
||||
} */
|
||||
#else
|
||||
if (std::regex_search(info, Host)) {
|
||||
url = std::regex_replace(info, Host, REDIRECT_TO_HOST);
|
||||
}
|
||||
#endif
|
||||
return curl_easy_setopt_original(Curl, opt, url.c_str());
|
||||
break;
|
||||
}
|
||||
return curl_easy_setopt_original(Curl, opt, info);
|
||||
const auto result = CurlSetOpt(data, option, arg);
|
||||
|
||||
va_end(arg);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define XOR
|
||||
|
||||
inline CURLcode CurlEasySetOptDetour(struct Curl_easy* data, CURLoption tag, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, tag);
|
||||
|
||||
CURLcode result = {};
|
||||
|
||||
if (!data) return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
//Ssl bypass
|
||||
if (tag == CURLOPT_SSL_VERIFYPEER)
|
||||
{
|
||||
result = CurlSetOpt_(data, tag, 0);
|
||||
}
|
||||
|
||||
//Disable Proxy
|
||||
if (tag == CURLOPT_PROXY)
|
||||
{
|
||||
result = CurlSetOpt_(data, tag, "");
|
||||
}
|
||||
|
||||
//URL redirection
|
||||
else if (tag == CURLOPT_URL)
|
||||
{
|
||||
std::string url = va_arg(arg, char*);
|
||||
|
||||
Uri uri = Uri::Parse(url);
|
||||
|
||||
#ifdef URL_HOST
|
||||
|
||||
if (uri.Host.ends_with(XOR("ol.epicgames.com"))
|
||||
|| uri.Host.ends_with(XOR(".akamaized.net"))
|
||||
|| uri.Host.ends_with(XOR("on.epicgames.com"))
|
||||
|| uri.Host.ends_with(XOR("game-social.epicgames.com"))
|
||||
|| uri.Host.contains(XOR("superawesome.com")))
|
||||
{
|
||||
url = Uri::CreateUri(URL_PROTOCOL, URL_HOST, URL_PORT, uri.Path, uri.QueryString);
|
||||
}
|
||||
|
||||
#endif
|
||||
result = CurlSetOpt_(data, tag, url.c_str());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
result = CurlSetOpt(data, tag, arg);
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
__int64 sigscan(const std::string& Str) { return Memcury::Scanner::FindPattern(Str.c_str()).Get(); }
|
||||
@@ -20,8 +20,14 @@ bool InitializeCurlHook()
|
||||
auto CurlEasySetOptAddr = sigscan("89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 48 83 EC 28 48 85 C9 75 08 8D 41 2B 48 83 C4 28 C3 4C");
|
||||
|
||||
if (!CurlEasySetOptAddr)
|
||||
{
|
||||
std::cout << "Fallback!\n";
|
||||
|
||||
while (!CurlEasySetOptAddr)
|
||||
{
|
||||
CurlEasySetOptAddr = sigscan("89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 48 83 EC 28 48 85 C9 75 08 8D 41 2B 48 83 C4 28 C3 4C");
|
||||
Sleep(200);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CurlEasySetOptAddr)
|
||||
@@ -30,15 +36,30 @@ bool InitializeCurlHook()
|
||||
return false;
|
||||
}
|
||||
|
||||
curl_easy_setopt_original = decltype(curl_easy_setopt_original)(CurlEasySetOptAddr);
|
||||
auto CurlSetOptAddr = sigscan("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 30 33 ED 49 8B F0 48 8B D9");
|
||||
|
||||
if (!CurlSetOptAddr)
|
||||
{
|
||||
CurlSetOptAddr = sigscan("48 89 5C 24 08 48 89 6C 24 10 56 57 41 56 48 83 EC 50 33 ED 49 8B F0 8B DA 48 8B F9");
|
||||
}
|
||||
|
||||
if (!CurlSetOptAddr)
|
||||
{
|
||||
std::cout << "Failed to find CurlSetOptAddr! But we will go ahead..\n";
|
||||
}
|
||||
|
||||
CurlEasySetOpt = decltype(CurlEasySetOpt)(CurlEasySetOptAddr);
|
||||
CurlSetOpt = decltype(CurlSetOpt)(CurlSetOptAddr);
|
||||
|
||||
if (FindPushWidget())
|
||||
{
|
||||
DetoursEasy(curl_easy_setopt_original, Hijacked_curl_easy_setopt);
|
||||
DetoursEasy(CurlEasySetOpt, CurlEasySetOptDetour);
|
||||
}
|
||||
else
|
||||
{
|
||||
Memcury::VEHHook::AddHook(curl_easy_setopt_original, Hijacked_curl_easy_setopt); // TODO find a better way to "bypass" UAC.
|
||||
// TODO find a better way to "bypass" UAC (aka switch off VEH hooks)
|
||||
|
||||
Memcury::VEHHook::AddHook(CurlEasySetOpt, CurlEasySetOptDetour);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -74,6 +95,8 @@ DWORD WINAPI Main(LPVOID)
|
||||
FILE* fptr;
|
||||
freopen_s(&fptr, "CONOUT$", "w+", stdout);
|
||||
|
||||
Memcury::VEHHook::Init();
|
||||
|
||||
bool curlResult = InitializeCurlHook();
|
||||
InitializeExitHook();
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define REDIRECT_TO_HOST "127.0.0.1:3551"
|
||||
#define URL_PROTOCOL XOR("http")
|
||||
#define URL_HOST XOR("127.0.0.1")
|
||||
#define URL_PORT XOR("3551")
|
||||
91
Cobalt/url.h
Normal file
91
Cobalt/url.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
|
||||
struct Uri
|
||||
{
|
||||
private:
|
||||
typedef std::string_view::const_iterator iterator_t;
|
||||
|
||||
public:
|
||||
std::string_view Protocol, Host, Port, Path, QueryString;
|
||||
|
||||
static Uri Parse(const std::string_view& uri)
|
||||
{
|
||||
Uri result;
|
||||
|
||||
if (uri.length() == 0) return result;
|
||||
|
||||
iterator_t uriEnd = uri.end();
|
||||
|
||||
iterator_t queryStart = std::find(uri.begin(), uriEnd, '?');
|
||||
|
||||
iterator_t protocolStart = uri.begin();
|
||||
iterator_t protocolEnd = std::find(protocolStart, uriEnd, ':');
|
||||
|
||||
if (protocolEnd != uriEnd)
|
||||
{
|
||||
std::string_view prot = &*(protocolEnd);
|
||||
if ((prot.length() > 3) && (prot.substr(0, 3) == "://"))
|
||||
{
|
||||
result.Protocol = make_string_view(uri, protocolStart, protocolEnd);
|
||||
protocolEnd += 3;
|
||||
}
|
||||
else protocolEnd = uri.begin();
|
||||
}
|
||||
else protocolEnd = uri.begin();
|
||||
|
||||
iterator_t hostStart = protocolEnd;
|
||||
iterator_t pathStart = std::find(hostStart, uriEnd, '/');
|
||||
|
||||
iterator_t hostEnd = std::find(protocolEnd, (pathStart != uriEnd) ? pathStart : queryStart, ':');
|
||||
|
||||
result.Host = make_string_view(uri, hostStart, hostEnd);
|
||||
|
||||
if ((hostEnd != uriEnd) && ((&*(hostEnd))[0] == ':'))
|
||||
{
|
||||
++hostEnd;
|
||||
iterator_t portEnd = (pathStart != uriEnd) ? pathStart : queryStart;
|
||||
result.Port = make_string_view(uri, hostEnd, portEnd);
|
||||
}
|
||||
|
||||
if (pathStart != uriEnd) result.Path = make_string_view(uri, pathStart, queryStart);
|
||||
|
||||
if (queryStart != uriEnd) result.QueryString = make_string_view(uri, queryStart, uri.end());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::string CreateUri(std::string_view Protocol, std::string_view Host, std::string_view Port, std::string_view Path, std::string_view QueryString)
|
||||
{
|
||||
std::ostringstream str;
|
||||
if (!Protocol.empty())
|
||||
{
|
||||
str.write(Protocol.data(), Protocol.size());
|
||||
str.write("://", 3);
|
||||
}
|
||||
str.write(Host.data(), Host.size());
|
||||
if (!Port.empty())
|
||||
{
|
||||
str.write(":", 1);
|
||||
str.write(Port.data(), Port.size());
|
||||
}
|
||||
if (!Path.empty())
|
||||
{
|
||||
str.write(Path.data(), Path.size());
|
||||
}
|
||||
if (!QueryString.empty())
|
||||
{
|
||||
str.write(QueryString.data(), QueryString.size());
|
||||
}
|
||||
return str.str();
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr std::string_view make_string_view(const std::string_view& base, iterator_t first, iterator_t last)
|
||||
{
|
||||
return base.substr(std::distance(base.begin(), first), std::distance(first, last));
|
||||
}
|
||||
};
|
||||
@@ -4,5 +4,4 @@ SSL Bypass for Fortnite.
|
||||
# Credits
|
||||
|
||||
Memcury - https://github.com/kem0x/Memcury<br>
|
||||
CSM (Curl Server Manipulation) for the base cURL hook - https://github.com/ALEHACKsp/Curl-Server-Manipulation<br>
|
||||
Neonite++ for the signatures - https://github.com/PeQuLeaks/NeonitePP-Fixed/tree/1.4<br>
|
||||
Neonite++ for the signatures and curl hook - https://github.com/PeQuLeaks/NeonitePP-Fixed/tree/1.4<br>
|
||||
|
||||
2791
vendor/cURL/curl.h
vendored
Normal file
2791
vendor/cURL/curl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
118
vendor/cURL/curlhooks.h
vendored
Normal file
118
vendor/cURL/curlhooks.h
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
#pragma once
|
||||
#include "curl.h"
|
||||
#include "url.h"
|
||||
|
||||
#define URL_PROTOCOL XOR("http")
|
||||
#define URL_HOST XOR("127.0.0.1")
|
||||
// #define URL_PORT XOR("80")
|
||||
#define URL_PORT XOR("3551")
|
||||
|
||||
/*
|
||||
#define URL_HOST XOR("scuffedeggs.cf")
|
||||
#define URL_PORT XOR("80")
|
||||
|
||||
*/
|
||||
|
||||
//NPP port = 5746
|
||||
//NV2 port = 5595
|
||||
|
||||
inline bool isReady;
|
||||
inline std::string gUrl;
|
||||
inline float gVersion;
|
||||
|
||||
static bool ProdMode;
|
||||
static bool bIsProdMode;
|
||||
static bool bIsVersionFound;
|
||||
|
||||
inline CURLcode(*CurlSetOpt)(struct Curl_easy*, CURLoption, va_list) = nullptr;
|
||||
inline CURLcode(*CurlEasySetOpt)(struct Curl_easy*, CURLoption, ...) = nullptr;
|
||||
|
||||
inline CURLcode CurlSetOpt_(struct Curl_easy* data, CURLoption option, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, option);
|
||||
|
||||
const auto result = CurlSetOpt(data, option, arg);
|
||||
|
||||
va_end(arg);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline CURLcode CurlEasySetOptDetour(struct Curl_easy* data, CURLoption tag, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, tag);
|
||||
|
||||
CURLcode result = {};
|
||||
|
||||
if (!data) return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
//Ssl bypass
|
||||
if (tag == CURLOPT_SSL_VERIFYPEER)
|
||||
{
|
||||
result = CurlSetOpt_(data, tag, 0);
|
||||
}
|
||||
|
||||
//Disable Proxy
|
||||
if (tag == CURLOPT_PROXY)
|
||||
{
|
||||
result = CurlSetOpt_(data, tag, "");
|
||||
}
|
||||
|
||||
//URL redirection
|
||||
else if (tag == CURLOPT_URL)
|
||||
{
|
||||
std::string url = va_arg(arg, char*);
|
||||
gUrl = url;
|
||||
|
||||
if (url.find("ClientQuest") != std::string::npos) isReady = !isReady;
|
||||
|
||||
Uri uri = Uri::Parse(url);
|
||||
|
||||
std::cout << "URL: " << uri.Host.data() << '\n';
|
||||
|
||||
#ifdef URL_HOST
|
||||
|
||||
if (!ProdMode)
|
||||
{
|
||||
if (uri.Host.ends_with(XOR("ol.epicgames.com"))
|
||||
|| uri.Host.ends_with(XOR(".akamaized.net"))
|
||||
|| uri.Host.ends_with(XOR("on.epicgames.com"))
|
||||
|| uri.Host.ends_with(XOR("game-social.epicgames.com"))
|
||||
|| uri.Host.contains(XOR("superawesome.com")))
|
||||
{
|
||||
//printf("LogURL: %s\n", url.c_str());
|
||||
url = Uri::CreateUri(URL_PROTOCOL, URL_HOST, URL_PORT, uri.Path, uri.QueryString);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
result = CurlSetOpt_(data, tag, url.c_str());
|
||||
}
|
||||
|
||||
//Version determination
|
||||
else if (tag == CURLOPT_HTTPHEADER && !bIsVersionFound)
|
||||
{
|
||||
auto list = va_arg(arg, curl_slist*);;
|
||||
|
||||
while (list->next != nullptr && list->data)
|
||||
{
|
||||
std::string listData = list->data;
|
||||
if (listData.starts_with(XOR("User-Agent:")))
|
||||
{
|
||||
const auto version = listData.erase(0, listData.find_first_of("0123456789")); //find first number
|
||||
gVersion = std::stof(version);
|
||||
bIsVersionFound = !bIsVersionFound;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
result = CurlSetOpt(data, tag, arg);
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
return result;
|
||||
}
|
||||
77
vendor/cURL/curlver.h
vendored
Normal file
77
vendor/cURL/curlver.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
#ifndef __CURL_CURLVER_H
|
||||
#define __CURL_CURLVER_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* This header file contains nothing but libcurl version info, generated by
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.55.1"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 55
|
||||
#define LIBCURL_VERSION_PATCH 1
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
always follow this syntax:
|
||||
|
||||
0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||
appears as "0x090b07".
|
||||
|
||||
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
|
||||
Note: This define is the full hex number and _does not_ use the
|
||||
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||
and needs it to contain the full number.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x073701
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
* timestamp is not stored in git, as the timestamp is properly set in the
|
||||
* tarballs by the maketgz script.
|
||||
*
|
||||
* The format of the date follows this template:
|
||||
*
|
||||
* "2007-11-23"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "2017-08-14"
|
||||
|
||||
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
|
||||
#define CURL_AT_LEAST_VERSION(x,y,z) \
|
||||
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
||||
547
vendor/cURL/system.h
vendored
Normal file
547
vendor/cURL/system.h
vendored
Normal file
@@ -0,0 +1,547 @@
|
||||
#ifndef __CURL_SYSTEM_H
|
||||
#define __CURL_SYSTEM_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Try to keep one section per platform, compiler and architecture, otherwise,
|
||||
* if an existing section is reused for a different one and later on the
|
||||
* original is adjusted, probably the piggybacking one can be adversely
|
||||
* changed.
|
||||
*
|
||||
* In order to differentiate between platforms/compilers/architectures use
|
||||
* only compiler built in predefined preprocessor symbols.
|
||||
*
|
||||
* curl_off_t
|
||||
* ----------
|
||||
*
|
||||
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
|
||||
* wide signed integral data type. The width of this data type must remain
|
||||
* constant and independent of any possible large file support settings.
|
||||
*
|
||||
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
|
||||
* wide signed integral data type if there is no 64-bit type.
|
||||
*
|
||||
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
|
||||
* only be violated if off_t is the only 64-bit data type available and the
|
||||
* size of off_t is independent of large file support settings. Keep your
|
||||
* build on the safe side avoiding an off_t gating. If you have a 64-bit
|
||||
* off_t then take for sure that another 64-bit data type exists, dig deeper
|
||||
* and you will find it.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__DJGPP__) || defined(__GO32__)
|
||||
# if defined(__DJGPP__) && (__DJGPP__ > 1)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__SALFORDC__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# if (__BORLANDC__ < 0x520)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__TURBOC__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__386__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__POCC__)
|
||||
# if (__POCC__ < 280)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# elif defined(_MSC_VER)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__LCC__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
# if defined(__EABI__) /* Treat all ARM compilers equally */
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__CW32__)
|
||||
# pragma longlong on
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__VC32__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_WS2TCPIP_H 1
|
||||
|
||||
#elif defined(__VMS)
|
||||
# if defined(__VAX)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__OS400__)
|
||||
# if defined(__ILEC400__)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__MVS__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# elif defined(_LP64)
|
||||
# define CURL_SIZEOF_LONG 8
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__370__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# elif defined(_LP64)
|
||||
# define CURL_SIZEOF_LONG 8
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(TPF)
|
||||
# define CURL_SIZEOF_LONG 8
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
#elif defined(__TINYC__) /* also known as tcc */
|
||||
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#elif defined(__SUNPRO_C) /* Oracle Solaris Studio */
|
||||
# if !defined(__LP64) && (defined(__ILP32) || \
|
||||
defined(__i386) || defined(__sparcv8))
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64) || \
|
||||
defined(__amd64) || defined(__sparcv9)
|
||||
# define CURL_SIZEOF_LONG 8
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# if !defined(__LP64__) && (defined(__ILP32__) || \
|
||||
defined(__i386__) || defined(__powerpc__) || defined(__arm__) || \
|
||||
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
|
||||
defined(__XTENSA__) || (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4))
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64__) || \
|
||||
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
|
||||
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8)
|
||||
# define CURL_SIZEOF_LONG 8
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SIZEOF_CURL_OFF_T 8
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#else
|
||||
/* generic "safe guess" on old 32 bit style */
|
||||
# define CURL_SIZEOF_LONG 4
|
||||
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
# define CURL_SIZEOF_CURL_OFF_T 4
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
|
||||
/* ws2tcpip.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_WS2TCPIP_H
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_socklen_t. */
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_off_t. */
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
|
||||
* these to be visible and exported by the external libcurl interface API,
|
||||
* while also making them visible to the library internals, simply including
|
||||
* curl_setup.h, without actually needing to include curl.h internally.
|
||||
* If some day this section would grow big enough, all this should be moved
|
||||
* to its own header file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Figure out if we can use the ## preprocessor operator, which is supported
|
||||
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
|
||||
* or __cplusplus so we need to carefully check for them too.
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||
defined(__ILEC400__)
|
||||
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||
#define CURL_ISOCPP
|
||||
#else
|
||||
/* This compiler is believed NOT to have an ISO compatible preprocessor */
|
||||
#undef CURL_ISOCPP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
|
||||
# define __CURL_OFF_T_C_HLPR2(x) x
|
||||
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
|
||||
#else
|
||||
# ifdef CURL_ISOCPP
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
|
||||
# else
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
|
||||
# endif
|
||||
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_SYSTEM_H */
|
||||
Reference in New Issue
Block a user