├── README.md ├── .gitattributes ├── api ├── static │ ├── placeholder.png │ └── index.html ├── api.h └── api.cpp ├── Dependencies ├── globals.h ├── curl │ ├── stdcheaders.h │ ├── mprintf.h │ ├── options.h │ ├── websockets.h │ ├── header.h │ ├── curlver.h │ ├── easy.h │ ├── urlapi.h │ ├── multi.h │ ├── system.h │ └── typecheck-gcc.h ├── unreal.h ├── globaloffsets.h ├── unreal_structs.h ├── minhook │ └── MinHook.h └── unreal_enums.h ├── FestNet.vcxproj.user ├── .gitignore ├── dllmain.cpp ├── FestNet.vcxproj.filters ├── LICENSE.txt ├── hooks.hpp └── FestNet.vcxproj /README.md: -------------------------------------------------------------------------------- 1 | # FestNet 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /api/static/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiritascend/FestNet/HEAD/api/static/placeholder.png -------------------------------------------------------------------------------- /Dependencies/globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #define HTTP_SERVER_PORT 9999 5 | #define MAIN_PAGE_RAW "https://gist.githubusercontent.com/spiritascend/4f4c891342e11cdc928481617cd2aead/raw/a675ec8dc53afb49059230484b661932be693a03/index.html" 6 | -------------------------------------------------------------------------------- /FestNet.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | #Folders 35 | packages/ 36 | x64/ 37 | .vs/ 38 | -------------------------------------------------------------------------------- /Dependencies/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_STDCHEADERS_H 2 | #define CURLINC_STDCHEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | 29 | size_t fread(void *, size_t, size_t, FILE *); 30 | size_t fwrite(const void *, size_t, size_t, FILE *); 31 | 32 | int strcasecmp(const char *, const char *); 33 | int strncasecmp(const char *, const char *, size_t); 34 | 35 | #endif /* CURLINC_STDCHEADERS_H */ 36 | -------------------------------------------------------------------------------- /dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hooks.hpp" 3 | 4 | DWORD WINAPI MainThread(LPVOID param) { 5 | // sleep 5 seconds so UE can prepare itself (if we load at process start rather than post-launch injection) 6 | Sleep(5000); 7 | 8 | 9 | // in Release builds check env variable FESTNET_DEBUG to see if we should enable the console 10 | // the console causes issues in gamescope 11 | #ifdef NDEBUG 12 | if (GetEnvironmentVariableA("FESTNET_DEBUG", NULL, 0) != 0) { 13 | #endif 14 | AllocConsole(); 15 | FILE* Dummy; 16 | freopen_s(&Dummy, "CONOUT$", "w", stdout); 17 | freopen_s(&Dummy, "CONIN$", "r", stdin); 18 | #ifdef NDEBUG 19 | } 20 | #endif 21 | 22 | uintptr_t BaseAddress = reinterpret_cast(GetModuleHandle(0)); 23 | 24 | printf("Module Base Address: %p\n", (void*)BaseAddress); 25 | 26 | if (Offsets::Init()) { 27 | Offsets::ClientWasKicked = (uintptr_t)static_cast(StaticFindObject(nullptr, nullptr, L"PlayerController.ClientWasKicked", false))->ExecFunction; 28 | Offsets::OnControlMappingsRebuilt = (uintptr_t)static_cast(StaticFindObject(nullptr, nullptr, L"PilgrimGame.OnControlMappingsRebuilt", false))->ExecFunction; 29 | Offsets::UAC_SendClientHello = (uintptr_t)static_cast(StaticFindObject(nullptr, nullptr, L"UACNetworkComponent.SendClientHello", false))->ExecFunction; 30 | Offsets::UAC_SendPacketToClient = (uintptr_t)static_cast(StaticFindObject(nullptr, nullptr, L"UACNetworkComponent.SendPacketToClient", false))->ExecFunction; 31 | Offsets::UAC_SendPacketToServer = (uintptr_t)static_cast(StaticFindObject(nullptr, nullptr, L"UACNetworkComponent.SendPacketToServer", false))->ExecFunction; 32 | Offsets::ProcessEvent_VTableIndex = GetProcessEventIndexFromObject(StaticFindObject(nullptr, nullptr, L"CoreUObject.Object", false)); 33 | 34 | if (Hooks::ApplyHooks()) 35 | { 36 | printf("Applied Hooks\n"); 37 | } 38 | } 39 | 40 | server.Init(); 41 | 42 | return 0; 43 | } 44 | 45 | volatile BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) 46 | { 47 | switch (reason) 48 | { 49 | case DLL_PROCESS_ATTACH: 50 | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)MainThread, hModule, 0, 0); 51 | break; 52 | } 53 | 54 | return TRUE; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Dependencies/curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MPRINTF_H 2 | #define CURLINC_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include /* needed for FILE */ 29 | #include "curl.h" /* for CURL_EXTERN */ 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | CURL_EXTERN int curl_mprintf(const char *format, ...); 36 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 37 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 38 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 39 | const char *format, ...); 40 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 41 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 42 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 43 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 44 | const char *format, va_list args); 45 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 46 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* CURLINC_MPRINTF_H */ 53 | -------------------------------------------------------------------------------- /api/api.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #define CURL_STATICLIB 5 | 6 | 7 | #include "..\Dependencies\json.hpp" 8 | #pragma comment (lib,"Dependencies/curl/libcurl_a.lib") 9 | #pragma comment (lib,"Normaliz.lib") 10 | #pragma comment (lib,"Ws2_32.lib") 11 | #pragma comment (lib,"Wldap32.lib") 12 | #pragma comment (lib,"Crypt32.lib") 13 | #pragma comment (lib,"advapi32.lib") 14 | 15 | 16 | #include 17 | #include 18 | 19 | #include "../Dependencies/globals.h" 20 | #include "..\Dependencies/httplib.h" 21 | #include "..\Dependencies/curl/curl.h" 22 | 23 | 24 | 25 | 26 | using json = nlohmann::json; 27 | namespace fs = std::filesystem; 28 | 29 | 30 | 31 | struct SongEntry { 32 | std::string Name; 33 | std::string MidiPath; 34 | std::string SegmentDir; 35 | std::string id; 36 | }; 37 | 38 | 39 | class api 40 | { 41 | public: 42 | static void Init(); 43 | 44 | 45 | static json GetCachedSongs() { 46 | return cachedsongs; 47 | } 48 | 49 | static std::string GetActiveSongID() { 50 | return activesong.id; 51 | } 52 | 53 | static SongEntry GetActiveSong() { 54 | return activesong; 55 | } 56 | 57 | static bool HasActiveSong() { 58 | return hasactivesong; 59 | } 60 | 61 | private: 62 | static inline std::string baseconfigdirectory; 63 | static inline std::string songsconfigpath; 64 | inline static json cachedsongs; 65 | static inline SongEntry activesong; 66 | static inline bool hasactivesong = false; 67 | 68 | 69 | static size_t WriteCallback(char* contents, size_t size, size_t nmemb, void* userp); 70 | static std::string get_query_param(const httplib::Request& req, const std::string& name); 71 | 72 | static void Handle_MainPage(const httplib::Request& req, httplib::Response& res); 73 | static void Handle_AddSong(const httplib::Request& req, httplib::Response& res); 74 | static void Handle_RemoveSong(const httplib::Request& req, httplib::Response& res); 75 | static void Handle_SetActiveSong(const httplib::Request& req, httplib::Response& res); 76 | static void Handle_RemoveActive(const httplib::Request& req, httplib::Response& res); 77 | 78 | 79 | static void Handle_GetSongs(const httplib::Request& req, httplib::Response& res); 80 | static void Handle_GetActiveSong(const httplib::Request& req, httplib::Response& res); 81 | static void Handle_GetPlaylist(const httplib::Request& req, httplib::Response& res); 82 | 83 | 84 | 85 | }; 86 | 87 | -------------------------------------------------------------------------------- /Dependencies/curl/options.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_OPTIONS_H 2 | #define CURLINC_OPTIONS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef enum { 32 | CURLOT_LONG, /* long (a range of values) */ 33 | CURLOT_VALUES, /* (a defined set or bitmask) */ 34 | CURLOT_OFF_T, /* curl_off_t (a range of values) */ 35 | CURLOT_OBJECT, /* pointer (void *) */ 36 | CURLOT_STRING, /* (char * to null-terminated buffer) */ 37 | CURLOT_SLIST, /* (struct curl_slist *) */ 38 | CURLOT_CBPTR, /* (void * passed as-is to a callback) */ 39 | CURLOT_BLOB, /* blob (struct curl_blob *) */ 40 | CURLOT_FUNCTION /* function pointer */ 41 | } curl_easytype; 42 | 43 | /* Flag bits */ 44 | 45 | /* "alias" means it is provided for old programs to remain functional, 46 | we prefer another name */ 47 | #define CURLOT_FLAG_ALIAS (1<<0) 48 | 49 | /* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size 50 | to use for curl_easy_setopt() for the given id */ 51 | struct curl_easyoption { 52 | const char *name; 53 | CURLoption id; 54 | curl_easytype type; 55 | unsigned int flags; 56 | }; 57 | 58 | CURL_EXTERN const struct curl_easyoption * 59 | curl_easy_option_by_name(const char *name); 60 | 61 | CURL_EXTERN const struct curl_easyoption * 62 | curl_easy_option_by_id(CURLoption id); 63 | 64 | CURL_EXTERN const struct curl_easyoption * 65 | curl_easy_option_next(const struct curl_easyoption *prev); 66 | 67 | #ifdef __cplusplus 68 | } /* end of extern "C" */ 69 | #endif 70 | #endif /* CURLINC_OPTIONS_H */ 71 | -------------------------------------------------------------------------------- /FestNet.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | -------------------------------------------------------------------------------- /Dependencies/curl/websockets.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_WEBSOCKETS_H 2 | #define CURLINC_WEBSOCKETS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct curl_ws_frame { 32 | int age; /* zero */ 33 | int flags; /* See the CURLWS_* defines */ 34 | curl_off_t offset; /* the offset of this data into the frame */ 35 | curl_off_t bytesleft; /* number of pending bytes left of the payload */ 36 | }; 37 | 38 | /* flag bits */ 39 | #define CURLWS_TEXT (1<<0) 40 | #define CURLWS_BINARY (1<<1) 41 | #define CURLWS_CONT (1<<2) 42 | #define CURLWS_CLOSE (1<<3) 43 | #define CURLWS_PING (1<<4) 44 | #define CURLWS_OFFSET (1<<5) 45 | 46 | /* 47 | * NAME curl_ws_recv() 48 | * 49 | * DESCRIPTION 50 | * 51 | * Receives data from the websocket connection. Use after successful 52 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 53 | */ 54 | CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen, 55 | size_t *recv, 56 | struct curl_ws_frame **metap); 57 | 58 | /* sendflags for curl_ws_send() */ 59 | #define CURLWS_PONG (1<<6) 60 | 61 | /* 62 | * NAME curl_easy_send() 63 | * 64 | * DESCRIPTION 65 | * 66 | * Sends data over the websocket connection. Use after successful 67 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 68 | */ 69 | CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer, 70 | size_t buflen, size_t *sent, 71 | curl_off_t framesize, 72 | unsigned int sendflags); 73 | 74 | /* bits for the CURLOPT_WS_OPTIONS bitmask: */ 75 | #define CURLWS_RAW_MODE (1<<0) 76 | 77 | CURL_EXTERN struct curl_ws_frame *curl_ws_meta(CURL *curl); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* CURLINC_WEBSOCKETS_H */ 84 | -------------------------------------------------------------------------------- /Dependencies/curl/header.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_HEADER_H 2 | #define CURLINC_HEADER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct curl_header { 32 | char *name; /* this might not use the same case */ 33 | char *value; 34 | size_t amount; /* number of headers using this name */ 35 | size_t index; /* ... of this instance, 0 or higher */ 36 | unsigned int origin; /* see bits below */ 37 | void *anchor; /* handle privately used by libcurl */ 38 | }; 39 | 40 | /* 'origin' bits */ 41 | #define CURLH_HEADER (1<<0) /* plain server header */ 42 | #define CURLH_TRAILER (1<<1) /* trailers */ 43 | #define CURLH_CONNECT (1<<2) /* CONNECT headers */ 44 | #define CURLH_1XX (1<<3) /* 1xx headers */ 45 | #define CURLH_PSEUDO (1<<4) /* pseudo headers */ 46 | 47 | typedef enum { 48 | CURLHE_OK, 49 | CURLHE_BADINDEX, /* header exists but not with this index */ 50 | CURLHE_MISSING, /* no such header exists */ 51 | CURLHE_NOHEADERS, /* no headers at all exist (yet) */ 52 | CURLHE_NOREQUEST, /* no request with this number was used */ 53 | CURLHE_OUT_OF_MEMORY, /* out of memory while processing */ 54 | CURLHE_BAD_ARGUMENT, /* a function argument was not okay */ 55 | CURLHE_NOT_BUILT_IN /* if API was disabled in the build */ 56 | } CURLHcode; 57 | 58 | CURL_EXTERN CURLHcode curl_easy_header(CURL *easy, 59 | const char *name, 60 | size_t index, 61 | unsigned int origin, 62 | int request, 63 | struct curl_header **hout); 64 | 65 | CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy, 66 | unsigned int origin, 67 | int request, 68 | struct curl_header *prev); 69 | 70 | #ifdef __cplusplus 71 | } /* end of extern "C" */ 72 | #endif 73 | 74 | #endif /* CURLINC_HEADER_H */ 75 | -------------------------------------------------------------------------------- /Dependencies/curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_CURLVER_H 2 | #define CURLINC_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* This header file contains nothing but libcurl version info, generated by 28 | a script at release-time. This was made its own header file in 7.11.2 */ 29 | 30 | /* This is the global package copyright */ 31 | #define LIBCURL_COPYRIGHT "1996 - 2022 Daniel Stenberg, ." 32 | 33 | /* This is the version number of the libcurl package from which this header 34 | file origins: */ 35 | #define LIBCURL_VERSION "7.86.0" 36 | 37 | /* The numeric version number is also available "in parts" by using these 38 | defines: */ 39 | #define LIBCURL_VERSION_MAJOR 7 40 | #define LIBCURL_VERSION_MINOR 86 41 | #define LIBCURL_VERSION_PATCH 0 42 | 43 | /* This is the numeric version of the libcurl version number, meant for easier 44 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will 45 | always follow this syntax: 46 | 47 | 0xXXYYZZ 48 | 49 | Where XX, YY and ZZ are the main version, release and patch numbers in 50 | hexadecimal (using 8 bits each). All three numbers are always represented 51 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 52 | appears as "0x090b07". 53 | 54 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 55 | and it is always a greater number in a more recent release. It makes 56 | comparisons with greater than and less than work. 57 | 58 | Note: This define is the full hex number and _does not_ use the 59 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 60 | and needs it to contain the full number. 61 | */ 62 | #define LIBCURL_VERSION_NUM 0x075600 63 | 64 | /* 65 | * This is the date and time when the full source package was created. The 66 | * timestamp is not stored in git, as the timestamp is properly set in the 67 | * tarballs by the maketgz script. 68 | * 69 | * The format of the date follows this template: 70 | * 71 | * "2007-11-23" 72 | */ 73 | #define LIBCURL_TIMESTAMP "2022-10-26" 74 | 75 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 76 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 77 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 78 | 79 | #endif /* CURLINC_CURLVER_H */ 80 | -------------------------------------------------------------------------------- /Dependencies/unreal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "globaloffsets.h" 4 | #include "unreal_structs.h" 5 | 6 | static UObject* StaticFindObject(UObject* ObjectClass, UObject* ObjectPackage, const wchar_t* OrigInName, bool bExactClass) { 7 | return reinterpret_cast(Offsets::StaticFindObject)(ObjectClass, ObjectPackage, OrigInName, bExactClass); 8 | } 9 | 10 | #define StaticLoadObjectEasy(Path) StaticLoadObject((UObject*)-1, nullptr, Path); 11 | static UObject* StaticLoadObject(UObject* Class, UObject* InOuter, const TCHAR* Name, const TCHAR* FileName = nullptr, uint32_t LoadFlags = 0, void* Sandbox = nullptr, bool bAllowObjectReconciliation = false, void* InstancingContext = nullptr) 12 | { 13 | return reinterpret_cast(Offsets::StaticLoadObject)(Class, InOuter, Name, FileName, LoadFlags, Sandbox, bAllowObjectReconciliation, InstancingContext); 14 | } 15 | 16 | 17 | static UObject* GetLocalPlayer() { 18 | return reinterpret_cast(Offsets::GetLocalPlayer)(); 19 | } 20 | 21 | FString* __fastcall UPlayer_ConsoleCommand(UObject* Player, FString* result, const FString* Cmd, bool bWriteToLog) { 22 | return reinterpret_cast(Offsets::ExecuteConsoleCommand)(Player,result,Cmd,bWriteToLog); 23 | } 24 | 25 | 26 | static std::string QuickplayState_ToString(EPilgrimQuickplayStateMachine_NameState StateID) { 27 | switch (StateID) { 28 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_Loading: 29 | return "PilgrimState_Loading"; 30 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_PreGame: 31 | return "PilgrimState_PreGame"; 32 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_PreIntro: 33 | return "PilgrimState_PreIntro"; 34 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_Intro: 35 | return "PilgrimState_Intro"; 36 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_SongGameplay: 37 | return "PilgrimState_SongGameplay"; 38 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_Outro: 39 | return "PilgrimState_Outro"; 40 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_SongResult: 41 | return "PilgrimState_SongResult"; 42 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_SetResults: 43 | return "PilgrimState_SetResults"; 44 | case EPilgrimQuickplayStateMachine_NameState::PilgrimState_Request_StateDone: 45 | return "PilgrimState_Request_StateDone"; 46 | default: 47 | return "PilgrimState_Undefined"; 48 | } 49 | } 50 | 51 | 52 | // Notes: EObjectFlags::RF_ClassDefaultObject to exclude default objects and also EInternalObjectFlags::GUnreachableObjectFlag for objects that are pending destruction 53 | void __fastcall GetObjectsOfClass_Internal( 54 | UObject* ClassToLookFor, 55 | TArray* Results, 56 | bool bIncludeDerivedClasses = true, 57 | EObjectFlags ExclusionFlags = EObjectFlags::RF_ClassDefaultObject, 58 | EInternalObjectFlags ExclusionInternalFlags = EInternalObjectFlags::Unreachable) 59 | { 60 | return reinterpret_cast*, bool, EObjectFlags, EInternalObjectFlags)>(Offsets::GetObjectsOfClass)(ClassToLookFor,Results,bIncludeDerivedClasses,ExclusionFlags, ExclusionInternalFlags); 61 | } 62 | 63 | TArray GetObjectsOfClass(UObject* Class) { 64 | TArray Results; 65 | GetObjectsOfClass_Internal(Class, &Results); 66 | return Results; 67 | } 68 | 69 | 70 | UObject* GetObjectOfClass(UObject* Class) { 71 | TArray Results; 72 | if (Class) { 73 | GetObjectsOfClass_Internal(Class, &Results); 74 | if (Results.Num() > 0) { 75 | return Results[0]; 76 | } 77 | } 78 | return nullptr; 79 | } 80 | 81 | static int GetProcessEventIndexFromObject(UObject* pObject) 82 | { 83 | auto vtable = *reinterpret_cast(pObject); 84 | 85 | for (int i = 0; i < 140; i++) 86 | { 87 | auto const bytes = (uint8_t*)vtable[i]; 88 | 89 | if (bytes[0] == 0x40 && bytes[1] == 0x55) 90 | { 91 | if (reinterpret_cast(bytes + 2)[0] == 0x56) 92 | { 93 | return i; 94 | } 95 | } 96 | } 97 | return 0; 98 | } -------------------------------------------------------------------------------- /Dependencies/curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_EASY_H 2 | #define CURLINC_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Flag bits in the curl_blob struct: */ 31 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 32 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 33 | 34 | struct curl_blob { 35 | void *data; 36 | size_t len; 37 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 38 | left zeroes */ 39 | }; 40 | 41 | CURL_EXTERN CURL *curl_easy_init(void); 42 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 43 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 44 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 45 | 46 | /* 47 | * NAME curl_easy_getinfo() 48 | * 49 | * DESCRIPTION 50 | * 51 | * Request internal information from the curl session with this function. The 52 | * third argument MUST be a pointer to a long, a pointer to a char * or a 53 | * pointer to a double (as the documentation describes elsewhere). The data 54 | * pointed to will be filled in accordingly and can be relied upon only if the 55 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 56 | * performed transfer, all results from this function are undefined until the 57 | * transfer is completed. 58 | */ 59 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 60 | 61 | 62 | /* 63 | * NAME curl_easy_duphandle() 64 | * 65 | * DESCRIPTION 66 | * 67 | * Creates a new curl session handle with the same options set for the handle 68 | * passed in. Duplicating a handle could only be a matter of cloning data and 69 | * options, internal state info and things like persistent connections cannot 70 | * be transferred. It is useful in multithreaded applications when you can run 71 | * curl_easy_duphandle() for each new thread to avoid a series of identical 72 | * curl_easy_setopt() invokes in every thread. 73 | */ 74 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_reset() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Re-initializes a CURL handle to the default values. This puts back the 82 | * handle to the same state as it was in when it was just created. 83 | * 84 | * It does keep: live connections, the Session ID cache, the DNS cache and the 85 | * cookies. 86 | */ 87 | CURL_EXTERN void curl_easy_reset(CURL *curl); 88 | 89 | /* 90 | * NAME curl_easy_recv() 91 | * 92 | * DESCRIPTION 93 | * 94 | * Receives data from the connected socket. Use after successful 95 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 96 | */ 97 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 98 | size_t *n); 99 | 100 | /* 101 | * NAME curl_easy_send() 102 | * 103 | * DESCRIPTION 104 | * 105 | * Sends data over the connected socket. Use after successful 106 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 107 | */ 108 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 109 | size_t buflen, size_t *n); 110 | 111 | 112 | /* 113 | * NAME curl_easy_upkeep() 114 | * 115 | * DESCRIPTION 116 | * 117 | * Performs connection upkeep for the given session handle. 118 | */ 119 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /Dependencies/globaloffsets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "memcury.h" 4 | 5 | namespace Offsets { 6 | #define Check(str, offset) \ 7 | if (offset == 0) { \ 8 | char message[256]; \ 9 | sprintf_s(message, sizeof(message), "Failed to find offset for %s", str); \ 10 | MessageBoxA(NULL, message, "Error", MB_OK | MB_ICONERROR); \ 11 | return false; \ 12 | } 13 | 14 | 15 | static uintptr_t FName_ToString; 16 | static uintptr_t NetConnection_Tick; 17 | static uintptr_t ReceivedPacket; 18 | static uintptr_t StaticFindObject; 19 | static uintptr_t ClearHitOffsetAverage; 20 | static uintptr_t StaticLoadObject; 21 | static uintptr_t CurlEasySetOpt; 22 | static uintptr_t CurlEasyGetInfo; 23 | static uintptr_t BroadcastNetworkFailure; 24 | static uintptr_t ClientWasKickedNative; 25 | static uintptr_t GetObjectsOfClass; 26 | static uintptr_t ReturnToMainMenuError; 27 | static uintptr_t GetLocalPlayer; 28 | static uintptr_t ExecuteConsoleCommand; 29 | 30 | static uintptr_t ReceiveResponseBodyCallback; 31 | static uintptr_t ReceiveResponseHeaderCallback; 32 | static uintptr_t CurlHttpRequestSetupRequest; 33 | static uintptr_t CurlHttpRequestFinishRequest; 34 | 35 | 36 | static uintptr_t ClientWasKicked; 37 | static uintptr_t ClientReturnToMainMenu; 38 | static uintptr_t OnControlMappingsRebuilt; 39 | static uintptr_t UAC_SendClientHello; 40 | static uintptr_t UAC_SendPacketToClient; 41 | static uintptr_t UAC_SendPacketToServer; 42 | 43 | 44 | static int ProcessEvent_VTableIndex; 45 | 46 | 47 | static bool Init() { 48 | FName_ToString = Memcury::Scanner::FindStringRef(L"Loading Module %s").ScanFor({ Memcury::ASM::CALL }, false).RelativeOffset(1).Get(); 49 | Check("FName_ToString", FName_ToString); 50 | 51 | StaticFindObject = Memcury::Scanner::FindStringRef(L"ServerStatReplicatorInst").ScanFor({ 0xE9 }, true).RelativeOffset(1).Get(); 52 | Check("StaticFindObject", StaticFindObject); 53 | 54 | ReceivedPacket = Memcury::Scanner::FindPattern("48 8B 45 F0 48 8D 5D B0 48 85 C0").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 55 | Check("ReceivedPacket", ReceivedPacket); 56 | 57 | NetConnection_Tick = Memcury::Scanner::FindStringRef(L"Stat_NetConnectionTick").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 58 | Check("NetConnection_Tick", NetConnection_Tick); 59 | 60 | ClearHitOffsetAverage = Memcury::Scanner::FindStringRef("UPilgrimGame::ClearHitOffsetAverage").ScanFor({ 0x40, 0x53 }, false).Get(); 61 | Check("ClearHitOffsetAverage", ClearHitOffsetAverage); 62 | 63 | ClientReturnToMainMenu = Memcury::Scanner::FindStringRef(L"Return To Main Menu").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 64 | Check("ClientReturnToMainMenu", ClientReturnToMainMenu); 65 | 66 | StaticLoadObject = Memcury::Scanner::FindStringRef(L"/LauncherSocial/SocialActionButtonDefaultData.SocialActionButtonDefaultData").ScanFor({ Memcury::ASM::CALL }, true).RelativeOffset(1).ScanFor({ Memcury::ASM::CALL }, true).RelativeOffset(1).Get(); 67 | Check("StaticLoadObject", StaticLoadObject); 68 | 69 | CurlEasySetOpt = Memcury::Scanner::FindPattern("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").Get(); 70 | Check("CurlEasySetOpt", CurlEasySetOpt); 71 | 72 | CurlEasyGetInfo = Memcury::Scanner::FindPattern("8B C6 25 00 00 F0 00 ").ScanFor({ 0x89, 0x54, 0x24, 0x10 }, false).Get(); 73 | Check("CurlEasyGetInfo", CurlEasyGetInfo); 74 | 75 | ReceiveResponseBodyCallback = Memcury::Scanner::FindStringRef(L"STAT_FCurlHttpRequest_StaticReceiveResponseBodyCallback").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 76 | Check("ReceiveResponseBodyCallback", ReceiveResponseBodyCallback); 77 | 78 | ReceiveResponseHeaderCallback = Memcury::Scanner::FindStringRef(L"STAT_FCurlHttpRequest_StaticReceiveResponseHeaderCallback").ScanFor({ 0x48, 0x89, 0x5C, 0x24 }, false).Get(); 79 | Check("ReceiveResponseHeaderCallback", ReceiveResponseHeaderCallback); 80 | 81 | CurlHttpRequestSetupRequest = Memcury::Scanner::FindStringRef(L"STAT_FCurlHttpRequest_SetupRequestHttpThread").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 82 | Check("CurlHttpRequestSetupRequest", CurlHttpRequestSetupRequest); 83 | 84 | CurlHttpRequestFinishRequest = Memcury::Scanner::FindStringRef(L"STAT_FCurlHttpRequest_FinishRequest").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 85 | Check("CurlHttpRequestFinishRequest", CurlHttpRequestFinishRequest); 86 | 87 | BroadcastNetworkFailure = Memcury::Scanner::FindStringRef(L"UIpNetConnection::HandleSocketSendResult: Socket->SendTo failed with error %i (%s). %s Connection will be closed during next Tick()!").ScanFor({ 0xE8 }, true, 2).RelativeOffset(1).Get(); 88 | Check("BroadcastNetworkFailure", BroadcastNetworkFailure); 89 | 90 | ClientWasKickedNative = Memcury::Scanner::FindPattern("F3 0F 5F 05 ? ? ? ? F3 0F 59 C1 F3 0F 58 C3 C3").ScanFor({ 0x48, 0x89 ,0x5C ,0x24 }, false).Get(); 91 | Check("ClientWasKickedNative", ClientWasKickedNative); 92 | 93 | GetObjectsOfClass = Memcury::Scanner::FindStringRef(L"STAT_Hash_GetObjectsOfClass").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 94 | Check("GetObjectsOfClass", GetObjectsOfClass); 95 | 96 | ReturnToMainMenuError = Memcury::Scanner::FindStringRef(L"ReturnToMenuError-%s-%s").ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get(); 97 | Check("ReturnToMainMenuError", ReturnToMainMenuError); 98 | 99 | GetLocalPlayer = Memcury::Scanner::FindStringRef(L"cheat GiveAllIngredients 99").ScanFor({ 0xE8 }, false).RelativeOffset(1).Get(); 100 | Check("GetLocalPlayer", GetLocalPlayer); 101 | 102 | ExecuteConsoleCommand = Memcury::Scanner::FindStringRef(L"cheat GiveAllIngredients 99").ScanFor({ 0xE8 }, true,1).RelativeOffset(1).Get(); 103 | Check("ExecuteConsoleCommand", ExecuteConsoleCommand); 104 | 105 | } 106 | } -------------------------------------------------------------------------------- /Dependencies/curl/urlapi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_URLAPI_H 2 | #define CURLINC_URLAPI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* the error codes for the URL API */ 34 | typedef enum { 35 | CURLUE_OK, 36 | CURLUE_BAD_HANDLE, /* 1 */ 37 | CURLUE_BAD_PARTPOINTER, /* 2 */ 38 | CURLUE_MALFORMED_INPUT, /* 3 */ 39 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 40 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 41 | CURLUE_URLDECODE, /* 6 */ 42 | CURLUE_OUT_OF_MEMORY, /* 7 */ 43 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 44 | CURLUE_UNKNOWN_PART, /* 9 */ 45 | CURLUE_NO_SCHEME, /* 10 */ 46 | CURLUE_NO_USER, /* 11 */ 47 | CURLUE_NO_PASSWORD, /* 12 */ 48 | CURLUE_NO_OPTIONS, /* 13 */ 49 | CURLUE_NO_HOST, /* 14 */ 50 | CURLUE_NO_PORT, /* 15 */ 51 | CURLUE_NO_QUERY, /* 16 */ 52 | CURLUE_NO_FRAGMENT, /* 17 */ 53 | CURLUE_NO_ZONEID, /* 18 */ 54 | CURLUE_BAD_FILE_URL, /* 19 */ 55 | CURLUE_BAD_FRAGMENT, /* 20 */ 56 | CURLUE_BAD_HOSTNAME, /* 21 */ 57 | CURLUE_BAD_IPV6, /* 22 */ 58 | CURLUE_BAD_LOGIN, /* 23 */ 59 | CURLUE_BAD_PASSWORD, /* 24 */ 60 | CURLUE_BAD_PATH, /* 25 */ 61 | CURLUE_BAD_QUERY, /* 26 */ 62 | CURLUE_BAD_SCHEME, /* 27 */ 63 | CURLUE_BAD_SLASHES, /* 28 */ 64 | CURLUE_BAD_USER, /* 29 */ 65 | CURLUE_LAST 66 | } CURLUcode; 67 | 68 | typedef enum { 69 | CURLUPART_URL, 70 | CURLUPART_SCHEME, 71 | CURLUPART_USER, 72 | CURLUPART_PASSWORD, 73 | CURLUPART_OPTIONS, 74 | CURLUPART_HOST, 75 | CURLUPART_PORT, 76 | CURLUPART_PATH, 77 | CURLUPART_QUERY, 78 | CURLUPART_FRAGMENT, 79 | CURLUPART_ZONEID /* added in 7.65.0 */ 80 | } CURLUPart; 81 | 82 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 83 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 84 | if the port number matches the 85 | default for the scheme */ 86 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 87 | missing */ 88 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 89 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 90 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 91 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 92 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 93 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 94 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 95 | #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the 96 | scheme is unknown. */ 97 | #define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */ 98 | 99 | typedef struct Curl_URL CURLU; 100 | 101 | /* 102 | * curl_url() creates a new CURLU handle and returns a pointer to it. 103 | * Must be freed with curl_url_cleanup(). 104 | */ 105 | CURL_EXTERN CURLU *curl_url(void); 106 | 107 | /* 108 | * curl_url_cleanup() frees the CURLU handle and related resources used for 109 | * the URL parsing. It will not free strings previously returned with the URL 110 | * API. 111 | */ 112 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 113 | 114 | /* 115 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 116 | * handle must also be freed with curl_url_cleanup(). 117 | */ 118 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in); 119 | 120 | /* 121 | * curl_url_get() extracts a specific part of the URL from a CURLU 122 | * handle. Returns error code. The returned pointer MUST be freed with 123 | * curl_free() afterwards. 124 | */ 125 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, 126 | char **part, unsigned int flags); 127 | 128 | /* 129 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 130 | * error code. The passed in string will be copied. Passing a NULL instead of 131 | * a part string, clears that part. 132 | */ 133 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 134 | const char *part, unsigned int flags); 135 | 136 | /* 137 | * curl_url_strerror() turns a CURLUcode value into the equivalent human 138 | * readable error string. This is useful for printing meaningful error 139 | * messages. 140 | */ 141 | CURL_EXTERN const char *curl_url_strerror(CURLUcode); 142 | 143 | #ifdef __cplusplus 144 | } /* end of extern "C" */ 145 | #endif 146 | 147 | #endif /* CURLINC_URLAPI_H */ 148 | -------------------------------------------------------------------------------- /Dependencies/unreal_structs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "unreal_enums.h" 5 | #include "globaloffsets.h" 6 | 7 | 8 | 9 | template 10 | struct TArray 11 | { 12 | 13 | friend struct FString; 14 | public: 15 | T* Data; 16 | int32_t Count; 17 | int32_t Max; 18 | 19 | inline TArray() 20 | { 21 | Data = nullptr; 22 | Count = Max = 0; 23 | }; 24 | 25 | inline int Num() const 26 | { 27 | return Count; 28 | }; 29 | 30 | inline T& operator[](int i) 31 | { 32 | return Data[i]; 33 | }; 34 | 35 | inline const T& operator[](int i) const 36 | { 37 | return Data[i]; 38 | }; 39 | 40 | inline bool IsValidIndex(int i) const 41 | { 42 | return i < Num(); 43 | } 44 | 45 | 46 | inline void Add(T InputData) 47 | { 48 | Data = (T*)realloc(Data, sizeof(T) * (Count + 1)); 49 | Data[Count++] = InputData; 50 | Max = Count; 51 | }; 52 | 53 | inline void Remove(int32_t Index) 54 | { 55 | TArray NewArray; 56 | for (size_t i = 0; i < this->Count; ++i) 57 | { 58 | if (i == Index) 59 | continue; 60 | 61 | NewArray.Add(this->operator[](i)); 62 | } 63 | this->Data = (T*)realloc(NewArray.Data, sizeof(T) * (NewArray.Count)); 64 | this->Count = NewArray.Count; 65 | this->Max = NewArray.Count; 66 | } 67 | }; 68 | 69 | struct FString : private TArray 70 | { 71 | FString() 72 | { 73 | }; 74 | 75 | FString(const wchar_t* other) 76 | { 77 | Max = Count = *other ? std::wcslen(other) + 1 : 0; 78 | 79 | if (Count) 80 | { 81 | Data = const_cast(other); 82 | } 83 | } 84 | 85 | bool IsValid() const 86 | { 87 | return Data != nullptr; 88 | } 89 | 90 | const wchar_t* ToWString() const 91 | { 92 | return Data; 93 | } 94 | 95 | std::string ToString() const 96 | { 97 | auto length = std::wcslen(Data); 98 | 99 | std::string str(length, '\0'); 100 | 101 | std::use_facet>(std::locale()).narrow(Data, Data + length, '?', &str[0]); 102 | 103 | return str; 104 | } 105 | }; 106 | 107 | 108 | class FName 109 | { 110 | public: 111 | int32_t ComparisonIndex; 112 | int32_t Number; 113 | 114 | inline std::string ToString() const { 115 | FString outname; 116 | reinterpret_cast<__int64(*)(const FName*, FString*)>(Offsets::FName_ToString)(this,&outname); 117 | return outname.ToString(); 118 | } 119 | }; 120 | 121 | 122 | class UObject 123 | { 124 | public: 125 | void* Vft; 126 | int32_t Flags; 127 | int32_t Index; 128 | UObject* Class; 129 | FName Name; 130 | class UObject* Outer; 131 | 132 | std::string GetName() 133 | { 134 | return Name.ToString(); 135 | } 136 | 137 | std::string GetFullName() 138 | { 139 | std::string temp; 140 | 141 | for (auto outer = Outer; outer; outer = outer->Outer) 142 | { 143 | temp = outer->GetName() + "." + temp; 144 | } 145 | 146 | temp = reinterpret_cast(Class)->GetName() + " " + temp + this->GetName(); 147 | return temp; 148 | } 149 | 150 | inline bool ProcessEvent(UObject* pFunction, void* pParams) 151 | { 152 | auto vtable = *reinterpret_cast(this); 153 | auto ProcesseventVtable = static_cast(vtable[Offsets::ProcessEvent_VTableIndex]); if (!ProcesseventVtable) return false; 154 | ProcesseventVtable(this, pFunction, pParams); 155 | return true; 156 | } 157 | }; 158 | 159 | 160 | class FField; 161 | 162 | 163 | class FFieldVariant 164 | { 165 | public: 166 | union FFieldObjectUnion 167 | { 168 | FField* Field; 169 | UObject* Object; 170 | } Container; 171 | }; 172 | 173 | class FField 174 | { 175 | public: 176 | void* VTableObject; 177 | UObject* ClassPrivate; 178 | FFieldVariant Owner; 179 | FField* Next; 180 | FName NamePrivate; 181 | }; 182 | 183 | 184 | template 185 | class TEnumAsByte 186 | { 187 | public: 188 | TEnumAsByte() 189 | { 190 | } 191 | 192 | TEnumAsByte(TEnum _value) 193 | : value(static_cast(_value)) 194 | { 195 | } 196 | 197 | explicit TEnumAsByte(int32_t _value) 198 | : value(static_cast(_value)) 199 | { 200 | } 201 | 202 | explicit TEnumAsByte(uint8_t _value) 203 | : value(_value) 204 | { 205 | } 206 | 207 | operator TEnum() const 208 | { 209 | return static_cast(value); 210 | } 211 | 212 | TEnum GetValue() const 213 | { 214 | return static_cast(value); 215 | } 216 | 217 | private: 218 | uint8_t value; 219 | }; 220 | 221 | 222 | struct FProperty : FField 223 | { 224 | int32_t ArrayDim; 225 | int32_t ElementSize; 226 | EPropertyFlags PropertyFlags; 227 | uint16_t RepIndex; 228 | TEnumAsByte BlueprintReplicationCondition; 229 | int32_t Offset_Internal; 230 | FName RepNotifyFunc; 231 | FProperty* PropertyLinkNext; 232 | FProperty* NextRef; 233 | FProperty* DestructorLinkNext; 234 | FProperty* PostConstructLinkNext; 235 | }; 236 | 237 | class UField : public UObject 238 | { 239 | public: 240 | UField* Next; 241 | }; 242 | 243 | class UStruct : public UField 244 | { 245 | public: 246 | uint8_t Pad_38[0x10]; 247 | class UStruct* Super; 248 | class UField* Children; 249 | class FField* ChildProperties; 250 | int32_t Size; 251 | int32_t MinAlignemnt; 252 | uint8_t Pad_39[0x50]; 253 | }; 254 | 255 | 256 | using FNativeFuncPtr = void (*)(void* Context, void* TheStack, void* Result); 257 | 258 | class UFunction : public UStruct 259 | { 260 | public: 261 | uint32_t FunctionFlags; 262 | uint8_t Pad_3F[0x20]; 263 | FNativeFuncPtr ExecFunction; 264 | }; 265 | 266 | struct FNativeFunctionLookup 267 | { 268 | FName Name; 269 | void* Pointer; 270 | }; 271 | 272 | class UClass : public UStruct 273 | { 274 | public: 275 | void* ClassConstructor; 276 | void* ClassVTableHelperCtorCaller; 277 | void* ClassAddReferencedObjects; 278 | mutable uint32_t ClassUnique : 31; 279 | uint32_t bCooked : 1; 280 | EClassFlags ClassFlags; 281 | EClassCastFlags ClassCastFlags; 282 | UClass* ClassWithin; 283 | UObject* ClassGeneratedBy; 284 | FName ClassConfigName; 285 | TArray ClassReps; 286 | TArray NetFields; 287 | int32_t FirstOwnedClassRep = 0; 288 | UObject* ClassDefaultObject; 289 | void* SparseClassData; 290 | void* SparseClassDataStruct; 291 | char FuncMap[0x50]; 292 | char SuperFuncMap[0x50]; 293 | void* SuperFuncMapLock; 294 | TArray Interfaces; 295 | TArray ReferenceTokenStream; 296 | // TArray TokenDebugInfo; 297 | char ReferenceTokenStreamCritical[0x28]; 298 | TArray NativeFunctionLookupTable; 299 | }; 300 | 301 | 302 | 303 | 304 | struct FNameNativePtrPair 305 | { 306 | const char* NameUTF8; 307 | FNativeFuncPtr Pointer; 308 | }; 309 | 310 | 311 | struct FPilgrimHistogramSample final { 312 | int32_t OffsetMs; 313 | int32_t NumSamples; 314 | }; 315 | 316 | 317 | struct FPilgrimQuickplayPlayerPerformanceData { 318 | float Accuracy; 319 | float AverageOffset; 320 | float StandardDeviation; 321 | bool FullCombo; 322 | uint8_t Pad_9605[0x3]; 323 | int32_t NotesHit; 324 | int32_t NotesPassed; 325 | int32_t NotesMissed; 326 | int32_t TotalNotes; 327 | int32_t LongestStreak; 328 | float TimeInOverdriveMs; 329 | TArray HistogramSamples; 330 | TArray AccuracyTierCounts; 331 | }; -------------------------------------------------------------------------------- /Dependencies/minhook/MinHook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) 32 | #error MinHook supports only x86 and x64 systems. 33 | #endif 34 | 35 | #include 36 | 37 | // MinHook Error Codes. 38 | typedef enum MH_STATUS 39 | { 40 | // Unknown error. Should not be returned. 41 | MH_UNKNOWN = -1, 42 | 43 | // Successful. 44 | MH_OK = 0, 45 | 46 | // MinHook is already initialized. 47 | MH_ERROR_ALREADY_INITIALIZED, 48 | 49 | // MinHook is not initialized yet, or already uninitialized. 50 | MH_ERROR_NOT_INITIALIZED, 51 | 52 | // The hook for the specified target function is already created. 53 | MH_ERROR_ALREADY_CREATED, 54 | 55 | // The hook for the specified target function is not created yet. 56 | MH_ERROR_NOT_CREATED, 57 | 58 | // The hook for the specified target function is already enabled. 59 | MH_ERROR_ENABLED, 60 | 61 | // The hook for the specified target function is not enabled yet, or already 62 | // disabled. 63 | MH_ERROR_DISABLED, 64 | 65 | // The specified pointer is invalid. It points the address of non-allocated 66 | // and/or non-executable region. 67 | MH_ERROR_NOT_EXECUTABLE, 68 | 69 | // The specified target function cannot be hooked. 70 | MH_ERROR_UNSUPPORTED_FUNCTION, 71 | 72 | // Failed to allocate memory. 73 | MH_ERROR_MEMORY_ALLOC, 74 | 75 | // Failed to change the memory protection. 76 | MH_ERROR_MEMORY_PROTECT, 77 | 78 | // The specified module is not loaded. 79 | MH_ERROR_MODULE_NOT_FOUND, 80 | 81 | // The specified function is not found. 82 | MH_ERROR_FUNCTION_NOT_FOUND 83 | } 84 | MH_STATUS; 85 | 86 | // Can be passed as a parameter to MH_EnableHook, MH_DisableHook, 87 | // MH_QueueEnableHook or MH_QueueDisableHook. 88 | #define MH_ALL_HOOKS NULL 89 | 90 | #ifdef __cplusplus 91 | extern "C" { 92 | #endif 93 | 94 | // Initialize the MinHook library. You must call this function EXACTLY ONCE 95 | // at the beginning of your program. 96 | MH_STATUS WINAPI MH_Initialize(VOID); 97 | 98 | // Uninitialize the MinHook library. You must call this function EXACTLY 99 | // ONCE at the end of your program. 100 | MH_STATUS WINAPI MH_Uninitialize(VOID); 101 | 102 | // Creates a Hook for the specified target function, in disabled state. 103 | // Parameters: 104 | // pTarget [in] A pointer to the target function, which will be 105 | // overridden by the detour function. 106 | // pDetour [in] A pointer to the detour function, which will override 107 | // the target function. 108 | // ppOriginal [out] A pointer to the trampoline function, which will be 109 | // used to call the original target function. 110 | // This parameter can be NULL. 111 | MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); 112 | 113 | // Creates a Hook for the specified API function, in disabled state. 114 | // Parameters: 115 | // pszModule [in] A pointer to the loaded module name which contains the 116 | // target function. 117 | // pszTarget [in] A pointer to the target function name, which will be 118 | // overridden by the detour function. 119 | // pDetour [in] A pointer to the detour function, which will override 120 | // the target function. 121 | // ppOriginal [out] A pointer to the trampoline function, which will be 122 | // used to call the original target function. 123 | // This parameter can be NULL. 124 | MH_STATUS WINAPI MH_CreateHookApi( 125 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); 126 | 127 | // Creates a Hook for the specified API function, in disabled state. 128 | // Parameters: 129 | // pszModule [in] A pointer to the loaded module name which contains the 130 | // target function. 131 | // pszTarget [in] A pointer to the target function name, which will be 132 | // overridden by the detour function. 133 | // pDetour [in] A pointer to the detour function, which will override 134 | // the target function. 135 | // ppOriginal [out] A pointer to the trampoline function, which will be 136 | // used to call the original target function. 137 | // This parameter can be NULL. 138 | // ppTarget [out] A pointer to the target function, which will be used 139 | // with other functions. 140 | // This parameter can be NULL. 141 | MH_STATUS WINAPI MH_CreateHookApiEx( 142 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); 143 | 144 | // Removes an already created hook. 145 | // Parameters: 146 | // pTarget [in] A pointer to the target function. 147 | MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); 148 | 149 | // Enables an already created hook. 150 | // Parameters: 151 | // pTarget [in] A pointer to the target function. 152 | // If this parameter is MH_ALL_HOOKS, all created hooks are 153 | // enabled in one go. 154 | MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); 155 | 156 | // Disables an already created hook. 157 | // Parameters: 158 | // pTarget [in] A pointer to the target function. 159 | // If this parameter is MH_ALL_HOOKS, all created hooks are 160 | // disabled in one go. 161 | MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); 162 | 163 | // Queues to enable an already created hook. 164 | // Parameters: 165 | // pTarget [in] A pointer to the target function. 166 | // If this parameter is MH_ALL_HOOKS, all created hooks are 167 | // queued to be enabled. 168 | MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); 169 | 170 | // Queues to disable an already created hook. 171 | // Parameters: 172 | // pTarget [in] A pointer to the target function. 173 | // If this parameter is MH_ALL_HOOKS, all created hooks are 174 | // queued to be disabled. 175 | MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); 176 | 177 | // Applies all queued changes in one go. 178 | MH_STATUS WINAPI MH_ApplyQueued(VOID); 179 | 180 | // Translates the MH_STATUS to its name as a string. 181 | const char * WINAPI MH_StatusToString(MH_STATUS status); 182 | 183 | #ifdef __cplusplus 184 | } 185 | #endif 186 | 187 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /hooks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "api/api.h" 4 | #include 5 | #include "Dependencies/memcury.h" 6 | #include "Dependencies/unreal_structs.h" 7 | #include "Dependencies/minhook/MinHook.h" 8 | #include "Dependencies/globaloffsets.h" 9 | #include "Dependencies/unreal.h" 10 | #include "Dependencies/curl/curl.h" 11 | 12 | 13 | #pragma comment(lib, "Dependencies/minhook/minhook.lib") 14 | 15 | const api server = api(); 16 | 17 | namespace Hooks { 18 | 19 | #define CleanupMinHook() \ 20 | MH_DisableHook(MH_ALL_HOOKS); \ 21 | MH_Uninitialize() 22 | 23 | GSConnectionState ConnectionState = GSConnectionState::Connected; 24 | 25 | static void (*UEngine_BroadcastNetworkFailure)(UObject* Engine, UObject* World, UObject* NetDriver, unsigned int FailureType, const FString* ErrorString); 26 | static bool (*NetConnection_Tick)(UObject* Connection); 27 | static void (*UNetConnection_ReceivedPacket)(UObject* Connection, void* Reader, bool bIsReinjectedPacket, bool bDispatchPacket); 28 | static void (*UPilgrimGame_ClearHitOffsetAverage)(UObject* PilgrimGame); 29 | static __int64 (*ClientWasKickedNative)(__int64 a1, __int64 a2); 30 | static void (*ClientReturnToMainMenu)(UObject* PlayerController, __int64 Reason); 31 | static void (*ReturnToMainMenuError)(UObject* PlayerController, wchar_t** Reason); 32 | static CURLcode(*CurlEasySetOpt)(CURL* curl, CURLoption option, ...); 33 | static int (*CurlEasyGetInfo)(CURL* handle, CURLINFO info, long* resp); 34 | 35 | 36 | 37 | static void (*APlayerController_execClientWasKicked)(UObject* Context, void* Stack, void* const Z_Param__Result); 38 | static void (*PilgrimGame_OnControlMappingsRebuilt)(UObject* Context, void* Stack, void* const Z_Param__Result); 39 | static void (*UACExec)(UObject* Context, void* Stack, void* const Z_Param__Result); 40 | 41 | 42 | void __fastcall UEngine_BroadcastNetworkFailure_Hook(UObject* Engine,UObject* World,UObject* NetDriver,unsigned int FailureType,const FString* ErrorString) { 43 | if (ConnectionState == GSConnectionState::Connected) { 44 | FString Message = L"took to long to select song."; 45 | return UEngine_BroadcastNetworkFailure(Engine, World, NetDriver, 3, &Message); 46 | } 47 | return; 48 | } 49 | 50 | 51 | static bool NetConnection_Tick_Hook(UObject* Connection) 52 | { 53 | if (ConnectionState == GSConnectionState::Disconnected) return true; 54 | return NetConnection_Tick(Connection); 55 | } 56 | 57 | static void UNetConnection_ReceivedPacket_Hook(UObject* Connection, void* Reader, bool bIsReinjectedPacket, bool bDispatchPacket) 58 | { 59 | if (ConnectionState == GSConnectionState::Disconnected) return; 60 | return UNetConnection_ReceivedPacket(Connection, Reader, bIsReinjectedPacket, bDispatchPacket); 61 | } 62 | 63 | static void UPilgrimGame_ClearHitOffsetAverage_Hook(UObject* PilgrimGame) 64 | { 65 | if (ConnectionState == GSConnectionState::Disconnected) ConnectionState = GSConnectionState::Connected; 66 | return; 67 | } 68 | 69 | __int64 __fastcall ClientWasKickedNative_Hook (__int64 a1, __int64 a2) { 70 | return NULL; 71 | } 72 | 73 | 74 | static void ClientReturnToMainMenu_Hook(UObject* PlayerController, __int64 Reason) { 75 | if (ConnectionState == GSConnectionState::Disconnected) { 76 | printf("Re-Connecting Client\n"); 77 | ConnectionState = GSConnectionState::Connected; 78 | } 79 | return ClientReturnToMainMenu(PlayerController,Reason); 80 | } 81 | 82 | static void ReturnToMainMenuError_Hook(UObject* PlayerController, wchar_t** Reason) { 83 | return; 84 | } 85 | 86 | 87 | static void PilgrimGame_OnControlMappingsRebuilt_Hook(UObject* Context, void* Stack, void* const Z_Param__Result) 88 | { 89 | auto DisconnectClient = []() { 90 | std::this_thread::sleep_for(std::chrono::seconds(1)); 91 | printf("Disconnecting Client From Server\n"); 92 | if (ConnectionState == GSConnectionState::Connected) { 93 | ConnectionState = GSConnectionState::Disconnected; 94 | } 95 | }; 96 | 97 | std::thread(DisconnectClient).detach(); 98 | 99 | return PilgrimGame_OnControlMappingsRebuilt(Context, Stack, Z_Param__Result); 100 | } 101 | 102 | 103 | static void APlayerController_execClientWasKicked_Hook(UObject* Context, void* Stack, void* const Z_Param__Result) 104 | { 105 | if (ConnectionState == GSConnectionState::Disconnected) return; 106 | return APlayerController_execClientWasKicked(Context, Stack, Z_Param__Result); 107 | } 108 | 109 | 110 | static void UACFunc_Hook(UObject* Context, void* Stack, void* const Z_Param__Result) 111 | { 112 | return; 113 | } 114 | 115 | static CURLcode CurlEasySetOpt_Hook(CURL* curl, CURLoption option, ...) 116 | { 117 | va_list args; 118 | va_start(args, option); 119 | 120 | if (option == CURLOPT_URL) 121 | { 122 | const char* url = va_arg(args, const char*); 123 | 124 | // completely blackhole datarouter 125 | if (strstr(url, "datarouter") != nullptr) { 126 | url = "http://0.0.0.0/"; 127 | } 128 | 129 | return CurlEasySetOpt(curl, option, url); 130 | } 131 | 132 | CURLcode result = CurlEasySetOpt(curl, option, va_arg(args, void*)); 133 | va_end(args); 134 | 135 | return result; 136 | } 137 | 138 | static int CurlEasyGetInfo_Hook(CURL* handle, CURLINFO info, long* resp) 139 | { 140 | int r = CurlEasyGetInfo(handle, info, resp); 141 | // file:/// URLs will have a response code of 0, game checks for 2xx success code, oops 142 | if (info == CURLINFO_RESPONSE_CODE && *resp == 0) 143 | *resp = 200; 144 | return r; 145 | } 146 | 147 | static bool ApplyHooks() 148 | { 149 | if (MH_Initialize() != MH_OK) { 150 | printf("Failed to Initialize Minhook!\n"); 151 | CleanupMinHook(); 152 | return false; 153 | } 154 | 155 | MH_CreateHook((LPVOID)Offsets::NetConnection_Tick, NetConnection_Tick_Hook, (LPVOID*)&NetConnection_Tick); 156 | MH_EnableHook((LPVOID)Offsets::NetConnection_Tick); 157 | 158 | MH_CreateHook((LPVOID)Offsets::ReceivedPacket, UNetConnection_ReceivedPacket_Hook, (LPVOID*)&UNetConnection_ReceivedPacket); 159 | MH_EnableHook((LPVOID)Offsets::ReceivedPacket); 160 | 161 | MH_CreateHook((LPVOID)Offsets::ClearHitOffsetAverage, UPilgrimGame_ClearHitOffsetAverage_Hook, (LPVOID*)&UPilgrimGame_ClearHitOffsetAverage); 162 | MH_EnableHook((LPVOID)Offsets::ClearHitOffsetAverage); 163 | 164 | MH_CreateHook((LPVOID)Offsets::ClientWasKickedNative, ClientWasKickedNative_Hook , (LPVOID*)&ClientWasKickedNative); 165 | MH_EnableHook((LPVOID)Offsets::ClientWasKickedNative); 166 | 167 | MH_CreateHook((LPVOID)Offsets::BroadcastNetworkFailure, UEngine_BroadcastNetworkFailure_Hook, (LPVOID*)&UEngine_BroadcastNetworkFailure); 168 | MH_EnableHook((LPVOID)Offsets::BroadcastNetworkFailure); 169 | 170 | MH_CreateHook((LPVOID)Offsets::ClientReturnToMainMenu, ClientReturnToMainMenu_Hook, (LPVOID*)&ClientReturnToMainMenu); 171 | MH_EnableHook((LPVOID)Offsets::ClientReturnToMainMenu); 172 | 173 | MH_CreateHook((LPVOID)Offsets::ReturnToMainMenuError, ReturnToMainMenuError_Hook, (LPVOID*)&ReturnToMainMenuError); 174 | MH_EnableHook((LPVOID)Offsets::ReturnToMainMenuError); 175 | 176 | MH_CreateHook((LPVOID)Offsets::OnControlMappingsRebuilt, PilgrimGame_OnControlMappingsRebuilt_Hook, (LPVOID*)&PilgrimGame_OnControlMappingsRebuilt); 177 | MH_EnableHook((LPVOID)Offsets::OnControlMappingsRebuilt); 178 | 179 | MH_CreateHook((LPVOID)Offsets::CurlEasySetOpt, CurlEasySetOpt_Hook, (LPVOID*)&CurlEasySetOpt); 180 | MH_EnableHook((LPVOID)Offsets::CurlEasySetOpt); 181 | 182 | MH_CreateHook((LPVOID)Offsets::CurlEasyGetInfo, CurlEasyGetInfo_Hook, (LPVOID*)&CurlEasyGetInfo); 183 | MH_EnableHook((LPVOID)Offsets::CurlEasyGetInfo); 184 | 185 | MH_CreateHook((LPVOID)Offsets::UAC_SendClientHello, UACFunc_Hook, (LPVOID*)&UACExec); 186 | //MH_EnableHook((LPVOID)Offsets::UAC_SendClientHello); 187 | 188 | MH_CreateHook((LPVOID)Offsets::UAC_SendPacketToClient, UACFunc_Hook, (LPVOID*)&UACExec); 189 | //MH_EnableHook((LPVOID)Offsets::UAC_SendPacketToClient); 190 | 191 | MH_CreateHook((LPVOID)Offsets::UAC_SendPacketToServer, UACFunc_Hook, (LPVOID*)&UACExec); 192 | // MH_EnableHook((LPVOID)Offsets::UAC_SendPacketToServer); 193 | 194 | return true; 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /FestNet.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {507e02a4-f6f2-414e-9cfd-8c1e544e3c83} 25 | FestNet 26 | 10.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;FESTNET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 78 | true 79 | Use 80 | pch.h 81 | 82 | 83 | Windows 84 | true 85 | false 86 | 87 | 88 | 89 | 90 | Level3 91 | true 92 | true 93 | true 94 | WIN32;NDEBUG;FESTNET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 95 | true 96 | Use 97 | pch.h 98 | 99 | 100 | Windows 101 | true 102 | true 103 | true 104 | false 105 | 106 | 107 | 108 | 109 | Level3 110 | true 111 | _DEBUG;FESTNET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 112 | true 113 | NotUsing 114 | pch.h 115 | stdcpp17 116 | 117 | 118 | Windows 119 | true 120 | false 121 | 122 | 123 | 124 | 125 | Level3 126 | true 127 | true 128 | true 129 | NDEBUG;FESTNET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 130 | true 131 | NotUsing 132 | pch.h 133 | stdcpp17 134 | MultiThreadedDebug 135 | 136 | 137 | Windows 138 | true 139 | true 140 | true 141 | false 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /api/api.cpp: -------------------------------------------------------------------------------- 1 | #include "api.h" 2 | 3 | 4 | 5 | std::string api::get_query_param(const httplib::Request& req, const std::string& name) { 6 | auto it = req.params.find(name); 7 | if (it != req.params.end()) { 8 | return it->second; 9 | } 10 | return ""; 11 | } 12 | 13 | 14 | size_t api::WriteCallback(char* contents, size_t size, size_t nmemb, void* userp) 15 | { 16 | ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; 17 | } 18 | 19 | void api::Init() 20 | { 21 | auto createserver = []() { 22 | httplib::Server server; 23 | 24 | baseconfigdirectory = "festnet"; 25 | songsconfigpath = baseconfigdirectory + "/songs.json"; 26 | 27 | 28 | auto createsongsconfig = [](std::string songsconfigpath) { 29 | std::ofstream outFile(songsconfigpath); 30 | if (outFile) { 31 | outFile << "[]"; 32 | } 33 | else { 34 | std::cerr << "Failed to create song config." << std::endl; 35 | } 36 | }; 37 | 38 | if (!fs::exists(baseconfigdirectory)) { 39 | if (fs::create_directory(baseconfigdirectory)) { 40 | createsongsconfig(songsconfigpath); 41 | cachedsongs = json::array(); 42 | } 43 | else { 44 | std::cerr << "Failed to create festnet folder." << std::endl; 45 | } 46 | } 47 | else { 48 | if (!fs::exists(songsconfigpath)) { 49 | createsongsconfig(songsconfigpath); 50 | } 51 | else { 52 | std::ifstream songconfigstream(songsconfigpath); 53 | if (!songconfigstream) { 54 | std::cerr << "Failed to get song config: " << songsconfigpath << std::endl; 55 | return; 56 | } 57 | 58 | songconfigstream >> cachedsongs; 59 | } 60 | } 61 | 62 | server.Get("/", Handle_MainPage); 63 | server.Post("/addsong", Handle_AddSong); 64 | server.Post("/removesong", Handle_RemoveSong); 65 | server.Get("/songs", Handle_GetSongs); 66 | server.Get("/getactive", Handle_GetActiveSong); 67 | server.Post("/setactive", Handle_SetActiveSong); 68 | server.Get("/getplaylist", Handle_GetPlaylist); 69 | server.Post("/removeactive", Handle_RemoveActive); 70 | 71 | 72 | std::string host = "localhost"; 73 | 74 | std::cout << "Starting server on " << host << ":" << HTTP_SERVER_PORT << "..." << std::endl; 75 | 76 | if (!server.listen(host.c_str(), HTTP_SERVER_PORT)) { 77 | std::cerr << "Error: Failed to start server on " << host << ":" << HTTP_SERVER_PORT << std::endl; 78 | return; 79 | } 80 | 81 | std::cout << "Server started successfully." << std::endl; 82 | }; 83 | 84 | std::thread cs(createserver); 85 | cs.join(); 86 | } 87 | 88 | void api::Handle_AddSong(const httplib::Request& req, httplib::Response& res) { 89 | 90 | json payload = nlohmann::json::parse(req.body); 91 | 92 | std::string id = payload["id"].get(); 93 | std::string name = payload["name"].get(); 94 | std::string midipath = payload["midipath"].get(); 95 | std::string imageurl = payload["imageurl"].get(); 96 | std::string songSegmentDir = payload["songSegmentDir"].get(); 97 | 98 | if (name.length() == 0 || id.length() == 0 || imageurl.length() == 0 || midipath.length() == 0 || songSegmentDir.length() == 0) { 99 | res.set_content("invalid request", "text/html"); 100 | res.status = 400; 101 | return; 102 | } 103 | 104 | json obj = { 105 | {"id", id}, 106 | {"name", name}, 107 | {"midipath", midipath}, 108 | {"imageurl", imageurl}, 109 | {"songSegmentDir", songSegmentDir} 110 | }; 111 | 112 | cachedsongs.push_back(obj); 113 | 114 | 115 | std::ofstream songconfigstream(songsconfigpath); 116 | if (!songconfigstream) { 117 | res.set_content("Failed to get song config when adding song", "text/html"); 118 | res.status = 500; 119 | return; 120 | } 121 | 122 | 123 | songconfigstream << cachedsongs.dump(4); 124 | songconfigstream.close(); 125 | } 126 | 127 | void api::Handle_RemoveSong(const httplib::Request& req, httplib::Response& res) { 128 | std::string id = get_query_param(req, "id"); 129 | 130 | if (id.length() == 0) { 131 | res.set_content("Invalid request: id is required", "text/html"); 132 | res.status = 400; 133 | return; 134 | } 135 | 136 | bool found = false; 137 | 138 | for (json::iterator it = cachedsongs.begin(); it != cachedsongs.end(); ++it) { 139 | std::string objid = (*it)["id"].get(); 140 | 141 | if (objid == id) { 142 | cachedsongs.erase(it); 143 | found = true; 144 | break; 145 | } 146 | } 147 | 148 | if (!found) { 149 | res.set_content("Failed to find song with the specified id", "text/html"); 150 | res.status = 404; 151 | return; 152 | } 153 | 154 | std::ofstream songconfigstream(songsconfigpath); 155 | if (!songconfigstream) { 156 | res.set_content("Failed to open song config file for writing", "text/html"); 157 | res.status = 500; 158 | return; 159 | } 160 | 161 | songconfigstream << cachedsongs.dump(4); 162 | songconfigstream.close(); 163 | 164 | res.status = 200; 165 | } 166 | 167 | 168 | void api::Handle_RemoveActive(const httplib::Request& req, httplib::Response& res) { 169 | if (hasactivesong) { 170 | hasactivesong = false; 171 | res.status = 200; 172 | } 173 | else { 174 | res.status = 404; 175 | res.set_content("no active song found", "text/html"); 176 | } 177 | } 178 | 179 | void api::Handle_GetSongs(const httplib::Request& req, httplib::Response& res) { 180 | res.status = 200; 181 | res.set_content(cachedsongs.dump(), "text/html"); 182 | } 183 | 184 | void api::Handle_GetActiveSong(const httplib::Request& req, httplib::Response& res) { 185 | res.status = 200; 186 | res.set_content(GetActiveSongID(), "text/html"); 187 | } 188 | 189 | void api::Handle_GetPlaylist(const httplib::Request& req, httplib::Response& res) 190 | { 191 | SongEntry Song = activesong; 192 | 193 | std::string manifest_path = activesong.SegmentDir + "\\Manifest.mpd"; 194 | res.set_content("tbd", ""); 195 | } 196 | 197 | void api::Handle_SetActiveSong(const httplib::Request& req, httplib::Response& res) { 198 | std::string id = get_query_param(req, "id"); 199 | if (id.size() > 0) { 200 | bool found = false; 201 | SongEntry entry; 202 | for (json::iterator it = cachedsongs.begin(); it != cachedsongs.end(); ++it) { 203 | std::string objid = (*it)["id"].get(); 204 | 205 | if (objid == id) { 206 | std::string midipath = (*it)["midipath"].get(); 207 | std::string songSegmentDir = (*it)["songSegmentDir"].get(); 208 | std::string name = (*it)["name"].get(); 209 | 210 | if (midipath.length() > 0 || songSegmentDir.length() > 0 || name.length() > 0) { 211 | entry.id = objid; 212 | entry.Name = name; 213 | entry.SegmentDir = songSegmentDir; 214 | entry.MidiPath = midipath; 215 | activesong = entry; 216 | found = true; 217 | hasactivesong = true; 218 | } 219 | else { 220 | res.status = 400; 221 | res.set_content("failed to set active song (corrupted object)", "text/html"); 222 | } 223 | break; 224 | } 225 | } 226 | return; 227 | } 228 | else { 229 | res.status = 404; 230 | res.set_content("failed to find id in active song request", "text/html"); 231 | } 232 | } 233 | 234 | 235 | 236 | void api::Handle_MainPage(const httplib::Request& req, httplib::Response& res) 237 | { 238 | CURL* curl; 239 | CURLcode response; 240 | std::string readBuffer; 241 | 242 | curl = curl_easy_init(); 243 | if (curl) { 244 | curl_easy_setopt(curl, CURLOPT_URL, "https://gist.githubusercontent.com/spiritascend/9e361bf72dc1cda35811e1b19dd5c4b4/raw"); 245 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); 246 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); 247 | 248 | response = curl_easy_perform(curl); 249 | if (response != CURLE_OK) { 250 | fprintf(stderr, "Failed to send handle_mainpage request: %s\n", curl_easy_strerror(response)); 251 | res.status = 500; 252 | res.set_content("Failed to fetch static HTML content", "text/html"); 253 | } 254 | else if (readBuffer.empty()) { 255 | fprintf(stderr, "Empty response body received from handle_mainpage request\n"); 256 | res.status = 404; 257 | res.set_content("Static HTML content not found", "text/html"); 258 | } 259 | else { 260 | res.set_content(readBuffer, "text/html"); 261 | } 262 | 263 | curl_easy_cleanup(curl); 264 | } 265 | else { 266 | fprintf(stderr, "Failed to initialize CURL\n"); 267 | res.status = 500; 268 | res.set_content("Failed to initialize CURL", "text/html"); 269 | } 270 | } 271 | -------------------------------------------------------------------------------- /api/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FestNet 9 | 192 | 193 | 194 |
195 |

