Update to the latest SDK
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -19,9 +19,9 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<ProjectGuid>{B385D394-19CC-48BC-827E-AF9ADCE559E0}</ProjectGuid>
|
||||
<TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<RootNamespace>KSystemInformer</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
<SignMode>Off</SignMode>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{c6f1d7ed-ed5d-4745-9ea8-c0dfaa942906}</UniqueIdentifier>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -27,9 +27,9 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<ProjectGuid>{B1863396-A667-42DB-97AC-C5E033CEE321}</ProjectGuid>
|
||||
<TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<RootNamespace>kphlib_km</RootNamespace>
|
||||
<ProjectName>kphlib</ProjectName>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{82b195b6-02b5-4bd3-b6be-ef713fcec8aa}</UniqueIdentifier>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{f1757430-8eee-49df-a5f1-0999a53bb4a0}</ProjectGuid>
|
||||
<RootNamespace>kphlib_um</RootNamespace>
|
||||
@@ -41,6 +41,7 @@
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
@@ -55,13 +56,15 @@
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
<SpectreMitigation>Spectre</SpectreMitigation>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
@@ -75,6 +78,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{d727b7f5-c766-42e2-b006-b57a27838deb}</UniqueIdentifier>
|
||||
|
||||
@@ -501,6 +501,35 @@ HWND PhGetShellWindow(
|
||||
return GetShellWindow();
|
||||
}
|
||||
|
||||
BOOLEAN PhSetChildWindowNoActivate(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ HANDLE ThreadId
|
||||
)
|
||||
{
|
||||
typedef ULONG (WINAPI* SetChildWindowNoActivate)(
|
||||
_In_ HWND WindowHandle
|
||||
);
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
static typeof(SetChildWindowNoActivate) SetChildWindowNoActivate_I = NULL; // NtUserSetChildWindowNoActivate
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
PVOID baseAddress;
|
||||
|
||||
if (baseAddress = PhLoadLibrary(L"user32.dll"))
|
||||
{
|
||||
SetChildWindowNoActivate_I = PhGetDllBaseProcedureAddress(baseAddress, nullptr, 2005);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&initOnce);
|
||||
}
|
||||
|
||||
if (!SetChildWindowNoActivate_I)
|
||||
return FALSE;
|
||||
|
||||
return !!SetChildWindowNoActivate_I(WindowHandle);
|
||||
}
|
||||
|
||||
BOOLEAN PhCheckWindowThreadDesktop(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ HANDLE ThreadId
|
||||
|
||||
+21
-148
@@ -185,7 +185,7 @@ LONG PhFindIListViewItemByFlags(
|
||||
LVITEMINDEX nextItemIndex;
|
||||
|
||||
itemIndex.iItem = StartIndex;
|
||||
itemIndex.iGroup = 0;
|
||||
itemIndex.iGroup = -1;
|
||||
|
||||
if (SUCCEEDED(ListView->GetNextItem(itemIndex, Flags, &nextItemIndex)))
|
||||
return nextItemIndex.iItem;
|
||||
@@ -425,6 +425,25 @@ VOID PhSetIListViewSubItem(
|
||||
ListView->SetItem(&item);
|
||||
}
|
||||
|
||||
VOID PhSetIListViewGroupSubItem(
|
||||
_In_ IListView* ListView,
|
||||
_In_ LONG GroupId,
|
||||
_In_ LONG Index,
|
||||
_In_ LONG SubItemIndex,
|
||||
_In_ PCWSTR Text
|
||||
)
|
||||
{
|
||||
LVITEM item;
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_GROUPID;
|
||||
item.iItem = Index;
|
||||
item.iSubItem = SubItemIndex;
|
||||
item.iGroupId = GroupId;
|
||||
item.pszText = const_cast<PWSTR>(Text);
|
||||
|
||||
ListView->SetItem(&item);
|
||||
}
|
||||
|
||||
VOID PhRedrawListViewItems(
|
||||
_In_ HWND ListViewHandle
|
||||
)
|
||||
@@ -701,153 +720,7 @@ BOOLEAN PhGetIListViewItemRect(
|
||||
LVITEMINDEX itemIndex;
|
||||
|
||||
itemIndex.iItem = StartIndex;
|
||||
itemIndex.iGroup = 0;
|
||||
itemIndex.iGroup = -1;
|
||||
|
||||
return SUCCEEDED(ListView->GetItemRect(itemIndex, Flags, ItemRect));
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum class SlimEventType
|
||||
{
|
||||
AutoReset,
|
||||
ManualReset,
|
||||
};
|
||||
|
||||
/**
|
||||
A lean and mean event class.
|
||||
This class provides a very similar API to `wil::unique_event` but doesn't require a kernel object.
|
||||
|
||||
The two variants of this class are:
|
||||
- `wil::slim_event_auto_reset`
|
||||
- `wil::slim_event_manual_reset`
|
||||
|
||||
In addition, `wil::slim_event_auto_reset` has the alias `wil::slim_event`.
|
||||
Some key differences to `wil::unique_event` include:
|
||||
- There is no 'create()' function, as initialization occurs in the constructor and can't fail.
|
||||
- The move functions have been deleted.
|
||||
- For auto-reset events, the `is_signaled()` function doesn't reset the event. (Use `ResetEvent()` instead.)
|
||||
- The `ResetEvent()` function returns the previous state of the event.
|
||||
- To create a manual reset event, use `wil::slim_event_manual_reset'.
|
||||
~~~~
|
||||
wil::slim_event finished;
|
||||
std::thread doStuff([&finished] () {
|
||||
Sleep(10);
|
||||
finished.SetEvent();
|
||||
});
|
||||
finished.wait();
|
||||
|
||||
std::shared_ptr<wil::slim_event> CreateSharedEvent(bool startSignaled)
|
||||
{
|
||||
return std::make_shared<wil::slim_event>(startSignaled);
|
||||
}
|
||||
~~~~ */
|
||||
template <SlimEventType Type>
|
||||
class slim_event_t
|
||||
{
|
||||
public:
|
||||
slim_event_t() noexcept = default;
|
||||
slim_event_t(bool isSignaled) noexcept : m_isSignaled(isSignaled ? TRUE : FALSE) { }
|
||||
|
||||
// Cannot change memory location.
|
||||
slim_event_t(const slim_event_t&) noexcept = default;
|
||||
slim_event_t(slim_event_t&&) noexcept = default;
|
||||
slim_event_t& operator=(const slim_event_t&) noexcept = default;
|
||||
slim_event_t& operator=(slim_event_t&&) noexcept = default;
|
||||
|
||||
ULONG_PTR m_isSignaled = FALSE;
|
||||
|
||||
// Returns the previous state of the event.
|
||||
bool ResetEvent() noexcept
|
||||
{
|
||||
return !!InterlockedExchangePointer(reinterpret_cast<volatile PVOID*>(&m_isSignaled), nullptr);
|
||||
}
|
||||
|
||||
void SetEvent() noexcept
|
||||
{
|
||||
// FYI: 'WakeByAddress*' invokes a full memory barrier.
|
||||
WriteULongPtrRelease(&m_isSignaled, TRUE);
|
||||
|
||||
if (Type == SlimEventType::AutoReset)
|
||||
{
|
||||
RtlWakeAddressSingle(&m_isSignaled);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlWakeAddressAll(&m_isSignaled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Checks if the event is currently signaled.
|
||||
// Note: Unlike Win32 auto-reset event objects, this will not reset the event.
|
||||
[[nodiscard]] bool is_signaled() const noexcept
|
||||
{
|
||||
return !!ReadULongPtrAcquire(&m_isSignaled);
|
||||
}
|
||||
|
||||
bool wait(ULONG timeoutMilliseconds) noexcept
|
||||
{
|
||||
ULONG64 elapsedTimeMilliseconds = 0;
|
||||
LARGE_INTEGER startCounter;
|
||||
LARGE_INTEGER stopCounter;
|
||||
|
||||
if (timeoutMilliseconds == 0)
|
||||
return TryAcquireEvent();
|
||||
if (timeoutMilliseconds == INFINITE)
|
||||
return wait();
|
||||
|
||||
PhQueryPerformanceCounter(&startCounter);
|
||||
|
||||
while (!TryAcquireEvent())
|
||||
{
|
||||
if (elapsedTimeMilliseconds >= timeoutMilliseconds)
|
||||
return false;
|
||||
|
||||
ULONG newTimeout = static_cast<ULONG>(timeoutMilliseconds - elapsedTimeMilliseconds);
|
||||
|
||||
if (!WaitForSignal(newTimeout))
|
||||
return false;
|
||||
|
||||
PhQueryPerformanceCounter(&stopCounter);
|
||||
elapsedTimeMilliseconds = (stopCounter.QuadPart - startCounter.QuadPart);
|
||||
elapsedTimeMilliseconds /= static_cast<ULONG64>(10 * 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wait() noexcept
|
||||
{
|
||||
while (!TryAcquireEvent())
|
||||
{
|
||||
if (!WaitForSignal(INFINITE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool TryAcquireEvent() noexcept
|
||||
{
|
||||
if (Type == SlimEventType::AutoReset)
|
||||
{
|
||||
return ResetEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
return is_signaled();
|
||||
}
|
||||
}
|
||||
|
||||
bool WaitForSignal(DWORD timeoutMilliseconds) noexcept
|
||||
{
|
||||
LONG falseValue = FALSE;
|
||||
BOOL waitResult = WaitOnAddress(&m_isSignaled, &falseValue, sizeof(m_isSignaled), timeoutMilliseconds);
|
||||
//__FAIL_FAST_ASSERT__(waitResult || ::GetLastError() == ERROR_TIMEOUT);
|
||||
return !!waitResult;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -725,6 +725,17 @@ PhSetIListViewSubItem(
|
||||
_In_ PCWSTR Text
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
PhSetIListViewGroupSubItem(
|
||||
_In_ IListView* ListView,
|
||||
_In_ LONG GroupId,
|
||||
_In_ LONG Index,
|
||||
_In_ LONG SubItemIndex,
|
||||
_In_ PCWSTR Text
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
@@ -971,6 +982,9 @@ PhGetListViewInterface(
|
||||
return listviewInterface;
|
||||
}
|
||||
|
||||
#define PhDestroyListViewInterface(ListViewClass) \
|
||||
if (ListViewClass) IListView_Release((struct IListView*)(ListViewClass));
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
|
||||
@@ -71,6 +71,7 @@ PhIsExecutingInWow64(
|
||||
VOID
|
||||
);
|
||||
|
||||
_Analysis_noreturn_
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
NTAPI
|
||||
|
||||
@@ -444,7 +444,7 @@ _InterlockedReadPointer(
|
||||
_Inout_ _Interlocked_operand_ volatile PVOID *Base
|
||||
)
|
||||
{
|
||||
return _InterlockedCompareExchangePointer(Base, nullptr, nullptr);
|
||||
return _InterlockedCompareExchangePointer(Base, NULL, NULL);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
@@ -614,7 +614,7 @@ PhMultiplyDivide(
|
||||
_In_ CONST ULONG Denominator
|
||||
)
|
||||
{
|
||||
return (ULONG)(((ULONG64)Number * (ULONG64)Numerator + Denominator / 2) / (ULONG64)Denominator);
|
||||
return UInt32Div32To64((UInt32Div32To64(UInt32Add32To64(UInt32Mul32To64(Number, Numerator), Denominator), 2)), Denominator);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
|
||||
@@ -824,7 +824,8 @@ VOID PhTnpProcessDragSelect(
|
||||
// Double buffering
|
||||
|
||||
VOID PhTnpCreateBufferedContext(
|
||||
_In_ PPH_TREENEW_CONTEXT Context
|
||||
_In_ PPH_TREENEW_CONTEXT Context,
|
||||
_In_ HDC Hdc
|
||||
);
|
||||
|
||||
VOID PhTnpDestroyBufferedContext(
|
||||
|
||||
+7
-10
@@ -46,7 +46,7 @@ PH_TOKEN_ATTRIBUTES PhGetOwnTokenAttributes(
|
||||
)
|
||||
{
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
static PH_TOKEN_ATTRIBUTES attributes = { 0 };
|
||||
static PH_TOKEN_ATTRIBUTES attributes = { nullptr };
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
@@ -108,14 +108,6 @@ NTSTATUS PhOpenProcess(
|
||||
clientId.UniqueProcess = ProcessId;
|
||||
clientId.UniqueThread = NULL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (ProcessId == NtCurrentProcessId())
|
||||
{
|
||||
*ProcessHandle = NtCurrentProcess();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
level = KsiLevel();
|
||||
|
||||
if ((level >= KphLevelMed) && (DesiredAccess & KPH_PROCESS_READ_ACCESS) == DesiredAccess)
|
||||
@@ -13849,6 +13841,11 @@ NTSTATUS PhEnumVirtualMemoryBulk(
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
if (PhIsExecutingInWow64())
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!NtPssCaptureVaSpaceBulk_Import())
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
@@ -13974,7 +13971,7 @@ NTSTATUS PhEnumVirtualMemoryPages(
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
NTSTATUS status;
|
||||
PMEMORY_WORKING_SET_INFORMATION pageInfo;
|
||||
|
||||
status = PhGetProcessWorkingSetInformation(
|
||||
|
||||
@@ -405,9 +405,9 @@ BOOLEAN NTAPI PhpEnumProcessModulesCallback(
|
||||
|
||||
if (indexOfLastBackslash != SIZE_MAX)
|
||||
{
|
||||
Entry->BaseDllName.Buffer = PTR_ADD_OFFSET(Entry->FullDllName.Buffer, indexOfLastBackslash * sizeof(WCHAR) + sizeof(UNICODE_NULL));
|
||||
Entry->BaseDllName.Length = Entry->FullDllName.Length - (USHORT)(indexOfLastBackslash * sizeof(WCHAR) - sizeof(UNICODE_NULL));
|
||||
Entry->BaseDllName.MaximumLength = Entry->BaseDllName.Length;
|
||||
Entry->BaseDllName.Buffer = Entry->FullDllName.Buffer + indexOfLastBackslash + 1;
|
||||
Entry->BaseDllName.Length = Entry->FullDllName.Length - (USHORT)indexOfLastBackslash * sizeof(WCHAR) - sizeof(UNICODE_NULL);
|
||||
Entry->BaseDllName.MaximumLength = Entry->BaseDllName.Length + sizeof(UNICODE_NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-15
@@ -16,9 +16,6 @@
|
||||
#include <lsasup.h>
|
||||
#include <mapldr.h>
|
||||
|
||||
#define PHNT_NATIVE_METHODS 0
|
||||
#define PH_NATIVE_WINDOWS_RUNTIME_STRING 1
|
||||
|
||||
/**
|
||||
* Opens a thread.
|
||||
*
|
||||
@@ -149,35 +146,35 @@ NTSTATUS PhOpenThreadProcess(
|
||||
THREAD_BASIC_INFORMATION basicInfo;
|
||||
KPH_LEVEL level;
|
||||
|
||||
status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
level = KsiLevel();
|
||||
|
||||
if ((level == KphLevelMax) ||
|
||||
((level >= KphLevelMed) &&
|
||||
((DesiredAccess & KPH_PROCESS_READ_ACCESS) == DesiredAccess)))
|
||||
if (level == KphLevelMax || (level >= KphLevelMed && FlagOn(DesiredAccess, KPH_PROCESS_READ_ACCESS) == DesiredAccess))
|
||||
{
|
||||
status = KphOpenThreadProcess(
|
||||
ThreadHandle,
|
||||
DesiredAccess,
|
||||
ProcessHandle
|
||||
);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
return status;
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
return status;
|
||||
|
||||
if (!NT_SUCCESS(status = PhGetThreadBasicInformation(
|
||||
status = PhGetThreadBasicInformation(
|
||||
ThreadHandle,
|
||||
&basicInfo
|
||||
)))
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
return status;
|
||||
|
||||
return PhOpenProcess(
|
||||
status = PhOpenProcessClientId(
|
||||
ProcessHandle,
|
||||
DesiredAccess,
|
||||
basicInfo.ClientId.UniqueProcess
|
||||
&basicInfo.ClientId
|
||||
);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NTSTATUS PhTerminateThread(
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -27,6 +27,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<ProjectGuid>{477D0215-F252-41A1-874B-F27E3EA1ED17}</ProjectGuid>
|
||||
<RootNamespace>phlib</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
@@ -179,9 +179,6 @@
|
||||
<ClCompile Include="strsrch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="appsupport.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ntuser.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
+2
-2
@@ -1319,9 +1319,9 @@ VOID PhCreateSearchControlEx(
|
||||
context->CaseButton.Active = !!PhGetIntegerSetting(context->CaseSetting);
|
||||
|
||||
// Subclass the Edit control window procedure.
|
||||
context->DefaultWindowProc = (WNDPROC)GetWindowLongPtr(WindowHandle, GWLP_WNDPROC);
|
||||
context->DefaultWindowProc = PhGetWindowProcedure(WindowHandle);
|
||||
PhSetWindowContext(WindowHandle, SHRT_MAX, context);
|
||||
SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)PhpSearchWndSubclassProc);
|
||||
PhSetWindowProcedure(WindowHandle, PhpSearchWndSubclassProc);
|
||||
|
||||
// Initialize the theme parameters.
|
||||
PhpSearchControlThemeChanged(context, WindowHandle);
|
||||
|
||||
+32
-34
@@ -703,18 +703,18 @@ VOID PhTnpOnPaint(
|
||||
return;
|
||||
}
|
||||
|
||||
if (Context->DoubleBuffered)
|
||||
{
|
||||
if (!Context->BufferedContext)
|
||||
{
|
||||
PhTnpCreateBufferedContext(Context);
|
||||
}
|
||||
}
|
||||
|
||||
if (hdc = BeginPaint(hwnd, &paintStruct))
|
||||
{
|
||||
updateRect = paintStruct.rcPaint;
|
||||
|
||||
if (Context->DoubleBuffered)
|
||||
{
|
||||
if (!Context->BufferedContext)
|
||||
{
|
||||
PhTnpCreateBufferedContext(Context, hdc);
|
||||
}
|
||||
}
|
||||
|
||||
if (Context->BufferedContext)
|
||||
{
|
||||
PhTnpPaint(hwnd, Context, Context->BufferedContext, &updateRect);
|
||||
@@ -6214,7 +6214,9 @@ VOID PhTnpDrawThemedBorder(
|
||||
LONG borderX;
|
||||
LONG borderY;
|
||||
|
||||
GetWindowRect(Context->Handle, &windowRect);
|
||||
if (!PhGetWindowRect(Context->Handle, &windowRect))
|
||||
return;
|
||||
|
||||
windowRect.right -= windowRect.left;
|
||||
windowRect.bottom -= windowRect.top;
|
||||
windowRect.left = 0;
|
||||
@@ -7344,7 +7346,8 @@ VOID PhTnpDragSelect(
|
||||
// TODO: Make sure the monitor's color depth is sufficient for alpha-blended selection
|
||||
// rectangles.
|
||||
|
||||
GetWindowRect(Context->Handle, &windowRect);
|
||||
if (!PhGetWindowRect(Context->Handle, &windowRect))
|
||||
return;
|
||||
|
||||
cursorPoint.x = windowRect.left + cursorX;
|
||||
cursorPoint.y = windowRect.top + cursorY;
|
||||
@@ -7658,35 +7661,30 @@ VOID PhTnpProcessDragSelect(
|
||||
}
|
||||
|
||||
VOID PhTnpCreateBufferedContext(
|
||||
_In_ PPH_TREENEW_CONTEXT Context
|
||||
_In_ PPH_TREENEW_CONTEXT Context,
|
||||
_In_ HDC Hdc
|
||||
)
|
||||
{
|
||||
HDC hdc;
|
||||
Context->BufferedContext = CreateCompatibleDC(Hdc);
|
||||
|
||||
if (hdc = GetDC(Context->Handle))
|
||||
if (!Context->BufferedContext)
|
||||
return;
|
||||
|
||||
Context->BufferedContextRect = Context->ClientRect;
|
||||
Context->BufferedBitmap = CreateCompatibleBitmap(
|
||||
Hdc,
|
||||
Context->BufferedContextRect.right + 1, // leave one extra pixel for divider animation
|
||||
Context->BufferedContextRect.bottom
|
||||
);
|
||||
|
||||
if (!Context->BufferedBitmap)
|
||||
{
|
||||
Context->BufferedContext = CreateCompatibleDC(hdc);
|
||||
|
||||
if (!Context->BufferedContext)
|
||||
return;
|
||||
|
||||
Context->BufferedContextRect = Context->ClientRect;
|
||||
Context->BufferedBitmap = CreateCompatibleBitmap(
|
||||
hdc,
|
||||
Context->BufferedContextRect.right + 1, // leave one extra pixel for divider animation
|
||||
Context->BufferedContextRect.bottom
|
||||
);
|
||||
|
||||
if (!Context->BufferedBitmap)
|
||||
{
|
||||
DeleteDC(Context->BufferedContext);
|
||||
Context->BufferedContext = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ReleaseDC(Context->Handle, hdc);
|
||||
Context->BufferedOldBitmap = SelectBitmap(Context->BufferedContext, Context->BufferedBitmap);
|
||||
DeleteDC(Context->BufferedContext);
|
||||
Context->BufferedContext = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
Context->BufferedOldBitmap = SelectBitmap(Context->BufferedContext, Context->BufferedBitmap);
|
||||
}
|
||||
|
||||
VOID PhTnpDestroyBufferedContext(
|
||||
|
||||
Reference in New Issue
Block a user