[DUG] NtSetInformationProcess
David Moorhouse
David.Moorhouse at pegasus.org.nz
Fri Oct 7 08:32:18 NZDT 2016
There are plenty of online resources available, e.g.
https://www.google.co.nz/search?q=c%2B%2B+headers+to+delphi&ie=utf-8&oe=utf-8&client=firefox-b-ab&gfe_rd=cr&ei=Kqb2V7CDHdLu8wfJmbLwAQ
Rudy Velthuis has some good resources, including this page http://rvelthuis.de/programs/convertpack.html which lays out the steps required.
HTH
David
David Moorhouse (BCom) | Principal Software Engineer - HealthOne
Pegasus Health (Charitable) Ltd
P: 03 353 0871 | W: www.pegasus.org.nz<http://www.pegasus.org.nz/>
E: david.moorhouse at pegasus.org.nz<mailto:david.moorhouse at pegasus.org.nz>
PO Box 741, Christchurch 8140
160 Bealey Ave, Christchurch 8014
[cid:image003.jpg at 01CEE516.6F544D00]
From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Ross Levis
Sent: Thursday, 6 October 2016 11:13 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] NtSetInformationProcess
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:ross at stationplaylist.com]
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.
[http://snow.pegasus.org.nz/wp-content/uploads/2016/10/moving_footer.jpg]
********************************************************************************
This email or attachment(s) may contain confidential or legally privileged
information intended for the sole use of the addressee(s). Any use, redistribution,
disclosure, or reproduction of this message, except as intended, is prohibited.
If you received this email in error, please notify the sender and erase all
copies of the message, including any attachments.
Any views or opinions expressed in this email (unless otherwise stated) may not
represent those of Pegasus Health Ltd.
********************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20161006/25ebec2a/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3614 bytes
Desc: image001.jpg
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20161006/25ebec2a/attachment-0001.jpg
More information about the Delphi
mailing list