Class: LiveIdentity::Identities
- Inherits:
-
Object
- Object
- LiveIdentity::Identities
- Defined in:
- lib/live_identity.rb
Instance Attribute Summary collapse
-
#peihEnumHandle ⇒ Object
readonly
Returns the value of attribute peihEnumHandle.
Class Method Summary collapse
Instance Method Summary collapse
- #GetAllIdentityNames ⇒ Object
- #GetNextIdentityName ⇒ Object
-
#initialize(cachedCredType) ⇒ Identities
constructor
A new instance of Identities.
Constructor Details
#initialize(cachedCredType) ⇒ Identities
Returns a new instance of Identities.
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/live_identity.rb', line 172 def initialize(cachedCredType) @peihEnumHandle = nil szCachedCredType = nil szCachedCredType = StringToWSTR(cachedCredType) if cachedCredType peihEnumHandle = FFI::MemoryPointer.new(:PassportEnumIdentitiesHandlePointer) hr = IDCRL.EnumIdentitiesWithCachedCredentials(szCachedCredType, peihEnumHandle) raise LiveIdentityError.new(hr) if LiveIdentity::IsError?(hr) @peihEnumHandle = peihEnumHandle.read_ulong ObjectSpace.define_finalizer(self, self.class.finalize(@peihEnumHandle)) end |
Instance Attribute Details
#peihEnumHandle ⇒ Object (readonly)
Returns the value of attribute peihEnumHandle.
171 172 173 |
# File 'lib/live_identity.rb', line 171 def peihEnumHandle @peihEnumHandle end |
Class Method Details
.finalize(peihEnumHandle) ⇒ Object
183 184 185 186 187 188 |
# File 'lib/live_identity.rb', line 183 def self.finalize(peihEnumHandle) Proc.new do hr = IDCRL.CloseEnumIdentitiesHandle(peihEnumHandle) raise LiveIdentityError.new(hr) if LiveIdentity::IsError?(hr) end end |
Instance Method Details
#GetAllIdentityNames ⇒ Object
200 201 202 203 204 205 206 207 208 |
# File 'lib/live_identity.rb', line 200 def GetAllIdentityNames identityNames = [] loop do identityName = GetNextIdentityName() break unless identityName identityNames << identityName end identityNames end |
#GetNextIdentityName ⇒ Object
190 191 192 193 194 195 196 197 198 |
# File 'lib/live_identity.rb', line 190 def GetNextIdentityName wszMemberName = FFI::MemoryPointer.new(:PLPWSTR) hr = IDCRL.NextIdentity(@peihEnumHandle, wszMemberName) raise LiveIdentityError.new(hr) if LiveIdentity::IsError?(hr) return nil if hr == IDCRL::HRESULT::PPCRL_S_NO_MORE_IDENTITIES memberName = read_wide_string(wszMemberName.read_pointer) LiveIdentity::FreeMemory(wszMemberName.read_pointer) memberName end |