module Net::SSH::Authentication::Pageant::Win

def self.get_security_attributes_for_user

def self.get_security_attributes_for_user
  user = get_current_user
  psd_information = malloc_ptr(Win::SECURITY_DESCRIPTOR.size)
  raise_error_if_zero(
    Win.InitializeSecurityDescriptor(psd_information,
                                     Win::REVISION)
  )
  raise_error_if_zero(
    Win.SetSecurityDescriptorOwner(psd_information, get_sid_ptr(user),
                                   0)
  )
  raise_error_if_zero(
    Win.IsValidSecurityDescriptor(psd_information)
  )
  sa = Win::SECURITY_ATTRIBUTES.new(to_struct_ptr(malloc_ptr(Win::SECURITY_ATTRIBUTES.size)))
  sa.nLength = Win::SECURITY_ATTRIBUTES.size
  sa.lpSecurityDescriptor = psd_information.to_i
  sa.bInheritHandle = 1
  return sa
end