mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
made PPH_IS_DOT_NET_CONTEXT a hashtable
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3601 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -1206,7 +1206,7 @@ BOOLEAN PhUiDetachFromDebuggerProcess(
|
||||
|
||||
// Disable kill-on-close.
|
||||
flags = 0;
|
||||
status = NtSetInformationDebugObject(
|
||||
NtSetInformationDebugObject(
|
||||
debugObjectHandle,
|
||||
DebugObjectFlags,
|
||||
&flags,
|
||||
|
||||
@@ -1001,8 +1001,10 @@ VOID PhpFillProcessItem(
|
||||
|
||||
if (WINDOWS_HAS_IMAGE_FILE_NAME_BY_PROCESS_ID)
|
||||
status = PhGetProcessImageFileNameByProcessId(ProcessItem->ProcessId, &fileName);
|
||||
else
|
||||
else if (processHandle)
|
||||
status = PhGetProcessImageFileName(processHandle, &fileName);
|
||||
else
|
||||
status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
@@ -1062,12 +1064,10 @@ VOID PhpFillProcessItem(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ProcessItem->ProcessId == SYSTEM_IDLE_PROCESS_ID)
|
||||
{
|
||||
PhReferenceObject(PhLocalSystemName);
|
||||
ProcessItem->UserName = PhLocalSystemName;
|
||||
}
|
||||
else if (ProcessItem->ProcessId == SYSTEM_PROCESS_ID) // System token can't be opened on XP
|
||||
if (
|
||||
ProcessItem->ProcessId == SYSTEM_IDLE_PROCESS_ID ||
|
||||
ProcessItem->ProcessId == SYSTEM_PROCESS_ID // System token can't be opened on XP
|
||||
)
|
||||
{
|
||||
PhReferenceObject(PhLocalSystemName);
|
||||
ProcessItem->UserName = PhLocalSystemName;
|
||||
@@ -1356,7 +1356,7 @@ VOID PhProcessProviderUpdate(
|
||||
PhRefreshDosDevicePrefixes();
|
||||
}
|
||||
|
||||
if (runCount % 10 == 1)
|
||||
if (runCount % 15 == 1)
|
||||
{
|
||||
if (PhpIsDotNetContext)
|
||||
{
|
||||
|
||||
@@ -882,11 +882,7 @@ NTSTATUS PhGetProcessIsDotNet(
|
||||
|
||||
#define PH_IS_DOT_NET_VERSION_4 0x1
|
||||
|
||||
typedef struct _PH_IS_DOT_NET_CONTEXT
|
||||
{
|
||||
PPH_LIST ProcessIdList;
|
||||
PPH_LIST FlagsList;
|
||||
} PH_IS_DOT_NET_CONTEXT, *PPH_IS_DOT_NET_CONTEXT;
|
||||
typedef PPH_HASHTABLE PPH_IS_DOT_NET_CONTEXT;
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS PhCreateIsDotNetContext(
|
||||
|
||||
+14
-18
@@ -5437,8 +5437,7 @@ BOOLEAN NTAPI PhpCreateIsDotNetContextCallback(
|
||||
|
||||
if (PhStringToInteger64(&name, 10, &processId))
|
||||
{
|
||||
PhAddItemList(context->ProcessIdList, UlongToHandle((ULONG)processId));
|
||||
PhAddItemList(context->FlagsList, (PVOID)flags);
|
||||
PhAddItemSimpleHashtable(context, UlongToHandle((ULONG)processId), (PVOID)flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5458,9 +5457,7 @@ NTSTATUS PhCreateIsDotNetContext(
|
||||
PH_STRINGREF defaultDirectoryName;
|
||||
ULONG i;
|
||||
|
||||
isDotNetContext = PhAllocate(sizeof(PH_IS_DOT_NET_CONTEXT));
|
||||
isDotNetContext->ProcessIdList = PhCreateList(4);
|
||||
isDotNetContext->FlagsList = PhCreateList(4);
|
||||
isDotNetContext = PhCreateSimpleHashtable(8);
|
||||
|
||||
if (!DirectoryNames || NumberOfDirectoryNames == 0)
|
||||
{
|
||||
@@ -5505,9 +5502,7 @@ VOID PhFreeIsDotNetContext(
|
||||
__inout PPH_IS_DOT_NET_CONTEXT IsDotNetContext
|
||||
)
|
||||
{
|
||||
PhDereferenceObject(IsDotNetContext->ProcessIdList);
|
||||
PhDereferenceObject(IsDotNetContext->FlagsList);
|
||||
PhFree(IsDotNetContext);
|
||||
PhDereferenceObject(IsDotNetContext);
|
||||
}
|
||||
|
||||
BOOLEAN PhGetProcessIsDotNetFromContext(
|
||||
@@ -5516,20 +5511,21 @@ BOOLEAN PhGetProcessIsDotNetFromContext(
|
||||
__out_opt PULONG Flags
|
||||
)
|
||||
{
|
||||
ULONG i;
|
||||
PPVOID item;
|
||||
|
||||
for (i = 0; i < IsDotNetContext->ProcessIdList->Count; i++)
|
||||
item = PhFindItemSimpleHashtable(IsDotNetContext, ProcessId);
|
||||
|
||||
if (item)
|
||||
{
|
||||
if (IsDotNetContext->ProcessIdList->Items[i] == ProcessId)
|
||||
{
|
||||
if (Flags)
|
||||
*Flags = (ULONG)IsDotNetContext->FlagsList->Items[i];
|
||||
if (Flags)
|
||||
*Flags = (ULONG)*item;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user