/// <summary> /// get a integer value /// </summary> /// <param name="fullPath">full path of acpi name</param> private void GetInt(string fullPath) { ushort utype = 1; IntPtr intPtr = acpiLib.GetValue(fullPath, ref utype); if (intPtr != IntPtr.Zero) { FromAcpiOutput(intPtr); acpiLib.FreeArg(intPtr); this.Type = AcpiDataType.Int; } }
/// <summary> /// Acpi evaluation popup menu handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Method_Eval_Click(object sender, EventArgs e) { ToolStripItem clickedItem = sender as ToolStripItem; // your code here acpiView.SelectedNode = PopupNode; // your code here // do nothing //if (acpiLib != null && acpiLib.DriverLoaded()) aslText.Text = PopupNode.Name; if (!acpiLib.DriverLoaded()) { aslText.AppendText("\n\nDriver is not loaded"); return; } { //acpiLib.GetEvalResult(PopupNode.Tag); string strAsl = ""; if (PopupNode.ToolTipText == "Method") { UInt64 args = 8; if (acpiLib.GetMethodArgCount((string)PopupNode.Tag, ref args) && args < 8) { // it's a method, now do eval input or eval if (args == 0) { if (acpiLib.GetEvalResult((string)PopupNode.Tag, ref strAsl)) { aslText.Text += string.Format("\n\n{0}", strAsl); } } else { // input args if (PopupNode.Name == "\\_OSI") { formArgInput.SetInputString(); formArgInput.ShowDialog(); } else { formArgInput.SetArgCount((int)args); formArgInput.ShowDialog(); } if (formArgInput.GetEvalState()) { // run command List <AcpiMethodArg> methodargs = formArgInput.Args; if (methodargs != null) { IntPtr pArg = IntPtr.Zero; for (int iIndex = 0; iIndex < methodargs.Count; iIndex++) { switch (methodargs[iIndex].Type) { case 0: pArg = acpiLib.ArgPutUInt64(pArg, methodargs[iIndex].ulValue); break; case 1: pArg = acpiLib.ArgPutString(pArg, methodargs[iIndex].strValue); break; case 2: pArg = acpiLib.ArgPutBuffer(pArg, methodargs[iIndex].bValue); break; } if (pArg == IntPtr.Zero) { MessageBox.Show("Failed to create Acpi Method Args"); return; } } string strValue = ""; if (acpiLib.GetEvalArgResult((string)PopupNode.Tag, pArg, ref strValue)) { aslText.Text += string.Format("\n\n{0}", strValue); } else { aslText.Text += "Bad"; } acpiLib.FreeArg(pArg); } } } } // Check the args... } else { //if (acpiLib.GetValue ()) if (acpiLib.GetEvalResult((string)PopupNode.Tag, ref strAsl)) { aslText.Text += string.Format("\n\n{0}", strAsl); } string FullPath = (string)PopupNode.Tag; //AcpiData amlData = new AcpiData( // acpiLib, // FullPath.Substring(0, FullPath.Length - 4), // FullPath.Substring(FullPath.Length - 4)); } } }