I have found code in C++ but I'm not good with dynamically loading DLLs to
access a function pointer. Can someone please help me translate this for
Delphi.
[DllImport("ntdll.dll", SetLastError = true)]
public static extern int NtSetInformationProcess(IntPtr processHandle,
PROCESS_INFORMATION_CLASS processInformationClass, ref IntPtr
processInformation, uint processInformationLength);
enum IOPriority : uint
{
VeryLow = 0,
Low = 1,
Normal = 2,
}
static int SetIOPriority(IntPtr hProcess, IOPriority newPrio)
{
IntPtr ioPrio = (IntPtr) newPrio;
int lret= NtSetInformationProcess(hProcess,
PROCESS_INFORMATION_CLASS.ProcessIoPriority, ref ioPrio, 4);
return lret;
}
ProcessIOPriority is a constant with the value 21.
Many thanks,
Ross.
From: Ross Levis [mailto:[email protected]]
Sent: Thursday, 6 October 2016 4:48 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: NtSetInformationProcess
Can anyone provide the definition for accessing this Windows function. It
doesn't exist in Windows.pas in Delphi 7. I guess it's in kernel32.dll.
There seems to be some issue with my app inheriting a "Low" I/O priority
after a recent Windows 10 update and causing lots of issues with my
customers. I want to try to set it to Normal.
Note this is not a Process or Thread Priority.
Cheers,
Ross.
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with
Subject: unsubscribe