mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
added Cancel I/O
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3768 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -348,6 +348,10 @@
|
||||
RelativePath=".\objprp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\thrdact.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\unldll.c"
|
||||
>
|
||||
|
||||
@@ -12,6 +12,13 @@ VOID EtHandlePropertiesInitializing(
|
||||
__in PVOID Parameter
|
||||
);
|
||||
|
||||
// thrdact
|
||||
|
||||
BOOLEAN EtUiCancelIoThread(
|
||||
__in HWND hWnd,
|
||||
__in PPH_THREAD_ITEM Thread
|
||||
);
|
||||
|
||||
// unldll
|
||||
|
||||
VOID EtShowUnloadedDllsDialog(
|
||||
|
||||
@@ -53,6 +53,11 @@ VOID NTAPI ProcessMenuInitializingCallback(
|
||||
__in_opt PVOID Context
|
||||
);
|
||||
|
||||
VOID NTAPI ThreadMenuInitializingCallback(
|
||||
__in_opt PVOID Parameter,
|
||||
__in_opt PVOID Context
|
||||
);
|
||||
|
||||
PPH_PLUGIN PluginInstance;
|
||||
PH_CALLBACK_REGISTRATION PluginLoadCallbackRegistration;
|
||||
PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration;
|
||||
@@ -60,6 +65,7 @@ PH_CALLBACK_REGISTRATION PluginMenuItemCallbackRegistration;
|
||||
PH_CALLBACK_REGISTRATION MainWindowShowingCallbackRegistration;
|
||||
PH_CALLBACK_REGISTRATION HandlePropertiesInitializingCallbackRegistration;
|
||||
PH_CALLBACK_REGISTRATION ProcessMenuInitializingCallbackRegistration;
|
||||
PH_CALLBACK_REGISTRATION ThreadMenuInitializingCallbackRegistration;
|
||||
|
||||
LOGICAL DllMain(
|
||||
__in HINSTANCE Instance,
|
||||
@@ -120,6 +126,12 @@ LOGICAL DllMain(
|
||||
NULL,
|
||||
&ProcessMenuInitializingCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetGeneralCallback(GeneralCallbackThreadMenuInitializing),
|
||||
ThreadMenuInitializingCallback,
|
||||
NULL,
|
||||
&ThreadMenuInitializingCallbackRegistration
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -157,6 +169,11 @@ VOID NTAPI MenuItemCallback(
|
||||
EtShowUnloadedDllsDialog(PhMainWndHandle, menuItem->Context);
|
||||
}
|
||||
break;
|
||||
case ID_THREAD_CANCELIO:
|
||||
{
|
||||
EtUiCancelIoThread(menuItem->OwnerWindow, menuItem->Context);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,3 +214,29 @@ VOID NTAPI ProcessMenuInitializingCallback(
|
||||
PhInsertEMenuItem(miscMenu, PhPluginCreateEMenuItem(PluginInstance, 0, ID_PROCESS_UNLOADEDMODULES, L"Unloaded Modules", processItem), -1);
|
||||
}
|
||||
}
|
||||
|
||||
VOID NTAPI ThreadMenuInitializingCallback(
|
||||
__in_opt PVOID Parameter,
|
||||
__in_opt PVOID Context
|
||||
)
|
||||
{
|
||||
PPH_PLUGIN_MENU_INFORMATION menuInfo = Parameter;
|
||||
PPH_THREAD_ITEM threadItem;
|
||||
ULONG insertIndex;
|
||||
PPH_EMENU_ITEM menuItem;
|
||||
|
||||
if (menuInfo->u.Thread.NumberOfThreads == 1)
|
||||
threadItem = menuInfo->u.Thread.Threads[0];
|
||||
else
|
||||
threadItem = NULL;
|
||||
|
||||
if (menuItem = PhFindEMenuItem(menuInfo->Menu, 0, L"Resume", 0))
|
||||
insertIndex = PhIndexOfEMenuItem(menuInfo->Menu, menuItem) + 1;
|
||||
else
|
||||
insertIndex = 0;
|
||||
|
||||
PhInsertEMenuItem(menuInfo->Menu, menuItem = PhPluginCreateEMenuItem(PluginInstance, 0, ID_THREAD_CANCELIO,
|
||||
L"Cancel I/O", threadItem), insertIndex);
|
||||
|
||||
if (!threadItem) menuItem->Flags |= PH_EMENU_DISABLED;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#define ID_PROCESS_UNLOADEDMODULES 101
|
||||
#define IDD_UNLOADEDDLLS 101
|
||||
#define IDD_OBJALPCPORT 102
|
||||
#define ID_THREAD_CANCELIO 102
|
||||
#define IDD_OBJTPWORKERFACTORY 103
|
||||
#define IDC_LIST 1001
|
||||
#define IDC_REFRESH 1002
|
||||
#define IDC_SEQUENCENUMBER 1003
|
||||
#define IDC_PORTCONTEXT 1004
|
||||
#define IDC_WORKERTHREADSTART 1005
|
||||
#define IDC_WORKERTHREADSTART2 1006
|
||||
#define IDC_WORKERTHREADCONTEXT 1006
|
||||
|
||||
// Next default values for new objects
|
||||
@@ -21,6 +21,6 @@
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1006
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Process Hacker Extended Tools -
|
||||
* thread actions extensions
|
||||
*
|
||||
* Copyright (C) 2010 wj32
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "extendedtools.h"
|
||||
#include "resource.h"
|
||||
|
||||
BOOLEAN EtUiCancelIoThread(
|
||||
__in HWND hWnd,
|
||||
__in PPH_THREAD_ITEM Thread
|
||||
)
|
||||
{
|
||||
NTSTATUS status;
|
||||
BOOLEAN cont = FALSE;
|
||||
HANDLE threadHandle;
|
||||
IO_STATUS_BLOCK isb;
|
||||
|
||||
if (!PhGetIntegerSetting(L"EnableWarnings") || PhShowConfirmMessage(
|
||||
hWnd,
|
||||
L"end",
|
||||
L"I/O for the selected thread",
|
||||
NULL,
|
||||
FALSE
|
||||
))
|
||||
cont = TRUE;
|
||||
|
||||
if (!cont)
|
||||
return FALSE;
|
||||
|
||||
if (NT_SUCCESS(status = PhOpenThread(&threadHandle, THREAD_TERMINATE, Thread->ThreadId)))
|
||||
{
|
||||
status = NtCancelSynchronousIoFile(threadHandle, NULL, &isb);
|
||||
}
|
||||
|
||||
if (status == STATUS_NOT_FOUND)
|
||||
{
|
||||
PhShowInformation(hWnd, L"There is no synchronous I/O to cancel.");
|
||||
return FALSE;
|
||||
}
|
||||
else if (!NT_SUCCESS(status))
|
||||
{
|
||||
PhShowStatus(hWnd, L"Unable to cancel synchronous I/O", status, 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user