Skip to content

Commit

Permalink
Bug #97,解决obj模式且SDK低于10时链接失败
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed Jun 15, 2024
1 parent d905632 commit 45d7751
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 58 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/Build&Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
# Procdump工具,用于单元测试崩溃诊断
Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Bin\Procdump.zip
&7z e Bin\Procdump.zip "-o$Env:GITHUB_WORKSPACE\Bin"
Invoke-WebRequest -Uri https://github.com/mingkuang-Chuyu/Visual_Studio_Platform_Toolset/releases/download/v1.0.2/Visual.Studio.2008.Platform.Toolset.v1.0.2.7z -OutFile Bin\Visual.Studio.2008.Platform.Toolset.v1.0.2.7z
&7z x Bin\Visual.Studio.2008.Platform.Toolset.v1.0.2.7z "-o$Env:GITHUB_WORKSPACE\Bin"
Invoke-WebRequest -Uri https://github.com/Chuyu-Team/LibMaker/releases/download/v1.0.3/LibMaker.exe -OutFile Bin\LibMaker.exe
Invoke-WebRequest -Uri https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.0.2.8/MinimumRequiredVersionHelper.exe -OutFile Bin\MinimumRequiredVersionHelper.exe
Expand Down Expand Up @@ -118,6 +120,8 @@ jobs:
# MSBuild、PROCDUMP_PATH目录更新到 Path
$Env:Path="$Env:GITHUB_WORKSPACE\Bin;${{env.MSBuildBinPath}};${{env.LatestVisualStudioRoot}}\Common7\IDE\CommonExtensions\Microsoft\TestWindow;" + $Env:Path
$Env:WindowsSdkDir_60A_TestPath="$Env:GITHUB_WORKSPACE\Bin\Program Files\Microsoft SDKs\Windows\v6.0A"
# 编译单元测试项目
&msbuild src\YY-Thunks.UnitTest\YY-Thunks.UnitTest.vcxproj "-p:Configuration=Release;Platform=Win32;SolutionDir=$Env:GITHUB_WORKSPACE\src\\"
if($lastexitcode -ne 0)
Expand Down Expand Up @@ -195,6 +199,8 @@ jobs:
src\x64\Release\YY-Thunks.UnitTest.dll
src\x64\Release\YY-Thunks.UnitTest.pdb
src\x64\Release\*.log
src\YY-Thunks.UnitTest\TestProject\Example\Win32\Static
src\YY-Thunks.UnitTest\TestProject\Example\x64\Static
- uses: xresloader/upload-to-github-release@v1
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,5 @@ MigrationBackup/
/src/Thunks/YY_Thunks_List.hpp
/objs
/Lib
/src/YY-Thunks.UnitTest/TestProject/Example/Win32/Static
/src/YY-Thunks.UnitTest/TestProject/Example/x64/Static
2 changes: 0 additions & 2 deletions ThunksList.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
| JetAttachDatabaseWithStreamingA | 调用JetAttachDatabaseWithStreaming。
| JetBackupA | 调用JetBackup。
| JetBackupInstanceA | 调用JetBackupInstance。
| JetBeginDatabaseIncrementalReseedA | 调用JetBeginDatabaseIncrementalReseed。
| JetBeginSessionA | 调用JetBeginSession。
| JetCompactA | 调用JetCompact。
| JetConvertDDLA | 调用JetConvertDDL。
Expand Down Expand Up @@ -269,7 +268,6 @@
| JetGetTableInfoA | 调用JetGetTableInfo。
| JetGetTruncateLogInfoInstanceA | 调用JetGetTruncateLogInfoInstance。
| JetInit3A | 调用JetInit3。
| JetInit4A | 调用JetInit4。
| JetOpenDatabaseA | 调用JetOpenDatabase。
| JetOpenFileA | 调用JetOpenFile。
| JetOpenFileInstanceA | 调用JetOpenFileInstance。
Expand Down
3 changes: 3 additions & 0 deletions src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ RtlCutoverTimeToSystemTime(

#ifndef __FALLBACK_PREFIX
#define __FALLBACK_PREFIX
#define __YY_Thunks_libs 0
#else
#define __YY_Thunks_libs 1
#endif

//展开函数的所有的 声明 以及 try_get_ 函数
Expand Down
2 changes: 1 addition & 1 deletion src/Thunks/api-ms-win-core-path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PATHCCH_NO_DEPRECATE
#include <pathcch.h>

#if (YY_Thunks_Support_Version < NTDDI_WIN8) && !defined(__Comment_Lib_pathcch)
#if (YY_Thunks_Support_Version < NTDDI_WIN8) && __YY_Thunks_libs && !defined(__Comment_Lib_pathcch)
#define __Comment_Lib_pathcch
#pragma comment(lib, "Pathcch.lib")
#endif
Expand Down
9 changes: 8 additions & 1 deletion src/Thunks/api-ms-win-core-winrt.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#include <roapi.h>
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
#include <roapi.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN8) && !defined(__Comment_Lib_ole32)
#define __Comment_Lib_ole32
#pragma comment(lib, "Ole32.lib")
#endif

namespace YY::Thunks
{
Expand Down
2 changes: 1 addition & 1 deletion src/Thunks/bcrypt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma comment(lib, "Advapi32.lib")
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN7) && !defined(__Comment_Lib_bcrypt)
#if (YY_Thunks_Support_Version < NTDDI_WIN7) && (YY_Thunks_Support_Version >= NTDDI_WIN6 || __YY_Thunks_libs) && !defined(__Comment_Lib_bcrypt)
#define __Comment_Lib_bcrypt
#pragma comment(lib, "bcrypt.lib")
#endif
Expand Down
5 changes: 0 additions & 5 deletions src/Thunks/bluetoothapis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include <bluetoothleapis.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN8) && !defined(__Comment_Lib_bluetoothapis)
#define __Comment_Lib_bluetoothapis
#pragma comment(lib, "BluetoothAPIs.lib")
#endif

