Class: TurboRex::Windows::TinySDK
- Inherits:
-
Object
- Object
- TurboRex::Windows::TinySDK
- Includes:
- Singleton
- Defined in:
- lib/turborex/windows/tinysdk.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#include_path ⇒ Object
readonly
Returns the value of attribute include_path.
-
#loaded_files ⇒ Object
readonly
Returns the value of attribute loaded_files.
-
#np ⇒ Object
readonly
Returns the value of attribute np.
Class Method Summary collapse
- .format_hex_ntstatus(integer, opts = {}) ⇒ Object
- .nt_error?(ntstatus) ⇒ Boolean
- .nt_information?(ntstatus) ⇒ Boolean
- .nt_success?(ntstatus) ⇒ Boolean
- .nt_warning?(ntstatus) ⇒ Boolean
Instance Method Summary collapse
-
#initialize ⇒ TinySDK
constructor
A new instance of TinySDK.
- #load(opts = {}) ⇒ Object
- #load!(opts) ⇒ Object
- #loaded? ⇒ Boolean
Constructor Details
#initialize ⇒ TinySDK
Returns a new instance of TinySDK.
18 19 20 21 22 |
# File 'lib/turborex/windows/tinysdk.rb', line 18 def initialize @loaded = false @loaded_files = [] set_include_path end |
Instance Attribute Details
#include_path ⇒ Object (readonly)
Returns the value of attribute include_path.
14 15 16 |
# File 'lib/turborex/windows/tinysdk.rb', line 14 def include_path @include_path end |
#loaded_files ⇒ Object (readonly)
Returns the value of attribute loaded_files.
15 16 17 |
# File 'lib/turborex/windows/tinysdk.rb', line 15 def loaded_files @loaded_files end |
#np ⇒ Object (readonly)
Returns the value of attribute np.
16 17 18 |
# File 'lib/turborex/windows/tinysdk.rb', line 16 def np @np end |
Class Method Details
.format_hex_ntstatus(integer, opts = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/turborex/windows/tinysdk.rb', line 71 def self.format_hex_ntstatus(integer, opts = {}) integer = 0 unless integer unpacked = [integer].pack('V').unpack('V')[0] if opts[:hex_str] '0x' + unpacked.to_s(16).upcase else unpacked end end |
.nt_error?(ntstatus) ⇒ Boolean
67 68 69 |
# File 'lib/turborex/windows/tinysdk.rb', line 67 def self.nt_error?(ntstatus) (0xC0000000..0xFFFFFFFF).include?(ntstatus) end |
.nt_information?(ntstatus) ⇒ Boolean
59 60 61 |
# File 'lib/turborex/windows/tinysdk.rb', line 59 def self.nt_information?(ntstatus) (0x40000000..0x7FFFFFFF).include?(ntstatus) end |
.nt_success?(ntstatus) ⇒ Boolean
55 56 57 |
# File 'lib/turborex/windows/tinysdk.rb', line 55 def self.nt_success?(ntstatus) (0..0x3FFFFFFF).include?(ntstatus) || (0x40000000..0x7FFFFFFF).include?(ntstatus) || ntstatus.nil? end |
.nt_warning?(ntstatus) ⇒ Boolean
63 64 65 |
# File 'lib/turborex/windows/tinysdk.rb', line 63 def self.nt_warning?(ntstatus) (0x80000000..0xBFFFFFFF).include?(ntstatus) end |
Instance Method Details
#load(opts = {}) ⇒ Object
24 25 26 27 |
# File 'lib/turborex/windows/tinysdk.rb', line 24 def load(opts = {}) return true if loaded? load!(opts) end |
#load!(opts) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/turborex/windows/tinysdk.rb', line 29 def load!(opts) opts[:cpu] ||= ::Metasm::Ia32 opts[:visual_studio] = true opts[:data_model] = 'llp64' if opts[:cpu] == Metasm::X86_64 opts[:predefined] = true @np = TurboRex::CStruct::NativeParser.new(nil, opts) @cp = @np.parser if opts[:files] opts[:files].each {|f| @cp.parse_file(f)} @loaded_files = opts[:files] else @cp.parse_file(DEFAULT_LOAD_FILE) @loaded_files << DEFAULT_LOAD_FILE end true end |
#loaded? ⇒ Boolean
50 51 52 |
# File 'lib/turborex/windows/tinysdk.rb', line 50 def loaded? @loaded end |