1 //go:build windows 2 3 package winapi 4 5 import ( 6 "unsafe" 7 8 "golang.org/x/sys/windows" 9 ) 10 11 const PSEUDOCONSOLE_INHERIT_CURSOR = 0x1 12 13 // CreatePseudoConsole creates a windows pseudo console. 14 func CreatePseudoConsole(size windows.Coord, hInput windows.Handle, hOutput windows.Handle, dwFlags uint32, hpcon *windows.Handle) error { 15 // We need this wrapper as the function takes a COORD struct and not a pointer to one, so we need to cast to something beforehand. 16 return createPseudoConsole(*((*uint32)(unsafe.Pointer(&size))), hInput, hOutput, 0, hpcon) 17 } 18 19 // ResizePseudoConsole resizes the internal buffers of the pseudo console to the width and height specified in `size`. 20 func ResizePseudoConsole(hpcon windows.Handle, size windows.Coord) error { 21 // We need this wrapper as the function takes a COORD struct and not a pointer to one, so we need to cast to something beforehand. 22 return resizePseudoConsole(hpcon, *((*uint32)(unsafe.Pointer(&size)))) 23 } 24 25 // HRESULT WINAPI CreatePseudoConsole( 26 // _In_ COORD size, 27 // _In_ HANDLE hInput, 28 // _In_ HANDLE hOutput, 29 // _In_ DWORD dwFlags, 30 // _Out_ HPCON* phPC 31 // ); 32 // 33 //sys createPseudoConsole(size uint32, hInput windows.Handle, hOutput windows.Handle, dwFlags uint32, hpcon *windows.Handle) (hr error) = kernel32.CreatePseudoConsole 34 35 // void WINAPI ClosePseudoConsole( 36 // _In_ HPCON hPC 37 // ); 38 // 39 //sys ClosePseudoConsole(hpc windows.Handle) = kernel32.ClosePseudoConsole 40 41 // HRESULT WINAPI ResizePseudoConsole( 42 // _In_ HPCON hPC , 43 // _In_ COORD size 44 // ); 45 // 46 //sys resizePseudoConsole(hPc windows.Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole 47