This post has a few questions. What is error code 6 when trying to connect?[/b] I get this error returned in everything C, C#, VB, VBScript/WSH, Perl Why am I having these excepti...
See more...
This post has a few questions. What is error code 6 when trying to connect?[/b] I get this error returned in everything C, C#, VB, VBScript/WSH, Perl Why am I having these exceptions in VixCom for GetErrorText?[/b] Why do my programs crash when compiled with DevC++ and VC+2005 but run fine with VC+6[/b] (except error 6 returned)[b]?[/b] Is this a bug in VixCom/Vix?[/b] Has anyone had any luck with VixCom or Vix on VMWare Server?[/b] If yes, can you please post your code or a link to a project source?[/b] Language is not a problem as long as it uses VIX. The other APIs do not support some of the functionality I am seeking. Environment:[/b] WinXPSP2 VMWare Server 1.0.3 (even though it has been tried on older versions and different machines) Vix API 1.1 Tried in various languages (C#, VB, VBScript, C) [u]Visual C Sharp (C#)[/u][/b] C Sharp (C#) Code[/b] Source at http://www.buriproject.info/vix/c%20sharp%20GetErrorText.7z using System; using System.Collections.Generic; using System.Text; using VixCOM; namespace VIXTest { class Program { static void Main(string[] args) { VixCOM.VixLib lib = new VixCOM.VixLib(); Console.WriteLine("Connecting..."); VixCOM.IJob job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER, "", 0, "", "", 0, null, null); object[] data = \{ VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE }; object results = null; ulong err = job.Wait((VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), ref results); if (lib.ErrorIndicatesFailure(err)) { ushort errCode = lib.ErrorCode(err); string errMsg; errMsg = lib.GetErrorText(err, null); Console.WriteLine("Error: " + errCode.ToString() + " : " + errMsg); } exit(true); } static void exit() { exit(false); } static void exit(bool prompt) { if (prompt) { Console.Write("Press Any Key To Exit"); Console.ReadKey(); } System.Environment.Exit(-1); } } } C Sharp(C#) Error ScreenShot[/b] http://www.buriproject.info/vix/c%20sharp%20GetErrorText.png Error Text[/b] System.Runtime.InteropServices.COMException was unhandled Message="The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))" Source="Interop.VixCOM" ErrorCode=-2147417851 StackTrace: at VixCOM.VixLibClass.GetErrorText(UInt64 err, String locale) at VIXTest.Program.Main(String[] args) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\VIXTest\VIXTest\Program.cs:line 23 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() [u]Visual Basic (VB)[/u][/b] VB Code[/b] Source at http://www.buriproject.info/vix/vb%20GetErrorText.7z Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim VixLibA As New VixCOM.VixLib Dim job = VixLibA.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER, Nothing, Nothing, Nothing, Nothing, 0, Nothing, Nothing) Dim results = Nothing Dim err = job.Wait((VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results) If VixLibA.ErrorIndicatesFailure(err) Then Dim errMsg = VixLibA.GetErrorText(err, Nothing) MsgBox("Error: " & err.ToString() & " : " & errMsg) End If End Sub End Class VB Error ScreenShot[/b] http://www.buriproject.info/vix/vb%20GetErrorText.png VB Error Text[/b] System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="Interop.VixCOM" StackTrace: at VixCOM.VixLibClass.GetErrorText(UInt64 err, String locale) at VixCom_Test.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\VixCom Test\VixCom Test\Form1.vb:line 10 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow) at System.Windows.Forms.Control.SetVisibleCore(Boolean value) at System.Windows.Forms.Form.SetVisibleCore(Boolean value) at System.Windows.Forms.Control.set_Visible(Boolean value) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at VixCom_Test.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()