1

Context: we are building cross-platform application from linux (ubuntu). We use the available mingw-w64 from ubuntu packages (v7.0.0-2 at the time of writing). We would like to start using the Windows ConPTY API (aka pseudo-console). Is there support for ConPTY in mingw-w64? Anyone has done it before? Thanks

  • Try it and see? As I cannot seem to find a proper msdn documentation page for this API, I would guess it is quite difficult to provide it (as you can't just copy the Windows SDK headers into MinGW-w64: they are all created from either clean room reverse engineering, or from public documentation, or from e.g. how an existing application uses specific APIs). If you need help implementing this or want to request this as a feature, your best bet is to send an email detailing your issue to the MinGW-w64 public mailing list. – rubenvb Mar 01 '21 at 09:46
  • 1
    @rubenvb You mean [this documentation](https://learn.microsoft.com/en-us/windows/console/createpseudoconsole)? Plus the `See also` links there at the bottom. – ssbssa Mar 01 '21 at 11:34
  • Fair enough, the blog post was the only thing that kept popping up when googling "ConPTY API" and it was never updated to link to actual documentation. – rubenvb Mar 02 '21 at 08:03

1 Answers1

0

It looks like ConPTY dedicated functions are enabled only for windows WINNT and windows NTDDI version _WIN32_WINNT_WIN10 and NTDDI_WIN10_RS5 respectively, or newer. MinGW (7.0.0-2) sets the WINNT version to _WIN32_WINNT_WS03 (Windows Server 2003) by default.

By setting those values manually before including windows.h it is possible to use ConPTY functions with Ubuntu's MinGW-w64 package v7.0.0-2.

Example code:

#define NTDDI_VERSION 0x0A000006 //NTDDI_WIN10_RS5
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10
#include <windows.h>
#include <wincon.h>
CreatePseudoConsole(size, inputReadSide, outputWriteSide, 0, &hPC);