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, user.SID,
                                   0))
  raise_error_if_zero(
    Win.IsValidSecurityDescriptor(psd_information))
  sa = Win::SECURITY_ATTRIBUTES.new(malloc_ptr(Win::SECURITY_ATTRIBUTES.size))
  sa.nLength = Win::SECURITY_ATTRIBUTES.size
  sa.lpSecurityDescriptor = psd_information.to_i
  sa.bInheritHandle = 1
  return sa
end