<p>There are times when you need to run GO on Windows and you need a certain kind of data that you just can't get via stdlib.
Besides this <a href="http://stackoverflow.com/questions/35154074/how-do-i-manage-windows-user-accounts-in-go" rel="nofollow">http://stackoverflow.com/questions/35154074/how-do-i-manage-windows-user-accounts-in-go</a></p>
<p>can anyone point me to some other source of information ?</p>
<hr/>**评论:**<br/><br/>Sphax: <pre><p>What are you looking for exactly ?
The post you link is right, the easiest and less painful way to interact with the windows API is to call the DLLs directly. More info here <a href="https://github.com/golang/go/wiki/WindowsDLLs" rel="nofollow">https://github.com/golang/go/wiki/WindowsDLLs</a></p>
<p>There's also <a href="https://github.com/AllenDang/w32" rel="nofollow">https://github.com/AllenDang/w32</a> which wraps quite a few APIs already. I've used it before it's not bad.</p></pre>globalgobble: <pre><p>I am looking for many things. For the moment I'd like to prototype fast so I guess controlling the environment would be a good thing. </p>
<p>Meaning: 1) knowing the .NET version
2) being able to install arbitrary .NET version
3) setting permissions ?
For everything else I'll do in C# and I start the binaries from GO project</p></pre>Sphax: <pre><p>Well I have no idea how you would automate this and I don't think the win32 API will help. You probably should just use exec.Command and run the .NET installer like this.</p>
<p>For permissions I don't know specifically either, I suggest you search on MSDN what win32 API you need to do what you want and after that you search (or write) a Go wrapper for it.</p></pre>globalgobble: <pre><p>Well I imagine it would be done the same as with C#. I open the RegistryKey db and scan through the values.</p>
<p>With installation I guess it's going to be more tricky especially getting the output from exe ?</p></pre>Sphax: <pre><p>To access the registry there's <a href="https://godoc.org/golang.org/x/sys/windows/registry" rel="nofollow">https://godoc.org/golang.org/x/sys/windows/registry</a> that works well, I've used successfully before.</p>
<p>Getting the output from a command run via exec.Command is easy enough, look at <a href="https://golang.org/pkg/os/exec/#Cmd" rel="nofollow">https://golang.org/pkg/os/exec/#Cmd</a> . You can either set the cmd.Stdout and cmd.Stderr fields to something like a file or a bytes.Buffer ; or you can skip them and call cmd.Output().</p></pre>globalgobble: <pre><p>Thanks. I'll definitely check that one out.</p>
<p>For the exec.cmd...I prefer not to use it unless I absolutely have to. I guess I would rather venture to the world of unsafe and syscalls</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传