Class: Ragweed::Wrap32::ProcessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/ragweed/wrap32/process_token.rb

Instance Method Summary collapse

Constructor Details

#initialize(p = nil) ⇒ ProcessToken

Returns a new instance of ProcessToken.



72
73
74
75
# File 'lib/ragweed/wrap32/process_token.rb', line 72

def initialize(p=nil)
  p ||= Ragweed::Wrap32::open_process(Ragweed::Wrap32::get_current_process_id)
  @h = Ragweed::Wrap32::open_process_token(p)
end

Instance Method Details

#grant(name) ⇒ Object



77
78
79
80
# File 'lib/ragweed/wrap32/process_token.rb', line 77

def grant(name)
  luid = Ragweed::Wrap32::lookup_privilege_value(name)
  Ragweed::Wrap32::adjust_token_privileges(@h, 0, [luid, Ragweed::Wrap32::PrivilegeAttribute::ENABLED])
end