iamacarpet / go-winpty Goto Github PK
View Code? Open in Web Editor NEWBindings for WinPTY in Go
License: Apache License 2.0
Bindings for WinPTY in Go
License: Apache License 2.0
Is it possible to set the terminal size?
when i refresh the terminal web page, lost ws connection, the winpty-agents.exe
process is still running, i need to force close winpty-agent.exe
. suggest to add an api for this.
Seems there might be an issue with the latest version of winpty? I tried disabling the conditional in the event of success but no dice. Will try older versions and report back.
Problem Description : There is dll( A1.dll- compiled in C++) in which a function is defined as
EXPORT void S3(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow){}
A1.dll
`// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include
//#include
#define EXPORT extern "C" __declspec(dllexport)
EXPORT void S3(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
MessageBox(NULL, TEXT("Hello World"),
TEXT("In a DLL"), MB_OK);
}
**I want to load this DLL using GO lang. For this I am writing below program:**package main
import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
)
func main() {
dll, err := syscall.LoadDLL("A1.dll")
proc, err := dll.FindProc("S3")
_, _, dllError := proc.Call()
fmt.Println("calling S3")
fmt.Printf("Error, err: %s\n", dllError)
fmt.Printf("Error, err: %s\n", err)
}`
This is not working. Also I am not able to understand that here how to pass the parameter in call function according to function S3 definition. Could anybody help me in understanding this issue?
Hey @iamacarpet! We're interested in using this code in Cloud Foundry on Windows to provide SSH support on Windows Server 2016. Given there's no license associated with this project, we can't currently do so. Do you intend to release this under an open source license? If published under MIT/BSD/Apache 2.0, this would save us a bunch of effort.
Thanks!
Hey duder,
Am looking at this and looks really good but would love a bit of of an example on how to use the library.
Thanks,
Michael Brune
PowerShell is failing to launch with the error:
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.
I've tracked down the issue to environment variables being missing:
This is the first time we've deployed with the changes to support extra options.
It looks like previously we didn't pass through an environment variable pointer, so it inherited from the parent process, but now it defaults to passing in an empty array.
So we don't break anything that is using this new behavior, which has been around a while now, I'll add OpenDefault
which goes back to the old original behavior.
Hi!
Your work here looks very interesting, but I haven't managed to make it run. It panics in the call to winpty.Open
. I'm not experienced enough to debug the interop with the dll and I can't find anyting wrong in your code. But the only output I manage to get when I'm using your library is the following panic.
Btw: this is 32 bit
Do you have any idea what can be the problem?
C:\Users\IEUser\Desktop>web-pty.exe
Exception 0xc0000005 0x1 0x452c44 0x6db3d1a0
PC=0x6db3d1a0
syscall.Syscall(0x6db313d9, 0x2, 0x0, 0x0, 0x0, 0x11854780, 0x0, 0x1184a8c0)
/usr/local/Cellar/go/1.7.3/libexec/src/runtime/syscall_windows.go:163 +0
x4a
syscall.(*Proc).Call(0x118c7c30, 0x118c7c18, 0x2, 0x2, 0x8, 0x612980, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/syscall/dll_windows.go:149 +0x28c
syscall.(*LazyProc).Call(0x118cac60, 0x118c7c18, 0x2, 0x2, 0x1, 0x1, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/syscall/dll_windows.go:304 +0x54
github.com/iamacarpet/go-winpty.Open(0x0, 0x0, 0x654058, 0x3, 0x0, 0x0, 0x0)
/Users/knut/go/src/github.com/iamacarpet/go-winpty/winpty.go:27 +0x127
main.(*wsPty).Start(0x1185e5b0)
/Users/knut/go/src/github.com/iamacarpet/go-winpty/example/server.go:56
+0x4f
main.ptyHandler(0x735c80, 0x11874870, 0x11840600)
/Users/knut/go/src/github.com/iamacarpet/go-winpty/example/server.go:79
+0x155
net/http.HandlerFunc.ServeHTTP(0x67e998, 0x735c80, 0x11874870, 0x11840600)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:1726 +0x34
net/http.(*ServeMux).ServeHTTP(0x74d740, 0x735c80, 0x11874870, 0x11840600)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2022 +0x133
net/http.serverHandler.ServeHTTP(0x1184c230, 0x735c80, 0x11874870, 0x11840600)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2202 +0x136
net/http.(*conn).serve(0x1184a780, 0x736180, 0x118ca960)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:1579 +0xe86
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2293 +0x489
goroutine 1 [IO wait]:
net.runtime_pollWait(0x31b24fd8, 0x72, 0x118c7b84)
/usr/local/Cellar/go/1.7.3/libexec/src/runtime/netpoll.go:160 +0x55
net.(*pollDesc).wait(0x118907d0, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_poll_runtime.go:73 +0x35
net.(*ioSrv).ExecIO(0x1185e530, 0x11890738, 0x654cf9, 0x8, 0x118c7b90, 0x11890c4
0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_windows.go:171 +0x122
net.(*netFD).acceptOne(0x11890700, 0x11890b60, 0x2, 0x2, 0x11890738, 0x67cbab, 0
x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_windows.go:529 +0x1d4
net.(*netFD).accept(0x11890700, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_windows.go:559 +0x133
net.(*TCPListener).accept(0x1185e540, 0xe8e54a3f, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/tcpsock_posix.go:132 +0x2d
net.(*TCPListener).AcceptTCP(0x1185e540, 0x44e0a0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/tcpsock.go:209 +0x8f
net/http.tcpKeepAliveListener.Accept(0x1185e540, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2608 +0x3d
net/http.(*Server).Serve(0x1184c230, 0x735d00, 0x1185e540, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2273 +0x216
net/http.(*Server).ListenAndServe(0x1184c230, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2219 +0xd9
net/http.ListenAndServe(0x654451, 0x5, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2351 +0x7a
main.main()
/Users/knut/go/src/github.com/iamacarpet/go-winpty/example/server.go:191
+0x110
goroutine 5 [IO wait]:
net.runtime_pollWait(0x31b24f60, 0x72, 0x118c7b80)
/usr/local/Cellar/go/1.7.3/libexec/src/runtime/netpoll.go:160 +0x55
net.(*pollDesc).wait(0x11890990, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_poll_runtime.go:73 +0x35
net.(*ioSrv).ExecIO(0x1185e530, 0x118908f8, 0x654b26, 0x7, 0x67e9b4, 0xfc2, 0x0,
0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_windows.go:171 +0x122
net.(*netFD).Read(0x118908c0, 0x11897000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/fd_windows.go:426 +0x129
net.(*conn).Read(0x1185e558, 0x11897000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/net.go:173 +0xa9
net/http.(*connReader).Read(0x118ca500, 0x11897000, 0x1000, 0x1000, 0x0, 0x0, 0x
0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:586 +0x189
bufio.(*Reader).fill(0x11848570)
/usr/local/Cellar/go/1.7.3/libexec/src/bufio/bufio.go:97 +0x172
bufio.(*Reader).ReadSlice(0x11848570, 0x67cc0a, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/bufio/bufio.go:330 +0x1b4
bufio.(*Reader).ReadLine(0x11848570, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/bufio/bufio.go:359 +0x4b
net/textproto.(*Reader).readLineSlice(0x118ca560, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/textproto/reader.go:55 +0x59
net/textproto.(*Reader).ReadLine(0x118ca560, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/textproto/reader.go:36 +0x39
net/http.readRequest(0x11848570, 0x655900, 0x11840580, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/request.go:793 +0x9a
net/http.(*conn).readRequest(0x1184a500, 0x736180, 0x118ca540, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:765 +0x3c0
net/http.(*conn).serve(0x1184a500, 0x736180, 0x118ca540)
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:1532 +0x96c
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.7.3/libexec/src/net/http/server.go:2293 +0x489
eax 0x452c44
ebx 0x118604b0
ecx 0x0
edx 0x11869b3c
edi 0x38ff3c
esi 0x11869b80
ebp 0x38ff2c
esp 0x38ff0c
eip 0x6db3d1a0
eflags 0x10206
cs 0x1b
fs 0x3b
gs 0x0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.