Skip to content

Commit

Permalink
[3RDPARTY] Update KNSoft.NDK to 1.2.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
RatinCN committed Sep 19, 2024
1 parent 0003ba4 commit 092a097
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Source/Demo/Demo.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets')" />
<Import Project="..\packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets" Condition="Exists('..\packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets'))" />
<Error Condition="!Exists('..\packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Source/Demo/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KNSoft.NDK" version="1.1.0-beta" targetFramework="native" />
<package id="KNSoft.NDK" version="1.2.0-beta" targetFramework="native" />
</packages>
4 changes: 2 additions & 2 deletions Source/KNSoft.SlimDetours.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets" Condition="Exists('packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets')" />
<Import Project="packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets" Condition="Exists('packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\KNSoft.NDK.1.1.0-beta\build\KNSoft.NDK.targets'))" />
<Error Condition="!Exists('packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\KNSoft.NDK.1.2.0-beta\build\KNSoft.NDK.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Source/SlimDetours/Memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ detour_memory_init(VOID)

NtdllLdrEntry = CONTAINING_RECORD(NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Flink,
LDR_DATA_TABLE_ENTRY,
InInitializationOrderModuleList);
InInitializationOrderLinks);
s_ulSystemRegionLowUpperBound = (ULONG_PTR)NtdllLdrEntry->DllBase + NtdllLdrEntry->SizeOfImage - 1;
s_ulSystemRegionLowLowerBound = s_ulSystemRegionLowUpperBound - _1GB + 1;
if (s_ulSystemRegionLowLowerBound < SYSTEM_RESERVED_REGION_LOWEST)
Expand Down
6 changes: 3 additions & 3 deletions Source/SlimDetours/SlimDetours.NDK.inl
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@

#endif

#define NtGetCurrentProcessId() (NtCurrentTeb()->ClientId.UniqueProcess)
#define NtGetCurrentThreadId() (NtCurrentTeb()->ClientId.UniqueThread)
#define NtCurrentProcessId() ((HANDLE)ReadTeb(ClientId.UniqueProcess))
#define NtCurrentThreadId() ((HANDLE)ReadTeb(ClientId.UniqueThread))
#define NtGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
#define NtGetNtdllBase() (CONTAINING_RECORD(NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Flink, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList)->DllBase)
#define NtGetNtdllBase() (CONTAINING_RECORD(NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Flink, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks)->DllBase)

#endif
4 changes: 2 additions & 2 deletions Source/SlimDetours/Thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ detour_thread_suspend(
}

/* Find current process and threads */
CurrentPID = NtGetCurrentProcessId();
CurrentPID = NtCurrentProcessId();
pCurrentSPI = pSPI;
while (pCurrentSPI->UniqueProcessId != CurrentPID)
{
Expand Down Expand Up @@ -72,7 +72,7 @@ detour_thread_suspend(

/* Suspend threads */
SuspendedCount = 0;
CurrentTID = NtGetCurrentThreadId();
CurrentTID = NtCurrentThreadId();
for (i = 0; i < pCurrentSPI->NumberOfThreads; i++)
{
if (pSTI[i].ClientId.UniqueThread == CurrentTID ||
Expand Down
12 changes: 6 additions & 6 deletions Source/SlimDetours/Transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SlimDetoursTransactionBegin(VOID)
NTSTATUS Status;

// Make sure only one thread can start a transaction.
if (_InterlockedCompareExchangePointer(&s_nPendingThreadId, NtGetCurrentThreadId(), 0) != 0)
if (_InterlockedCompareExchangePointer(&s_nPendingThreadId, NtCurrentThreadId(), 0) != 0)
{
return HRESULT_FROM_NT(STATUS_TRANSACTIONAL_CONFLICT);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ SlimDetoursTransactionAbort(VOID)
SIZE_T sMem;
DWORD dwOld;

if (s_nPendingThreadId != NtGetCurrentThreadId())
if (s_nPendingThreadId != NtCurrentThreadId())
{
return HRESULT_FROM_NT(STATUS_TRANSACTIONAL_CONFLICT);
}
Expand Down Expand Up @@ -152,7 +152,7 @@ SlimDetoursTransactionCommit(VOID)
BOOL freed = FALSE;
ULONG i;

if (s_nPendingThreadId != NtGetCurrentThreadId())
if (s_nPendingThreadId != NtCurrentThreadId())
{
return HRESULT_FROM_NT(STATUS_TRANSACTIONAL_CONFLICT);
}
Expand Down Expand Up @@ -281,7 +281,7 @@ SlimDetoursAttach(
SIZE_T sMem;
DWORD dwOld;

if (s_nPendingThreadId != NtGetCurrentThreadId())
if (s_nPendingThreadId != NtCurrentThreadId())
{
return HRESULT_FROM_NT(STATUS_TRANSACTIONAL_CONFLICT);
}
Expand Down Expand Up @@ -484,7 +484,7 @@ SlimDetoursDetach(
SIZE_T sMem;
DWORD dwOld;

if (s_nPendingThreadId != NtGetCurrentThreadId())
if (s_nPendingThreadId != NtCurrentThreadId())
{
return HRESULT_FROM_NT(STATUS_TRANSACTIONAL_CONFLICT);
}
Expand Down Expand Up @@ -622,7 +622,7 @@ detour_dll_notify_proc(
while (pAttach != NULL)
{
/* Match Dll name */
if (!RtlEqualUnicodeString(&pAttach->usDllName, NotificationData->Loaded.BaseDllName, FALSE))
if (!RtlEqualUnicodeString(&pAttach->usDllName, (PUNICODE_STRING)NotificationData->Loaded.BaseDllName, FALSE))
{
pPrevAttach = pAttach;
pAttach = pAttach->pNext;
Expand Down
2 changes: 1 addition & 1 deletion Source/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KNSoft.NDK" version="1.1.0-beta" targetFramework="native" />
<package id="KNSoft.NDK" version="1.2.0-beta" targetFramework="native" />
</packages>

0 comments on commit 092a097

Please sign in to comment.