Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
version 0.1.2
Browse files Browse the repository at this point in the history
[Chakra]preload
  • Loading branch information
ShrBox committed Feb 7, 2021
1 parent 16ba560 commit 2ed3544
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
20 changes: 20 additions & 0 deletions Chakra/Chakra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,27 @@

#include "pch.h"
#include "framework.h"
#include <filesystem>
#include "Chakra.h"

void preload() {
static std::vector<std::pair<std::wstring, HMODULE>> libs;
std::filesystem::create_directory("plugins_preload");
std::filesystem::directory_iterator ent("plugins_preload");
std::cout << "[Chakra] Loading preload plugins\n";
for (auto& i : ent) {
if (i.is_regular_file() && i.path().extension() == ".dll") {
auto lib = LoadLibrary(i.path().c_str());
if (lib) {
std::cout << "[Chakra] Plugin " << canonical(i.path()) << " loaded\n";
libs.push_back({ std::wstring{ i.path().c_str() }, lib });
}
else {
std::cout << "[Chakra] Error when loading " << i.path() << "\n";
}
}
}
}

#pragma comment(linker, "/export:HookFunction=LiteLoader.HookFunction")
#pragma comment(linker, "/export:GetServerSymbol=LiteLoader.dlsym_real")
1 change: 1 addition & 0 deletions Chakra/Chakra.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<PreprocessorDefinitions>NDEBUG;CHAKRA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
4 changes: 4 additions & 0 deletions Chakra/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"

void preload();

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
Expand All @@ -10,6 +12,8 @@ BOOL APIENTRY DllMain( HMODULE hModule,
{
case DLL_PROCESS_ATTACH: {
std::wcout << "LiteLoader Injected" << std::endl;
system("chcp 65001");
preload();
if (!LoadLibrary(TEXT("LiteLoader.dll"))) {
std::wcout << "[Error] Can't load LiteLoader " << GetLastError() << std::endl;
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion LiteLoader/LiteLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void entry(bool fixcwd) {

THook(int, "main", int a, void* b) {
std::ios::sync_with_stdio(false);
system("chcp 65001");
//system("chcp 65001");
entry(a > 1);
return original(a, b);
}
2 changes: 1 addition & 1 deletion headers/liteloader.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#pragma once
#define LIAPI __declspec(dllexport)
const std::string getVersion = "0.1.1 Beta";
const std::string getVersion = "0.1.2";

0 comments on commit 2ed3544

Please # to comment.