This commit is contained in:
恍兮惚兮 2024-05-03 01:54:36 +08:00
parent 8913587e2f
commit bcf500fdf9
59 changed files with 105 additions and 258 deletions

View File

@ -31,8 +31,12 @@ set(VERSION_MAJOR 2)
set(VERSION_MINOR 48)
set(VERSION_PATCH 0)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)
add_subdirectory(exec)
add_subdirectory(shareddllproxy)
add_subdirectory(winrtutils)
add_subdirectory(winsharedutils)
add_subdirectory(hookmagpie)
add_subdirectory(shareddllproxy)

View File

@ -20,3 +20,6 @@ target_compile_definitions(LunaTranslator_debug PRIVATE PYSTAND_CONSOLE)
add_executable(LunaTranslator WIN32 ${sources})
add_executable(LunaTranslator_admin WIN32 ${sources})
set_target_properties(LunaTranslator_admin PROPERTIES LINK_FLAGS " /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" ")
target_precompile_headers(LunaTranslator_debug REUSE_FROM pch)
target_precompile_headers(LunaTranslator_admin REUSE_FROM pch)
target_precompile_headers(LunaTranslator REUSE_FROM pch)

View File

@ -9,18 +9,8 @@
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS 1
#endif
#include <shlwapi.h>
#include <string>
#include <string.h>
#include <winbase.h>
#include <wincon.h>
#include "PyStand.h"
#ifdef _MSC_VER
#pragma comment(lib, "shlwapi.lib")
#endif
//---------------------------------------------------------------------
// dtor

View File

@ -9,13 +9,6 @@
#ifndef _PYSTAND_H_
#define _PYSTAND_H_
#include <stdio.h>
#include <windows.h>
#include <shlwapi.h>
#include <string>
#include <vector>
//---------------------------------------------------------------------
// PyStand
//---------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
add_library(hookmagpie MODULE hookmagpie.cpp veh_hook.cpp)
target_link_libraries(hookmagpie)
target_precompile_headers(hookmagpie REUSE_FROM pch)
endif()

View File

@ -1,8 +1,4 @@
#include <iostream>
#include <windows.h>
#include <thread>
#include <string>
#include <assert.h>
#include "veh_hook.h"
namespace Win32Utils
{

View File

@ -4,9 +4,7 @@ Version: 24-March-2008
**/
// #define WINVER 0x0501
// #define _WIN32_WINNT 0x0501
#include <windows.h>
#include "veh_hook.h"
#include <mutex>
static veh_list_t *list = NULL;
char int3bp[] = "\xCC";
std::mutex vehlistlock;

View File

@ -5,10 +5,6 @@ Version: 24-March-2008
#ifndef LIST_T_H_INCLUDED
#define LIST_T_H_INCLUDED
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <functional>
// VEH Hooking types
#define VEH_HK_INT3 0
#define VEH_HK_MEM 1

0
plugins/pch.cpp Normal file
View File

77
plugins/pch.h Normal file
View File

@ -0,0 +1,77 @@
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <Shobjidl.h>
#include <malloc.h>
#include <initguid.h>
#include <ShlGuid.h>
#include <strsafe.h>
#include <Audiopolicy.h>
#include <mmdeviceapi.h>
#include <Psapi.h>
#include <atlbase.h>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <fstream>
#include <filesystem>
#include <stdexcept>
#include <cstdint>
#include <mutex>
#include <queue>
#include <thread>
#include <cmath>
#include <cwchar>
#include <comdef.h>
#include <shlwapi.h>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <mshtmhst.h>
#include <exdisp.h>
#include <mshtml.h>
#include <stdlib.h>
#include <iostream>
#include <winbase.h>
#include <wincon.h>
#include <sapi.h>
#include <stdio.h>
#include <sphelper.h>
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <mmsystem.h>
#include <shlobj.h>
#include <cctype>
#include <cassert>
#include <mshtmcid.h>
#include <process.h>
#include <stdint.h>
#include <dwmapi.h>
#include <optional>
#include <unordered_set>
#include <set>
#include <tlhelp32.h>
#include <io.h>
#include <fcntl.h>
#include <crtdefs.h>
#include <memory>
#include <nlohmann/json.hpp>
#include <detours.h>
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib, "Psapi.lib")
#pragma comment(lib, "Version.lib")

View File

@ -13,13 +13,17 @@ generate_product_version(
add_executable(shareddllproxy shareddllproxy.cpp dllinject.cpp ntleas.cpp aspatch.cpp ${versioninfo})
target_precompile_headers(shareddllproxy REUSE_FROM pch)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
add_library(x64lib magpie.cpp lossless.cpp)
target_precompile_headers(x64lib REUSE_FROM pch)
target_link_libraries(shareddllproxy x64lib ${Detours})
set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy64")
else()
add_subdirectory(voiceroid2)
add_library(x86lib dreye.cpp jbj7.cpp kingsoft.cpp le.cpp neospeech.cpp LR.cpp)
target_precompile_headers(voiceroid2 REUSE_FROM pch)
target_precompile_headers(x86lib REUSE_FROM pch)
target_link_libraries(shareddllproxy x86lib voiceroid2 ${Detours})
set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy32")
endif()

View File

@ -1,6 +1,4 @@
#include <Windows.h>
#include <detours.h>
#include <string>
struct LRProfile
{
UINT CodePage;

View File

@ -1,12 +1,3 @@
#include <nlohmann/json.hpp>
#include <filesystem>
#include <fstream>
#include <optional>
#include <thread>
#include <Windows.h>
#include <unordered_set>
#include <set>
#include <tlhelp32.h>
static std::wstring StringToWideString(const std::string &text, UINT encoding = CP_UTF8)
{
std::vector<wchar_t> buffer(text.size() + 1);

View File

@ -1,6 +1,4 @@
#include <iostream>
#include <Windows.h>
int dllinjectwmain(int argc, wchar_t *argv[])
int dllinjectwmain(int argc, wchar_t *argv[])
{
for (int i = 1; i < argc - 1; i += 1)

View File

@ -1,6 +1,3 @@
#include <Windows.h>
#include <iostream>
#include <string>
extern "C"
{
typedef int(__stdcall *MTInitCJ)(int);

View File

@ -1,11 +1,4 @@
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <Windows.h>
#include <io.h>
#include <fcntl.h>
#include <Shlwapi.h>
#define CODEPAGE_JA 932
#define CODEPAGE_GB 936

View File

@ -1,9 +1,4 @@
#include <iostream>
#include <Windows.h>
#include <string>
#include <io.h>
#include <fcntl.h>
extern "C"
{
typedef DWORD(__stdcall *StartSession)(wchar_t *path, void *bufferStart, void *bufferStop, const wchar_t *app);

View File

@ -1,6 +1,4 @@
#include <iostream>
#include <Windows.h>
#define SHIFT_JIS 932
int lewmain(int argc, wchar_t *argv[])

View File

@ -1,9 +1,4 @@

#include <iostream>
#include <windows.h>
#include <thread>
#include <detours.h>
#include <string>
typedef BSTR (*GetAdapterNames_t)();
typedef BSTR (*GetDisplayNames_t)();

View File

@ -1,9 +1,4 @@
// magpiecmdrunner.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <windows.h>

typedef BOOL (*Initialize)(
UINT logLevel,
const char *logFileName,

View File

@ -1,16 +1,4 @@

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <Windows.h>
#include <io.h>
#include <fcntl.h>
#include <vector>
#include <sapi.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <sphelper.h>
bool _Speak(std::wstring &Content, const wchar_t *token, int voiceid, int rate, int volume, std::wstring &FileName)
{
ISpVoice *pVoice = NULL;

View File

@ -1,6 +1,4 @@
#include <string>
#include <Windows.h>
#include <crtdefs.h>
#define NTLEA_PARAMETERS_LENGTH (LF_FACESIZE + 20)
#define szRcpIntMtx "RcpInternalMutex"

View File

@ -1,11 +1,4 @@

#include <Windows.h>
#include <iostream>
#include <string>
#include <psapi.h>
#include <memory>
#include <fstream>
#pragma comment(linker, "/subsystem:windows /entry:wmainCRTStartup")
#pragma comment(linker, "/subsystem:windows /entry:wmainCRTStartup")
int dllinjectwmain(int argc, wchar_t *argv[]);
int ntleaswmain(int argc, wchar_t *wargv[]);

View File

@ -1,9 +1,5 @@
#include "api_adapter.h"
#include <stdexcept>
#include <Windows.h>
#include "ebyutil.h"
namespace ebyroid

View File

@ -1,8 +1,6 @@
#ifndef API_ADAPTER_H
#define API_ADAPTER_H
#include <cstdint>
// forward-declaration to avoid including Windows.h in header
#ifndef _WINDEF_
struct HINSTANCE__;

View File

@ -1,7 +1,5 @@
#include "api_settings.h"
#include <stdexcept>
#include "ebyutil.h"
namespace ebyroid
{

View File

@ -1,9 +1,6 @@
#ifndef API_SETTINGS_H
#define API_SETTINGS_H
#include <string>
#include <cstdint>
namespace ebyroid
{

View File

@ -1,12 +1,5 @@
#include "ebyroid.h"
#include <cstdint>
#include <functional>
#include <stdexcept>
#include <string>
#include <Windows.h>
#include "api_adapter.h"
#include "api_settings.h"
#include "ebyutil.h"

View File

@ -1,9 +1,6 @@
#ifndef EBYROID_H
#define EBYROID_H
#include <cstdint>
#include <string>
#include <vector>
namespace ebyroid
{

View File

@ -1,13 +1,9 @@
#include "ebyroid.h"
#include <Windows.h>
#include "api_adapter.h"
#include "ebyutil.h"
#include <io.h>
#include <fcntl.h>
using ebyroid::Ebyroid;
#include "types.h"
#pragma comment(lib, "winmm.lib")
int voiceroid2wmain(int argc, wchar_t *wargv[])
{

View File

@ -10,7 +10,8 @@ generate_product_version(
VERSION_PATCH ${VERSION_PATCH}
)
add_library(winrtutils MODULE winrtsnapshot.cpp cinterface.cpp dllmain.cpp pch.cpp winrtocr.cpp ${versioninfo})
add_library(winrtutils MODULE winrtsnapshot.cpp cinterface.cpp dllmain.cpp winrtocr.cpp ${versioninfo})
target_precompile_headers(winrtutils REUSE_FROM pch)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils64")
@ -18,4 +19,3 @@ else()
set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils32")
endif()

View File

@ -1,6 +1,4 @@
#include "pch.h"
#include "define.h"
#include <iostream>
void free_all(void *str)
{

View File

@ -1,7 +1,4 @@
#pragma once
#include <string>
#include <vector>
#include <windows.h>
struct ocrres
{
wchar_t **lines;

View File

@ -1,5 +1,4 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include "define.h"
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,

View File

@ -1,5 +0,0 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>

View File

@ -1,5 +0,0 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

View File

@ -1,13 +0,0 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H

View File

@ -1,6 +1,4 @@
#include "pch.h"
#include "define.h"
#include <windows.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Storage.Pickers.h>
#include <winrt/Windows.Storage.Streams.h>
@ -14,9 +12,6 @@
#include <winrt/Windows.Security.Cryptography.h>
#include <winrt/Windows.Globalization.h>
#include <iostream>
#include <fstream>
#include <vector>
using namespace winrt;
using namespace Windows::Foundation;

View File

@ -1,5 +1,4 @@
#include "pch.h"
#include "define.h"
#include "define.h"
#include <dxgi.h>
#include <inspectable.h>
#include <dxgi1_2.h>
@ -19,13 +18,9 @@
#include <winrt/Windows.Storage.Pickers.h>
#include <winrt/Windows.Storage.Streams.h>
#include <roerrorapi.h>
#include <dwmapi.h>
#include <filesystem>
#include <Windows.h>
#include <gdiplus.h>
// #include "ImageFormatConversion.hpp"
#pragma comment(lib, "Dwmapi.lib")
#pragma comment(lib, "windowsapp.lib")
#pragma comment(lib, "DXGI.lib")
#pragma comment(lib, "gdiplus.lib")

View File

@ -1,8 +1,4 @@
#pragma once
#include <fstream>
#include <vector>
#include <stdexcept>
#include <iostream>
#pragma pack(push, 1)
struct BMPFileHeader {

View File

@ -12,11 +12,9 @@ generate_product_version(
)
add_library(winsharedutils MODULE hwnd.cpp darklistener.cpp theme.cpp version.cpp otsu.cpp cinterface.cpp clipboard.cpp lnk.cpp dllmain.cpp levenshtein.cpp muteprocess.cpp sapi_dll.cpp simplemecab.cpp SimpleBrowser.cpp MWebBrowser.cpp icon.cpp maglistener.cpp ${versioninfo})
target_link_libraries(winsharedutils dwmapi)
target_precompile_headers(winsharedutils REUSE_FROM pch)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set_target_properties(winsharedutils PROPERTIES OUTPUT_NAME "winsharedutils64")
else()
set_target_properties(winsharedutils PROPERTIES OUTPUT_NAME "winsharedutils32")
endif()

View File

@ -3,13 +3,6 @@
// This file is public domain software.
#include "MWebBrowser.hpp"
#include <cwchar>
#include <comdef.h>
#include <shlwapi.h>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <mshtmhst.h>
/*static*/ MWebBrowser *
MWebBrowser::Create(HWND hwndParent)

View File

@ -6,10 +6,6 @@
#define MWEB_BROWSER_HPP_ 13 // Version 13
#define INITGUID
#include <windows.h>
#include <exdisp.h>
#include <mshtml.h>
#include <mshtmhst.h>
class MWebBrowser :
public IOleClientSite,

View File

@ -8,21 +8,6 @@
// This file is public domain software.
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <mmsystem.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <mshtml.h>
#include <string>
#include <cctype>
#include <cassert>
#include <strsafe.h>
#include <comdef.h>
#include <mshtmcid.h>
#include <process.h>
#include "MWebBrowser.hpp"
BOOL GetIEVersion(LPWSTR pszVersion, DWORD cchVersionMax)

View File

@ -1,11 +1,5 @@
#include "define.h"
#include <iostream>
#include "cinterface.h"
#include <malloc.h>
#include <mutex>
#include <queue>
#include <Windows.h>
void free_all(void *str)
{
delete str;

View File

@ -1,5 +1,3 @@
#include <string>
#include <vector>
char **vecstr2c(std::vector<std::string> &vs);
int *vecint2c(std::vector<int> &vs);
wchar_t **vecwstr2c(std::vector<std::wstring> &vs);

View File

@ -1,6 +1,5 @@
#include "define.h"
#include <windows.h>
bool tryopenclipboard(HWND hwnd = 0)
{
bool success = false;

View File

@ -1,6 +1,4 @@
#include <windows.h>
#include <thread>
#include <string>
#include "define.h"
HANDLE hsema;
void IsColorSchemeChangeMessage(LPARAM lParam)

View File

@ -1,5 +1,4 @@
#pragma once
#include <Windows.h>
#define DECLARE extern "C" __declspec(dllexport)
extern "C"
{

View File

@ -1,4 +1,3 @@
#include <Windows.h>
#include "define.h"
DECLARE void showintab(HWND hwnd, bool show)

View File

@ -1,8 +1,5 @@
#include "define.h"
#include <windows.h>
#include <iostream>
#include <fstream>
size_t lev_u_edit_distance(size_t len1, const wchar_t *string1,
size_t len2, const wchar_t *string2,
int xcost)

View File

@ -1,10 +1,3 @@
#include <Shobjidl.h>
#include <Windows.h>
#include <Shobjidl.h>
#include <iostream>
#include <initguid.h>
#include <ShlGuid.h>
#include <strsafe.h>
#include "define.h"
void GetLnkTargetPath(wchar_t *lnkFilePath, wchar_t *path, wchar_t *tgtpath, wchar_t *iconpath, wchar_t *dirpath)
{

View File

@ -1,6 +1,3 @@
#include <windows.h>
#include <thread>
#include <string>
#include "define.h"
static UINT WM_MAGPIE_SCALINGCHANGED = RegisterWindowMessage(L"MagpieScalingChanged");

View File

@ -1,14 +1,5 @@
#include <Audiopolicy.h>
#include <iostream>
#include <string>
#include <mmdeviceapi.h>
#include <Psapi.h>
#include <Windows.h>
#include <atlbase.h>
#include "define.h"
#pragma comment(lib, "Psapi.lib")
class CAudioMgr
{
public:

View File

@ -1,10 +1,4 @@
#include "define.h"
#include <iostream>
#include <windows.h>
#include <vector>
#include <cmath>
typedef struct
{
BYTE b;

View File

@ -1,9 +1,4 @@

#include <sapi.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <sphelper.h>
#include "define.h"
#include "cinterface.h"
bool _Speak(std::wstring &Content, const wchar_t *token, int voiceid, int rate, int volume, std::wstring &FileName)

View File

@ -1,9 +1,5 @@
#pragma execution_character_set("utf-8")
#include <windows.h>
#include <iostream>
#include <fstream>
#include <vector>
#include "define.h"
#include "cinterface.h"
struct mecab_node_t

View File

@ -1,8 +1,4 @@
#include <Windows.h>
#include <stdint.h>
#include <dwmapi.h>
#include <string>
#include "define.h"
#include "define.h"
// https://github.com/Blinue/Xaml-Islands-Cpp/blob/main/src/XamlIslandsCpp/XamlWindow.h
enum WindowBackdrop : int32_t

View File

@ -1,8 +1,5 @@
#include <windows.h>
#include <vector>
#include "define.h"
#pragma comment(lib, "Version.lib")
bool queryversion(const wchar_t *exe, WORD *_1, WORD *_2, WORD *_3, WORD *_4)
{