Skip to content

Commit 78c1e60

Browse files
committed
Fixed AllocConsoleWithOptions Arm64
1 parent 43ed36f commit 78c1e60

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

winsup/cygwin/fhandler/console.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,25 @@ details. */
3535
#include "winf.h"
3636
#include "psapi.h"
3737

38+
#include <windows.h>
39+
#include <wincon.h>
40+
typedef HRESULT (WINAPI *pAllocConsoleWithOptions)(
41+
const ALLOC_CONSOLE_OPTIONS*,
42+
ALLOC_CONSOLE_RESULT*
43+
);
44+
HRESULT CallAllocConsoleWithOptions(const ALLOC_CONSOLE_OPTIONS* opt,
45+
ALLOC_CONSOLE_RESULT* res)
46+
{
47+
HMODULE h = GetModuleHandleW(L"kernel32.dll");
48+
if (!h)
49+
return HRESULT_FROM_WIN32(GetLastError());
50+
auto fn = (pAllocConsoleWithOptions)
51+
GetProcAddress(h, "AllocConsoleWithOptions");
52+
if (!fn)
53+
return HRESULT_FROM_WIN32(ERROR_CALL_NOT_IMPLEMENTED);
54+
return fn(opt, res);
55+
}
56+
3857
/* Don't make this bigger than NT_MAX_PATH as long as the temporary buffer
3958
is allocated using tmp_pathbuf!!! */
4059
#define CONVERT_LIMIT NT_MAX_PATH

0 commit comments

Comments
 (0)