public bool OpenHandle() { try { if (handle == null) { IntPtr handle_t = RegistryInteropWrapper.OpenHandle(); handle = (handle_t == IntPtr.Zero) ? null : new RegServerHandle(handle_t); } return (handle != null); } catch (Exception e) { Logger.LogException("RegistryViewerPlugin.RegOpenServer", e); handle = null; return false; } }
private void ConnectToHost() { IsConnectionSuccess = false; _currentHost = System.Environment.MachineName; Logger.Log("RegistryViewerPlugin.ConnectToHost", Logger.RegistryViewerLoglevel); if (!String.IsNullOrEmpty(_currentHost)) { if (handle != null) { handle.Dispose(); handle = null; } if (_pluginNode != null && !String.IsNullOrEmpty(_currentHost)) { if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows) { IsConnectionSuccess = Do_LogonUserSet(); if (!IsConnectionSuccess) { _container.ShowError("Unable to access the Registry for the speficied user authentication"); return; } else { Do_LogonUserHandleClose(); } } else { IsConnectionSuccess = OpenHandle(); if (!IsConnectionSuccess) { Logger.ShowUserError("Unable to get registry handle"); return; } } if (handle != null) _pluginNode.Nodes.Clear(); } } }