Add a simple tool to generate provider ID's

Also implements the Stringer interface for etw.Provider to output the ID

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
Justin Terry (VM)
2019-01-15 15:56:17 -08:00
parent 6c8aa416ae
commit 950c57133f
3 changed files with 45 additions and 19 deletions
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"flag"
"fmt"
"os"
"github.com/Microsoft/go-winio/internal/etw"
)
func main() {
var pn = flag.String("provider-name", "", "The human readable ETW provider name to be converted into GUID format")
flag.Parse()
if pn == nil || *pn == "" {
fmt.Fprint(os.Stderr, "--provider-name is required")
os.Exit(1)
}
p, err := etw.NewProvider(*pn, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to convert provider-name: '%s' with err: '%s", *pn, err)
os.Exit(1)
}
defer p.Close()
fmt.Fprintf(os.Stdout, "%s", p)
}