I'm attempting to call the TpmIsReady function from the TpmCoreProvisioning.dll included on Windows. I don't notice anything glaringly wrong with the code, but the error is thrown regardless.
This is what I have:
package windows
import (
"errors"
"log"
"syscall"
"unsafe"
)
var (
TPMDLL = syscall.NewLazyDLL("TpmCoreProvisioning.dll")
TpmReady = TPMDLL.NewProc("TpmIsReady")
)
func IsTpmReady() (bool, error) {
var enabled byte
ptr := (uintptr)(unsafe.Pointer(&enabled))
_, _, err := TpmReady.Call(ptr)
if errors.Is(err, syscall.Errno(0)) {
return enabled == 1, nil
}
if DEBUG {
log.Printf("IsTpmReady: %v", err)
}
return false, err
}
Am I using something incorrectly, or not freeing resources?
IF IT STILL DOESN'T WORK... At this point I don't know what else works.... but you could try running it on another machine and see if the error persists. You can reset your machine but it would be rather inconvenient...Check if you have any programs that might conflict or extensions. Unfortunately this is all i can do to help... Hope some part is found useful
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.