private void EnumChildNodes(RegistryKey sSubKey, HKEY hKey)
        {
            Array sSubKeys = null;
            Array sValues = null;
            Dictionary<string, LACTreeNode> nodesAdded = new Dictionary<string, LACTreeNode>();
            Dictionary<string, LACTreeNode> nodesToAdd = new Dictionary<string, LACTreeNode>();

            foreach (LACTreeNode n in treeNode.Nodes)
                nodesAdded.Add(n.Text.Trim(), n);

            if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows)
            {
                if (sSubKey != null)
                {
                    if (nodeType != RegistryViewerPlugin.NodeType.HKEY_SUBKEY)
                    {
                        SubKeyInfo subKeyInfo = new SubKeyInfo();
                        subKeyInfo.sKey = sSubKey.Name;
                        subKeyInfo.hKey = hKey;
                        subKeyInfo.sSubKey = sSubKey;
                        treeNode.Tag = subKeyInfo;
                    }
                    RegistryInteropWrapperWindows.Win32RegSubKeyList(sSubKey, out sSubKeys);

                    if (sSubKeys != null && sSubKeys.Length != 0)
                    {
                        foreach (string key in sSubKeys)
                        {
                            RegistryKey subKey = RegistryInteropWrapperWindows.Win32RegOpenRemoteSubKey(sSubKey, key);

                            Icon ic = Properties.Resources.Reports;
                            LACTreeNode node = Manage.CreateIconNode(key,
                                              ic,
                                              typeof(RegistryViewerKeyPage),
                                              plugin);
                            node.sc = plugin.GetPlugInNode().sc;

                            SubKeyInfo subKeyInfo = new SubKeyInfo();
                            subKeyInfo.sKey = key;
                            subKeyInfo.hKey = hKey;
                            subKeyInfo.sSubKey = subKey;

                            node.Tag = subKeyInfo;

                            if (!nodesAdded.ContainsKey(key.Trim()))
                                nodesToAdd.Add(key, node);
                        }
                    }

                    RegistryInteropWrapperWindows.Win32RegSubKeyValueList(sSubKey, out sValues);

                    ListViewItem lvItem = new ListViewItem(new string[] { "(Default)", "REG_SZ", "(value not set)" });
                    SubKeyValueInfo valueInfo = new SubKeyValueInfo();
                    valueInfo.hKey = hKey;
                    valueInfo.sParentKey = sSubKey;
                    valueInfo.sValue = "";
                    valueInfo.sData = "(value not set)";
                    valueInfo.RegDataType = LWRegistryValueKind.REG_SZ;
                    valueInfo.IsDefaultValue = true;

                    lvItem.Tag = valueInfo;
                    lvRegistryPage.Items.Add(lvItem);

                    if (sValues != null && sValues.Length != 0)
                    {
                        foreach (string value in sValues)
                        {
                            valueInfo = new SubKeyValueInfo();
                            RegistryInteropWrapperWindows.Win32RegValueKind(sSubKey, value, valueInfo);
                            valueInfo.hKey = hKey;
                            valueInfo.sParentKey = sSubKey;
                            valueInfo.sValue = value;
                            valueInfo.IsDefaultValue = false;

                            if (String.IsNullOrEmpty(value))
                            {
                                valueInfo.IsDefaultValue = true;
                                lvItem = new ListViewItem(new string[] { "(Default)", GetRegValueStringType(valueInfo.RegDataType), valueInfo.sData });
                                lvRegistryPage.Items.RemoveAt(0);
                            }
                            else
                                lvItem = new ListViewItem(new string[] { value, GetRegValueStringType(valueInfo.RegDataType), valueInfo.sData });

                            lvItem.Tag = valueInfo;
                            lvRegistryPage.Items.Add(lvItem);
                        }
                    }
                }
            }

            LACTreeNode[] nodestoAddedRe = new LACTreeNode[nodesToAdd.Count];
            int idx = 0;
            if (nodesToAdd != null && nodesToAdd.Count != 0)
            {
                foreach (string key in nodesToAdd.Keys) {
                    nodestoAddedRe[idx] = nodesToAdd[key];
                    idx++;
                }
            }

            if (nodestoAddedRe != null && nodestoAddedRe.Length != 0)
                treeNode.Nodes.AddRange(nodestoAddedRe);
        }
        private void Do_CreateKey(SubKeyInfo keyInfo, LACTreeNode node)
        {
            if (keyInfo != null)
            {
                RegistryAddSubKeyDlg addDlg = new RegistryAddSubKeyDlg(string.Empty, true, keyInfo.sSubKey);
                if (addDlg.ShowDialog(this) == DialogResult.OK)
                {
                    RegistryInteropWrapperWindows.Win32CreateSubKey(keyInfo.sSubKey, addDlg.KeyName);

                    treeNode.IsModified = true;
                    treeNode.sc.ShowControl(treeNode);
                }
            }
        }