forked from StackExchange/wmi
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md. Improve docs a bit
- Loading branch information
Showing
6 changed files
with
88 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package wmi_test | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/bi-zone/wmi" | ||
) | ||
|
||
// Structure with some fields of Win32_Process | ||
type win32Process struct { | ||
PID uint32 `wmi:"ProcessId"` // Field name differ from Win32_Process | ||
Name string // Same name | ||
UserField int `wmi:"-"` // Shouldn't affect WMI fields | ||
} | ||
|
||
func Example_EnumerateRunningProcesses() { | ||
var dst []win32Process | ||
|
||
q := wmi.CreateQueryFrom(&dst, "Win32_Process", "") | ||
fmt.Println(q) | ||
|
||
if err := wmi.Query(q, &dst); err != nil { | ||
log.Fatal(err) | ||
} | ||
for _, v := range dst { | ||
fmt.Printf("%6d\t%s\n", v.PID, v.Name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters