<div dir="ltr">Hi Vincent,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 23, 2018 at 4:11 PM,  <span dir="ltr"><<a href="mailto:Vincent.Blondeau@lamresearch.com" target="_blank">Vincent.Blondeau@lamresearch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br>





<div lang="EN-US">
<div class="gmail-m_6315257302318273854WordSection1">
<p class="MsoNormal">Hi Eliot,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><b>From:</b> Vm-dev [mailto:<a href="mailto:vm-dev-bounces@lists.squeakfoundation.org" target="_blank">vm-dev-bounces@lists.<wbr>squeakfoundation.org</a>]
<b>On Behalf Of </b>Eliot Miranda<br>
<b>Sent:</b> Monday, April 23, 2018 13:33<br>
<b>To:</b> Open Smalltalk Virtual Machine Development Discussion <<a href="mailto:vm-dev@lists.squeakfoundation.org" target="_blank">vm-dev@lists.<wbr>squeakfoundation.org</a>><br>
<b>Subject:</b> Re: [Vm-dev] Raise minimum supported Windows API from XP to Vista (was: Identify console executable and standard one)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">Hi Alistair,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">On Mon, Apr 23, 2018 at 1:06 PM, Alistair Grant <<a href="mailto:akgrant0710@gmail.com" target="_blank">akgrant0710@gmail.com</a>><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> Hi Eliot & Vincent,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> On Mon, Apr 23, 2018 at 10:00:12AM -0700, Eliot Miranda wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > Hi Alistair,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > On Apr 23, 2018, at 2:46 AM, Alistair Grant <<a href="mailto:akgrant0710@gmail.com" target="_blank">akgrant0710@gmail.com</a>><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > Hi Everyone,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > I have some test code that correctly identifies whether stdin on<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> Windows<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > is a console or redirected, in both windows command terminals (cmd.exe)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > and cygwin mintty (the current code only works for cmd.exe, not for<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > cygwin terminals).<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > However it relies on the Windows Vista API, i.e. _WIN32_WINNT >=<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > 0x0600, and at the moment we set the minimum supported version to<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > Windows XP (0x0501).<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > Since Windows XP is no longer supported, I can't see any problem with<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > raising the minimum version to Windows Vista (which also isn't<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > supported, but should give us maximum compatibility), but wanted to<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > check first.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > Are there any objections to raising the minimum API level to Windows<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > > Vista?<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> ><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > Not from me.  But it would be nice if the resulting executable still<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > ran in Windows NT.  Is that still possible?  What does the code look<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> > like?<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> If we make this change I think the chances of it working on NT are next<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> to zero.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> Actually, I'd be surprised if the current VM ran on NT since it is<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> explicitly asking for the XP API, but I haven't tested it.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> The code is available at:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__fossies.org_linux_misc_vim-2D8.0.tar.bz2_vim80_src_iscygpty.c&d=DwIBaQ&c=RWI7EqL8K9lqtga8KxgfzvOYoob76EZWE0yAO85PVMQ&r=kIZIYXBAA3fhM7P5HOuTC5w6mnEApTfXPTq3lR34ZiY&m=oPgRLf_qAaa4HRKiutXLr1xXOa8SzpEcef72bohSLbU&s=mkWFs166cLTuhJuXteRsf0YR1UetLXCU4lbr9L-ztdY&e=" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__<wbr>fossies.org_linux_misc_vim-<wbr>2D8.0.tar.bz2_vim80_src_<wbr>iscygpty.c&d=DwIBaQ&c=<wbr>RWI7EqL8K9lqtga8KxgfzvOYoob76E<wbr>ZWE0yAO85PVMQ&r=<wbr>kIZIYXBAA3fhM7P5HOuTC5w6mnEApT<wbr>fXPTq3lR34ZiY&m=oPgRLf_<wbr>qAaa4HRKiutXLr1xXOa8SzpEcef72b<wbr>ohSLbU&s=<wbr>mkWFs166cLTuhJuXteRsf0YR1UetLX<wbr>CU4lbr9L-ztdY&e=</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__fossies.org_linux_misc_vim-2D8.0.tar.bz2_vim80_src_iscygpty.h&d=DwIBaQ&c=RWI7EqL8K9lqtga8KxgfzvOYoob76EZWE0yAO85PVMQ&r=kIZIYXBAA3fhM7P5HOuTC5w6mnEApTfXPTq3lR34ZiY&m=oPgRLf_qAaa4HRKiutXLr1xXOa8SzpEcef72bohSLbU&s=C9f7RvD0S_OxvWZFF8Md_6nmuANHrD3WPtoUghrAahE&e=" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__<wbr>fossies.org_linux_misc_vim-<wbr>2D8.0.tar.bz2_vim80_src_<wbr>iscygpty.h&d=DwIBaQ&c=<wbr>RWI7EqL8K9lqtga8KxgfzvOYoob76E<wbr>ZWE0yAO85PVMQ&r=<wbr>kIZIYXBAA3fhM7P5HOuTC5w6mnEApT<wbr>fXPTq3lR34ZiY&m=oPgRLf_<wbr>qAaa4HRKiutXLr1xXOa8SzpEcef72b<wbr>ohSLbU&s=C9f7RvD0S_OxvWZFF8Md_<wbr>6nmuANHrD3WPtoUghrAahE&e=</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">So if you look at lines 60 through 101 you'll see the standard technique<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">for getting around the version issue:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   60 //#define USE_DYNFILEID<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   61 #ifdef USE_DYNFILEID<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   62 typedef BOOL (WINAPI *<wbr>pfnGetFileInformationByHandleE<wbr>x)(<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   63         HANDLE                    hFile,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   64         FILE_INFO_BY_HANDLE_CLASS FileInformationClass,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   65         LPVOID                    lpFileInformation,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   66         DWORD                     dwBufferSize<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   67 );<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   68 static pfnGetFileInformationByHandleE<wbr>x pGetFileInformationByHandleEx<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">= NULL;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   69<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   70 # ifndef USE_FILEEXTD<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   71 static BOOL WINAPI stub_<wbr>GetFileInformationByHandleEx(<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   72         HANDLE                    hFile,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   73         FILE_INFO_BY_HANDLE_CLASS FileInformationClass,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   74         LPVOID                    lpFileInformation,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   75         DWORD                     dwBufferSize<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   76         )<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   77 {<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   78     return FALSE;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   79 }<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   80 # endif<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   81<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   82 static void setup_fileid_api(void)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   83 {<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   84     if (pGetFileInformationByHandleEx != NULL) {<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   85         return;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   86     }<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   87     pGetFileInformationByHandleEx = (<wbr>pfnGetFileInformationByHandleE<wbr>x)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   88         GetProcAddress(<wbr>GetModuleHandle(TEXT("<wbr>kernel32.dll")),<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   89                 "GetFileInformationByHandleEx"<wbr>);<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   90     if (pGetFileInformationByHandleEx == NULL) {<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   91 # ifdef USE_FILEEXTD<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   92         pGetFileInformationByHandleEx = GetFileInformationByHandleEx;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   93 # else<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   94         pGetFileInformationByHandleEx =<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">stub_<wbr>GetFileInformationByHandleEx;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   95 # endif<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   96     }<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   97 }<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   98 #else<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">   99 # define pGetFileInformationByHandleEx  GetFileInformationByHandleEx<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">  100 # define setup_fileid_api()<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">  101 #endif<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">If USE_DYNFILEID is defined then the code searches kernel32.dll and uses<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">the function if found.  So the safe way to write this is to follow the<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">approach given by USE_DYNFILEID (no need to implement setup_fileid_api; all<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">thats needed is the statements therefore prepended to the use of<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">pGetFileInformationByHandleEx)<wbr>.  If GetFileInformationByHandleEx exists in<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">kernel32.dll use it, otherwise fall back on our existing code.  That way we<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">should be able to keep the Windows XP build level.  People still use it a<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">lot (especially students in poor countries) and I'd rather wait until we<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">can jump forward beyond Vista to make the change ;-) ;-) ;-)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">Does that make sense?  You'll see some of this code in the win32 subsystem<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">already; gre p GetProcAddress  platforms/win32/vm/*<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">platforms/win32/plugins/*/*<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It does make sense. But, it is not possible anymore to compile with Cygwin in this case: some structures like FILE_BASIC_INFO, FILE_INFO_BY_HANDLE_CLASS are not defined if the Windows version is before 0x0600 (see winbase.h:2641).</p></div></div></blockquote><div><br></div><div>No problem; one simply steals the Microsoft define from the Vista header and includes it verbatim,  e.g. see NOTIFYICONDATA in platforms/win32/vm/sqWin32.h.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_6315257302318273854WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">And in the Windows 10 version of Cygwin, fileExt.h, which should contains the definitions for the XP version, is just an empty stub.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Then, should we change: <u></u><u></u></p>
<p class="MsoNormal">WINVER:=-D_WIN32_WINNT=0x0501 -DWINVER=0x0501<u></u><u></u></p>
<p class="MsoNormal">to:<u></u><u></u></p>
<p class="MsoNormal">WINVER:=-D_WIN32_WINNT=0x0600 -DWINVER=0x0600<u></u><u></u></p>
<p class="MsoNormal">In Makefile.tools, knowing that the dependencies are still compatible?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Or should be add the fileExt.h XP version in the dependencies?</p></div></div></blockquote><div><br></div><div>No.  We simply define the necessary types verbatim.  Look at sqWin32.h for the pattern:</div><div><br></div><div><div>/****************************************************************************/</div><div>/* few addtional definitions for those having older include files           */</div><div>/****************************************************************************/</div><div>#if (WINVER < 0x0400) && !defined(_GNU_H_WINDOWS_H)</div></div><div>...</div><div>defines</div><div>#endif</div><div></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">In this case we should just use #if WINVER < 0x0600, right?</div><br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>