Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: add Windows Process Creation Flag constants #13754

Closed
vChrysanthemum opened this issue Dec 28, 2015 · 2 comments
Closed

syscall: add Windows Process Creation Flag constants #13754

vChrysanthemum opened this issue Dec 28, 2015 · 2 comments

Comments

@vChrysanthemum
Copy link

I want to create process as "hidden" in windows , and i found os.ProcAttr.Sys.HideWindow is not useful.

Unfortunately, there are not CREATE_NO_WINDOW in syscall/ztypes_windows.go.

hence, if i want create a daemon process in windows , and which won't be closed while the console quit,
i should code as below:

var attr os.ProcAttr
attr.Sys = &syscall.SysProcAttr{}
attr.Sys.CreationFlags = 0x08000000
attr.Sys.HideWindow = true
os.StartProcess("foo", []string{}, &attr)
@bradfitz bradfitz changed the title StartProcess not support CREATE_NO_WINDOW (in windows) syscall: add Windows Process Creation Flag constants Dec 28, 2015
@bradfitz
Copy link
Contributor

We're missing some Windows constants from https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx in the syscall package.

Maybe they belong in x/syscall/windows instead.

@bradfitz bradfitz added this to the Unplanned milestone Dec 28, 2015
@alexbrainman
Copy link
Member

I don't see a problem here. You code works fine as expected. Maybe change it to:

const CREATE_NO_WINDOW = 0x08000000
var attr os.ProcAttr
attr.Sys = &syscall.SysProcAttr{}
attr.Sys.CreationFlags = CREATE_NO_WINDOW
attr.Sys.HideWindow = true
os.StartProcess("foo", []string{}, &attr)

so you understand what it does next time you have to look at it. There are many consts defined in Windows .h files. We cannot have them all include in Go standard packages. Why should we include CREATE_NO_WINDOW and not others?

Alex

@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants