diff --git a/easyhook.h b/easyhook.h index f4b79e7..adddc6d 100644 --- a/easyhook.h +++ b/easyhook.h @@ -54,7 +54,11 @@ extern "C"{ #define DRIVER_SHARED_API(type, decl) EXTERN_C type EASYHOOK_API decl #else #ifndef DRIVER - #define EASYHOOK_API __declspec(dllimport) __stdcall + #ifdef STATIC_LIB + #define EASYHOOK_API __stdcall + #else + #define EASYHOOK_API __declspec(dllimport) __stdcall + #endif #define DRIVER_SHARED_API(type, decl) EXTERN_C type EASYHOOK_API decl #else #define EASYHOOK_API __stdcall @@ -131,6 +135,10 @@ DRIVER_SHARED_API(NTSTATUS, LhUninstallHook(TRACED_HOOK_HANDLE InHandle)); DRIVER_SHARED_API(NTSTATUS, LhWaitForPendingRemovals()); +#ifdef STATIC_LIB +BOOL APIENTRY EasyHookDllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved); +#endif + /* Setup the ACLs after hook installation. Please note that every hook starts suspended. You will have to set a proper ACL to diff --git a/gdidll.rc b/gdidll.rc index aa6f5df..838e379 100644 --- a/gdidll.rc +++ b/gdidll.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2022,810,1 - PRODUCTVERSION 1,2022,810,1 + FILEVERSION 1,2023,531,1 + PRODUCTVERSION 1,2023,531,1 FILEFLAGSMASK 0x8L #ifdef _DEBUG FILEFLAGS 0xbL @@ -44,12 +44,12 @@ BEGIN VALUE "Comments", "Portions of this software are copyright (c) 2005-2021 The FreeType Project (www.freetype.org). All rights reserved." VALUE "CompanyName", "2ch & THEMEX & everyone" VALUE "FileDescription", "The Ultimate Font Rasterizer" - VALUE "FileVersion", "1.2022.810.1" + VALUE "FileVersion", "1.2023.531.1" VALUE "InternalName", "MacType" VALUE "LegalCopyright", "(C) 460, 168, Higambana, 555 and sy567. All rights reserved. FlyingSnow republished" VALUE "OriginalFilename", "MacType.dll" VALUE "ProductName", "The Ultimate Font Rasterizer" - VALUE "ProductVersion", "1.2022.810.1" + VALUE "ProductVersion", "1.2023.531.1" VALUE "URL", "http://www.mactype.net http://drwatson.nobody.jp/gdi++/" END END diff --git a/gdipp.sln b/gdipp.sln index c3615bf..d74bc72 100644 --- a/gdipp.sln +++ b/gdipp.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31515.178 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33103.184 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MacType", "gdipp.vcxproj", "{15C33FD9-0811-4981-B08F-E0BAD74A3028}" EndProject @@ -16,6 +16,8 @@ Global Release Infinality|x64 = Release Infinality|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + Release+StaticHook|Win32 = Release+StaticHook|Win32 + Release+StaticHook|x64 = Release+StaticHook|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug Infinality|Win32.ActiveCfg = Debug Infinality|Win32 @@ -38,6 +40,10 @@ Global {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|Win32.Build.0 = Release|Win32 {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.ActiveCfg = Release|x64 {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.Build.0 = Release|x64 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release+StaticHook|Win32.ActiveCfg = Release+StaticHook|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release+StaticHook|Win32.Build.0 = Release+StaticHook|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release+StaticHook|x64.ActiveCfg = Release+StaticHook|x64 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release+StaticHook|x64.Build.0 = Release+StaticHook|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/gdipp.vcxproj b/gdipp.vcxproj index 7f8b15b..2fe5cfd 100644 --- a/gdipp.vcxproj +++ b/gdipp.vcxproj @@ -49,6 +49,18 @@ Release Infinality x64 + + Release+StaticHook + ARM + + + Release+StaticHook + Win32 + + + Release+StaticHook + x64 + Release ARM @@ -76,6 +88,12 @@ true v143 + + DynamicLibrary + Unicode + true + v143 + DynamicLibrary Unicode @@ -104,6 +122,12 @@ Unicode true + + DynamicLibrary + v143 + Unicode + true + DynamicLibrary v143 @@ -122,6 +146,12 @@ Unicode true + + DynamicLibrary + v143 + Unicode + true + DynamicLibrary v143 @@ -160,6 +190,9 @@ + + + @@ -175,6 +208,9 @@ + + + @@ -184,6 +220,9 @@ + + + @@ -269,6 +308,15 @@ $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) $(SolutionDir)lib;$(LibraryPath) + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + $(ProjectName).Core + $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) + $(SolutionDir)lib;$(LibraryPath) + $(SolutionDir)$(Configuration)\ $(Configuration)\ @@ -296,6 +344,15 @@ $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) $(SolutionDir)lib;$(LibraryPath) + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + $(ProjectName)64.Core + $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) + $(SolutionDir)lib;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ @@ -323,6 +380,15 @@ $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) $(SolutionDir)lib;$(LibraryPath) + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + $(ProjectName)64.Core + $(INI_PARSER_PATH);$(FREETYPE_PATH)\include;$(IncludePath) + $(SolutionDir)lib;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ @@ -546,6 +612,45 @@ easyhk32.dll $(SolutionDir)deps\lib;%(AdditionalLibraryDirectories) UseLinkTimeCodeGeneration + + + + + + MaxSpeed + true + Speed + false + STATIC_LIB;WIN32;NDEBUG;_WINDOWS;_USRDLL;GDIPP_EXPORTS;_GDIPP_DLL;%(PreprocessorDefinitions) + Sync + MultiThreaded + false + false + StreamingSIMDExtensions2 + Precise + + + Level3 + ProgramDatabase + $(SolutionDir)deps\include;%(AdditionalIncludeDirectories) + /Zc:threadSafeInit- /utf-8 %(AdditionalOptions) + + + freetype.lib;usp10.lib;dwrite.lib;%(AdditionalDependencies) + false + expfunc.def + true + Windows + true + true + true + MachineX86 + + + $(SolutionDir)deps\lib;%(AdditionalLibraryDirectories) + UseLinkTimeCodeGeneration + + @@ -653,6 +758,43 @@ true + + + X64 + + + MaxSpeed + true + Speed + STATIC_LIB;NDEBUG;_WINDOWS;_USRDLL;GDIPP_EXPORTS;_GDIPP_DLL;%(PreprocessorDefinitions) + Sync + MultiThreaded + false + true + StreamingSIMDExtensions2 + + + Level3 + ProgramDatabase + $(SolutionDir)deps\include;%(AdditionalIncludeDirectories) + /utf-8 %(AdditionalOptions) + + + freetype64.lib;usp10.lib;%(AdditionalDependencies) + false + expfunc.def + true + Windows + true + true + true + MachineX64 + + + $(SolutionDir)deps\lib;%(AdditionalLibraryDirectories) + true + + X64 @@ -755,6 +897,37 @@ easyhook64.dll + + + + MaxSpeed + true + Speed + NDEBUG;_WINDOWS;_USRDLL;GDIPP_EXPORTS;_GDIPP_DLL;%(PreprocessorDefinitions) + Sync + MultiThreaded + false + true + StreamingSIMDExtensions2 + + + Level3 + ProgramDatabase + /utf-8 %(AdditionalOptions) + + + freetype64.lib;usp10.lib;%(AdditionalDependencies) + false + expfunc.def + true + Windows + true + true + true + true + easyhook64.dll + + @@ -834,6 +1007,7 @@ Sync + Sync Sync Sync diff --git a/hook.cpp b/hook.cpp index c80134c..87490fd 100644 --- a/hook.cpp +++ b/hook.cpp @@ -21,6 +21,14 @@ #include #include "EventLogging.h" +#ifdef STATIC_LIB + #include + #include + + #pragma comment(lib, "aux_ulib.lib") + #pragma comment(lib, "psapi.lib") +#endif + #ifndef _WIN64 #include "wow64ext.h" #endif @@ -435,6 +443,7 @@ extern COLORCACHE* g_AACache2[MAX_CACHE_SIZE]; HANDLE hDelayHook = 0; BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID lpReserved) { + EasyHookDllMain(instance, reason, lpReserved); static bool bDllInited = false; BOOL IsUnload = false, bEnableDW = true, bUseFontSubstitute = false; switch(reason) { @@ -446,6 +455,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID lpReserved) if (bDllInited) return true; g_dllInstance = instance; +#ifndef STATIC_LIB { LPWSTR dllPath = new WCHAR[MAX_PATH + 1]; int nSize = GetModuleFileName(g_dllInstance, dllPath, MAX_PATH + 1); @@ -464,6 +474,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID lpReserved) return false; } } +#endif //初期化順序 //DLL_PROCESS_DETACHではこれの逆順にする //1. CRT関数の初期化