Skip to content

Commit f34bb9f

Browse files
JoeyShapirogopherbot
authored andcommitted
windows: add net user enum
In the go windows package, you can get user information by using `NetUserGetInfo` along with a specified level. However, there is no way to get a list of the users. The only options are to 1. know the users, 2. brute force users, or 3. use an external tool or command (`net users`). I suggest adding a function that implements the windows api for `NetUserEnum`. This will allow a built in way to enumerate users and follow the standard. A side note is that I used `buf **byte` because it is how the others are done, but using `buf *byte` works just as well. Change-Id: Ifcc916659eb1d796175cd18acd2e81f2661bfcd2 GitHub-Last-Rev: 3d01bca GitHub-Pull-Request: #190 Reviewed-on: https://go-review.googlesource.com/c/sys/+/578475 Reviewed-by: Alex Brainman <[email protected]> Auto-Submit: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 6dfb94e commit f34bb9f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

windows/security_windows.go

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type UserInfo10 struct {
6868
//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo
6969
//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation
7070
//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree
71+
//sys NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) = netapi32.NetUserEnum
7172

7273
const (
7374
// do not reorder

windows/zsyscall_windows.go

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)