forked from MarkusMaal/BlueScreenSimulatorPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulatorDatabase.cs
More file actions
1125 lines (1052 loc) · 51.7 KB
/
SimulatorDatabase.cs
File metadata and controls
1125 lines (1052 loc) · 51.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using UltimateBlueScreenSimulator;
using System.Drawing;
using System.Management;
using System.Threading;
//
// This namespace contains classes that are shared between forms that specify
// using SimulatorDatabase;
// at the top
//
namespace SimulatorDatabase
{
public class DrawRoutines
{
public void Draw(WindowScreen ws)
{
// for upscaling and multidisplay support
if (ws.primary || Program.multidisplaymode == "mirror")
{
var frm = Form.ActiveForm;
if (frm is null)
{
return;
}
using (Bitmap bmp = new Bitmap(frm.Width, frm.Height))
{
frm.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
Bitmap newImage = new Bitmap(ws.Width, ws.Height);
using (Graphics g = Graphics.FromImage(newImage))
{
if (Program.f1.GMode == "HighQualityBicubic") { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; }
if (Program.f1.GMode == "HighQualityBilinear") { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear; }
if (Program.f1.GMode == "Bilinear") { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear; }
if (Program.f1.GMode == "Bicubic") { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic; }
if (Program.f1.GMode == "NearestNeighbour") { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; }
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.DrawImage(bmp, new Rectangle(0, 0, ws.Width, ws.Height));
}
// dispose old images from memory to avoid memory leaks and potentially
// actual crashes
if (ws.screenDisplay.Image != null)
{
ws.screenDisplay.Image.Dispose();
}
ws.screenDisplay.Image = newImage;
bmp.Dispose();
}
}
}
}
struct USBDeviceInfo
{
public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
{
this.DeviceID = deviceID;
this.PnpDeviceID = pnpDeviceID;
this.Description = description;
}
public string DeviceID { get; private set; }
public string PnpDeviceID { get; private set; }
public string Description { get; private set; }
public static List<USBDeviceInfo> GetUSBDevices()
{
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
collection = searcher.Get();
foreach (var device in collection)
{
devices.Add(new USBDeviceInfo(
(string)device.GetPropertyValue("DeviceID"),
(string)device.GetPropertyValue("PNPDeviceID"),
(string)device.GetPropertyValue("Description")
));
}
collection.Dispose();
return devices;
}
}
//
// Blue screen template class
//
public class BlueScreen
{
// constructor
private Color background;
private Color foreground;
private Color highlight_bg;
private Color highlight_fg;
private string[] ecodes;
private string os;
private Font font;
// possible values:
// 2D flag
// 3D flag
// 2D window
// 3D window
private string icon;
readonly IDictionary<string, string> titles;
readonly IDictionary<string, string> texts;
readonly IDictionary<string, string[]> codefiles;
readonly IDictionary<string, bool> bools;
readonly IDictionary<string, int> ints;
readonly IDictionary<string, string> strings;
readonly IDictionary<int, int> progression;
private readonly Random r;
public BlueScreen(string base_os, bool autosetup = true)
{
this.r = new Random();
this.background = Color.FromArgb(0, 0, 0);
this.foreground = Color.FromArgb(255, 255, 255);
this.os = base_os;
string[] codes_temp = { "RRRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR" };
this.ecodes = codes_temp;
this.highlight_bg = Color.FromArgb(255, 255, 255);
this.highlight_fg = Color.FromArgb(0, 0, 0);
this.icon = "2D flag";
this.titles = new Dictionary<string, string>();
this.texts = new Dictionary<string, string>();
this.codefiles = new Dictionary<string, string[]>();
this.bools = new Dictionary<string, bool>();
this.ints = new Dictionary<string, int>();
this.strings = new Dictionary<string, string>();
this.progression = new Dictionary<int, int>();
this.font = new Font("Lucida Console", 10.4f, FontStyle.Regular);
if (autosetup) { SetOSSpecificDefaults(); }
}
public IDictionary<string, bool> AllBools() { return this.bools; }
public IDictionary<string, int> AllInts() { return this.ints; }
public IDictionary<string, string> AllStrings() { return this.strings; }
public IDictionary<int, int> AllProgress() { return this.progression; }
// blue screen properties
public bool GetBool(string name)
{
if (this.bools.ContainsKey(name))
{
return this.bools[name];
}
else
{
return false;
}
}
public void SetBool(string name, bool value)
{
if (this.bools.ContainsKey(name))
{
this.bools[name] = value;
}
else
{
this.bools.Add(name, value);
}
}
public string GetString(string name)
{
switch (name)
{
case "os": return this.os;
case "icon": return this.icon;
case "ecode1": return this.ecodes[0];
case "ecode2": return this.ecodes[1];
case "ecode3": return this.ecodes[2];
case "ecode4": return this.ecodes[3];
default:
if (this.strings.ContainsKey(name))
{
return strings[name];
}
else if (this.titles.ContainsKey(name))
{
return titles[name];
}
else if (this.texts.ContainsKey(name))
{
return texts[name];
}
else
{
return "";
}
}
}
public void ClearAllTitleTexts()
{
this.titles.Clear();
this.texts.Clear();
}
public void ClearProgress()
{
this.progression.Clear();
}
public void SetString(string name, string value)
{
switch (name)
{
case "icon": this.icon = value; break;
case "os": this.os = value; break;
default:
if (this.strings.ContainsKey(name))
{
this.strings[name] = value;
}
else
{
this.strings.Add(name, value);
}
break;
}
}
public void SetTitle(string name, string value)
{
this.titles[name] = value;
}
public void PushTitle(string name, string value)
{
this.titles.Add(name, value);
}
public void SetText(string name, string value)
{
this.texts[name] = value;
}
public void PushText(string name, string value)
{
this.texts.Add(name, value);
}
// theming
public Color GetTheme(bool bg, bool highlight = false)
{
if (highlight)
{
if (bg) { return this.highlight_bg; } else { return this.highlight_fg; }
}
if (bg) { return this.background; } else { return this.foreground; }
}
public void SetTheme(Color bg, Color fg, bool highlight = false)
{
if (highlight)
{
this.highlight_bg = bg;
this.highlight_fg = fg;
return;
}
this.background = bg;
this.foreground = fg;
}
// error codes
public string[] GetCodes()
{
return this.ecodes;
}
public void SetCodes(string code1, string code2, string code3, string code4)
{
string[] code_temp = { code1, code2, code3, code4 };
this.ecodes = code_temp;
}
private Color RGB(int r, int g, int b)
{
return Color.FromArgb(r, g, b);
}
// integers
public int GetInt(string name)
{
if (this.ints.ContainsKey(name))
{
return this.ints[name];
}
else
{
return 1;
}
}
public void SetInt(string name, int value)
{
if (this.ints.ContainsKey(name))
{
this.ints[name] = value;
}
else
{
this.ints.Add(name, value);
}
}
public void SetFont(string font_family, float emsize, FontStyle style)
{
this.font = new Font(font_family, emsize, style);
}
public Font GetFont()
{
return this.font;
}
public Icon GetIcon()
{
ImageList windowsIcons = new StringEdit().AllIcons;
switch (GetString("icon"))
{
case "2D flag":
return Icon.FromHandle(((Bitmap)windowsIcons.Images[0]).GetHicon());
case "3D flag":
return Icon.FromHandle(((Bitmap)windowsIcons.Images[1]).GetHicon());
case "3D window":
return Icon.FromHandle(((Bitmap)windowsIcons.Images[2]).GetHicon());
case "2D window":
return Icon.FromHandle(((Bitmap)windowsIcons.Images[3]).GetHicon());
default:
return Icon.FromHandle(((Bitmap)windowsIcons.Images[0]).GetHicon());
}
}
public IDictionary<string, string> GetTitles()
{
return this.titles;
}
public IDictionary<string, string> GetTexts()
{
return this.texts;
}
// progress keyframes
public int GetProgression(int name)
{
if (this.progression.ContainsKey(name))
{
return this.progression[name];
}
else
{
return 0;
}
}
public void SetProgression(int name, int value)
{
if (this.progression.ContainsKey(name))
{
this.progression[name] = value;
}
else
{
this.progression.Add(name, value);
}
}
public void SetAllProgression(int[] keys, int[] values)
{
this.progression.Clear();
for (int i = 0; i < keys.Length; i++)
{
this.progression[keys[i]] = values[i];
}
}
//GenAddress uses the last function to generate multiple error address codes
public string GenAddress(int count, int places, bool lower)
{
string ot = "";
string inspir = GetString("ecode1");
for (int i = 0; i < count; i++)
{
if (i == 1) { inspir = GetString("ecode2"); }
if (i == 2) { inspir = GetString("ecode3"); }
if (i == 3) { inspir = GetString("ecode4"); }
if (ot != "") { ot += ", "; }
ot += "0x" + GenHex(places, inspir);
}
if (lower) { return ot.ToLower(); }
return ot;
}
//generates hexadecimal codes
//lettercount sets the length of the actual hex code
//inspir is a string where each character represents if the value is fixed or random
public string GenHex(int lettercount, string inspir)
{
//sleep command is used to make sure that randomization works properly
System.Threading.Thread.Sleep(20);
string output = "";
Random r = new Random();
for (int i = 0; i < lettercount; i++)
{
int temp = r.Next(15);
char lette = ' ';
if ((inspir + inspir).Substring(i, 1) == "R")
{
if (temp < 10) { lette = Convert.ToChar(temp.ToString()); }
if (temp == 10) { lette = 'A'; }
if (temp == 11) { lette = 'B'; }
if (temp == 12) { lette = 'C'; }
if (temp == 13) { lette = 'D'; }
if (temp == 14) { lette = 'E'; }
if (temp == 15) { lette = 'F'; }
}
else
{
lette = Convert.ToChar((inspir + inspir).Substring(i, 1));
}
output += lette.ToString();
}
return output;
}
public void PushFile(string name, string[] codes)
{
if (!codefiles.ContainsKey(name))
{
codefiles.Add(name, codes);
}
}
public IDictionary<string, string[]> GetFiles()
{
return codefiles;
}
public void ClearFiles()
{
codefiles.Clear();
}
public void RenameFile(string key, string renamed)
{
string[] codes;
foreach (KeyValuePair<string, string[]> kvp in this.GetFiles())
{
if (key == kvp.Key)
{
codes = kvp.Value;
this.codefiles.Remove(key);
this.PushFile(renamed, codes);
break;
}
}
}
public void SetFile(string key, int subcode, string code)
{
foreach (KeyValuePair<string, string[]> kvp in this.GetFiles())
{
if (key == kvp.Key)
{
string[] codearray = kvp.Value;
codearray[subcode] = code;
this.codefiles[key] = codearray;
break;
}
}
}
//GenFile generates a new file for use in Windows NT blue screen
public string GenFile(bool lower = true)
{
string[] files = UltimateBlueScreenSimulator.Properties.Resources.CULPRIT_FILES.Split('\n');
List<string> filenames = new List<string>();
foreach (string line in files)
{
filenames.Add(line.Split(':')[0]);
}
int temp = this.r.Next(filenames.Count - 1);
while (this.GetFiles().ContainsKey(filenames[temp]))
{
temp = this.r.Next(filenames.Count - 1);
}
if (!lower)
{
return filenames[temp];
}
else
{
return filenames[temp].ToLower();
}
}
public void Show()
{
switch (this.os)
{
case "BOOTMGR":
BootMgr bm = new BootMgr
{
me = this
};
bm.ShowDialog();
Thread.CurrentThread.Abort();
break;
case "Windows 11":
SetupWinXabove(new WXBS(), true);
break;
case "Windows 10":
SetupWinXabove(new WXBS());
break;
case "Windows 8/8.1":
SetupWin8(new WXBS());
break;
case "Windows 7":
SetupVista(new Vistabs());
break;
case "Windows Vista":
SetupVista(new Vistabs());
break;
case "Windows XP":
SetupExperience(new Xvsbs());
break;
case "Windows 2000":
Setup2k(new W2kbs());
break;
case "Windows CE":
SetupCE(new Cebsod());
break;
case "Windows NT 3.x/4.0":
SetupNT(new NTBSOD());
break;
case "Windows 9x/Me":
Setup9x(new Old_bluescreen());
break;
case "Windows 3.1x":
Setup9x(new Old_bluescreen());
break;
case "Windows 1.x/2.x":
SetupWin(new Win());
break;
}
}
private void SetupCE(Cebsod bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.Font = this.GetFont();
bs.fullscreen = !GetBool("windowed");
bs.waterMarkText.Visible = GetBool("watermark");
bs.technicalCode.Text = "*** STOP: 0x" + GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString().Substring(4, 6) + " (" + GetString("code").Split(' ')[0].ToString().Replace("_", " ").ToLower() + ")";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
CheckMessageJustInCase();
Thread.CurrentThread.Abort();
}
private void CheckMessageJustInCase()
{
if (!Program.f1.showcursor)
{
Cursor.Show();
}
if (Program.f1.showmsg)
{
MessageBox.Show(Program.f1.MsgBoxMessage,
Program.f1.MsgBoxTitle,
Program.f1.MsgBoxType,
Program.f1.MsgBoxIcon);
Program.f1.showmsg = false;
}
}
private void SetupNT(NTBSOD bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
if (GetBool("show_file")) { bs.whatfail = GetString("culprit"); }
bs.error = GetString("code").Substring(0, GetString("code").ToString().Length - 1);
bs.fullscreen = !GetBool("windowed");
if (GetBool("amd")) { bs.processortype = "AuthenticAMD"; }
bs.stacktrace = GetBool("stack_trace");
bs.blink = GetBool("blink");
bs.waterMarkText.Visible = GetBool("watermark");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void Setup9x(Old_bluescreen bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.window = this.GetBool("windowed");
bs.screenmode = this.GetString("screen_mode");
bs.errorCode = GenHex(2, GetString("ecode1")) + " : " + GenHex(4, GetString("ecode2")) + " : " + GenHex(6, GetString("ecode3"));
bs.waterMarkText.Visible = this.GetBool("watermark");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void SetupWin(Win bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.window = this.GetBool("windowed");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void Setup2k(W2kbs bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.fullscreen = !this.GetBool("windowed");
bs.waterMarkText.Visible = this.GetBool("watermark");
if (this.GetBool("show_file")) { bs.whatfail = this.GetString("culprit"); }
bs.errorCode = string.Format(this.GetTexts()["Error code formatting"].Replace("{1}", "0x{1},0x{2},0x{3},0x{4}"), this.GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString(), GenHex(8, this.GetString("ecode1")), GenHex(8, this.GetString("ecode2")), GenHex(8, this.GetString("ecode3")), GenHex(8, this.GetString("ecode4")));
bs.errorCode = bs.errorCode + "\n" + this.GetString("code").Split(' ')[0].ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void SetupExperience(Xvsbs bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.fullscreen = !this.GetBool("windowed");
bs.errorCode.Visible = this.GetBool("show_details");
bs.waterMarkText.Visible = this.GetBool("watermark");
if (this.GetBool("show_file")) { bs.whatfail = this.GetString("culprit"); }
bs.errorCode.Text = this.GetString("code").Split(' ')[0].ToString();
bs.technicalCode.Text = "*** STOP: " + this.GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString() + " (" + GenAddress(4, 8, false) + ")";
bs.supportInfo.Text = this.GetTexts()["Technical support"] + "\n\n\nTechnical information:";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void SetupVista(Vistabs bs)
{
try
{
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.fullscreen = !this.GetBool("windowed");
bs.errorCode.Visible = this.GetBool("show_details");
bs.waterMarkText.Visible = this.GetBool("watermark");
if (this.GetBool("show_file")) { bs.whatfail = this.GetString("culprit"); }
if (this.GetBool("acpi"))
{
//bs.errorCode.Visible = false;
bs.dumpText.Visible = false;
}
bs.errorCode.Text = this.GetString("code").Split(' ')[0].ToString();
bs.technicalCode.Text = "*** STOP: " + this.GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString() + " (" + GenAddress(4, 16, false) + ")";
bs.supportInfo.Text = this.GetTexts()["Technical support"] + "\n\n\nTechnical information:";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void SetupWinXabove(WXBS bs, bool w11 = false)
{
bs.emoticonLabel.Text = this.GetString("emoticon");
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.qr = GetBool("qr");
bs.close = GetBool("autoclose");
bs.green = GetBool("insider");
bs.server = GetBool("server");
bs.maxprogressmillis = GetInt("progressmillis");
bs.w11 = w11;
bs.memCodes.Text = "0x" + GenHex(16, GetString("ecode1")) + "\r\n0x" +
GenHex(16, GetString("ecode2")) + "\r\n0x" +
GenHex(16, GetString("ecode3")) + "\r\n0x" +
GenHex(16, GetString("ecode4"));
bs.waterMarkText.Visible = GetBool("watermark");
if (GetBool("show_file")) { bs.whatfail = GetString("culprit"); }
if (GetBool("windowed")) { bs.WindowState = FormWindowState.Normal; bs.FormBorderStyle = FormBorderStyle.Sizable; }
try
{
if (GetBool("show_description"))
{
bs.code = GetString("code").Split(' ')[0].ToString();
}
else
{
bs.code = GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
private void SetupWin8(WXBS bs)
{
bs.emoticonLabel.Text = this.GetString("emoticon");
bs.BackColor = this.GetTheme(true);
bs.ForeColor = this.GetTheme(false);
bs.maxprogressmillis = GetInt("progressmillis");
bs.qr = false;
bs.w8 = true;
bs.close = GetBool("autoclose");
bs.green = false;
bs.server = false;
bs.memCodes.Text = "0x" + GenHex(16, GetString("ecode1")) + "\r\n0x" +
GenHex(16, GetString("ecode2")) + "\r\n0x" +
GenHex(16, GetString("ecode3")) + "\r\n0x" +
GenHex(16, GetString("ecode4"));
bs.waterMarkText.Visible = GetBool("watermark");
if (GetBool("show_file")) { bs.whatfail = GetString("culprit"); }
if (GetBool("windowed")) { bs.WindowState = FormWindowState.Normal; bs.FormBorderStyle = FormBorderStyle.Sizable; }
try
{
if (GetBool("show_description"))
{
bs.code = GetString("code").Split(' ')[0].ToString();
}
else
{
bs.code = GetString("code").Split(' ')[1].ToString().Replace(")", "").Replace("(", "").ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "A non-critical error has occoured", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
bs.me = this;
bs.ShowDialog();
Thread.CurrentThread.Abort();
}
public void Crash(string message, string stacktrace, string type)
{
Metaerror me = new Metaerror
{
stack_trace = stacktrace,
message = message,
type = type
};
switch (me.ShowDialog())
{
case DialogResult.Ignore:
break;
case DialogResult.Retry:
break;
case DialogResult.Abort:
Thread.CurrentThread.Abort();
break;
}
}
// default hacks for specific OS
public void SetOSSpecificDefaults()
{
SetBool("watermark", true);
switch (this.os)
{
case "BOOTMGR":
SetTheme(RGB(0, 0, 0), RGB(192, 192, 192));
SetTheme(RGB(0, 0, 0), RGB(255, 255, 255), true);
SetFont("Consolas", 16.0f, FontStyle.Regular);
PushTitle("Main", "Windows Boot Manager");
PushText("Troubleshooting introduction", "Windows failed to start. A recent hardware or software change might be the\r\ncause.To fix the problem:");
PushText("Troubleshooting", "1. Insert your Windows installation disc and restart your computer.\r\n2. Choose your language settings, and then click \"Next.\"\r\n3. Click \"Repair your computer.\"");
PushText("Troubleshooting without disc", "If you do not have this disc, contact your system administrator or computer\r\nmanufacturer for assistance.");
PushText("Error description", "The boot selection failed because a required device is\r\ninaccessible.");
PushText("Info", "Info:");
PushText("Status", "Status:");
PushText("Continue", "ENTER=Continue");
PushText("Exit", "ESC=Exit");
SetString("code", "0x0000000e");
break;
case "Windows 1.x/2.x":
SetTheme(RGB(0, 0, 170), RGB(255, 255, 255));
SetTheme(RGB(170, 170, 170), RGB(0, 0, 170), true);
SetInt("blink_speed", 100);
SetString("friendlyname", "Windows 1.x/2.x (Text mode, Standard)");
SetBool("playsound", true);
SetString("qr_file", "local:1");
SetBool("font_support", false);
SetBool("blinkblink", false);
SetString("qr_file", "local:1");
break;
case "Windows 3.1x":
SetTheme(RGB(0, 0, 170), RGB(255, 255, 255));
SetTheme(RGB(170, 170, 170), RGB(0, 0, 170), true);
SetInt("blink_speed", 100);
PushTitle("Main", "Windows");
PushText("No unresponsive programs", "Altough you can use CTRL+ALT+DEL to quit an application that has\r\nstopped responding to the system, there is no application in this\r\nstate.\r\nTo quit an application, use the application's quit or exit command,\r\nor choose the Close command from the Control menu.\r\n* Press any key to return to Windows\r\n* Press CTRL + ALT + DEL again to restart your computer.You will\r\nlose any unsaved information in all applications.");
PushText("Prompt", "Press any key to continue");
SetString("friendlyname", "Windows 3.1 (Text mode, Standard)");
SetBool("font_support", false);
SetBool("blinkblink", true);
SetString("screen_mode", "No unresponsive programs");
break;
case "Windows 9x/Me":
SetTheme(RGB(0, 0, 170), RGB(255, 255, 255));
SetTheme(RGB(170, 170, 170), RGB(0, 0, 170), true);
SetInt("blink_speed", 100);
SetCodes("0RRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR", "RRRRRRRRRRRRRRRR");
PushTitle("Main", "Windows");
PushTitle("System is busy", "System is busy. ");
PushTitle("Warning", "WARNING!");
PushText("System error", "An error has occurred. To continue:\r\n\r\nPress Enter to return to Windows, or\r\n\r\nPress CTRL + ALT + DEL to restart your computer. If you do this,\r\nyou will lose any unsaved information in all open applications.\r\n\r\nError: {0}");
PushText("Application error", "A fatal exception {2} has occurred at {0}:{1}. The current\r\napplication will be terminated.\r\n\r\n* Press any key to terminate current application\r\n* Press CTRL + ALT + DEL again to restart your computer. You will\r\n lose any unsaved information in all applications.");
PushText("Driver error", "A fatal exception {2} has occurred at {0}:{1} in VXD VMM(01) +\r\n{2}. The current application will be terminated.\r\n\r\n* Press any key to terminate current application\r\n* Press CTRL + ALT + DEL again to restart your computer. You will\r\n lose any unsaved information in all applications.");
PushText("System is busy", "The system is busy waiting for the Close Program dialog box to be\r\ndisplayed. You can wait and see if it appears, or you can restart\r\nyour computer.\r\n\r\n* Press any key to return to Windows and wait.\r\n* Press CTRL + ALT + DEL again to restart your computer. You will\r\n lose any unsaved information in programs that are running.");
PushText("System is unresponsive", "The system is either busy or has become unstable. You can wait and\r\nsee if it becomes available again, or you can restart your computer.\r\n\r\n* Press any key to return to Windows and wait.\r\n* Press CTRL + ALT + DEL again to restart your computer. You will\r\n lose any unsaved information in programs that are running.");
PushText("Prompt", "Press any key to continue");
SetString("friendlyname", "Windows 9x/Millennium Edition (Text mode, Standard)");
SetBool("font_support", false);
SetBool("blinkblink", true);
SetString("screen_mode", "System error");
break;
case "Windows CE":
this.icon = "3D flag";
SetTheme(RGB(0, 0, 128), RGB(255, 255, 255));
PushText("A problem has occurred...", "A problem has occurred and Windows CE has been shut down to prevent damage to your\r\ncomputer.");
PushText("CTRL+ALT+DEL message", "If you will try to restart your computer, press Ctrl+Alt+Delete.");
PushText("Technical information", "Technical information:");
PushText("Technical information formatting", "*** STOP: {0} ({1})");
PushText("Restart message", "The computer will restart automatically\r\nafter {0} seconds.");
SetInt("timer", 30);
SetFont("Lucida Console", 10.4f, FontStyle.Regular);
SetString("friendlyname", "Windows CE 5.0 and later (750x400, Standard)");
SetString("code", "IRQL_NOT_LESS_OR_EQUAL (0x0000000A)");
break;
case "Windows NT 3.x/4.0":
this.icon = "2D flag";
SetTheme(RGB(0, 0, 160), RGB(170, 170, 170));
PushText("Error code formatting", "*** STOP: {0} ({1})");
PushText("CPUID formatting", "CPUID: {0} 6.3.3 irql:lf SYSVER 0xf0000565");
PushText("Stack trace heading", "Dll Base DateStmp - Name");
PushText("Stack trace table formatting", "{0} {1} - {2}");
PushText("Memory address dump heading", "Address dword dump Build [1381] - Name");
PushText("Memory address dump table", "{0} {1} {2} {3} {4} {5} - {6}");
PushText("Troubleshooting text", "Restart and set the recovery options in the system control panel\r\nor the /CRASHDEBUG system start option.");
SetInt("blink_speed", 100);
SetString("friendlyname", "Windows NT 4.0/3.x (Text mode, Standard)");
for (int n = 0; n < 40; n++)
{
string[] inspirn = { "RRRRRRRR", "RRRRRRRR" };
PushFile(GenFile(true), inspirn);
}
for (int n = 0; n < 4; n++)
{
string[] inspirn = { "RRRRRRRR", "RRRRRRRR", "RRRRRRRR", "RRRRRRRR", "RRRRRRRR", "RRRRRRRR" };
PushFile(GenFile(true), inspirn);
}
SetBool("font_support", false);
SetBool("blinkblink", true);
SetString("code", "IRQL_NOT_LESS_OR_EQUAL (0x0000000A)");
SetBool("stack_trace", true);
break;
case "Windows 2000":
PushText("Error code formatting", "*** STOP: {0} ({1})");
PushText("Troubleshooting introduction", "If this is the first time you've seen this Stop error screen,\r\nrestart your computer. If this screen appears again, follow\r\nthese steps: ");
PushText("Troubleshooting text", "Check for viruses on your computer. Remove any newly installed\r\nhard drives or hard drive controllers. Check your hard drive\r\nto make sure it is properly configured and terminated.\r\nRun CHKDSK /F to check for hard drive corruption, and then\r\nrestart your computer.");
PushText("Additional troubleshooting information", "Refer to your Getting Started manual for more information on\r\ntroubleshooting Stop errors.");
PushText("File information", "*** Address {0} base at {1}, DateStamp {2} - {3}");
SetFont("Lucida Console", 8.0f, FontStyle.Bold);
SetString("friendlyname", "Windows 2000 Professional/Server Family (640x480, Standard)");
SetTheme(RGB(0, 0, 128), RGB(255, 255, 255));
string[] inspirw2k = { "RRRRRRRR", "RRRRRRRR", "RRRRRRRR" };
SetString("culprit", GenFile(true));
PushFile(GetString("culprit"), inspirw2k);
SetString("code", "IRQL_NOT_LESS_OR_EQUAL (0x0000000A)");
SetBool("show_description", true);
SetBool("font_support", false);
break;
case "Windows XP":
this.icon = "3D flag";
PushText("A problem has been detected...", "A problem has been detected and Windows has been shut down to prevent damage\r\nto your computer.");
PushText("Troubleshooting introduction", "If this is the first time you've seen this Stop error screen,\r\nrestart your computer. If this screen appears again, follow\r\nthese steps:");
PushText("Troubleshooting", "Check to make sure any new hardware or software is properly installed.\r\nIf this is a new installation, ask your hardware or software manufacturer\r\nfor any Windows updates you might need.\r\n\r\nIf problems continue, disable or remove any newly installed hardware\r\nor software. Disable BIOS memory options such as caching or shadowing.\r\nIf you need to use Safe mode to remove or disable components, restart\r\nyour computer, press F8 to select Advanced Startup Options, and then\r\nselect Safe Mode.");
PushText("Technical information", "Technical information:");
PushText("Technical information formatting", "*** STOP: {0} ({1})");
PushText("Culprit file", "The problem seems to be caused by the following file: ");
PushText("Physical memory dump", "Beginning dump of physical memory\r\nPhysical memory dump complete.");
PushText("Technical support", "Contact your system administrator or technical support group for further\r\nassistance.");
SetBool("auto", true);
SetFont("Lucida Console", 9.7f, FontStyle.Regular);
SetString("friendlyname", "Windows XP (640x480, Standard)");
string[] inspirb = { "RRRRRRRR", "RRRRRRRR", "RRRRRRRR" };
SetString("culprit", GenFile(true));
PushFile(GetString("culprit"), inspirb);
SetTheme(RGB(0, 0, 128), RGB(255, 255, 255));
SetBool("autoclose", true);
SetString("code", "IRQL_NOT_LESS_OR_EQUAL (0x0000000A)");
SetBool("show_description", true);
SetBool("font_support", true);
break;
case "Windows Vista":
this.icon = "3D flag";
PushText("A problem has been detected...", "A problem has been detected and Windows has been shut down to prevent damage\r\nto your computer.");
PushText("Troubleshooting introduction", "If this is the first time you've seen this Stop error screen,\r\nrestart your computer. If this screen appears again, follow\r\nthese steps:");
PushText("Troubleshooting", "Check to make sure any new hardware or software is properly installed.\r\nIf this is a new installation, ask your hardware or software manufacturer\r\nfor any Windows updates you might need.\r\n\r\nIf problems continue, disable or remove any newly installed hardware\r\nor software. Disable BIOS memory options such as caching or shadowing.\r\nIf you need to use Safe mode to remove or disable components, restart\r\nyour computer, press F8 to select Advanced Startup Options, and then\r\nselect Safe Mode.");
PushText("Technical information", "Technical information:");
PushText("Technical information formatting", "*** STOP: {0} ({1})");
PushText("Collecting data for crash dump", "Collecting data for crash dump ...");
PushText("Initializing crash dump", "Initializing disk for crash dump ...");
PushText("Begin dump", "Beginning dump of physical memory.");
PushText("End dump", "Physical memory dump complete.");
PushText("Physical memory dump", "Dumping physical memory to disk:{0}");
PushText("Culprit file", "The problem seems to be caused by the following file: ");
PushText("Culprit file memory address", "*** {0} - Address {1} base at {2}, DateStamp {3}");
PushText("Technical support", "Contact your system admin or technical support group for further assistance.");
SetFont("Lucida Console", 9.4f, FontStyle.Regular);
SetString("friendlyname", "Windows Vista (640x480, Standard)");
SetTheme(RGB(0, 0, 128), RGB(255, 255, 255));
SetBool("autoclose", true);
SetString("code", "IRQL_NOT_LESS_OR_EQUAL (0x0000000A)");
string[] inspir = { "RRRRRRRR", "RRRRRRRR", "RRRRRRRR" };
SetString("culprit", GenFile(true));
PushFile(GetString("culprit"), inspir);
SetBool("show_description", true);
SetBool("font_support", true);