mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-24 04:04:14 +08:00
fix
1
This commit is contained in:
parent
ebe0048bb2
commit
fea96595c5
@ -25,9 +25,10 @@ else()
|
||||
endif()
|
||||
|
||||
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x${bitappendix})
|
||||
set(binary_out_putpath ${CMAKE_SOURCE_DIR}/builds/output)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${binary_out_putpath}>)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${binary_out_putpath}>)
|
||||
|
||||
include_directories(.)
|
||||
include(libs/libs.cmake)
|
||||
|
@ -52,4 +52,5 @@
|
||||
#define MenuCopyHookCode L"CopyHookCode"
|
||||
#define MenuRemoveHook L"RemoveHook"
|
||||
#define MenuDetachProcess L"DetachProcess"
|
||||
#define DefaultFont L"Arial"
|
||||
#define DefaultFont L"Arial"
|
||||
#define InVaildPlugin L"InVaild Plugin"
|
@ -1,5 +1,6 @@
|
||||
add_executable(LunaHost WIN32 controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp luna.rc pluginmanager.cpp pluginexample.cpp)
|
||||
add_executable(LunaHost WIN32 controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp luna.rc pluginmanager.cpp Plugin/pluginexample.cpp)
|
||||
target_precompile_headers(LunaHost REUSE_FROM pch)
|
||||
set_target_properties(LunaHost PROPERTIES OUTPUT_NAME "LunaHost${bitappendix}")
|
||||
|
||||
target_link_libraries(LunaHost pch host ${YY_Thunks_for_WinXP})
|
||||
add_subdirectory(Plugin)
|
@ -41,7 +41,7 @@ std::optional<std::wstring>SelectFile(HWND hwnd){
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = hwnd;
|
||||
ofn.lpstrFilter = L"Plugin Files (.dll)\0*.dll\0";
|
||||
ofn.lpstrFilter = L"Plugin Files\0*.dll;*.xdll\0";
|
||||
ofn.lpstrFile = szFileName;
|
||||
ofn.nMaxFile = sizeof(szFileName);
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include"processlistwindow.h"
|
||||
#include"textthread.h"
|
||||
#include"pluginmanager.h"
|
||||
#include"plugin.h"
|
||||
#include"Plugin/plugindef.h"
|
||||
class LunaHost:public mainwindow{
|
||||
|
||||
int64_t currentselect=0;
|
||||
|
4
LunaHost/GUI/Plugin/CMakeLists.txt
Normal file
4
LunaHost/GUI/Plugin/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
add_library(ToClipboard MODULE pluginexample.cpp)
|
||||
target_precompile_headers(ToClipboard REUSE_FROM pch)
|
||||
set_target_properties(ToClipboard PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugin${bitappendix}")
|
@ -1,4 +1,4 @@
|
||||
#include"plugin.h"
|
||||
#include"plugindef.h"
|
||||
|
||||
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include"pluginmanager.h"
|
||||
#include<filesystem>
|
||||
#include"plugin.h"
|
||||
#include"Plugin/plugindef.h"
|
||||
#include<fstream>
|
||||
#include"Lang/Lang.h"
|
||||
std::vector<char> readfile(const wchar_t* fname) {
|
||||
FILE* f;
|
||||
_wfopen_s(&f, fname, L"rb");
|
||||
@ -60,13 +61,14 @@ bool pluginmanager::dispatch(const InfoForExtension* sentenceInfo, std::wstring&
|
||||
HeapFree(GetProcessHeap(), 0, sentenceBuffer);
|
||||
return !sentence.empty();
|
||||
}
|
||||
|
||||
std::optional<std::pair<std::wstring,LPVOID>> pluginmanager::checkisvalidplugin(const std::wstring& pl){
|
||||
auto path=std::filesystem::path(pl);
|
||||
if (!std::filesystem::exists(path))return{};
|
||||
if (!std::filesystem::is_regular_file(path))return{};
|
||||
auto appendix=path.extension().wstring();
|
||||
stolower(appendix);
|
||||
if(appendix!=std::wstring(L".dll"))return {};
|
||||
if((appendix!=std::wstring(L".dll"))&&(appendix!=std::wstring(L".xdll")))return {};
|
||||
auto dll=LoadLibraryW(pl.c_str());
|
||||
if(!dll)return {};
|
||||
auto OnNewSentence=GetProcAddress(dll,"OnNewSentence");
|
||||
@ -94,6 +96,7 @@ bool pluginmanager::addplugin(const std::wstring& p){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
MessageBoxW(0,InVaildPlugin,L"Error",0);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include"plugin.h"
|
||||
#include"Plugin/plugindef.h"
|
||||
#include"textthread.h"
|
||||
class pluginmanager{
|
||||
std::vector<std::pair<std::wstring,LPVOID>>OnNewSentenceS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user