Windows:Revert change to wait for OOBE
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
abecc530ee
commit
6eed7f0cac
1 changed files with 1 additions and 34 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim"
|
"github.com/Microsoft/hcsshim"
|
||||||
"github.com/Sirupsen/logrus"
|
"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 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
|
// 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 {
|
func (daemon *Daemon) setupSeccompProfile() error {
|
||||||
return nil
|
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