diff --git a/test.sln b/test.sln new file mode 100644 index 0000000..55ffeac --- /dev/null +++ b/test.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31729.503 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Debug|x64.ActiveCfg = Debug|x64 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Debug|x64.Build.0 = Debug|x64 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Debug|x86.ActiveCfg = Debug|Win32 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Debug|x86.Build.0 = Debug|Win32 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Release|x64.ActiveCfg = Release|x64 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Release|x64.Build.0 = Release|x64 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Release|x86.ActiveCfg = Release|Win32 + {F3D55A8B-A1E8-4E81-A655-5F2BF73B00E9}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {334071A3-783E-4F8A-9E81-1A8AF321F2D9} + EndGlobalSection +EndGlobal diff --git a/test/dllmain.cpp b/test/dllmain.cpp new file mode 100644 index 0000000..f5c4e2f --- /dev/null +++ b/test/dllmain.cpp @@ -0,0 +1,70 @@ +// dllmain.cpp : 定义 DLL 应用程序的入口点。 +#include "pch.h" +#include +#include + + + + +typedef int func(int a , int b); +func* f = (func*)0x401000; + + + +int GetExeNutWrtNum(int Pos) +{ + int num = *(int*)(0x40079F + (Pos * 4)); + return num; +} + +void ThreadFun(void) +{ + + while (true) + { + std::cout << GetExeNutWrtNum(40) << std::endl;; + } + Sleep(10); +} + + +__declspec(dllexport) void Lenheart() +{ + DWORD threadID; + CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFun, NULL, 0, &threadID); +} + +/* +extern "C" __declspec(dllexport) int Sub(int a, int b) { + + int i = f(160, 80); + std::cout << i << std::endl; + getchar(); + + std::cout << "注入成功\n"; + + return a - b; + +} +*/ + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + //int i = f(60,80); + //std::cout << "12132132" << std::endl; + Lenheart(); + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/test/framework.h b/test/framework.h new file mode 100644 index 0000000..80cbbc9 --- /dev/null +++ b/test/framework.h @@ -0,0 +1,5 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 +// Windows 头文件 +#include diff --git a/test/pch.cpp b/test/pch.cpp new file mode 100644 index 0000000..b6fb8f4 --- /dev/null +++ b/test/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: 与预编译标头对应的源文件 + +#include "pch.h" + +// 当使用预编译的头时,需要使用此源文件,编译才能成功。 diff --git a/test/pch.h b/test/pch.h new file mode 100644 index 0000000..9660927 --- /dev/null +++ b/test/pch.h @@ -0,0 +1,13 @@ +// pch.h: 这是预编译标头文件。 +// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 +// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 +// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 +// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 + +#ifndef PCH_H +#define PCH_H + +// 添加要在此处预编译的标头 +#include "framework.h" + +#endif //PCH_H diff --git a/test/test.vcxproj b/test/test.vcxproj new file mode 100644 index 0000000..b5ff8ce --- /dev/null +++ b/test/test.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {f3d55a8b-a1e8-4e81-a655-5f2bf73b00e9} + test + 10.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + D:\DOF\DOF-Lenheart\Plugins\ + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;TEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;TEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Console + true + true + true + false + + + + + Level3 + true + _DEBUG;TEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;TEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/test/test.vcxproj.filters b/test/test.vcxproj.filters new file mode 100644 index 0000000..2689155 --- /dev/null +++ b/test/test.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + \ No newline at end of file