• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Notifying a message in Action center.


Commit MetaInfo

Revisionbac4db89f68c658ed2954910b4f295f8cccc7d90 (tree)
Time2015-01-31 13:46:21
AuthorJeffyTS <JeffyTS@outl...>
CommiterJeffyTS

Log Message

Improved checking whether VM tools running.

Change Summary

Incremental Difference

--- a/CtrlVIX/CtrlVix.cs
+++ b/CtrlVIX/CtrlVix.cs
@@ -125,19 +125,27 @@ namespace CtrlVix
125125 CloseVixObject(IVM);
126126 IHost.Disconnect();
127127 // 数回再実行する
128- for (int i = 1; i <= 10; i++)
128+ for (int i = 1; i <= 5; i++)
129129 {
130130 #if DEBUG
131131 Debug.WriteLine("VIX: ReRunVMControl x" + i.ToString("D"));
132132 #endif
133133 System.Threading.Thread.Sleep(5000); // 5sec wait
134134 if (reRunVMOperation(vmxFilePath, powerOP)) return true;
135+ // if (GetVMState(vmxFilePath) != Constants.VMSTATE.ERROR) return true;
135136 }
136- ErrMessage(VixCOM.Constants.VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE);
137+ if (CheckToolsRunnnging(vmxFilePath) != Constants.TOOLS_RUNNING.RUNNING)
138+ {
139+ // toolが動いていないときはエラーとはしない
140+ // ErrMessage(VixCOM.Constants.VIX_E_TIMEOUT_WAITING_FOR_TOOLS);
141+ return true;
142+ }
143+ ErrMessage(VixCOM.Constants.VIX_E_TIMEOUT_WAITING_FOR_TOOLS);
137144 return false;
138145 }
139146 // SUSPED させたとき VM_NOT_RUNNNINGはエラーとはしない
140- else if ((powerOP == Constants.POWEROP.SUSPEND) && (IVixLib.ErrorCode(err) == VixCOM.Constants.VIX_E_VM_NOT_RUNNING))
147+ else if ((powerOP == Constants.POWEROP.SUSPEND) &&
148+ (IVixLib.ErrorCode(err) == VixCOM.Constants.VIX_E_VM_NOT_RUNNING))
141149 {
142150 // NOP
143151 }
@@ -497,6 +505,9 @@ namespace CtrlVix
497505 if ((toolsState & VixCOM.Constants.VIX_TOOLSSTATE_RUNNING) == VixCOM.Constants.VIX_TOOLSSTATE_RUNNING)
498506 {
499507 vmState = vmState | VixCOM.Constants.VIX_POWERSTATE_TOOLS_RUNNING; // プロパティを見てもちゃんと判定できないので手動でフラグを立てる
508+//#if DEBUG
509+// Debug.WriteLine("VIX: Can't determine tools running.");
510+//#endif
500511 }
501512 CloseVixObject(IVM);
502513 IHost.Disconnect();
@@ -661,13 +672,22 @@ namespace CtrlVix
661672 private void ErrMessage(ulong err)
662673 {
663674 VixCOM.IVixLib IVixLib = new VixCOM.VixLib();
664- if (err == 0x4000)
675+ if (err == VixCOM.Constants.VIX_E_VM_NOT_FOUND) // 0x4000
665676 {
666677 #if DEBUG
667678 Debug.WriteLine("VIX: VIX file not found");
668679 #endif
669680 return; // vix file not found no時は無視する
670681 }
682+ /***
683+ if (err == VixCOM.Constants.VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE) // 0x3009
684+ {
685+#if DEBUG
686+ Debug.WriteLine("VIX: VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE");
687+#endif
688+ return; // VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE時は無視する
689+ }
690+ ***/
671691 #if DEBUG
672692 // 文字化けのため
673693 string a = IVixLib.GetErrorText(err, null);
--- a/CtrlVIX/Properties/AssemblyInfo.cs
+++ b/CtrlVIX/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
3232 // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
3333 // 既定値にすることができます:
3434 // [assembly: AssemblyVersion("1.0.*")]
35-[assembly: AssemblyVersion("1.1.0.0")]
36-[assembly: AssemblyFileVersion("1.1.0.0")]
35+[assembly: AssemblyVersion("1.1.1.0")]
36+[assembly: AssemblyFileVersion("1.1.1.0")]
--- a/VMwPlayerTaskTray/MainFormSub.cs
+++ b/VMwPlayerTaskTray/MainFormSub.cs
@@ -35,6 +35,7 @@ namespace VMwPlayerTaskTray
3535 private const string MSG_BALN_WARN = "GUI/NoGUI couldn't be determined when guest OS started by \"VMware Player\". " +
3636 "It might be cause of loosing control.";
3737 private const string MSG_BALN_NO_VMX_FILE = ".vmx\" file not found. Check your VM path.";
38+ private const string MSG_BALN_NOT_RUNNING_VMTOOLS = "VM tools might be not running. Check your VM.";
3839
3940 // クラス内のグローバル変数
4041 private enum VMSTATE : int // ChangeMenuItem()
@@ -66,6 +67,7 @@ namespace VMwPlayerTaskTray
6667 POWERED_OFF,
6768 CANNOT_DEFINE_RUNNING_MODE,
6869 NO_VMXFILE,
70+ NOT_RUNNING_VMTOOLS,
6971 ERROR = 0xffff
7072 };
7173
@@ -267,29 +269,38 @@ namespace VMwPlayerTaskTray
267269 }
268270 else if (vmState == VMSTATE.POWERED_ON)
269271 {
270- switch (Vix.CheckRunningMode(vmxFilePath))
272+ if (Vix.CheckToolsRunnnging(vmxFilePath) != CtrlVix.Constants.TOOLS_RUNNING.RUNNING)
271273 {
272- case CtrlVix.Constants.RUNNING_MODE.GUI:
273- // GUI mode
274- SetMenuItem(MENU_MODE.RUNNING_GUI);
274+ SetMenuItem(MENU_MODE.NOT_RUNNING_VMTOOLS);
275275 #if DEBUG
276- Debug.WriteLine("RUNNING_GUI");
276+ Debug.WriteLine("NOT_RUNNING_VMTOOLS");
277277 #endif
278- break;
279- case CtrlVix.Constants.RUNNING_MODE.NOGUI:
280- // No GUI mode
281- SetMenuItem(MENU_MODE.RUNNING_NOGUI);
278+ }
279+ else{
280+ switch (Vix.CheckRunningMode(vmxFilePath))
281+ {
282+ case CtrlVix.Constants.RUNNING_MODE.GUI:
283+ // GUI mode
284+ SetMenuItem(MENU_MODE.RUNNING_GUI);
282285 #if DEBUG
283- Debug.WriteLine("RUNNING_NOGUI");
286+ Debug.WriteLine("RUNNING_GUI");
284287 #endif
285- break;
286- case CtrlVix.Constants.RUNNING_MODE.CANNOT_DETERMINE:
287- // Guest OS started by VMware Player - can't determine GUI/NGUI
288- SetMenuItem(MENU_MODE.CANNOT_DEFINE_RUNNING_MODE);
288+ break;
289+ case CtrlVix.Constants.RUNNING_MODE.NOGUI:
290+ // No GUI mode
291+ SetMenuItem(MENU_MODE.RUNNING_NOGUI);
289292 #if DEBUG
290- Debug.WriteLine("CANNOT_DEFINE_RUNNING_MODE");
293+ Debug.WriteLine("RUNNING_NOGUI");
291294 #endif
292- break;
295+ break;
296+ case CtrlVix.Constants.RUNNING_MODE.CANNOT_DETERMINE:
297+ // Guest OS started by VMware Player - can't determine GUI/NGUI
298+ SetMenuItem(MENU_MODE.CANNOT_DEFINE_RUNNING_MODE);
299+#if DEBUG
300+ Debug.WriteLine("CANNOT_DEFINE_RUNNING_MODE");
301+#endif
302+ break;
303+ }
293304 }
294305 }
295306 else if (vmState == VMSTATE.NO_VMXFILE)
@@ -397,6 +408,16 @@ namespace VMwPlayerTaskTray
397408 this.notifyIcon_MainForm.Icon = Properties.Resources.VMwPlayerTaskTray_err;
398409 this.notifyIcon_MainForm.ShowBalloonTip(500); // バルーンTip表示
399410 break;
411+ case MENU_MODE.NOT_RUNNING_VMTOOLS:
412+ ToolStripMenuItem_GoGUI.Enabled = false;
413+ ToolStripMenuItem_GoNoGUI.Enabled = false;
414+ ToolStripMenuItem_GoSuspend.Enabled = false;
415+ ToolStripMenuItem_OtherCommand.Enabled = false;
416+ this.notifyIcon_MainForm.Text = "VM tools not runnning - " + vmxName;
417+ this.notifyIcon_MainForm.BalloonTipText = "\"" + vmxName + MSG_BALN_NOT_RUNNING_VMTOOLS;
418+ this.notifyIcon_MainForm.Icon = Properties.Resources.VMwPlayerTaskTray_err;
419+ this.notifyIcon_MainForm.ShowBalloonTip(500); // バルーンTip表示
420+ break;
400421 case MENU_MODE.ERROR:
401422 default:
402423 ToolStripMenuItem_GoGUI.Enabled = false;
--- a/VMwPlayerTaskTray/Properties/AssemblyInfo.cs
+++ b/VMwPlayerTaskTray/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
3232 // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
3333 // 既定値にすることができます:
3434 // [assembly: AssemblyVersion("1.0.*")]
35-[assembly: AssemblyVersion("1.1.0.*")]
36-[assembly: AssemblyFileVersion("1.1.0.0")]
35+[assembly: AssemblyVersion("1.1.1.*")]
36+[assembly: AssemblyFileVersion("1.1.1.0")]
--- a/readme.txt
+++ b/readme.txt
@@ -40,6 +40,7 @@ Rlease & modify
4040 2015/01/10 1.0.4 Separated source files.
4141 2015/01/20 1.0.5 Improved error messages.
4242 2015/01/22 1.1.0 Change to x64 appication.
43+ 2015/01/31 1.1.1 Improved checking whether VM tools running.
4344
4445
4546