<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.str
        {mso-style-name:str;}
span.skimlinks-unlinked
        {mso-style-name:skimlinks-unlinked;}
span.kwrd
        {mso-style-name:kwrd;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">There are plenty of online resources available, e.g.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><a href="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">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</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Rudy Velthuis has some good resources, including this page
<a href="http://rvelthuis.de/programs/convertpack.html">http://rvelthuis.de/programs/convertpack.html</a> which lays out the steps required.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">HTH<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">David<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td width="357" valign="top" style="width:267.65pt;padding:0cm 5.4pt 0cm 5.4pt">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F">David Moorhouse (BCom)</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F"> |
<b>Principal Software Engineer - HealthOne</b><br>
Pegasus Health (Charitable) Ltd </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F">P: 03 353 0871 | W: </span><span style="color:#1F497D"><a href="http://www.pegasus.org.nz/"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F">www.pegasus.org.nz</span></a></span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F"> <br>
E: </span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D"><a href="mailto:david.moorhouse@pegasus.org.nz">david.moorhouse@pegasus.org.nz</a></span><u><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F"><br>
</span></u><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#47678F">PO Box 741, Christchurch 8140<br>
160 Bealey Ave, Christchurch 8014</span><b><span style="color:#47678F;mso-fareast-language:EN-US"><o:p></o:p></span></b></p>
</td>
<td width="259" valign="top" style="width:194.45pt;padding:0cm 5.4pt 0cm 5.4pt">
<p class="MsoNormal"><span style="color:#1F497D"><img border="0" width="240" height="76" id="Picture_x0020_1" src="cid:image001.jpg@01D22075.50B9C4E0" alt="cid:image003.jpg@01CEE516.6F544D00"></span><b><span style="color:#47678F;mso-fareast-language:EN-US"><o:p></o:p></span></b></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> delphi-bounces@listserver.123.net.nz [mailto:delphi-bounces@listserver.123.net.nz]
<b>On Behalf Of </b>Ross Levis<br>
<b>Sent:</b> Thursday, 6 October 2016 11:13 p.m.<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> Re: [DUG] NtSetInformationProcess<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> [DllImport(</span><span style="font-size:9.0pt;font-family:Consolas;color:#006080">"ntdll.dll"</span><span style="font-size:9.0pt;font-family:Consolas;color:black">,
SetLastError = </span><span style="font-size:9.0pt;font-family:Consolas;color:blue">true</span><span style="font-size:9.0pt;font-family:Consolas;color:black">)]<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">public</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">static</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">extern</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> NtSetInformationProcess(IntPtr processHandle,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> PROCESS_INFORMATION_CLASS processInformationClass,
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">ref</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> IntPtr processInformation,
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">uint</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> processInformationLength);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">enum</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> IOPriority :
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">uint</span><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> VeryLow = 0,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> Low = 1,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> Normal = 2,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">static</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> SetIOPriority(IntPtr hProcess, IOPriority newPrio)<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> IntPtr ioPrio = (IntPtr) newPrio;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> lret= NtSetInformationProcess(hProcess, PROCESS_INFORMATION_CLASS.ProcessIoPriority,
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">ref</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> ioPrio, 4);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:blue">return</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> lret;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-size:9.0pt;font-family:Consolas;color:black">ProcessIOPriority is a constant with the value 21.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Many thanks,<br>
Ross.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Ross Levis [<a href="mailto:ross@stationplaylist.com">mailto:ross@stationplaylist.com</a>]
<br>
<b>Sent:</b> Thursday, 6 October 2016 4:48 p.m.<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> NtSetInformationProcess<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Note this is not a Process or Thread Priority.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Ross.<o:p></o:p></span></p>
</div>
<img src="http://snow.pegasus.org.nz/wp-content/uploads/2016/10/moving_footer.jpg">
<P><FONT color=#47678f size=2
face=Arial>*****************************************************</FONT></P>
<P><FONT color=#47678f size=2 face=Arial>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.</FONT></P>
<P><FONT color=#47678f size=2 face=Arial>Any views or opinions expressed in this
email (unless otherwise stated) may not represent those of Pegasus Health
Ltd.</FONT></P>
<P><FONT color=#47678f size=2
face=Arial>**********************************************************</FONT></P>
</body>
</html>