mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[TASKMGR] Processes page: Add "Properties" and "Open File Location" context menu items (#4323)
Signed-off-by: Thamatip Chitpong <tangaming123456@outlook.com> Reviewed-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> Reviewed-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> Reviewed-by: Joachim Henze <joachim.henze@reactos.org> Reviewed-by: Mark Jansen <mark.jansen@reactos.org>
This commit is contained in:
parent
4121b0e805
commit
59dcec1faf
34 changed files with 385 additions and 0 deletions
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Ниско", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Установяване на с&родство...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "Ní&zká", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Nastavit &afinitu...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Lav", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Sæt &Affinitet...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "N&iedrig", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "&Zugehörigkeit festlegen...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Eigenschaften", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "Übergeordneten Ordner ö&ffnen", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Low", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Set &Affinity...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Low", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Set &Affinity...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Baja", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Establecer &afinidad...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -142,6 +142,9 @@ BEGIN
|
|||
MENUITEM "&Madal", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Määra &ühtivus...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Basse", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Définir l'&affinité...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&נמוכה", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "הגדרת &קירבה", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "A&lacsony", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "&Processzorok használata...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Rendah", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Setel &Afinitas...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Bassa", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Definisci &Affinità...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "低(&L)", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "関係の設定(&A)...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "낮음(&L)", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "선호도 설정(&A)", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Laag", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "&Affiniteit instellen...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Lav", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Sett &tiltrekning ...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -143,6 +143,9 @@ BEGIN
|
|||
MENUITEM "N&iski", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Ustaw &koligację...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Baixa", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Definir &afinidade...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Baixa", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Definir &afinidade...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -141,6 +141,9 @@ BEGIN
|
|||
MENUITEM "Prioritate &minimă", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "A&finitate…", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Низкий", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Задать &соответствие...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "Níz&ka", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Nastaviť &afinitu...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -139,6 +139,9 @@ BEGIN
|
|||
MENUITEM "Poshte", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Vendos prirje...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Låg", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "Välj &källa (FIXME)...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ BEGIN
|
|||
MENUITEM "&Düşük", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "İ&lişkiyi Ayarla...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ BEGIN
|
|||
MENUITEM "&Низький", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "У&становити відповідність...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -142,6 +142,9 @@ BEGIN
|
|||
MENUITEM "低(&L)", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "关系设置(&A)...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -143,6 +143,9 @@ BEGIN
|
|||
MENUITEM "低(&L)", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "親和性設定(&A)...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -143,6 +143,9 @@ BEGIN
|
|||
MENUITEM "低(&L)", ID_PROCESS_PAGE_SETPRIORITY_LOW
|
||||
END
|
||||
MENUITEM "親和性設定(&A)...", ID_PROCESS_PAGE_SETAFFINITY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Properties", ID_PROCESS_PAGE_PROPERTIES
|
||||
MENUITEM "&Open File Location", ID_PROCESS_PAGE_OPENFILELOCATION
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||
* Copyright (C) 2009 Maxime Vernier <maxime.vernier@gmail.com>
|
||||
* Copyright (C) 2022 Thamatip Chitpong <tangaming123456@outlook.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -25,6 +26,10 @@
|
|||
|
||||
#include "proclist.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
|
||||
#include <ndk/psfuncs.h>
|
||||
|
||||
#define CMP(x1, x2)\
|
||||
(x1 < x2 ? -1 : (x1 > x2 ? 1 : 0))
|
||||
|
||||
|
@ -931,3 +936,283 @@ int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPara
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL DevicePathToDosPath(LPWSTR lpPath, DWORD dwSize)
|
||||
{
|
||||
WCHAR cDrive;
|
||||
|
||||
/* Check if lpPath is a device path */
|
||||
if (_wcsnicmp(lpPath, L"\\Device\\", 8) != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (cDrive = L'A'; cDrive <= L'Z'; cDrive++)
|
||||
{
|
||||
WCHAR szDrive[3];
|
||||
WCHAR szDevPath[MAX_PATH];
|
||||
|
||||
szDrive[0] = cDrive;
|
||||
szDrive[1] = L':';
|
||||
szDrive[2] = UNICODE_NULL;
|
||||
|
||||
if (QueryDosDeviceW(szDrive, szDevPath, _countof(szDevPath)) != 0)
|
||||
{
|
||||
size_t len = wcslen(szDevPath);
|
||||
|
||||
if (_wcsnicmp(lpPath, szDevPath, len) == 0)
|
||||
{
|
||||
StringCbPrintfW(lpPath, dwSize, L"%s%s", szDrive, lpPath + len);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static DWORD GetProcessExecutablePath(HANDLE hProcess, LPWSTR lpExePath, DWORD dwLength)
|
||||
{
|
||||
BYTE StaticBuffer[sizeof(UNICODE_STRING) + (MAX_PATH * sizeof(WCHAR))];
|
||||
PVOID DynamicBuffer = NULL;
|
||||
PUNICODE_STRING ImagePath = NULL;
|
||||
LPWSTR pszExePath = NULL;
|
||||
ULONG SizeNeeded;
|
||||
NTSTATUS Status;
|
||||
DWORD dwRet = 0;
|
||||
|
||||
Status = NtQueryInformationProcess(hProcess,
|
||||
ProcessImageFileName,
|
||||
StaticBuffer,
|
||||
sizeof(StaticBuffer) - sizeof(WCHAR),
|
||||
&SizeNeeded);
|
||||
|
||||
if (Status == STATUS_INFO_LENGTH_MISMATCH)
|
||||
{
|
||||
DynamicBuffer = HeapAlloc(GetProcessHeap(), 0, SizeNeeded + sizeof(WCHAR));
|
||||
|
||||
if (!DynamicBuffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Status = NtQueryInformationProcess(hProcess,
|
||||
ProcessImageFileName,
|
||||
DynamicBuffer,
|
||||
SizeNeeded,
|
||||
&SizeNeeded);
|
||||
|
||||
ImagePath = (PUNICODE_STRING)DynamicBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImagePath = (PUNICODE_STRING)StaticBuffer;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
pszExePath = HeapAlloc(GetProcessHeap(), 0, ImagePath->Length + sizeof(WCHAR));
|
||||
|
||||
if (!pszExePath)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
StringCbCopyNW(pszExePath, ImagePath->Length + sizeof(WCHAR), ImagePath->Buffer, ImagePath->Length);
|
||||
|
||||
if (!DevicePathToDosPath(pszExePath, ImagePath->Length + sizeof(WCHAR)))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
dwRet = wcslen(pszExePath) + 1;
|
||||
|
||||
if (dwLength >= dwRet)
|
||||
{
|
||||
StringCchCopyW(lpExePath, dwLength, pszExePath);
|
||||
|
||||
dwRet -= 1;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
|
||||
if (pszExePath)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pszExePath);
|
||||
}
|
||||
|
||||
if (DynamicBuffer)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, DynamicBuffer);
|
||||
}
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
static DWORD GetProcessExecutablePathById(DWORD dwProcessId, LPWSTR lpExePath, DWORD dwLength)
|
||||
{
|
||||
DWORD dwRet = 0;
|
||||
|
||||
if (dwProcessId == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PID = 4 or "System" */
|
||||
if (dwProcessId == 4)
|
||||
{
|
||||
static const WCHAR szKernelExe[] = L"\\ntoskrnl.exe";
|
||||
WCHAR szSystemDir[MAX_PATH];
|
||||
UINT uLength;
|
||||
|
||||
uLength = GetSystemDirectoryW(szSystemDir, _countof(szSystemDir));
|
||||
|
||||
if (uLength != 0)
|
||||
{
|
||||
dwRet = uLength + _countof(szKernelExe);
|
||||
|
||||
if (dwLength >= dwRet)
|
||||
{
|
||||
StringCchPrintfW(lpExePath, dwLength, L"%s%s", szSystemDir, szKernelExe);
|
||||
|
||||
dwRet -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HANDLE hProcess;
|
||||
|
||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
|
||||
|
||||
if (hProcess)
|
||||
{
|
||||
dwRet = GetProcessExecutablePath(hProcess, lpExePath, dwLength);
|
||||
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
void ProcessPage_OnProperties(void)
|
||||
{
|
||||
DWORD dwProcessId;
|
||||
WCHAR szPath[MAX_PATH];
|
||||
LPWSTR pszPath = NULL;
|
||||
LPWSTR pszExePath = NULL;
|
||||
DWORD dwLength;
|
||||
SHELLEXECUTEINFOW info = { 0 };
|
||||
|
||||
dwProcessId = GetSelectedProcessId();
|
||||
dwLength = GetProcessExecutablePathById(dwProcessId, szPath, _countof(szPath));
|
||||
|
||||
if (dwLength == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (dwLength > _countof(szPath))
|
||||
{
|
||||
pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
||||
|
||||
if (!pszPath)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
pszExePath = pszPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
pszExePath = szPath;
|
||||
}
|
||||
|
||||
info.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||
info.fMask = SEE_MASK_INVOKEIDLIST;
|
||||
info.hwnd = NULL;
|
||||
info.lpVerb = L"properties";
|
||||
info.lpFile = pszExePath;
|
||||
info.lpParameters = L"";
|
||||
info.lpDirectory = NULL;
|
||||
info.nShow = SW_SHOW;
|
||||
info.hInstApp = NULL;
|
||||
|
||||
ShellExecuteExW(&info);
|
||||
|
||||
Cleanup:
|
||||
|
||||
if (pszPath)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pszPath);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessPage_OnOpenFileLocation(void)
|
||||
{
|
||||
DWORD dwProcessId;
|
||||
WCHAR szPath[MAX_PATH];
|
||||
LPWSTR pszPath = NULL;
|
||||
LPWSTR pszExePath = NULL;
|
||||
LPWSTR pszCmdLine = NULL;
|
||||
DWORD dwLength;
|
||||
|
||||
dwProcessId = GetSelectedProcessId();
|
||||
dwLength = GetProcessExecutablePathById(dwProcessId, szPath, _countof(szPath));
|
||||
|
||||
if (dwLength == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (dwLength > _countof(szPath))
|
||||
{
|
||||
pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
||||
|
||||
if (!pszPath)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
pszExePath = pszPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
pszExePath = szPath;
|
||||
dwLength += 1;
|
||||
}
|
||||
|
||||
pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + 10) * sizeof(WCHAR));
|
||||
|
||||
if (!pszCmdLine)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
StringCchPrintfW(pszCmdLine, dwLength + 10, L"/select,\"%s\"", pszExePath);
|
||||
|
||||
/* Open file explorer and select the exe file */
|
||||
ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pszCmdLine);
|
||||
|
||||
Cleanup:
|
||||
|
||||
if (pszPath)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pszPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,3 +31,5 @@ extern HWND hProcessPageShowAllProcessesButton; /* Process Show All Processes c
|
|||
INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void RefreshProcessPage(void);
|
||||
DWORD GetSelectedProcessId(void);
|
||||
void ProcessPage_OnProperties(void);
|
||||
void ProcessPage_OnOpenFileLocation(void);
|
||||
|
|
|
@ -179,6 +179,8 @@
|
|||
#define ID_PROCESS_PAGE_SETPRIORITY_NORMAL 32812
|
||||
#define ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL 32813
|
||||
#define ID_PROCESS_PAGE_SETPRIORITY_LOW 32814
|
||||
#define ID_PROCESS_PAGE_PROPERTIES 32825
|
||||
#define ID_PROCESS_PAGE_OPENFILELOCATION 32826
|
||||
|
||||
#define ID_SHUTDOWN_STANDBY 32816
|
||||
#define ID_SHUTDOWN_HIBERNATE 32817
|
||||
|
|
|
@ -324,6 +324,12 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case ID_PROCESS_PAGE_SETPRIORITY_LOW:
|
||||
DoSetPriority(IDLE_PRIORITY_CLASS);
|
||||
break;
|
||||
case ID_PROCESS_PAGE_PROPERTIES:
|
||||
ProcessPage_OnProperties();
|
||||
break;
|
||||
case ID_PROCESS_PAGE_OPENFILELOCATION:
|
||||
ProcessPage_OnOpenFileLocation();
|
||||
break;
|
||||
|
||||
/* ShutDown items */
|
||||
case ID_SHUTDOWN_STANDBY:
|
||||
|
|
Loading…
Reference in a new issue