public static void UIMain(string[] args)
 {
     ProcessUtils.LogParentProcessDetails();
     TimelineStatsSender.Init(MultiInstanceStrings.VmName);
     TimelineStatsSender.HandleEngineBootEvent(EngineStatsEvent.player_launched.ToString());
     Program.BstPlusDevicesInit();
     Opt.Instance.Parse(args);
     if (Opt.Instance.help)
     {
         Program.Usage();
     }
     Stats.SendFrontendStatusUpdate("frontend-launched", MultiInstanceStrings.VmName);
     if (!MultiInstanceUtils.VerifyVmId(MultiInstanceStrings.VmName))
     {
         Logger.Error("VmName {0} , not part of VmList {1} , Exiting Process", (object)MultiInstanceStrings.VmName, (object)RegistryManager.Instance.VmList.ToString());
         Environment.Exit(1);
     }
     Logger.InitVmInstanceName(MultiInstanceStrings.VmName);
     InputManagerProxy.SetUp();
     if (HyperV.Instance.HyperVStatus == HyperV.ReturnCodes.MicrosoftHyperV)
     {
         Logger.Error("Hyper-V enabled for non Hyper-V build, exiting");
         Environment.Exit(-5);
     }
     else
     {
         if (HyperV.Instance.HyperVStatus != HyperV.ReturnCodes.None)
         {
             Logger.Info("Non-microsoft Hyper-V may be active, continuing");
         }
         Program.SetupAndRunApplication(Opt.Instance);
     }
 }
 public void SendControlShutdown()
 {
     Logger.Info("{0}", (object)MethodBase.GetCurrentMethod().Name);
     if (InputManagerProxy.MonitorSendControl(1))
     {
         return;
     }
     InputManagerProxy.ThrowLastWin32Error("Cannot send shutdown control");
 }
        internal static void SetUp()
        {
            InputManagerProxy.mLoggerCallback = (Monitor.LoggerCallback)(msg => Logger.Info("HyperV: " + msg));
            string dllToLoad = "HD-Plus-Service-Native.dll";
            IntPtr hModule   = InputManagerProxy.LoadLibrary(dllToLoad);

            if (hModule == IntPtr.Zero)
            {
                Logger.Info("Failed to {0} dll", (object)dllToLoad);
            }
            else
            {
                IntPtr procAddress = InputManagerProxy.GetProcAddress(hModule, "HyperVLog");
                if (procAddress == IntPtr.Zero)
                {
                    Logger.Info("function pointer is null");
                }
                else
                {
                    ((InputManagerProxy.HyperVLog)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(InputManagerProxy.HyperVLog)))(InputManagerProxy.mLoggerCallback);
                }
            }
        }
Example #4
0
        private void EnterStateShuttingDown()
        {
            Logger.Info("{0}", (object)MethodBase.GetCurrentMethod().Name);
            this.SerialQueueCheck();
            this.mState = StateMachine.State.ShuttingDown;
            VBoxBridgeService.Instance.RegisterStateChangeEvent((VBoxBridgeService.StateChangeCallback)(newMstate => this.mWorkQueue.DispatchSync((SerialWorkQueue.Work)(() =>
            {
                Logger.Info("Callback for state {0} called...", (object)newMstate);
                switch (newMstate)
                {
                case MachineState.MachineState_PoweredOff:
                    this.mShutdownTimer.Change(-1, -1);
                    this.StopMachineCompletion(true);
                    break;

                case MachineState.MachineState_Stuck:
                    this.StopMachineCompletion(false);
                    break;

                case MachineState.MachineState_Stopping:
                    this.mState = StateMachine.State.Stopping;
                    break;

                default:
                    Logger.Info("Invalid machine state");
                    break;
                }
            }))));
            if (this.mShutdownTimer == null)
            {
                this.mShutdownTimer = new Timer((TimerCallback)(x => this.ForceShutdown()), (object)null, StateMachine.mForceShutdownDueTime, -1);
                Logger.Info("Shutdown timer started with due time {0}", (object)StateMachine.mForceShutdownDueTime);
            }
            using (InputManagerProxy inputManagerProxy = new InputManagerProxy(Process.GetCurrentProcess().Id))
                inputManagerProxy.SendControlShutdown();
        }