Skip to content

Commit 749a5f5

Browse files
committed
Move GetProcessDpiAwarenessInternal to guisup
1 parent f279cb4 commit 749a5f5

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

ProcessHacker/proctree.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,28 +1240,13 @@ static VOID PhpUpdateProcessNodeDpiAwareness(
12401240
_Inout_ PPH_PROCESS_NODE ProcessNode
12411241
)
12421242
{
1243-
static PH_INITONCE initOnce = PH_INITONCE_INIT;
1244-
static BOOL (WINAPI *getProcessDpiAwarenessInternal)(
1245-
_In_ HANDLE hprocess,
1246-
_Out_ ULONG *value
1247-
);
1248-
1249-
if (PhBeginInitOnce(&initOnce))
1250-
{
1251-
getProcessDpiAwarenessInternal = PhGetDllProcedureAddress(L"user32.dll", "GetProcessDpiAwarenessInternal", 0);
1252-
PhEndInitOnce(&initOnce);
1253-
}
1254-
1255-
if (!getProcessDpiAwarenessInternal)
1256-
return;
1257-
12581243
if (!(ProcessNode->ValidMask & PHPN_DPIAWARENESS))
12591244
{
12601245
if (ProcessNode->ProcessItem->QueryHandle)
12611246
{
12621247
ULONG dpiAwareness;
12631248

1264-
if (getProcessDpiAwarenessInternal(ProcessNode->ProcessItem->QueryHandle, &dpiAwareness))
1249+
if (PhGetProcessDpiAwareness(ProcessNode->ProcessItem->QueryHandle, &dpiAwareness))
12651250
ProcessNode->DpiAwareness = dpiAwareness + 1;
12661251
}
12671252

phlib/guisup.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,37 @@ BOOLEAN PhIsImmersiveProcess(
18171817
return !!IsImmersiveProcess_I(ProcessHandle);
18181818
}
18191819

1820+
_Success_(return)
1821+
BOOLEAN PhGetProcessDpiAwareness(
1822+
_In_ HANDLE ProcessHandle,
1823+
_Out_ PULONG ProcessDpiAwareness
1824+
)
1825+
{
1826+
static PH_INITONCE initOnce = PH_INITONCE_INIT;
1827+
static BOOL (WINAPI *GetProcessDpiAwarenessInternal_I)(
1828+
_In_ HANDLE hprocess,
1829+
_Out_ ULONG *value
1830+
);
1831+
ULONG dpiAwareness = 0;
1832+
1833+
if (PhBeginInitOnce(&initOnce))
1834+
{
1835+
GetProcessDpiAwarenessInternal_I = PhGetDllProcedureAddress(L"user32.dll", "GetProcessDpiAwarenessInternal", 0);
1836+
PhEndInitOnce(&initOnce);
1837+
}
1838+
1839+
if (!GetProcessDpiAwarenessInternal_I)
1840+
return FALSE;
1841+
1842+
if (GetProcessDpiAwarenessInternal_I(ProcessHandle, &dpiAwareness))
1843+
{
1844+
*ProcessDpiAwareness = dpiAwareness;
1845+
return TRUE;
1846+
}
1847+
1848+
return FALSE;
1849+
}
1850+
18201851
// rev from ExtractIconExW
18211852
_Success_(return)
18221853
BOOLEAN PhExtractIcon(

phlib/include/guisup.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,15 @@ PhIsImmersiveProcess(
967967
_In_ HANDLE ProcessHandle
968968
);
969969

970+
_Success_(return)
971+
PHLIBAPI
972+
BOOLEAN
973+
NTAPI
974+
PhGetProcessDpiAwareness(
975+
_In_ HANDLE ProcessHandle,
976+
_Out_ PULONG ProcessDpiAwareness
977+
);
978+
970979
_Success_(return)
971980
PHLIBAPI
972981
BOOLEAN

0 commit comments

Comments
 (0)