Browse Source

【模块名称】
GM模块
【问题原因】
不使用MFC创建DLL,改用纯DLL创建项目。
【修改描述】
使用纯DLL方式创建项目,并替换之前使用MFC创建的DLL。
【测试结果】

sat23 3 years ago
parent
commit
95ee76d83b
11 changed files with 23 additions and 166 deletions
  1. 10 10
      gm/gm.sln
  2. 0 16
      gm/gm/Resource.h
  3. 5 9
      gm/gm/framework.h
  4. 0 35
      gm/gm/gm.cpp
  5. 0 22
      gm/gm/gm.h
  6. BIN
      gm/gm/gm.rc
  7. 2 27
      gm/gm/gm.vcxproj
  8. 6 23
      gm/gm/gm.vcxproj.filters
  9. 0 5
      gm/gm/pch.cpp
  10. 0 13
      gm/gm/pch.h
  11. 0 6
      gm/gm/targetver.h

+ 10 - 10
gm/gm.sln

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 16
 VisualStudioVersion = 16.0.31624.102
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gm", "gm\gm.vcxproj", "{395C3072-C2D9-4CF8-A742-5D809EA95627}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gm", "gm\gm.vcxproj", "{A148E651-B539-4F34-B818-E5EDD63035D4}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,19 +13,19 @@ Global
 		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Debug|x64.ActiveCfg = Debug|x64
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Debug|x64.Build.0 = Debug|x64
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Debug|x86.ActiveCfg = Debug|Win32
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Debug|x86.Build.0 = Debug|Win32
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Release|x64.ActiveCfg = Release|x64
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Release|x64.Build.0 = Release|x64
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Release|x86.ActiveCfg = Release|Win32
-		{395C3072-C2D9-4CF8-A742-5D809EA95627}.Release|x86.Build.0 = Release|Win32
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Debug|x64.ActiveCfg = Debug|x64
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Debug|x64.Build.0 = Debug|x64
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Debug|x86.ActiveCfg = Debug|Win32
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Debug|x86.Build.0 = Debug|Win32
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Release|x64.ActiveCfg = Release|x64
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Release|x64.Build.0 = Release|x64
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Release|x86.ActiveCfg = Release|Win32
+		{A148E651-B539-4F34-B818-E5EDD63035D4}.Release|x86.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {FB1BD768-AB27-4B02-B562-AEC4A68BFE41}
+		SolutionGuid = {97CDEF85-964E-4DF2-BE87-F3AF844C0630}
 	EndGlobalSection
 EndGlobal

+ 0 - 16
gm/gm/Resource.h

@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ 生成的包含文件。
-// 使用者 gm.rc
-
-#define IDS_APP_TITLE			103
-
-// 新对象的下一组默认值
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE	101
-#define _APS_NEXT_COMMAND_VALUE		40001
-#define _APS_NEXT_CONTROL_VALUE		1000
-#define _APS_NEXT_SYMED_VALUE		101
-#endif
-#endif

+ 5 - 9
gm/gm/framework.h

@@ -1,13 +1,9 @@
-#pragma once
+// header.h: 标准系统包含文件的包含文件,
+// 或特定于项目的包含文件
+//
 
-#include "targetver.h"
-#define WIN32_LEAN_AND_MEAN             // 从 Windows 头文件中排除极少使用的内容
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN            // 从 Windows 头文件中排除极少使用的内容
-#endif
+#pragma once
 
-
-#include <iostream>
+#define WIN32_LEAN_AND_MEAN             // 从 Windows 头文件中排除极少使用的内容
 // Windows 头文件
 #include <windows.h>

+ 0 - 35
gm/gm/gm.cpp

@@ -1,35 +0,0 @@
-// gm.cpp : 定义 DLL 的导出函数。
-//
-
-#include "pch.h"
-#include "framework.h"
-#include "gm.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#endif
-
-
-// 唯一的应用程序对象
-
-using namespace std;
-
-int main()
-{
-    int nRetCode = 0;
-
-    HMODULE hModule = ::GetModuleHandle(nullptr);
-
-    if (hModule != nullptr)
-    {
-
-    }
-    else
-    {
-        // TODO: 更改错误代码以符合需要
-        wprintf(L"错误: GetModuleHandle 失败\n");
-        nRetCode = 1;
-    }
-
-    return nRetCode;
-}

+ 0 - 22
gm/gm/gm.h

