Skip to content

Commit

Permalink
增加替换核心库函数的测试lib
Browse files Browse the repository at this point in the history
  • Loading branch information
aiqinxuancai committed Feb 1, 2024
1 parent ae4852b commit 49d7461
Show file tree
Hide file tree
Showing 10 changed files with 1,635 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild ${{env.SOLUTION_FILE_PATH}} -t:rebuild -verbosity:diag -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}}
msbuild ${{env.SOLUTION_FILE_PATH}}/AutoLinker.vcxproj -t:rebuild -verbosity:diag -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}}
- name: Compress-Archive
run: |
Expand Down
26 changes: 26 additions & 0 deletions AutoLinker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoLinker", "AutoLinker.vcxproj", "{607624E5-4E20-426C-880C-852DDE9FC5BB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCore", "TestCore\TestCore.vcxproj", "{3C88A635-14E4-4094-B4BE-3F893D545C11}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -44,6 +46,30 @@ Global
{607624E5-4E20-426C-880C-852DDE9FC5BB}.static_lib_release|x64.Build.0 = static_lib_release|x64
{607624E5-4E20-426C-880C-852DDE9FC5BB}.static_lib_release|x86.ActiveCfg = static_lib_release|Win32
{607624E5-4E20-426C-880C-852DDE9FC5BB}.static_lib_release|x86.Build.0 = static_lib_release|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Debug|x64.ActiveCfg = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Debug|x64.Build.0 = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Debug|x86.ActiveCfg = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Debug|x86.Build.0 = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_debug|x64.ActiveCfg = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_debug|x64.Build.0 = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_debug|x86.ActiveCfg = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_debug|x86.Build.0 = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_release|x64.ActiveCfg = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_release|x64.Build.0 = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_release|x86.ActiveCfg = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.fne_release|x86.Build.0 = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Release|x64.ActiveCfg = Release|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Release|x64.Build.0 = Release|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Release|x86.ActiveCfg = Release|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.Release|x86.Build.0 = Release|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_debug|x64.ActiveCfg = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_debug|x64.Build.0 = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_debug|x86.ActiveCfg = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_debug|x86.Build.0 = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_release|x64.ActiveCfg = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_release|x64.Build.0 = Debug|x64
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_release|x86.ActiveCfg = Debug|Win32
{3C88A635-14E4-4094-B4BE-3F893D545C11}.static_lib_release|x86.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
35 changes: 35 additions & 0 deletions TestCore/TestCore.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// TestCore.cpp : 定义静态库的函数。
//

#include "pch.h"
#include "framework.h"
#include <math.h>

// TODO: 这是一个库函数示例
void fnTestCore()
{


}



//算术运算 - 取绝对值
/*
调用格式: 〈双精度小数型〉 取绝对值 (双精度小数型 欲取其绝对值的数值) - 系统核心支持库->算术运算
英文名称:abs
如果所提供数值为字节型,则将直接返回该数值。本命令为初级命令。
参数<1>的名称为“欲取其绝对值的数值”,类型为“双精度小数型(double)”。
*/
//LIBAPI(void, krnln_fnabs)
//{
// MessageBoxA(0, "112122", "", 0);
// ArgInf.m_double = fabs(ArgInf.m_double);
// __asm
// {
// mov eax, ArgInf.m_unit.m_dwFormID;
// mov edx, ArgInf.m_unit.m_dwUnitID;
// }
//}


164 changes: 164 additions & 0 deletions TestCore/TestCore.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3c88a635-14e4-4094-b4be-3f893d545c11}</ProjectGuid>
<RootNamespace>TestCore</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp14</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="lib2.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="a1.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>
<ClCompile Include="TestCore.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
39 changes: 39 additions & 0 deletions TestCore/TestCore.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="lib2.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="TestCore.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="a1.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions TestCore/a1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "pch.h"
#include "framework.h"
#include <math.h>


//LIBAPI(int, krnln_fnBAnd)
//{
// PMDATA_INF pArg = &ArgInf;
// ret
// int n = pArg->m_int;
// for (int i = 1; i < nArgCount; i++)
// {
// n &= pArg[i].m_int;
// }
//
// return n;
//
//}


extern "C" void _cdecl krnln_fnBAnd(PMDATA_INF pRetData, INT nArgCount, PMDATA_INF pArgInf) {
int n = pArgInf->m_int;
for (int i = 1; i < nArgCount; i++)
{
n &= pArgInf[i].m_int;
}
pRetData->m_int = n;
}
3 changes: 3 additions & 0 deletions TestCore/framework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
Loading

0 comments on commit 49d7461

Please sign in to comment.