Remove legacy XP code
This commit is contained in:
@@ -1827,60 +1827,6 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
END
|
||||
|
||||
IDD_SYSINFO_MEMPANELXP DIALOGEX 0, 0, 230, 171
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Commit charge",-1,0,0,108,44
|
||||
LTEXT "Current",-1,7,11,26,8
|
||||
LTEXT "Peak",-1,7,21,16,8
|
||||
LTEXT "Limit",-1,7,31,15,8
|
||||
RTEXT "Static",IDC_ZCOMMITCURRENT_V,45,11,56,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZCOMMITPEAK_V,41,21,60,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZCOMMITLIMIT_V,40,31,61,8,SS_ENDELLIPSIS
|
||||
GROUPBOX "Physical memory",-1,112,0,118,64
|
||||
LTEXT "Current",-1,120,11,26,8
|
||||
LTEXT "Cache WS",-1,120,31,34,8
|
||||
RTEXT "Static",IDC_ZPHYSICALCURRENT_V,165,11,57,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPHYSICALTOTAL_V,167,21,55,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPHYSICALCACHEWS_V,159,31,63,8,SS_ENDELLIPSIS
|
||||
LTEXT "Total",-1,120,21,17,8
|
||||
LTEXT "Kernel WS",-1,120,41,34,8
|
||||
RTEXT "Static",IDC_ZPHYSICALKERNELWS_V,167,41,55,8,SS_ENDELLIPSIS
|
||||
LTEXT "Driver WS",-1,120,51,33,8
|
||||
RTEXT "Static",IDC_ZPHYSICALDRIVERWS_V,163,51,59,8,SS_ENDELLIPSIS
|
||||
GROUPBOX "Paged pool",-1,0,47,108,64
|
||||
LTEXT "Working set",-1,7,58,40,8
|
||||
LTEXT "Limit",-1,7,78,15,8
|
||||
RTEXT "Static",IDC_ZPAGEDWORKINGSET_V,54,58,47,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPAGEDVIRTUALSIZE_V,52,68,49,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPAGEDLIMIT_V,48,78,53,8,SS_ENDELLIPSIS
|
||||
LTEXT "Virtual size",-1,7,68,36,8
|
||||
LTEXT "Allocs delta",-1,7,88,38,8
|
||||
RTEXT "Static",IDC_ZPAGEDALLOCSDELTA_V,53,88,48,8,SS_ENDELLIPSIS
|
||||
LTEXT "Frees delta",-1,7,98,38,8
|
||||
RTEXT "Static",IDC_ZPAGEDFREESDELTA_V,51,98,50,8,SS_ENDELLIPSIS
|
||||
GROUPBOX "Non-paged pool",-1,0,114,108,55
|
||||
LTEXT "Usage",-1,7,125,21,8
|
||||
LTEXT "Allocs delta",-1,7,145,38,8
|
||||
RTEXT "Static",IDC_ZNONPAGEDUSAGE_V,54,125,47,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZNONPAGEDLIMIT_V,52,135,49,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZNONPAGEDALLOCSDELTA_V,56,145,45,8,SS_ENDELLIPSIS
|
||||
LTEXT "Limit",-1,7,135,15,8
|
||||
LTEXT "Frees delta",-1,7,155,38,8
|
||||
RTEXT "Static",IDC_ZNONPAGEDFREESDELTA_V,56,155,45,8,SS_ENDELLIPSIS
|
||||
GROUPBOX "Paging",-1,112,67,118,55
|
||||
LTEXT "Page faults delta",-1,120,78,57,8
|
||||
LTEXT "Pagefile writes delta",-1,120,98,68,8
|
||||
RTEXT "Static",IDC_ZPAGINGPAGEFAULTSDELTA_V,183,78,39,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPAGINGPAGEREADSDELTA_V,179,88,43,8,SS_ENDELLIPSIS
|
||||
RTEXT "Static",IDC_ZPAGINGPAGEFILEWRITESDELTA_V,189,98,33,8,SS_ENDELLIPSIS
|
||||
LTEXT "Page reads delta",-1,120,88,58,8
|
||||
LTEXT "Mapped writes delta",-1,120,108,68,8
|
||||
RTEXT "Static",IDC_ZPAGINGMAPPEDWRITESDELTA_V,191,108,31,8,SS_ENDELLIPSIS
|
||||
END
|
||||
|
||||
IDD_MINIINFO DIALOGEX 0, 0, 217, 150
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
@@ -2428,10 +2374,6 @@ BEGIN
|
||||
BOTTOMMARGIN, 175
|
||||
END
|
||||
|
||||
IDD_SYSINFO_MEMPANELXP, DIALOG
|
||||
BEGIN
|
||||
END
|
||||
|
||||
IDD_MINIINFO, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 4
|
||||
|
||||
@@ -164,7 +164,7 @@ BOOLEAN PhpShowErrorAndElevateAction(
|
||||
))
|
||||
return FALSE;
|
||||
|
||||
if (!WINDOWS_HAS_UAC || PhGetOwnTokenAttributes().Elevated)
|
||||
if (PhGetOwnTokenAttributes().Elevated)
|
||||
return FALSE;
|
||||
|
||||
elevationLevel = PhGetIntegerSetting(L"ElevationLevel");
|
||||
@@ -257,7 +257,7 @@ BOOLEAN PhpShowErrorAndConnectToPhSvc(
|
||||
))
|
||||
return FALSE;
|
||||
|
||||
if (!WINDOWS_HAS_UAC || PhGetOwnTokenAttributes().Elevated)
|
||||
if (PhGetOwnTokenAttributes().Elevated)
|
||||
return FALSE;
|
||||
|
||||
elevationLevel = PhGetIntegerSetting(L"ElevationLevel");
|
||||
|
||||
@@ -439,7 +439,7 @@ static BOOLEAN NTAPI PhpWalkThreadStackAnalyzeCallback(
|
||||
|
||||
PhAppendStringBuilder2(
|
||||
&context->StringBuilder,
|
||||
WindowsVersion >= WINDOWS_VISTA ? L"Thread is waiting for an ALPC port:\r\n" : L"Thread is waiting for a LPC port:\r\n"
|
||||
L"Thread is waiting for an ALPC port:\r\n"
|
||||
);
|
||||
PhAppendStringBuilder(
|
||||
&context->StringBuilder,
|
||||
|
||||
@@ -901,7 +901,7 @@ static NTSTATUS PhpFindObjectsThreadStart(
|
||||
PH_WORK_QUEUE workQueue;
|
||||
processHandleHashtable = PhCreateSimpleHashtable(8);
|
||||
|
||||
if (!KphIsConnected() && WindowsVersion >= WINDOWS_VISTA)
|
||||
if (!KphIsConnected())
|
||||
{
|
||||
useWorkQueue = TRUE;
|
||||
PhInitializeWorkQueue(&workQueue, 1, 20, 1000);
|
||||
|
||||
@@ -808,7 +808,7 @@ NTSTATUS PhpEnumHiddenProcessesBruteForce(
|
||||
}
|
||||
|
||||
// Use an alternative method if we don't have sufficient access.
|
||||
if (status2 == STATUS_ACCESS_DENIED && WindowsVersion >= WINDOWS_VISTA)
|
||||
if (status2 == STATUS_ACCESS_DENIED)
|
||||
{
|
||||
if (NT_SUCCESS(status2 = PhGetProcessImageFileNameByProcessId(UlongToHandle(pid), &fileName)))
|
||||
{
|
||||
|
||||
@@ -487,7 +487,7 @@ VOID PhHandleProviderUpdate(
|
||||
)))
|
||||
goto UpdateExit;
|
||||
|
||||
if (!KphIsConnected() && WindowsVersion >= WINDOWS_VISTA)
|
||||
if (!KphIsConnected())
|
||||
{
|
||||
useWorkQueue = TRUE;
|
||||
PhInitializeWorkQueue(&workQueue, 1, 20, 1000);
|
||||
|
||||
+7
-11
@@ -142,7 +142,7 @@ BOOLEAN PhMainWndInitialization(
|
||||
if (KphIsConnected()) PhAppendCharStringBuilder(&stringBuilder, '+');
|
||||
}
|
||||
|
||||
if (WINDOWS_HAS_UAC && PhGetOwnTokenAttributes().ElevationType == TokenElevationTypeFull)
|
||||
if (PhGetOwnTokenAttributes().ElevationType == TokenElevationTypeFull)
|
||||
PhAppendStringBuilder2(&stringBuilder, L" (Administrator)");
|
||||
}
|
||||
|
||||
@@ -175,8 +175,7 @@ BOOLEAN PhMainWndInitialization(
|
||||
windowRectangle.Width, windowRectangle.Height, FALSE);
|
||||
|
||||
// Allow WM_PH_ACTIVATE to pass through UIPI.
|
||||
if (WINDOWS_HAS_UAC)
|
||||
ChangeWindowMessageFilter_I(WM_PH_ACTIVATE, MSGFLT_ADD);
|
||||
ChangeWindowMessageFilter_I(WM_PH_ACTIVATE, MSGFLT_ADD);
|
||||
|
||||
PhMwpOnSettingChange();
|
||||
|
||||
@@ -3103,15 +3102,12 @@ VOID PhAddMiniProcessMenuItems(
|
||||
|
||||
// I/O priority
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
ioPriorityMenu = PhCreateEMenuItem(0, 0, L"I/O priority", NULL, ProcessId);
|
||||
ioPriorityMenu = PhCreateEMenuItem(0, 0, L"I/O priority", NULL, ProcessId);
|
||||
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_HIGH, L"High", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_NORMAL, L"Normal", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_LOW, L"Low", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_VERYLOW, L"Very low", NULL, ProcessId), -1);
|
||||
}
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_HIGH, L"High", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_NORMAL, L"Normal", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_LOW, L"Low", NULL, ProcessId), -1);
|
||||
PhInsertEMenuItem(ioPriorityMenu, PhCreateEMenuItem(0, ID_IOPRIORITY_VERYLOW, L"Very low", NULL, ProcessId), -1);
|
||||
|
||||
// Menu
|
||||
|
||||
|
||||
+6
-34
@@ -347,20 +347,6 @@ NTSTATUS PhpUpdateMemoryRegionTypes(
|
||||
{
|
||||
PSYSTEM_EXTENDED_THREAD_INFORMATION thread = (PSYSTEM_EXTENDED_THREAD_INFORMATION)process->Threads + i;
|
||||
|
||||
if (WindowsVersion < WINDOWS_VISTA)
|
||||
{
|
||||
HANDLE threadHandle;
|
||||
THREAD_BASIC_INFORMATION basicInfo;
|
||||
|
||||
if (NT_SUCCESS(PhOpenThread(&threadHandle, ThreadQueryAccess, thread->ThreadInfo.ClientId.UniqueThread)))
|
||||
{
|
||||
if (NT_SUCCESS(PhGetThreadBasicInformation(threadHandle, &basicInfo)))
|
||||
thread->TebBase = basicInfo.TebBaseAddress;
|
||||
|
||||
NtClose(threadHandle);
|
||||
}
|
||||
}
|
||||
|
||||
if (thread->TebBase)
|
||||
{
|
||||
NT_TIB ntTib;
|
||||
@@ -437,27 +423,13 @@ NTSTATUS PhpUpdateMemoryRegionTypes(
|
||||
PVOID candidateHeap = NULL;
|
||||
ULONG candidateHeap32 = 0;
|
||||
PPH_MEMORY_ITEM heapMemoryItem;
|
||||
PHEAP_SEGMENT heapSegment = (PHEAP_SEGMENT)buffer;
|
||||
PHEAP_SEGMENT32 heapSegment32 = (PHEAP_SEGMENT32)buffer;
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
PHEAP_SEGMENT heapSegment = (PHEAP_SEGMENT)buffer;
|
||||
PHEAP_SEGMENT32 heapSegment32 = (PHEAP_SEGMENT32)buffer;
|
||||
|
||||
if (heapSegment->SegmentSignature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap = heapSegment->Heap;
|
||||
if (heapSegment32->SegmentSignature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap32 = heapSegment32->Heap;
|
||||
}
|
||||
else
|
||||
{
|
||||
PHEAP_SEGMENT_OLD heapSegment = (PHEAP_SEGMENT_OLD)buffer;
|
||||
PHEAP_SEGMENT_OLD32 heapSegment32 = (PHEAP_SEGMENT_OLD32)buffer;
|
||||
|
||||
if (heapSegment->Signature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap = heapSegment->Heap;
|
||||
if (heapSegment32->Signature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap32 = heapSegment32->Heap;
|
||||
}
|
||||
if (heapSegment->SegmentSignature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap = heapSegment->Heap;
|
||||
if (heapSegment32->SegmentSignature == HEAP_SEGMENT_SIGNATURE)
|
||||
candidateHeap32 = heapSegment32->Heap;
|
||||
|
||||
if (candidateHeap)
|
||||
{
|
||||
|
||||
@@ -747,15 +747,8 @@ BOOLEAN NTAPI PhpModuleTreeNewCallback(
|
||||
getCellText->Text = PhGetStringRef(moduleItem->VerifySignerName);
|
||||
break;
|
||||
case PHMOTLC_ASLR:
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
if (moduleItem->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
||||
PhInitializeStringRef(&getCellText->Text, L"ASLR");
|
||||
}
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&getCellText->Text, L"N/A");
|
||||
}
|
||||
if (moduleItem->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
||||
PhInitializeStringRef(&getCellText->Text, L"ASLR");
|
||||
break;
|
||||
case PHMOTLC_TIMESTAMP:
|
||||
{
|
||||
|
||||
@@ -111,15 +111,12 @@ PPH_MODULE_PROVIDER PhCreateModuleProvider(
|
||||
ProcessId
|
||||
)))
|
||||
{
|
||||
if (WINDOWS_HAS_LIMITED_ACCESS)
|
||||
{
|
||||
// Try to get a handle with query limited information + vm read access.
|
||||
status = PhOpenProcess(
|
||||
&moduleProvider->ProcessHandle,
|
||||
PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ,
|
||||
ProcessId
|
||||
);
|
||||
}
|
||||
// Try to get a handle with query limited information + vm read access.
|
||||
status = PhOpenProcess(
|
||||
&moduleProvider->ProcessHandle,
|
||||
PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ,
|
||||
ProcessId
|
||||
);
|
||||
|
||||
moduleProvider->RunStatus = status;
|
||||
}
|
||||
|
||||
@@ -363,10 +363,16 @@ VOID PhMwpSetProcessMenuPriorityChecks(
|
||||
{
|
||||
if (SetPriority)
|
||||
{
|
||||
NtQueryInformationProcess(processHandle, ProcessPriorityClass, &priorityClass, sizeof(PROCESS_PRIORITY_CLASS), NULL);
|
||||
NtQueryInformationProcess(
|
||||
processHandle,
|
||||
ProcessPriorityClass,
|
||||
&priorityClass,
|
||||
sizeof(PROCESS_PRIORITY_CLASS),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (SetIoPriority && WindowsVersion >= WINDOWS_VISTA)
|
||||
if (SetIoPriority)
|
||||
{
|
||||
if (!NT_SUCCESS(PhGetProcessIoPriority(
|
||||
processHandle,
|
||||
@@ -377,7 +383,7 @@ VOID PhMwpSetProcessMenuPriorityChecks(
|
||||
}
|
||||
}
|
||||
|
||||
if (SetPagePriority && WindowsVersion >= WINDOWS_VISTA)
|
||||
if (SetPagePriority)
|
||||
{
|
||||
if (!NT_SUCCESS(PhGetProcessPagePriority(
|
||||
processHandle,
|
||||
@@ -545,17 +551,6 @@ VOID PhMwpInitializeProcessMenu(
|
||||
}
|
||||
}
|
||||
|
||||
// Remove irrelevant menu items.
|
||||
if (WindowsVersion < WINDOWS_VISTA)
|
||||
{
|
||||
// Remove I/O priority.
|
||||
if (item = PhFindEMenuItem(Menu, PH_EMENU_FIND_DESCEND, L"I/O Priority", 0))
|
||||
PhDestroyEMenuItem(item);
|
||||
// Remove page priority.
|
||||
if (item = PhFindEMenuItem(Menu, PH_EMENU_FIND_DESCEND, L"Page Priority", 0))
|
||||
PhDestroyEMenuItem(item);
|
||||
}
|
||||
|
||||
// Suspend/Resume
|
||||
if (NumberOfProcesses == 1)
|
||||
{
|
||||
@@ -643,13 +638,6 @@ VOID PhMwpInitializeProcessMenu(
|
||||
item->Flags |= PH_EMENU_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove irrelevant menu items (continued)
|
||||
if (!WINDOWS_HAS_UAC)
|
||||
{
|
||||
if (item = PhFindEMenuItem(Menu, 0, NULL, ID_PROCESS_VIRTUALIZATION))
|
||||
PhDestroyEMenuItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
VOID PhShowProcessContextMenu(
|
||||
|
||||
@@ -132,7 +132,7 @@ VOID PhInitializeNetworkTreeList(
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_REMOTEPORT, TRUE, L"Remote port", 50, PH_ALIGN_RIGHT, 4, DT_RIGHT);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_PROTOCOL, TRUE, L"Protocol", 45, PH_ALIGN_LEFT, 5, 0);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_STATE, TRUE, L"State", 70, PH_ALIGN_LEFT, 6, 0);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_OWNER, WINDOWS_HAS_SERVICE_TAGS, L"Owner", 80, PH_ALIGN_LEFT, 7, 0);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_OWNER, TRUE, L"Owner", 80, PH_ALIGN_LEFT, 7, 0);
|
||||
PhAddTreeNewColumnEx(hwnd, PHNETLC_TIMESTAMP, FALSE, L"Time stamp", 100, PH_ALIGN_LEFT, -1, 0, TRUE);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_LOCALHOSTNAME, FALSE, L"Local hostname", 120, PH_ALIGN_LEFT, -1, 0);
|
||||
PhAddTreeNewColumn(hwnd, PHNETLC_REMOTEHOSTNAME, FALSE, L"Remote hostname", 120, PH_ALIGN_LEFT, -1, 0);
|
||||
@@ -538,10 +538,7 @@ BOOLEAN NTAPI PhpNetworkTreeNewCallback(
|
||||
PhInitializeEmptyStringRef(&getCellText->Text);
|
||||
break;
|
||||
case PHNETLC_OWNER:
|
||||
if (WINDOWS_HAS_SERVICE_TAGS)
|
||||
getCellText->Text = PhGetStringRef(networkItem->OwnerName);
|
||||
else
|
||||
PhInitializeStringRef(&getCellText->Text, L"N/A"); // make sure the user knows this column doesn't work on XP
|
||||
getCellText->Text = PhGetStringRef(networkItem->OwnerName);
|
||||
break;
|
||||
case PHNETLC_TIMESTAMP:
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ VOID PhNfLoadStage2(
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
PhNfMiniInfoEnabled = WindowsVersion >= WINDOWS_VISTA && !!PhGetIntegerSetting(L"MiniInfoWindowEnabled");
|
||||
PhNfMiniInfoEnabled = !!PhGetIntegerSetting(L"MiniInfoWindowEnabled");
|
||||
|
||||
for (i = PH_ICON_MINIMUM; i != PhNfMaximumIconId; i <<= 1)
|
||||
{
|
||||
@@ -558,11 +558,8 @@ BOOLEAN PhNfpAddNotifyIcon(
|
||||
|
||||
Shell_NotifyIcon(NIM_ADD, ¬ifyIcon);
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
notifyIcon.uVersion = NOTIFYICON_VERSION_4;
|
||||
Shell_NotifyIcon(NIM_SETVERSION, ¬ifyIcon);
|
||||
}
|
||||
notifyIcon.uVersion = NOTIFYICON_VERSION_4;
|
||||
Shell_NotifyIcon(NIM_SETVERSION, ¬ifyIcon);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -388,10 +388,7 @@ static VOID PhpRefreshMutantPageInfo(
|
||||
SetDlgItemText(hwndDlg, IDC_ABANDONED, L"Unknown");
|
||||
}
|
||||
|
||||
if (
|
||||
WindowsVersion >= WINDOWS_VISTA &&
|
||||
NT_SUCCESS(PhGetMutantOwnerInformation(mutantHandle, &ownerInfo))
|
||||
)
|
||||
if (NT_SUCCESS(PhGetMutantOwnerInformation(mutantHandle, &ownerInfo)))
|
||||
{
|
||||
PPH_STRING name;
|
||||
|
||||
@@ -433,12 +430,6 @@ INT_PTR CALLBACK PhpMutantPageProc(
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
if (WindowsVersion < WINDOWS_VISTA)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_OWNERLABEL), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_OWNER), FALSE);
|
||||
}
|
||||
|
||||
PhpRefreshMutantPageInfo(hwndDlg, pageContext);
|
||||
}
|
||||
break;
|
||||
|
||||
+24
-38
@@ -1072,32 +1072,29 @@ VOID PhpProcessQueryStage1(
|
||||
// Token information
|
||||
if (processHandleLimited)
|
||||
{
|
||||
if (WINDOWS_HAS_UAC)
|
||||
HANDLE tokenHandle;
|
||||
|
||||
status = PhOpenProcessToken(processHandleLimited, TOKEN_QUERY, &tokenHandle);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
HANDLE tokenHandle;
|
||||
|
||||
status = PhOpenProcessToken(processHandleLimited, TOKEN_QUERY, &tokenHandle);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
// Elevation
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(
|
||||
tokenHandle,
|
||||
&Data->ElevationType
|
||||
)))
|
||||
{
|
||||
// Elevation
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(
|
||||
tokenHandle,
|
||||
&Data->ElevationType
|
||||
)))
|
||||
{
|
||||
Data->IsElevated = Data->ElevationType == TokenElevationTypeFull;
|
||||
}
|
||||
|
||||
// Integrity
|
||||
PhGetTokenIntegrityLevel(
|
||||
tokenHandle,
|
||||
&Data->IntegrityLevel,
|
||||
&Data->IntegrityString
|
||||
);
|
||||
|
||||
NtClose(tokenHandle);
|
||||
Data->IsElevated = Data->ElevationType == TokenElevationTypeFull;
|
||||
}
|
||||
|
||||
// Integrity
|
||||
PhGetTokenIntegrityLevel(
|
||||
tokenHandle,
|
||||
&Data->IntegrityLevel,
|
||||
&Data->IntegrityString
|
||||
);
|
||||
|
||||
NtClose(tokenHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1360,24 +1357,13 @@ VOID PhpFillProcessItem(
|
||||
{
|
||||
PPH_STRING fileName;
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
if (processHandle)
|
||||
{
|
||||
if (processHandle)
|
||||
{
|
||||
PhGetProcessImageFileNameWin32(processHandle, &ProcessItem->FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NT_SUCCESS(PhGetProcessImageFileNameByProcessId(ProcessItem->ProcessId, &fileName)))
|
||||
{
|
||||
ProcessItem->FileName = PhGetFileName(fileName);
|
||||
PhDereferenceObject(fileName);
|
||||
}
|
||||
}
|
||||
PhGetProcessImageFileNameWin32(processHandle, &ProcessItem->FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (processHandle && NT_SUCCESS(PhGetProcessImageFileName(processHandle, &fileName)))
|
||||
if (NT_SUCCESS(PhGetProcessImageFileNameByProcessId(ProcessItem->ProcessId, &fileName)))
|
||||
{
|
||||
ProcessItem->FileName = PhGetFileName(fileName);
|
||||
PhDereferenceObject(fileName);
|
||||
@@ -2241,7 +2227,7 @@ VOID PhProcessProviderUpdate(
|
||||
{
|
||||
PhOpenProcess(&processItem->QueryHandle, PROCESS_QUERY_INFORMATION, processItem->ProcessId);
|
||||
|
||||
if (WINDOWS_HAS_LIMITED_ACCESS && !processItem->QueryHandle)
|
||||
if (!processItem->QueryHandle)
|
||||
PhOpenProcess(&processItem->QueryHandle, PROCESS_QUERY_LIMITED_INFORMATION, processItem->ProcessId);
|
||||
}
|
||||
|
||||
|
||||
+16
-31
@@ -949,7 +949,7 @@ static VOID PhpUpdateProcessNodeToken(
|
||||
ProcessNode->VirtualizationAllowed = FALSE;
|
||||
ProcessNode->VirtualizationEnabled = FALSE;
|
||||
|
||||
if (WINDOWS_HAS_UAC && ProcessNode->ProcessItem->QueryHandle)
|
||||
if (ProcessNode->ProcessItem->QueryHandle)
|
||||
{
|
||||
if (NT_SUCCESS(PhOpenProcessToken(
|
||||
ProcessNode->ProcessItem->QueryHandle,
|
||||
@@ -2359,16 +2359,8 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
|
||||
break;
|
||||
case PHPRTLC_ASLR:
|
||||
PhpUpdateProcessNodeImage(node);
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
if (node->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
||||
PhInitializeStringRef(&getCellText->Text, L"ASLR");
|
||||
}
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&getCellText->Text, L"N/A");
|
||||
}
|
||||
if (node->ImageDllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
||||
PhInitializeStringRef(&getCellText->Text, L"ASLR");
|
||||
break;
|
||||
case PHPRTLC_RELATIVESTARTTIME:
|
||||
{
|
||||
@@ -2397,27 +2389,20 @@ BOOLEAN NTAPI PhpProcessTreeNewCallback(
|
||||
{
|
||||
PWSTR type;
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
switch (processItem->ElevationType)
|
||||
{
|
||||
switch (processItem->ElevationType)
|
||||
{
|
||||
case TokenElevationTypeDefault:
|
||||
type = L"N/A";
|
||||
break;
|
||||
case TokenElevationTypeLimited:
|
||||
type = L"Limited";
|
||||
break;
|
||||
case TokenElevationTypeFull:
|
||||
type = L"Full";
|
||||
break;
|
||||
default:
|
||||
type = L"N/A";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = L"";
|
||||
case TokenElevationTypeDefault:
|
||||
type = L"N/A";
|
||||
break;
|
||||
case TokenElevationTypeLimited:
|
||||
type = L"Limited";
|
||||
break;
|
||||
case TokenElevationTypeFull:
|
||||
type = L"Full";
|
||||
break;
|
||||
default:
|
||||
type = L"N/A";
|
||||
break;
|
||||
}
|
||||
|
||||
PhInitializeStringRefLongHint(&getCellText->Text, type);
|
||||
|
||||
@@ -344,7 +344,7 @@ INT_PTR CALLBACK PhpProcessGeneralDlgProc(
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_PROTECTION, L"N/A");
|
||||
|
||||
if (WINDOWS_HAS_LIMITED_ACCESS && processHandle)
|
||||
if (processHandle)
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_8_1)
|
||||
{
|
||||
|
||||
+12
-25
@@ -123,18 +123,14 @@ VOID PhpUpdateProcessStatistics(
|
||||
gdiHandles = PhaFormatUInt64(GetGuiResources(ProcessItem->QueryHandle, GR_GDIOBJECTS), TRUE); // GDI handles
|
||||
userHandles = PhaFormatUInt64(GetGuiResources(ProcessItem->QueryHandle, GR_USEROBJECTS), TRUE); // USER handles
|
||||
|
||||
if (WINDOWS_HAS_CYCLE_TIME &&
|
||||
NT_SUCCESS(PhGetProcessCycleTime(ProcessItem->QueryHandle, &cycleTime)))
|
||||
if (NT_SUCCESS(PhGetProcessCycleTime(ProcessItem->QueryHandle, &cycleTime)))
|
||||
{
|
||||
cycles = PhaFormatUInt64(cycleTime, TRUE);
|
||||
gotCycles = TRUE;
|
||||
}
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
PhGetProcessPagePriority(ProcessItem->QueryHandle, &pagePriority);
|
||||
PhGetProcessIoPriority(ProcessItem->QueryHandle, &ioPriority);
|
||||
}
|
||||
PhGetProcessPagePriority(ProcessItem->QueryHandle, &pagePriority);
|
||||
PhGetProcessIoPriority(ProcessItem->QueryHandle, &ioPriority);
|
||||
}
|
||||
|
||||
if (Context->ProcessHandle)
|
||||
@@ -165,26 +161,17 @@ VOID PhpUpdateProcessStatistics(
|
||||
|
||||
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, WINDOWS_HAS_CYCLE_TIME ? L"Unknown" : L"N/A"));
|
||||
SetDlgItemText(hwndDlg, IDC_ZCYCLES_V, PhGetStringOrDefault(cycles, L"Unknown"));
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
if (pagePriority != -1 && pagePriority <= MEMORY_PRIORITY_NORMAL)
|
||||
SetDlgItemText(hwndDlg, IDC_ZPAGEPRIORITY_V, PhPagePriorityNames[pagePriority]);
|
||||
else
|
||||
SetDlgItemText(hwndDlg, IDC_ZPAGEPRIORITY_V, L"Unknown");
|
||||
|
||||
if (ioPriority != -1 && ioPriority < MaxIoPriorityTypes)
|
||||
SetDlgItemText(hwndDlg, IDC_ZIOPRIORITY_V, PhIoPriorityHintNames[ioPriority]);
|
||||
else
|
||||
SetDlgItemText(hwndDlg, IDC_ZIOPRIORITY_V, L"Unknown");
|
||||
}
|
||||
if (pagePriority != -1 && pagePriority <= MEMORY_PRIORITY_NORMAL)
|
||||
SetDlgItemText(hwndDlg, IDC_ZPAGEPRIORITY_V, PhPagePriorityNames[pagePriority]);
|
||||
else
|
||||
{
|
||||
SetDlgItemText(hwndDlg, IDC_ZPAGEPRIORITY_V, L"N/A");
|
||||
SetDlgItemText(hwndDlg, IDC_ZIOPRIORITY_V, L"N/A");
|
||||
}
|
||||
SetDlgItemText(hwndDlg, IDC_ZPAGEPRIORITY_V, L"Unknown");
|
||||
|
||||
if (ioPriority != -1 && ioPriority < MaxIoPriorityTypes)
|
||||
SetDlgItemText(hwndDlg, IDC_ZIOPRIORITY_V, PhIoPriorityHintNames[ioPriority]);
|
||||
else
|
||||
SetDlgItemText(hwndDlg, IDC_ZIOPRIORITY_V, L"Unknown");
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_ZPRIVATEWS_V, PhGetStringOrDefault(privateWs, L"Unknown"));
|
||||
SetDlgItemText(hwndDlg, IDC_ZSHAREABLEWS_V, PhGetStringOrDefault(shareableWs, L"Unknown"));
|
||||
|
||||
+13
-37
@@ -102,8 +102,6 @@ VOID PhpInitializeThreadMenu(
|
||||
_In_ ULONG NumberOfThreads
|
||||
)
|
||||
{
|
||||
PPH_EMENU_ITEM item;
|
||||
|
||||
if (NumberOfThreads == 0)
|
||||
{
|
||||
PhSetFlagsAllEMenuItems(Menu, PH_EMENU_DISABLED, PH_EMENU_DISABLED);
|
||||
@@ -133,18 +131,6 @@ VOID PhpInitializeThreadMenu(
|
||||
}
|
||||
}
|
||||
|
||||
// Remove irrelevant menu items.
|
||||
|
||||
if (WindowsVersion < WINDOWS_VISTA)
|
||||
{
|
||||
// Remove I/O priority.
|
||||
if (item = PhFindEMenuItem(Menu, 0, L"I/O Priority", 0))
|
||||
PhDestroyEMenuItem(item);
|
||||
// Remove page priority.
|
||||
if (item = PhFindEMenuItem(Menu, 0, L"Page Priority", 0))
|
||||
PhDestroyEMenuItem(item);
|
||||
}
|
||||
|
||||
PhEnableEMenuItem(Menu, ID_THREAD_TOKEN, FALSE);
|
||||
|
||||
// Priority
|
||||
@@ -163,32 +149,25 @@ VOID PhpInitializeThreadMenu(
|
||||
)))
|
||||
{
|
||||
THREAD_BASIC_INFORMATION basicInfo;
|
||||
HANDLE tokenHandle;
|
||||
|
||||
if (NT_SUCCESS(PhGetThreadBasicInformation(threadHandle, &basicInfo)))
|
||||
{
|
||||
threadPriority = basicInfo.BasePriority;
|
||||
}
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
PhGetThreadIoPriority(threadHandle, &ioPriority);
|
||||
PhGetThreadPagePriority(threadHandle, &pagePriority);
|
||||
}
|
||||
PhGetThreadIoPriority(threadHandle, &ioPriority);
|
||||
PhGetThreadPagePriority(threadHandle, &pagePriority);
|
||||
|
||||
// Token
|
||||
if (NT_SUCCESS(NtOpenThreadToken(
|
||||
threadHandle,
|
||||
TOKEN_QUERY,
|
||||
TRUE,
|
||||
&tokenHandle
|
||||
)))
|
||||
{
|
||||
HANDLE tokenHandle;
|
||||
|
||||
if (NT_SUCCESS(NtOpenThreadToken(
|
||||
threadHandle,
|
||||
TOKEN_QUERY,
|
||||
TRUE,
|
||||
&tokenHandle
|
||||
)))
|
||||
{
|
||||
PhEnableEMenuItem(Menu, ID_THREAD_TOKEN, TRUE);
|
||||
NtClose(tokenHandle);
|
||||
}
|
||||
PhEnableEMenuItem(Menu, ID_THREAD_TOKEN, TRUE);
|
||||
NtClose(tokenHandle);
|
||||
}
|
||||
|
||||
NtClose(threadHandle);
|
||||
@@ -363,9 +342,7 @@ VOID PhpUpdateThreadDetails(
|
||||
PhPrintTimeSpan(userTime, threadItem->UserTime.QuadPart, PH_TIMESPAN_HMSM);
|
||||
|
||||
contextSwitches = PhaFormatUInt64(threadItem->ContextSwitchesDelta.Value, TRUE);
|
||||
|
||||
if (WINDOWS_HAS_CYCLE_TIME)
|
||||
cycles = PhaFormatUInt64(threadItem->CyclesDelta.Value, TRUE);
|
||||
cycles = PhaFormatUInt64(threadItem->CyclesDelta.Value, TRUE);
|
||||
|
||||
if (threadItem->State != Waiting)
|
||||
{
|
||||
@@ -588,7 +565,6 @@ INT_PTR CALLBACK PhpProcessThreadsDlgProc(
|
||||
// Use Cycles instead of Context Switches on Vista and above, but only when we can
|
||||
// open the process, since cycle time information requires sufficient access to the
|
||||
// threads.
|
||||
if (WINDOWS_HAS_CYCLE_TIME)
|
||||
{
|
||||
HANDLE processHandle;
|
||||
|
||||
@@ -619,7 +595,7 @@ INT_PTR CALLBACK PhpProcessThreadsDlgProc(
|
||||
}
|
||||
}
|
||||
|
||||
if (processItem->ServiceList && processItem->ServiceList->Count != 0 && WINDOWS_HAS_SERVICE_TAGS)
|
||||
if (processItem->ServiceList && processItem->ServiceList->Count != 0)
|
||||
threadsContext->ListContext.HasServices = TRUE;
|
||||
|
||||
PhEmCallObjectOperation(EmThreadsContextType, threadsContext, EmObjectCreate);
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
#define IDD_MEMLISTS 202
|
||||
#define IDR_EMPTYMEMLISTS 204
|
||||
#define IDD_CONTAINER 205
|
||||
#define IDD_SYSINFO_MEMPANELXP 206
|
||||
#define IDD_MINIINFO 207
|
||||
#define IDD_MINIINFO_LIST 210
|
||||
#define IDR_MINIINFO 211
|
||||
|
||||
+2
-10
@@ -349,9 +349,6 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
|
||||
|
||||
//if (!PhGetOwnTokenAttributes().Elevated)
|
||||
// SendMessage(GetDlgItem(hwndDlg, IDOK), BCM_SETSHIELD, 0, TRUE);
|
||||
|
||||
if (!WINDOWS_HAS_UAC)
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_TOGGLEELEVATION), SW_HIDE);
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
@@ -407,11 +404,7 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
|
||||
|
||||
sessionId = GetDlgItemInt(hwndDlg, IDC_SESSIONID, NULL, FALSE);
|
||||
desktopName = PhaGetDlgItemText(hwndDlg, IDC_DESKTOP);
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
useLinkedToken = Button_GetCheck(GetDlgItem(hwndDlg, IDC_TOGGLEELEVATION)) == BST_CHECKED;
|
||||
else
|
||||
useLinkedToken = FALSE;
|
||||
useLinkedToken = Button_GetCheck(GetDlgItem(hwndDlg, IDC_TOGGLEELEVATION)) == BST_CHECKED;
|
||||
|
||||
if (PhFindIntegerSiKeyValuePairs(
|
||||
PhpLogonTypePairs,
|
||||
@@ -444,8 +437,7 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
|
||||
createInfo.Password = PhGetStringOrEmpty(password);
|
||||
|
||||
// Whenever we can, try not to set the desktop name; it breaks a lot of things.
|
||||
// Note that on XP we must set it, otherwise the program doesn't display correctly.
|
||||
if (WindowsVersion < WINDOWS_VISTA || (desktopName->Length != 0 && !PhEqualString2(desktopName, L"WinSta0\\Default", TRUE)))
|
||||
if (desktopName->Length != 0 && !PhEqualString2(desktopName, L"WinSta0\\Default", TRUE))
|
||||
createInfo.DesktopName = desktopName->Buffer;
|
||||
|
||||
PhSetDesktopWinStaAccess();
|
||||
|
||||
+20
-32
@@ -174,10 +174,7 @@ static VOID PhpRefreshControls(
|
||||
_In_ HWND hwndDlg
|
||||
)
|
||||
{
|
||||
if (
|
||||
WindowsVersion >= WINDOWS_VISTA &&
|
||||
PhEqualString2(PhaGetDlgItemText(hwndDlg, IDC_STARTTYPE), L"Auto start", FALSE)
|
||||
)
|
||||
if (PhEqualString2(PhaGetDlgItemText(hwndDlg, IDC_STARTTYPE), L"Auto start", FALSE))
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYEDSTART), TRUE);
|
||||
}
|
||||
@@ -254,10 +251,7 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
|
||||
PhDereferenceObject(description);
|
||||
}
|
||||
|
||||
if (
|
||||
WindowsVersion >= WINDOWS_VISTA &&
|
||||
PhGetServiceDelayedAutoStart(serviceHandle, &delayedStart)
|
||||
)
|
||||
if (PhGetServiceDelayedAutoStart(serviceHandle, &delayedStart))
|
||||
{
|
||||
context->OldDelayedStart = delayedStart;
|
||||
|
||||
@@ -460,16 +454,13 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
|
||||
NULL
|
||||
))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
BOOLEAN newDelayedStart;
|
||||
|
||||
newDelayedStart = Button_GetCheck(GetDlgItem(hwndDlg, IDC_DELAYEDSTART)) == BST_CHECKED;
|
||||
|
||||
if (newDelayedStart != context->OldDelayedStart)
|
||||
{
|
||||
BOOLEAN newDelayedStart;
|
||||
|
||||
newDelayedStart = Button_GetCheck(GetDlgItem(hwndDlg, IDC_DELAYEDSTART)) == BST_CHECKED;
|
||||
|
||||
if (newDelayedStart != context->OldDelayedStart)
|
||||
{
|
||||
PhSetServiceDelayedAutoStart(serviceHandle, newDelayedStart);
|
||||
}
|
||||
PhSetServiceDelayedAutoStart(serviceHandle, newDelayedStart);
|
||||
}
|
||||
|
||||
PhMarkNeedsConfigUpdateServiceItem(serviceItem);
|
||||
@@ -503,23 +494,20 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
BOOLEAN newDelayedStart;
|
||||
|
||||
newDelayedStart = Button_GetCheck(GetDlgItem(hwndDlg, IDC_DELAYEDSTART)) == BST_CHECKED;
|
||||
|
||||
if (newDelayedStart != context->OldDelayedStart)
|
||||
{
|
||||
BOOLEAN newDelayedStart;
|
||||
SERVICE_DELAYED_AUTO_START_INFO info;
|
||||
|
||||
newDelayedStart = Button_GetCheck(GetDlgItem(hwndDlg, IDC_DELAYEDSTART)) == BST_CHECKED;
|
||||
|
||||
if (newDelayedStart != context->OldDelayedStart)
|
||||
{
|
||||
SERVICE_DELAYED_AUTO_START_INFO info;
|
||||
|
||||
info.fDelayedAutostart = newDelayedStart;
|
||||
PhSvcCallChangeServiceConfig2(
|
||||
serviceItem->Name->Buffer,
|
||||
SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
|
||||
&info
|
||||
);
|
||||
}
|
||||
info.fDelayedAutostart = newDelayedStart;
|
||||
PhSvcCallChangeServiceConfig2(
|
||||
serviceItem->Name->Buffer,
|
||||
SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
|
||||
&info
|
||||
);
|
||||
}
|
||||
|
||||
PhMarkNeedsConfigUpdateServiceItem(serviceItem);
|
||||
|
||||
@@ -463,11 +463,7 @@ VOID PhServiceProviderUpdate(
|
||||
{
|
||||
if (!PhpNonPollInitialized)
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
PhpInitializeServiceNonPoll();
|
||||
}
|
||||
|
||||
PhpInitializeServiceNonPoll();
|
||||
PhpNonPollInitialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ VOID PhSipOnShowWindow(
|
||||
|
||||
MinimumSize.left = 0;
|
||||
MinimumSize.top = 0;
|
||||
MinimumSize.right = WindowsVersion >= WINDOWS_VISTA ? 430 : 370; // XP doesn't have the Memory Lists group
|
||||
MinimumSize.right = 430;
|
||||
MinimumSize.bottom = 290;
|
||||
MapDialogRect(PhSipWindow, &MinimumSize);
|
||||
|
||||
|
||||
+51
-54
@@ -320,7 +320,7 @@ INT_PTR CALLBACK PhSipMemoryDialogProc(
|
||||
|
||||
MemoryPanel = CreateDialog(
|
||||
PhInstanceHandle,
|
||||
WindowsVersion >= WINDOWS_VISTA ? MAKEINTRESOURCE(IDD_SYSINFO_MEMPANEL) : MAKEINTRESOURCE(IDD_SYSINFO_MEMPANELXP),
|
||||
MAKEINTRESOURCE(IDD_SYSINFO_MEMPANEL),
|
||||
hwndDlg,
|
||||
PhSipMemoryPanelDialogProc
|
||||
);
|
||||
@@ -777,64 +777,61 @@ VOID PhSipUpdateMemoryPanel(
|
||||
|
||||
// Memory lists
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
if (NT_SUCCESS(NtQuerySystemInformation(
|
||||
SystemMemoryListInformation,
|
||||
&memoryListInfo,
|
||||
sizeof(SYSTEM_MEMORY_LIST_INFORMATION),
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
if (NT_SUCCESS(NtQuerySystemInformation(
|
||||
SystemMemoryListInformation,
|
||||
&memoryListInfo,
|
||||
sizeof(SYSTEM_MEMORY_LIST_INFORMATION),
|
||||
NULL
|
||||
)))
|
||||
ULONG_PTR standbyPageCount;
|
||||
ULONG_PTR repurposedPageCount;
|
||||
ULONG i;
|
||||
|
||||
standbyPageCount = 0;
|
||||
repurposedPageCount = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
ULONG_PTR standbyPageCount;
|
||||
ULONG_PTR repurposedPageCount;
|
||||
ULONG i;
|
||||
|
||||
standbyPageCount = 0;
|
||||
repurposedPageCount = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
standbyPageCount += memoryListInfo.PageCountByPriority[i];
|
||||
repurposedPageCount += memoryListInfo.RepurposedPagesByPriority[i];
|
||||
}
|
||||
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTZEROED_V, PhaFormatSize((ULONG64)memoryListInfo.ZeroPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTFREE_V, PhaFormatSize((ULONG64)memoryListInfo.FreePageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIED_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDNOWRITE_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedNoWritePageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY_V, PhaFormatSize((ULONG64)standbyPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY0_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[0] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY1_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[1] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY2_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[2] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY3_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[3] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY4_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[4] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY5_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[5] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY6_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[6] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY7_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[7] * PAGE_SIZE, -1)->Buffer);
|
||||
|
||||
if (WindowsVersion >= WINDOWS_8)
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDPAGEFILE_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedPageCountPageFile * PAGE_SIZE, -1)->Buffer);
|
||||
else
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDPAGEFILE_V, L"N/A");
|
||||
standbyPageCount += memoryListInfo.PageCountByPriority[i];
|
||||
repurposedPageCount += memoryListInfo.RepurposedPagesByPriority[i];
|
||||
}
|
||||
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTZEROED_V, PhaFormatSize((ULONG64)memoryListInfo.ZeroPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTFREE_V, PhaFormatSize((ULONG64)memoryListInfo.FreePageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIED_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDNOWRITE_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedNoWritePageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY_V, PhaFormatSize((ULONG64)standbyPageCount * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY0_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[0] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY1_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[1] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY2_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[2] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY3_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[3] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY4_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[4] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY5_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[5] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY6_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[6] * PAGE_SIZE, -1)->Buffer);
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY7_V, PhaFormatSize((ULONG64)memoryListInfo.PageCountByPriority[7] * PAGE_SIZE, -1)->Buffer);
|
||||
|
||||
if (WindowsVersion >= WINDOWS_8)
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDPAGEFILE_V, PhaFormatSize((ULONG64)memoryListInfo.ModifiedPageCountPageFile * PAGE_SIZE, -1)->Buffer);
|
||||
else
|
||||
{
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTZEROED_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTFREE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIED_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDNOWRITE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDPAGEFILE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY0_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY1_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY2_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY3_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY4_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY5_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY6_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY7_V, L"N/A");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTZEROED_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTFREE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIED_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDNOWRITE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTMODIFIEDPAGEFILE_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY0_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY1_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY2_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY3_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY4_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY5_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY6_V, L"N/A");
|
||||
SetDlgItemText(MemoryPanel, IDC_ZLISTSTANDBY7_V, L"N/A");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -538,7 +538,7 @@ NTSTATUS PhpThreadQueryWorker(
|
||||
|
||||
// Check if the process has services - we'll need to know before getting service tag/name
|
||||
// information.
|
||||
if (WINDOWS_HAS_SERVICE_TAGS && !data->ThreadProvider->HasServicesKnown)
|
||||
if (!data->ThreadProvider->HasServicesKnown)
|
||||
{
|
||||
PPH_PROCESS_ITEM processItem;
|
||||
|
||||
@@ -552,9 +552,10 @@ NTSTATUS PhpThreadQueryWorker(
|
||||
}
|
||||
|
||||
// Get the service tag, and the service name.
|
||||
if (WINDOWS_HAS_SERVICE_TAGS &&
|
||||
if (
|
||||
data->ThreadProvider->SymbolProvider->IsRealHandle &&
|
||||
data->ThreadItem->ThreadHandle)
|
||||
data->ThreadItem->ThreadHandle
|
||||
)
|
||||
{
|
||||
PVOID serviceTag;
|
||||
|
||||
@@ -869,7 +870,6 @@ VOID PhpThreadProviderUpdate(
|
||||
}
|
||||
|
||||
// Get the cycle count.
|
||||
if (WINDOWS_HAS_CYCLE_TIME)
|
||||
{
|
||||
ULONG64 cycles;
|
||||
|
||||
@@ -1027,7 +1027,6 @@ VOID PhpThreadProviderUpdate(
|
||||
}
|
||||
|
||||
// Update the cycle count.
|
||||
if (WINDOWS_HAS_CYCLE_TIME)
|
||||
{
|
||||
ULONG64 cycles;
|
||||
ULONG64 oldDelta;
|
||||
@@ -1055,7 +1054,7 @@ VOID PhpThreadProviderUpdate(
|
||||
|
||||
// Update the CPU usage.
|
||||
// If the cycle time isn't available, we'll fall back to using the CPU time.
|
||||
if (WINDOWS_HAS_CYCLE_TIME && PhEnableCycleCpuUsage && (threadProvider->ProcessId == SYSTEM_IDLE_PROCESS_ID || threadItem->ThreadHandle))
|
||||
if (PhEnableCycleCpuUsage && (threadProvider->ProcessId == SYSTEM_IDLE_PROCESS_ID || threadItem->ThreadHandle))
|
||||
{
|
||||
threadItem->CpuUsage = (FLOAT)threadItem->CyclesDelta.Delta / PhCpuTotalCycleDelta;
|
||||
}
|
||||
|
||||
+28
-42
@@ -450,9 +450,6 @@ INT_PTR CALLBACK PhpTokenPageProc(
|
||||
SetDlgItemText(hwndDlg, IDC_USERSID, L"Unknown");
|
||||
SetDlgItemText(hwndDlg, IDC_APPCONTAINERSID, L"Unknown");
|
||||
|
||||
if (!WINDOWS_HAS_UAC)
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_INTEGRITY), SW_HIDE);
|
||||
|
||||
if (NT_SUCCESS(tokenPageContext->OpenObject(
|
||||
&tokenHandle,
|
||||
TOKEN_QUERY,
|
||||
@@ -490,34 +487,26 @@ INT_PTR CALLBACK PhpTokenPageProc(
|
||||
if (NT_SUCCESS(PhGetTokenSessionId(tokenHandle, &sessionId)))
|
||||
SetDlgItemInt(hwndDlg, IDC_SESSIONID, sessionId, FALSE);
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
{
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(tokenHandle, &elevationType)))
|
||||
SetDlgItemText(hwndDlg, IDC_ELEVATED, PhGetElevationTypeString(elevationType));
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(tokenHandle, &elevationType)))
|
||||
SetDlgItemText(hwndDlg, IDC_ELEVATED, PhGetElevationTypeString(elevationType));
|
||||
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationAllowed(tokenHandle, &isVirtualizationAllowed)))
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationAllowed(tokenHandle, &isVirtualizationAllowed)))
|
||||
{
|
||||
if (isVirtualizationAllowed)
|
||||
{
|
||||
if (isVirtualizationAllowed)
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationEnabled(tokenHandle, &isVirtualizationEnabled)))
|
||||
{
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationEnabled(tokenHandle, &isVirtualizationEnabled)))
|
||||
{
|
||||
SetDlgItemText(
|
||||
hwndDlg,
|
||||
IDC_VIRTUALIZED,
|
||||
isVirtualizationEnabled ? L"Yes" : L"No"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemText(hwndDlg, IDC_VIRTUALIZED, L"Not allowed");
|
||||
SetDlgItemText(
|
||||
hwndDlg,
|
||||
IDC_VIRTUALIZED,
|
||||
isVirtualizationEnabled ? L"Yes" : L"No"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemText(hwndDlg, IDC_ELEVATED, L"N/A");
|
||||
SetDlgItemText(hwndDlg, IDC_VIRTUALIZED, L"N/A");
|
||||
else
|
||||
{
|
||||
SetDlgItemText(hwndDlg, IDC_VIRTUALIZED, L"Not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
if (WINDOWS_HAS_IMMERSIVE)
|
||||
@@ -1119,28 +1108,25 @@ INT_PTR CALLBACK PhpTokenGeneralPageProc(
|
||||
|
||||
PhGetTokenSessionId(tokenHandle, &tokenSessionId);
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(tokenHandle, &elevationType)))
|
||||
{
|
||||
if (NT_SUCCESS(PhGetTokenElevationType(tokenHandle, &elevationType)))
|
||||
{
|
||||
tokenElevated = PhGetElevationTypeString(elevationType);
|
||||
hasLinkedToken = elevationType != TokenElevationTypeDefault;
|
||||
}
|
||||
tokenElevated = PhGetElevationTypeString(elevationType);
|
||||
hasLinkedToken = elevationType != TokenElevationTypeDefault;
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationAllowed(tokenHandle, &isVirtualizationAllowed)))
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationAllowed(tokenHandle, &isVirtualizationAllowed)))
|
||||
{
|
||||
if (isVirtualizationAllowed)
|
||||
{
|
||||
if (isVirtualizationAllowed)
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationEnabled(tokenHandle, &isVirtualizationEnabled)))
|
||||
{
|
||||
if (NT_SUCCESS(PhGetTokenIsVirtualizationEnabled(tokenHandle, &isVirtualizationEnabled)))
|
||||
{
|
||||
tokenVirtualization = isVirtualizationEnabled ? L"Enabled" : L"Disabled";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenVirtualization = L"Not Allowed";
|
||||
tokenVirtualization = isVirtualizationEnabled ? L"Enabled" : L"Disabled";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenVirtualization = L"Not Allowed";
|
||||
}
|
||||
}
|
||||
|
||||
NtClose(tokenHandle);
|
||||
|
||||
+5
-16
@@ -220,20 +220,9 @@ static VOID PhInitializeWindowsVersion(
|
||||
WindowsVersion = WINDOWS_NEW;
|
||||
}
|
||||
|
||||
if (WINDOWS_HAS_LIMITED_ACCESS)
|
||||
{
|
||||
ProcessQueryAccess = PROCESS_QUERY_LIMITED_INFORMATION;
|
||||
ProcessAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1fff;
|
||||
ThreadQueryAccess = THREAD_QUERY_LIMITED_INFORMATION;
|
||||
ThreadSetAccess = THREAD_SET_LIMITED_INFORMATION;
|
||||
ThreadAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessQueryAccess = PROCESS_QUERY_INFORMATION;
|
||||
ProcessAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff;
|
||||
ThreadQueryAccess = THREAD_QUERY_INFORMATION;
|
||||
ThreadSetAccess = THREAD_SET_INFORMATION;
|
||||
ThreadAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3ff;
|
||||
}
|
||||
ProcessQueryAccess = PROCESS_QUERY_LIMITED_INFORMATION;
|
||||
ProcessAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1fff;
|
||||
ThreadQueryAccess = THREAD_QUERY_LIMITED_INFORMATION;
|
||||
ThreadSetAccess = THREAD_SET_LIMITED_INFORMATION;
|
||||
ThreadAllAccess = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff;
|
||||
}
|
||||
|
||||
+3
-12
@@ -50,8 +50,7 @@ VOID PhGuiSupportInitialization(
|
||||
shell32Handle = LoadLibrary(L"shell32.dll");
|
||||
shlwapiHandle = LoadLibrary(L"shlwapi.dll");
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
ChangeWindowMessageFilter_I = PhGetModuleProcAddress(L"user32.dll", "ChangeWindowMessageFilter");
|
||||
ChangeWindowMessageFilter_I = PhGetModuleProcAddress(L"user32.dll", "ChangeWindowMessageFilter");
|
||||
if (WINDOWS_HAS_IMMERSIVE)
|
||||
IsImmersiveProcess_I = PhGetModuleProcAddress(L"user32.dll", "IsImmersiveProcess");
|
||||
RunFileDlg = PhGetProcedureAddress(shell32Handle, NULL, 61);
|
||||
@@ -63,10 +62,7 @@ VOID PhSetControlTheme(
|
||||
_In_ PWSTR Theme
|
||||
)
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
SetWindowTheme(Handle, Theme, NULL);
|
||||
}
|
||||
SetWindowTheme(Handle, Theme, NULL);
|
||||
}
|
||||
|
||||
INT PhAddListViewColumn(
|
||||
@@ -694,16 +690,11 @@ VOID PhGetStockApplicationIcon(
|
||||
PhInitializeStringRef(&dllBaseName, L"\\imageres.dll");
|
||||
index = 11;
|
||||
}
|
||||
else if (WindowsVersion >= WINDOWS_VISTA)
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&dllBaseName, L"\\user32.dll");
|
||||
index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&dllBaseName, L"\\shell32.dll");
|
||||
index = 2;
|
||||
}
|
||||
|
||||
dllFileName = PhConcatStringRef2(&systemDirectory->sr, &dllBaseName);
|
||||
PhDereferenceObject(systemDirectory);
|
||||
|
||||
@@ -33,13 +33,8 @@ PHLIBAPI extern ACCESS_MASK ThreadAllAccess;
|
||||
#define WINDOWS_NEW MAXLONG
|
||||
|
||||
#define WINDOWS_HAS_CONSOLE_HOST (WindowsVersion >= WINDOWS_7)
|
||||
#define WINDOWS_HAS_CYCLE_TIME (WindowsVersion >= WINDOWS_VISTA)
|
||||
#define WINDOWS_HAS_IFILEDIALOG (WindowsVersion >= WINDOWS_VISTA)
|
||||
#define WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID (WindowsVersion >= WINDOWS_VISTA)
|
||||
#define WINDOWS_HAS_IMMERSIVE (WindowsVersion >= WINDOWS_8)
|
||||
#define WINDOWS_HAS_LIMITED_ACCESS (WindowsVersion >= WINDOWS_VISTA)
|
||||
#define WINDOWS_HAS_SERVICE_TAGS (WindowsVersion >= WINDOWS_VISTA)
|
||||
#define WINDOWS_HAS_UAC (WindowsVersion >= WINDOWS_VISTA)
|
||||
|
||||
// Debugging
|
||||
|
||||
|
||||
+40
-100
@@ -87,11 +87,8 @@ PH_TOKEN_ATTRIBUTES PhGetOwnTokenAttributes(
|
||||
BOOLEAN elevated = TRUE;
|
||||
TOKEN_ELEVATION_TYPE elevationType = TokenElevationTypeFull;
|
||||
|
||||
if (WINDOWS_HAS_UAC)
|
||||
{
|
||||
PhGetTokenIsElevated(attributes.TokenHandle, &elevated);
|
||||
PhGetTokenElevationType(attributes.TokenHandle, &elevationType);
|
||||
}
|
||||
PhGetTokenIsElevated(attributes.TokenHandle, &elevated);
|
||||
PhGetTokenElevationType(attributes.TokenHandle, &elevationType);
|
||||
|
||||
attributes.Elevated = elevated;
|
||||
attributes.ElevationType = elevationType;
|
||||
@@ -1319,39 +1316,19 @@ NTSTATUS PhInjectDllProcess(
|
||||
)))
|
||||
goto FreeExit;
|
||||
|
||||
// Vista seems to support native threads better than XP.
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
if (!NT_SUCCESS(status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)threadStart,
|
||||
baseAddress,
|
||||
&threadHandle,
|
||||
NULL
|
||||
)))
|
||||
goto FreeExit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(threadHandle = CreateRemoteThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
0,
|
||||
(PTHREAD_START_ROUTINE)threadStart,
|
||||
baseAddress,
|
||||
0,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
status = PhGetLastWin32ErrorAsNtStatus();
|
||||
goto FreeExit;
|
||||
}
|
||||
}
|
||||
if (!NT_SUCCESS(status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)threadStart,
|
||||
baseAddress,
|
||||
&threadHandle,
|
||||
NULL
|
||||
)))
|
||||
goto FreeExit;
|
||||
|
||||
// Wait for the thread to finish.
|
||||
status = NtWaitForSingleObject(threadHandle, FALSE, Timeout);
|
||||
@@ -1465,36 +1442,18 @@ NTSTATUS PhUnloadDllProcess(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
{
|
||||
status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)threadStart,
|
||||
BaseAddress,
|
||||
&threadHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(threadHandle = CreateRemoteThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
0,
|
||||
(PTHREAD_START_ROUTINE)threadStart,
|
||||
BaseAddress,
|
||||
0,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
status = PhGetLastWin32ErrorAsNtStatus();
|
||||
}
|
||||
}
|
||||
status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)threadStart,
|
||||
BaseAddress,
|
||||
&threadHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
return status;
|
||||
@@ -1639,39 +1598,20 @@ NTSTATUS PhSetEnvironmentVariableRemote(
|
||||
}
|
||||
}
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
if (!NT_SUCCESS(status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
TRUE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)rtlExitUserThread,
|
||||
NULL,
|
||||
&threadHandle,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
if (!NT_SUCCESS(status = RtlCreateUserThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
TRUE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PUSER_THREAD_START_ROUTINE)rtlExitUserThread,
|
||||
NULL,
|
||||
&threadHandle,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
goto CleanupExit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(threadHandle = CreateRemoteThread(
|
||||
ProcessHandle,
|
||||
NULL,
|
||||
0,
|
||||
(PTHREAD_START_ROUTINE)rtlExitUserThread,
|
||||
NULL,
|
||||
CREATE_SUSPENDED,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
status = PhGetLastWin32ErrorAsNtStatus();
|
||||
goto CleanupExit;
|
||||
}
|
||||
goto CleanupExit;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
+2
-4
@@ -645,13 +645,11 @@ BOOLEAN PhGetAccessEntries(
|
||||
}
|
||||
else if (PhEqualStringZ(Type, L"Process", TRUE))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
Type = L"Process60";
|
||||
Type = L"Process60";
|
||||
}
|
||||
else if (PhEqualStringZ(Type, L"Thread", TRUE))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
Type = L"Thread60";
|
||||
Type = L"Thread60";
|
||||
}
|
||||
|
||||
// Find the specific type.
|
||||
|
||||
+2
-2
@@ -2049,13 +2049,13 @@ VOID PhTnpUpdateTextMetrics(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA && !(Context->Style & TN_STYLE_THIN_ROWS))
|
||||
if (!(Context->Style & TN_STYLE_THIN_ROWS))
|
||||
Context->RowHeight += 1; // HACK
|
||||
}
|
||||
|
||||
Context->RowHeight += 1; // HACK
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA && !(Context->Style & TN_STYLE_THIN_ROWS))
|
||||
if (!(Context->Style & TN_STYLE_THIN_ROWS))
|
||||
Context->RowHeight += 2; // HACK
|
||||
}
|
||||
|
||||
|
||||
+26
-61
@@ -41,9 +41,6 @@
|
||||
#include "sha.h"
|
||||
#include "sha256.h"
|
||||
|
||||
// We may want to change this for debugging purposes.
|
||||
#define PHP_USE_IFILEDIALOG (WINDOWS_HAS_IFILEDIALOG)
|
||||
|
||||
typedef BOOLEAN (NTAPI *_WinStationQueryInformationW)(
|
||||
_In_opt_ HANDLE ServerHandle,
|
||||
_In_ ULONG LogonId,
|
||||
@@ -2849,15 +2846,8 @@ NTSTATUS PhCreateProcessAsUser(
|
||||
// Check if this is a service logon.
|
||||
if (PhEqualStringZ(Information->DomainName, L"NT AUTHORITY", TRUE))
|
||||
{
|
||||
if (PhEqualStringZ(Information->UserName, L"SYSTEM", TRUE))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
logonType = LOGON32_LOGON_SERVICE;
|
||||
else
|
||||
logonType = LOGON32_LOGON_NEW_CREDENTIALS; // HACK
|
||||
}
|
||||
|
||||
if (PhEqualStringZ(Information->UserName, L"LOCAL SERVICE", TRUE) ||
|
||||
if (PhEqualStringZ(Information->UserName, L"SYSTEM", TRUE) ||
|
||||
PhEqualStringZ(Information->UserName, L"LOCAL SERVICE", TRUE) ||
|
||||
PhEqualStringZ(Information->UserName, L"NETWORK SERVICE", TRUE))
|
||||
{
|
||||
logonType = LOGON32_LOGON_SERVICE;
|
||||
@@ -3154,7 +3144,6 @@ NTSTATUS PhFilterTokenForLimitedUser(
|
||||
return status;
|
||||
|
||||
// Set the integrity level to Low if we're on Vista and above.
|
||||
if (WINDOWS_HAS_UAC)
|
||||
{
|
||||
lowMandatoryLevelSid = (PSID)lowMandatoryLevelSidBuffer;
|
||||
RtlInitializeSid(lowMandatoryLevelSid, &mandatoryLabelAuthority, 1);
|
||||
@@ -3287,7 +3276,7 @@ BOOLEAN PhShellExecuteEx(
|
||||
info.nShow = ShowWindowType;
|
||||
info.hwnd = hWnd;
|
||||
|
||||
if ((Flags & PH_SHELL_EXECUTE_ADMIN) && WINDOWS_HAS_UAC)
|
||||
if (Flags & PH_SHELL_EXECUTE_ADMIN)
|
||||
info.lpVerb = L"runas";
|
||||
|
||||
if (ShellExecuteEx(&info))
|
||||
@@ -3418,11 +3407,7 @@ PPH_STRING PhExpandKeyName(
|
||||
|
||||
if (Computer)
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
tempString = PhConcatStrings2(L"Computer\\", keyName->Buffer);
|
||||
else
|
||||
tempString = PhConcatStrings2(L"My Computer\\", keyName->Buffer);
|
||||
|
||||
tempString = PhConcatStrings2(L"Computer\\", keyName->Buffer);
|
||||
PhDereferenceObject(keyName);
|
||||
keyName = tempString;
|
||||
}
|
||||
@@ -3733,31 +3718,21 @@ PVOID PhCreateOpenFileDialog(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
OPENFILENAME *ofn;
|
||||
PVOID ofnFileDialog;
|
||||
IFileDialog *fileDialog;
|
||||
|
||||
if (PHP_USE_IFILEDIALOG)
|
||||
if (SUCCEEDED(CoCreateInstance(
|
||||
&CLSID_FileOpenDialog,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IFileDialog,
|
||||
&fileDialog
|
||||
)))
|
||||
{
|
||||
IFileDialog *fileDialog;
|
||||
|
||||
if (SUCCEEDED(CoCreateInstance(
|
||||
&CLSID_FileOpenDialog,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IFileDialog,
|
||||
&fileDialog
|
||||
)))
|
||||
{
|
||||
// The default options are fine.
|
||||
return PhpCreateFileDialog(FALSE, NULL, fileDialog);
|
||||
}
|
||||
// The default options are fine.
|
||||
return PhpCreateFileDialog(FALSE, NULL, fileDialog);
|
||||
}
|
||||
|
||||
ofn = PhpCreateOpenFileName();
|
||||
ofnFileDialog = PhpCreateFileDialog(FALSE, ofn, NULL);
|
||||
PhSetFileDialogOptions(ofnFileDialog, PH_FILEDIALOG_PATHMUSTEXIST | PH_FILEDIALOG_FILEMUSTEXIST | PH_FILEDIALOG_STRICTFILETYPES);
|
||||
|
||||
return ofnFileDialog;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3770,31 +3745,21 @@ PVOID PhCreateSaveFileDialog(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
OPENFILENAME *ofn;
|
||||
PVOID ofnFileDialog;
|
||||
IFileDialog *fileDialog;
|
||||
|
||||
if (PHP_USE_IFILEDIALOG)
|
||||
if (SUCCEEDED(CoCreateInstance(
|
||||
&CLSID_FileSaveDialog,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IFileDialog,
|
||||
&fileDialog
|
||||
)))
|
||||
{
|
||||
IFileDialog *fileDialog;
|
||||
|
||||
if (SUCCEEDED(CoCreateInstance(
|
||||
&CLSID_FileSaveDialog,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IFileDialog,
|
||||
&fileDialog
|
||||
)))
|
||||
{
|
||||
// The default options are fine.
|
||||
return PhpCreateFileDialog(TRUE, NULL, fileDialog);
|
||||
}
|
||||
// The default options are fine.
|
||||
return PhpCreateFileDialog(TRUE, NULL, fileDialog);
|
||||
}
|
||||
|
||||
ofn = PhpCreateOpenFileName();
|
||||
ofnFileDialog = PhpCreateFileDialog(TRUE, ofn, NULL);
|
||||
PhSetFileDialogOptions(ofnFileDialog, PH_FILEDIALOG_PATHMUSTEXIST | PH_FILEDIALOG_OVERWRITEPROMPT | PH_FILEDIALOG_STRICTFILETYPES);
|
||||
|
||||
return ofnFileDialog;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-5
@@ -217,11 +217,7 @@ VERIFY_RESULT PhpVerifyFile(
|
||||
if (Information->Flags & PH_VERIFY_PREVENT_NETWORK_ACCESS)
|
||||
{
|
||||
trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
trustData.dwProvFlags |= WTD_CACHE_ONLY_URL_RETRIEVAL;
|
||||
else
|
||||
trustData.dwProvFlags |= WTD_REVOCATION_CHECK_NONE;
|
||||
trustData.dwProvFlags |= WTD_CACHE_ONLY_URL_RETRIEVAL;
|
||||
}
|
||||
|
||||
status = WinVerifyTrust_I(NULL, ActionId, &trustData);
|
||||
|
||||
+18
-21
@@ -267,32 +267,29 @@ VOID PhpUpdateWorkQueueEnvironment(
|
||||
}
|
||||
}
|
||||
|
||||
if (WindowsVersion >= WINDOWS_VISTA)
|
||||
if (CurrentEnvironment->IoPriority != NewEnvironment->IoPriority || NewEnvironment->ForceUpdate)
|
||||
{
|
||||
if (CurrentEnvironment->IoPriority != NewEnvironment->IoPriority || NewEnvironment->ForceUpdate)
|
||||
IO_PRIORITY_HINT ioPriority;
|
||||
|
||||
ioPriority = NewEnvironment->IoPriority;
|
||||
|
||||
if (NT_SUCCESS(NtSetInformationThread(NtCurrentThread(), ThreadIoPriority,
|
||||
&ioPriority, sizeof(IO_PRIORITY_HINT))))
|
||||
{
|
||||
IO_PRIORITY_HINT ioPriority;
|
||||
|
||||
ioPriority = NewEnvironment->IoPriority;
|
||||
|
||||
if (NT_SUCCESS(NtSetInformationThread(NtCurrentThread(), ThreadIoPriority,
|
||||
&ioPriority, sizeof(IO_PRIORITY_HINT))))
|
||||
{
|
||||
CurrentEnvironment->IoPriority = NewEnvironment->IoPriority;
|
||||
}
|
||||
CurrentEnvironment->IoPriority = NewEnvironment->IoPriority;
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentEnvironment->PagePriority != NewEnvironment->PagePriority || NewEnvironment->ForceUpdate)
|
||||
if (CurrentEnvironment->PagePriority != NewEnvironment->PagePriority || NewEnvironment->ForceUpdate)
|
||||
{
|
||||
ULONG pagePriority;
|
||||
|
||||
pagePriority = NewEnvironment->PagePriority;
|
||||
|
||||
if (NT_SUCCESS(NtSetInformationThread(NtCurrentThread(), ThreadPagePriority,
|
||||
&pagePriority, sizeof(ULONG))))
|
||||
{
|
||||
ULONG pagePriority;
|
||||
|
||||
pagePriority = NewEnvironment->PagePriority;
|
||||
|
||||
if (NT_SUCCESS(NtSetInformationThread(NtCurrentThread(), ThreadPagePriority,
|
||||
&pagePriority, sizeof(ULONG))))
|
||||
{
|
||||
CurrentEnvironment->PagePriority = NewEnvironment->PagePriority;
|
||||
}
|
||||
CurrentEnvironment->PagePriority = NewEnvironment->PagePriority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user