@@ -1,22 +0,0 @@
-// 下列 ifdef 块是创建使从 DLL 导出更简单的
-// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 {0}_EXPORTS
-// 符号编译的。在使用此 DLL 的
-// 任何项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
-// {0}_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
-// 符号视为是被导出的。
-#ifdef GM_EXPORTS
-#define GM_API __declspec(dllexport)
-#else
-#define GM_API __declspec(dllimport)
-#endif
-
-// 此类是从 dll 导出的
-class GM_API Cgm {
-public:
-	Cgm(void);
-	// TODO: 在此处添加方法。
-};
-
-extern GM_API int ngm;
-
-GM_API int fngm(void);

BIN
gm/gm/gm.rc


+ 2 - 27
gm/gm/gm.vcxproj

@@ -21,7 +21,7 @@
   <PropertyGroup Label="Globals">
     <VCProjectVersion>16.0</VCProjectVersion>
     <Keyword>Win32Proj</Keyword>
-    <ProjectGuid>{395c3072-c2d9-4cf8-a742-5d809ea95627}</ProjectGuid>
+    <ProjectGuid>{a148e651-b539-4f34-b818-e5edd63035d4}</ProjectGuid>
     <RootNamespace>gm</RootNamespace>
     <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
@@ -31,8 +31,6 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
-    <UseOfMfc>false</UseOfMfc>
-    <PreferredToolArchitecture>x86</PreferredToolArchitecture>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -40,14 +38,12 @@
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
-    <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
-    <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -55,7 +51,6 @@
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
-    <UseOfMfc>Dynamic</UseOfMfc>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -93,11 +88,8 @@
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>WIN32;_DEBUG;GM_EXPORTS;_WINDOWS;_USRDLL;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ConformanceMode>true</ConformanceMode>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
       <AdditionalIncludeDirectories>.;..\..\..\Blackbone\src;..\3rd_party\include;..\..\..\Blackbone\src\3rd_party\AsmJit;.\core</AdditionalIncludeDirectories>
       <LanguageStandard>stdcpp17</LanguageStandard>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -117,8 +109,6 @@
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>WIN32;NDEBUG;GM_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ConformanceMode>true</ConformanceMode>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -134,8 +124,6 @@
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>_DEBUG;GM_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ConformanceMode>true</ConformanceMode>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -151,8 +139,6 @@
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>NDEBUG;GM_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ConformanceMode>true</ConformanceMode>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -264,27 +250,16 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <None Include="gm.def" />
     <None Include="res\gm.rc2" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="framework.h" />
     <ClInclude Include="gm.h" />
-    <ClInclude Include="pch.h" />
     <ClInclude Include="Resource.h" />
     <ClInclude Include="targetver.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="gm.cpp" />
-    <ClCompile Include="pch.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="gm.rc" />
+    <ClCompile Include="dllmain.cpp" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 6 - 23
gm/gm/gm.vcxproj.filters

@@ -45,22 +45,9 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="pch.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="..\3rd_party\src\kiero.cpp">
       <Filter>keroi</Filter>
     </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="gm.def">
-      <Filter>源文件</Filter>
-    </None>
-    <None Include="res\gm.rc2">
-      <Filter>资源文件</Filter>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
     <ClInclude Include="framework.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -76,9 +63,6 @@
     <ClInclude Include="gm.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="pch.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="winapi\Injecter.h">
       <Filter>winapi</Filter>
     </ClInclude>
@@ -162,17 +146,11 @@
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="gm.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="pch.cpp">
+    <ClCompile Include="dllmain.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="gm.rc">
-      <Filter>资源文件</Filter>
-    </ResourceCompile>
     <ClCompile Include="libop.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
@@ -240,4 +218,9 @@
       <Filter>background\mouse</Filter>
     </ClCompile>
   </ItemGroup>
+  <ItemGroup>
+    <None Include="res\gm.rc2">
+      <Filter>资源文件</Filter>
+    </None>
+  </ItemGroup>
 </Project>

+ 0 - 5
gm/gm/pch.cpp

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

+ 0 - 13
gm/gm/pch.h

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

+ 0 - 6
gm/gm/targetver.h

@@ -1,6 +0,0 @@
-#pragma once
-
-// // 包含 SDKDDKVer.h 可定义可用的最高版本的 Windows 平台。
-// 如果希望为之前的 Windows 平台构建应用程序,在包含 SDKDDKVer.h 之前请先包含 WinSDKVer.h 并
-// 将 _WIN32_WINNT 宏设置为想要支持的平台。
-#include <SDKDDKVer.h>