mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-23 22:05:36 +08:00
parent
6e011c5780
commit
7518d4a8eb
@ -4,7 +4,7 @@ target_precompile_headers(ToClipboard REUSE_FROM pch)
|
||||
set_target_properties(ToClipboard PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugin${bitappendix}")
|
||||
endif()
|
||||
|
||||
if(0) #pluginmanager->QtLoadLibrarys
|
||||
|
||||
include(QtUtils.cmake)
|
||||
msvc_registry_search()
|
||||
if(Qt5_DIR)
|
||||
@ -16,4 +16,3 @@ if(Qt5_DIR)
|
||||
target_link_libraries(QtLoader Qt5::Widgets Qt5::Core)
|
||||
set_target_properties(QtLoader PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugin${bitappendix}")
|
||||
endif()
|
||||
endif()
|
@ -108,6 +108,14 @@ std::vector<HMODULE> QtLoadLibrarys(std::vector<std::wstring>&collectQtplugs)
|
||||
|
||||
return modules;
|
||||
}
|
||||
typedef HMODULE*(*QtLoadLibrary_t)(LPWSTR*,int);
|
||||
QtLoadLibrary_t loadqtloader(const std::filesystem::path&pluginpath){
|
||||
auto QtLoaderPath=pluginpath/"QtLoader.dll";
|
||||
auto helper=LoadLibrary(QtLoaderPath.c_str());
|
||||
if(helper==0)return 0;
|
||||
auto QtLoadLibrary = (QtLoadLibrary_t)GetProcAddress(helper, "QtLoadLibrary");
|
||||
return QtLoadLibrary;
|
||||
}
|
||||
void Pluginmanager::loadqtdlls(std::vector<std::wstring>&collectQtplugs){
|
||||
if(collectQtplugs.size()==0)return;
|
||||
auto pluginpath=std::filesystem::current_path()/(x64?"plugin64":"plugin32");
|
||||
@ -120,8 +128,23 @@ void Pluginmanager::loadqtdlls(std::vector<std::wstring>&collectQtplugs){
|
||||
}
|
||||
SetEnvironmentVariableW(L"PATH",envs.c_str());
|
||||
|
||||
auto modules=QtLoadLibrarys(collectQtplugs);
|
||||
if(modules.empty())return;
|
||||
// auto modules=QtLoadLibrarys(collectQtplugs);
|
||||
// if(modules.empty())return;
|
||||
|
||||
|
||||
auto QtLoadLibrary = loadqtloader(pluginpath);
|
||||
if(!QtLoadLibrary){
|
||||
MessageBoxW(host->winId,CantLoadQtLoader,L"Error",0);
|
||||
return ;
|
||||
}
|
||||
std::vector<wchar_t*>saves;
|
||||
for(auto&p:collectQtplugs){
|
||||
auto str=new wchar_t[p.size()+1];
|
||||
wcscpy(str,p.c_str());
|
||||
saves.emplace_back(str);
|
||||
}
|
||||
auto modules=QtLoadLibrary(saves.data(),collectQtplugs.size());
|
||||
for(auto str:saves)delete str;
|
||||
|
||||
for(int i=0;i<collectQtplugs.size();i++){
|
||||
OnNewSentenceS[collectQtplugs[i]]=GetProcAddress(modules[i],"OnNewSentence");
|
||||
|
Loading…
Reference in New Issue
Block a user