private static string GetAccessibleText(System.IntPtr accObj, int vmId) { string sentence = string.Empty; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { try { AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo); if (accContextInfo.accessibleText) { AccessibleTextInfo accTextInfo = new AccessibleTextInfo(); if (JavaAccNativeMethods.getAccessibleTextInfo(vmId, accObj, out accTextInfo, 0, 0)) { AccessibleTextItemsInfo accTextItems = new AccessibleTextItemsInfo(); if (JavaAccNativeMethods.getAccessibleTextItems(vmId, accObj, out accTextItems, accTextInfo.indexAtPoint)) { sentence = accTextItems.sentence; } } } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(sentence); } } return(sentence); }
void LoadData() { accContextInfo = new AccessibleContextInfo(); System.Windows.Forms.Application.DoEvents(); bool result = JavaAccNativeMethods.getAccessibleContextInfo(_vmId, _javaWin, out accContextInfo); if (result == false) { System.Diagnostics.Debug.WriteLine("No info"); return; } int count = JavaAccNativeMethods.getAccessibleActions(_vmId, _javaWin); for (int i = 0; i < count; i++) { IntPtr actionname = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(JavaAccNativeMethods.ACTIONNAMESIZE); if (!actionname.Equals((System.IntPtr)System.IntPtr.Zero) && JavaAccNativeMethods.getAccessibleActionItem(i, actionname, JavaAccNativeMethods.ACTIONNAMESIZE)) { javaactions.Add(System.Runtime.InteropServices.Marshal.PtrToStringUni(actionname)); } } System.Windows.Forms.Application.DoEvents(); if (accContextInfo.childrenCount == 0) { return; // we are done! } // get children System.Windows.Forms.Application.DoEvents(); for (int i = 0; i < accContextInfo.childrenCount; i++) { IntPtr childPtr = JavaAccNativeMethods.getAccessibleChildFromContext(_vmId, _javaWin, i); _children.Add(new JavaWindow(this, childPtr, _vmId)); } }
private static void SetControlValue(System.IntPtr accObj, int vmId, string controlValue) { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { System.IntPtr pControlValue = System.Runtime.InteropServices.Marshal.StringToCoTaskMemUni(controlValue); try { if (!pControlValue.Equals((System.IntPtr)System.IntPtr.Zero)) { JavaAccNativeMethods.setTextContents(vmId, accObj, pControlValue); } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } finally { if (!pControlValue.Equals((System.IntPtr)System.IntPtr.Zero)) { System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pControlValue); } } } }
internal static string BuildAccKey(System.IntPtr accObj, int vmId) { System.Text.StringBuilder builder = new System.Text.StringBuilder(); if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { try { System.IntPtr ptr = JavaAccNativeMethods.getTopLevelObject(vmId, accObj); System.IntPtr hWnd = JavaAccNativeMethods.getHWNDFromAccessibleContext(vmId, ptr); builder.AppendFormat("{0}.{1}.{2:X8}", (int)GetRoleID(accObj, vmId), (int)vmId, (int)hWnd.ToInt32()); LPRECT lpRect = new LPRECT(); Win32NativeMethods.GetWindowRect(hWnd, ref lpRect); AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo); int num = (int)(accContextInfo.x - lpRect.Left); int num2 = (int)(accContextInfo.y - lpRect.Top); int width = accContextInfo.width; int height = accContextInfo.height; builder.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, ".{0},{1},{2},{3}", new object[] { (int)num, (int)num2, (int)width, (int)height }); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } } return(builder.ToString()); }
private static string GetVirtualAccessibleName(System.IntPtr accObj, int vmId) { string str = string.Empty; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { System.IntPtr zero = System.IntPtr.Zero; try { zero = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(JavaDataDrivenAdapterConstants.TASK_MEMORY_SIZE); if (!zero.Equals((System.IntPtr)System.IntPtr.Zero) && JavaAccNativeMethods.getVirtualAccessibleName(vmId, accObj, zero, JavaDataDrivenAdapterConstants.TASK_MEMORY_SIZE)) { str = System.Runtime.InteropServices.Marshal.PtrToStringUni(zero); } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(str); } finally { if (!zero.Equals((System.IntPtr)System.IntPtr.Zero)) { System.Runtime.InteropServices.Marshal.FreeCoTaskMem(zero); } } } return(str); }
private static AccessibleTableCellInfo GetAccTableCellInfo(System.IntPtr accObj, int vmId, int index) { AccessibleTableCellInfo accTableCellInfo = new AccessibleTableCellInfo(); if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { System.IntPtr accTable = GetAccTable(accObj, vmId); try { if (!accTable.Equals((System.IntPtr)System.IntPtr.Zero)) { int row = JavaAccNativeMethods.getAccessibleTableRow(vmId, accTable, index); int column = JavaAccNativeMethods.getAccessibleTableColumn(vmId, accTable, index); if (JavaAccNativeMethods.getAccessibleTableCellInfo(vmId, accTable, row, column, out accTableCellInfo)) { return(accTableCellInfo); } } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(accTableCellInfo); } finally { ReleaseObject(accTable, vmId); } } return(accTableCellInfo); }
public override void DisplayVisualTree() { if (!JavaAccNativeMethods._IsWindowsAccessBridgeAvailable) { JavaAccNativeMethods.LoadJavaAccessBridge(); JavaAccNativeMethods.Windows_run(); Trace.WriteLine("Initializing the java dda instance.."); JavaAccHelperMethods.InitializeJavaAccessBridge(true); System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents(); } int vmId = 0; System.IntPtr accFromWindow = JavaAccHelperMethods.GetAccFromWindow(rootWindow, out vmId); jtvm = new JavaTreeViewModel(new JavaWindow(null, accFromWindow, vmId)); if (w != null) { w.Closing -= W_Closing; avv = null; w = null; } avv = new ApplicationVisualViewer(ApplicationName); avv.LoadTree(jtvm); w = new Window(); w.Closing += W_Closing; w.Content = avv; w.Show(); }
internal static int GetAccTableCellIndex(System.IntPtr accObj, int vmId, int row, int column) { int num = -1; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { System.IntPtr accTable = GetAccTable(accObj, vmId); if (accTable.Equals((System.IntPtr)System.IntPtr.Zero)) { return(num); } try { num = JavaAccNativeMethods.getAccessibleTableIndex(vmId, accTable, row, column); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(num); } finally { ReleaseObject(accTable, vmId); } } return(num); }
public override void Initialize() { try { JavaAccNativeMethods.LoadJavaAccessBridge(); JavaAccNativeMethods.Windows_run(); JavaAccNativeMethods._IsWindowsAccessBridgeAvailable = true; } catch (Exception ex) { LogWriter.Log(ex); } try { int num; JavaAccHelperMethods.GetAccFromWindow(rootWindow, out num); System.Windows.Forms.Application.DoEvents(); Trace.WriteLine("Initializing the java dda instance.."); JavaAccHelperMethods.InitializeJavaAccessBridge(true); //this.JavaAccEventListenerInstallTimer = new System.Threading.Timer(new System.Threading.TimerCallback(this.InstallAccEventListener_TimerCallback), null, (int)(-1), 0); } catch { } }
internal static string GetAccHyperlink(System.IntPtr accObj, int vmId) { string text = string.Empty; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleHypertextInfo hypertextInfo = new AccessibleHypertextInfo(); try { if (JavaAccNativeMethods.getAccessibleHypertext(vmId, accObj, out hypertextInfo)) { AccessibleHyperlinkInfo hyperlinkInfo = new AccessibleHyperlinkInfo(); if (JavaAccNativeMethods.getAccessibleHyperlink(vmId, hypertextInfo.accessibleHypertext, 0, out hyperlinkInfo)) { text = hyperlinkInfo.text; } } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(text); } } return(text); }
internal static void ActivateAccHyperlink(System.IntPtr accObj, int vmId) { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleHypertextInfo hypertextInfo = new AccessibleHypertextInfo(); try { if (JavaAccNativeMethods.getAccessibleHypertext(vmId, accObj, out hypertextInfo)) { AccessibleHyperlinkInfo hyperlinkInfo = new AccessibleHyperlinkInfo(); if (JavaAccNativeMethods.getAccessibleHyperlink(vmId, hypertextInfo.accessibleHypertext, 0, out hyperlinkInfo)) { JavaAccNativeMethods.activateAccessibleHyperlink(vmId, accObj, hyperlinkInfo.accessibleHyperlink); } } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } } }
internal static string GetName(System.IntPtr accObj, int vmId) { string str = string.Empty; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); try { if (JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo) && !string.IsNullOrEmpty(accContextInfo.name)) { return(accContextInfo.name); } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(str); } } return(str); }
internal static int GetRoleID(System.IntPtr accObj, int vmId) { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { bool flag = false; AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); try { flag = JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } if (flag && !string.IsNullOrEmpty(accContextInfo.role)) { if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.PUSH_BUTTON, System.StringComparison.OrdinalIgnoreCase)) { return(0); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.TOGGLE_BUTTON, System.StringComparison.OrdinalIgnoreCase)) { return(6); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.CHECK_BOX, System.StringComparison.OrdinalIgnoreCase)) { return(1); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.RADIO_BUTTON, System.StringComparison.OrdinalIgnoreCase)) { return(2); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.COMBO_BOX, System.StringComparison.OrdinalIgnoreCase)) { return(3); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.TEXT, System.StringComparison.OrdinalIgnoreCase)) { return(4); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.LABEL, System.StringComparison.OrdinalIgnoreCase)) { return(5); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.MENU, System.StringComparison.OrdinalIgnoreCase)) { return(7); } if (accContextInfo.role.Equals(JavaDataDrivenAdapterConstants.MENU_ITEM, System.StringComparison.OrdinalIgnoreCase)) { return(8); } } } return(-1); }
internal static void ReleaseObject(System.IntPtr accObj, int vmId) { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { try { JavaAccNativeMethods.releaseJavaObject(vmId, accObj); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { Trace.WriteLine("Unable to free memory associated with the java accessible node."); } } } }
internal static int GetVisibleChildrenCount(System.IntPtr accObj, int vmId) { int num = 0; try { num = JavaAccNativeMethods.getVisibleChildrenCount(vmId, accObj); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(num); } return(num); }
internal static System.IntPtr[] GetChildren(System.IntPtr accObj, int startIndex, int vmId, out int childrenCount) { childrenCount = 0; VisibleChildenInfo visibleChildrenInfo = new VisibleChildenInfo(); try { JavaAccNativeMethods.getVisibleChildren(vmId, accObj, startIndex, out visibleChildrenInfo); childrenCount = visibleChildrenInfo.returnedChildrenCount; } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } return(visibleChildrenInfo.children); }
internal static System.IntPtr GetAccFromWindow(System.IntPtr hWnd, out int vmId) { System.IntPtr zero = System.IntPtr.Zero; vmId = 0; if (!hWnd.Equals((System.IntPtr)System.IntPtr.Zero)) { try { JavaAccNativeMethods.getAccessibleContextFromHWND(hWnd, out vmId, out zero); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(zero); } } return(zero); }
internal static System.IntPtr GetHWNDFromAccessibleContext(System.IntPtr accObj, int vmId) { System.IntPtr zero = System.IntPtr.Zero; System.IntPtr ptr2 = System.IntPtr.Zero; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { try { zero = JavaAccNativeMethods.getTopLevelObject(vmId, accObj); if (!zero.Equals((System.IntPtr)System.IntPtr.Zero)) { ptr2 = JavaAccNativeMethods.getHWNDFromAccessibleContext(vmId, zero); } } finally { ReleaseObject(zero, vmId); } } return(ptr2); }
internal static int GetChildrenCount(System.IntPtr accObj, int vmId) { int childrenCount = 0; try { AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); if (JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo)) { childrenCount = accContextInfo.childrenCount; } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(childrenCount); } return(childrenCount); }
private static string GetAccessibleValueInt(System.IntPtr accObj, int vmId) { string str = string.Empty; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { System.IntPtr zero = System.IntPtr.Zero; try { zero = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(4); if (!zero.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo); if (accContextInfo.accessibleInterfaces && JavaAccNativeMethods.getCurrentAccessibleValueFromContext(vmId, accObj, zero, 4)) { str = System.Runtime.InteropServices.Marshal.PtrToStringUni(zero); } } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(str); } finally { if (!zero.Equals((System.IntPtr)System.IntPtr.Zero)) { System.Runtime.InteropServices.Marshal.FreeCoTaskMem(zero); } } } return(str); }
internal static bool DoAction(System.IntPtr accObj, out int failure, int vmId, bool isDefaultAction, string actionName) { bool flag = false; failure = 0; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleActionsToDo[] actionsToDo = new AccessibleActionsToDo[] { new AccessibleActionsToDo() }; actionsToDo[0].actionsCount = 1; actionsToDo[0].actions = new AccessibleActionInfo[0x20]; actionsToDo[0].actions[0] = new AccessibleActionInfo(); if (isDefaultAction) { actionsToDo[0].actions[0].name = JavaDataDrivenAdapterConstants.DEFAULT_ACTION_NAME; } else { actionsToDo[0].actions[0].name = actionName; } try { flag = JavaAccNativeMethods.doAccessibleActions(vmId, accObj, actionsToDo, out failure); if (flag == false) { throw new Exception("doAccessibleActions failed: " + failure.ToString()); } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(flag); } } return(flag); }
private static System.IntPtr GetAccSelection(System.IntPtr accObj, int vmId) { System.IntPtr zero = System.IntPtr.Zero; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { try { if (JavaAccNativeMethods.getAccessibleSelectionCountFromContext(vmId, accObj) != -1) { zero = JavaAccNativeMethods.getAccessibleSelectionFromContext(vmId, accObj, 0); } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(zero); } } return(zero); }
internal static void SetAccSelection(System.IntPtr accSelection, int vmId, string controlValue) { int num = 0; if (!accSelection.Equals((System.IntPtr)System.IntPtr.Zero) && int.TryParse(controlValue, out num)) { try { if (num <= 0) { throw new System.ArgumentException("Incorrect Control Value"); } JavaAccNativeMethods.addAccessibleSelectionFromContext(vmId, accSelection, (int)(num - 1)); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } } }
private static System.IntPtr GetAccTable(System.IntPtr accObj, int vmId) { System.IntPtr zero = System.IntPtr.Zero; if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { AccessibleTableInfo accTableInfo = new AccessibleTableInfo(); try { if (JavaAccNativeMethods.getAccessibleTableInfo(vmId, accObj, out accTableInfo)) { zero = accTableInfo.accessibleTable; } } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(zero); } } return(zero); }
internal static string GetRole(System.IntPtr accObj, int vmId) { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { bool flag = false; AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); try { flag = JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } } if (flag && !string.IsNullOrEmpty(accContextInfo.role)) { return(accContextInfo.role_en_US); } } return(string.Empty); }
public override IUSDAutomationObject GetAutomationObject(XmlNode control) { /* * <Controls> * <JAccControl name="clickme"> // this is the control * <Path> * <NextName offset = "1">Click Me</NextName> * </Path> * </JAccControl> * <JAccControl name="textbox"> * <Path> * <NextRole offset = "0">text</NextRole> * </Path> * </JAccControl> * </Controls> */ if (!JavaAccNativeMethods._IsWindowsAccessBridgeAvailable) { throw new Exception("Java Bridge not available"); } if (control.Name != "JAccControl") { throw new Exception("Invalid node type included: " + control.Name + ". Only JAccControl is valid."); } string name = GetAttributeValue(control, "name", ""); XmlNode path = control.SelectSingleNode("Path"); int vmId = 0; System.IntPtr zero = System.IntPtr.Zero; zero = this.JavaFindAccObj(name, out vmId, path.OuterXml); AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); if (Tracing) { StringBuilder sb = new StringBuilder(); if (JavaAccNativeMethods.getAccessibleContextInfo(vmId, zero, out accContextInfo)) { sb.AppendLine("Java Control Found: " + name); sb.AppendLine("\taccessibleText: " + accContextInfo.accessibleText.ToString()); sb.AppendLine("\taccessibleAction: " + accContextInfo.accessibleAction.ToString()); sb.AppendLine("\taccessibleComponent: " + accContextInfo.accessibleComponent.ToString()); sb.AppendLine("\taccessibleInterfaces: " + accContextInfo.accessibleInterfaces.ToString()); sb.AppendLine("\taccessibleSelection: " + accContextInfo.accessibleSelection.ToString()); sb.AppendLine("\tchildrenCount: " + accContextInfo.childrenCount.ToString()); sb.AppendLine("\tdescription: " + accContextInfo.description.ToString()); sb.AppendLine("\theight: " + accContextInfo.height.ToString()); sb.AppendLine("\tindexInParent: " + accContextInfo.indexInParent.ToString()); sb.AppendLine("\tname: " + accContextInfo.name); sb.AppendLine("\trole: " + accContextInfo.role); sb.AppendLine("\trole_en_US: " + accContextInfo.role_en_US); sb.AppendLine("\tstates: " + accContextInfo.states); sb.AppendLine("\tstates_en_US: " + accContextInfo.states_en_US); sb.AppendLine("\twidth: " + accContextInfo.width.ToString()); sb.AppendLine("\tx: " + accContextInfo.x.ToString()); sb.AppendLine("\ty: " + accContextInfo.y.ToString()); string[] stateList = accContextInfo.states.Split(','); } int count = JavaAccNativeMethods.getAccessibleActions(vmId, zero); sb.AppendLine("\tActions: " + count.ToString()); for (int i = 0; i < count; i++) { IntPtr actionname = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(JavaAccNativeMethods.ACTIONNAMESIZE); if (!actionname.Equals((System.IntPtr)System.IntPtr.Zero) && JavaAccNativeMethods.getAccessibleActionItem(i, actionname, JavaAccNativeMethods.ACTIONNAMESIZE)) { string action = System.Runtime.InteropServices.Marshal.PtrToStringUni(actionname); sb.AppendLine("\t\t: " + action); } } LogWriter.Log(sb.ToString(), TraceEventType.Verbose); Trace.WriteLine(sb.ToString()); } return(new JavaAutomationObject(name, vmId, zero)); }
internal static System.IntPtr GetNextChildByRole(string role, ref int count, int offset, ref bool nodeFound, System.IntPtr accObj, int vmId) { System.IntPtr zero = System.IntPtr.Zero; bool flag = false; try { if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero)) { if (GetRole(accObj, vmId).Equals(role.Trim(), System.StringComparison.OrdinalIgnoreCase) && (--count <= 0)) { flag = true; return(accObj); } AccessibleContextInfo accContextInfo = new AccessibleContextInfo(); if (!JavaAccNativeMethods.getAccessibleContextInfo(vmId, accObj, out accContextInfo)) { return(zero); } for (int i = 0; i < accContextInfo.childrenCount; i = (int)(i + 1)) { System.IntPtr ptr2 = JavaAccNativeMethods.getAccessibleChildFromContext(vmId, accObj, i); zero = GetNextChildByRole(role, ref count, offset, ref nodeFound, ptr2, vmId); if (!nodeFound && !zero.Equals((System.IntPtr)System.IntPtr.Zero)) { nodeFound = true; if (offset != 0) { if (((i + offset) >= 0) && ((i + offset) < accContextInfo.childrenCount)) { zero = JavaAccNativeMethods.getAccessibleChildFromContext(vmId, accObj, (int)(i + offset)); } else { zero = System.IntPtr.Zero; } } } if (nodeFound) { return(zero); } } } return(zero); } catch (System.Exception exception) { if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception)) { throw; } return(zero); } finally { if (!flag || (offset != 0)) { ReleaseObject(accObj, vmId); } } return(zero); }