mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
fixed incorrect alignment specifications when probing
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3946 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
build -cZ
|
||||
build -cZ dirty
|
||||
if not %errorlevel%==0 goto end
|
||||
copy bin\i386\kprocesshacker.sys ..\bin\Release32\
|
||||
copy bin\i386\kprocesshacker.pdb ..\bin\Release32\
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -42,6 +42,11 @@ VOID KphDynamicImport(
|
||||
PsIsProtectedProcess_I = KphGetSystemRoutineAddress(L"PsIsProtectedProcess");
|
||||
PsResumeProcess_I = KphGetSystemRoutineAddress(L"PsResumeProcess");
|
||||
PsSuspendProcess_I = KphGetSystemRoutineAddress(L"PsSuspendProcess");
|
||||
|
||||
dprintf("ObGetObjectType: 0x%Ix\n", ObGetObjectType_I);
|
||||
dprintf("PsIsProtectedProcess: 0x%Ix\n", PsIsProtectedProcess_I);
|
||||
dprintf("PsResumeProcess: 0x%Ix\n", PsResumeProcess_I);
|
||||
dprintf("PsSuspendProcess: 0x%Ix\n", PsSuspendProcess_I);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1021,9 +1021,21 @@ NTSTATUS KpiSetInformationObject(
|
||||
|
||||
if (AccessMode != KernelMode)
|
||||
{
|
||||
ULONG alignment;
|
||||
|
||||
switch (ObjectInformationClass)
|
||||
{
|
||||
case KphObjectHandleFlagInformation:
|
||||
alignment = sizeof(BOOLEAN);
|
||||
break;
|
||||
default:
|
||||
alignment = sizeof(ULONG);
|
||||
break;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
ProbeForRead(ObjectInformation, ObjectInformationLength, sizeof(ULONG));
|
||||
ProbeForRead(ObjectInformation, ObjectInformationLength, alignment);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
@@ -515,9 +515,21 @@ NTSTATUS KpiQueryInformationProcess(
|
||||
|
||||
if (AccessMode != KernelMode)
|
||||
{
|
||||
ULONG alignment;
|
||||
|
||||
switch (ProcessInformationClass)
|
||||
{
|
||||
case KphProcessProtectionInformation:
|
||||
alignment = sizeof(KPH_PROCESS_PROTECTION_INFORMATION);
|
||||
break;
|
||||
default:
|
||||
alignment = sizeof(ULONG);
|
||||
break;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
ProbeForWrite(ProcessInformation, ProcessInformationLength, sizeof(ULONG));
|
||||
ProbeForWrite(ProcessInformation, ProcessInformationLength, alignment);
|
||||
|
||||
if (ReturnLength)
|
||||
ProbeForWrite(ReturnLength, sizeof(ULONG), sizeof(ULONG));
|
||||
@@ -561,21 +573,24 @@ NTSTATUS KpiQueryInformationProcess(
|
||||
status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (ProcessInformationLength == sizeof(KPH_PROCESS_PROTECTION_INFORMATION))
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
__try
|
||||
if (ProcessInformationLength == sizeof(KPH_PROCESS_PROTECTION_INFORMATION))
|
||||
{
|
||||
((PKPH_PROCESS_PROTECTION_INFORMATION)ProcessInformation)->IsProtectedProcess = protectedProcess;
|
||||
__try
|
||||
{
|
||||
((PKPH_PROCESS_PROTECTION_INFORMATION)ProcessInformation)->IsProtectedProcess = protectedProcess;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
status = GetExceptionCode();
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
else
|
||||
{
|
||||
status = GetExceptionCode();
|
||||
status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
returnLength = sizeof(KPH_PROCESS_PROTECTION_INFORMATION);
|
||||
}
|
||||
@@ -679,9 +694,21 @@ NTSTATUS KpiSetInformationProcess(
|
||||
|
||||
if (AccessMode != KernelMode)
|
||||
{
|
||||
ULONG alignment;
|
||||
|
||||
switch (ProcessInformationClass)
|
||||
{
|
||||
case KphProcessProtectionInformation:
|
||||
alignment = sizeof(KPH_PROCESS_PROTECTION_INFORMATION);
|
||||
break;
|
||||
default:
|
||||
alignment = sizeof(ULONG);
|
||||
break;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
ProbeForRead(ProcessInformation, ProcessInformationLength, sizeof(ULONG));
|
||||
ProbeForRead(ProcessInformation, ProcessInformationLength, alignment);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user