Remove legacy Vista support

This commit is contained in:
dmex
2017-06-14 09:06:46 +10:00
parent 7c172f65a8
commit ccfd5ee036
21 changed files with 127 additions and 403 deletions
-1
View File
@@ -383,7 +383,6 @@ BEGIN
BEGIN
MENUITEM "&Go to process\aEnter", ID_NETWORK_GOTOPROCESS
MENUITEM "Go to service", ID_NETWORK_GOTOSERVICE
MENUITEM "View &stack", ID_NETWORK_VIEWSTACK
MENUITEM "C&lose", ID_NETWORK_CLOSE
MENUITEM SEPARATOR
MENUITEM "&Copy\aCtrl+C", ID_NETWORK_COPY
+1 -19
View File
@@ -726,7 +726,6 @@ static BOOLEAN PhpIsDangerousProcess(
)
{
NTSTATUS status;
HANDLE processHandle;
PPH_STRING fileName;
PPH_STRING systemDirectory;
ULONG i;
@@ -734,24 +733,7 @@ static BOOLEAN PhpIsDangerousProcess(
if (ProcessId == SYSTEM_PROCESS_ID)
return TRUE;
if (WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID)
{
status = PhGetProcessImageFileNameByProcessId(ProcessId, &fileName);
}
else
{
if (!NT_SUCCESS(status = PhOpenProcess(
&processHandle,
ProcessQueryAccess,
ProcessId
)))
return FALSE;
status = PhGetProcessImageFileName(processHandle, &fileName);
NtClose(processHandle);
}
if (!NT_SUCCESS(status))
if (!NT_SUCCESS(status = PhGetProcessImageFileNameByProcessId(ProcessId, &fileName)))
return FALSE;
PhMoveReference(&fileName, PhGetFileName(fileName));
+2 -6
View File
@@ -120,9 +120,6 @@ static VOID PhpRefreshProcessList(
HANDLE tokenHandle;
PTOKEN_USER user;
if (!WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID && process->UniqueProcessId != SYSTEM_PROCESS_ID)
PhGetProcessImageFileName(processHandle, &fileName);
if (NT_SUCCESS(PhOpenProcessToken(processHandle, TOKEN_QUERY, &tokenHandle)))
{
if (NT_SUCCESS(PhGetTokenUser(tokenHandle, &user)))
@@ -140,11 +137,10 @@ static VOID PhpRefreshProcessList(
if (process->UniqueProcessId == SYSTEM_IDLE_PROCESS_ID && !userName && PhLocalSystemName)
PhSetReference(&userName, PhLocalSystemName);
if (WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID && process->UniqueProcessId != SYSTEM_PROCESS_ID)
PhGetProcessImageFileNameByProcessId(process->UniqueProcessId, &fileName);
if (process->UniqueProcessId == SYSTEM_PROCESS_ID)
fileName = PhGetKernelFileName();
else
PhGetProcessImageFileNameByProcessId(process->UniqueProcessId, &fileName);
if (fileName)
PhMoveReference(&fileName, PhGetFileName(fileName));
+26 -87
View File
@@ -315,105 +315,44 @@ NTSTATUS PhEnumHandlesGeneric(
// Enumerate handles using KProcessHacker. Unlike with NtQuerySystemInformation,
// this only enumerates handles for a single process and saves a lot of processing.
if (NT_SUCCESS(status = KphEnumerateProcessHandles2(ProcessHandle, &handles)))
{
convertedHandles = PhAllocate(
FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles) +
sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX) * handles->HandleCount
);
convertedHandles->NumberOfHandles = handles->HandleCount;
for (i = 0; i < handles->HandleCount; i++)
{
convertedHandles->Handles[i].Object = handles->Handles[i].Object;
convertedHandles->Handles[i].UniqueProcessId = (ULONG_PTR)ProcessId;
convertedHandles->Handles[i].HandleValue = (ULONG_PTR)handles->Handles[i].Handle;
convertedHandles->Handles[i].GrantedAccess = (ULONG)handles->Handles[i].GrantedAccess;
convertedHandles->Handles[i].CreatorBackTraceIndex = 0;
convertedHandles->Handles[i].ObjectTypeIndex = handles->Handles[i].ObjectTypeIndex;
convertedHandles->Handles[i].HandleAttributes = handles->Handles[i].HandleAttributes;
}
PhFree(handles);
*Handles = convertedHandles;
*FilterNeeded = FALSE;
if (!NT_SUCCESS(status = KphEnumerateProcessHandles2(ProcessHandle, &handles)))
return status;
}
}
if (WindowsVersion >= WINDOWS_XP)
convertedHandles = PhAllocate(
FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles) +
sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX) * handles->HandleCount
);
convertedHandles->NumberOfHandles = handles->HandleCount;
for (i = 0; i < handles->HandleCount; i++)
{
convertedHandles->Handles[i].Object = handles->Handles[i].Object;
convertedHandles->Handles[i].UniqueProcessId = (ULONG_PTR)ProcessId;
convertedHandles->Handles[i].HandleValue = (ULONG_PTR)handles->Handles[i].Handle;
convertedHandles->Handles[i].GrantedAccess = (ULONG)handles->Handles[i].GrantedAccess;
convertedHandles->Handles[i].CreatorBackTraceIndex = 0;
convertedHandles->Handles[i].ObjectTypeIndex = handles->Handles[i].ObjectTypeIndex;
convertedHandles->Handles[i].HandleAttributes = handles->Handles[i].HandleAttributes;
}
PhFree(handles);
*Handles = convertedHandles;
*FilterNeeded = FALSE;
}
else
{
PSYSTEM_HANDLE_INFORMATION_EX handles;
// Enumerate handles using the new method; no conversion
// necessary.
if (!NT_SUCCESS(status = PhEnumHandlesEx(&handles)))
return status;
*Handles = handles;
*FilterNeeded = TRUE;
}
else
{
PSYSTEM_HANDLE_INFORMATION handles;
PSYSTEM_HANDLE_INFORMATION_EX convertedHandles;
ULONG count;
ULONG allocatedCount;
ULONG i;
// Enumerate handles using the old info class and convert
// the relevant entries to the new format.
if (!NT_SUCCESS(status = PhEnumHandles(&handles)))
return status;
count = 0;
allocatedCount = 100;
convertedHandles = PhAllocate(
FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles) +
sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX) * allocatedCount
);
for (i = 0; i < handles->NumberOfHandles; i++)
{
if ((HANDLE)handles->Handles[i].UniqueProcessId != ProcessId)
continue;
if (count == allocatedCount)
{
allocatedCount *= 2;
convertedHandles = PhReAllocate(
convertedHandles,
FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles) +
sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX) * allocatedCount
);
}
convertedHandles->Handles[count].Object = handles->Handles[i].Object;
convertedHandles->Handles[count].UniqueProcessId = (ULONG_PTR)handles->Handles[i].UniqueProcessId;
convertedHandles->Handles[count].HandleValue = (ULONG_PTR)handles->Handles[i].HandleValue;
convertedHandles->Handles[count].GrantedAccess = handles->Handles[i].GrantedAccess;
convertedHandles->Handles[count].CreatorBackTraceIndex = handles->Handles[i].CreatorBackTraceIndex;
convertedHandles->Handles[count].ObjectTypeIndex = handles->Handles[i].ObjectTypeIndex;
convertedHandles->Handles[count].HandleAttributes = (ULONG)handles->Handles[i].HandleAttributes;
count++;
}
convertedHandles->NumberOfHandles = count;
PhFree(handles);
*Handles = convertedHandles;
*FilterNeeded = FALSE;
}
return STATUS_SUCCESS;
return status;
}
NTSTATUS PhpCreateHandleItemFunction(
-3
View File
@@ -592,9 +592,6 @@ VOID PhInitializeKph(
PUCHAR signature;
ULONG signatureSize;
if (WindowsVersion < WINDOWS_7)
return;
kprocesshackerFileName = PhConcatStringRef2(&PhApplicationDirectory->sr, &kprocesshacker);
processhackerSigFileName = PhConcatStringRef2(&PhApplicationDirectory->sr, &processhackerSig);
-12
View File
@@ -1520,18 +1520,6 @@ VOID PhMwpOnCommand(
}
}
break;
case ID_NETWORK_VIEWSTACK:
{
PPH_NETWORK_ITEM networkItem = PhGetSelectedNetworkItem();
if (networkItem)
{
PhReferenceObject(networkItem);
PhShowNetworkStackDialog(PhMainWndHandle, networkItem);
PhDereferenceObject(networkItem);
}
}
break;
case ID_NETWORK_CLOSE:
{
PPH_NETWORK_ITEM *networkItems;
+1 -6
View File
@@ -780,12 +780,7 @@ ContinueLoop:
PhpUpdateMemoryRegionTypes(List, processHandle);
if (Flags & PH_QUERY_MEMORY_WS_COUNTERS)
{
if (WindowsVersion >= WINDOWS_SERVER_2003)
PhpUpdateMemoryWsCounters(List, processHandle);
else
PhpUpdateMemoryWsCountersOld(List, processHandle);
}
PhpUpdateMemoryWsCounters(List, processHandle);
NtClose(processHandle);
-6
View File
@@ -221,12 +221,6 @@ VOID PhMwpInitializeNetworkMenu(
PhEnableEMenuItem(Menu, ID_NETWORK_COPY, TRUE);
}
if (WindowsVersion >= WINDOWS_VISTA)
{
if (item = PhFindEMenuItem(Menu, 0, NULL, ID_NETWORK_VIEWSTACK))
PhDestroyEMenuItem(item);
}
// Go to Service
if (NumberOfNetworkItems != 1 || !NetworkItems[0]->OwnerName)
{
+1 -1
View File
@@ -123,7 +123,7 @@ BOOLEAN PhMwpProcessesPageCallback(
if (menuItem = PhFindEMenuItem(menu, 0, NULL, ID_VIEW_SHOWCPUBELOW001))
{
if (WindowsVersion >= WINDOWS_7 && PhEnableCycleCpuUsage)
if (PhEnableCycleCpuUsage)
{
if (PhCsShowCpuBelow001)
menuItem->Flags |= PH_EMENU_CHECKED;
-13
View File
@@ -814,19 +814,6 @@ BOOLEAN PhGetNetworkConnections(
tableSize = 0;
GetExtendedTcpTable(NULL, &tableSize, FALSE, AF_INET6, TCP_TABLE_OWNER_MODULE_ALL, 0);
// Note: On Windows XP, GetExtendedTcpTable had a bug where it calculated the required buffer size
// for IPv6 TCP_TABLE_OWNER_MODULE_ALL requests incorrectly, causing it to return the wrong size
// and overrun the provided buffer instead of returning an error. The size should be:
// = FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE, table) + sizeof(MIB_TCP6ROW_OWNER_MODULE) * (number of entries)
// However, the function calculated it as:
// = FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE, table) + sizeof(MIB_TCP6ROW_OWNER_PID) * (number of entries)
// A workaround is implemented below.
if (WindowsVersion <= WINDOWS_XP && tableSize >= (ULONG)FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE, table)) // make sure we don't wrap around
{
tableSize = FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE, table) +
(tableSize - FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE, table)) / sizeof(MIB_TCP6ROW_OWNER_PID) * sizeof(MIB_TCP6ROW_OWNER_MODULE);
}
table = PhAllocate(tableSize);
if (GetExtendedTcpTable(table, &tableSize, FALSE, AF_INET6, TCP_TABLE_OWNER_MODULE_ALL, 0) == 0)
+2 -11
View File
@@ -680,9 +680,7 @@ VOID PhpAdvancedPageLoad(
SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLENETWORKRESOLVE, L"EnableNetworkResolve");
SetDlgItemCheckForSetting(hwndDlg, IDC_PROPAGATECPUUSAGE, L"PropagateCpuUsage");
SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLEINSTANTTOOLTIPS, L"EnableInstantTooltips");
if (WindowsVersion >= WINDOWS_7)
SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLECYCLECPUUSAGE, L"EnableCycleCpuUsage");
SetDlgItemCheckForSetting(hwndDlg, IDC_ENABLECYCLECPUUSAGE, L"EnableCycleCpuUsage");
SetDlgItemInt(hwndDlg, IDC_SAMPLECOUNT, PhGetIntegerSetting(L"SampleCount"), FALSE);
SetDlgItemCheckForSetting(hwndDlg, IDC_SAMPLECOUNTAUTOMATIC, L"SampleCountAutomatic");
@@ -762,9 +760,7 @@ VOID PhpAdvancedPageSave(
SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLENETWORKRESOLVE, L"EnableNetworkResolve");
SetSettingForDlgItemCheck(hwndDlg, IDC_PROPAGATECPUUSAGE, L"PropagateCpuUsage");
SetSettingForDlgItemCheck(hwndDlg, IDC_ENABLEINSTANTTOOLTIPS, L"EnableInstantTooltips");
if (WindowsVersion >= WINDOWS_7)
SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLECYCLECPUUSAGE, L"EnableCycleCpuUsage");
SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_ENABLECYCLECPUUSAGE, L"EnableCycleCpuUsage");
sampleCount = GetDlgItemInt(hwndDlg, IDC_SAMPLECOUNT, NULL, FALSE);
SetSettingForDlgItemCheckRestartRequired(hwndDlg, IDC_SAMPLECOUNTAUTOMATIC, L"SampleCountAutomatic");
@@ -874,11 +870,6 @@ INT_PTR CALLBACK PhpOptionsAdvancedDlgProc(
EnableWindow(GetDlgItem(hwndDlg, IDC_SAMPLECOUNT), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SAMPLECOUNTAUTOMATIC), FALSE);
}
else
{
if (WindowsVersion < WINDOWS_7)
EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLECYCLECPUUSAGE), FALSE); // cycle-based CPU usage not available before Windows 7
}
}
break;
case WM_DESTROY:
+8 -41
View File
@@ -1151,7 +1151,7 @@ VOID PhpProcessQueryStage1(
}
// Console host process
if (processHandleLimited && WINDOWS_HAS_CONSOLE_HOST)
if (processHandleLimited)
{
PhGetProcessConsoleHostProcessId(processHandleLimited, &Data->ConsoleHostProcessId);
}
@@ -1423,35 +1423,6 @@ VOID PhpFillProcessItem(
}
}
if (!ProcessItem->UserName && WindowsVersion <= WINDOWS_XP)
{
// In some cases we can get the user SID using WTS (only works on XP and below).
if (!PhpTsProcesses)
{
WinStationGetAllProcesses(
NULL,
0,
&PhpTsNumberOfProcesses,
&PhpTsProcesses
);
}
if (PhpTsProcesses)
{
ULONG i;
for (i = 0; i < PhpTsNumberOfProcesses; i++)
{
if (UlongToHandle(PhpTsProcesses[i].pTsProcessInfo->UniqueProcessId) == ProcessItem->ProcessId)
{
ProcessItem->UserName = PhpGetSidFullNameCached(PhpTsProcesses[i].pSid);
break;
}
}
}
}
NtClose(processHandle);
}
@@ -1951,8 +1922,6 @@ VOID PhProcessProviderUpdate(
PSYSTEM_PROCESS_INFORMATION process;
ULONG bucketIndex;
BOOLEAN isCycleCpuUsageEnabled = FALSE;
ULONG64 sysTotalTime; // total time for this update period
ULONG64 sysTotalCycleTime = 0; // total cycle time for this update period
ULONG64 sysIdleCycleTime = 0; // total idle cycle time for this update period
@@ -1974,8 +1943,6 @@ VOID PhProcessProviderUpdate(
PhPurgeProcessRecords();
}
isCycleCpuUsageEnabled = WindowsVersion >= WINDOWS_7 && PhEnableCycleCpuUsage;
if (!PhProcessStatisticsInitialized)
{
PhpInitializeProcessStatistics();
@@ -1984,7 +1951,7 @@ VOID PhProcessProviderUpdate(
PhpUpdatePerfInformation();
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
{
PhpUpdateCpuInformation(FALSE, &sysTotalTime);
PhpUpdateCpuCycleInformation(&sysIdleCycleTime);
@@ -2053,7 +2020,7 @@ VOID PhProcessProviderUpdate(
process->UniqueProcessKey = (ULONG_PTR)pidBuckets[bucketIndex];
pidBuckets[bucketIndex] = process;
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
{
PPH_PROCESS_ITEM processItem;
@@ -2069,7 +2036,7 @@ VOID PhProcessProviderUpdate(
// On Windows 7 the two fake processes are merged into "Interrupts" since we can only get cycle
// time information both DPCs and Interrupts combined.
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
{
PhInterruptsProcessInformation.KernelTime.QuadPart = PhCpuTotals.DpcTime.QuadPart + PhCpuTotals.InterruptTime.QuadPart;
PhInterruptsProcessInformation.CycleTime = PhCpuSystemCycleDelta.Value;
@@ -2131,7 +2098,7 @@ VOID PhProcessProviderUpdate(
exitTime = times.ExitTime;
}
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
{
if (NT_SUCCESS(PhGetProcessCycleTime(processItem->QueryHandle, &finalCycleTime)))
{
@@ -2324,7 +2291,7 @@ VOID PhProcessProviderUpdate(
if (InterlockedExchange(&processItem->JustProcessed, 0) != 0)
modified = TRUE;
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
{
FLOAT totalDelta;
@@ -2464,7 +2431,7 @@ VOID PhProcessProviderUpdate(
if (process == NULL)
{
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
process = &PhInterruptsProcessInformation;
else
process = &PhDpcsProcessInformation;
@@ -2489,7 +2456,7 @@ VOID PhProcessProviderUpdate(
// I/O "deltas" will be huge because they are currently the raw accumulated values.
if (runCount != 0)
{
if (isCycleCpuUsageEnabled)
if (PhEnableCycleCpuUsage)
PhpUpdateCpuCycleUsageInformation(sysTotalCycleTime, sysIdleCycleTime);
PhpUpdateSystemHistory();
+41 -71
View File
@@ -427,7 +427,7 @@ PPH_PROCESS_NODE PhAddProcessNode(
}
}
if (WindowsVersion >= WINDOWS_7 && PhEnableCycleCpuUsage && ProcessItem->ProcessId == INTERRUPTS_PROCESS_ID)
if (PhEnableCycleCpuUsage && ProcessItem->ProcessId == INTERRUPTS_PROCESS_ID)
PhInitializeStringRef(&processNode->DescriptionText, L"Interrupts and DPCs");
if (FilterSupport.FilterList)
@@ -982,28 +982,25 @@ static VOID PhpUpdateProcessOsContext(
{
HANDLE processHandle;
if (WindowsVersion >= WINDOWS_7)
if (NT_SUCCESS(PhOpenProcess(&processHandle, ProcessQueryAccess | PROCESS_VM_READ, ProcessNode->ProcessId)))
{
if (NT_SUCCESS(PhOpenProcess(&processHandle, ProcessQueryAccess | PROCESS_VM_READ, ProcessNode->ProcessId)))
if (NT_SUCCESS(PhGetProcessSwitchContext(processHandle, &ProcessNode->OsContextGuid)))
{
if (NT_SUCCESS(PhGetProcessSwitchContext(processHandle, &ProcessNode->OsContextGuid)))
{
if (memcmp(&ProcessNode->OsContextGuid, &WINTHRESHOLD_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_10;
else if (memcmp(&ProcessNode->OsContextGuid, &WINBLUE_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_8_1;
else if (memcmp(&ProcessNode->OsContextGuid, &WIN8_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_8;
else if (memcmp(&ProcessNode->OsContextGuid, &WIN7_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_7;
else if (memcmp(&ProcessNode->OsContextGuid, &VISTA_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_VISTA;
else if (memcmp(&ProcessNode->OsContextGuid, &XP_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_XP;
}
NtClose(processHandle);
if (memcmp(&ProcessNode->OsContextGuid, &WINTHRESHOLD_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_10;
else if (memcmp(&ProcessNode->OsContextGuid, &WINBLUE_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_8_1;
else if (memcmp(&ProcessNode->OsContextGuid, &WIN8_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_8;
else if (memcmp(&ProcessNode->OsContextGuid, &WIN7_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_7;
else if (memcmp(&ProcessNode->OsContextGuid, &VISTA_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_VISTA;
else if (memcmp(&ProcessNode->OsContextGuid, &XP_CONTEXT_GUID, sizeof(GUID)) == 0)
ProcessNode->OsContextVersion = WINDOWS_XP;
}
NtClose(processHandle);
}
ProcessNode->ValidMask |= PHPN_OSCONTEXT;
@@ -1104,15 +1101,8 @@ static VOID PhpUpdateProcessNodeAppId(
if (!NT_SUCCESS(PhOpenProcess(&processHandle, ProcessQueryAccess | PROCESS_VM_READ, ProcessNode->ProcessId)))
{
if (WindowsVersion >= WINDOWS_7)
{
if (!NT_SUCCESS(PhOpenProcess(&processHandle, ProcessQueryAccess, ProcessNode->ProcessId)))
goto Done;
}
else
{
if (!NT_SUCCESS(PhOpenProcess(&processHandle, ProcessQueryAccess, ProcessNode->ProcessId)))
goto Done;
}
}
if (NT_SUCCESS(PhGetProcessWindowTitle(
@@ -2026,12 +2016,10 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
if (PhBeginInitOnce(&initOnce))
{
if (WindowsVersion >= WINDOWS_7)
{
sortFunctions[PHPRTLC_PRIVATEWS] = SORT_FUNCTION(PrivateWsWin7);
sortFunctions[PHPRTLC_CYCLES] = SORT_FUNCTION(CyclesWin7);
sortFunctions[PHPRTLC_CYCLESDELTA] = SORT_FUNCTION(CyclesDeltaWin7);
}
// TODO: Remove this.
sortFunctions[PHPRTLC_PRIVATEWS] = SORT_FUNCTION(PrivateWsWin7);
sortFunctions[PHPRTLC_CYCLES] = SORT_FUNCTION(CyclesWin7);
sortFunctions[PHPRTLC_CYCLESDELTA] = SORT_FUNCTION(CyclesDeltaWin7);
PhEndInitOnce(&initOnce);
}
@@ -2421,7 +2409,6 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
break;
case PHPRTLC_CYCLES:
if (WindowsVersion >= WINDOWS_7)
{
ULONG64 value = 0;
PhpAggregateFieldIfNeeded(node, AggregateTypeInt64, AggregateLocationProcessItem, FIELD_OFFSET(PH_PROCESS_ITEM, CycleTimeDelta.Value), &value);
@@ -2432,13 +2419,8 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
getCellText->Text = node->CyclesText->sr;
}
}
else
{
getCellText->Text = PhGetStringRef(node->CyclesText);
}
break;
case PHPRTLC_CYCLESDELTA:
if (WindowsVersion >= WINDOWS_7)
{
ULONG64 value = 0;
PhpAggregateFieldIfNeeded(node, AggregateTypeInt64, AggregateLocationProcessItem, FIELD_OFFSET(PH_PROCESS_ITEM, CycleTimeDelta.Delta), &value);
@@ -2449,10 +2431,6 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
getCellText->Text = node->CyclesDeltaText->sr;
}
}
else
{
getCellText->Text = PhGetStringRef(node->CyclesDeltaText);
}
break;
case PHPRTLC_DEP:
PhpUpdateProcessNodeDepStatus(node);
@@ -2559,34 +2537,26 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
break;
case PHPRTLC_OSCONTEXT:
PhpUpdateProcessOsContext(node);
if (WindowsVersion >= WINDOWS_7)
switch (node->OsContextVersion)
{
switch (node->OsContextVersion)
{
case WINDOWS_10:
PhInitializeStringRef(&getCellText->Text, L"Windows 10");
break;
case WINDOWS_8_1:
PhInitializeStringRef(&getCellText->Text, L"Windows 8.1");
break;
case WINDOWS_8:
PhInitializeStringRef(&getCellText->Text, L"Windows 8");
break;
case WINDOWS_7:
PhInitializeStringRef(&getCellText->Text, L"Windows 7");
break;
case WINDOWS_VISTA:
PhInitializeStringRef(&getCellText->Text, L"Windows Vista");
break;
case WINDOWS_XP:
PhInitializeStringRef(&getCellText->Text, L"Windows XP");
break;
}
}
else
{
PhInitializeStringRef(&getCellText->Text, L"N/A");
case WINDOWS_10:
PhInitializeStringRef(&getCellText->Text, L"Windows 10");
break;
case WINDOWS_8_1:
PhInitializeStringRef(&getCellText->Text, L"Windows 8.1");
break;
case WINDOWS_8:
PhInitializeStringRef(&getCellText->Text, L"Windows 8");
break;
case WINDOWS_7:
PhInitializeStringRef(&getCellText->Text, L"Windows 7");
break;
case WINDOWS_VISTA:
PhInitializeStringRef(&getCellText->Text, L"Windows Vista");
break;
case WINDOWS_XP:
PhInitializeStringRef(&getCellText->Text, L"Windows XP");
break;
}
break;
case PHPRTLC_PAGEDPOOL:
+14 -25
View File
@@ -103,21 +103,17 @@ VOID PhpUpdateProcessStatistics(
if (ProcessItem->QueryHandle)
{
ULONG64 cycleTime;
PROCESS_HANDLE_INFORMATION handleInfo;
if (WindowsVersion >= WINDOWS_7)
if (NT_SUCCESS(NtQueryInformationProcess(
ProcessItem->QueryHandle,
ProcessHandleCount,
&handleInfo,
sizeof(PROCESS_HANDLE_INFORMATION),
NULL
)))
{
PROCESS_HANDLE_INFORMATION handleInfo;
if (NT_SUCCESS(NtQueryInformationProcess(
ProcessItem->QueryHandle,
ProcessHandleCount,
&handleInfo,
sizeof(PROCESS_HANDLE_INFORMATION),
NULL
)))
{
peakHandles = PhaFormatUInt64(handleInfo.HandleCountHighWatermark, TRUE);
}
peakHandles = PhaFormatUInt64(handleInfo.HandleCountHighWatermark, TRUE);
}
gdiHandles = PhaFormatUInt64(GetGuiResources(ProcessItem->QueryHandle, GR_GDIOBJECTS), TRUE); // GDI handles
@@ -146,19 +142,12 @@ VOID PhpUpdateProcessStatistics(
}
}
if (WindowsVersion >= WINDOWS_7)
{
if (!gotCycles)
cycles = PhaFormatUInt64(ProcessItem->CycleTimeDelta.Value, TRUE);
if (!gotWsCounters)
privateWs = PhaFormatSize(ProcessItem->WorkingSetPrivateSize, -1);
}
if (WindowsVersion >= WINDOWS_7)
SetDlgItemText(hwndDlg, IDC_ZPEAKHANDLES_V, PhGetStringOrDefault(peakHandles, L"Unknown"));
else
SetDlgItemText(hwndDlg, IDC_ZPEAKHANDLES_V, L"N/A");
if (!gotCycles)
cycles = PhaFormatUInt64(ProcessItem->CycleTimeDelta.Value, TRUE);
if (!gotWsCounters)
privateWs = PhaFormatSize(ProcessItem->WorkingSetPrivateSize, -1);
SetDlgItemText(hwndDlg, IDC_ZPEAKHANDLES_V, PhGetStringOrDefault(peakHandles, L"Unknown"));
SetDlgItemText(hwndDlg, IDC_ZGDIHANDLES_V, PhGetStringOrDefault(gdiHandles, L"Unknown"));
SetDlgItemText(hwndDlg, IDC_ZUSERHANDLES_V, PhGetStringOrDefault(userHandles, L"Unknown"));
SetDlgItemText(hwndDlg, IDC_ZCYCLES_V, PhGetStringOrDefault(cycles, L"Unknown"));
-1
View File
@@ -645,7 +645,6 @@
#define ID_COMPUTER_HIBERNATE 40163
#define ID_COMPUTER_RESTART 40164
#define ID_COMPUTER_SHUTDOWN 40165
#define ID_NETWORK_VIEWSTACK 40167
#define ID_TRAYICONS_IOHISTORY 40168
#define ID_ICON_EXIT 40169
#define ID_ICON_SHOWHIDEPROCESSHACKER 40171
+1 -13
View File
@@ -538,19 +538,7 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
if (IsServiceAccount(userName))
{
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
// Hack for Windows XP
if (
PhEqualString2(userName, L"NT AUTHORITY\\SYSTEM", TRUE) &&
WindowsVersion <= WINDOWS_XP
)
{
PhSelectComboBoxString(GetDlgItem(hwndDlg, IDC_TYPE), L"New credentials", FALSE);
}
else
{
PhSelectComboBoxString(GetDlgItem(hwndDlg, IDC_TYPE), L"Service", FALSE);
}
PhSelectComboBoxString(GetDlgItem(hwndDlg, IDC_TYPE), L"Service", FALSE);
}
else
{
+7 -11
View File
@@ -177,8 +177,7 @@ VOID PhSipInitializeCpuDialog(
CurrentPerformanceDistribution = NULL;
PreviousPerformanceDistribution = NULL;
if (WindowsVersion >= WINDOWS_7)
PhSipQueryProcessorPerformanceDistribution(&CurrentPerformanceDistribution);
PhSipQueryProcessorPerformanceDistribution(&CurrentPerformanceDistribution);
}
VOID PhSipUninitializeCpuDialog(
@@ -241,15 +240,12 @@ VOID PhSipTickCpuDialog(
memset(PowerInformation, 0, sizeof(PROCESSOR_POWER_INFORMATION) * NumberOfProcessors);
}
if (WindowsVersion >= WINDOWS_7)
{
if (PreviousPerformanceDistribution)
PhFree(PreviousPerformanceDistribution);
if (PreviousPerformanceDistribution)
PhFree(PreviousPerformanceDistribution);
PreviousPerformanceDistribution = CurrentPerformanceDistribution;
CurrentPerformanceDistribution = NULL;
PhSipQueryProcessorPerformanceDistribution(&CurrentPerformanceDistribution);
}
PreviousPerformanceDistribution = CurrentPerformanceDistribution;
CurrentPerformanceDistribution = NULL;
PhSipQueryProcessorPerformanceDistribution(&CurrentPerformanceDistribution);
CpuTicked++;
@@ -693,7 +689,7 @@ VOID PhSipUpdateCpuPanel(
cpuGhz = 0;
distributionSucceeded = FALSE;
if (WindowsVersion >= WINDOWS_7 && CurrentPerformanceDistribution && PreviousPerformanceDistribution)
if (CurrentPerformanceDistribution && PreviousPerformanceDistribution)
{
if (PhSipGetCpuFrequencyFromDistribution(&cpuFraction))
{
+1 -16
View File
@@ -176,25 +176,10 @@ static VOID PhInitializeWindowsVersion(
majorVersion = versionInfo.dwMajorVersion;
minorVersion = versionInfo.dwMinorVersion;
if (majorVersion == 5 && minorVersion < 1 || majorVersion < 5)
if (majorVersion == 6 && minorVersion < 1 || majorVersion < 6)
{
WindowsVersion = WINDOWS_ANCIENT;
}
/* Windows XP */
else if (majorVersion == 5 && minorVersion == 1)
{
WindowsVersion = WINDOWS_XP;
}
/* Windows Server 2003 */
else if (majorVersion == 5 && minorVersion == 2)
{
WindowsVersion = WINDOWS_SERVER_2003;
}
/* Windows Vista, Windows Server 2008 */
else if (majorVersion == 6 && minorVersion == 0)
{
WindowsVersion = WINDOWS_VISTA;
}
/* Windows 7, Windows Server 2008 R2 */
else if (majorVersion == 6 && minorVersion == 1)
{
+7 -31
View File
@@ -1294,31 +1294,12 @@ NTSTATUS PhGetHandleInformationEx(
// If we're dealing with a file handle we must take special precautions so we don't hang.
if (PhEqualString2(typeName, L"File", TRUE) && !KphIsConnected())
{
#define QUERY_NORMALLY 0
#define QUERY_WITH_TIMEOUT 1
#define QUERY_FAIL 2
ULONG hackLevel = QUERY_WITH_TIMEOUT;
// We can't use the timeout method on XP because hanging threads can't even be terminated!
if (WindowsVersion <= WINDOWS_XP)
hackLevel = QUERY_FAIL;
if (hackLevel == QUERY_NORMALLY || hackLevel == QUERY_WITH_TIMEOUT)
{
status = PhpGetObjectName(
ProcessHandle,
KphIsConnected() ? Handle : dupHandle,
hackLevel == QUERY_WITH_TIMEOUT,
&objectName
);
}
else
{
// Pretend the file object has no name.
objectName = PhReferenceEmptyString();
status = STATUS_SUCCESS;
}
status = PhpGetObjectName(
ProcessHandle,
KphIsConnected() ? Handle : dupHandle,
TRUE,
&objectName
);
}
else
{
@@ -1453,14 +1434,9 @@ ULONG PhGetObjectTypeNumber(
objectIndex = objectType->TypeIndex;
break;
}
else if (WindowsVersion >= WINDOWS_7)
{
objectIndex = i + 2;
break;
}
else
{
objectIndex = i + 1;
objectIndex = i + 2;
break;
}
}
-3
View File
@@ -24,7 +24,6 @@ PHLIBAPI extern ACCESS_MASK ThreadAllAccess;
#define WINDOWS_ANCIENT 0
#define WINDOWS_XP 51
#define WINDOWS_SERVER_2003 52
#define WINDOWS_VISTA 60
#define WINDOWS_7 61
#define WINDOWS_8 62
@@ -32,8 +31,6 @@ PHLIBAPI extern ACCESS_MASK ThreadAllAccess;
#define WINDOWS_10 100
#define WINDOWS_NEW MAXLONG
#define WINDOWS_HAS_CONSOLE_HOST (WindowsVersion >= WINDOWS_7)
#define WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID (WindowsVersion >= WINDOWS_VISTA)
#define WINDOWS_HAS_IMMERSIVE (WindowsVersion >= WINDOWS_8)
// Debugging
+15 -26
View File
@@ -736,25 +736,21 @@ NTSTATUS PhGetProcessWindowTitle(
BOOLEAN isWow64 = FALSE;
#endif
ULONG windowFlags;
PPROCESS_WINDOW_INFORMATION windowInfo;
if (WindowsVersion >= WINDOWS_7)
status = PhpQueryProcessVariableSize(
ProcessHandle,
ProcessWindowInformation,
&windowInfo
);
if (NT_SUCCESS(status))
{
PPROCESS_WINDOW_INFORMATION windowInfo;
*WindowFlags = windowInfo->WindowFlags;
*WindowTitle = PhCreateStringEx(windowInfo->WindowTitle, windowInfo->WindowTitleLength);
PhFree(windowInfo);
status = PhpQueryProcessVariableSize(
ProcessHandle,
ProcessWindowInformation,
&windowInfo
);
if (NT_SUCCESS(status))
{
*WindowFlags = windowInfo->WindowFlags;
*WindowTitle = PhCreateStringEx(windowInfo->WindowTitle, windowInfo->WindowTitleLength);
PhFree(windowInfo);
return status;
}
return status;
}
#ifdef _WIN64
@@ -2918,10 +2914,8 @@ NTSTATUS PhpEnumProcessModules(
if (WindowsVersion >= WINDOWS_8)
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN8;
else if (WindowsVersion >= WINDOWS_7)
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN7;
else
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WINXP;
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN7;
// Traverse the linked list (in load order).
@@ -3281,10 +3275,8 @@ NTSTATUS PhpEnumProcessModules32(
if (WindowsVersion >= WINDOWS_8)
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN8_32;
else if (WindowsVersion >= WINDOWS_7)
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN7_32;
else
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WINXP_32;
dataTableEntrySize = LDR_DATA_TABLE_ENTRY_SIZE_WIN7_32;
// Traverse the linked list (in load order).
@@ -4804,10 +4796,7 @@ VOID PhUpdateMupDevicePrefixes(
PhDeviceMupPrefixes[PhDeviceMupPrefixesCount++] = PhCreateString(L"\\Device\\Mup");
// DFS claims an extra part of file names, which we don't handle.
/*if (WindowsVersion >= WINDOWS_VISTA)
PhDeviceMupPrefixes[PhDeviceMupPrefixesCount++] = PhCreateString(L"\\Device\\DfsClient");
else
PhDeviceMupPrefixes[PhDeviceMupPrefixesCount++] = PhCreateString(L"\\Device\\WinDfs");*/
// PhDeviceMupPrefixes[PhDeviceMupPrefixesCount++] = PhCreateString(L"\\Device\\DfsClient");
remainingPart = providerOrder->sr;