module Net::SSH::Authentication::Pageant::Win
def self.get_token_information(token_handle,
def self.get_token_information(token_handle, token_information_class) # Hold the size of the information to be returned preturn_length = malloc_ptr(Win::SIZEOF_DWORD) # Going to throw an INSUFFICIENT_BUFFER_ERROR, but that is ok # here. This is retrieving the size of the information to be # returned. Win.GetTokenInformation(token_handle, token_information_class, Win::NULL, 0, preturn_length) ptoken_information = malloc_ptr(preturn_length.to_s(Win::SIZEOF_DWORD).unpack('L')[0]) # This call is going to write the requested information to # the memory location referenced by token_information. raise_error_if_zero( Win.GetTokenInformation(token_handle, token_information_class, ptoken_information, ptoken_information.size, preturn_length)) return TOKEN_USER.new(ptoken_information) end