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

@vChrysanthemum vChrysanthemum commented Dec 28, 2015

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

@bradfitz bradfitz commented Dec 28, 2015

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
@bradfitz bradfitz added the OS-Windows label Dec 28, 2015
@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Dec 29, 2015

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.