Windows:Revert change to wait for OOBE

Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
Darren Stahl 2017-03-27 14:32:18 -07:00
parent abecc530ee
commit 6eed7f0cac

View file

@ -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
}