[NTOS:PS] query.c: Improve some DPRINTs and comments

This commit is contained in:
Hermès Bélusca-Maïto
2025-08-19 14:02:52 +02:00
parent 991c57a93b
commit 47b92973a9

View File

@@ -70,7 +70,7 @@ NtQueryInformationProcess(
PAGED_CODE();
/* Verify Information Class validity */
/* Validate the information class */
Status = DefaultQueryInfoBufferCheck(ProcessInformationClass,
PsProcessInfoClass,
RTL_NUMBER_OF(PsProcessInfoClass),
@@ -82,7 +82,8 @@ NtQueryInformationProcess(
PreviousMode);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtQueryInformationProcess(): Information verification class failed! (Status -> 0x%lx, ProcessInformationClass -> %lx)\n", Status, ProcessInformationClass);
DPRINT1("NtQueryInformationProcess(ProcessInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
ProcessInformationClass, Status);
return Status;
}
@@ -112,7 +113,7 @@ NtQueryInformationProcess(
break;
}
/* Set return length */
/* Set the return length */
Length = sizeof(PROCESS_BASIC_INFORMATION);
/* Reference the process */
@@ -163,7 +164,7 @@ NtQueryInformationProcess(
break;
}
/* Set return length */
/* Set the return length */
Length = ProcessInformationLength;
Extended = (Length == sizeof(QUOTA_LIMITS_EX));
@@ -337,7 +338,7 @@ NtQueryInformationProcess(
break;
}
/* Set return length */
/* Set the return length */
Length = sizeof(HANDLE);
/* Reference the process */
@@ -708,7 +709,7 @@ NtQueryInformationProcess(
Status = SeLocateProcessImageName(Process, &ImageName);
if (NT_SUCCESS(Status))
{
/* Set return length */
/* Set the return length */
Length = ImageName->MaximumLength +
sizeof(OBJECT_NAME_INFORMATION);
@@ -925,7 +926,7 @@ NtQueryInformationProcess(
Cookie);
if (!Cookie) Cookie = NewCookie;
/* Set return length */
/* Set the return length */
Length = sizeof(ULONG);
}
@@ -1023,7 +1024,7 @@ NtQueryInformationProcess(
}
case ProcessHandleTracing:
DPRINT1("Handle tracing Not implemented: %lx\n", ProcessInformationClass);
DPRINT1("Handle tracing not implemented: %lu\n", ProcessInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
break;
@@ -1102,7 +1103,7 @@ NtQueryInformationProcess(
break;
}
/* Set return length */
/* Set the return length */
Length = sizeof(ULONG_PTR);
/* Reference the process */
@@ -1153,7 +1154,7 @@ NtQueryInformationProcess(
break;
}
/* Set return length */
/* Set the return length */
Length = sizeof(ULONG);
if (ProcessHandle != NtCurrentProcess())
@@ -1183,23 +1184,23 @@ NtQueryInformationProcess(
}
case ProcessLdtInformation:
DPRINT1("VDM/16-bit not implemented: %lx\n", ProcessInformationClass);
DPRINT1("VDM/16-bit not implemented: %lu\n", ProcessInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
break;
case ProcessWorkingSetWatch:
DPRINT1("WS Watch Not implemented: %lx\n", ProcessInformationClass);
DPRINT1("WS Watch not implemented: %lu\n", ProcessInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
break;
case ProcessPooledUsageAndLimits:
DPRINT1("Pool limits Not implemented: %lx\n", ProcessInformationClass);
DPRINT1("Pool limits not implemented: %lu\n", ProcessInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
break;
/* Not supported by Server 2003 */
default:
DPRINT1("Unsupported info class: %lx\n", ProcessInformationClass);
DPRINT1("Unsupported info class: %lu\n", ProcessInformationClass);
Status = STATUS_INVALID_INFO_CLASS;
}
@@ -1257,7 +1258,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
PETHREAD Thread;
PAGED_CODE();
/* Verify Information Class validity */
/* Validate the information class */
Status = DefaultSetInfoBufferCheck(ProcessInformationClass,
PsProcessInfoClass,
RTL_NUMBER_OF(PsProcessInfoClass),
@@ -1266,7 +1267,8 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
PreviousMode);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetInformationProcess(): Information verification class failed! (Status -> 0x%lx, ProcessInformationClass -> %lx)\n", Status, ProcessInformationClass);
DPRINT1("NtSetInformationProcess(ProcessInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
ProcessInformationClass, Status);
return Status;
}
@@ -1694,7 +1696,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
if (!HasPrivilege)
{
ObDereferenceObject(Process);
DPRINT1("Privilege to change priority from %lx to %lx lacking\n", BasePriority, Process->Pcb.BasePriority);
DPRINT1("Privilege to change priority from %lx to %lx lacking\n", Process->Pcb.BasePriority, BasePriority);
return STATUS_PRIVILEGE_NOT_HELD;
}
}
@@ -2102,7 +2104,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
case ProcessLdtInformation:
case ProcessLdtSize:
case ProcessIoPortHandlers:
DPRINT1("VDM/16-bit Request not implemented: %lx\n", ProcessInformationClass);
DPRINT1("VDM/16-bit Request not implemented: %lu\n", ProcessInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
break;
@@ -2127,7 +2129,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
/* Anything else is invalid */
default:
DPRINT1("Invalid Server 2003 Info Class: %lx\n", ProcessInformationClass);
DPRINT1("Invalid Server 2003 Info Class: %lu\n", ProcessInformationClass);
Status = STATUS_INVALID_INFO_CLASS;
}
@@ -2164,7 +2166,7 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
BOOLEAN HasPrivilege;
PAGED_CODE();
/* Verify Information Class validity */
/* Validate the information class */
Status = DefaultSetInfoBufferCheck(ThreadInformationClass,
PsThreadInfoClass,
RTL_NUMBER_OF(PsThreadInfoClass),
@@ -2173,7 +2175,8 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
PreviousMode);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetInformationThread(): Information verification class failed! (Status -> 0x%lx, ThreadInformationClass -> %lx)\n", Status, ThreadInformationClass);
DPRINT1("NtSetInformationThread(ThreadInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
ThreadInformationClass, Status);
return Status;
}
@@ -2733,9 +2736,10 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
ObDereferenceObject(Thread);
break;
/* Anything else */
default:
/* We don't implement it yet */
DPRINT1("Not implemented: %d\n", ThreadInformationClass);
/* Not yet implemented */
DPRINT1("Not implemented: %lu\n", ThreadInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
}
@@ -2765,7 +2769,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
ULONG ThreadTerminated;
PAGED_CODE();
/* Verify Information Class validity */
/* Validate the information class */
Status = DefaultQueryInfoBufferCheck(ThreadInformationClass,
PsThreadInfoClass,
RTL_NUMBER_OF(PsThreadInfoClass),
@@ -2777,7 +2781,8 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
PreviousMode);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtQueryInformationThread(): Information verification class failed! (Status -> 0x%lx , ThreadInformationClass -> %lx)\n", Status, ThreadInformationClass);
DPRINT1("NtQueryInformationThread(ThreadInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
ThreadInformationClass, Status);
return Status;
}
@@ -2790,7 +2795,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
/* Basic thread information */
case ThreadBasicInformation:
/* Set return length */
/* Set the return length */
Length = sizeof(THREAD_BASIC_INFORMATION);
if (ThreadInformationLength != Length)
@@ -2799,7 +2804,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -2843,7 +2848,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -2893,7 +2898,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -2931,7 +2936,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -2969,7 +2974,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -3011,7 +3016,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -3048,7 +3053,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
case ThreadDescriptorTableEntry:
#if defined(_X86_)
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -3083,7 +3088,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -3118,7 +3123,7 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
break;
}
/* Reference the process */
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
@@ -3146,9 +3151,8 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
/* Anything else */
default:
/* Not yet implemented */
DPRINT1("Not implemented: %lx\n", ThreadInformationClass);
DPRINT1("Not implemented: %lu\n", ThreadInformationClass);
Status = STATUS_NOT_IMPLEMENTED;
}