Added a check if all required files are available at startup. Improved the crash reporting.
1.1 --- a/GUI/CrashReportForm.Designer.cs Fri Apr 30 20:53:40 2010 +0000
1.2 +++ b/GUI/CrashReportForm.Designer.cs Sat May 01 12:12:37 2010 +0000
1.3 @@ -70,6 +70,8 @@
1.4 this.reportPanel = new System.Windows.Forms.Panel();
1.5 this.reportTextBox = new System.Windows.Forms.TextBox();
1.6 this.textBox1 = new System.Windows.Forms.TextBox();
1.7 + this.label2 = new System.Windows.Forms.Label();
1.8 + this.emailTextBox = new System.Windows.Forms.TextBox();
1.9 this.commentPanel.SuspendLayout();
1.10 this.reportPanel.SuspendLayout();
1.11 this.SuspendLayout();
1.12 @@ -77,10 +79,10 @@
1.13 // sendButton
1.14 //
1.15 this.sendButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1.16 - this.sendButton.Location = new System.Drawing.Point(467, 412);
1.17 + this.sendButton.Location = new System.Drawing.Point(449, 469);
1.18 this.sendButton.Name = "sendButton";
1.19 this.sendButton.Size = new System.Drawing.Size(75, 23);
1.20 - this.sendButton.TabIndex = 1;
1.21 + this.sendButton.TabIndex = 2;
1.22 this.sendButton.Text = "Send";
1.23 this.sendButton.UseVisualStyleBackColor = true;
1.24 this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
1.25 @@ -89,10 +91,10 @@
1.26 //
1.27 this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
1.28 this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
1.29 - this.exitButton.Location = new System.Drawing.Point(548, 412);
1.30 + this.exitButton.Location = new System.Drawing.Point(530, 469);
1.31 this.exitButton.Name = "exitButton";
1.32 this.exitButton.Size = new System.Drawing.Size(75, 23);
1.33 - this.exitButton.TabIndex = 2;
1.34 + this.exitButton.TabIndex = 3;
1.35 this.exitButton.Text = "Exit";
1.36 this.exitButton.UseVisualStyleBackColor = true;
1.37 //
1.38 @@ -105,8 +107,8 @@
1.39 this.commentTextBox.Multiline = true;
1.40 this.commentTextBox.Name = "commentTextBox";
1.41 this.commentTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
1.42 - this.commentTextBox.Size = new System.Drawing.Size(604, 77);
1.43 - this.commentTextBox.TabIndex = 0;
1.44 + this.commentTextBox.Size = new System.Drawing.Size(586, 77);
1.45 + this.commentTextBox.TabIndex = 1;
1.46 //
1.47 // titleLabel
1.48 //
1.49 @@ -118,7 +120,7 @@
1.50 this.titleLabel.Location = new System.Drawing.Point(-1, -1);
1.51 this.titleLabel.Name = "titleLabel";
1.52 this.titleLabel.Padding = new System.Windows.Forms.Padding(10);
1.53 - this.titleLabel.Size = new System.Drawing.Size(637, 52);
1.54 + this.titleLabel.Size = new System.Drawing.Size(619, 52);
1.55 this.titleLabel.TabIndex = 4;
1.56 this.titleLabel.Text = "Open Hardware Monitor has encountered a problem and needs to close. We are sorry " +
1.57 "for the inconvenience.";
1.58 @@ -135,7 +137,7 @@
1.59 this.label3.Size = new System.Drawing.Size(571, 13);
1.60 this.label3.TabIndex = 5;
1.61 this.label3.Text = "To help diagnose and fix the problem, you can send a crash report. The following " +
1.62 - "report has been created automatically.";
1.63 + "report has been created automatically:";
1.64 //
1.65 // label1
1.66 //
1.67 @@ -143,12 +145,12 @@
1.68 | System.Windows.Forms.AnchorStyles.Right)));
1.69 this.label1.AutoEllipsis = true;
1.70 this.label1.AutoSize = true;
1.71 - this.label1.Location = new System.Drawing.Point(9, 290);
1.72 + this.label1.Location = new System.Drawing.Point(9, 347);
1.73 this.label1.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8);
1.74 this.label1.Name = "label1";
1.75 - this.label1.Size = new System.Drawing.Size(233, 13);
1.76 + this.label1.Size = new System.Drawing.Size(279, 13);
1.77 this.label1.TabIndex = 6;
1.78 - this.label1.Text = "You can add additional information to the report.";
1.79 + this.label1.Text = "You can add additional information to the report (optional):";
1.80 //
1.81 // commentPanel
1.82 //
1.83 @@ -157,12 +159,13 @@
1.84 this.commentPanel.BackColor = System.Drawing.SystemColors.Window;
1.85 this.commentPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
1.86 this.commentPanel.Controls.Add(this.commentTextBox);
1.87 - this.commentPanel.Location = new System.Drawing.Point(12, 314);
1.88 + this.commentPanel.Location = new System.Drawing.Point(12, 371);
1.89 this.commentPanel.Margin = new System.Windows.Forms.Padding(3, 3, 3, 8);
1.90 this.commentPanel.Name = "commentPanel";
1.91 this.commentPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4);
1.92 - this.commentPanel.Size = new System.Drawing.Size(611, 87);
1.93 - this.commentPanel.TabIndex = 7;
1.94 + this.commentPanel.Size = new System.Drawing.Size(593, 87);
1.95 + this.commentPanel.TabIndex = 1;
1.96 + this.commentPanel.TabStop = true;
1.97 //
1.98 // reportPanel
1.99 //
1.100 @@ -176,7 +179,7 @@
1.101 this.reportPanel.Location = new System.Drawing.Point(12, 87);
1.102 this.reportPanel.Name = "reportPanel";
1.103 this.reportPanel.Padding = new System.Windows.Forms.Padding(4, 4, 1, 4);
1.104 - this.reportPanel.Size = new System.Drawing.Size(611, 188);
1.105 + this.reportPanel.Size = new System.Drawing.Size(593, 212);
1.106 this.reportPanel.TabIndex = 8;
1.107 //
1.108 // reportTextBox
1.109 @@ -189,7 +192,7 @@
1.110 this.reportTextBox.Name = "reportTextBox";
1.111 this.reportTextBox.ReadOnly = true;
1.112 this.reportTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
1.113 - this.reportTextBox.Size = new System.Drawing.Size(604, 178);
1.114 + this.reportTextBox.Size = new System.Drawing.Size(586, 202);
1.115 this.reportTextBox.TabIndex = 9;
1.116 this.reportTextBox.TabStop = false;
1.117 //
1.118 @@ -200,17 +203,42 @@
1.119 this.textBox1.Location = new System.Drawing.Point(4, 4);
1.120 this.textBox1.Multiline = true;
1.121 this.textBox1.Name = "textBox1";
1.122 - this.textBox1.Size = new System.Drawing.Size(604, 178);
1.123 + this.textBox1.Size = new System.Drawing.Size(586, 202);
1.124 this.textBox1.TabIndex = 2;
1.125 //
1.126 + // label2
1.127 + //
1.128 + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
1.129 + | System.Windows.Forms.AnchorStyles.Right)));
1.130 + this.label2.AutoEllipsis = true;
1.131 + this.label2.AutoSize = true;
1.132 + this.label2.Location = new System.Drawing.Point(9, 318);
1.133 + this.label2.Margin = new System.Windows.Forms.Padding(3, 12, 3, 8);
1.134 + this.label2.Name = "label2";
1.135 + this.label2.Size = new System.Drawing.Size(171, 13);
1.136 + this.label2.TabIndex = 9;
1.137 + this.label2.Text = "Enter your email address (optional):";
1.138 + //
1.139 + // emailTextBox
1.140 + //
1.141 + this.emailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
1.142 + | System.Windows.Forms.AnchorStyles.Right)));
1.143 + this.emailTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
1.144 + this.emailTextBox.Location = new System.Drawing.Point(188, 315);
1.145 + this.emailTextBox.Name = "emailTextBox";
1.146 + this.emailTextBox.Size = new System.Drawing.Size(417, 20);
1.147 + this.emailTextBox.TabIndex = 0;
1.148 + //
1.149 // CrashReportForm
1.150 //
1.151 this.AcceptButton = this.sendButton;
1.152 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
1.153 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
1.154 this.CancelButton = this.exitButton;
1.155 - this.ClientSize = new System.Drawing.Size(635, 447);
1.156 + this.ClientSize = new System.Drawing.Size(617, 504);
1.157 this.ControlBox = false;
1.158 + this.Controls.Add(this.emailTextBox);
1.159 + this.Controls.Add(this.label2);
1.160 this.Controls.Add(this.reportPanel);
1.161 this.Controls.Add(this.commentPanel);
1.162 this.Controls.Add(this.label1);
1.163 @@ -245,5 +273,7 @@
1.164 private System.Windows.Forms.Panel reportPanel;
1.165 private System.Windows.Forms.TextBox reportTextBox;
1.166 private System.Windows.Forms.TextBox textBox1;
1.167 + private System.Windows.Forms.Label label2;
1.168 + private System.Windows.Forms.TextBox emailTextBox;
1.169 }
1.170 }
1.171 \ No newline at end of file
2.1 --- a/GUI/CrashReportForm.cs Fri Apr 30 20:53:40 2010 +0000
2.2 +++ b/GUI/CrashReportForm.cs Sat May 01 12:12:37 2010 +0000
2.3 @@ -61,7 +61,7 @@
2.4 exception = value;
2.5 StringBuilder s = new StringBuilder();
2.6 Version version = typeof(CrashReportForm).Assembly.GetName().Version;
2.7 - s.Append("Version: "); s.AppendLine(version.ToString());
2.8 + s.Append("Version: "); s.AppendLine(version.ToString());
2.9 s.AppendLine();
2.10 s.AppendLine(exception.ToString());
2.11 s.AppendLine();
2.12 @@ -69,7 +69,13 @@
2.13 s.AppendLine(exception.InnerException.ToString());
2.14 s.AppendLine();
2.15 }
2.16 - reportTextBox.Text = s.ToString();
2.17 + s.Append("Common Language Runtime: ");
2.18 + s.AppendLine(Environment.Version.ToString());
2.19 + s.Append("Operating System: ");
2.20 + s.AppendLine(Environment.OSVersion.ToString());
2.21 + s.Append("Process Type: ");
2.22 + s.AppendLine(IntPtr.Size == 4 ? "32-Bit" : "64-Bit");
2.23 + reportTextBox.Text = s.ToString();
2.24 }
2.25 }
2.26
2.27 @@ -84,8 +90,9 @@
2.28
2.29 string report =
2.30 "version=" + HttpUtility.UrlEncode(version.ToString()) + "&" +
2.31 - "report=" + HttpUtility.UrlEncode(reportTextBox.Text +
2.32 - commentTextBox.Text);
2.33 + "report=" + HttpUtility.UrlEncode(reportTextBox.Text) + "&" +
2.34 + "comment=" + HttpUtility.UrlEncode(commentTextBox.Text) + "&" +
2.35 + "email=" + HttpUtility.UrlEncode(emailTextBox.Text);
2.36 byte[] byteArray = Encoding.UTF8.GetBytes(report);
2.37 request.ContentLength = byteArray.Length;
2.38
3.1 --- a/Program.cs Fri Apr 30 20:53:40 2010 +0000
3.2 +++ b/Program.cs Sat May 01 12:12:37 2010 +0000
3.3 @@ -57,6 +57,9 @@
3.4 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
3.5 #endif
3.6
3.7 + if (!AllRequiredFilesAvailable())
3.8 + Environment.Exit(0);
3.9 +
3.10 Application.EnableVisualStyles();
3.11 Application.SetCompatibleTextRenderingDefault(false);
3.12 using (GUI.MainForm form = new GUI.MainForm()) {
3.13 @@ -67,6 +70,37 @@
3.14 }
3.15 }
3.16
3.17 + private static bool IsFileAvailable(string fileName) {
3.18 + string path = Path.GetDirectoryName(Application.ExecutablePath) +
3.19 + Path.DirectorySeparatorChar;
3.20 +
3.21 + if (!File.Exists(path + fileName)) {
3.22 + MessageBox.Show("The following file could not be found: " + fileName +
3.23 + "\nPlease extract all files from the zip archive.", "Error",
3.24 + MessageBoxButtons.OK, MessageBoxIcon.Error);
3.25 + return false;
3.26 + }
3.27 + return true;
3.28 + }
3.29 +
3.30 + private static bool AllRequiredFilesAvailable() {
3.31 + if (!IsFileAvailable("Aga.Controls.dll"))
3.32 + return false;
3.33 +
3.34 + if (IntPtr.Size == 4) {
3.35 + if (!IsFileAvailable("WinRing0.dll"))
3.36 + return false;
3.37 + if (!IsFileAvailable("WinRing0.sys"))
3.38 + return false;
3.39 + } else {
3.40 + if (!IsFileAvailable("WinRing0x64.dll"))
3.41 + return false;
3.42 + if (!IsFileAvailable("WinRing0x64.sys"))
3.43 + return false;
3.44 + }
3.45 + return true;
3.46 + }
3.47 +
3.48 private static void ReportException(Exception e) {
3.49 CrashReportForm form = new CrashReportForm();
3.50 form.Exception = e;