Sha256: f34016adca498f2fc43805d2e3b5f540c68014d3430814c17cbb76938894500f

Contents?: true

Size: 461 Bytes

Versions: 14

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true

require_relative '../../../../facter/resolvers/windows/ffi/ffi'

module IdentityFFI
  extend FFI::Library

  ffi_convention :stdcall
  ffi_lib :secur32
  attach_function :GetUserNameExW, %i[uint32 lpwstr pointer], :win32_bool

  ffi_convention :stdcall
  ffi_lib :shell32
  attach_function :IsUserAnAdmin, [], :win32_bool

  def self.privileged?
    result = self.IsUserAnAdmin()
    result && result != FFI::WIN32FALSE
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facter-4.10.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.9.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.8.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.7.1 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.7.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.6.1 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.6.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.5.2 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.5.1 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.5.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.4.3 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.4.2 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.4.1 lib/facter/resolvers/windows/ffi/identity_ffi.rb
facter-4.4.0 lib/facter/resolvers/windows/ffi/identity_ffi.rb