private void frmPropertiesWindow_Load(object sender, EventArgs e) { if (data is ComputerData) { this.Text = "Computer informations"; transformeddata = new PComputerData(); ClassCopy.CopyClassData(data, transformeddata); ((PComputerData)transformeddata).IOSVerType = ((ComputerData)data).OSVerType; PropertiesG.SelectedObject = transformeddata; } if (data is AddRemoveAppReport) { this.Text = "Software informations"; transformeddata = new PAddRemovePrograms(); ClassCopy.CopyClassData(data, transformeddata); PropertiesG.SelectedObject = transformeddata; } if (data is DiskDataReport) { this.Text = "Disk informations"; transformeddata = new PDiskDataReport(); ClassCopy.CopyClassData(data, transformeddata); PropertiesG.SelectedObject = transformeddata; } if (data is StartupItemFull) { this.Text = "Startup informations"; transformeddata = new PStartupItemFull(); ClassCopy.CopyClassData(data, transformeddata); PropertiesG.SelectedObject = transformeddata; } }
private void ctlWindowsLicense_Load(object sender, EventArgs e) { PropertyGrid wlg = new PropertyGrid(); wlg.HelpVisible = false; wlg.Dock = DockStyle.Fill; WindowsLic winlic = Program.net.GetWindowsLicData(MID); if (winlic != null) { PWindowsLic winlictransformeddata = new PWindowsLic(); ClassCopy.CopyClassData(winlic, winlictransformeddata); wlg.SelectedObject = winlictransformeddata; } this.Controls.Add(wlg); }
public RESTStatus ReportEventLog(SQLLib sql, ListEventLogReport EventLogList, NetworkConnectionInfo ni) { if (ni.HasAcl(ACLFlags.ComputerLogin) == false) { ni.Error = "Access denied"; ni.ErrorID = ErrorFlags.AccessDenied; return(RESTStatus.Denied); } EventLogList.MachineID = ni.Username; lock (ni.sqllock) { if (Convert.ToInt32(sql.ExecSQLScalar("SELECT COUNT(*) FROM ComputerAccounts WHERE MachineID=@m", new SQLParam("@m", EventLogList.MachineID))) == 0) { ni.Error = "Invalid MachineID"; ni.ErrorID = ErrorFlags.InvalidValue; return(RESTStatus.Denied); } } if (EventLogList.Items == null) { ni.Error = "Invalid Items"; ni.ErrorID = ErrorFlags.InvalidValue; return(RESTStatus.Fail); } if (EventLogList.Items.Count == 0) { return(RESTStatus.Created); } DateTime DT = DateTime.Now; foreach (EventLogReport ar in EventLogList.Items) { if (NullTest.Test(ar) == false) { ni.Error = "Invalid Items"; ni.ErrorID = ErrorFlags.InvalidValue; return(RESTStatus.Fail); } CommonUtilities.CalcEventLogID(ar); } List <SQLParam> sqlparams = new List <SQLParam>(); sqlparams.Add(new SQLParam("@id", EventLogList.MachineID)); int count = 1; string vars = ""; foreach (EventLogReport ar in EventLogList.Items) { sqlparams.Add(new SQLParam("@p" + count.ToString(), ar.LogID)); vars += "@p" + count.ToString() + ","; count++; } if (vars.EndsWith(",") == true) { vars = vars.Substring(0, vars.Length - 1); } List <string> LogIDinDB = new List <string>(); lock (ni.sqllock) { SqlDataReader dr = sql.ExecSQLReader("SELECT LogID FROM EventLog WHERE MachineID=@id and LogID in (" + vars + ")", sqlparams.ToArray()); while (dr.Read()) { LogIDinDB.Add(Convert.ToString(dr["LogID"])); } dr.Close(); } List <EventLogReport> RemoveEVL = new List <EventLogReport>(); foreach (EventLogReport ar in EventLogList.Items) { if (LogIDinDB.Contains(ar.LogID) == true) { RemoveEVL.Add(ar); continue; } if (SettingsManager.Settings.KeepEventLogDays > 0) { if (ar.TimeGenerated < DateTime.UtcNow.AddDays(0 - SettingsManager.Settings.KeepEventLogDays)) { RemoveEVL.Add(ar); continue; } } } foreach (EventLogReport ar in RemoveEVL) { EventLogList.Items.Remove(ar); } List <EventLogReportFull> car = new List <EventLogReportFull>(); lock (ni.sqllock) { try { sql.BeginTransaction(); sql.SEHError = true; foreach (EventLogReport ar in EventLogList.Items) { EventLogReportFull arr = new EventLogReportFull(); ClassCopy.CopyClassData(ar, arr); arr.Reported = DateTime.UtcNow; arr.MachineID = EventLogList.MachineID; List <SQLData> d = sql.InsertFromClassPrep(arr); foreach (SQLData dd in d) { if (dd.Column == "ID") { dd.Data = DBNull.Value; break; } } car.Add(arr); sql.InsertFromClass("EventLog", arr); } sql.CommitTransaction(); } catch (Exception ee) { sql.RollBackTransaction(); FoxEventLog.WriteEventLog("DB Error: Cannot insert data to EventLog: " + ee.ToString() + "\r\n\r\nJSON: " + JsonConvert.SerializeObject(car, Formatting.Indented), System.Diagnostics.EventLogEntryType.Error); return(RESTStatus.ServerError); } finally { sql.SEHError = false; } } Thread t = new Thread(new ParameterizedThreadStart(new DReportingThread(ReportingThread))); t.Start(car); return(RESTStatus.Created); }
private void TV_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode selected = TV.SelectedNode; if (selected.Tag == null) { PG.SelectedObject = null; return; } PPnPDevice pnp = new PPnPDevice(); ClassCopy.CopyClassData(selected.Tag, pnp); switch (pnp.ConfigManagerErrorCode) { case 0: pnp.ConfigManagerErrorCodeText = "This device is working properly."; break; case 1: pnp.ConfigManagerErrorCodeText = "This device is not configured correctly."; break; case 2: pnp.ConfigManagerErrorCodeText = "Windows cannot load the driver for this device."; break; case 3: pnp.ConfigManagerErrorCodeText = "The driver for this device might be corrupted, or your system may be running low on memory or other resources."; break; case 4: pnp.ConfigManagerErrorCodeText = "This device is not working properly. One of its drivers or your registry might be corrupted."; break; case 5: pnp.ConfigManagerErrorCodeText = "The driver for this device needs a resource that Windows cannot manage."; break; case 6: pnp.ConfigManagerErrorCodeText = "The boot configuration for this device conflicts with other devices."; break; case 7: pnp.ConfigManagerErrorCodeText = "Cannot filter."; break; case 8: pnp.ConfigManagerErrorCodeText = "The driver loader for the device is missing."; break; case 9: pnp.ConfigManagerErrorCodeText = "This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly."; break; case 10: pnp.ConfigManagerErrorCodeText = "This device cannot start."; break; case 11: pnp.ConfigManagerErrorCodeText = "This device failed."; break; case 12: pnp.ConfigManagerErrorCodeText = "This device cannot find enough free resources that it can use."; break; case 13: pnp.ConfigManagerErrorCodeText = "Windows cannot verify this device's resources."; break; case 14: pnp.ConfigManagerErrorCodeText = "This device cannot work properly until you restart your computer."; break; case 15: pnp.ConfigManagerErrorCodeText = "This device is not working properly because there is probably a re-enumeration problem."; break; case 16: pnp.ConfigManagerErrorCodeText = "Windows cannot identify all the resources this device uses."; break; case 17: pnp.ConfigManagerErrorCodeText = "This device is asking for an unknown resource type."; break; case 18: pnp.ConfigManagerErrorCodeText = "Reinstall the drivers for this device."; break; case 19: pnp.ConfigManagerErrorCodeText = "Your registry might be corrupted."; break; case 20: pnp.ConfigManagerErrorCodeText = "Failure using the VxD loader."; break; case 21: pnp.ConfigManagerErrorCodeText = "System failure: Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device."; break; case 22: pnp.ConfigManagerErrorCodeText = "This device is disabled."; break; case 23: pnp.ConfigManagerErrorCodeText = "System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation."; break; case 24: pnp.ConfigManagerErrorCodeText = "This device is not present, is not working properly, or does not have all its drivers installed."; break; case 25: pnp.ConfigManagerErrorCodeText = "Windows is still setting up this device."; break; case 26: pnp.ConfigManagerErrorCodeText = "Windows is still setting up this device."; break; case 27: pnp.ConfigManagerErrorCodeText = "This device does not have valid log configuration."; break; case 28: pnp.ConfigManagerErrorCodeText = "The drivers for this device are not installed."; break; case 29: pnp.ConfigManagerErrorCodeText = "This device is disabled because the firmware of the device did not give it the required resources."; break; case 30: pnp.ConfigManagerErrorCodeText = "This device is using an Interrupt Request (IRQ) resource that another device is using."; break; case 31: pnp.ConfigManagerErrorCodeText = "This device is not working properly because Windows cannot load the drivers required for this device."; break; default: pnp.ConfigManagerErrorCodeText = "??? " + pnp.ConfigManagerErrorCode.ToString(); break; } PG.SelectedObject = pnp; }
private void frmComputerInfo_Load(object sender, EventArgs e) { data = Program.net.GetComputerDetail(MID); lblPing.Text = "Status pending .."; lblWUReboot.Text = lblWUStatus.Text = ""; picStatus.Image = Resources.Help.ToBitmap(); if (data == null) { this.Text = "Computer Information: ???"; return; } Program.LoadImageList(TVImgList); PComputerData transformeddata = new PComputerData(); ClassCopy.CopyClassData(data, transformeddata); ((PComputerData)transformeddata).IOSVerType = ((ComputerData)data).OSVerType; ((PComputerData)transformeddata).OSWin10Edition = Win10Version.GetWin10Version(transformeddata.OSVersion); ((PComputerData)transformeddata).BMeteredConnection = data.IsMeteredConnection; ((PComputerData)transformeddata).RunningInWindowsPE = data.RunningInWindowsPE; if (Settings.Default.ShowActiveUsers == false) { transformeddata.OneUser = "******"; } PropertiesG.SelectedObject = transformeddata; this.Text = "Computer information: " + data.Computername; #if !ENABLECHAT tabControl1.TabPages.Remove(tabPage6); #endif AddTab(new ctlServices(MID), "Services"); AddTab(new ctlEventLogs(MID), "Event Log"); AddTab(new ctlAddRemovePrograms(MID), "Programs"); AddTab(new ctlListDiskData(MID), "Disk"); AddTab(new ctlListNetworkConfig(MID), "Network"); AddTab(new ctlDevices(MID), "Devices"); AddTab(new ctlDevicesFilter(MID), "Filter Drivers"); AddTab(new ctlBitlockerRK(MID), "Bitlocker Recovery"); AddTab(new ctlWindowsLicense(MID), "Windows License"); AddTab(new ctlFileTransfer(MID), "File transfer"); AddTab(new ctlStartupItems(MID), "Startup Items"); AddTab(new ctlSMARTInfo(MID), "SMART Data"); AddTab(new ctlSimpleTasks(MID), "Simple Tasks"); timerPinger_Tick(null, null); lstRemotePort.Items.Add("HTTP"); lstRemotePort.Items.Add("RDP"); lstRemotePort.Items.Add("HTTPS"); lstRemotePort.Items.Add("SSH"); lstRemotePort.Items.Add("SMTP"); lstRemotePort.Items.Add("POP3"); lstRemotePort.Items.Add("IMAP"); lstRemotePort.Items.Add("TELNET"); LoadPolicies(); }