<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 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@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";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.str
        {mso-style-name:str;}
span.skimlinks-unlinked
        {mso-style-name:skimlinks-unlinked;}
span.kwrd
        {mso-style-name:kwrd;}
.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='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 [mailto:ross@stationplaylist.com] <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></body></html>