Skip to content

Commit cb1ce7a

Browse files
committed
OnlineChecks: Fix performance issue
1 parent dfc91e8 commit cb1ce7a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

plugins/OnlineChecks/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ VOID NTAPI MenuItemCallback(
139139
config.cbSize = sizeof(TASKDIALOGCONFIG);
140140
config.dwFlags = TDF_USE_HICON_MAIN | TDF_ALLOW_DIALOG_CANCELLATION;
141141
config.dwCommonButtons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON;
142+
config.hwndParent = menuItem->OwnerWindow;
142143
config.hMainIcon = PhLoadIcon(
143144
NtCurrentPeb()->ImageBaseAddress,
144145
MAKEINTRESOURCE(PHAPP_IDI_PROCESSHACKER),

plugins/OnlineChecks/virustotal.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,17 @@ NTSTATUS NTAPI VirusTotalProcessApiThread(
383383
_In_ PVOID Parameter
384384
)
385385
{
386-
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
386+
LONG increment;
387+
IO_PRIORITY_HINT ioPriority;
387388

388-
Sleep(5 / PH_TICKS_PER_SEC);
389+
// TODO: Workqueue support.
390+
increment = THREAD_PRIORITY_LOWEST;
391+
ioPriority = IoPriorityVeryLow;
392+
393+
NtSetInformationThread(NtCurrentThread(), ThreadBasePriority, &increment, sizeof(LONG));
394+
NtSetInformationThread(NtCurrentThread(), ThreadIoPriority, &ioPriority, sizeof(IO_PRIORITY_HINT));
395+
396+
Sleep(5 * PH_TICKS_PER_SEC);
389397

390398
do
391399
{
@@ -529,7 +537,7 @@ NTSTATUS NTAPI VirusTotalProcessApiThread(
529537
}
530538

531539
// Wait 15 seconds before checking list again
532-
Sleep(10 / PH_TICKS_PER_SEC);
540+
Sleep(15 * PH_TICKS_PER_MS);
533541

534542
} while (VirusTotalHandle);
535543

0 commit comments

Comments
 (0)