Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build Release failed in VS 2022. #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion global-inject-demo/app.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "functions.h"
#include "engine_control.h"
#include "common_functions.h"

int main()
{
Expand Down
33 changes: 2 additions & 31 deletions global-inject-demo/engine_control.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
#include "stdafx.h"
#include "engine_control.h"

namespace
{
std::filesystem::path GetEnginePath()
{
// Use current architecture.
#ifdef _WIN64
USHORT machine = IMAGE_FILE_MACHINE_AMD64;
#else // !_WIN64
USHORT machine = IMAGE_FILE_MACHINE_I386;
#endif // _WIN64

PCWSTR folderName;
switch (machine) {
case IMAGE_FILE_MACHINE_I386:
folderName = L"32";
break;

case IMAGE_FILE_MACHINE_AMD64:
folderName = L"64";
break;

default:
throw std::logic_error("Unknown architecture");
}

std::filesystem::path modulePath = wil::GetModuleFileName<std::wstring>();
return modulePath.parent_path() / folderName;
}
}
#include "common_functions.h"

EngineControl::EngineControl()
{
auto engineLibraryPath = GetEnginePath() / L"global-inject-lib.dll";
auto engineLibraryPath = GetEnginePath() / GetDllFileName();

engineModule.reset(LoadLibrary(engineLibraryPath.c_str()));
THROW_LAST_ERROR_IF_NULL(engineModule);
Expand Down
37 changes: 0 additions & 37 deletions global-inject-demo/functions.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions global-inject-demo/functions.h

This file was deleted.

26 changes: 21 additions & 5 deletions global-inject-demo/global-inject-demo.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,32 @@
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\shared\libraries;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\shared\libraries;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(ProjectName)_D_32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\shared\libraries;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\shared\libraries;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(ProjectName)_D</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\shared\libraries;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\shared\libraries;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(ProjectName)_32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\shared\libraries;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\shared\libraries;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
Expand All @@ -98,12 +105,14 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/d1trimfile:"$(SolutionDir)\" %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(SolutionDir)shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
Expand All @@ -127,7 +136,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
Expand All @@ -136,12 +145,14 @@
<PreprocessorDefinitions>_WINDOWS;STRICT;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/d1trimfile:"$(SolutionDir)\" %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(SolutionDir)shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
Expand All @@ -164,20 +175,22 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<DebugInformationFormat />
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/d1trimfile:"$(SolutionDir)\" %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(SolutionDir)shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
Expand All @@ -201,20 +214,22 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<DebugInformationFormat />
<PreprocessorDefinitions>_WINDOWS;STRICT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/d1trimfile:"$(SolutionDir)\" %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(SolutionDir)shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
Expand All @@ -236,9 +251,9 @@
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\shared\common_functions.cpp" />
<ClCompile Include="app.cpp" />
<ClCompile Include="engine_control.cpp" />
<ClCompile Include="functions.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
Expand All @@ -247,6 +262,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\shared\common_functions.h" />
<ClInclude Include="engine_control.h" />
<ClInclude Include="functions.h" />
<ClInclude Include="stdafx.h" />
Expand Down
10 changes: 8 additions & 2 deletions global-inject-demo/global-inject-demo.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<UniqueIdentifier>{c9908b8c-b610-454b-9f8a-fd6afc7f6daa}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest</Extensions>
</Filter>
<Filter Include="common">
<UniqueIdentifier>{c45cc86a-3c01-42b2-867d-f4a5454beff5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand All @@ -24,8 +27,8 @@
<ClCompile Include="engine_control.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="functions.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="..\shared\common_functions.cpp">
<Filter>common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand All @@ -38,5 +41,8 @@
<ClInclude Include="functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\common_functions.h">
<Filter>common</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading