Hi Alistair,
On Mon, Apr 23, 2018 at 1:06 PM, Alistair Grant akgrant0710@gmail.com wrote:
Hi Eliot & Vincent,
On Mon, Apr 23, 2018 at 10:00:12AM -0700, Eliot Miranda wrote:
Hi Alistair,
On Apr 23, 2018, at 2:46 AM, Alistair Grant akgrant0710@gmail.com
wrote:
Hi Everyone,
I have some test code that correctly identifies whether stdin on
Windows
is a console or redirected, in both windows command terminals (cmd.exe) and cygwin mintty (the current code only works for cmd.exe, not for cygwin terminals).
However it relies on the Windows Vista API, i.e. _WIN32_WINNT >= 0x0600, and at the moment we set the minimum supported version to Windows XP (0x0501).
Since Windows XP is no longer supported, I can't see any problem with raising the minimum version to Windows Vista (which also isn't supported, but should give us maximum compatibility), but wanted to check first.
Are there any objections to raising the minimum API level to Windows Vista?
Not from me. But it would be nice if the resulting executable still ran in Windows NT. Is that still possible? What does the code look like?
If we make this change I think the chances of it working on NT are next to zero.
Actually, I'd be surprised if the current VM ran on NT since it is explicitly asking for the XP API, but I haven't tested it.
The code is available at:
https://fossies.org/linux/misc/vim-8.0.tar.bz2/vim80/src/iscygpty.c https://fossies.org/linux/misc/vim-8.0.tar.bz2/vim80/src/iscygpty.h
So if you look at lines 60 through 101 you'll see the standard technique for getting around the version issue:
60 //#define USE_DYNFILEID 61 #ifdef USE_DYNFILEID 62 typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( 63 HANDLE hFile, 64 FILE_INFO_BY_HANDLE_CLASS FileInformationClass, 65 LPVOID lpFileInformation, 66 DWORD dwBufferSize 67 ); 68 static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; 69 70 # ifndef USE_FILEEXTD 71 static BOOL WINAPI stub_GetFileInformationByHandleEx( 72 HANDLE hFile, 73 FILE_INFO_BY_HANDLE_CLASS FileInformationClass, 74 LPVOID lpFileInformation, 75 DWORD dwBufferSize 76 ) 77 { 78 return FALSE; 79 } 80 # endif 81 82 static void setup_fileid_api(void) 83 { 84 if (pGetFileInformationByHandleEx != NULL) { 85 return; 86 } 87 pGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx) 88 GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), 89 "GetFileInformationByHandleEx"); 90 if (pGetFileInformationByHandleEx == NULL) { 91 # ifdef USE_FILEEXTD 92 pGetFileInformationByHandleEx = GetFileInformationByHandleEx; 93 # else 94 pGetFileInformationByHandleEx = stub_GetFileInformationByHandleEx; 95 # endif 96 } 97 } 98 #else 99 # define pGetFileInformationByHandleEx GetFileInformationByHandleEx 100 # define setup_fileid_api() 101 #endif
If USE_DYNFILEID is defined then the code searches kernel32.dll and uses the function if found. So the safe way to write this is to follow the approach given by USE_DYNFILEID (no need to implement setup_fileid_api; all thats needed is the statements therefore prepended to the use of pGetFileInformationByHandleEx). If GetFileInformationByHandleEx exists in kernel32.dll use it, otherwise fall back on our existing code. That way we should be able to keep the Windows XP build level. People still use it a lot (especially students in poor countries) and I'd rather wait until we can jump forward beyond Vista to make the change ;-) ;-) ;-)
Does that make sense? You'll see some of this code in the win32 subsystem already; grep GetProcAddress platforms/win32/vm/* platforms/win32/plugins/*/*
On Mon, Apr 23, 2018 at 05:37:45PM +0000, Vincent.Blondeau@lamresearch.com wrote:
Hi Alistair,
I made some code that have the same goal, but I am also stuck to identify the Cygwin and minty terminals, I tried the approach with the name of the pipes, but the pipes have always the same name. You can take a look at my code there: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/Cog...
VincentBlondeau:addStdoutIsConsolePrimitive
The vim code does something very similar, but haven't looked closely.
Have you been thinking to another solution?
No :-)
Which function do you need that is not existing under XP?
The use of FILE_NAME_INFO and GetFileInformationByHandleEx() requires Vista (see iscygpty.c above).
Cheers, Alistair
Thanks,
Cheers, Vincent
-----Original Message----- From: Vm-dev [mailto:vm-dev-bounces@lists.squeakfoundation.org] On
Behalf Of Alistair Grant
Sent: Monday, April 23, 2018 2:47 To: Open Smalltalk Virtual Machine Development Discussion <vm-dev@lists.
squeakfoundation.org>
Subject: [Vm-dev] Raise minimum supported Windows API from XP to Vista
(was: Identify console executable and standard one)
Hi Everyone,
I have some test code that correctly identifies whether stdin on Windows
is a console or redirected, in both windows command terminals (cmd.exe) and cygwin mintty (the current code only works for cmd.exe, not for cygwin terminals).
However it relies on the Windows Vista API, i.e. _WIN32_WINNT >= 0x0600,
and at the moment we set the minimum supported version to Windows XP (0x0501).
Since Windows XP is no longer supported, I can't see any problem with
raising the minimum version to Windows Vista (which also isn't supported, but should give us maximum compatibility), but wanted to check first.
Are there any objections to raising the minimum API level to Windows
Vista?
Thanks, Alistair