Windows:Revert change to wait for OOBE
Signed-off-by: Darren Stahl <darst@microsoft.com>
(cherry picked from commit 6eed7f0cac
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
73b512220d
commit
6ddedae595
1 changed files with 1 additions and 34 deletions
|
@ -6,7 +6,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
@ -245,7 +244,7 @@ func checkSystem() error {
|
|||
return fmt.Errorf("Failed to load vmcompute.dll. Ensure that the Containers role is installed.")
|
||||
}
|
||||
|
||||
return waitOOBEComplete()
|
||||
return nil
|
||||
}
|
||||
|
||||
// configureKernelSecuritySupport configures and validate security support for the kernel
|
||||
|
@ -617,35 +616,3 @@ func (daemon *Daemon) verifyVolumesInfo(container *container.Container) error {
|
|||
func (daemon *Daemon) setupSeccompProfile() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func waitOOBEComplete() error {
|
||||
kernel32 := windows.NewLazySystemDLL("kernel32.dll")
|
||||
registerWaitUntilOOBECompleted := kernel32.NewProc("RegisterWaitUntilOOBECompleted")
|
||||
unregisterWaitUntilOOBECompleted := kernel32.NewProc("UnregisterWaitUntilOOBECompleted")
|
||||
|
||||
callbackChan := make(chan struct{})
|
||||
callbackFunc := func(uintptr) uintptr {
|
||||
close(callbackChan)
|
||||
return 0
|
||||
}
|
||||
callbackFuncPtr := syscall.NewCallback(callbackFunc)
|
||||
|
||||
var callbackHandle syscall.Handle
|
||||
ret, _, err := registerWaitUntilOOBECompleted.Call(callbackFuncPtr, 0, uintptr(unsafe.Pointer(&callbackHandle)))
|
||||
if ret == 0 {
|
||||
if err == errInvalidState {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("failed to register OOBEComplete callback. Error: %v", err)
|
||||
}
|
||||
|
||||
// Wait for the callback when OOBE is finished
|
||||
<-callbackChan
|
||||
|
||||
ret, _, err = unregisterWaitUntilOOBECompleted.Call(uintptr(callbackHandle))
|
||||
if ret == 0 {
|
||||
return fmt.Errorf("failed to unregister OOBEComplete callback. Error: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue