Class: Vigilem::Win32API::Types::PBYTE

Inherits:
Object
  • Object
show all
Includes:
FFI::ArrayPointerSync
Defined in:
lib/vigilem/win32_api/types.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_len_or_ptr, *init_values) ⇒ PBYTE

Returns a new instance of PBYTE.

Parameters:

  • max_len_or_ptr (Integer || ::FFI::Pointer)
  • (Array)

See Also:

  • ArrayPointerSync#initialize_array_sync


59
60
61
# File 'lib/vigilem/win32_api/types.rb', line 59

def initialize(max_len_or_ptr, *init_values)
  initialize_array_sync(max_len_or_ptr, *init_values)
end

Class Method Details

.array_typeObject

Class || Symbol


67
68
69
# File 'lib/vigilem/win32_api/types.rb', line 67

def array_type
  :BYTE
end

.from_native(value, ctx) ⇒ Integer

Converts the specified value from the native type.

Returns:

  • (Integer)


73
74
75
# File 'lib/vigilem/win32_api/types.rb', line 73

def from_native(value, ctx)
  new(value)
end

.to_native(value, ctx) ⇒ ::FFI::Pointer

Converts the specified value to the native type.

Returns:

  • (::FFI::Pointer)


79
80
81
82
83
84
85
86
87
88
# File 'lib/vigilem/win32_api/types.rb', line 79

def to_native(value, ctx)
  case 
  when value.is_a?(::FFI::Pointer)
    value
  when value.is_a?(self)
    value.ptr
  else
    raise "#{value} is an Unsupported Type"
  end
end