mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-06 00:57:19 -04:00
Fix ETW package to work on 386
The ETW registration handle is defined to be 64-bits on all platforms. The Go type previously used a uintptr which created problems on 32-bit systems. This change adds a new wrapper file which receives a 64-bit handle for the functions defined in it, and correctly passes it to the native ETW functions either as-is (on 64-bit) or as two 32-bit values (on 32-bit). This required a minor change in mksyscall_windows.go, to allow multiple syscalls that map to the same underlying function without causing a duplicate definition error in the generated file.
This commit is contained in:
@@ -603,6 +603,19 @@ type Source struct {
|
||||
ExternalImports []string
|
||||
}
|
||||
|
||||
func (src *Source) FuncImports() []*Fn {
|
||||
uniq := make(map[string]bool)
|
||||
r := make([]*Fn, 0)
|
||||
for _, f := range src.Funcs {
|
||||
name := f.DLLFuncName()
|
||||
if _, found := uniq[name]; !found {
|
||||
uniq[name] = true
|
||||
r = append(r, f)
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func (src *Source) Import(pkg string) {
|
||||
src.StdLibImports = append(src.StdLibImports, pkg)
|
||||
sort.Strings(src.StdLibImports)
|
||||
@@ -865,7 +878,7 @@ var (
|
||||
{{define "dlls"}}{{range .DLLs}} mod{{.}} = {{newlazydll .}}
|
||||
{{end}}{{end}}
|
||||
|
||||
{{define "funcnames"}}{{range .Funcs}} proc{{.DLLFuncName}} = mod{{.DLLName}}.NewProc("{{.DLLFuncName}}")
|
||||
{{define "funcnames"}}{{range .FuncImports}} proc{{.DLLFuncName}} = mod{{.DLLName}}.NewProc("{{.DLLFuncName}}")
|
||||
{{end}}{{end}}
|
||||
|
||||
{{define "helperbody"}}
|
||||
|
||||
Reference in New Issue
Block a user