Class: TurboRex::Windows::COM::COMRegistry::AppIDEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/turborex/windows/com/com_registry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#access_permissionObject

Returns the value of attribute access_permission.



63
64
65
# File 'lib/turborex/windows/com/com_registry.rb', line 63

def access_permission
  @access_permission
end

#appid_guidObject

Returns the value of attribute appid_guid.



60
61
62
# File 'lib/turborex/windows/com/com_registry.rb', line 60

def appid_guid
  @appid_guid
end

#executable_nameObject

Returns the value of attribute executable_name.



61
62
63
# File 'lib/turborex/windows/com/com_registry.rb', line 61

def executable_name
  @executable_name
end

#launch_permissionObject

Returns the value of attribute launch_permission.



62
63
64
# File 'lib/turborex/windows/com/com_registry.rb', line 62

def launch_permission
  @launch_permission
end

#local_serviceObject

Returns the value of attribute local_service.



64
65
66
# File 'lib/turborex/windows/com/com_registry.rb', line 64

def local_service
  @local_service
end

Class Method Details

.from_registry(reg_key) ⇒ Object



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
# File 'lib/turborex/windows/com/com_registry.rb', line 66

def self.from_registry(reg_key)
  appid_entry = AppIDEntry.new
  if reg_key.keyname  =~ /^\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}$/i
    appid_entry.appid_guid = reg_key.keyname
    if (raw = reg_key.read('LaunchPermission').last rescue nil)
      sd = TurboRex::Windows::Win32API.alloc_c_ary('BYTE', raw.bytesize)
      sd.str = raw
      lpbDaclPresent = TurboRex::Windows::Win32API.alloc_c_ptr('BOOL')
      pdacl = TurboRex::Windows::Win32API.alloc_c_ptr('PVOID')
      lpbDaclDefaulted = TurboRex::Windows::Win32API.alloc_c_ptr('BOOL')

      TurboRex::Windows::Win32API.getsecuritydescriptordacl(sd, lpbDaclPresent, pdacl, lpbDaclDefaulted)
      appid_entry.launch_permission = TurboRex::Windows::Security::SecurityDescriptor.from_raw(raw)
    end

    if (raw = reg_key.read('AccessPermission').last rescue nil)
      sd = TurboRex::Windows::Win32API.alloc_c_ary('BYTE', raw.bytesize)
      sd.str = raw
      lpbDaclPresent = TurboRex::Windows::Win32API.alloc_c_ptr('BOOL')
      pdacl = TurboRex::Windows::Win32API.alloc_c_ptr('PVOID')
      lpbDaclDefaulted = TurboRex::Windows::Win32API.alloc_c_ptr('BOOL')

      TurboRex::Windows::Win32API.getsecuritydescriptordacl(sd, lpbDaclPresent, pdacl, lpbDaclDefaulted)
      appid_entry.access_permission = TurboRex::Windows::Security::SecurityDescriptor.from_raw(raw)
    end
  else
    appid_entry.executable_name = reg_key.keyname
  end

end