RegisterDeviceWithLocalManagement could return an error if MDM management channel is already initialized (#10298)

This commit is contained in:
Marcos Oviedo 2023-03-14 09:20:21 -03:00 committed by GitHub
parent 4413a20bcb
commit 8fcec316ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -559,9 +559,9 @@ func enableCmdExecution() error {
// The code below is just using returnCode to determine if call was successul or not. The err
// variable returns status above call dispatching so it not needed and actually introduce
// confusion about the status of the call.
// This is a best effort call as MDM management stack could have been initialized already by other components
if returnCode, _, _ := procRegisterDeviceWithLocalManagement.Call(uintptr(unsafe.Pointer(nil))); returnCode != uintptr(windows.ERROR_SUCCESS) {
log.Error().Msgf("there was an error calling RegisterDeviceWithLocalManagement(): (0x%X)", returnCode)
return
}
// generate SHA256 hash of UUID bytes