bsod 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4fcb61503d20aadeeb8d96bd59b25abfd8c55982
4
+ data.tar.gz: 21917c0d26eab1ae230f4a53bb926a6e4af33cf2
5
+ SHA512:
6
+ metadata.gz: b73af5a295d3046ff810a1fe38e3811d57d0535fb0ed22fe10ba04e0edd44fec15b34c6c0faa11d30cbf6e84971abeafc99486d82fd918bd00cd200532d9b099
7
+ data.tar.gz: 6ee4b3e0425c61a088d5f3b4152a7f95f6a31fdfa3801036daf8aee74b6de99307678f4661ca126e52f1ab408083b5746b0ae2b10ce9c6a93e86e02638eff783
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.ttf
2
+ *.txt
3
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rubysdl", "~> 2.1.2"
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # bsdod
2
+
3
+ Simulates a Blue Screen of Death, as seen on Micro$oftWindow$.
4
+
5
+ As an executable, has optional flag to sleep before BSODing so you can surprise
6
+ your friends!
7
+
8
+ As a library, you can integrate a BSOD on any SDL surface.
9
+
10
+ ## Usage
11
+
12
+ ### Executable
13
+
14
+ $ bsod
15
+ $ bsod --sleep 3.1415 # sleep before BSODing
16
+ $ bsod --no-fullscreen
17
+
18
+ For more see `bsod --help`.
19
+
20
+ ### Library
21
+
22
+ require 'bsod'
23
+ screen = SDL::Screen.get
24
+ BSOD::run(screen, screen.w, screen.h)
25
+
26
+ ## Install
27
+
28
+ $ gem install bsod
29
+
30
+ ## Contact
31
+
32
+ Hi, I'm Alexandre Dantas! Thanks for having interest in this project. Please
33
+ take the time to visit any of the links below.
34
+
35
+ * `bsod` homepage: http://www.alexdantas.net/projects/bsod
36
+ * Contact: `eu @ alexdantas.net`
37
+ * My homepage: http://www.alexdantas.net
38
+
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+
2
+ require 'bsod/version'
3
+
4
+ # Adding lib directory to load path
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $:.unshift lib unless $:.include? lib
7
+
8
+ task :build do
9
+ system 'gem build bsod.gemspec'
10
+ end
11
+
12
+ task :release => :build do
13
+ system "gem push bsod-#{BSOD::VERSION}.gem"
14
+ end
15
+
data/bin/bsod ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bsod'
4
+ require 'bsod/settings'
5
+
6
+ # Global configuration thingy. See `settings.rb`.
7
+ $settings = nil
8
+
9
+ # Starts all things related to SDL for this program to work.
10
+ #
11
+ # Returns SDL's main drawing screen.
12
+ def sdl_init
13
+ SDL::init(SDL::INIT_VIDEO)
14
+ SDL::TTF.init
15
+ SDL::Mouse.hide
16
+
17
+ screen = nil
18
+
19
+ if $settings[:fullscreen]
20
+ screen = SDL::Screen.open($settings[:width],
21
+ $settings[:height],
22
+ 0,
23
+ SDL::HWSURFACE | SDL::FULLSCREEN)
24
+ else
25
+ screen = SDL::Screen.open($settings[:width],
26
+ $settings[:height],
27
+ 0,
28
+ SDL::HWSURFACE)
29
+ end
30
+ return screen
31
+ end
32
+
33
+ begin
34
+ $settings = Settings.new
35
+ $settings.parse ARGV
36
+
37
+ # Will wait for a while if the user told us so
38
+ time = $settings[:sleep_time]
39
+ sleep time if time
40
+
41
+ screen = sdl_init
42
+ BSOD::run(screen, screen.w, screen.h)
43
+
44
+ # It automatically ends SDL on exit
45
+ end
46
+
data/bsod.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # Adding ./lib directory to load path
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $:.unshift lib unless $:.include? lib
4
+
5
+ require 'bsod/version'
6
+ require 'date'
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = 'bsod'
10
+ s.version = BSOD::VERSION
11
+ s.summary = "Simulates a Blue Screen Of Death"
12
+ s.date = Date.today.to_s
13
+ s.description = <<END_OF_DESCRIPTION
14
+ Simulates a Blue Screen Of Death, as seen on Micro$oftWindow$.
15
+ As an executable, has optional flag to sleep before BSODing so
16
+ you can surprise your friends!
17
+ As a library, you can integrate a BSOD on any SDL surface.
18
+ END_OF_DESCRIPTION
19
+ s.authors = ["Alexandre Dantas"]
20
+ s.email = ["eu@alexdantas.net"]
21
+ s.homepage = 'http://www.alexdantas.net/projects/bsod'
22
+ s.license = "GPL-3.0"
23
+
24
+ # Including everything that's checked out on git
25
+ s.files = `git ls-files`.split($/)
26
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
+ s.require_paths = ['lib']
28
+
29
+ s.add_development_dependency "rake"
30
+ s.add_dependency "rubysdl", "~> 2.1.2"
31
+
32
+ s.post_install_message = <<END_OF_INSTALL_MESSAGE
33
+ * To exit the BSOD press `F8`
34
+ END_OF_INSTALL_MESSAGE
35
+
36
+ s.metadata = { 'github' => 'http://www.github.com/alexdantas/bsod' }
37
+ end
38
+
data/droidsansmono.ttf ADDED
Binary file
@@ -0,0 +1,99 @@
1
+
2
+ require 'optparse'
3
+ require 'bsod/version'
4
+
5
+ # Global configurations of the program, along with a commandline
6
+ # argument parser.
7
+ #
8
+ # Contains the program's specific configuration rules.
9
+ class Settings
10
+
11
+ # Creates a configuration, with default values.
12
+ def initialize
13
+ @settings = {}
14
+
15
+ # Makes possible to sleep for a while before BSODing
16
+ @settings[:sleep_time] = nil
17
+
18
+ # This doesn't matter because it will go fullscreen anyways.
19
+ # Just change it if looks ugly
20
+ @settings[:width] = 800
21
+ @settings[:height] = 600
22
+ @settings[:fullscreen] = true
23
+
24
+ # SDL-specific key to exit BSOD
25
+ @settings[:exit_key] = SDL::Key::F8
26
+
27
+ # This is the default font, distributed with the gem.
28
+ # It's `../../droidsansmono.ttf` based on `settings.rb` path.
29
+ fontname = File.expand_path("../../", __FILE__)
30
+ fontname = File.dirname fontname
31
+ fontname += "/droidsansmono.ttf"
32
+ @settings[:font_filename] = fontname
33
+ @settings[:font_size] = 14
34
+ @settings[:font_bold] = false
35
+ end
36
+
37
+ # Sets options based on commandline arguments `args`.
38
+ # It should be `ARGV`.
39
+ def parse args
40
+
41
+ opts = OptionParser.new do |parser|
42
+ parser.banner = "Usage: bsod [options]"
43
+
44
+ # Make output beautiful
45
+ parser.separator ""
46
+ parser.separator "Note: Default key to exit BSOD is `F8`"
47
+ parser.separator ""
48
+ parser.separator "Options:"
49
+
50
+ parser.on("-s", "--sleep N", "Sleep N (float) seconds before BSODing") do |n|
51
+ @settings[:sleep_time] = n.to_f
52
+ end
53
+
54
+ parser.on("--[no-]fullscreen", "Runs on fullscreen mode (default on)") do |f|
55
+ @settings[:fullscreen] = f
56
+ end
57
+
58
+ # These options appear if no other is given.
59
+ parser.on("-h", "--help", "Show this message") do
60
+ puts parser
61
+ exit
62
+ end
63
+
64
+ parser.on("--version", "Show version and license info") do
65
+ puts <<END_OF_VERSION
66
+ _ __ _ _
67
+ |_) (_ / \\ | \\
68
+ |_) __) \\_/ |_/ #{BSOD::VERSION} (http://alexdantas.net/projects/bsod)
69
+
70
+ Copyright (C) 2011-2012 Alexandre Dantas <eu@alexdantas.net>
71
+
72
+ bsod is free software: you can redistribute it and/or modify
73
+ it under the terms of the GNU General Public License as published by
74
+ the Free Software Foundation, either version 3 of the License, or
75
+ any later version.
76
+
77
+ This program is distributed in the hope that it will be useful,
78
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
79
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80
+ GNU General Public License for more details.
81
+
82
+ You should have received a copy of the GNU General Public License
83
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
84
+ END_OF_VERSION
85
+ exit
86
+ end
87
+
88
+ end
89
+ opts.parse! args
90
+
91
+ return @settings
92
+ end
93
+
94
+ # Returns a specific setting previously set.
95
+ def [] name
96
+ return @settings[name]
97
+ end
98
+ end
99
+
@@ -0,0 +1,5 @@
1
+
2
+ module BSOD
3
+ VERSION = "0.0.1"
4
+ end
5
+
data/lib/bsod.rb ADDED
@@ -0,0 +1,108 @@
1
+
2
+ require 'sdl'
3
+
4
+ # Attempts to simulate a Blue Screen of Death, optionally
5
+ # with a delay before (in seconds).
6
+ #
7
+ # Make sure you have installed:
8
+ # * ruby `sdl` gem
9
+ # * C `SDL` library
10
+ # * C `SDL_ttf` library
11
+ module BSOD
12
+
13
+ # This is the full text to be displayed onscreen.
14
+ # Change it to your heart's content!
15
+ BSODTEXT = <<END_OF_TEXT
16
+ *** STOP: 0x00000001E (0x00000003,0x00000d0e8,0x0c001201e,0x000c0ffee)
17
+ Unhandled Kernel exception c0000047 from fa8418b4 (00d4a81c0,00028492e)
18
+
19
+ Dll Base Date Stamp - Name Dll Base Date Stamp - Name
20
+ bf7978fb be154c92 - ntoskrnl.exe 7fa3883b 11b92972 - hal.dll
21
+ a519c86a b386ca2c - ncrc710.sys faea83e1 c47447d7 - SCSIPORT.SYS
22
+ 2f983e0b 6e01a9a4 - scsidisk.sys 6a7f9869 45b277c4 - Fastfat.sys
23
+ 94041089 e1a9f5d9 - Floppy.SYS b91218c4 c037818d - Hpfs_Rec.SYS
24
+ 0bb5c0c9 8ca7bd22 - Null.SYS 5496bb5f 1d60d82c - Beep.SYS
25
+ a9b37c3a f70ef21d - i8042prt.SYS 585fd0b5 1e973d5d - SERMOUSE.SYS
26
+ e4965cb7 24a6ec07 - kbdclass.SYS 2925baf7 5cb9a053 - MOUCLASS.SYS
27
+ e54f64c7 f54b26c1 - Videoprt.SYS ad7a85bd 7d2571b9 - NCC1701E.SYS
28
+ 1a119462 e9c098e9 - Vga.SYS e3c5a4a4 f5caa34a - Msfs.SYS
29
+
30
+ Address dword dump Dll Base - Name
31
+ 2fc589eb b483bf92 20677c0a f254e409 5977ffa0 a082a53e : c76875ba - i8042prt.SYS
32
+ 35ec96b5 1dc0af3c 406c655c 5bfbe3fe 8390119a bd653a61 : d17a5ee1 - SCSIPORT.SYS
33
+ d54704c9 c9c43be6 ece08295 e5fd350c f469f913 86a54eeb : 24ed5a16 - ntoskrnl.exe
34
+ 4ade1e66 2639fc5c 4d22f159 94f99371 f9876420 71517f45 : 69048b22 - ntoskrnl.exe
35
+ e3d88756 0e0e2322 2a899667 71dd4f99 9fba9b81 12b84e81 : 23ce15e3 - ntoskrnl.exe
36
+ 981f5fa4 e03f9d34 6ec6e730 31ca1ce6 f75b54b6 d5ba53f6 : a7419dad - ntoskrnl.exe
37
+ 16cfcafd 67eb2c74 9152a8f3 62864c8e 148c9c29 bb4235b5 : 3e24c47e - ntoskrnl.exe
38
+
39
+ Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)
40
+ Restart and set the recovery options in the system control panel
41
+ or the /CRASHDEBUG system start option. If this message reappears,
42
+ contact your system administrator or technical support group.
43
+ END_OF_TEXT
44
+
45
+ # Runs the BSOD on a SDL's `screen`, bounded by `width` and
46
+ # `height`.
47
+ #
48
+ # It must be a `SDL::Surface` (consequently, a `SDL::Screen` is
49
+ # acceptable too.
50
+ def self.run(screen, width, height)
51
+
52
+ if (SDL::inited_system(SDL::INIT_VIDEO) == 0) or
53
+ (not SDL::TTF::init?)
54
+ puts "Error: SDL Video or SDL::TTF not initialized."
55
+ exit 666
56
+ end
57
+
58
+ # Filling screen with that sweet, sweet blue tone
59
+ blue = screen.format.map_rgb(0, 0, 255)
60
+ screen.fill_rect(0, 0, width, height, blue)
61
+
62
+ # Printing that bizarre text
63
+ font = SDL::TTF.open($settings[:font_filename],
64
+ $settings[:font_size])
65
+
66
+ font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
67
+
68
+ i = 0
69
+ BSODTEXT.each_line do |line|
70
+ # This is a little hack to allow printing empty lines.
71
+ # First I remove the '\n' at the end to avoid nasty things
72
+ # and then I append a space, to prevent nil strings.
73
+ line.chomp!
74
+ line += " "
75
+
76
+ font.draw_solid_utf8(screen, line,
77
+ 3, (i * font.height),
78
+ 255, 255, 255)
79
+ i += 1
80
+ end
81
+
82
+ font.close
83
+
84
+ # @note Maybe update only the bounded rectangle?
85
+ SDL::Screen.get.update_rect(0, 0, 0, 0)
86
+
87
+ # This basically waits for keypresses and ignores everything
88
+ # except for that special key you've defined.
89
+ loop = true
90
+ while loop
91
+
92
+ # Get events, exit when a certain key is pressed
93
+ while event = SDL::Event2.poll
94
+
95
+ case event
96
+ when SDL::Event2::KeyDown
97
+ SDL::Key.scan
98
+ if SDL::Key.press? $settings[:exit_key]
99
+ loop = false
100
+ end
101
+ end
102
+ end
103
+ # Sleeping a little to avoid high-CPU rates.
104
+ sleep 0.05
105
+ end
106
+ end
107
+ end
108
+
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bsod
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alexandre Dantas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubysdl
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.2
41
+ description: |
42
+ Simulates a Blue Screen Of Death, as seen on Micro$oftWindow$.
43
+ As an executable, has optional flag to sleep before BSODing so
44
+ you can surprise your friends!
45
+ As a library, you can integrate a BSOD on any SDL surface.
46
+ email:
47
+ - eu@alexdantas.net
48
+ executables:
49
+ - bsod
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - ".gitignore"
54
+ - Gemfile
55
+ - README.md
56
+ - Rakefile
57
+ - bin/bsod
58
+ - bsod.gemspec
59
+ - droidsansmono.ttf
60
+ - lib/bsod.rb
61
+ - lib/bsod/settings.rb
62
+ - lib/bsod/version.rb
63
+ homepage: http://www.alexdantas.net/projects/bsod
64
+ licenses:
65
+ - GPL-3.0
66
+ metadata:
67
+ github: http://www.github.com/alexdantas/bsod
68
+ post_install_message: |
69
+ * To exit the BSOD press `F8`
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.1.7
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Simulates a Blue Screen Of Death
89
+ test_files: []