Closed jwenz723 closed 6 years ago
Also, when I run it in this current condition I get the error code: PDH_INVALID_ARGUMENT, so I assume something is incorrect with the arguments I am passing into the function call.
Figured it out finally after many hours of trial and error...
func PdhParseCounterPath(szFullPathBuffer string, pCounterPathElements *PDH_COUNTER_PATH_ELEMENTS, pdwBufferSize *uint32) uint32 {
ptxt, _ := syscall.UTF16PtrFromString(szFullPathBuffer)
ret, _, _ := pdh_ParseCounterPathW.Call(
uintptr(unsafe.Pointer(ptxt)),
uintptr(unsafe.Pointer(pCounterPathElements)),
uintptr(unsafe.Pointer(pdwBufferSize)),
0)
return uint32(ret)
}
I am trying to add the PdhParseCounterPath function (as documented here https://msdn.microsoft.com/en-us/library/windows/desktop/aa372657(v=vs.85).aspx ) into pdh.go, but I am a bit unsure of how to do so. Wondering if any of the contributors could offer a little help? Here is what I've added: