Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Native Windows Function IsTpmReady throws "too many posts were made to a semaphore" error

Writer Matthew Barrera

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?

1

1 Answer

Although this is not really my area of expertise as @Eelco has mentioned most of the time it should be related to your antivirus. You can proceed through this checklist:

  1. Disable any anti-virus you have running includes windows defender
  2. Run it as administrator(I assume you would have tried this already)
  3. Check if you are on the latest version of windows

If it still doesn't work try performing a clean boot by

  1. Press windows + R and type "msconfig"

  2. It should open "system configuration" from which you have to navigate to the "services tab" and check "Hide all Microsoft services box" and press the disable button

  3. Navigate to the startup tab and disable all the programs in the same fashion then click apply after closing the task manager windows inside the tab

  4. Proceed to restart your machine and run the program again


If it still doesn't work perhaps restart your machine in safe mode (with networking as it's easier to search something in case needed) and try again.


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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.