public void HandleCreateRegistryKey(TcpSocketSaeaSession session) { var packet = GetMessageEntity <DoCreateRegistryKeyPack>(session); GetCreateRegistryKeyResponsePack responsePacket = new GetCreateRegistryKeyResponsePack(); 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; SendTo(CurrentSession, MessageHead.C_NREG_CREATE_KEY_RESPONSE, responsePacket); //client.Send(responsePacket); }
public void CtrlAltDelHandler(TcpSocketSaeaSession session) { var registryKey = RegistryEditor.GetWritableRegistryKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"); registryKey.SetValue("SoftwareSASGeneration", 00000003, Microsoft.Win32.RegistryValueKind.DWord); if (AppConfiguartion.HasSystemAuthority) { UserTrunkContext.UserTrunkContextInstance?.SendSas(); } else { User32.SendSAS(true); } }
public void HandleDeleteRegistryKey(TcpSocketSaeaSession session) { DoDeleteRegistryKeyPack packet = GetMessageEntity <DoDeleteRegistryKeyPack>(session); GetDeleteRegistryKeyResponsePack responsePacket = new GetDeleteRegistryKeyResponsePack(); string errorMsg; try { responsePacket.IsError = !(RegistryEditor.DeleteRegistryKey(packet.KeyName, packet.ParentPath, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.ParentPath = packet.ParentPath; responsePacket.KeyName = packet.KeyName; SendTo(CurrentSession, MessageHead.C_NREG_DELETE_KEY_RESPONSE, responsePacket); //client.Send(responsePacket); }
public void HandleChangeRegistryValue(TcpSocketSaeaSession session) { DoChangeRegistryValuePack packet = GetMessageEntity <DoChangeRegistryValuePack>(session); GetChangeRegistryValueResponsePack responsePacket = new GetChangeRegistryValueResponsePack(); string errorMsg; try { responsePacket.IsError = !(RegistryEditor.ChangeRegistryValue(packet.Value, packet.KeyPath, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.KeyPath = packet.KeyPath; responsePacket.Value = packet.Value; SendTo(CurrentSession, MessageHead.C_NREG_CHANGE_VALUE_RESPONSE, responsePacket); //client.Send(responsePacket); }
public void HandleCreateRegistryValue(TcpSocketSaeaSession session) { DoCreateRegistryValuePack packet = GetMessageEntity <DoCreateRegistryValuePack>(session); GetCreateRegistryValueResponsePack responsePacket = new GetCreateRegistryValueResponsePack(); string errorMsg; string newKeyName = ""; try { responsePacket.IsError = !(RegistryEditor.CreateRegistryValue(packet.KeyPath, packet.Kind, out newKeyName, out errorMsg)); } catch (Exception ex) { responsePacket.IsError = true; errorMsg = ex.Message; } responsePacket.ErrorMsg = errorMsg; responsePacket.Value = RegistryKeyHelper.CreateRegValueData(newKeyName, packet.Kind, packet.Kind.GetDefault()); responsePacket.KeyPath = packet.KeyPath; SendTo(CurrentSession, MessageHead.C_NREG_CREATE_VALUE_RESPONSE, responsePacket); //client.Send(responsePacket); }