namespace YY::Thunks
{
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
Expand Down
5 changes: 0 additions & 5 deletions src/Thunks/mfplat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include <mfapi.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN8) && !defined(__Comment_Lib_mfplat)
#define __Comment_Lib_mfplat
#pragma comment(lib, "Mfplat.lib")
#endif

namespace YY::Thunks
{
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
Expand Down
5 changes: 0 additions & 5 deletions src/Thunks/netapi32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include <lmjoin.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN10) && !defined(__Comment_Lib_netapi32)
#define __Comment_Lib_netapi32
#pragma comment(lib, "Netapi32.lib")
#endif

namespace YY::Thunks
{
#if (YY_Thunks_Support_Version < NTDDI_WIN10)
Expand Down
5 changes: 0 additions & 5 deletions src/Thunks/powrprof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include <powrprof.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_VISTA) && !defined(__Comment_Lib_powrProf)
#define __Comment_Lib_powrProf
#pragma comment(lib, "PowrProf.lib")
#endif

namespace YY::Thunks
{
#if (YY_Thunks_Support_Version < NTDDI_VISTA)
Expand Down
6 changes: 3 additions & 3 deletions src/Thunks/shcore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <ShellScalingAPI.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WINBLUE) && !defined(__Comment_Lib_shcore)
#define __Comment_Lib_shcore
#pragma comment(lib, "Shcore.lib")
#if (YY_Thunks_Support_Version < NTDDI_WINBLUE) && !defined(__Comment_Lib_user32)
#define __Comment_Lib_user32
#pragma comment(lib, "User32.lib")
#endif

namespace YY::Thunks
Expand Down
14 changes: 13 additions & 1 deletion src/Thunks/shell32.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#include <shellapi.h>
#if (YY_Thunks_Support_Version < NTDDI_WIN7)
#include <shellapi.h>
#include <Shlobj.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6) && !defined(__Comment_Lib_shell32)
#define __Comment_Lib_shell32
#pragma comment(lib, "Shell32.lib")
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6) && !defined(__Comment_Lib_ole32)
#define __Comment_Lib_ole32
#pragma comment(lib, "Ole32.lib")
#endif

namespace YY::Thunks
{
Expand Down
7 changes: 6 additions & 1 deletion src/Thunks/user32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
#pragma comment(lib, "User32.lib")
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN10_RS2) && !defined(__Comment_Lib_shcore)
#if (YY_Thunks_Support_Version < NTDDI_WIN10_RS2) && (YY_Thunks_Support_Version >= NTDDI_WINBLUE || __YY_Thunks_libs) && !defined(__Comment_Lib_shcore)
#define __Comment_Lib_shcore
#pragma comment(lib, "Shcore.lib")
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN10_RS1) && !defined(__Comment_Lib_gdi32)
#define __Comment_Lib_gdi32
#pragma comment(lib, "Gdi32.lib")
#endif

#if defined(YY_Thunks_Implemented)
namespace YY::Thunks::internal
{
Expand Down
5 changes: 0 additions & 5 deletions src/Thunks/userenv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#include <userenv.h>
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN8) && !defined(__Comment_Lib_userenv)
#define __Comment_Lib_userenv
#pragma comment(lib, "Userenv.lib")
#endif

namespace YY::Thunks
{
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SymbolsTestCppRootPathTmp)</OutDir>
<IntDir>$(SymbolsTestCppRootPathTmp)</IntDir>
<LibraryPath Condition="'$(WindowsSdkDir_60A)' != ''">$(VC_LibraryPath_x86);$(WindowsSdkDir_60A)\lib</LibraryPath>
<LibraryPath Condition="'$(YY_Thunks_Libs)' != ''">$(YY_Thunks_Libs);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SymbolsTestCppRootPathTmp)</OutDir>
<IntDir>$(SymbolsTestCppRootPathTmp)</IntDir>
<LibraryPath Condition="'$(WindowsSdkDir_60A)' != ''">$(VC_LibraryPath_x64);$(WindowsSdkDir_60A)\lib\x64</LibraryPath>
<LibraryPath Condition="'$(YY_Thunks_Libs)' != ''">$(YY_Thunks_Libs);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Static|Win32'">
<ClCompile>
Expand All @@ -68,7 +72,7 @@
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(YY_Thunks_File_Path)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(YY_Thunks_File_Path)' != ''">$(YY_Thunks_File_Path)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Static|x64'">
Expand All @@ -85,7 +89,8 @@
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(YY_Thunks_File_Path)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(YY_Thunks_File_Path)' != ''">$(YY_Thunks_File_Path)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit 45d7751

Please sign in to comment.