Songs

196 |
197 |
198 |
199 |
200 | 201 |
202 |
203 | 204 |
205 |
206 | 207 |
208 |
209 | 210 |
211 | 212 |
213 |
214 |
215 |
216 | 320 | 321 | -------------------------------------------------------------------------------- /Dependencies/curl/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MULTI_H 2 | #define CURLINC_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | /* 27 | This is an "external" header file. Don't give away any internals here! 28 | 29 | GOALS 30 | 31 | o Enable a "pull" interface. The application that uses libcurl decides where 32 | and when to ask libcurl to get/send data. 33 | 34 | o Enable multiple simultaneous transfers in the same thread without making it 35 | complicated for the application. 36 | 37 | o Enable the application to select() on its own file descriptors and curl's 38 | file descriptors simultaneous easily. 39 | 40 | */ 41 | 42 | /* 43 | * This header file should not really need to include "curl.h" since curl.h 44 | * itself includes this file and we expect user applications to do #include 45 | * without the need for especially including multi.h. 46 | * 47 | * For some reason we added this include here at one point, and rather than to 48 | * break existing (wrongly written) libcurl applications, we leave it as-is 49 | * but with this warning attached. 50 | */ 51 | #include "curl.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 58 | typedef struct Curl_multi CURLM; 59 | #else 60 | typedef void CURLM; 61 | #endif 62 | 63 | typedef enum { 64 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 65 | curl_multi_socket*() soon */ 66 | CURLM_OK, 67 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 68 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 69 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 70 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 71 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 72 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 73 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 74 | attempted to get added - again */ 75 | CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a 76 | callback */ 77 | CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */ 78 | CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */ 79 | CURLM_ABORTED_BY_CALLBACK, 80 | CURLM_UNRECOVERABLE_POLL, 81 | CURLM_LAST 82 | } CURLMcode; 83 | 84 | /* just to make code nicer when using curl_multi_socket() you can now check 85 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 86 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 87 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 88 | 89 | /* bitmask bits for CURLMOPT_PIPELINING */ 90 | #define CURLPIPE_NOTHING 0L 91 | #define CURLPIPE_HTTP1 1L 92 | #define CURLPIPE_MULTIPLEX 2L 93 | 94 | typedef enum { 95 | CURLMSG_NONE, /* first, not used */ 96 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 97 | the CURLcode of the transfer */ 98 | CURLMSG_LAST /* last, not used */ 99 | } CURLMSG; 100 | 101 | struct CURLMsg { 102 | CURLMSG msg; /* what this message means */ 103 | CURL *easy_handle; /* the handle it concerns */ 104 | union { 105 | void *whatever; /* message-specific data */ 106 | CURLcode result; /* return code for transfer */ 107 | } data; 108 | }; 109 | typedef struct CURLMsg CURLMsg; 110 | 111 | /* Based on poll(2) structure and values. 112 | * We don't use pollfd and POLL* constants explicitly 113 | * to cover platforms without poll(). */ 114 | #define CURL_WAIT_POLLIN 0x0001 115 | #define CURL_WAIT_POLLPRI 0x0002 116 | #define CURL_WAIT_POLLOUT 0x0004 117 | 118 | struct curl_waitfd { 119 | curl_socket_t fd; 120 | short events; 121 | short revents; /* not supported yet */ 122 | }; 123 | 124 | /* 125 | * Name: curl_multi_init() 126 | * 127 | * Desc: initialize multi-style curl usage 128 | * 129 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 130 | */ 131 | CURL_EXTERN CURLM *curl_multi_init(void); 132 | 133 | /* 134 | * Name: curl_multi_add_handle() 135 | * 136 | * Desc: add a standard curl handle to the multi stack 137 | * 138 | * Returns: CURLMcode type, general multi error code. 139 | */ 140 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 141 | CURL *curl_handle); 142 | 143 | /* 144 | * Name: curl_multi_remove_handle() 145 | * 146 | * Desc: removes a curl handle from the multi stack again 147 | * 148 | * Returns: CURLMcode type, general multi error code. 149 | */ 150 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 151 | CURL *curl_handle); 152 | 153 | /* 154 | * Name: curl_multi_fdset() 155 | * 156 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 157 | * poll() on. We want curl_multi_perform() called as soon as one of 158 | * them are ready. 159 | * 160 | * Returns: CURLMcode type, general multi error code. 161 | */ 162 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 163 | fd_set *read_fd_set, 164 | fd_set *write_fd_set, 165 | fd_set *exc_fd_set, 166 | int *max_fd); 167 | 168 | /* 169 | * Name: curl_multi_wait() 170 | * 171 | * Desc: Poll on all fds within a CURLM set as well as any 172 | * additional fds passed to the function. 173 | * 174 | * Returns: CURLMcode type, general multi error code. 175 | */ 176 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 177 | struct curl_waitfd extra_fds[], 178 | unsigned int extra_nfds, 179 | int timeout_ms, 180 | int *ret); 181 | 182 | /* 183 | * Name: curl_multi_poll() 184 | * 185 | * Desc: Poll on all fds within a CURLM set as well as any 186 | * additional fds passed to the function. 187 | * 188 | * Returns: CURLMcode type, general multi error code. 189 | */ 190 | CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, 191 | struct curl_waitfd extra_fds[], 192 | unsigned int extra_nfds, 193 | int timeout_ms, 194 | int *ret); 195 | 196 | /* 197 | * Name: curl_multi_wakeup() 198 | * 199 | * Desc: wakes up a sleeping curl_multi_poll call. 200 | * 201 | * Returns: CURLMcode type, general multi error code. 202 | */ 203 | CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); 204 | 205 | /* 206 | * Name: curl_multi_perform() 207 | * 208 | * Desc: When the app thinks there's data available for curl it calls this 209 | * function to read/write whatever there is right now. This returns 210 | * as soon as the reads and writes are done. This function does not 211 | * require that there actually is data available for reading or that 212 | * data can be written, it can be called just in case. It returns 213 | * the number of handles that still transfer data in the second 214 | * argument's integer-pointer. 215 | * 216 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 217 | * returns errors etc regarding the whole multi stack. There might 218 | * still have occurred problems on individual transfers even when 219 | * this returns OK. 220 | */ 221 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 222 | int *running_handles); 223 | 224 | /* 225 | * Name: curl_multi_cleanup() 226 | * 227 | * Desc: Cleans up and removes a whole multi stack. It does not free or 228 | * touch any individual easy handles in any way. We need to define 229 | * in what state those handles will be if this function is called 230 | * in the middle of a transfer. 231 | * 232 | * Returns: CURLMcode type, general multi error code. 233 | */ 234 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 235 | 236 | /* 237 | * Name: curl_multi_info_read() 238 | * 239 | * Desc: Ask the multi handle if there's any messages/informationals from 240 | * the individual transfers. Messages include informationals such as 241 | * error code from the transfer or just the fact that a transfer is 242 | * completed. More details on these should be written down as well. 243 | * 244 | * Repeated calls to this function will return a new struct each 245 | * time, until a special "end of msgs" struct is returned as a signal 246 | * that there is no more to get at this point. 247 | * 248 | * The data the returned pointer points to will not survive calling 249 | * curl_multi_cleanup(). 250 | * 251 | * The 'CURLMsg' struct is meant to be very simple and only contain 252 | * very basic information. If more involved information is wanted, 253 | * we will provide the particular "transfer handle" in that struct 254 | * and that should/could/would be used in subsequent 255 | * curl_easy_getinfo() calls (or similar). The point being that we 256 | * must never expose complex structs to applications, as then we'll 257 | * undoubtably get backwards compatibility problems in the future. 258 | * 259 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 260 | * of structs. It also writes the number of messages left in the 261 | * queue (after this read) in the integer the second argument points 262 | * to. 263 | */ 264 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 265 | int *msgs_in_queue); 266 | 267 | /* 268 | * Name: curl_multi_strerror() 269 | * 270 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 271 | * value into the equivalent human readable error string. This is 272 | * useful for printing meaningful error messages. 273 | * 274 | * Returns: A pointer to a null-terminated error message. 275 | */ 276 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 277 | 278 | /* 279 | * Name: curl_multi_socket() and 280 | * curl_multi_socket_all() 281 | * 282 | * Desc: An alternative version of curl_multi_perform() that allows the 283 | * application to pass in one of the file descriptors that have been 284 | * detected to have "action" on them and let libcurl perform. 285 | * See man page for details. 286 | */ 287 | #define CURL_POLL_NONE 0 288 | #define CURL_POLL_IN 1 289 | #define CURL_POLL_OUT 2 290 | #define CURL_POLL_INOUT 3 291 | #define CURL_POLL_REMOVE 4 292 | 293 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 294 | 295 | #define CURL_CSELECT_IN 0x01 296 | #define CURL_CSELECT_OUT 0x02 297 | #define CURL_CSELECT_ERR 0x04 298 | 299 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 300 | curl_socket_t s, /* socket */ 301 | int what, /* see above */ 302 | void *userp, /* private callback 303 | pointer */ 304 | void *socketp); /* private socket 305 | pointer */ 306 | /* 307 | * Name: curl_multi_timer_callback 308 | * 309 | * Desc: Called by libcurl whenever the library detects a change in the 310 | * maximum number of milliseconds the app is allowed to wait before 311 | * curl_multi_socket() or curl_multi_perform() must be called 312 | * (to allow libcurl's timed events to take place). 313 | * 314 | * Returns: The callback should return zero. 315 | */ 316 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 317 | long timeout_ms, /* see above */ 318 | void *userp); /* private callback 319 | pointer */ 320 | 321 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 322 | int *running_handles); 323 | 324 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 325 | curl_socket_t s, 326 | int ev_bitmask, 327 | int *running_handles); 328 | 329 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 330 | int *running_handles); 331 | 332 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 333 | /* This macro below was added in 7.16.3 to push users who recompile to use 334 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 335 | */ 336 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 337 | #endif 338 | 339 | /* 340 | * Name: curl_multi_timeout() 341 | * 342 | * Desc: Returns the maximum number of milliseconds the app is allowed to 343 | * wait before curl_multi_socket() or curl_multi_perform() must be 344 | * called (to allow libcurl's timed events to take place). 345 | * 346 | * Returns: CURLM error code. 347 | */ 348 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 349 | long *milliseconds); 350 | 351 | typedef enum { 352 | /* This is the socket callback function pointer */ 353 | CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), 354 | 355 | /* This is the argument passed to the socket callback */ 356 | CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), 357 | 358 | /* set to 1 to enable pipelining for this multi handle */ 359 | CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), 360 | 361 | /* This is the timer callback function pointer */ 362 | CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), 363 | 364 | /* This is the argument passed to the timer callback */ 365 | CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), 366 | 367 | /* maximum number of entries in the connection cache */ 368 | CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), 369 | 370 | /* maximum number of (pipelining) connections to one host */ 371 | CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), 372 | 373 | /* maximum number of requests in a pipeline */ 374 | CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), 375 | 376 | /* a connection with a content-length longer than this 377 | will not be considered for pipelining */ 378 | CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), 379 | 380 | /* a connection with a chunk length longer than this 381 | will not be considered for pipelining */ 382 | CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), 383 | 384 | /* a list of site names(+port) that are blocked from pipelining */ 385 | CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), 386 | 387 | /* a list of server types that are blocked from pipelining */ 388 | CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), 389 | 390 | /* maximum number of open connections in total */ 391 | CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), 392 | 393 | /* This is the server push callback function pointer */ 394 | CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), 395 | 396 | /* This is the argument passed to the server push callback */ 397 | CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), 398 | 399 | /* maximum number of concurrent streams to support on a connection */ 400 | CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), 401 | 402 | CURLMOPT_LASTENTRY /* the last unused */ 403 | } CURLMoption; 404 | 405 | 406 | /* 407 | * Name: curl_multi_setopt() 408 | * 409 | * Desc: Sets options for the multi handle. 410 | * 411 | * Returns: CURLM error code. 412 | */ 413 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 414 | CURLMoption option, ...); 415 | 416 | 417 | /* 418 | * Name: curl_multi_assign() 419 | * 420 | * Desc: This function sets an association in the multi handle between the 421 | * given socket and a private pointer of the application. This is 422 | * (only) useful for curl_multi_socket uses. 423 | * 424 | * Returns: CURLM error code. 425 | */ 426 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 427 | curl_socket_t sockfd, void *sockp); 428 | 429 | 430 | /* 431 | * Name: curl_push_callback 432 | * 433 | * Desc: This callback gets called when a new stream is being pushed by the 434 | * server. It approves or denies the new stream. It can also decide 435 | * to completely fail the connection. 436 | * 437 | * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT 438 | */ 439 | #define CURL_PUSH_OK 0 440 | #define CURL_PUSH_DENY 1 441 | #define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */ 442 | 443 | struct curl_pushheaders; /* forward declaration only */ 444 | 445 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, 446 | size_t num); 447 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, 448 | const char *name); 449 | 450 | typedef int (*curl_push_callback)(CURL *parent, 451 | CURL *easy, 452 | size_t num_headers, 453 | struct curl_pushheaders *headers, 454 | void *userp); 455 | 456 | #ifdef __cplusplus 457 | } /* end of extern "C" */ 458 | #endif 459 | 460 | #endif 461 | -------------------------------------------------------------------------------- /Dependencies/curl/system.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_SYSTEM_H 2 | #define CURLINC_SYSTEM_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* 28 | * Try to keep one section per platform, compiler and architecture, otherwise, 29 | * if an existing section is reused for a different one and later on the 30 | * original is adjusted, probably the piggybacking one can be adversely 31 | * changed. 32 | * 33 | * In order to differentiate between platforms/compilers/architectures use 34 | * only compiler built in predefined preprocessor symbols. 35 | * 36 | * curl_off_t 37 | * ---------- 38 | * 39 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit 40 | * wide signed integral data type. The width of this data type must remain 41 | * constant and independent of any possible large file support settings. 42 | * 43 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit 44 | * wide signed integral data type if there is no 64-bit type. 45 | * 46 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall 47 | * only be violated if off_t is the only 64-bit data type available and the 48 | * size of off_t is independent of large file support settings. Keep your 49 | * build on the safe side avoiding an off_t gating. If you have a 64-bit 50 | * off_t then take for sure that another 64-bit data type exists, dig deeper 51 | * and you will find it. 52 | * 53 | */ 54 | 55 | #if defined(__DJGPP__) || defined(__GO32__) 56 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 57 | # define CURL_TYPEOF_CURL_OFF_T long long 58 | # define CURL_FORMAT_CURL_OFF_T "lld" 59 | # define CURL_FORMAT_CURL_OFF_TU "llu" 60 | # define CURL_SUFFIX_CURL_OFF_T LL 61 | # define CURL_SUFFIX_CURL_OFF_TU ULL 62 | # else 63 | # define CURL_TYPEOF_CURL_OFF_T long 64 | # define CURL_FORMAT_CURL_OFF_T "ld" 65 | # define CURL_FORMAT_CURL_OFF_TU "lu" 66 | # define CURL_SUFFIX_CURL_OFF_T L 67 | # define CURL_SUFFIX_CURL_OFF_TU UL 68 | # endif 69 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 70 | 71 | #elif defined(__SALFORDC__) 72 | # define CURL_TYPEOF_CURL_OFF_T long 73 | # define CURL_FORMAT_CURL_OFF_T "ld" 74 | # define CURL_FORMAT_CURL_OFF_TU "lu" 75 | # define CURL_SUFFIX_CURL_OFF_T L 76 | # define CURL_SUFFIX_CURL_OFF_TU UL 77 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 78 | 79 | #elif defined(__BORLANDC__) 80 | # if (__BORLANDC__ < 0x520) 81 | # define CURL_TYPEOF_CURL_OFF_T long 82 | # define CURL_FORMAT_CURL_OFF_T "ld" 83 | # define CURL_FORMAT_CURL_OFF_TU "lu" 84 | # define CURL_SUFFIX_CURL_OFF_T L 85 | # define CURL_SUFFIX_CURL_OFF_TU UL 86 | # else 87 | # define CURL_TYPEOF_CURL_OFF_T __int64 88 | # define CURL_FORMAT_CURL_OFF_T "I64d" 89 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 90 | # define CURL_SUFFIX_CURL_OFF_T i64 91 | # define CURL_SUFFIX_CURL_OFF_TU ui64 92 | # endif 93 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 94 | 95 | #elif defined(__TURBOC__) 96 | # define CURL_TYPEOF_CURL_OFF_T long 97 | # define CURL_FORMAT_CURL_OFF_T "ld" 98 | # define CURL_FORMAT_CURL_OFF_TU "lu" 99 | # define CURL_SUFFIX_CURL_OFF_T L 100 | # define CURL_SUFFIX_CURL_OFF_TU UL 101 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 102 | 103 | #elif defined(__POCC__) 104 | # if (__POCC__ < 280) 105 | # define CURL_TYPEOF_CURL_OFF_T long 106 | # define CURL_FORMAT_CURL_OFF_T "ld" 107 | # define CURL_FORMAT_CURL_OFF_TU "lu" 108 | # define CURL_SUFFIX_CURL_OFF_T L 109 | # define CURL_SUFFIX_CURL_OFF_TU UL 110 | # elif defined(_MSC_VER) 111 | # define CURL_TYPEOF_CURL_OFF_T __int64 112 | # define CURL_FORMAT_CURL_OFF_T "I64d" 113 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 114 | # define CURL_SUFFIX_CURL_OFF_T i64 115 | # define CURL_SUFFIX_CURL_OFF_TU ui64 116 | # else 117 | # define CURL_TYPEOF_CURL_OFF_T long long 118 | # define CURL_FORMAT_CURL_OFF_T "lld" 119 | # define CURL_FORMAT_CURL_OFF_TU "llu" 120 | # define CURL_SUFFIX_CURL_OFF_T LL 121 | # define CURL_SUFFIX_CURL_OFF_TU ULL 122 | # endif 123 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 124 | 125 | #elif defined(__LCC__) 126 | # if defined(__MCST__) /* MCST eLbrus Compiler Collection */ 127 | # define CURL_TYPEOF_CURL_OFF_T long 128 | # define CURL_FORMAT_CURL_OFF_T "ld" 129 | # define CURL_FORMAT_CURL_OFF_TU "lu" 130 | # define CURL_SUFFIX_CURL_OFF_T L 131 | # define CURL_SUFFIX_CURL_OFF_TU UL 132 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 133 | # define CURL_PULL_SYS_TYPES_H 1 134 | # define CURL_PULL_SYS_SOCKET_H 1 135 | # else /* Local (or Little) C Compiler */ 136 | # define CURL_TYPEOF_CURL_OFF_T long 137 | # define CURL_FORMAT_CURL_OFF_T "ld" 138 | # define CURL_FORMAT_CURL_OFF_TU "lu" 139 | # define CURL_SUFFIX_CURL_OFF_T L 140 | # define CURL_SUFFIX_CURL_OFF_TU UL 141 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 142 | # endif 143 | 144 | #elif defined(__SYMBIAN32__) 145 | # if defined(__EABI__) /* Treat all ARM compilers equally */ 146 | # define CURL_TYPEOF_CURL_OFF_T long long 147 | # define CURL_FORMAT_CURL_OFF_T "lld" 148 | # define CURL_FORMAT_CURL_OFF_TU "llu" 149 | # define CURL_SUFFIX_CURL_OFF_T LL 150 | # define CURL_SUFFIX_CURL_OFF_TU ULL 151 | # elif defined(__CW32__) 152 | # pragma longlong on 153 | # define CURL_TYPEOF_CURL_OFF_T long long 154 | # define CURL_FORMAT_CURL_OFF_T "lld" 155 | # define CURL_FORMAT_CURL_OFF_TU "llu" 156 | # define CURL_SUFFIX_CURL_OFF_T LL 157 | # define CURL_SUFFIX_CURL_OFF_TU ULL 158 | # elif defined(__VC32__) 159 | # define CURL_TYPEOF_CURL_OFF_T __int64 160 | # define CURL_FORMAT_CURL_OFF_T "lld" 161 | # define CURL_FORMAT_CURL_OFF_TU "llu" 162 | # define CURL_SUFFIX_CURL_OFF_T LL 163 | # define CURL_SUFFIX_CURL_OFF_TU ULL 164 | # endif 165 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 166 | 167 | #elif defined(__MWERKS__) 168 | # define CURL_TYPEOF_CURL_OFF_T long long 169 | # define CURL_FORMAT_CURL_OFF_T "lld" 170 | # define CURL_FORMAT_CURL_OFF_TU "llu" 171 | # define CURL_SUFFIX_CURL_OFF_T LL 172 | # define CURL_SUFFIX_CURL_OFF_TU ULL 173 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 174 | 175 | #elif defined(_WIN32_WCE) 176 | # define CURL_TYPEOF_CURL_OFF_T __int64 177 | # define CURL_FORMAT_CURL_OFF_T "I64d" 178 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 179 | # define CURL_SUFFIX_CURL_OFF_T i64 180 | # define CURL_SUFFIX_CURL_OFF_TU ui64 181 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 182 | 183 | #elif defined(__MINGW32__) 184 | # define CURL_TYPEOF_CURL_OFF_T long long 185 | # define CURL_FORMAT_CURL_OFF_T "I64d" 186 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 187 | # define CURL_SUFFIX_CURL_OFF_T LL 188 | # define CURL_SUFFIX_CURL_OFF_TU ULL 189 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 190 | # define CURL_PULL_SYS_TYPES_H 1 191 | # define CURL_PULL_WS2TCPIP_H 1 192 | 193 | #elif defined(__VMS) 194 | # if defined(__VAX) 195 | # define CURL_TYPEOF_CURL_OFF_T long 196 | # define CURL_FORMAT_CURL_OFF_T "ld" 197 | # define CURL_FORMAT_CURL_OFF_TU "lu" 198 | # define CURL_SUFFIX_CURL_OFF_T L 199 | # define CURL_SUFFIX_CURL_OFF_TU UL 200 | # else 201 | # define CURL_TYPEOF_CURL_OFF_T long long 202 | # define CURL_FORMAT_CURL_OFF_T "lld" 203 | # define CURL_FORMAT_CURL_OFF_TU "llu" 204 | # define CURL_SUFFIX_CURL_OFF_T LL 205 | # define CURL_SUFFIX_CURL_OFF_TU ULL 206 | # endif 207 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 208 | 209 | #elif defined(__OS400__) 210 | # if defined(__ILEC400__) 211 | # define CURL_TYPEOF_CURL_OFF_T long long 212 | # define CURL_FORMAT_CURL_OFF_T "lld" 213 | # define CURL_FORMAT_CURL_OFF_TU "llu" 214 | # define CURL_SUFFIX_CURL_OFF_T LL 215 | # define CURL_SUFFIX_CURL_OFF_TU ULL 216 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 217 | # define CURL_PULL_SYS_TYPES_H 1 218 | # define CURL_PULL_SYS_SOCKET_H 1 219 | # endif 220 | 221 | #elif defined(__MVS__) 222 | # if defined(__IBMC__) || defined(__IBMCPP__) 223 | # if defined(_ILP32) 224 | # elif defined(_LP64) 225 | # endif 226 | # if defined(_LONG_LONG) 227 | # define CURL_TYPEOF_CURL_OFF_T long long 228 | # define CURL_FORMAT_CURL_OFF_T "lld" 229 | # define CURL_FORMAT_CURL_OFF_TU "llu" 230 | # define CURL_SUFFIX_CURL_OFF_T LL 231 | # define CURL_SUFFIX_CURL_OFF_TU ULL 232 | # elif defined(_LP64) 233 | # define CURL_TYPEOF_CURL_OFF_T long 234 | # define CURL_FORMAT_CURL_OFF_T "ld" 235 | # define CURL_FORMAT_CURL_OFF_TU "lu" 236 | # define CURL_SUFFIX_CURL_OFF_T L 237 | # define CURL_SUFFIX_CURL_OFF_TU UL 238 | # else 239 | # define CURL_TYPEOF_CURL_OFF_T long 240 | # define CURL_FORMAT_CURL_OFF_T "ld" 241 | # define CURL_FORMAT_CURL_OFF_TU "lu" 242 | # define CURL_SUFFIX_CURL_OFF_T L 243 | # define CURL_SUFFIX_CURL_OFF_TU UL 244 | # endif 245 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 246 | # define CURL_PULL_SYS_TYPES_H 1 247 | # define CURL_PULL_SYS_SOCKET_H 1 248 | # endif 249 | 250 | #elif defined(__370__) 251 | # if defined(__IBMC__) || defined(__IBMCPP__) 252 | # if defined(_ILP32) 253 | # elif defined(_LP64) 254 | # endif 255 | # if defined(_LONG_LONG) 256 | # define CURL_TYPEOF_CURL_OFF_T long long 257 | # define CURL_FORMAT_CURL_OFF_T "lld" 258 | # define CURL_FORMAT_CURL_OFF_TU "llu" 259 | # define CURL_SUFFIX_CURL_OFF_T LL 260 | # define CURL_SUFFIX_CURL_OFF_TU ULL 261 | # elif defined(_LP64) 262 | # define CURL_TYPEOF_CURL_OFF_T long 263 | # define CURL_FORMAT_CURL_OFF_T "ld" 264 | # define CURL_FORMAT_CURL_OFF_TU "lu" 265 | # define CURL_SUFFIX_CURL_OFF_T L 266 | # define CURL_SUFFIX_CURL_OFF_TU UL 267 | # else 268 | # define CURL_TYPEOF_CURL_OFF_T long 269 | # define CURL_FORMAT_CURL_OFF_T "ld" 270 | # define CURL_FORMAT_CURL_OFF_TU "lu" 271 | # define CURL_SUFFIX_CURL_OFF_T L 272 | # define CURL_SUFFIX_CURL_OFF_TU UL 273 | # endif 274 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 275 | # define CURL_PULL_SYS_TYPES_H 1 276 | # define CURL_PULL_SYS_SOCKET_H 1 277 | # endif 278 | 279 | #elif defined(TPF) 280 | # define CURL_TYPEOF_CURL_OFF_T long 281 | # define CURL_FORMAT_CURL_OFF_T "ld" 282 | # define CURL_FORMAT_CURL_OFF_TU "lu" 283 | # define CURL_SUFFIX_CURL_OFF_T L 284 | # define CURL_SUFFIX_CURL_OFF_TU UL 285 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 286 | 287 | #elif defined(__TINYC__) /* also known as tcc */ 288 | # define CURL_TYPEOF_CURL_OFF_T long long 289 | # define CURL_FORMAT_CURL_OFF_T "lld" 290 | # define CURL_FORMAT_CURL_OFF_TU "llu" 291 | # define CURL_SUFFIX_CURL_OFF_T LL 292 | # define CURL_SUFFIX_CURL_OFF_TU ULL 293 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 294 | # define CURL_PULL_SYS_TYPES_H 1 295 | # define CURL_PULL_SYS_SOCKET_H 1 296 | 297 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ 298 | # if !defined(__LP64) && (defined(__ILP32) || \ 299 | defined(__i386) || \ 300 | defined(__sparcv8) || \ 301 | defined(__sparcv8plus)) 302 | # define CURL_TYPEOF_CURL_OFF_T long long 303 | # define CURL_FORMAT_CURL_OFF_T "lld" 304 | # define CURL_FORMAT_CURL_OFF_TU "llu" 305 | # define CURL_SUFFIX_CURL_OFF_T LL 306 | # define CURL_SUFFIX_CURL_OFF_TU ULL 307 | # elif defined(__LP64) || \ 308 | defined(__amd64) || defined(__sparcv9) 309 | # define CURL_TYPEOF_CURL_OFF_T long 310 | # define CURL_FORMAT_CURL_OFF_T "ld" 311 | # define CURL_FORMAT_CURL_OFF_TU "lu" 312 | # define CURL_SUFFIX_CURL_OFF_T L 313 | # define CURL_SUFFIX_CURL_OFF_TU UL 314 | # endif 315 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 316 | # define CURL_PULL_SYS_TYPES_H 1 317 | # define CURL_PULL_SYS_SOCKET_H 1 318 | 319 | #elif defined(__xlc__) /* IBM xlc compiler */ 320 | # if !defined(_LP64) 321 | # define CURL_TYPEOF_CURL_OFF_T long long 322 | # define CURL_FORMAT_CURL_OFF_T "lld" 323 | # define CURL_FORMAT_CURL_OFF_TU "llu" 324 | # define CURL_SUFFIX_CURL_OFF_T LL 325 | # define CURL_SUFFIX_CURL_OFF_TU ULL 326 | # else 327 | # define CURL_TYPEOF_CURL_OFF_T long 328 | # define CURL_FORMAT_CURL_OFF_T "ld" 329 | # define CURL_FORMAT_CURL_OFF_TU "lu" 330 | # define CURL_SUFFIX_CURL_OFF_T L 331 | # define CURL_SUFFIX_CURL_OFF_TU UL 332 | # endif 333 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 334 | # define CURL_PULL_SYS_TYPES_H 1 335 | # define CURL_PULL_SYS_SOCKET_H 1 336 | 337 | /* ===================================== */ 338 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 339 | /* ===================================== */ 340 | 341 | #elif defined(_MSC_VER) 342 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 343 | # define CURL_TYPEOF_CURL_OFF_T __int64 344 | # define CURL_FORMAT_CURL_OFF_T "I64d" 345 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 346 | # define CURL_SUFFIX_CURL_OFF_T i64 347 | # define CURL_SUFFIX_CURL_OFF_TU ui64 348 | # else 349 | # define CURL_TYPEOF_CURL_OFF_T long 350 | # define CURL_FORMAT_CURL_OFF_T "ld" 351 | # define CURL_FORMAT_CURL_OFF_TU "lu" 352 | # define CURL_SUFFIX_CURL_OFF_T L 353 | # define CURL_SUFFIX_CURL_OFF_TU UL 354 | # endif 355 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 356 | 357 | /* ===================================== */ 358 | /* KEEP GENERIC GCC THE LAST ENTRY */ 359 | /* ===================================== */ 360 | 361 | #elif defined(__GNUC__) && !defined(_SCO_DS) 362 | # if !defined(__LP64__) && \ 363 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \ 364 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \ 365 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ 366 | defined(__XTENSA__) || \ 367 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ 368 | (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) 369 | # define CURL_TYPEOF_CURL_OFF_T long long 370 | # define CURL_FORMAT_CURL_OFF_T "lld" 371 | # define CURL_FORMAT_CURL_OFF_TU "llu" 372 | # define CURL_SUFFIX_CURL_OFF_T LL 373 | # define CURL_SUFFIX_CURL_OFF_TU ULL 374 | # elif defined(__LP64__) || \ 375 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ 376 | defined(__e2k__) || \ 377 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ 378 | (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) 379 | # define CURL_TYPEOF_CURL_OFF_T long 380 | # define CURL_FORMAT_CURL_OFF_T "ld" 381 | # define CURL_FORMAT_CURL_OFF_TU "lu" 382 | # define CURL_SUFFIX_CURL_OFF_T L 383 | # define CURL_SUFFIX_CURL_OFF_TU UL 384 | # endif 385 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 386 | # define CURL_PULL_SYS_TYPES_H 1 387 | # define CURL_PULL_SYS_SOCKET_H 1 388 | 389 | #else 390 | /* generic "safe guess" on old 32 bit style */ 391 | # define CURL_TYPEOF_CURL_OFF_T long 392 | # define CURL_FORMAT_CURL_OFF_T "ld" 393 | # define CURL_FORMAT_CURL_OFF_TU "lu" 394 | # define CURL_SUFFIX_CURL_OFF_T L 395 | # define CURL_SUFFIX_CURL_OFF_TU UL 396 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 397 | #endif 398 | 399 | #ifdef _AIX 400 | /* AIX needs */ 401 | #define CURL_PULL_SYS_POLL_H 402 | #endif 403 | 404 | 405 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ 406 | /* ws2tcpip.h is required here to properly make type definitions below. */ 407 | #ifdef CURL_PULL_WS2TCPIP_H 408 | # include 409 | # include 410 | # include 411 | #endif 412 | 413 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 414 | /* sys/types.h is required here to properly make type definitions below. */ 415 | #ifdef CURL_PULL_SYS_TYPES_H 416 | # include 417 | #endif 418 | 419 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 420 | /* sys/socket.h is required here to properly make type definitions below. */ 421 | #ifdef CURL_PULL_SYS_SOCKET_H 422 | # include 423 | #endif 424 | 425 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ 426 | /* sys/poll.h is required here to properly make type definitions below. */ 427 | #ifdef CURL_PULL_SYS_POLL_H 428 | # include 429 | #endif 430 | 431 | /* Data type definition of curl_socklen_t. */ 432 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 433 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 434 | #endif 435 | 436 | /* Data type definition of curl_off_t. */ 437 | 438 | #ifdef CURL_TYPEOF_CURL_OFF_T 439 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 440 | #endif 441 | 442 | /* 443 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 444 | * these to be visible and exported by the external libcurl interface API, 445 | * while also making them visible to the library internals, simply including 446 | * curl_setup.h, without actually needing to include curl.h internally. 447 | * If some day this section would grow big enough, all this should be moved 448 | * to its own header file. 449 | */ 450 | 451 | /* 452 | * Figure out if we can use the ## preprocessor operator, which is supported 453 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 454 | * or __cplusplus so we need to carefully check for them too. 455 | */ 456 | 457 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 458 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 459 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 460 | defined(__ILEC400__) 461 | /* This compiler is believed to have an ISO compatible preprocessor */ 462 | #define CURL_ISOCPP 463 | #else 464 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 465 | #undef CURL_ISOCPP 466 | #endif 467 | 468 | /* 469 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 470 | */ 471 | 472 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 473 | # define CURLINC_OFF_T_C_HLPR2(x) x 474 | # define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x) 475 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 476 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 477 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 478 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 479 | #else 480 | # ifdef CURL_ISOCPP 481 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 482 | # else 483 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 484 | # endif 485 | # define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix) 486 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 487 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 488 | #endif 489 | 490 | #endif /* CURLINC_SYSTEM_H */ 491 | -------------------------------------------------------------------------------- /Dependencies/unreal_enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | enum class GSConnectionState 8 | { 9 | Connected = 0, 10 | Disconnected = 1 11 | }; 12 | 13 | enum EObjectFlags 14 | { 15 | // Do not add new flags unless they truly belong here. There are alternatives. 16 | // if you change any the bit of any of the RF_Load flags, then you will need legacy serialization 17 | RF_NoFlags = 0x00000000, ///< No flags, used to avoid a cast 18 | 19 | // This first group of flags mostly has to do with what kind of object it is. Other than transient, these are the persistent object flags. 20 | // The garbage collector also tends to look at these. 21 | RF_Public = 0x00000001, ///< Object is visible outside its package. 22 | RF_Standalone = 0x00000002, ///< Keep object around for editing even if unreferenced. 23 | RF_MarkAsNative = 0x00000004, ///< Object (UField) will be marked as native on construction (DO NOT USE THIS FLAG in HasAnyFlags() etc) 24 | RF_Transactional = 0x00000008, ///< Object is transactional. 25 | RF_ClassDefaultObject = 0x00000010, ///< This object is its class's default object 26 | RF_ArchetypeObject = 0x00000020, ///< This object is a template for another object - treat like a class default object 27 | RF_Transient = 0x00000040, ///< Don't save object. 28 | 29 | // This group of flags is primarily concerned with garbage collection. 30 | RF_MarkAsRootSet = 0x00000080, ///< Object will be marked as root set on construction and not be garbage collected, even if unreferenced (DO NOT USE THIS FLAG in HasAnyFlags() etc) 31 | RF_TagGarbageTemp = 0x00000100, ///< This is a temp user flag for various utilities that need to use the garbage collector. The garbage collector itself does not interpret it. 32 | 33 | // The group of flags tracks the stages of the lifetime of a uobject 34 | RF_NeedInitialization = 0x00000200, ///< This object has not completed its initialization process. Cleared when ~FObjectInitializer completes 35 | RF_NeedLoad = 0x00000400, ///< During load, indicates object needs loading. 36 | RF_KeepForCooker = 0x00000800, ///< Keep this object during garbage collection because it's still being used by the cooker 37 | RF_NeedPostLoad = 0x00001000, ///< Object needs to be postloaded. 38 | RF_NeedPostLoadSubobjects = 0x00002000, ///< During load, indicates that the object still needs to instance subobjects and fixup serialized component references 39 | RF_NewerVersionExists = 0x00004000, ///< Object has been consigned to oblivion due to its owner package being reloaded, and a newer version currently exists 40 | RF_BeginDestroyed = 0x00008000, ///< BeginDestroy has been called on the object. 41 | RF_FinishDestroyed = 0x00010000, ///< FinishDestroy has been called on the object. 42 | 43 | // Misc. Flags 44 | RF_BeingRegenerated = 0x00020000, ///< Flagged on UObjects that are used to create UClasses (e.g. Blueprints) while they are regenerating their UClass on load (See FLinkerLoad::CreateExport()), as well as UClass objects in the midst of being created 45 | RF_DefaultSubObject = 0x00040000, ///< Flagged on subobjects that are defaults 46 | RF_WasLoaded = 0x00080000, ///< Flagged on UObjects that were loaded 47 | RF_TextExportTransient = 0x00100000, ///< Do not export object to text form (e.g. copy/paste). Generally used for sub-objects that can be regenerated from data in their parent object. 48 | RF_LoadCompleted = 0x00200000, ///< Object has been completely serialized by linkerload at least once. DO NOT USE THIS FLAG, It should be replaced with RF_WasLoaded. 49 | RF_InheritableComponentTemplate = 0x00400000, ///< Archetype of the object can be in its super class 50 | RF_DuplicateTransient = 0x00800000, ///< Object should not be included in any type of duplication (copy/paste, binary duplication, etc.) 51 | RF_StrongRefOnFrame = 0x01000000, ///< References to this object from persistent function frame are handled as strong ones. 52 | RF_NonPIEDuplicateTransient = 0x02000000, ///< Object should not be included for duplication unless it's being duplicated for a PIE session 53 | RF_Dynamic = 0x04000000, ///< Field Only. Dynamic field - doesn't get constructed during static initialization, can be constructed multiple times // @todo: BP2CPP_remove 54 | RF_WillBeLoaded = 0x08000000, ///< This object was constructed during load and will be loaded shortly 55 | RF_HasExternalPackage = 0x10000000, ///< This object has an external package assigned and should look it up when getting the outermost package 56 | 57 | // RF_Garbage and RF_PendingKill are mirrored in EInternalObjectFlags because checking the internal flags is much faster for the Garbage Collector 58 | // while checking the object flags is much faster outside of it where the Object pointer is already available and most likely cached. 59 | // RF_PendingKill is mirrored in EInternalObjectFlags because checking the internal flags is much faster for the Garbage Collector 60 | // while checking the object flags is much faster outside of it where the Object pointer is already available and most likely cached. 61 | 62 | RF_PendingKill = 0x20000000, ///< Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored in EInternalObjectFlags as PendingKill for performance 63 | RF_Garbage = 0x40000000, ///< Garbage from logical point of view and should not be referenced. This flag is mirrored in EInternalObjectFlags as Garbage for performance 64 | RF_AllocatedInSharedPage = 0x80000000, ///< Allocated from a ref-counted page shared with other UObjects 65 | }; 66 | 67 | 68 | enum EPropertyFlags : uint64_t 69 | { 70 | CPF_None = 0, 71 | 72 | CPF_Edit = 0x0000000000000001, 73 | ///< Property is user-settable in the editor. 74 | CPF_ConstParm = 0x0000000000000002, 75 | ///< This is a constant function parameter 76 | CPF_BlueprintVisible = 0x0000000000000004, 77 | ///< This property can be read by blueprint code 78 | CPF_ExportObject = 0x0000000000000008, 79 | ///< Object can be exported with actor. 80 | CPF_BlueprintReadOnly = 0x0000000000000010, 81 | ///< This property cannot be modified by blueprint code 82 | CPF_Net = 0x0000000000000020, 83 | ///< Property is relevant to network replication. 84 | CPF_EditFixedSize = 0x0000000000000040, 85 | ///< Indicates that elements of an array can be modified, but its size cannot be changed. 86 | CPF_Parm = 0x0000000000000080, 87 | ///< Function/When call parameter. 88 | CPF_OutParm = 0x0000000000000100, 89 | ///< Value is copied out after function call. 90 | CPF_ZeroConstructor = 0x0000000000000200, 91 | ///< memset is fine for construction 92 | CPF_ReturnParm = 0x0000000000000400, 93 | ///< Return value. 94 | CPF_DisableEditOnTemplate = 0x0000000000000800, 95 | ///< Disable editing of this property on an archetype/sub-blueprint 96 | //CPF_ = 0x0000000000001000, ///< 97 | CPF_Transient = 0x0000000000002000, 98 | ///< Property is transient: shouldn't be saved or loaded, except for Blueprint CDOs. 99 | CPF_Config = 0x0000000000004000, 100 | ///< Property should be loaded/saved as permanent profile. 101 | //CPF_ = 0x0000000000008000, ///< 102 | CPF_DisableEditOnInstance = 0x0000000000010000, 103 | ///< Disable editing on an instance of this class 104 | CPF_EditConst = 0x0000000000020000, 105 | ///< Property is uneditable in the editor. 106 | CPF_GlobalConfig = 0x0000000000040000, 107 | ///< Load config from base class, not subclass. 108 | CPF_InstancedReference = 0x0000000000080000, 109 | ///< Property is a component references. 110 | //CPF_ = 0x0000000000100000, ///< 111 | CPF_DuplicateTransient = 0x0000000000200000, 112 | ///< Property should always be reset to the default value during any type of duplication (copy/paste, binary duplication, etc.) 113 | //CPF_ = 0x0000000000400000, ///< 114 | //CPF_ = 0x0000000000800000, ///< 115 | CPF_SaveGame = 0x0000000001000000, 116 | ///< Property should be serialized for save games, this is only checked for game-specific archives with ArIsSaveGame 117 | CPF_NoClear = 0x0000000002000000, 118 | ///< Hide clear (and browse) button. 119 | //CPF_ = 0x0000000004000000, ///< 120 | CPF_ReferenceParm = 0x0000000008000000, 121 | ///< Value is passed by reference; CPF_OutParam and CPF_Param should also be set. 122 | CPF_BlueprintAssignable = 0x0000000010000000, 123 | ///< MC Delegates only. Property should be exposed for assigning in blueprint code 124 | CPF_Deprecated = 0x0000000020000000, 125 | ///< Property is deprecated. Read it from an archive, but don't save it. 126 | CPF_IsPlainOldData = 0x0000000040000000, 127 | ///< If this is set, then the property can be memcopied instead of CopyCompleteValue / CopySingleValue 128 | CPF_RepSkip = 0x0000000080000000, 129 | ///< Not replicated. For non replicated properties in replicated structs 130 | CPF_RepNotify = 0x0000000100000000, 131 | ///< Notify actors when a property is replicated 132 | CPF_Interp = 0x0000000200000000, 133 | ///< interpolatable property for use with matinee 134 | CPF_NonTransactional = 0x0000000400000000, 135 | ///< Property isn't transacted 136 | CPF_EditorOnly = 0x0000000800000000, 137 | ///< Property should only be loaded in the editor 138 | CPF_NoDestructor = 0x0000001000000000, 139 | ///< No destructor 140 | //CPF_ = 0x0000002000000000, ///< 141 | CPF_AutoWeak = 0x0000004000000000, 142 | ///< Only used for weak pointers, means the export type is autoweak 143 | CPF_ContainsInstancedReference = 0x0000008000000000, 144 | ///< Property contains component references. 145 | CPF_AssetRegistrySearchable = 0x0000010000000000, 146 | ///< asset instances will add properties with this flag to the asset registry automatically 147 | CPF_SimpleDisplay = 0x0000020000000000, 148 | ///< The property is visible by default in the editor details view 149 | CPF_AdvancedDisplay = 0x0000040000000000, 150 | ///< The property is advanced and not visible by default in the editor details view 151 | CPF_Protected = 0x0000080000000000, 152 | ///< property is protected from the perspective of script 153 | CPF_BlueprintCallable = 0x0000100000000000, 154 | ///< MC Delegates only. Property should be exposed for calling in blueprint code 155 | CPF_BlueprintAuthorityOnly = 0x0000200000000000, 156 | ///< MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly. 157 | CPF_TextExportTransient = 0x0000400000000000, 158 | ///< Property shouldn't be exported to text format (e.g. copy/paste) 159 | CPF_NonPIEDuplicateTransient = 0x0000800000000000, 160 | ///< Property should only be copied in PIE 161 | CPF_ExposeOnSpawn = 0x0001000000000000, 162 | ///< Property is exposed on spawn 163 | CPF_PersistentInstance = 0x0002000000000000, 164 | ///< A object referenced by the property is duplicated like a component. (Each actor should have an own instance.) 165 | CPF_UObjectWrapper = 0x0004000000000000, 166 | ///< Property was parsed as a wrapper class like TSubclassOf, FScriptInterface etc., rather than a USomething* 167 | CPF_HasGetValueTypeHash = 0x0008000000000000, 168 | ///< This property can generate a meaningful hash value. 169 | CPF_NativeAccessSpecifierPublic = 0x0010000000000000, 170 | ///< Public native access specifier 171 | CPF_NativeAccessSpecifierProtected = 0x0020000000000000, 172 | ///< Protected native access specifier 173 | CPF_NativeAccessSpecifierPrivate = 0x0040000000000000, 174 | ///< Private native access specifier 175 | CPF_SkipSerialization = 0x0080000000000000, 176 | ///< Property shouldn't be serialized, can still be exported to text 177 | }; 178 | 179 | enum ELifetimeCondition 180 | { 181 | COND_None = 0, 182 | COND_InitialOnly = 1, 183 | COND_OwnerOnly = 2, 184 | COND_SkipOwner = 3, 185 | COND_SimulatedOnly = 4, 186 | COND_AutonomousOnly = 5, 187 | COND_SimulatedOrPhysics = 6, 188 | COND_InitialOrOwner = 7, 189 | COND_Custom = 8, 190 | COND_ReplayOrOwner = 9, 191 | COND_ReplayOnly = 10, 192 | COND_SimulatedOnlyNoReplay = 11, 193 | COND_SimulatedOrPhysicsNoReplay = 12, 194 | COND_SkipReplay = 13, 195 | COND_Never = 15, 196 | COND_Max = 16, 197 | }; 198 | 199 | 200 | enum EInternalObjectFlags : uint8_t 201 | { 202 | None = 0, 203 | ReachableInCluster = 1 << 23, 204 | ClusterRoot = 1 << 24, 205 | Native = 1 << 25, 206 | Async = 1 << 26, 207 | AsyncLoading = 1 << 27, 208 | Unreachable = 1 << 28, 209 | PendingKill = 1 << 29, 210 | RootSet = 1 << 30, 211 | GarbageCollectionKeepFlags = Native | Async | AsyncLoading, 212 | AllFlags = ReachableInCluster | ClusterRoot | Native | Async | AsyncLoading | Unreachable | PendingKill | RootSet, 213 | }; 214 | 215 | enum EFunctionFlags : uint32_t 216 | { 217 | // Function flags. 218 | FUNC_None = 0x00000000, 219 | FUNC_Final = 0x00000001, 220 | // Function is final (prebindable, non-overridable function). 221 | FUNC_RequiredAPI = 0x00000002, 222 | // Indicates this function is DLL exported/imported. 223 | FUNC_BlueprintAuthorityOnly = 0x00000004, 224 | // Function will only run if the object has network authority 225 | FUNC_BlueprintCosmetic = 0x00000008, 226 | // Function is cosmetic in nature and should not be invoked on dedicated servers 227 | // FUNC_ = 0x00000010, // unused. 228 | // FUNC_ = 0x00000020, // unused. 229 | FUNC_Net = 0x00000040, 230 | // Function is network-replicated. 231 | FUNC_NetReliable = 0x00000080, 232 | // Function should be sent reliably on the network. 233 | FUNC_NetRequest = 0x00000100, 234 | // Function is sent to a net service 235 | FUNC_Exec = 0x00000200, 236 | // Executable from command line. 237 | FUNC_Native = 0x00000400, 238 | // Native function. 239 | FUNC_Event = 0x00000800, 240 | // Event function. 241 | FUNC_NetResponse = 0x00001000, 242 | // Function response from a net service 243 | FUNC_Static = 0x00002000, 244 | // Static function. 245 | FUNC_NetMulticast = 0x00004000, 246 | // Function is networked multicast Server -> All Clients 247 | FUNC_UbergraphFunction = 0x00008000, 248 | // Function is used as the merge 'ubergraph' for a blueprint, only assigned when using the persistent 'ubergraph' frame 249 | FUNC_MulticastDelegate = 0x00010000, 250 | // Function is a multi-cast delegate signature (also requires FUNC_Delegate to be set!) 251 | FUNC_Public = 0x00020000, 252 | // Function is accessible in all classes (if overridden, parameters must remain unchanged). 253 | FUNC_Private = 0x00040000, 254 | // Function is accessible only in the class it is defined in (cannot be overridden, but function name may be reused in subclasses. IOW: if overridden, parameters don't need to match, and Super.Func() cannot be accessed since it's private.) 255 | FUNC_Protected = 0x00080000, 256 | // Function is accessible only in the class it is defined in and subclasses (if overridden, parameters much remain unchanged). 257 | FUNC_Delegate = 0x00100000, 258 | // Function is delegate signature (either single-cast or multi-cast, depending on whether FUNC_MulticastDelegate is set.) 259 | FUNC_NetServer = 0x00200000, 260 | // Function is executed on servers (set by replication code if passes check) 261 | FUNC_HasOutParms = 0x00400000, 262 | // function has out (pass by reference) parameters 263 | FUNC_HasDefaults = 0x00800000, 264 | // function has structs that contain defaults 265 | FUNC_NetClient = 0x01000000, 266 | // function is executed on clients 267 | FUNC_DLLImport = 0x02000000, 268 | // function is imported from a DLL 269 | FUNC_BlueprintCallable = 0x04000000, 270 | // function can be called from blueprint code 271 | FUNC_BlueprintEvent = 0x08000000, 272 | // function can be overridden/implemented from a blueprint 273 | FUNC_BlueprintPure = 0x10000000, 274 | // function can be called from blueprint code, and is also pure (produces no side effects). If you set this, you should set FUNC_BlueprintCallable as well. 275 | FUNC_EditorOnly = 0x20000000, 276 | // function can only be called from an editor scrippt. 277 | FUNC_Const = 0x40000000, 278 | // function can be called from blueprint code, and only reads state (never writes state) 279 | FUNC_NetValidate = 0x80000000, 280 | // function must supply a _Validate implementation 281 | 282 | FUNC_AllFlags = 0xFFFFFFFF, 283 | }; 284 | 285 | enum EClassFlags 286 | { 287 | /** No Flags */ 288 | CLASS_None = 0x00000000u, 289 | /** Class is abstract and can't be instantiated directly. */ 290 | CLASS_Abstract = 0x00000001u, 291 | /** Save object configuration only to Default INIs, never to local INIs. Must be combined with CLASS_Config */ 292 | CLASS_DefaultConfig = 0x00000002u, 293 | /** Load object configuration at construction time. */ 294 | CLASS_Config = 0x00000004u, 295 | /** This object type can't be saved; null it out at save time. */ 296 | CLASS_Transient = 0x00000008u, 297 | /** This object type may not be available in certain context. (i.e. game runtime or in certain configuration). Optional class data is saved separately to other object types. (i.e. might use sidecar files) */ 298 | CLASS_Optional = 0x00000010u, 299 | /** */ 300 | CLASS_MatchedSerializers = 0x00000020u, 301 | /** Indicates that the config settings for this class will be saved to Project/User*.ini (similar to CLASS_GlobalUserConfig) */ 302 | CLASS_ProjectUserConfig = 0x00000040u, 303 | /** Class is a native class - native interfaces will have CLASS_Native set, but not RF_MarkAsNative */ 304 | CLASS_Native = 0x00000080u, 305 | /** Don't export to C++ header. */ 306 | CLASS_NoExport = 0x00000100u, 307 | /** Do not allow users to create in the editor. */ 308 | CLASS_NotPlaceable = 0x00000200u, 309 | /** Handle object configuration on a per-object basis, rather than per-class. */ 310 | CLASS_PerObjectConfig = 0x00000400u, 311 | 312 | /** Whether SetUpRuntimeReplicationData still needs to be called for this class */ 313 | CLASS_ReplicationDataIsSetUp = 0x00000800u, 314 | 315 | /** Class can be constructed from editinline New button. */ 316 | CLASS_EditInlineNew = 0x00001000u, 317 | /** Display properties in the editor without using categories. */ 318 | CLASS_CollapseCategories = 0x00002000u, 319 | /** Class is an interface **/ 320 | CLASS_Interface = 0x00004000u, 321 | /** Do not export a constructor for this class, assuming it is in the cpptext **/ 322 | CLASS_CustomConstructor = 0x00008000u, 323 | /** all properties and functions in this class are const and should be exported as const */ 324 | CLASS_Const = 0x00010000u, 325 | 326 | /** Class flag indicating objects of this class need deferred dependency loading */ 327 | CLASS_NeedsDeferredDependencyLoading = 0x00020000u, 328 | 329 | /** Indicates that the class was created from blueprint source material */ 330 | CLASS_CompiledFromBlueprint = 0x00040000u, 331 | 332 | /** Indicates that only the bare minimum bits of this class should be DLL exported/imported */ 333 | CLASS_MinimalAPI = 0x00080000u, 334 | 335 | /** Indicates this class must be DLL exported/imported (along with all of it's members) */ 336 | CLASS_RequiredAPI = 0x00100000u, 337 | 338 | /** Indicates that references to this class default to instanced. Used to be subclasses of UComponent, but now can be any UObject */ 339 | CLASS_DefaultToInstanced = 0x00200000u, 340 | 341 | /** Indicates that the parent token stream has been merged with ours. */ 342 | CLASS_TokenStreamAssembled = 0x00400000u, 343 | /** Class has component properties. */ 344 | CLASS_HasInstancedReference = 0x00800000u, 345 | /** Don't show this class in the editor class browser or edit inline new menus. */ 346 | CLASS_Hidden = 0x01000000u, 347 | /** Don't save objects of this class when serializing */ 348 | CLASS_Deprecated = 0x02000000u, 349 | /** Class not shown in editor drop down for class selection */ 350 | CLASS_HideDropDown = 0x04000000u, 351 | /** Class settings are saved to /..../Blah.ini (as opposed to CLASS_DefaultConfig) */ 352 | CLASS_GlobalUserConfig = 0x08000000u, 353 | /** Class was declared directly in C++ and has no boilerplate generated by UnrealHeaderTool */ 354 | CLASS_Intrinsic = 0x10000000u, 355 | /** Class has already been constructed (maybe in a previous DLL version before hot-reload). */ 356 | CLASS_Constructed = 0x20000000u, 357 | /** Indicates that object configuration will not check against ini base/defaults when serialized */ 358 | CLASS_ConfigDoNotCheckDefaults = 0x40000000u, 359 | /** Class has been consigned to oblivion as part of a blueprint recompile, and a newer version currently exists. */ 360 | CLASS_NewerVersionExists = 0x80000000u, 361 | }; 362 | 363 | enum EClassCastFlags : uint64_t 364 | { 365 | CASTCLASS_None = 0x0000000000000000, 366 | 367 | CASTCLASS_UField = 0x0000000000000001, 368 | CASTCLASS_FInt8Property = 0x0000000000000002, 369 | CASTCLASS_UEnum = 0x0000000000000004, 370 | CASTCLASS_UStruct = 0x0000000000000008, 371 | CASTCLASS_UScriptStruct = 0x0000000000000010, 372 | CASTCLASS_UClass = 0x0000000000000020, 373 | CASTCLASS_FByteProperty = 0x0000000000000040, 374 | CASTCLASS_FIntProperty = 0x0000000000000080, 375 | CASTCLASS_FFloatProperty = 0x0000000000000100, 376 | CASTCLASS_FUInt64Property = 0x0000000000000200, 377 | CASTCLASS_FClassProperty = 0x0000000000000400, 378 | CASTCLASS_FUInt32Property = 0x0000000000000800, 379 | CASTCLASS_FInterfaceProperty = 0x0000000000001000, 380 | CASTCLASS_FNameProperty = 0x0000000000002000, 381 | CASTCLASS_FStrProperty = 0x0000000000004000, 382 | CASTCLASS_FProperty = 0x0000000000008000, 383 | CASTCLASS_FObjectProperty = 0x0000000000010000, 384 | CASTCLASS_FBoolProperty = 0x0000000000020000, 385 | CASTCLASS_FUInt16Property = 0x0000000000040000, 386 | CASTCLASS_UFunction = 0x0000000000080000, 387 | CASTCLASS_FStructProperty = 0x0000000000100000, 388 | CASTCLASS_FArrayProperty = 0x0000000000200000, 389 | CASTCLASS_FInt64Property = 0x0000000000400000, 390 | CASTCLASS_FDelegateProperty = 0x0000000000800000, 391 | CASTCLASS_FNumericProperty = 0x0000000001000000, 392 | CASTCLASS_FMulticastDelegateProperty = 0x0000000002000000, 393 | CASTCLASS_FObjectPropertyBase = 0x0000000004000000, 394 | CASTCLASS_FWeakObjectProperty = 0x0000000008000000, 395 | CASTCLASS_FLazyObjectProperty = 0x0000000010000000, 396 | CASTCLASS_FSoftObjectProperty = 0x0000000020000000, 397 | CASTCLASS_FTextProperty = 0x0000000040000000, 398 | CASTCLASS_FInt16Property = 0x0000000080000000, 399 | CASTCLASS_FDoubleProperty = 0x0000000100000000, 400 | CASTCLASS_FSoftClassProperty = 0x0000000200000000, 401 | CASTCLASS_UPackage = 0x0000000400000000, 402 | CASTCLASS_ULevel = 0x0000000800000000, 403 | CASTCLASS_AActor = 0x0000001000000000, 404 | CASTCLASS_APlayerController = 0x0000002000000000, 405 | CASTCLASS_APawn = 0x0000004000000000, 406 | CASTCLASS_USceneComponent = 0x0000008000000000, 407 | CASTCLASS_UPrimitiveComponent = 0x0000010000000000, 408 | CASTCLASS_USkinnedMeshComponent = 0x0000020000000000, 409 | CASTCLASS_USkeletalMeshComponent = 0x0000040000000000, 410 | CASTCLASS_UBlueprint = 0x0000080000000000, 411 | CASTCLASS_UDelegateFunction = 0x0000100000000000, 412 | CASTCLASS_UStaticMeshComponent = 0x0000200000000000, 413 | CASTCLASS_FMapProperty = 0x0000400000000000, 414 | CASTCLASS_FSetProperty = 0x0000800000000000, 415 | CASTCLASS_FEnumProperty = 0x0001000000000000, 416 | CASTCLASS_USparseDelegateFunction = 0x0002000000000000, 417 | CASTCLASS_FMulticastInlineDelegateProperty = 0x0004000000000000, 418 | CASTCLASS_FMulticastSparseDelegateProperty = 0x0008000000000000, 419 | CASTCLASS_FFieldPathProperty = 0x0010000000000000, 420 | CASTCLASS_FObjectPtrProperty = 0x0020000000000000, 421 | CASTCLASS_FClassPtrProperty = 0x0040000000000000, 422 | CASTCLASS_FLargeWorldCoordinatesRealProperty = 0x0080000000000000, 423 | }; 424 | 425 | 426 | 427 | 428 | enum EConnectionState 429 | { 430 | USOCK_Invalid = 0, // Connection is invalid, possibly uninitialized. 431 | USOCK_Closed = 1, // Connection permanently closed. 432 | USOCK_Pending = 2, // Connection is awaiting connection. 433 | USOCK_Open = 3, // Connection is open. 434 | }; 435 | 436 | enum EPilgrimQuickplayStateMachine_NameState : int { 437 | PilgrimState_Loading = 382935, 438 | PilgrimState_PreGame = 382957, 439 | PilgrimState_PreIntro = 382979, 440 | PilgrimState_Intro = 383001, 441 | PilgrimState_SongGameplay = 383022, 442 | PilgrimState_Outro = 383046, 443 | PilgrimState_SongResult = 383067, 444 | PilgrimState_SetResults = 383091, 445 | PilgrimState_Request_StateDone = 383114, 446 | }; 447 | -------------------------------------------------------------------------------- /Dependencies/curl/typecheck-gcc.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_TYPECHECK_GCC_H 2 | #define CURLINC_TYPECHECK_GCC_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* wraps curl_easy_setopt() with typechecking */ 28 | 29 | /* To add a new kind of warning, add an 30 | * if(curlcheck_sometype_option(_curl_opt)) 31 | * if(!curlcheck_sometype(value)) 32 | * _curl_easy_setopt_err_sometype(); 33 | * block and define curlcheck_sometype_option, curlcheck_sometype and 34 | * _curl_easy_setopt_err_sometype below 35 | * 36 | * NOTE: We use two nested 'if' statements here instead of the && operator, in 37 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x 38 | * when compiling with -Wlogical-op. 39 | * 40 | * To add an option that uses the same type as an existing option, you'll just 41 | * need to extend the appropriate _curl_*_option macro 42 | */ 43 | #define curl_easy_setopt(handle, option, value) \ 44 | __extension__({ \ 45 | __typeof__(option) _curl_opt = option; \ 46 | if(__builtin_constant_p(_curl_opt)) { \ 47 | if(curlcheck_long_option(_curl_opt)) \ 48 | if(!curlcheck_long(value)) \ 49 | _curl_easy_setopt_err_long(); \ 50 | if(curlcheck_off_t_option(_curl_opt)) \ 51 | if(!curlcheck_off_t(value)) \ 52 | _curl_easy_setopt_err_curl_off_t(); \ 53 | if(curlcheck_string_option(_curl_opt)) \ 54 | if(!curlcheck_string(value)) \ 55 | _curl_easy_setopt_err_string(); \ 56 | if(curlcheck_write_cb_option(_curl_opt)) \ 57 | if(!curlcheck_write_cb(value)) \ 58 | _curl_easy_setopt_err_write_callback(); \ 59 | if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \ 60 | if(!curlcheck_resolver_start_callback(value)) \ 61 | _curl_easy_setopt_err_resolver_start_callback(); \ 62 | if((_curl_opt) == CURLOPT_READFUNCTION) \ 63 | if(!curlcheck_read_cb(value)) \ 64 | _curl_easy_setopt_err_read_cb(); \ 65 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ 66 | if(!curlcheck_ioctl_cb(value)) \ 67 | _curl_easy_setopt_err_ioctl_cb(); \ 68 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ 69 | if(!curlcheck_sockopt_cb(value)) \ 70 | _curl_easy_setopt_err_sockopt_cb(); \ 71 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ 72 | if(!curlcheck_opensocket_cb(value)) \ 73 | _curl_easy_setopt_err_opensocket_cb(); \ 74 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ 75 | if(!curlcheck_progress_cb(value)) \ 76 | _curl_easy_setopt_err_progress_cb(); \ 77 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ 78 | if(!curlcheck_debug_cb(value)) \ 79 | _curl_easy_setopt_err_debug_cb(); \ 80 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ 81 | if(!curlcheck_ssl_ctx_cb(value)) \ 82 | _curl_easy_setopt_err_ssl_ctx_cb(); \ 83 | if(curlcheck_conv_cb_option(_curl_opt)) \ 84 | if(!curlcheck_conv_cb(value)) \ 85 | _curl_easy_setopt_err_conv_cb(); \ 86 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ 87 | if(!curlcheck_seek_cb(value)) \ 88 | _curl_easy_setopt_err_seek_cb(); \ 89 | if(curlcheck_cb_data_option(_curl_opt)) \ 90 | if(!curlcheck_cb_data(value)) \ 91 | _curl_easy_setopt_err_cb_data(); \ 92 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \ 93 | if(!curlcheck_error_buffer(value)) \ 94 | _curl_easy_setopt_err_error_buffer(); \ 95 | if((_curl_opt) == CURLOPT_STDERR) \ 96 | if(!curlcheck_FILE(value)) \ 97 | _curl_easy_setopt_err_FILE(); \ 98 | if(curlcheck_postfields_option(_curl_opt)) \ 99 | if(!curlcheck_postfields(value)) \ 100 | _curl_easy_setopt_err_postfields(); \ 101 | if((_curl_opt) == CURLOPT_HTTPPOST) \ 102 | if(!curlcheck_arr((value), struct curl_httppost)) \ 103 | _curl_easy_setopt_err_curl_httpost(); \ 104 | if((_curl_opt) == CURLOPT_MIMEPOST) \ 105 | if(!curlcheck_ptr((value), curl_mime)) \ 106 | _curl_easy_setopt_err_curl_mimepost(); \ 107 | if(curlcheck_slist_option(_curl_opt)) \ 108 | if(!curlcheck_arr((value), struct curl_slist)) \ 109 | _curl_easy_setopt_err_curl_slist(); \ 110 | if((_curl_opt) == CURLOPT_SHARE) \ 111 | if(!curlcheck_ptr((value), CURLSH)) \ 112 | _curl_easy_setopt_err_CURLSH(); \ 113 | } \ 114 | curl_easy_setopt(handle, _curl_opt, value); \ 115 | }) 116 | 117 | /* wraps curl_easy_getinfo() with typechecking */ 118 | #define curl_easy_getinfo(handle, info, arg) \ 119 | __extension__({ \ 120 | __typeof__(info) _curl_info = info; \ 121 | if(__builtin_constant_p(_curl_info)) { \ 122 | if(curlcheck_string_info(_curl_info)) \ 123 | if(!curlcheck_arr((arg), char *)) \ 124 | _curl_easy_getinfo_err_string(); \ 125 | if(curlcheck_long_info(_curl_info)) \ 126 | if(!curlcheck_arr((arg), long)) \ 127 | _curl_easy_getinfo_err_long(); \ 128 | if(curlcheck_double_info(_curl_info)) \ 129 | if(!curlcheck_arr((arg), double)) \ 130 | _curl_easy_getinfo_err_double(); \ 131 | if(curlcheck_slist_info(_curl_info)) \ 132 | if(!curlcheck_arr((arg), struct curl_slist *)) \ 133 | _curl_easy_getinfo_err_curl_slist(); \ 134 | if(curlcheck_tlssessioninfo_info(_curl_info)) \ 135 | if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \ 136 | _curl_easy_getinfo_err_curl_tlssesssioninfo(); \ 137 | if(curlcheck_certinfo_info(_curl_info)) \ 138 | if(!curlcheck_arr((arg), struct curl_certinfo *)) \ 139 | _curl_easy_getinfo_err_curl_certinfo(); \ 140 | if(curlcheck_socket_info(_curl_info)) \ 141 | if(!curlcheck_arr((arg), curl_socket_t)) \ 142 | _curl_easy_getinfo_err_curl_socket(); \ 143 | if(curlcheck_off_t_info(_curl_info)) \ 144 | if(!curlcheck_arr((arg), curl_off_t)) \ 145 | _curl_easy_getinfo_err_curl_off_t(); \ 146 | } \ 147 | curl_easy_getinfo(handle, _curl_info, arg); \ 148 | }) 149 | 150 | /* 151 | * For now, just make sure that the functions are called with three arguments 152 | */ 153 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 154 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 155 | 156 | 157 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err* 158 | * functions */ 159 | 160 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */ 161 | #define CURLWARNING(id, message) \ 162 | static void __attribute__((__warning__(message))) \ 163 | __attribute__((__unused__)) __attribute__((__noinline__)) \ 164 | id(void) { __asm__(""); } 165 | 166 | CURLWARNING(_curl_easy_setopt_err_long, 167 | "curl_easy_setopt expects a long argument for this option") 168 | CURLWARNING(_curl_easy_setopt_err_curl_off_t, 169 | "curl_easy_setopt expects a curl_off_t argument for this option") 170 | CURLWARNING(_curl_easy_setopt_err_string, 171 | "curl_easy_setopt expects a " 172 | "string ('char *' or char[]) argument for this option" 173 | ) 174 | CURLWARNING(_curl_easy_setopt_err_write_callback, 175 | "curl_easy_setopt expects a curl_write_callback argument for this option") 176 | CURLWARNING(_curl_easy_setopt_err_resolver_start_callback, 177 | "curl_easy_setopt expects a " 178 | "curl_resolver_start_callback argument for this option" 179 | ) 180 | CURLWARNING(_curl_easy_setopt_err_read_cb, 181 | "curl_easy_setopt expects a curl_read_callback argument for this option") 182 | CURLWARNING(_curl_easy_setopt_err_ioctl_cb, 183 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option") 184 | CURLWARNING(_curl_easy_setopt_err_sockopt_cb, 185 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option") 186 | CURLWARNING(_curl_easy_setopt_err_opensocket_cb, 187 | "curl_easy_setopt expects a " 188 | "curl_opensocket_callback argument for this option" 189 | ) 190 | CURLWARNING(_curl_easy_setopt_err_progress_cb, 191 | "curl_easy_setopt expects a curl_progress_callback argument for this option") 192 | CURLWARNING(_curl_easy_setopt_err_debug_cb, 193 | "curl_easy_setopt expects a curl_debug_callback argument for this option") 194 | CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb, 195 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") 196 | CURLWARNING(_curl_easy_setopt_err_conv_cb, 197 | "curl_easy_setopt expects a curl_conv_callback argument for this option") 198 | CURLWARNING(_curl_easy_setopt_err_seek_cb, 199 | "curl_easy_setopt expects a curl_seek_callback argument for this option") 200 | CURLWARNING(_curl_easy_setopt_err_cb_data, 201 | "curl_easy_setopt expects a " 202 | "private data pointer as argument for this option") 203 | CURLWARNING(_curl_easy_setopt_err_error_buffer, 204 | "curl_easy_setopt expects a " 205 | "char buffer of CURL_ERROR_SIZE as argument for this option") 206 | CURLWARNING(_curl_easy_setopt_err_FILE, 207 | "curl_easy_setopt expects a 'FILE *' argument for this option") 208 | CURLWARNING(_curl_easy_setopt_err_postfields, 209 | "curl_easy_setopt expects a 'void *' or 'char *' argument for this option") 210 | CURLWARNING(_curl_easy_setopt_err_curl_httpost, 211 | "curl_easy_setopt expects a 'struct curl_httppost *' " 212 | "argument for this option") 213 | CURLWARNING(_curl_easy_setopt_err_curl_mimepost, 214 | "curl_easy_setopt expects a 'curl_mime *' " 215 | "argument for this option") 216 | CURLWARNING(_curl_easy_setopt_err_curl_slist, 217 | "curl_easy_setopt expects a 'struct curl_slist *' argument for this option") 218 | CURLWARNING(_curl_easy_setopt_err_CURLSH, 219 | "curl_easy_setopt expects a CURLSH* argument for this option") 220 | 221 | CURLWARNING(_curl_easy_getinfo_err_string, 222 | "curl_easy_getinfo expects a pointer to 'char *' for this info") 223 | CURLWARNING(_curl_easy_getinfo_err_long, 224 | "curl_easy_getinfo expects a pointer to long for this info") 225 | CURLWARNING(_curl_easy_getinfo_err_double, 226 | "curl_easy_getinfo expects a pointer to double for this info") 227 | CURLWARNING(_curl_easy_getinfo_err_curl_slist, 228 | "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info") 229 | CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo, 230 | "curl_easy_getinfo expects a pointer to " 231 | "'struct curl_tlssessioninfo *' for this info") 232 | CURLWARNING(_curl_easy_getinfo_err_curl_certinfo, 233 | "curl_easy_getinfo expects a pointer to " 234 | "'struct curl_certinfo *' for this info") 235 | CURLWARNING(_curl_easy_getinfo_err_curl_socket, 236 | "curl_easy_getinfo expects a pointer to curl_socket_t for this info") 237 | CURLWARNING(_curl_easy_getinfo_err_curl_off_t, 238 | "curl_easy_getinfo expects a pointer to curl_off_t for this info") 239 | 240 | /* groups of curl_easy_setops options that take the same type of argument */ 241 | 242 | /* To add a new option to one of the groups, just add 243 | * (option) == CURLOPT_SOMETHING 244 | * to the or-expression. If the option takes a long or curl_off_t, you don't 245 | * have to do anything 246 | */ 247 | 248 | /* evaluates to true if option takes a long argument */ 249 | #define curlcheck_long_option(option) \ 250 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) 251 | 252 | #define curlcheck_off_t_option(option) \ 253 | (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB)) 254 | 255 | /* evaluates to true if option takes a char* argument */ 256 | #define curlcheck_string_option(option) \ 257 | ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \ 258 | (option) == CURLOPT_ACCEPT_ENCODING || \ 259 | (option) == CURLOPT_ALTSVC || \ 260 | (option) == CURLOPT_CAINFO || \ 261 | (option) == CURLOPT_CAPATH || \ 262 | (option) == CURLOPT_COOKIE || \ 263 | (option) == CURLOPT_COOKIEFILE || \ 264 | (option) == CURLOPT_COOKIEJAR || \ 265 | (option) == CURLOPT_COOKIELIST || \ 266 | (option) == CURLOPT_CRLFILE || \ 267 | (option) == CURLOPT_CUSTOMREQUEST || \ 268 | (option) == CURLOPT_DEFAULT_PROTOCOL || \ 269 | (option) == CURLOPT_DNS_INTERFACE || \ 270 | (option) == CURLOPT_DNS_LOCAL_IP4 || \ 271 | (option) == CURLOPT_DNS_LOCAL_IP6 || \ 272 | (option) == CURLOPT_DNS_SERVERS || \ 273 | (option) == CURLOPT_DOH_URL || \ 274 | (option) == CURLOPT_EGDSOCKET || \ 275 | (option) == CURLOPT_FTP_ACCOUNT || \ 276 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ 277 | (option) == CURLOPT_FTPPORT || \ 278 | (option) == CURLOPT_HSTS || \ 279 | (option) == CURLOPT_INTERFACE || \ 280 | (option) == CURLOPT_ISSUERCERT || \ 281 | (option) == CURLOPT_KEYPASSWD || \ 282 | (option) == CURLOPT_KRBLEVEL || \ 283 | (option) == CURLOPT_LOGIN_OPTIONS || \ 284 | (option) == CURLOPT_MAIL_AUTH || \ 285 | (option) == CURLOPT_MAIL_FROM || \ 286 | (option) == CURLOPT_NETRC_FILE || \ 287 | (option) == CURLOPT_NOPROXY || \ 288 | (option) == CURLOPT_PASSWORD || \ 289 | (option) == CURLOPT_PINNEDPUBLICKEY || \ 290 | (option) == CURLOPT_PRE_PROXY || \ 291 | (option) == CURLOPT_PROTOCOLS_STR || \ 292 | (option) == CURLOPT_PROXY || \ 293 | (option) == CURLOPT_PROXY_CAINFO || \ 294 | (option) == CURLOPT_PROXY_CAPATH || \ 295 | (option) == CURLOPT_PROXY_CRLFILE || \ 296 | (option) == CURLOPT_PROXY_ISSUERCERT || \ 297 | (option) == CURLOPT_PROXY_KEYPASSWD || \ 298 | (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \ 299 | (option) == CURLOPT_PROXY_SERVICE_NAME || \ 300 | (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \ 301 | (option) == CURLOPT_PROXY_SSLCERT || \ 302 | (option) == CURLOPT_PROXY_SSLCERTTYPE || \ 303 | (option) == CURLOPT_PROXY_SSLKEY || \ 304 | (option) == CURLOPT_PROXY_SSLKEYTYPE || \ 305 | (option) == CURLOPT_PROXY_TLS13_CIPHERS || \ 306 | (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \ 307 | (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \ 308 | (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \ 309 | (option) == CURLOPT_PROXYPASSWORD || \ 310 | (option) == CURLOPT_PROXYUSERNAME || \ 311 | (option) == CURLOPT_PROXYUSERPWD || \ 312 | (option) == CURLOPT_RANDOM_FILE || \ 313 | (option) == CURLOPT_RANGE || \ 314 | (option) == CURLOPT_REDIR_PROTOCOLS_STR || \ 315 | (option) == CURLOPT_REFERER || \ 316 | (option) == CURLOPT_REQUEST_TARGET || \ 317 | (option) == CURLOPT_RTSP_SESSION_ID || \ 318 | (option) == CURLOPT_RTSP_STREAM_URI || \ 319 | (option) == CURLOPT_RTSP_TRANSPORT || \ 320 | (option) == CURLOPT_SASL_AUTHZID || \ 321 | (option) == CURLOPT_SERVICE_NAME || \ 322 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ 323 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ 324 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \ 325 | (option) == CURLOPT_SSH_KNOWNHOSTS || \ 326 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ 327 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ 328 | (option) == CURLOPT_SSLCERT || \ 329 | (option) == CURLOPT_SSLCERTTYPE || \ 330 | (option) == CURLOPT_SSLENGINE || \ 331 | (option) == CURLOPT_SSLKEY || \ 332 | (option) == CURLOPT_SSLKEYTYPE || \ 333 | (option) == CURLOPT_SSL_CIPHER_LIST || \ 334 | (option) == CURLOPT_TLS13_CIPHERS || \ 335 | (option) == CURLOPT_TLSAUTH_PASSWORD || \ 336 | (option) == CURLOPT_TLSAUTH_TYPE || \ 337 | (option) == CURLOPT_TLSAUTH_USERNAME || \ 338 | (option) == CURLOPT_UNIX_SOCKET_PATH || \ 339 | (option) == CURLOPT_URL || \ 340 | (option) == CURLOPT_USERAGENT || \ 341 | (option) == CURLOPT_USERNAME || \ 342 | (option) == CURLOPT_AWS_SIGV4 || \ 343 | (option) == CURLOPT_USERPWD || \ 344 | (option) == CURLOPT_XOAUTH2_BEARER || \ 345 | (option) == CURLOPT_SSL_EC_CURVES || \ 346 | 0) 347 | 348 | /* evaluates to true if option takes a curl_write_callback argument */ 349 | #define curlcheck_write_cb_option(option) \ 350 | ((option) == CURLOPT_HEADERFUNCTION || \ 351 | (option) == CURLOPT_WRITEFUNCTION) 352 | 353 | /* evaluates to true if option takes a curl_conv_callback argument */ 354 | #define curlcheck_conv_cb_option(option) \ 355 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ 356 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ 357 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) 358 | 359 | /* evaluates to true if option takes a data argument to pass to a callback */ 360 | #define curlcheck_cb_data_option(option) \ 361 | ((option) == CURLOPT_CHUNK_DATA || \ 362 | (option) == CURLOPT_CLOSESOCKETDATA || \ 363 | (option) == CURLOPT_DEBUGDATA || \ 364 | (option) == CURLOPT_FNMATCH_DATA || \ 365 | (option) == CURLOPT_HEADERDATA || \ 366 | (option) == CURLOPT_HSTSREADDATA || \ 367 | (option) == CURLOPT_HSTSWRITEDATA || \ 368 | (option) == CURLOPT_INTERLEAVEDATA || \ 369 | (option) == CURLOPT_IOCTLDATA || \ 370 | (option) == CURLOPT_OPENSOCKETDATA || \ 371 | (option) == CURLOPT_PREREQDATA || \ 372 | (option) == CURLOPT_PROGRESSDATA || \ 373 | (option) == CURLOPT_READDATA || \ 374 | (option) == CURLOPT_SEEKDATA || \ 375 | (option) == CURLOPT_SOCKOPTDATA || \ 376 | (option) == CURLOPT_SSH_KEYDATA || \ 377 | (option) == CURLOPT_SSL_CTX_DATA || \ 378 | (option) == CURLOPT_WRITEDATA || \ 379 | (option) == CURLOPT_RESOLVER_START_DATA || \ 380 | (option) == CURLOPT_TRAILERDATA || \ 381 | (option) == CURLOPT_SSH_HOSTKEYDATA || \ 382 | 0) 383 | 384 | /* evaluates to true if option takes a POST data argument (void* or char*) */ 385 | #define curlcheck_postfields_option(option) \ 386 | ((option) == CURLOPT_POSTFIELDS || \ 387 | (option) == CURLOPT_COPYPOSTFIELDS || \ 388 | 0) 389 | 390 | /* evaluates to true if option takes a struct curl_slist * argument */ 391 | #define curlcheck_slist_option(option) \ 392 | ((option) == CURLOPT_HTTP200ALIASES || \ 393 | (option) == CURLOPT_HTTPHEADER || \ 394 | (option) == CURLOPT_MAIL_RCPT || \ 395 | (option) == CURLOPT_POSTQUOTE || \ 396 | (option) == CURLOPT_PREQUOTE || \ 397 | (option) == CURLOPT_PROXYHEADER || \ 398 | (option) == CURLOPT_QUOTE || \ 399 | (option) == CURLOPT_RESOLVE || \ 400 | (option) == CURLOPT_TELNETOPTIONS || \ 401 | (option) == CURLOPT_CONNECT_TO || \ 402 | 0) 403 | 404 | /* groups of curl_easy_getinfo infos that take the same type of argument */ 405 | 406 | /* evaluates to true if info expects a pointer to char * argument */ 407 | #define curlcheck_string_info(info) \ 408 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \ 409 | (info) != CURLINFO_PRIVATE) 410 | 411 | /* evaluates to true if info expects a pointer to long argument */ 412 | #define curlcheck_long_info(info) \ 413 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) 414 | 415 | /* evaluates to true if info expects a pointer to double argument */ 416 | #define curlcheck_double_info(info) \ 417 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) 418 | 419 | /* true if info expects a pointer to struct curl_slist * argument */ 420 | #define curlcheck_slist_info(info) \ 421 | (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST)) 422 | 423 | /* true if info expects a pointer to struct curl_tlssessioninfo * argument */ 424 | #define curlcheck_tlssessioninfo_info(info) \ 425 | (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION)) 426 | 427 | /* true if info expects a pointer to struct curl_certinfo * argument */ 428 | #define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO) 429 | 430 | /* true if info expects a pointer to struct curl_socket_t argument */ 431 | #define curlcheck_socket_info(info) \ 432 | (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T) 433 | 434 | /* true if info expects a pointer to curl_off_t argument */ 435 | #define curlcheck_off_t_info(info) \ 436 | (CURLINFO_OFF_T < (info)) 437 | 438 | 439 | /* typecheck helpers -- check whether given expression has requested type*/ 440 | 441 | /* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros, 442 | * otherwise define a new macro. Search for __builtin_types_compatible_p 443 | * in the GCC manual. 444 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is 445 | * the actual expression passed to the curl_easy_setopt macro. This 446 | * means that you can only apply the sizeof and __typeof__ operators, no 447 | * == or whatsoever. 448 | */ 449 | 450 | /* XXX: should evaluate to true if expr is a pointer */ 451 | #define curlcheck_any_ptr(expr) \ 452 | (sizeof(expr) == sizeof(void *)) 453 | 454 | /* evaluates to true if expr is NULL */ 455 | /* XXX: must not evaluate expr, so this check is not accurate */ 456 | #define curlcheck_NULL(expr) \ 457 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) 458 | 459 | /* evaluates to true if expr is type*, const type* or NULL */ 460 | #define curlcheck_ptr(expr, type) \ 461 | (curlcheck_NULL(expr) || \ 462 | __builtin_types_compatible_p(__typeof__(expr), type *) || \ 463 | __builtin_types_compatible_p(__typeof__(expr), const type *)) 464 | 465 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */ 466 | #define curlcheck_arr(expr, type) \ 467 | (curlcheck_ptr((expr), type) || \ 468 | __builtin_types_compatible_p(__typeof__(expr), type [])) 469 | 470 | /* evaluates to true if expr is a string */ 471 | #define curlcheck_string(expr) \ 472 | (curlcheck_arr((expr), char) || \ 473 | curlcheck_arr((expr), signed char) || \ 474 | curlcheck_arr((expr), unsigned char)) 475 | 476 | /* evaluates to true if expr is a long (no matter the signedness) 477 | * XXX: for now, int is also accepted (and therefore short and char, which 478 | * are promoted to int when passed to a variadic function) */ 479 | #define curlcheck_long(expr) \ 480 | (__builtin_types_compatible_p(__typeof__(expr), long) || \ 481 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \ 482 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ 483 | __builtin_types_compatible_p(__typeof__(expr), int) || \ 484 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \ 485 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ 486 | __builtin_types_compatible_p(__typeof__(expr), short) || \ 487 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \ 488 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ 489 | __builtin_types_compatible_p(__typeof__(expr), char) || \ 490 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \ 491 | __builtin_types_compatible_p(__typeof__(expr), unsigned char)) 492 | 493 | /* evaluates to true if expr is of type curl_off_t */ 494 | #define curlcheck_off_t(expr) \ 495 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) 496 | 497 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ 498 | /* XXX: also check size of an char[] array? */ 499 | #define curlcheck_error_buffer(expr) \ 500 | (curlcheck_NULL(expr) || \ 501 | __builtin_types_compatible_p(__typeof__(expr), char *) || \ 502 | __builtin_types_compatible_p(__typeof__(expr), char[])) 503 | 504 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */ 505 | #if 0 506 | #define curlcheck_cb_data(expr) \ 507 | (curlcheck_ptr((expr), void) || \ 508 | curlcheck_ptr((expr), FILE)) 509 | #else /* be less strict */ 510 | #define curlcheck_cb_data(expr) \ 511 | curlcheck_any_ptr(expr) 512 | #endif 513 | 514 | /* evaluates to true if expr is of type FILE* */ 515 | #define curlcheck_FILE(expr) \ 516 | (curlcheck_NULL(expr) || \ 517 | (__builtin_types_compatible_p(__typeof__(expr), FILE *))) 518 | 519 | /* evaluates to true if expr can be passed as POST data (void* or char*) */ 520 | #define curlcheck_postfields(expr) \ 521 | (curlcheck_ptr((expr), void) || \ 522 | curlcheck_arr((expr), char) || \ 523 | curlcheck_arr((expr), unsigned char)) 524 | 525 | /* helper: __builtin_types_compatible_p distinguishes between functions and 526 | * function pointers, hide it */ 527 | #define curlcheck_cb_compatible(func, type) \ 528 | (__builtin_types_compatible_p(__typeof__(func), type) || \ 529 | __builtin_types_compatible_p(__typeof__(func) *, type)) 530 | 531 | /* evaluates to true if expr is of type curl_resolver_start_callback */ 532 | #define curlcheck_resolver_start_callback(expr) \ 533 | (curlcheck_NULL(expr) || \ 534 | curlcheck_cb_compatible((expr), curl_resolver_start_callback)) 535 | 536 | /* evaluates to true if expr is of type curl_read_callback or "similar" */ 537 | #define curlcheck_read_cb(expr) \ 538 | (curlcheck_NULL(expr) || \ 539 | curlcheck_cb_compatible((expr), __typeof__(fread) *) || \ 540 | curlcheck_cb_compatible((expr), curl_read_callback) || \ 541 | curlcheck_cb_compatible((expr), _curl_read_callback1) || \ 542 | curlcheck_cb_compatible((expr), _curl_read_callback2) || \ 543 | curlcheck_cb_compatible((expr), _curl_read_callback3) || \ 544 | curlcheck_cb_compatible((expr), _curl_read_callback4) || \ 545 | curlcheck_cb_compatible((expr), _curl_read_callback5) || \ 546 | curlcheck_cb_compatible((expr), _curl_read_callback6)) 547 | typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *); 548 | typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *); 549 | typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *); 550 | typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *); 551 | typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *); 552 | typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *); 553 | 554 | /* evaluates to true if expr is of type curl_write_callback or "similar" */ 555 | #define curlcheck_write_cb(expr) \ 556 | (curlcheck_read_cb(expr) || \ 557 | curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \ 558 | curlcheck_cb_compatible((expr), curl_write_callback) || \ 559 | curlcheck_cb_compatible((expr), _curl_write_callback1) || \ 560 | curlcheck_cb_compatible((expr), _curl_write_callback2) || \ 561 | curlcheck_cb_compatible((expr), _curl_write_callback3) || \ 562 | curlcheck_cb_compatible((expr), _curl_write_callback4) || \ 563 | curlcheck_cb_compatible((expr), _curl_write_callback5) || \ 564 | curlcheck_cb_compatible((expr), _curl_write_callback6)) 565 | typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *); 566 | typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t, 567 | const void *); 568 | typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *); 569 | typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *); 570 | typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t, 571 | const void *); 572 | typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *); 573 | 574 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ 575 | #define curlcheck_ioctl_cb(expr) \ 576 | (curlcheck_NULL(expr) || \ 577 | curlcheck_cb_compatible((expr), curl_ioctl_callback) || \ 578 | curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \ 579 | curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \ 580 | curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \ 581 | curlcheck_cb_compatible((expr), _curl_ioctl_callback4)) 582 | typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *); 583 | typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *); 584 | typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *); 585 | typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *); 586 | 587 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ 588 | #define curlcheck_sockopt_cb(expr) \ 589 | (curlcheck_NULL(expr) || \ 590 | curlcheck_cb_compatible((expr), curl_sockopt_callback) || \ 591 | curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \ 592 | curlcheck_cb_compatible((expr), _curl_sockopt_callback2)) 593 | typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); 594 | typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t, 595 | curlsocktype); 596 | 597 | /* evaluates to true if expr is of type curl_opensocket_callback or 598 | "similar" */ 599 | #define curlcheck_opensocket_cb(expr) \ 600 | (curlcheck_NULL(expr) || \ 601 | curlcheck_cb_compatible((expr), curl_opensocket_callback) || \ 602 | curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \ 603 | curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \ 604 | curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \ 605 | curlcheck_cb_compatible((expr), _curl_opensocket_callback4)) 606 | typedef curl_socket_t (*_curl_opensocket_callback1) 607 | (void *, curlsocktype, struct curl_sockaddr *); 608 | typedef curl_socket_t (*_curl_opensocket_callback2) 609 | (void *, curlsocktype, const struct curl_sockaddr *); 610 | typedef curl_socket_t (*_curl_opensocket_callback3) 611 | (const void *, curlsocktype, struct curl_sockaddr *); 612 | typedef curl_socket_t (*_curl_opensocket_callback4) 613 | (const void *, curlsocktype, const struct curl_sockaddr *); 614 | 615 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */ 616 | #define curlcheck_progress_cb(expr) \ 617 | (curlcheck_NULL(expr) || \ 618 | curlcheck_cb_compatible((expr), curl_progress_callback) || \ 619 | curlcheck_cb_compatible((expr), _curl_progress_callback1) || \ 620 | curlcheck_cb_compatible((expr), _curl_progress_callback2)) 621 | typedef int (*_curl_progress_callback1)(void *, 622 | double, double, double, double); 623 | typedef int (*_curl_progress_callback2)(const void *, 624 | double, double, double, double); 625 | 626 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */ 627 | #define curlcheck_debug_cb(expr) \ 628 | (curlcheck_NULL(expr) || \ 629 | curlcheck_cb_compatible((expr), curl_debug_callback) || \ 630 | curlcheck_cb_compatible((expr), _curl_debug_callback1) || \ 631 | curlcheck_cb_compatible((expr), _curl_debug_callback2) || \ 632 | curlcheck_cb_compatible((expr), _curl_debug_callback3) || \ 633 | curlcheck_cb_compatible((expr), _curl_debug_callback4) || \ 634 | curlcheck_cb_compatible((expr), _curl_debug_callback5) || \ 635 | curlcheck_cb_compatible((expr), _curl_debug_callback6) || \ 636 | curlcheck_cb_compatible((expr), _curl_debug_callback7) || \ 637 | curlcheck_cb_compatible((expr), _curl_debug_callback8)) 638 | typedef int (*_curl_debug_callback1) (CURL *, 639 | curl_infotype, char *, size_t, void *); 640 | typedef int (*_curl_debug_callback2) (CURL *, 641 | curl_infotype, char *, size_t, const void *); 642 | typedef int (*_curl_debug_callback3) (CURL *, 643 | curl_infotype, const char *, size_t, void *); 644 | typedef int (*_curl_debug_callback4) (CURL *, 645 | curl_infotype, const char *, size_t, const void *); 646 | typedef int (*_curl_debug_callback5) (CURL *, 647 | curl_infotype, unsigned char *, size_t, void *); 648 | typedef int (*_curl_debug_callback6) (CURL *, 649 | curl_infotype, unsigned char *, size_t, const void *); 650 | typedef int (*_curl_debug_callback7) (CURL *, 651 | curl_infotype, const unsigned char *, size_t, void *); 652 | typedef int (*_curl_debug_callback8) (CURL *, 653 | curl_infotype, const unsigned char *, size_t, const void *); 654 | 655 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ 656 | /* this is getting even messier... */ 657 | #define curlcheck_ssl_ctx_cb(expr) \ 658 | (curlcheck_NULL(expr) || \ 659 | curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \ 660 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \ 661 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \ 662 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \ 663 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \ 664 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \ 665 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \ 666 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \ 667 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8)) 668 | typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *); 669 | typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *); 670 | typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *); 671 | typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *, 672 | const void *); 673 | #ifdef HEADER_SSL_H 674 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX 675 | * this will of course break if we're included before OpenSSL headers... 676 | */ 677 | typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *); 678 | typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *); 679 | typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *); 680 | typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *, 681 | const void *); 682 | #else 683 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; 684 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; 685 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; 686 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; 687 | #endif 688 | 689 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */ 690 | #define curlcheck_conv_cb(expr) \ 691 | (curlcheck_NULL(expr) || \ 692 | curlcheck_cb_compatible((expr), curl_conv_callback) || \ 693 | curlcheck_cb_compatible((expr), _curl_conv_callback1) || \ 694 | curlcheck_cb_compatible((expr), _curl_conv_callback2) || \ 695 | curlcheck_cb_compatible((expr), _curl_conv_callback3) || \ 696 | curlcheck_cb_compatible((expr), _curl_conv_callback4)) 697 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); 698 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); 699 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); 700 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); 701 | 702 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */ 703 | #define curlcheck_seek_cb(expr) \ 704 | (curlcheck_NULL(expr) || \ 705 | curlcheck_cb_compatible((expr), curl_seek_callback) || \ 706 | curlcheck_cb_compatible((expr), _curl_seek_callback1) || \ 707 | curlcheck_cb_compatible((expr), _curl_seek_callback2)) 708 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); 709 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); 710 | 711 | 712 | #endif /* CURLINC_TYPECHECK_GCC_H */ 713 | --------------------------------------------------------------------------------