fixing mingw errors
VoidLoader/VoidLoaderCore/pipeline/head There was a failure building this commit
VoidLoader/VoidLoaderCore/pipeline/head There was a failure building this commit
Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
5 files changed
+39
-33
No files matched your search
@@ -1,9 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#if defined(unix)
|
#if defined(unix)
|
||||||
#include <string>
|
#include <string>
|
||||||
|
namespace vl::mod {
|
||||||
|
|
||||||
|
void* LoadLibrary(const std::string& path, bool isGlobal);
|
||||||
|
bool CloseLibrary(void* handle);
|
||||||
|
void* LoadSymbol(void* handle, const std::string& name);
|
||||||
|
|
||||||
void* LoadLibrary(const std::string& path, bool isGlobal);
|
}
|
||||||
bool CloseLibrary(void* handle);
|
|
||||||
void* LoadSymbol(void* handle, const std::string& name);
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
namespace vl::mod {
|
||||||
void* LoadLibrary(const std::string& path, bool isGlobal);
|
void* LoadLibrary(const std::string& path, bool isGlobal);
|
||||||
bool CloseLibrary(void* handle);
|
bool CloseLibrary(void* handle);
|
||||||
void* LoadSymbol(void* handle, const std::string& name);
|
void* LoadSymbol(void* handle, const std::string& name);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -35,7 +35,7 @@ namespace vl::Agent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadLibrary(mods.at("VoidLoaderApi.vlmod").string(), true);
|
vl::mod::LoadLibrary(mods.at("VoidLoaderApi.vlmod").string(), true);
|
||||||
mods.erase("VoidLoaderApi.vlmod");
|
mods.erase("VoidLoaderApi.vlmod");
|
||||||
mods.erase("VoidLoader.vlmod");
|
mods.erase("VoidLoader.vlmod");
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,20 @@
|
|||||||
|
|
||||||
#include <Mods/LoadLibraryUnix.hpp>
|
#include <Mods/LoadLibraryUnix.hpp>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
namespace vl::mod {
|
||||||
void* LoadLibrary(const std::string& path, bool isGlobal)
|
void* LoadLibrary(const std::string& path, bool isGlobal)
|
||||||
{
|
{
|
||||||
dlerror();
|
dlerror();
|
||||||
return dlopen(path.c_str(), isGlobal ? RTLD_NOW | RTLD_GLOBAL : RTLD_NOW);
|
return dlopen(path.c_str(), isGlobal ? RTLD_NOW | RTLD_GLOBAL : RTLD_NOW);
|
||||||
}
|
}
|
||||||
bool CloseLibrary(void* handle)
|
bool CloseLibrary(void* handle)
|
||||||
{
|
{
|
||||||
return dlclose(handle) == 0;
|
return dlclose(handle) == 0;
|
||||||
}
|
}
|
||||||
void* LoadSymbol(void* handle, const std::string& name)
|
void* LoadSymbol(void* handle, const std::string& name)
|
||||||
{
|
{
|
||||||
dlerror();
|
dlerror();
|
||||||
return dlsym(handle, name.c_str());
|
return dlsym(handle, name.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
+18
-16
@@ -4,8 +4,10 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
||||||
static int32_t __wtf8_decode1(const char** input) {
|
namespace vl::mod {
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
static int32_t __wtf8_decode1(const char** input) {
|
||||||
uint32_t code_point;
|
uint32_t code_point;
|
||||||
uint8_t b1;
|
uint8_t b1;
|
||||||
uint8_t b2;
|
uint8_t b2;
|
||||||
@@ -45,9 +47,9 @@ static int32_t __wtf8_decode1(const char** input) {
|
|||||||
|
|
||||||
/* code point too large */
|
/* code point too large */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t wtf8_length_as_utf16(const char* source_ptr) {
|
ssize_t wtf8_length_as_utf16(const char* source_ptr) {
|
||||||
size_t w_target_len = 0;
|
size_t w_target_len = 0;
|
||||||
int32_t code_point;
|
int32_t code_point;
|
||||||
|
|
||||||
@@ -61,9 +63,9 @@ ssize_t wtf8_length_as_utf16(const char* source_ptr) {
|
|||||||
} while (*source_ptr++);
|
} while (*source_ptr++);
|
||||||
|
|
||||||
return w_target_len;
|
return w_target_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wtf8_to_utf16(const char* source_ptr,
|
void wtf8_to_utf16(const char* source_ptr,
|
||||||
WCHAR* w_target,
|
WCHAR* w_target,
|
||||||
size_t w_target_len) {
|
size_t w_target_len) {
|
||||||
int32_t code_point;
|
int32_t code_point;
|
||||||
@@ -85,10 +87,10 @@ void wtf8_to_utf16(const char* source_ptr,
|
|||||||
|
|
||||||
(void)w_target_len;
|
(void)w_target_len;
|
||||||
assert(w_target_len == 0);
|
assert(w_target_len == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* LoadLibrary(const std::string& path, bool isGlobal)
|
void* LoadLibrary(const std::string& path, bool isGlobal)
|
||||||
{
|
{
|
||||||
WCHAR filename_w[32768];
|
WCHAR filename_w[32768];
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
void* handle = nullptr;
|
void* handle = nullptr;
|
||||||
@@ -101,14 +103,14 @@ void* LoadLibrary(const std::string& path, bool isGlobal)
|
|||||||
wtf8_to_utf16(path.c_str(), filename_w, r);
|
wtf8_to_utf16(path.c_str(), filename_w, r);
|
||||||
|
|
||||||
return LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
return LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||||
}
|
}
|
||||||
bool CloseLibrary(void* handle)
|
bool CloseLibrary(void* handle)
|
||||||
{
|
{
|
||||||
return FreeLibrary(static_cast<HMODULE>(handle)) != 0;
|
return FreeLibrary(static_cast<HMODULE>(handle)) != 0;
|
||||||
}
|
}
|
||||||
void* LoadSymbol(void* handle, const std::string& name)
|
void* LoadSymbol(void* handle, const std::string& name)
|
||||||
{
|
{
|
||||||
return (void*)(uintptr_t) GetProcAddress(static_cast<HMODULE>(handle), name.c_str());
|
return (void*)(uintptr_t) GetProcAddress(static_cast<HMODULE>(handle), name.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user