text stringlengths 8 4.13M |
|---|
pub mod close_strings;
pub mod concatenated_binary;
pub mod diagonal_sort;
pub mod get_smallest_string;
pub mod k_length_apart;
pub mod merge_k_lists;
pub mod minimum_effort_path;
|
extern crate rand;
extern crate ndarray;
#[macro_use]
extern crate ndarray_linalg;
extern crate da_lab;
use ndarray::Array;
use ndarray_linalg::*;
use rand::distributions::IndependentSample;
use std::f64::consts::E;
use da_lab::weight::*;
fn close_max(a: &Vec<f64>, b: &Vec<f64>, atol: f64) {
let a = Array::from_vec(a.clone());
let b = Array::from_vec(b.clone());
ndarray_linalg::assert::close_max(&a, &b, atol).unwrap();
}
#[test]
fn lw2w2lw() {
let n = 10;
let lw: LogWeight = vec![0.0; n].into();
let w: Weight = lw.clone().into();
let lw2: LogWeight = w.into();
close_max(lw2.get_raw_logweight(), lw.get_raw_logweight(), 1e-7);
}
#[test]
fn w2lw2w() {
let n = 10;
let w = Weight::random(n);
let lw: LogWeight = w.clone().into();
let w2: Weight = lw.into();
close_max(w2.get_raw_weight(), w.get_raw_weight(), 1e-7);
}
#[test]
fn logweight_to_weight() {
let n = 10;
let lw: LogWeight = vec![0.0; n].into();
let w: Weight = lw.into();
let truth = vec![1.0 / n as f64; n];
close_max(w.get_raw_weight(), &truth, 1e-7);
}
#[test]
fn logweight() {
let lw: LogWeight = vec![0.0, 1.0].into();
let w: Weight = lw.into();
let raw = w.get_raw_weight();
assert_rclose!(raw[1] / raw[0], E, 1e-7);
}
#[test]
fn dist() {
let n = 3;
let w = Weight::random(n);
let mut count: Vec<u64> = vec![0; n];
let mut rng = rand::thread_rng();
let dist = w.to_dist();
let k: usize = 10000;
for _ in 0..k {
let idx = dist.ind_sample(&mut rng);
count[idx] += 1;
}
let w_eff: Vec<f64> = count.into_iter().map(|x| x as f64 / k as f64).collect();
println!("weight = {:?}", w);
println!("observed = {:?}", w_eff);
close_max(&w_eff, &w.get_raw_weight(), 0.5);
}
|
//! Variable metadata.
use partial_ref::{partial, PartialRef};
use rustc_hash::FxHashSet as HashSet;
use varisat_formula::Var;
use crate::{
context::{parts::*, Context},
processing::{process_step, CheckedProofStep, CheckedSamplingMode, CheckedUserVar},
CheckerError,
};
/// Data for each literal.
#[derive(Clone, Default)]
pub struct LitData {
pub clause_count: usize,
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum SamplingMode {
Sample,
Witness,
Hide,
}
/// Data for each variable.
#[derive(Clone)]
pub struct VarData {
pub user_var: Option<Var>,
pub sampling_mode: SamplingMode,
}
impl Default for VarData {
fn default() -> VarData {
VarData {
user_var: None,
sampling_mode: SamplingMode::Sample,
}
}
}
#[derive(Default)]
pub struct Variables {
/// Information about literals in the current formula.
pub lit_data: Vec<LitData>,
/// Information about variables in the current formula.
pub var_data: Vec<VarData>,
/// User var names in use.
///
/// This is used to check for colliding mappings which are not allowed.
used_user_vars: HashSet<Var>,
}
/// Check that var is a sampling user var and create new variables as necessary.
pub fn ensure_sampling_var(
mut ctx: partial!(Context, mut ClausesP, mut VariablesP, CheckerStateP),
var: Var,
) -> Result<(), CheckerError> {
ensure_var(ctx.borrow(), var);
let variables = ctx.part_mut(VariablesP);
if variables.var_data[var.index()].sampling_mode != SamplingMode::Sample {
return Err(CheckerError::check_failed(
ctx.part(CheckerStateP).step,
format!("variable {:?} is not a sampling variable", var),
));
}
Ok(())
}
/// Ensure that a variable is present.
pub fn ensure_var(mut ctx: partial!(Context, mut ClausesP, mut VariablesP), var: Var) {
let (variables, mut ctx) = ctx.split_part_mut(VariablesP);
if variables.var_data.len() <= var.index() {
variables
.var_data
.resize(var.index() + 1, VarData::default());
variables
.lit_data
.resize((var.index() + 1) * 2, LitData::default());
ctx.part_mut(ClausesP)
.unit_clauses
.resize(var.index() + 1, None);
}
}
/// Add a user/global var mapping.
pub fn add_user_mapping<'a>(
mut ctx: partial!(Context<'a>, mut ClausesP, mut ProcessingP<'a>, mut VariablesP, CheckerStateP),
global_var: Var,
user_var: Var,
) -> Result<(), CheckerError> {
ensure_var(ctx.borrow(), global_var);
let mut ctx_in = ctx;
let (variables, ctx) = ctx_in.split_part_mut(VariablesP);
// TODO will the first check cause problems when observing solver added variables?
// That check is required for the workaround in CheckerData's user from proof method
if user_var.index() >= variables.var_data.len() || variables.used_user_vars.contains(&user_var)
{
return Err(CheckerError::check_failed(
ctx.part(CheckerStateP).step,
format!("user name {:?} used for two different variables", user_var),
));
}
let var_data = &mut variables.var_data[global_var.index()];
// sampling_mode will be Witness for a newly observed internal variable and Sample for a a
// fresh variable
if var_data.sampling_mode == SamplingMode::Hide {
return Err(CheckerError::check_failed(
ctx.part(CheckerStateP).step,
format!(
"user name added to variable {:?} which is still hidden",
global_var
),
));
}
if var_data.user_var.is_some() {
return Err(CheckerError::check_failed(
ctx.part(CheckerStateP).step,
format!("change of user name for in use varible {:?}", global_var),
));
}
var_data.user_var = Some(user_var);
variables.used_user_vars.insert(user_var);
let sampling_mode = if var_data.sampling_mode == SamplingMode::Witness {
CheckedSamplingMode::Witness
} else {
CheckedSamplingMode::Sample
};
process_step(
ctx_in.borrow(),
&CheckedProofStep::UserVar {
var: global_var,
user_var: Some(CheckedUserVar {
user_var,
sampling_mode,
new_var: true,
}),
},
)?;
Ok(())
}
/// Remove a user/global var mapping.
pub fn remove_user_mapping<'a>(
mut ctx: partial!(Context<'a>, mut ClausesP, mut ProcessingP<'a>, mut VariablesP, CheckerStateP),
global_var: Var,
) -> Result<(), CheckerError> {
ensure_var(ctx.borrow(), global_var);
let variables = ctx.part_mut(VariablesP);
let var_data = &variables.var_data[global_var.index()];
// We process this step before removing the mapping, so the processor can still look up the
// mapping.
if var_data.user_var.is_some() {
process_step(
ctx.borrow(),
&CheckedProofStep::UserVar {
var: global_var,
user_var: None,
},
)?;
} else {
return Err(CheckerError::check_failed(
ctx.part(CheckerStateP).step,
format!("no user name to remove for variable {:?}", global_var),
));
}
let variables = ctx.part_mut(VariablesP);
let var_data = &mut variables.var_data[global_var.index()];
if let Some(user_var) = var_data.user_var {
variables.used_user_vars.remove(&user_var);
var_data.user_var = None;
var_data.sampling_mode = SamplingMode::Hide;
}
Ok(())
}
|
use std::fmt::{self, Debug};
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
}
impl Color {
pub const fn new(r: u8, g: u8, b: u8) -> Self {
Color { r, g, b }
}
pub const BLUE: Color = Color::new(0, 0, 0xFF);
}
impl Debug for Color {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "#{:02x}{:02x}{:02x}", self.r, self.g, self.b)
}
}
#[cfg(test)]
mod tests {
use super::Color;
#[test]
fn debug() {
assert_eq!(format!("{:?}", Color::new(0xAB, 0xCD, 0xEF)), "#abcdef");
assert_eq!(format!("{:?}", Color::new(0x00, 0x00, 0x00)), "#000000");
}
}
|
use crate::mask::Mask;
/// A mask where every element is set.
#[derive(Default, Debug, Clone, Copy)]
pub struct All(());
impl Mask for All {
type Iter = Iter;
fn test(&self, _: usize) -> bool {
true
}
fn iter(&self) -> Self::Iter {
Iter { index: 0 }
}
}
/// The iterator for the [All] mask. Yields every possible index in order.
pub struct Iter {
index: usize,
}
impl Iterator for Iter {
type Item = usize;
fn next(&mut self) -> Option<Self::Item> {
let index = self.index;
self.index += 1;
Some(index)
}
}
|
fn main() {
let d1 = [1, 2, 3];
println!("{:?}", d1);
for x in &d1 {
println!("res = {}", x);
}
print_each(&d1);
}
fn print_each(list: &[i32]) {
for n in list {
println!("v = {}", n);
}
}
|
use nannou::prelude::*;
use super::rect::RectExtension;
use crate::snapshot::rand::Rand;
pub trait F32Extension {
fn rescale(&self, input_min: f32, input_max: f32, output_min: f32, output_max: f32) -> f32;
fn normalize(&self, input_min: f32, input_max: f32) -> f32;
fn denormalize(&self, output_min: f32, output_max: f32) -> f32;
fn denormalize_symmetrically(&self, radius: f32) -> f32;
fn lerp_w(&self, rect: &Rect) -> f32;
fn lerp_h(&self, rect: &Rect) -> f32;
fn times(&self, other: f32) -> f32;
fn plus(&self, other: f32) -> f32;
fn clamp(&self, min: f32, max: f32) -> f32;
fn normalize_w(&self, rect: &Rect) -> f32;
fn normalize_h(&self, rect: &Rect) -> f32;
fn turns(&self) -> f32;
fn jitter(&self, rand: &mut Rand, amplitude: f32) -> f32;
fn ease_in_quart(&self) -> f32;
fn normalized_cos(&self) -> f32;
fn loop_normalize(&self, min: f32, max: f32) -> f32;
}
impl F32Extension for f32 {
fn rescale(&self, input_min: f32, input_max: f32, output_min: f32, output_max: f32) -> f32 {
// Great explanation of this algorithm here:
// https://stats.stackexchange.com/questions/281162/scale-a-number-between-a-range/281164
let input_size = input_max - input_min;
let normalized = (self - input_min) / input_size;
let output_size = output_max - output_min;
(normalized * output_size) + output_min
}
fn normalize(&self, input_min: f32, input_max: f32) -> f32 {
self.rescale(input_min, input_max, 0.0, 1.0)
}
fn denormalize(&self, output_min: f32, output_max: f32) -> f32 {
self.rescale(0.0, 1.0, output_min, output_max)
}
fn denormalize_symmetrically(&self, radius: f32) -> f32 {
self.denormalize(-radius, radius)
}
fn lerp_w(&self, rect: &Rect) -> f32 {
rect.lerp_w(*self)
}
fn lerp_h(&self, rect: &Rect) -> f32 {
rect.lerp_h(*self)
}
fn times(&self, other: f32) -> f32 {
self * other
}
fn plus(&self, other: f32) -> f32 {
self + other
}
fn clamp(&self, min: f32, max: f32) -> f32 {
if self > &max {
return max;
}
if self < &min {
return min;
}
self.clone()
}
fn normalize_w(&self, rect: &Rect) -> f32 {
rect.normalize_w(*self)
}
fn normalize_h(&self, rect: &Rect) -> f32 {
rect.normalize_w(*self)
}
fn turns(&self) -> f32 {
*self * TAU
}
fn jitter(&self, rand: &mut Rand, amplitude: f32) -> f32 {
*self + rand.standard_gaussian() * amplitude
}
fn ease_in_quart(&self) -> f32 {
nannou::ease::quart::ease_in(*self, 0.0, 1.0, 1.0)
}
fn normalized_cos(&self) -> f32 {
self.cos().normalize(-1.0, 1.0)
}
// Takes a value that goes from min to max and normalizes it.
// It handles out of bounds values by looping them back into
// the normalized range. In contrast, regular normalization
// just lets the value exceed the normalized range.
//
// For example:
//
// 20.0.normalize(0.0, 10.0); // Returns two.
// 20.0.loop_normalize(0.0, 10.0) // Returns one.
fn loop_normalize(&self, min: f32, max: f32) -> f32 {
(self.normalize(min, max) % 1.0).abs()
}
}
|
use crate::extractors::amp_spectrum;
use crate::utils;
pub fn compute(signal: &Vec<f64>) -> f64 {
let amp_spec: Vec<f64> = amp_spectrum::compute(signal);
let mus: Vec<f64> = (1..5)
.map(|x| utils::mu(x as i32, &_spec))
.into_iter()
.collect();
let numerator =
-3.0 * mus[0].powf(4.0) + 6.0 * mus[0] * mus[1] - 4.0 * mus[0] * mus[2] + mus[3];
let denominator = (mus[1] - mus[0].powf(2.0)).sqrt().powf(4.0);
numerator / denominator
}
#[cfg(test)]
mod tests {
use super::compute;
use crate::utils::test;
use std::f64;
const FLOAT_PRECISION: f64 = 0.000_010_000;
fn test_against(dataset: &test::data::TestDataSet) -> () {
let sk = compute(&dataset.signal);
assert_relative_eq!(
sk,
dataset.features.spectralKurtosis,
epsilon = f64::EPSILON,
max_relative = FLOAT_PRECISION
);
}
#[test]
fn test_spectral_kurtosis() {
let datasets = test::data::get_all();
for dataset in datasets.iter() {
test_against(dataset);
}
}
}
|
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: u32 = rd.get();
let x = n * 108 / 100;
let y = 206;
if x < y {
println!("Yay!");
} else if x == y {
println!("so-so");
} else {
println!(":(");
}
}
|
#[doc = "Reader of register OR"]
pub type R = crate::R<u32, super::OR>;
#[doc = "Writer for register OR"]
pub type W = crate::W<u32, super::OR>;
#[doc = "Register OR `reset()`'s with value 0"]
impl crate::ResetValue for super::OR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `TIM8_ETR_ADC2_RMP`"]
pub type TIM8_ETR_ADC2_RMP_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `TIM8_ETR_ADC2_RMP`"]
pub struct TIM8_ETR_ADC2_RMP_W<'a> {
w: &'a mut W,
}
impl<'a> TIM8_ETR_ADC2_RMP_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
self.w
}
}
#[doc = "Reader of field `TIM8_ETR_ADC3_RMP`"]
pub type TIM8_ETR_ADC3_RMP_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `TIM8_ETR_ADC3_RMP`"]
pub struct TIM8_ETR_ADC3_RMP_W<'a> {
w: &'a mut W,
}
impl<'a> TIM8_ETR_ADC3_RMP_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
self.w
}
}
impl R {
#[doc = "Bits 0:1 - TIM8_ETR_ADC2 remapping capability"]
#[inline(always)]
pub fn tim8_etr_adc2_rmp(&self) -> TIM8_ETR_ADC2_RMP_R {
TIM8_ETR_ADC2_RMP_R::new((self.bits & 0x03) as u8)
}
#[doc = "Bits 2:3 - TIM8_ETR_ADC3 remapping capability"]
#[inline(always)]
pub fn tim8_etr_adc3_rmp(&self) -> TIM8_ETR_ADC3_RMP_R {
TIM8_ETR_ADC3_RMP_R::new(((self.bits >> 2) & 0x03) as u8)
}
}
impl W {
#[doc = "Bits 0:1 - TIM8_ETR_ADC2 remapping capability"]
#[inline(always)]
pub fn tim8_etr_adc2_rmp(&mut self) -> TIM8_ETR_ADC2_RMP_W {
TIM8_ETR_ADC2_RMP_W { w: self }
}
#[doc = "Bits 2:3 - TIM8_ETR_ADC3 remapping capability"]
#[inline(always)]
pub fn tim8_etr_adc3_rmp(&mut self) -> TIM8_ETR_ADC3_RMP_W {
TIM8_ETR_ADC3_RMP_W { w: self }
}
}
|
/*
* Copyright 2017 Bitwise IO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -----------------------------------------------------------------------------
*/
extern crate zmq;
extern crate protobuf;
extern crate rand;
use self::rand::Rng;
pub mod handler;
use std::error::Error;
use protobuf::Message as M;
use messages::validator::Message_MessageType;
use messages::processor::TpRegisterRequest;
use messages::processor::TpProcessRequest;
use messages::processor::TpProcessResponse;
use messages::processor::TpProcessResponse_Status;
use messaging::stream::MessageConnection;
use messaging::stream::MessageSender;
use messaging::zmq_stream::ZmqMessageConnection;
use self::handler::TransactionContext;
use self::handler::TransactionHandler;
use self::handler::ApplyError;
/// Generates a random correlation id for use in Message
fn generate_correlation_id() -> String {
const LENGTH: usize = 16;
rand::thread_rng().gen_ascii_chars().take(LENGTH).collect()
}
pub struct TransactionProcessor<'a> {
endpoint: String,
conn: ZmqMessageConnection,
handlers: Vec<&'a TransactionHandler>
}
impl<'a> TransactionProcessor<'a> {
/// TransactionProcessor is for communicating with a
/// validator and routing transaction processing requests to a registered
/// handler. It uses ZMQ and channels to handle requests concurrently.
pub fn new(endpoint: &str) -> TransactionProcessor {
TransactionProcessor {
endpoint: String::from(endpoint),
conn: ZmqMessageConnection::new(endpoint),
handlers: Vec::new()
}
}
/// Adds a transaction family handler
///
/// # Arguments
///
/// * handler - the handler to be added
pub fn add_handler(&mut self, handler: &'a TransactionHandler) {
self.handlers.push(handler);
}
/// Connects the transaction processor to a validator and starts
/// listening for requests and routing them to an appropriate
/// transaction handler.
pub fn start(&mut self) {
info!("connecting to endpoint: {}", self.endpoint);
let (mut sender, receiver) = self.conn.create();
for handler in &self.handlers {
for version in handler.family_versions() {
let mut request = TpRegisterRequest::new();
request.set_family(handler.family_name().clone());
request.set_version(version.clone());
info!("sending TpRegisterRequest: {} {}",
&handler.family_name(),
&version);
let serialized = request.write_to_bytes().unwrap();
let x : &[u8] = &serialized;
let mut future = sender.send(
Message_MessageType::TP_REGISTER_REQUEST,
&generate_correlation_id(),
x).unwrap();
// Absorb the TpRegisterResponse message
let _ = future.get().unwrap();
}
}
loop {
match receiver.recv() {
Ok(r) => {
let message = r.unwrap();
info!("Message: {}", message.get_correlation_id());
match message.get_message_type() {
Message_MessageType::TP_PROCESS_REQUEST => {
let request: TpProcessRequest = protobuf::parse_from_bytes(&message.get_content()).unwrap();
let mut context = TransactionContext::new(request.get_context_id(), sender.clone());
let mut response = TpProcessResponse::new();
match self.handlers[0].apply(&request, &mut context) {
Ok(()) => {
response.set_status(TpProcessResponse_Status::OK);
info!("TP_PROCESS_REQUEST sending TpProcessResponse: OK");
},
Err(ApplyError::InvalidTransaction(msg)) => {
response.set_status(TpProcessResponse_Status::INVALID_TRANSACTION);
response.set_message(msg.clone());
info!("TP_PROCESS_REQUEST sending TpProcessResponse: {}", msg);
},
Err(err) => {
response.set_status(TpProcessResponse_Status::INTERNAL_ERROR);
response.set_message(String::from(err.description()));
info!("TP_PROCESS_REQUEST sending TpProcessResponse: {}", err.description());
}
};
let serialized = response.write_to_bytes().unwrap();
let x : &[u8] = &serialized;
sender.reply(
Message_MessageType::TP_PROCESS_RESPONSE,
message.get_correlation_id(),
x).unwrap();
},
_ => {
let mut response = TpProcessResponse::new();
response.set_status(TpProcessResponse_Status::INTERNAL_ERROR);
response.set_message(String::from("not implemented..."));
let serialized = response.write_to_bytes().unwrap();
let x : &[u8] = &serialized;
sender.reply(
Message_MessageType::TP_PROCESS_RESPONSE,
message.get_correlation_id(),
x).unwrap();
}
}
}
Err(err) => {
error!("Error: {}", err.description());
}
}
}
}
}
|
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#[macro_use]
pub mod serde_ext;
mod v1_to_v2;
pub mod v2;
use {
crate::{serde_ext::*, v2::FontsManifest as FontsManifestV2},
char_set::CharSet,
failure::{self, format_err, ResultExt},
fidl_fuchsia_fonts::{GenericFontFamily, Slant, Width, WEIGHT_NORMAL},
fuchsia_url::pkg_url::PkgUrl,
offset_string::OffsetString,
serde::{
de::{self, Deserialize, Deserializer, Error},
ser::{Serialize, Serializer},
},
serde_derive::{Deserialize, Serialize},
serde_json,
std::{
convert::TryFrom,
fmt,
fs::{self, File},
io::Read,
path::{Path, PathBuf},
},
};
#[derive(Deserialize, Serialize)]
#[serde(tag = "version")]
pub enum FontManifestWrapper {
#[serde(rename = "1")]
Version1(FontsManifest),
#[serde(rename = "2")]
Version2(FontsManifestV2),
}
// Following structs are used to parse manifest.json.
#[derive(Debug, Deserialize, Serialize)]
pub struct FontsManifest {
pub families: Vec<Family>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct Family {
pub family: String,
pub aliases: Option<Vec<String>>,
pub fonts: Vec<Font>,
#[serde(default = "default_fallback")]
pub fallback: bool,
#[serde(
alias = "fallback_group",
default = "default_generic_family",
with = "OptGenericFontFamily"
)]
pub generic_family: Option<GenericFontFamily>,
}
pub type LanguageSet = Vec<String>;
#[derive(Debug, Deserialize, Serialize)]
pub struct Font {
pub asset: PathBuf,
#[serde(default = "default_index")]
pub index: u32,
#[serde(default = "default_slant", with = "SlantDef")]
pub slant: Slant,
#[serde(default = "default_weight")]
pub weight: u16,
#[serde(default = "default_width", with = "WidthDef")]
pub width: Width,
#[serde(
alias = "language",
default = "default_languages",
deserialize_with = "deserialize_languages"
)]
pub languages: LanguageSet,
#[serde(default = "default_package")]
pub package: Option<PkgUrl>,
#[serde(
default,
deserialize_with = "deserialize_code_points",
serialize_with = "serialize_code_points"
)]
pub code_points: CharSet,
}
fn default_fallback() -> bool {
false
}
fn default_generic_family() -> Option<GenericFontFamily> {
None
}
fn default_index() -> u32 {
0
}
fn default_slant() -> Slant {
Slant::Upright
}
fn default_weight() -> u16 {
WEIGHT_NORMAL
}
fn default_width() -> Width {
Width::Normal
}
fn default_languages() -> LanguageSet {
LanguageSet::new()
}
fn default_package() -> Option<PkgUrl> {
None
}
/// Helper used to deserialize language field for a font. Language field can contain either a single
/// string or an array of strings.
fn deserialize_languages<'d, D>(deserializer: D) -> Result<LanguageSet, D::Error>
where
D: Deserializer<'d>,
{
struct LanguageSetVisitor;
impl<'de> de::Visitor<'de> for LanguageSetVisitor {
type Value = Vec<String>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("string or list of strings")
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: de::Error,
{
Ok(vec![s.to_string()])
}
fn visit_seq<S>(self, seq: S) -> Result<Self::Value, S::Error>
where
S: de::SeqAccess<'de>,
{
Deserialize::deserialize(de::value::SeqAccessDeserializer::new(seq))
}
}
deserializer.deserialize_any(LanguageSetVisitor)
}
fn deserialize_code_points<'d, D>(deserializer: D) -> Result<CharSet, D::Error>
where
D: Deserializer<'d>,
{
let offset_string = OffsetString::deserialize(deserializer)?;
CharSet::try_from(offset_string).map_err(|e| D::Error::custom(format!("{:?}", e)))
}
fn serialize_code_points<S>(code_points: &CharSet, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let offset_string: OffsetString = code_points.into();
offset_string.serialize(serializer)
}
impl FontsManifest {
// TODO(8892): Implement loading of v2 manifests.
pub fn load_from_file(path: &Path) -> Result<FontsManifest, failure::Error> {
let path = fs::canonicalize(path)?;
let base_dir =
path.parent().ok_or(format_err!("Invalid manifest path: {}", path.display()))?;
let mut f = File::open(path.clone())?;
let mut contents = String::new();
f.read_to_string(&mut contents)?;
let mut manifest: FontsManifest = serde_json::from_str(&contents)
.context(format!("Failed to load {}", path.display()))?;
// Make sure all paths are absolute.
for family in manifest.families.iter_mut() {
for font in family.fonts.iter_mut() {
if font.asset.is_relative() {
font.asset = base_dir.join(font.asset.clone());
}
}
}
Ok(manifest)
}
}
|
use std::fmt::Debug;
use std::io;
use std::str::FromStr;
fn read_and_divide_line<T>() -> Vec<T>
where
T: FromStr,
<T as FromStr>::Err: Debug,
{
let mut target_line = String::new();
io::stdin().read_line(&mut target_line).unwrap();
target_line
.trim()
.split_whitespace()
.map(|c| T::from_str(c).unwrap())
.collect()
}
fn main() {
let kind_num: Vec<i64> = read_and_divide_line();
let coupon_kind_num = kind_num[2];
let refrigerator_prices: Vec<i64> = read_and_divide_line();
let microwave_prices: Vec<i64> = read_and_divide_line();
let mut each_price_combination: Vec<Vec<i64>> = vec![];
for _ in 0..coupon_kind_num {
each_price_combination.push(read_and_divide_line());
}
let min_refrigerator_price = {
let mut tmp_refrigerator_prices = refrigerator_prices.clone();
tmp_refrigerator_prices.sort();
tmp_refrigerator_prices[0]
};
let min_microwave_price = {
let mut tmp_microwave_prices = microwave_prices.clone();
tmp_microwave_prices.sort();
tmp_microwave_prices[0]
};
let mut min_price = min_refrigerator_price + min_microwave_price;
for combination in each_price_combination {
let now_price = refrigerator_prices[(combination[0] as usize) - 1]
+ microwave_prices[(combination[1] as usize) - 1]
- combination[2];
if now_price < min_price {
min_price = now_price;
}
}
println!("{}", min_price);
}
|
const RAM_SIZE: usize = 65536;
const SPR_RAM_SIZE: usize = 256;
const NAME_TABLE_ADDRS: [usize; 4] = [0x2000, 0x2400, 0x2800, 0x2c00];
#[derive(Default)]
pub struct PPU {
io_regs: [u8; 8],
// Control register 1
name_table: usize,
addr_incr: u32,
pattern_table: usize,
background_table: usize,
sprite_size: u32,
vblank_nmi: bool,
// Control register 2
monochrome: bool,
background_clip: bool,
sprite_clip: bool,
background: bool,
sprites: bool,
background_col: u32,
// SPR-RAM address register
spr_ram_addr: usize,
scroll_pos: u8,
vram_addr: u8,
vram_addr_prev: u8,
ram: Vec<u8>,
spr_ram: Vec<u8>
}
impl PPU {
pub fn new() -> PPU {
PPU {
ram: vec![0; RAM_SIZE],
spr_ram: vec![0; SPR_RAM_SIZE],
..Default::default()
}
}
pub fn read_io_reg(&mut self, reg: usize) -> u8 {
if reg == 2 {
self.scroll_pos = 0;
self.vram_addr = 0;
self.io_regs[reg]
} else if reg == 7 {
let addr = (self.vram_addr_prev as usize) << 8 + self.vram_addr as usize;
self.ram[addr]
// TODO: increment address?
} else {
panic!("Attempt to read write-only I/O register {}", reg);
}
}
pub fn write_io_reg(&mut self, reg: usize, val: u8) {
if reg != 2 {
match reg {
0 => {
// Control reg 1
self.name_table = NAME_TABLE_ADDRS[(val & 0b11) as usize];
self.addr_incr = if (val & 0b100) != 0 { 32 } else { 1 };
self.pattern_table = if (val & 0b1000) != 0 { 0x1000 } else { 0 };
self.background_table = if (val & 0b10000) != 0 { 0x1000 } else { 0 };
self.sprite_size = if (val & 0b100000) != 0 { 16 } else { 8 };
self.vblank_nmi = (val & 0b10000000) != 0;
}
1 => {
// Control reg 2
self.monochrome = (val & 1) != 0;
self.background_clip = (val & 0b10) == 0;
self.sprite_clip = (val & 0b100) == 0;
self.background = (val & 0b1000) != 0;
self.sprites = (val & 0b10000) != 0;
self.background_col = (val >> 5) as u32;
}
5 => {
// scroll reg
self.scroll_pos = val;
}
6 => {
// VRAM addr reg
self.vram_addr_prev = self.vram_addr;
self.vram_addr = val;
}
7 => {
let addr = ((self.vram_addr_prev as usize) << 8) + self.vram_addr as usize;
self.ram[addr] = val;
// TODO: increment address?
}
_ => { panic!("Unhandled I/O register {} write", reg); }
}
self.io_regs[reg] = val;
} else {
panic!("Attempt to write to read-only I/O register {}", reg);
}
}
pub fn run_step(&mut self) {
self.io_regs[2] = 0x80;
}
}
|
use rdev::{simulate, Button, EventType, Key, SimulateError};
use std::{thread, time};
fn send(event_type: &EventType) {
let delay = time::Duration::from_millis(20);
match simulate(event_type) {
Ok(()) => (),
Err(SimulateError) => {
println!("We could not send {:?}", event_type);
}
}
// Let ths OS catchup (at least MacOS)
thread::sleep(delay);
}
fn main() {
send(&EventType::KeyPress(Key::KeyS));
send(&EventType::KeyRelease(Key::KeyS));
send(&EventType::MouseMove { x: 0.0, y: 0.0 });
send(&EventType::MouseMove { x: 400.0, y: 400.0 });
send(&EventType::ButtonPress(Button::Left));
send(&EventType::ButtonRelease(Button::Right));
send(&EventType::Wheel {
delta_x: 0,
delta_y: 1,
});
}
|
use std::{
fmt::{Debug, Display},
sync::Arc,
};
use async_trait::async_trait;
use data_types::PartitionId;
use parking_lot::Mutex;
/// A source of partitions, noted by [`PartitionId`](data_types::PartitionId), that may potentially need compacting.
#[async_trait]
pub(crate) trait PartitionsSource: Debug + Display + Send + Sync {
/// Get partition IDs.
///
/// This method performs retries.
///
/// This should only perform basic, efficient filtering. It MUST NOT inspect individual parquet files.
async fn fetch(&self) -> Vec<PartitionId>;
}
#[async_trait]
impl<T> PartitionsSource for Arc<T>
where
T: PartitionsSource + ?Sized,
{
async fn fetch(&self) -> Vec<PartitionId> {
self.as_ref().fetch().await
}
}
pub(crate) use mock::MockPartitionsSource;
mod mock {
use super::*;
/// A mock structure for providing [partitions](PartitionId).
#[derive(Debug)]
pub(crate) struct MockPartitionsSource {
partitions: Mutex<Vec<PartitionId>>,
}
impl MockPartitionsSource {
/// Create a new MockPartitionsSource.
pub(crate) fn new(partitions: Vec<PartitionId>) -> Self {
Self {
partitions: Mutex::new(partitions),
}
}
/// Set PartitionIds for MockPartitionsSource.
#[cfg(test)]
pub(crate) fn set(&self, partitions: Vec<PartitionId>) {
*self.partitions.lock() = partitions;
}
}
impl Display for MockPartitionsSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "mock")
}
}
#[async_trait]
impl PartitionsSource for MockPartitionsSource {
async fn fetch(&self) -> Vec<PartitionId> {
self.partitions.lock().clone()
}
}
}
#[cfg(test)]
mod tests {
use super::mock::*;
use super::*;
#[test]
fn test_display() {
assert_eq!(MockPartitionsSource::new(vec![]).to_string(), "mock",);
}
#[tokio::test]
async fn test_fetch() {
let source = MockPartitionsSource::new(vec![]);
assert_eq!(source.fetch().await, vec![],);
let p_1 = PartitionId::new(5);
let p_2 = PartitionId::new(1);
let p_3 = PartitionId::new(12);
let parts = vec![p_1, p_2, p_3];
source.set(parts.clone());
assert_eq!(source.fetch().await, parts,);
}
}
|
use std::io;
use std::path::PathBuf;
use serde_json;
use structopt::StructOpt;
use telamon::explorer::{eventlog::EventLog, mcts};
#[derive(Debug, StructOpt)]
#[structopt(name = "parse_event_log")]
struct Opt {
#[structopt(
parse(from_os_str),
short = "i",
long = "input",
default_value = "eventlog.tfrecord.gz"
)]
eventlog: PathBuf,
}
fn main() -> io::Result<()> {
let opt = Opt::from_args();
for record_bytes in EventLog::open(&opt.eventlog)?.records() {
let message: mcts::Message = bincode::deserialize(&record_bytes?).unwrap();
println!("{}", serde_json::to_string(&message).unwrap());
}
Ok(())
}
|
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let t: usize = rd.get();
for _ in 0..t {
let k: usize = rd.get();
let n: usize = rd.get();
let m: usize = rd.get();
let a: Vec<usize> = rd.get_vec(n);
let b: Vec<usize> = rd.get_vec(m);
solve(k, n, m, a, b);
}
}
fn solve(k: usize, n: usize, m: usize, a: Vec<usize>, b: Vec<usize>) {
use std::collections::VecDeque;
let mut a: VecDeque<usize> = a.into_iter().collect();
let mut b: VecDeque<usize> = b.into_iter().collect();
let mut k = k;
let mut ans = Vec::new();
while a.len() >= 1 || b.len() >= 1 {
while a.len() >= 1 && a[0] == 0 {
ans.push(a.pop_front().unwrap());
k += 1;
}
while b.len() >= 1 && b[0] == 0 {
ans.push(b.pop_front().unwrap());
k += 1;
}
if a.len() >= 1 && a[0] <= k {
ans.push(a.pop_front().unwrap());
} else if b.len() >= 1 && b[0] <= k {
ans.push(b.pop_front().unwrap());
} else {
break;
}
}
if ans.len() != n + m {
println!("-1");return;
}
print!("{}", ans[0]);
for a in &ans[1..] {
print!(" {}", a);
}
println!();
}
|
use std::cmp;
fn main() {
let (earliest_timestamp_to_depart, delta_time_and_bus_frequency_list) = get_input();
let mut min_wait = u64::MAX;
let mut bus_id =0;
for bus in &delta_time_and_bus_frequency_list {
let time = bus.1 - earliest_timestamp_to_depart%bus.1;
if time < min_wait {
min_wait = time;
bus_id = bus.1;
}
}
println!("Part One: {}", min_wait*bus_id);
let mut time =0;
let mut current_lcm =1;
for thing in delta_time_and_bus_frequency_list {
while (thing.1 - time%(thing.1))%thing.1 != thing.0%thing.1 {
time += current_lcm;
}
current_lcm = lcm(current_lcm, thing.1);
}
println!("{:?}", time);
}
fn lcm(first: u64, second: u64) -> u64 {
first * second / gcd(first, second)
}
fn gcd(first: u64, second: u64) -> u64 {
let mut max = first;
let mut min = second;
if min > max {
let val = max; max = min; min = val;
}
loop {
let res = max % min;
if res == 0 {
return min;
}
max = min;
min = res;
}
}
fn get_input() -> (u64, Vec<(u64, u64)>) {
let split: Vec<_> = INPUT.split('\n').collect();
let earliest_timestamp_to_depart = split[0].parse::<u64>().unwrap();
let busses: Vec<_>= split[1].split(',').collect();
let mut delta_time_and_bus_frequency_list = Vec::new();
for (i, a) in busses.iter().enumerate() {
if a != &"x" {
delta_time_and_bus_frequency_list.push((i as u64,a.parse::<u64>().unwrap()));
}
};
(earliest_timestamp_to_depart, delta_time_and_bus_frequency_list)
}
static INPUT: &str = "1009310
19,x,x,x,x,x,x,x,x,x,x,x,x,37,x,x,x,x,x,599,x,29,x,x,x,x,x,x,x,x,x,x,x,x,x,x,17,x,x,x,x,x,23,x,x,x,x,x,x,x,761,x,x,x,x,x,x,x,x,x,41,x,x,13"; |
#![cfg_attr(feature = "strict", deny(warnings))]
use std::fmt::*;
use std::marker::*;
pub struct Map {
pub height: u8,
pub width: u8,
pub players: Vec<Vec<Player>>
}
impl Display for Map {
fn fmt(&self, f: &mut Formatter) -> Result {
for row in &self.players {
for player in row {
write!(f, "{}", player);
}
write!(f, "\n");
}
write!(f, "")
}
}
impl Map {
pub fn get_next_gen(&self) -> Map {
let mut next_gen_players = vec![vec![Player { is_alive: false }; self.width as usize]; self.height as usize];
for y in 0usize..self.height as usize {
for x in 0usize..self.width as usize {
next_gen_players[y][x].is_alive = get_next_gen_is_alive(self, x, y);
}
}
Map {
height: self.height,
width: self.width,
players: next_gen_players
}
}
}
fn get_next_gen_is_alive(map: &Map, x: usize, y: usize) -> bool {
let mut living_neighbors_count = 0u8;
let lower_bound = map.height as i8;
let right_bound = map.width as i8;
for y_offset in -1i8..=1 {
for x_offset in -1i8..=1 {
if y_offset != 0 || x_offset != 0 {
let (in_bounds, (x_index, y_index)) = get_indeces(x, x_offset, y, y_offset, right_bound, lower_bound);
if in_bounds && map.players[y_index][x_index].is_alive {
living_neighbors_count += 1;
}
}
}
}
match living_neighbors_count {
2 => map.players[y][x].is_alive,
3 => true,
_ => false
}
}
fn get_indeces(x: usize, x_off: i8, y: usize, y_off: i8, x_max: i8, y_max: i8) -> (bool, (usize, usize)) {
let x_in_bounds = x as i8 + x_off;
let y_in_bounds = y as i8 + y_off;
if x_in_bounds > 0 && x_in_bounds < x_max && y_in_bounds > 0 && y_in_bounds < y_max {
(true, (x_in_bounds as usize, y_in_bounds as usize))
} else {
(false, (0usize, 0usize))
}
}
#[derive(Copy, Clone)]
pub struct Player {
pub is_alive: bool
}
impl Display for Player {
fn fmt(&self, f: &mut Formatter) -> Result {
if self.is_alive { write!(f, "*") }
else { write!(f, ".") }
}
} |
#![no_main]
#![no_std]
extern crate cortex_m;
#[macro_use]
extern crate cortex_m_rt as rt;
extern crate panic_semihosting;
extern crate pwm_speaker;
extern crate stm32f103xx_hal as hal;
use hal::delay::Delay;
use hal::prelude::*;
use rt::ExceptionFrame;
entry!(main);
fn main() -> ! {
let dp = hal::stm32f103xx::Peripherals::take().unwrap();
let cp = cortex_m::Peripherals::take().unwrap();
let mut flash = dp.FLASH.constrain();
let mut rcc = dp.RCC.constrain();
let mut afio = dp.AFIO.constrain(&mut rcc.apb2);
let mut gpioa = dp.GPIOA.split(&mut rcc.apb2);
let clocks = rcc.cfgr.freeze(&mut flash.acr);
let mut delay = Delay::new(cp.SYST, clocks);
let c1 = gpioa.pa0.into_alternate_push_pull(&mut gpioa.crl);
let mut pwm = dp
.TIM2
.pwm(c1, &mut afio.mapr, 440.hz(), clocks, &mut rcc.apb1);
pwm.enable();
let mut speaker = pwm_speaker::Speaker::new(pwm, clocks);
loop {
use pwm_speaker::songs::*;
speaker.play_score(&AU_FEU_LES_POMPIERS, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&BATEAU_SUR_LEAU, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&FRERE_JACQUES, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&IL_ETAIT_UN_PETIT_NAVIRE, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&LAVENTURIER, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&MARIO_THEME_INTRO, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&SO_WHAT, &mut delay);
delay.delay_ms(1000u32);
speaker.play_score(&THIRD_KIND, &mut delay);
delay.delay_ms(1000u32);
}
}
exception!(HardFault, hard_fault);
fn hard_fault(ef: &ExceptionFrame) -> ! {
panic!("{:#?}", ef);
}
exception!(*, default_handler);
fn default_handler(irqn: i16) {
panic!("Unhandled exception (IRQn = {})", irqn);
}
|
#![feature(crate_in_paths)]
extern crate failure;
#[macro_use]
extern crate maplit;
extern crate oatie;
extern crate rand;
extern crate regex;
extern crate serde;
extern crate taken;
#[macro_use]
extern crate serde_derive;
extern crate colored;
extern crate htmlescape;
#[macro_use]
extern crate lazy_static;
extern crate pulldown_cmark;
extern crate pulldown_cmark_to_cmark;
extern crate ron;
extern crate serde_json;
extern crate take_mut;
pub mod commands;
pub mod markdown;
use htmlescape::encode_minimal;
use oatie::doc::*;
use regex::Regex;
// TODO move this to a different module
/// Converts a DocSpan to an HTML string.
pub fn doc_as_html(doc: &DocSpan) -> String {
lazy_static! {
// Whenever caret can be wrapped with the next line, it should.
static ref CARET_FOLLOWS_BREAKABLE: Regex =
Regex::new(r#"(\s|\-)</span><div\s+data-tag="caret""#).unwrap();
}
let (res, res_alt) = doc_as_html_inner(doc, false);
let res = if res_alt {
// TODO do this in a save, non-ridiculous way(!)
res.replace(r#"Selected""#, "\"")
} else {
res
};
CARET_FOLLOWS_BREAKABLE
.replace_all(&res, r#"$1</span><div data-wsj="true" data-tag="caret""#)
.to_string()
}
pub fn doc_as_html_inner(doc: &DocSpan, mut alt: bool) -> (String, bool) {
use oatie::doc::*;
let mut out = String::new();
for elem in doc {
match elem {
&DocGroup(ref attrs, ref span) => {
out.push_str(&format!(
r#"<div
data-tag={}
data-client={}
data-anchor={}
class={}
>"#,
serde_json::to_string(attrs.get("tag").unwrap_or(&"".to_string())).unwrap(),
serde_json::to_string(attrs.get("client").unwrap_or(&"".to_string())).unwrap(),
serde_json::to_string(attrs.get("anchor").unwrap_or(&"".to_string())).unwrap(),
serde_json::to_string(attrs.get("class").unwrap_or(&"".to_string())).unwrap(),
));
if attrs.get("tag") == Some(&"caret".to_string()) {
alt = !alt;
}
let (inner, new_alt) = doc_as_html_inner(span, alt);
alt = new_alt;
out.push_str(&inner);
out.push_str(r"</div>");
}
&DocChars(ref text) => {
if let &Some(ref styles) = &text.styles() {
let mut classes = styles.keys().cloned().collect::<Vec<Style>>();
// TODO Style::Selected could be selected here directly
if alt {
classes.push(Style::Selected);
}
out.push_str(&format!(r#"<span class="{}">"#, classes.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(" ")));
} else {
out.push_str(r"<span>");
}
out.push_str(&encode_minimal(text.as_str()));
out.push_str(r"</span>");
}
}
}
(out, alt)
}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type NotePlacementChangedPreviewEventArgs = *mut ::core::ffi::c_void;
pub type NoteVisibilityChangedPreviewEventArgs = *mut ::core::ffi::c_void;
pub type NotesWindowManagerPreview = *mut ::core::ffi::c_void;
pub type NotesWindowManagerPreviewShowNoteOptions = *mut ::core::ffi::c_void;
|
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use libc::*;
use spin::Mutex;
use core::sync::atomic::AtomicBool;
use core::sync::atomic::Ordering;
use lazy_static::lazy_static;
use super::super::qlib::common::*;
use super::super::qlib::linux_def::*;
use super::super::qlib::control_msg::*;
use super::super::qlib::loader;
use super::super::{FD_NOTIFIER, IO_MGR};
use super::ucall::*;
use super::usocket::*;
use super::super::runc::container::container::*;
use super::super::vmspace::*;
use super::super::vmspace::hostfdnotifier::*;
lazy_static! {
pub static ref UCALL_SRV : Mutex<UCallController> = Mutex::new(UCallController::New());
pub static ref STOP : AtomicBool = AtomicBool::new(false);
}
pub fn InitUCallController(sock: i32) -> Result<()> {
error!("InitUCallController sock is {}", sock);
UCALL_SRV.lock().Init(sock)?;
return Ok(())
}
pub fn HandleSrv(srvSock: i32) -> Result<()> {
loop {
let sock = unsafe {
accept(srvSock, 0 as *mut sockaddr, 0 as *mut socklen_t)
};
if sock < 0 {
let errno = errno::errno().0 as i32;
//no connection
if errno == SysErr::EAGAIN {
return Ok(())
}
return Err(Error::SysError(errno))
}
let usock = USocket {
socket: sock,
};
let (mut req, fds) = match usock.GetReq() {
Ok((req, fds)) => ((req, fds)),
Err(e) => {
let err = UCallResp::UCallRespErr(format!("{:?}", e));
usock.SendResp(&err)?;
return Ok(())
}
};
return ProcessReq(usock, &mut req, &fds);
}
}
pub fn HandleRootContainerStart(usock: USocket, start: &RootContainerStart) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::RootContainerStart(RootProcessStart{
cid: start.cid.to_string(),
})))?;
return Ok(());
}
pub fn HandleExecProcess(usock: USocket, execArgs: &mut ExecArgs, fds: &[i32]) -> Result<()> {
execArgs.SetFds(fds);
let mut process = loader::Process::default();
process.ID = execArgs.ContainerID.to_string();
process.Cwd = execArgs.WorkDir.to_string();
process.Args.append(&mut execArgs.Argv);
process.Envs.append(&mut execArgs.Envv);
process.UID = execArgs.KUID.0;
process.GID = execArgs.KGID.0;
process.AdditionalGids.append(&mut execArgs.ExtraKGIDs.iter().map(| gid | gid.0).collect());
process.Terminal = execArgs.Terminal;
for i in 0..execArgs.Fds.len() {
let osfd = execArgs.Fds[i];
let stat = VMSpace::LibcFstat(osfd)?;
VMSpace::UnblockFd(osfd);
let st_mode = stat.st_mode & ModeType::S_IFMT as u32;
let epollable = st_mode == S_IFIFO || st_mode == S_IFSOCK || st_mode == S_IFCHR;
let hostfd = IO_MGR.lock().AddFd(osfd, epollable);
// can block wait
if epollable {
FD_NOTIFIER.AddFd(osfd, Box::new(GuestFd{hostfd: hostfd}));
}
process.Stdiofds[i] = hostfd;
}
SendControlMsg(usock, ControlMsg::New(Payload::ExecProcess(process)))?;
return Ok(());
}
pub fn HandlePause(usock: USocket) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::Pause))?;
return Ok(())
}
pub fn HandleUnpause(usock: USocket) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::Unpause))?;
return Ok(())
}
pub fn HandlePs(usock: USocket, cid: &str) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::Ps(cid.to_string())))?;
return Ok(())
}
pub fn HandleWait(usock: USocket) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::WaitContainer))?;
return Ok(())
}
pub fn HandleWaitPid(usock: USocket, waitpid: &WaitPid) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::WaitPid(*waitpid)))?;
return Ok(())
}
pub fn HandleSignal(usock: USocket, signalArgs: &SignalArgs) -> Result<()> {
//error!("ucallServer::HandleSignal signalArgs is {:?}", signalArgs);
// workaournd: in case the guest threads crash.
// todo: fix this
if signalArgs.Signo == Signal::SIGKILL && signalArgs.Mode == SignalDeliveryMode::DeliverToAllProcesses {
unsafe {
// ucallServer::HandleSignal SIGKILL all processes
libc::kill(0, 9);
return Ok(())
}
}
SendControlMsg(usock, ControlMsg::New(Payload::Signal(*signalArgs)))?;
return Ok(())
}
pub fn HandleContainerDestroy(usock: USocket) -> Result<()> {
SendControlMsg(usock, ControlMsg::New(Payload::ContainerDestroy))?;
return Ok(())
}
pub fn ProcessReq(usock: USocket, req: &mut UCallReq, fds: &[i32]) -> Result<()> {
match req {
UCallReq::RootContainerStart(start) => HandleRootContainerStart(usock, start)?,
UCallReq::ExecProcess(ref mut execArgs) => HandleExecProcess(usock, execArgs, fds)?,
UCallReq::Pause => HandlePause(usock)?,
UCallReq::Unpause => HandleUnpause(usock)?,
UCallReq::Ps(cid) => HandlePs(usock, cid)?,
UCallReq::WaitContainer => HandleWait(usock)?,
UCallReq::WaitPid(waitpid) => HandleWaitPid(usock, waitpid)?,
UCallReq::Signal(signalArgs) => HandleSignal(usock, signalArgs)?,
UCallReq::ContainerDestroy => HandleContainerDestroy(usock)?,
};
return Ok(())
}
pub fn HandleEvent() -> Result<()> {
return Ok(())
}
pub fn Stop() -> Result<()> {
STOP.store(true, Ordering::SeqCst);
return UCALL_SRV.lock().Notify();
}
pub fn UcallSrvProcess() -> Result<()> {
let epollSock = UCALL_SRV.lock().epollSock;
let srvSock = UCALL_SRV.lock().srvSock;
let _eventfd = UCALL_SRV.lock().eventfd;
let mut events = [epoll_event { events: 0, u64: 0 }; 2];
while !STOP.load(Ordering::SeqCst) {
let nfds = unsafe {
epoll_wait(epollSock, &mut events[0], 2, -1)
};
if nfds == -1 {
return Err(Error::Common(format!("UCallController wait fail with err {}", errno::errno().0)));
}
for i in 0..nfds as usize {
let fd = events[i].u64 as i32;
if fd == srvSock {
HandleSrv(srvSock)?;
} else { //eventfd
HandleEvent()?;
}
}
}
UCALL_SRV.lock().Close();
return Ok(())
}
pub struct UCallController {
pub epollSock: i32,
pub srvSock: i32,
pub eventfd: i32,
}
impl UCallController {
pub fn New() -> Self {
return Self {
epollSock: 0,
srvSock: 0,
eventfd: 0,
}
}
pub fn Close(&mut self) {
unsafe {
close(self.epollSock);
close(self.srvSock);
close(self.eventfd);
}
}
pub fn Init(&mut self, sock: i32) -> Result<()> {
let eventfd = unsafe {
eventfd(0, 0)
};
if eventfd < 0 {
info!("USrvSocket eventfd fail");
return Err(Error::SysError(errno::errno().0 as i32))
}
let epollfd = unsafe {
epoll_create1(0)
};
if epollfd == -1 {
info!("USrvSocket epoll_create fail");
return Err(Error::SysError(errno::errno().0 as i32))
}
let mut event = epoll_event {
events: (EPOLLIN | EPOLLHUP | EPOLLERR) as u32,
u64: sock as u64,
};
let ret = unsafe {
epoll_ctl(epollfd, EPOLL_CTL_ADD, sock, &mut event)
};
if ret < 0 {
error!("USrvSocket epoll_ctl add fd fail with err {}", errno::errno().0 as i32);
return Err(Error::SysError(errno::errno().0 as i32))
}
let mut event = epoll_event {
events: (EPOLLIN | EPOLLHUP | EPOLLERR) as u32,
u64: eventfd as u64,
};
let ret = unsafe {
epoll_ctl(epollfd, EPOLL_CTL_ADD, eventfd, &mut event)
};
if ret < 0 {
error!("USrvSocket epoll_ctl add fd fail with err {}", errno::errno().0 as i32);
return Err(Error::SysError(errno::errno().0 as i32))
}
self.srvSock = sock;
self.eventfd = eventfd;
self.epollSock = epollfd;
return Ok(())
}
pub fn Notify(&self) -> Result<()> {
let data: u64 = 1;
unsafe {
write(self.eventfd, &data as *const _ as *const c_void, 8);
}
return Ok(())
}
}
pub trait UcallCallback {
fn Callback(&self, payload: &Payload) -> Result<()>;
} |
//! # Parse a subset of [InfluxQL]
//!
//! [InfluxQL]: https://docs.influxdata.com/influxdb/v1.8/query_language
#![deny(rustdoc::broken_intra_doc_links, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_docs,
clippy::explicit_iter_loop,
// See https://github.com/influxdata/influxdb_iox/pull/1671
clippy::future_not_send,
clippy::use_self,
clippy::clone_on_ref_ptr,
clippy::todo,
clippy::dbg_macro,
unused_crate_dependencies
)]
// Workaround for "unused crate" lint false positives.
use workspace_hack as _;
use crate::common::{statement_terminator, ws0};
use crate::internal::Error as InternalError;
use crate::statement::{statement, Statement};
use common::ParseError;
use nom::combinator::eof;
use nom::Offset;
#[cfg(test)]
mod test_util;
pub mod common;
pub mod create;
pub mod delete;
pub mod drop;
pub mod explain;
pub mod expression;
pub mod functions;
pub mod identifier;
mod internal;
mod keywords;
pub mod literal;
pub mod parameter;
pub mod select;
pub mod show;
pub mod show_field_keys;
pub mod show_measurements;
pub mod show_retention_policies;
pub mod show_tag_keys;
pub mod show_tag_values;
pub mod simple_from_clause;
pub mod statement;
pub mod string;
pub mod time_range;
pub mod timestamp;
pub mod visit;
pub mod visit_mut;
/// ParseResult is type that represents the success or failure of parsing
/// a given input into a set of InfluxQL statements.
///
/// Errors are human-readable messages indicating the cause of the parse failure.
pub type ParseResult = Result<Vec<Statement>, ParseError>;
/// Parse the input into a set of InfluxQL statements.
pub fn parse_statements(input: &str) -> ParseResult {
let mut res = Vec::new();
let mut i: &str = input;
loop {
// Consume whitespace from the input
(i, _) = ws0(i).expect("ws0 is infallible");
if eof::<_, nom::error::Error<_>>(i).is_ok() {
return Ok(res);
}
if let Ok((i1, _)) = statement_terminator(i) {
i = i1;
continue;
}
match statement(i) {
Ok((i1, o)) => {
res.push(o);
i = i1;
}
Err(nom::Err::Failure(InternalError::Syntax {
input: pos,
message,
})) => {
return Err(ParseError {
message: message.into(),
pos: input.offset(pos),
})
}
// any other error indicates an invalid statement
Err(_) => {
return Err(ParseError {
message: "invalid SQL statement".into(),
pos: input.offset(i),
})
}
}
}
}
#[cfg(test)]
mod test {
use crate::parse_statements;
/// Validates that the [`parse_statements`] function
/// handles statement terminators and errors.
#[test]
fn test_parse_statements() {
// Parse a single statement, without a terminator
let got = parse_statements("SHOW MEASUREMENTS").unwrap();
assert_eq!(got.first().unwrap().to_string(), "SHOW MEASUREMENTS");
// Parse a single statement, with a terminator
let got = parse_statements("SHOW MEASUREMENTS;").unwrap();
assert_eq!(got[0].to_string(), "SHOW MEASUREMENTS");
// Parse multiple statements with whitespace
let got = parse_statements("SHOW MEASUREMENTS;\nSHOW MEASUREMENTS LIMIT 1").unwrap();
assert_eq!(got[0].to_string(), "SHOW MEASUREMENTS");
assert_eq!(got[1].to_string(), "SHOW MEASUREMENTS LIMIT 1");
// Parse multiple statements with a terminator in quotes, ensuring it is not interpreted as
// a terminator
let got =
parse_statements("SHOW MEASUREMENTS WITH MEASUREMENT = \";\";SHOW DATABASES").unwrap();
assert_eq!(
got[0].to_string(),
"SHOW MEASUREMENTS WITH MEASUREMENT = \";\""
);
assert_eq!(got[1].to_string(), "SHOW DATABASES");
// Parses a statement with a comment
let got = parse_statements(
"SELECT idle FROM cpu WHERE host = 'host1' --GROUP BY host fill(null)",
)
.unwrap();
assert_eq!(
got[0].to_string(),
"SELECT idle FROM cpu WHERE host = 'host1'"
);
// Parses multiple statements with a comment
let got = parse_statements(
"SELECT idle FROM cpu WHERE host = 'host1' --GROUP BY host fill(null)\nSHOW DATABASES",
)
.unwrap();
assert_eq!(
got[0].to_string(),
"SELECT idle FROM cpu WHERE host = 'host1'"
);
assert_eq!(got[1].to_string(), "SHOW DATABASES");
// Parses statement with inline comment
let got = parse_statements(r#"SELECT idle FROM cpu WHERE/* time > now() AND */host = 'host1' --GROUP BY host fill(null)"#).unwrap();
assert_eq!(
got[0].to_string(),
"SELECT idle FROM cpu WHERE host = 'host1'"
);
// Parses empty single-line comments in various placements
let got = parse_statements(
r#"-- foo
--
--
SELECT value FROM cpu--
-- foo
;SELECT val2 FROM cpu"#,
)
.unwrap();
assert_eq!(got[0].to_string(), "SELECT value FROM cpu");
assert_eq!(got[1].to_string(), "SELECT val2 FROM cpu");
// Returns error for invalid statement
let got = parse_statements("BAD SQL").unwrap_err();
assert_eq!(got.to_string(), "invalid SQL statement at pos 0");
// Returns error for invalid statement after first
let got = parse_statements("SHOW MEASUREMENTS;BAD SQL").unwrap_err();
assert_eq!(got.to_string(), "invalid SQL statement at pos 18");
}
}
|
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2019 The developers of linux-epoll. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT.
use super::*;
include!("AnswerOutcome.rs");
include!("AuthorityResourceRecordVisitor.rs");
include!("CanonicalNameChain.rs");
include!("DiscardingResourceRecordVisitor.rs");
include!("NegativeCachingTimeToLiveInSeconds.rs");
include!("RequestQueryIdentification.rs");
include!("ResponseParser.rs");
include!("ResponseParsingState.rs");
include!("ResourceRecordVisitor.rs");
|
//! Global model reconstruction
use partial_ref::{partial, PartialRef};
use varisat_formula::Lit;
use varisat_internal_proof::ProofStep;
use crate::{
context::{parts::*, Context},
proof,
state::SatState,
};
/// Global model reconstruction
#[derive(Default)]
pub struct Model {
/// Assignment of the global model.
///
/// Whenever the solver state is SAT this must be up to date.
assignment: Vec<Option<bool>>,
}
impl Model {
/// Assignment of the global model.
///
/// Only valid if the solver state is SAT.
pub fn assignment(&self) -> &[Option<bool>] {
&self.assignment
}
/// Whether a given global literal is true in the model assignment.
///
/// Only valid if the solver state is SAT.
pub fn lit_is_true(&self, global_lit: Lit) -> bool {
self.assignment[global_lit.index()] == Some(global_lit.is_positive())
}
}
pub fn reconstruct_global_model<'a>(
mut ctx: partial!(
Context<'a>,
mut ModelP,
mut ProofP<'a>,
mut SolverStateP,
mut TmpDataP,
AssignmentP,
VariablesP
),
) {
let (variables, mut ctx) = ctx.split_part(VariablesP);
let (model, mut ctx) = ctx.split_part_mut(ModelP);
let (tmp, mut ctx) = ctx.split_part_mut(TmpDataP);
let models_in_proof = ctx.part(ProofP).models_in_proof();
tmp.lits.clear();
model.assignment.clear();
model.assignment.resize(variables.global_watermark(), None);
for global_var in variables.global_var_iter() {
let value = if let Some(solver_var) = variables.solver_from_global().get(global_var) {
ctx.part(AssignmentP).var_value(solver_var)
} else {
Some(variables.var_data_global(global_var).unit.unwrap_or(false))
};
model.assignment[global_var.index()] = value;
if models_in_proof {
if let Some(value) = value {
tmp.lits.push(global_var.lit(value))
}
}
}
if models_in_proof {
proof::add_step(
ctx.borrow(),
false,
&ProofStep::Model {
assignment: &tmp.lits,
},
);
}
ctx.part_mut(SolverStateP).sat_state = SatState::Sat;
}
|
///! This module contains the signatures of all NIFs in SSA IR
///!
///! The purpose of this is to centralize the registration of native functions that the
///! compiler is aware of and can reason about. If the code generator needs to implement
///! an op using a native function, it should be registered here with the appropriate type
///! signature.
use std::collections::BTreeMap;
use lazy_static::lazy_static;
use firefly_intern::{symbols, Symbol};
use crate::{CallConv, Signature, Visibility};
use crate::{FunctionType, PrimitiveType, TermType, Type};
lazy_static! {
static ref NIF_SIGNATURES: Vec<Signature> = {
vec![
// pub __firefly_make_tuple(isize) -> tuple
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifMakeTuple, FunctionType::new(vec![Type::Primitive(PrimitiveType::Isize)], vec![Type::Term(TermType::Tuple(None))])),
// pub __firefly_tuple_size(term) -> i1, u32
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifTupleSize, FunctionType::new(vec![Type::Term(TermType::Any)], vec![Type::Primitive(PrimitiveType::I1), Type::Primitive(PrimitiveType::I32)])),
// pub __firefly_map_empty() -> map
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifMapEmpty, FunctionType::new(vec![], vec![Type::Term(TermType::Map)])),
// pub __firefly_map_put(map, term, term) -> map
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifMapPut, FunctionType::new(vec![Type::Term(TermType::Map), Type::Term(TermType::Any), Type::Term(TermType::Any)], vec![Type::Term(TermType::Map)])),
// pub __firefly_map_put_mut(map, term, term) -> map
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifMapPutMut, FunctionType::new(vec![Type::Term(TermType::Map), Type::Term(TermType::Any), Type::Term(TermType::Any)], vec![Type::Term(TermType::Map)])),
// pub __firefly_map_update(map, term, term) -> i1, map
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::Erlang, symbols::Empty, symbols::NifMapUpdate, FunctionType::new(vec![Type::Term(TermType::Map), Type::Term(TermType::Any), Type::Term(TermType::Any)], vec![Type::Primitive(PrimitiveType::I1), Type::Term(TermType::Map)])),
// pub __firefly_map_update_mut(map, term, term) -> i1, map
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::Erlang, symbols::Empty, symbols::NifMapUpdateMut, FunctionType::new(vec![Type::Term(TermType::Map), Type::Term(TermType::Any), Type::Term(TermType::Any)], vec![Type::Primitive(PrimitiveType::I1), Type::Term(TermType::Map)])),
// pub __firefly_map_fetch(map, term) -> i1, term
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::Erlang, symbols::Empty, symbols::NifMapFetch, FunctionType::new(vec![Type::Term(TermType::Map), Type::Term(TermType::Any)], vec![Type::Term(TermType::Any)])),
// pub __firefly_build_stacktrace(exception_trace) -> term
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::C, symbols::Empty, symbols::NifBuildStacktrace, FunctionType::new(vec![Type::ExceptionTrace], vec![Type::Term(TermType::Any)])),
// pub __firefly_bs_init() -> i1, term
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::Erlang, symbols::Empty, symbols::NifBsInit, FunctionType::new(vec![], vec![Type::Primitive(PrimitiveType::I1), Type::Term(TermType::Any)])),
// pub __firefly_bs_finish(binary_builder) -> i1, term
Signature::new(Visibility::PUBLIC | Visibility::EXTERNAL, CallConv::Erlang, symbols::Empty, symbols::NifBsFinish, FunctionType::new(vec![Type::BinaryBuilder], vec![Type::Primitive(PrimitiveType::I1), Type::Term(TermType::Any)])),
]
};
}
lazy_static! {
static ref NIF_MAP: BTreeMap<Symbol, &'static Signature> = {
let mut nifs = BTreeMap::new();
for sig in NIF_SIGNATURES.iter() {
let op = sig.name;
nifs.insert(op, sig);
}
nifs
};
}
/// Get the Signature matching the provided name
pub fn get(op: &Symbol) -> Option<&'static Signature> {
NIF_MAP.get(op).copied()
}
/// Get the Signature matching the provided name, or panic if unregistered
pub fn fetch(op: &Symbol) -> &'static Signature {
match NIF_MAP.get(op).copied() {
Some(sig) => sig,
None => panic!("unregistered nif {}", op),
}
}
/// Get a slice containing the Signature of all built-in functions
pub fn all() -> &'static [Signature] {
NIF_SIGNATURES.as_slice()
}
|
use super::{
FracAdd, FracAddOp, FracDiv, FracDivOp, FracMul, FracMulOp, FracSub, FracSubOp, Fraction,
Irreducible, UFraction,
};
use crate::common::*;
// positive fraction type
pub struct PFrac<Frac>(PhantomData<Frac>)
where
Frac: UFraction;
impl<Frac> Fraction for PFrac<Frac>
where
Frac: UFraction,
{
fn new() -> Self {
PFrac(PhantomData)
}
}
// negative fraction type
pub struct NFrac<Frac>(PhantomData<Frac>)
where
Frac: UFraction;
impl<Frac> Fraction for NFrac<Frac>
where
Frac: UFraction,
{
fn new() -> Self {
NFrac(PhantomData)
}
}
// non-zero marker
impl<Frac> NonZero for PFrac<Frac> where Frac: UFraction + NonZero {}
impl<Frac> NonZero for NFrac<Frac> where Frac: UFraction + NonZero {}
// irreducible marker
impl<F> Irreducible for PFrac<F> where F: UFraction + Irreducible {}
impl<F> Irreducible for NFrac<F> where F: UFraction + Irreducible {}
// negation
impl<Frac> Neg for PFrac<Frac>
where
Frac: UFraction,
{
type Output = NFrac<Frac>;
fn neg(self) -> Self::Output {
Self::Output::new()
}
}
impl<Frac> Neg for NFrac<Frac>
where
Frac: UFraction,
{
type Output = PFrac<Frac>;
fn neg(self) -> Self::Output {
Self::Output::new()
}
}
// sum of singed fractions
impl<F, Rhs> Add<Rhs> for PFrac<F>
where
(): FracAdd<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracAddOp<Self, Rhs>;
fn add(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
impl<F, Rhs> Add<Rhs> for NFrac<F>
where
(): FracAdd<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracAddOp<Self, Rhs>;
fn add(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
// subtraction of signed fractions
impl<F, Rhs> Sub<Rhs> for PFrac<F>
where
(): FracSub<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracSubOp<Self, Rhs>;
fn sub(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
impl<F, Rhs> Sub<Rhs> for NFrac<F>
where
(): FracSub<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracSubOp<Self, Rhs>;
fn sub(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
// product
impl<F, Rhs> Mul<Rhs> for PFrac<F>
where
(): FracMul<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracMulOp<Self, Rhs>;
fn mul(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
impl<F, Rhs> Mul<Rhs> for NFrac<F>
where
(): FracMul<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracMulOp<Self, Rhs>;
fn mul(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
// division
impl<F, Rhs> Div<Rhs> for PFrac<F>
where
(): FracDiv<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracDivOp<Self, Rhs>;
fn div(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
impl<F, Rhs> Div<Rhs> for NFrac<F>
where
(): FracDiv<Self, Rhs>,
F: UFraction,
Rhs: Fraction,
{
type Output = FracDivOp<Self, Rhs>;
fn div(self, _rhs: Rhs) -> Self::Output {
Self::Output::new()
}
}
|
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HelloEntity {
#[prost(string, tag = "1")]
pub entity_message: std::string::String,
#[prost(double, tag = "2")]
pub entity_double: f64,
#[prost(int32, tag = "3")]
pub entity_int32: i32,
#[prost(int64, tag = "4")]
pub entity_int64: i64,
#[prost(uint32, tag = "5")]
pub entity_uint32: u32,
#[prost(uint64, tag = "6")]
pub entity_uint64: u64,
#[prost(sint32, tag = "7")]
pub entity_sint32: i32,
#[prost(sint64, tag = "8")]
pub entity_sint64: i64,
#[prost(fixed32, tag = "9")]
pub entity_fixed32: u32,
#[prost(fixed64, tag = "10")]
pub entity_fixed64: u64,
#[prost(sfixed32, tag = "11")]
pub entity_sfixed32: i32,
#[prost(sfixed64, tag = "12")]
pub entity_sfixed64: i64,
#[prost(bool, tag = "13")]
pub entity_bool: bool,
#[prost(bytes, tag = "14")]
pub entity_bytes: std::vec::Vec<u8>,
}
|
use rune::termcolor::{ColorChoice, StandardStream};
use rune::{Diagnostics, EmitDiagnostics as _, Options, Sources};
use runestick::{FromValue as _, Source, Vm};
use std::error::Error;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let context = rune_modules::default_context()?;
let options = Options::default();
let mut sources = Sources::new();
sources.insert(Source::new(
"script",
r#"
pub fn calculate(a, b) {
println("Hello World");
a + b
}
"#,
));
let mut diagnostics = Diagnostics::new();
let result = rune::load_sources(&context, &options, &mut sources, &mut diagnostics);
if !diagnostics.is_empty() {
let mut writer = StandardStream::stderr(ColorChoice::Always);
diagnostics.emit_diagnostics(&mut writer, &sources)?;
}
let unit = result?;
let vm = Vm::new(Arc::new(context.runtime()), Arc::new(unit));
let mut execution = vm.execute(&["calculate"], (10i64, 20i64))?;
let value = execution.async_complete().await?;
let value = i64::from_value(value)?;
println!("{}", value);
Ok(())
}
|
#![allow(dead_code, unused)]
use clap::clap_app;
use log::{error, warn};
use once_cell::sync::Lazy;
use regex::Regex;
use serde_json::Value;
use std::{collections::HashMap, sync::Arc};
use tokio::{
io::{AsyncRead, AsyncWrite},
sync::RwLock,
};
use tower_lsp::{
jsonrpc::Result as TResult, lsp_types::*, Client, LanguageServer, LspService, Server,
};
use tree_sitter::InputEdit;
mod typing;
fn get_parser() -> tree_sitter::Parser {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(tree_sitter_teal::language())
.expect("Failed to load Teal language");
parser
}
struct Document {
url: Url,
tree: tree_sitter::Tree,
source: String,
}
struct Backend {
_client: Client,
documents: Arc<RwLock<HashMap<Url, Document>>>,
}
fn _pretty_print(source: &str, node: tree_sitter::Node, indent: usize) -> String {
static PRINT_KINDS: Lazy<[u16; 2]> = Lazy::new(|| {
let language = tree_sitter_teal::language();
[
language.id_for_node_kind("identifier", true),
language.id_for_node_kind("simple_type", true),
]
});
let mut ret = String::new();
if node.is_error() {
ret.push_str("ERROR: ");
} else if node.is_missing() {
ret.push_str("MISSING: ");
}
ret.push_str(&"\t".repeat(indent));
if PRINT_KINDS.contains(&node.kind_id()) {
ret.push_str("\"");
ret.push_str(node.utf8_text(source.as_bytes()).unwrap());
ret.push_str("\"");
} else {
ret.push_str(node.kind());
}
ret.push_str("\n");
let mut cursor = node.walk();
for child in node.named_children(&mut cursor) {
ret.push_str(&_pretty_print(source, child, indent + 1));
}
ret
}
impl Backend {
fn collect_syntax_errors(&self, node: tree_sitter::Node, diagnostics: &mut Vec<Diagnostic>) {
println!("Syntax check: {:?} ({})", node, node.has_error());
let mut cursor = node.walk();
let has_children = cursor.goto_first_child();
let mut last_error = true;
if has_children {
loop {
if cursor.node().has_error() {
last_error = false;
self.collect_syntax_errors(cursor.node(), diagnostics);
}
if !cursor.goto_next_sibling() {
break;
}
}
}
if node.is_error() || last_error {
diagnostics.push(Diagnostic {
range: Range {
start: Position {
line: node.range().start_point.row as u32,
character: node.range().start_point.column as u32,
},
end: Position {
line: node.range().end_point.row as u32,
character: node.range().end_point.column as u32,
},
},
severity: Some(DiagnosticSeverity::Error),
code: None,
code_description: None,
source: None,
message: "Syntax error".to_string(),
related_information: None,
tags: None,
data: None,
});
}
}
async fn report_errors(&self) {
let documents = self.documents.read().await;
for (url, document) in documents.iter() {
let mut diagnostics = Vec::new();
{
let node = document.tree.root_node();
if node.has_error() {
self.collect_syntax_errors(document.tree.root_node(), &mut diagnostics);
}
}
document.check_types(&mut diagnostics);
self._client
.publish_diagnostics(url.clone(), diagnostics, None)
.await;
}
}
}
#[tower_lsp::async_trait]
impl LanguageServer for Backend {
async fn initialize(&self, _params: InitializeParams) -> TResult<InitializeResult> {
let mut result = InitializeResult::default();
// let workspace_server_capabilities = WorkspaceServerCapabilities {
// workspace_folders: Some(WorkspaceFoldersServerCapabilities {
// supported: Some(true),
// change_notifications: Some(OneOf::Left(false)),
// }),
// file_operations: WorkspaceFileOperationsServerCapabilities {
// did_create: (),
// will_create: (),
// did_rename: (),
// will_rename: (),
// did_delete: (),
// will_delete: (),
// }
// };
result.capabilities.hover_provider = Some(HoverProviderCapability::Simple(true));
result.capabilities.text_document_sync =
Some(TextDocumentSyncCapability::Kind(TextDocumentSyncKind::Full));
result.server_info = Some(ServerInfo {
name: "teal-lsp".to_string(),
version: Some(env!("CARGO_PKG_VERSION").to_string()),
});
Ok(result)
}
async fn initialized(&self, _params: InitializedParams) {}
async fn shutdown(&self) -> TResult<()> {
Ok(())
}
async fn did_change_workspace_folders(&self, params: DidChangeWorkspaceFoldersParams) {
let _ = params;
warn!("Got a workspace/didChangeWorkspaceFolders notification, but it is not implemented");
}
async fn did_change_configuration(&self, params: DidChangeConfigurationParams) {
let _ = params;
warn!("Got a workspace/didChangeConfiguration notification, but it is not implemented");
}
async fn did_change_watched_files(&self, params: DidChangeWatchedFilesParams) {
let _ = params;
warn!("Got a workspace/didChangeWatchedFiles notification, but it is not implemented");
}
async fn symbol(
&self,
params: WorkspaceSymbolParams,
) -> TResult<Option<Vec<SymbolInformation>>> {
let _ = params;
error!("Got a workspace/symbol request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn execute_command(&self, params: ExecuteCommandParams) -> TResult<Option<Value>> {
let _ = params;
error!("Got a workspace/executeCommand request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn will_create_files(&self, params: CreateFilesParams) -> TResult<Option<WorkspaceEdit>> {
let _ = params;
error!("Got a workspace/willCreateFiles request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn did_create_files(&self, params: CreateFilesParams) {
let _ = params;
warn!("Got a workspace/didCreateFiles notification, but it is not implemented");
}
async fn will_rename_files(&self, params: RenameFilesParams) -> TResult<Option<WorkspaceEdit>> {
let _ = params;
error!("Got a workspace/willRenameFiles request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn did_rename_files(&self, params: RenameFilesParams) {
let _ = params;
warn!("Got a workspace/didRenameFiles notification, but it is not implemented");
}
async fn will_delete_files(&self, params: DeleteFilesParams) -> TResult<Option<WorkspaceEdit>> {
let _ = params;
error!("Got a workspace/willDeleteFiles request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn did_delete_files(&self, params: DeleteFilesParams) {
let _ = params;
warn!("Got a workspace/didDeleteFiles notification, but it is not implemented");
}
async fn did_open(&self, params: DidOpenTextDocumentParams) {
let url = params.text_document.uri;
let mut parser = get_parser();
if let Some(tree) = parser.parse(params.text_document.text.clone(), None) {
let document = Document {
url: url.clone(),
tree,
source: params.text_document.text,
};
let mut documents = self.documents.write().await;
documents.insert(url, document);
}
self.report_errors().await;
}
async fn did_change(&self, params: DidChangeTextDocumentParams) {
fn get_last_line_col(s: &str) -> tree_sitter::Point {
let (count, last): (usize, _) = {
let it = s.lines();
let mut last = "";
let mut count = 0;
for line in it {
count += 1;
last = line;
}
(count, last)
};
tree_sitter::Point {
column: last.chars().count().saturating_sub(1),
row: count.saturating_sub(1),
}
}
let url = params.text_document.uri;
{
let mut documents = self.documents.write().await;
let document = if let Some(document) = documents.get_mut(&url) {
document
} else {
println!("Got change for document we are not tracking...");
return;
};
let mut source = document.source.clone();
for change in params.content_changes {
let edit = if let Some(range) = change.range {
// InputEdit {
// start_byte: todo!(),
// old_end_byte: todo!(),
// new_end_byte: todo!(),
// start_position: tree_sitter::Point {
// row: range.start.line as usize,
// column: range.start.character as usize,
// },
// old_end_position: tree_sitter::Point {
// row: range.end.line as usize,
// column: range.end.character as usize,
// },
// new_end_position: todo!(),
// };
println!("Edit range not None");
InputEdit {
start_byte: 0,
old_end_byte: 0,
new_end_byte: 0,
start_position: tree_sitter::Point { row: 0, column: 0 },
old_end_position: tree_sitter::Point { row: 0, column: 0 },
new_end_position: tree_sitter::Point { row: 0, column: 0 },
}
} else {
let edit = InputEdit {
start_byte: 0,
old_end_byte: source.len(),
new_end_byte: change.text.len(),
start_position: tree_sitter::Point { row: 0, column: 0 },
old_end_position: get_last_line_col(&source),
new_end_position: get_last_line_col(&change.text),
};
source = change.text.clone();
document.source = change.text;
edit
};
document.tree.edit(&edit);
}
let mut parser = get_parser();
if let Some(tree) = parser.parse(source, Some(&document.tree)) {
document.tree = tree;
}
}
self.report_errors().await;
}
async fn will_save(&self, params: WillSaveTextDocumentParams) {
let _ = params;
warn!("Got a textDocument/willSave notification, but it is not implemented");
}
async fn will_save_wait_until(
&self,
params: WillSaveTextDocumentParams,
) -> TResult<Option<Vec<TextEdit>>> {
let _ = params;
error!("Got a textDocument/willSaveWaitUntil request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn did_save(&self, params: DidSaveTextDocumentParams) {
let _ = params;
warn!("Got a textDocument/didSave notification, but it is not implemented");
}
async fn did_close(&self, params: DidCloseTextDocumentParams) {
let _ = params;
warn!("Got a textDocument/didClose notification, but it is not implemented");
}
async fn completion(&self, params: CompletionParams) -> TResult<Option<CompletionResponse>> {
let _ = params;
error!("Got a textDocument/completion request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn completion_resolve(&self, params: CompletionItem) -> TResult<CompletionItem> {
let _ = params;
error!("Got a completionItem/resolve request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn hover(&self, _params: HoverParams) -> TResult<Option<Hover>> {
println!("Hover");
Ok(Some(Hover {
contents: HoverContents::Scalar(MarkedString::String("Hover".to_string())),
range: None,
}))
}
async fn signature_help(&self, params: SignatureHelpParams) -> TResult<Option<SignatureHelp>> {
let _ = params;
error!("Got a textDocument/signatureHelp request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn goto_declaration(
&self,
params: request::GotoDeclarationParams,
) -> TResult<Option<request::GotoDeclarationResponse>> {
let _ = params;
error!("Got a textDocument/declaration request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn goto_definition(
&self,
params: GotoDefinitionParams,
) -> TResult<Option<GotoDefinitionResponse>> {
let _ = params;
error!("Got a textDocument/definition request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn goto_type_definition(
&self,
params: request::GotoTypeDefinitionParams,
) -> TResult<Option<request::GotoTypeDefinitionResponse>> {
let _ = params;
error!("Got a textDocument/typeDefinition request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn goto_implementation(
&self,
params: request::GotoImplementationParams,
) -> TResult<Option<request::GotoImplementationResponse>> {
let _ = params;
error!("Got a textDocument/implementation request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn references(&self, params: ReferenceParams) -> TResult<Option<Vec<Location>>> {
let _ = params;
error!("Got a textDocument/references request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn document_highlight(
&self,
params: DocumentHighlightParams,
) -> TResult<Option<Vec<DocumentHighlight>>> {
let _ = params;
error!("Got a textDocument/documentHighlight request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn document_symbol(
&self,
params: DocumentSymbolParams,
) -> TResult<Option<DocumentSymbolResponse>> {
let _ = params;
error!("Got a textDocument/documentSymbol request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn code_action(&self, params: CodeActionParams) -> TResult<Option<CodeActionResponse>> {
let _ = params;
error!("Got a textDocument/codeAction request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn code_action_resolve(&self, params: CodeAction) -> TResult<CodeAction> {
let _ = params;
error!("Got a codeAction/resolve request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn code_lens(&self, params: CodeLensParams) -> TResult<Option<Vec<CodeLens>>> {
let _ = params;
error!("Got a textDocument/codeLens request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn code_lens_resolve(&self, params: CodeLens) -> TResult<CodeLens> {
let _ = params;
error!("Got a codeLens/resolve request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn document_link(
&self,
params: DocumentLinkParams,
) -> TResult<Option<Vec<DocumentLink>>> {
let _ = params;
error!("Got a textDocument/documentLink request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn document_link_resolve(&self, params: DocumentLink) -> TResult<DocumentLink> {
let _ = params;
error!("Got a documentLink/resolve request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn document_color(&self, params: DocumentColorParams) -> TResult<Vec<ColorInformation>> {
let _ = params;
error!("Got a textDocument/documentColor request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn color_presentation(
&self,
params: ColorPresentationParams,
) -> TResult<Vec<ColorPresentation>> {
let _ = params;
error!("Got a textDocument/colorPresentation request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn formatting(&self, params: DocumentFormattingParams) -> TResult<Option<Vec<TextEdit>>> {
let _ = params;
error!("Got a textDocument/formatting request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn range_formatting(
&self,
params: DocumentRangeFormattingParams,
) -> TResult<Option<Vec<TextEdit>>> {
let _ = params;
error!("Got a textDocument/rangeFormatting request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn on_type_formatting(
&self,
params: DocumentOnTypeFormattingParams,
) -> TResult<Option<Vec<TextEdit>>> {
let _ = params;
error!("Got a textDocument/onTypeFormatting request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn rename(&self, params: RenameParams) -> TResult<Option<WorkspaceEdit>> {
let _ = params;
error!("Got a textDocument/rename request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn prepare_rename(
&self,
params: TextDocumentPositionParams,
) -> TResult<Option<PrepareRenameResponse>> {
let _ = params;
error!("Got a textDocument/prepareRename request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn folding_range(
&self,
params: FoldingRangeParams,
) -> TResult<Option<Vec<FoldingRange>>> {
let _ = params;
error!("Got a textDocument/foldingRange request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn selection_range(
&self,
params: SelectionRangeParams,
) -> TResult<Option<Vec<SelectionRange>>> {
let _ = params;
error!("Got a textDocument/selectionRange request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn prepare_call_hierarchy(
&self,
params: CallHierarchyPrepareParams,
) -> TResult<Option<Vec<CallHierarchyItem>>> {
let _ = params;
error!("Got a textDocument/prepareCallHierarchy request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn incoming_calls(
&self,
params: CallHierarchyIncomingCallsParams,
) -> TResult<Option<Vec<CallHierarchyIncomingCall>>> {
let _ = params;
error!("Got a callHierarchy/incomingCalls request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn outgoing_calls(
&self,
params: CallHierarchyOutgoingCallsParams,
) -> TResult<Option<Vec<CallHierarchyOutgoingCall>>> {
let _ = params;
error!("Got a callHierarchy/outgoingCalls request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn semantic_tokens_full(
&self,
params: SemanticTokensParams,
) -> TResult<Option<SemanticTokensResult>> {
let _ = params;
error!("Got a textDocument/semanticTokens/full request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn semantic_tokens_full_delta(
&self,
params: SemanticTokensDeltaParams,
) -> TResult<Option<SemanticTokensFullDeltaResult>> {
let _ = params;
error!("Got a textDocument/semanticTokens/full/delta request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn semantic_tokens_range(
&self,
params: SemanticTokensRangeParams,
) -> TResult<Option<SemanticTokensRangeResult>> {
let _ = params;
error!("Got a textDocument/semanticTokens/range request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn linked_editing_range(
&self,
params: LinkedEditingRangeParams,
) -> TResult<Option<LinkedEditingRanges>> {
let _ = params;
error!("Got a textDocument/linkedEditingRange request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
async fn moniker(&self, params: MonikerParams) -> TResult<Option<Vec<Moniker>>> {
let _ = params;
error!("Got a textDocument/moniker request, but it is not implemented");
Err(tower_lsp::jsonrpc::Error::method_not_found())
}
}
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
let clapapp = clap_app!(app =>
(version: "0.1")
(author: "Martin Zeller")
(@arg listen: -l --listen +takes_value "Listen on TCP port instead of using stdin/stdout")
);
let matches = clapapp.get_matches();
// let stdin = tokio::io::stdin();
// let stdout = tokio::io::stdout();
loop {
let (service, messages) = LspService::new(|client| Backend {
_client: client,
documents: Arc::new(RwLock::new(HashMap::new())),
});
if let Some(listen) = matches.value_of("listen") {
let listener = tokio::net::TcpListener::bind(listen).await?;
let (stream, _) = listener.accept().await?;
let (read, write) = tokio::io::split(stream);
Server::new(read, write)
.interleave(messages)
.serve(service)
.await;
} else {
Server::new(tokio::io::stdin(), tokio::io::stdout())
.interleave(messages)
.serve(service)
.await;
};
}
}
|
use local::api::stream_server;
use local::iota_channels_lite::channel_author::Channel;
use local::security::keystore::KeyManager;
use local::types::config::Config;
use std::fs::File;
use std::sync::{Arc, Mutex};
use iota_streams::app::transport::tangle::client::SendTrytesOptions;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//read configuration file
let config: Config = serde_json::from_reader(File::open("config.json").unwrap()).unwrap();
let device_name = config.device_name;
let port = config.port;
let node = config.node;
let mwm = config.mwm;
let local_pow = config.local_pow;
let store = KeyManager::new(device_name.to_string());
println!("Starting....");
let mut send_opt = SendTrytesOptions::default();
send_opt.min_weight_magnitude = mwm;
send_opt.local_pow = local_pow;
let channel = Arc::new(Mutex::new(Channel::new(node, send_opt, None)));
let (addr, _) = channel.lock().expect("").open().unwrap();
println!("Channel root: {:?}", addr);
println!(
"To Start the Subscriber run: \n
cargo run --release --example subscriber {:?} \n",
addr
);
let store = Arc::new(Mutex::new(store));
stream_server::start(port, channel, store).await
}
|
use crate::utils::*;
pub(crate) const NAME: &[&str] = &["fmt::Write"];
pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> {
derive_trait!(
data,
parse_quote!(::core::fmt::Write)?,
parse_quote! {
trait Write {
#[inline]
fn write_str(&mut self, s: &str) -> ::core::fmt::Result;
#[inline]
fn write_char(&mut self, c: char) -> ::core::fmt::Result;
#[inline]
fn write_fmt(&mut self, args: ::core::fmt::Arguments<'_>) -> ::core::fmt::Result;
}
}?,
)
.map(|item| items.push(item))
}
|
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{format_err, Error},
fuchsia_async as fasync,
futures::{channel::mpsc, prelude::*},
std::collections::HashSet,
std::fmt,
std::io::Write,
test_executor::TestEvent,
};
#[derive(PartialEq, Debug)]
pub enum TestOutcome {
Passed,
Failed,
Inconclusive,
Error,
}
impl fmt::Display for TestOutcome {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
TestOutcome::Passed => write!(f, "PASSED"),
TestOutcome::Failed => write!(f, "FAILED"),
TestOutcome::Inconclusive => write!(f, "INCONCLUSIVE"),
TestOutcome::Error => write!(f, "ERROR"),
}
}
}
// Runs test defined by |url|, and writes logs to writer.
// Returns (Outcome, Names of tests executed, Names of tests passed)
pub async fn run_test<W: Write>(
url: String,
writer: &mut W,
) -> Result<(TestOutcome, Vec<String>, Vec<String>), Error> {
let launcher =
match fuchsia_component::client::connect_to_service::<fidl_fuchsia_sys::LauncherMarker>() {
Ok(l) => l,
Err(e) => return Err(e),
};
let (sender, mut recv) = mpsc::channel(1);
let (remote, test_fut) =
test_executor::run_test_component(launcher, url, sender).remote_handle();
fasync::spawn(remote);
let mut test_outcome = TestOutcome::Passed;
let mut test_cases_in_progress = HashSet::new();
let mut test_cases_executed = HashSet::new();
let mut test_cases_passed = HashSet::new();
while let Some(test_event) = recv.next().await {
match test_event {
TestEvent::TestCaseStarted { test_case_name } => {
if test_cases_executed.contains(&test_case_name) {
return Err(format_err!("test case: '{}' started twice", test_case_name));
}
writeln!(writer, "[RUNNING]\t{}", test_case_name).expect("Cannot write logs");
test_cases_in_progress.insert(test_case_name.clone());
test_cases_executed.insert(test_case_name);
}
TestEvent::TestCaseFinished { test_case_name, outcome } => {
if !test_cases_in_progress.contains(&test_case_name) {
return Err(format_err!(
"test case: '{}' was never started, still got a finish event",
test_case_name
));
}
test_cases_in_progress.remove(&test_case_name);
let outcome_str = match outcome {
test_executor::Outcome::Passed => {
test_cases_passed.insert(test_case_name.clone());
"PASSED".to_string()
}
test_executor::Outcome::Failed => {
if test_outcome == TestOutcome::Passed {
test_outcome = TestOutcome::Failed;
}
"FAILED".to_string()
}
test_executor::Outcome::Error => {
test_outcome = TestOutcome::Error;
"ERROR".to_string()
}
};
writeln!(writer, "[{}]\t{}", outcome_str, test_case_name)
.expect("Cannot write logs");
}
TestEvent::LogMessage { test_case_name, msg } => {
if !test_cases_executed.contains(&test_case_name) {
return Err(format_err!(
"test case: '{}' was never started, still got a log",
test_case_name
));
}
let msgs = msg.trim().split("\n");
for msg in msgs {
writeln!(writer, "[{}]\t{}", test_case_name, msg).expect("Cannot write logs");
}
}
}
}
test_fut.await.map_err(|e| format_err!("Error running test: {}", e))?;
let mut test_cases_in_progress: Vec<String> = test_cases_in_progress.into_iter().collect();
test_cases_in_progress.sort();
if test_cases_in_progress.len() != 0 {
match test_outcome {
TestOutcome::Passed | TestOutcome::Failed => {
test_outcome = TestOutcome::Inconclusive;
}
_ => {}
}
writeln!(writer, "\nThe following test(s) never completed:").expect("Cannot write logs");
for t in test_cases_in_progress {
writeln!(writer, "{}", t).expect("Cannot write logs");
}
}
let mut test_cases_executed: Vec<String> = test_cases_executed.into_iter().collect();
let mut test_cases_passed: Vec<String> = test_cases_passed.into_iter().collect();
test_cases_executed.sort();
test_cases_passed.sort();
Ok((test_outcome, test_cases_executed, test_cases_passed))
}
|
use mod_int::ModInt998244353;
use proconio::input;
macro_rules! add {
($a: expr, $b: expr) => {
$a = ($a + $b) % 998244353;
};
}
fn main() {
input! {
n: usize,
a: usize,
b: usize,
p: usize,
q: usize,
};
let mut dp_p = vec![vec![0; (p + 1) * (n + 1) + 1]; n + 1];
let mut dp_q = vec![vec![0; (q + 1) * (n + 1) + 1]; n + 1];
dp_p[0][0] = 1;
dp_q[0][0] = 1;
for j in 1..=p {
dp_p[1][j] = 1;
}
for j in 1..=q {
dp_q[1][j] = 1;
}
for i in 1..n {
for j in 1..=(p + 1) * (n + 1) {
for d in 1..=p {
if j + d <= (p + 1) * (n + 1) {
add!(dp_p[i + 1][j + d], dp_p[i][j]);
}
}
}
}
for i in 1..n {
for j in 1..=(q + 1) * (n + 1) {
for d in 1..=q {
if j + d <= (q + 1) * (n + 1) {
add!(dp_q[i + 1][j + d], dp_q[i][j]);
}
}
}
}
type Mint = ModInt998244353;
let mut ans = Mint::new(0);
for x in 1..=(n - a) {
let mut s = 0;
for j in 0..(n - a) {
add!(s, dp_p[x - 1][j]);
}
let mut t = 0;
for j in (n - a)..=(p * x) {
add!(t, dp_p[x][j]);
}
let mut u = 0;
for j in 0..(n - b) {
add!(u, dp_q[x - 1][j]);
}
let pp = Mint::from(s) / Mint::from(p).pow((x - 1) as u32);
let qq = Mint::from(t) / Mint::from(p).pow(x as u32);
let rr = Mint::from(u) / Mint::from(q).pow((x - 1) as u32);
ans += (qq - (Mint::new(1) - pp)) * rr;
}
println!("{}", ans.val());
}
|
pub mod primal;
pub mod dual;
pub mod incidence; |
// Valid Anagram
// https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3636/
pub struct Solution;
use std::collections::HashMap;
impl Solution {
pub fn is_anagram(s: String, t: String) -> bool {
if s.len() != t.len() {
return false;
}
let mut by_char: HashMap<char, usize> = HashMap::new();
for char in s.chars() {
*by_char.entry(char).or_default() += 1;
}
for char in t.chars() {
let entry = by_char.entry(char).or_default();
if *entry == 0 {
return false;
} else {
*entry -= 1;
}
}
true
}
}
#[cfg(disable)]
impl Solution {
pub fn is_anagram(s: String, t: String) -> bool {
if s.len() != t.len() {
return false;
}
let mut sv = s.chars().collect::<Vec<_>>();
let mut tv = t.chars().collect::<Vec<_>>();
sv.sort_unstable();
tv.sort_unstable();
sv == tv
}
}
#[cfg(test)]
mod tests {
use super::*;
fn check(s: &str, t: &str, res: bool) {
assert_eq!(
Solution::is_anagram(String::from(s), String::from(t)),
res
);
}
#[test]
fn example1() {
check("anagram", "nagaram", true);
}
#[test]
fn example2() {
check("rat", "car", false);
}
}
|
use crate::util::id::PatternID;
/// The kind of match semantics to use for a DFA.
///
/// The default match kind is `LeftmostFirst`.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum MatchKind {
/// Report all possible matches.
All,
/// Report only the leftmost matches. When multiple leftmost matches exist,
/// report the match corresponding to the part of the regex that appears
/// first in the syntax.
LeftmostFirst,
/// Hints that destructuring should not be exhaustive.
///
/// This enum may grow additional variants, so this makes sure clients
/// don't count on exhaustive matching. (Otherwise, adding a new variant
/// could break existing code.)
#[doc(hidden)]
__Nonexhaustive,
// There is prior art in RE2 that shows that we should be able to add
// LeftmostLongest too. The tricky part of it is supporting ungreedy
// repetitions. Instead of treating all NFA states as having equivalent
// priority (as in 'All') or treating all NFA states as having distinct
// priority based on order (as in 'LeftmostFirst'), we instead group NFA
// states into sets, and treat members of each set as having equivalent
// priority, but having greater priority than all following members
// of different sets.
//
// However, it's not clear whether it's really worth adding this. After
// all, leftmost-longest can be emulated when using literals by using
// leftmost-first and sorting the literals by length in descending order.
// However, this won't work for arbitrary regexes. e.g., `\w|\w\w` will
// always match `a` in `ab` when using leftmost-first, but leftmost-longest
// would match `ab`.
}
impl MatchKind {
#[cfg(feature = "alloc")]
pub(crate) fn continue_past_first_match(&self) -> bool {
*self == MatchKind::All
}
}
impl Default for MatchKind {
fn default() -> MatchKind {
MatchKind::LeftmostFirst
}
}
/// A representation of a match reported by a regex engine.
///
/// A match records the start and end offsets of the match in the haystack.
///
/// Every match guarantees that `start <= end`.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct Match {
/// The start offset of the match, inclusive.
start: usize,
/// The end offset of the match, exclusive.
end: usize,
}
impl Match {
/// Create a new match from a byte offset span.
///
/// # Panics
///
/// This panics if `end < start`.
#[inline]
pub fn new(start: usize, end: usize) -> Match {
assert!(start <= end);
Match { start, end }
}
/// The starting position of the match.
#[inline]
pub fn start(&self) -> usize {
self.start
}
/// The ending position of the match.
#[inline]
pub fn end(&self) -> usize {
self.end
}
/// Returns the match location as a range.
#[inline]
pub fn range(&self) -> core::ops::Range<usize> {
self.start..self.end
}
/// Returns true if and only if this match is empty. That is, when
/// `start() == end()`.
///
/// An empty match can only be returned when the empty string was among
/// the patterns used to build the Aho-Corasick automaton.
#[inline]
pub fn is_empty(&self) -> bool {
self.start == self.end
}
}
/// A representation of a match reported by a DFA.
///
/// This is called a "half" match because it only includes the end location
/// (or start location for a reverse match) of a match. This corresponds to the
/// information that a single DFA scan can report. Getting the other half of
/// the match requires a second scan with a reversed DFA.
///
/// A half match also includes the pattern that matched. The pattern is
/// identified by an ID, which corresponds to its position (starting from `0`)
/// relative to other patterns used to construct the corresponding DFA. If only
/// a single pattern is provided to the DFA, then all matches are guaranteed to
/// have a pattern ID of `0`.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct HalfMatch {
/// The pattern ID.
pub(crate) pattern: PatternID,
/// The offset of the match.
///
/// For forward searches, the offset is exclusive. For reverse searches,
/// the offset is inclusive.
pub(crate) offset: usize,
}
impl HalfMatch {
/// Create a new half match from a pattern ID and a byte offset.
#[inline]
pub fn new(pattern: PatternID, offset: usize) -> HalfMatch {
HalfMatch { pattern, offset }
}
/// Create a new half match from a pattern ID and a byte offset.
///
/// This is like [`HalfMatch::new`], but accepts a `usize` instead of a
/// [`PatternID`]. This panics if the given `usize` is not representable
/// as a `PatternID`.
#[inline]
pub fn must(pattern: usize, offset: usize) -> HalfMatch {
HalfMatch::new(PatternID::new(pattern).unwrap(), offset)
}
/// Returns the ID of the pattern that matched.
///
/// The ID of a pattern is derived from the position in which it was
/// originally inserted into the corresponding DFA. The first pattern has
/// identifier `0`, and each subsequent pattern is `1`, `2` and so on.
#[inline]
pub fn pattern(&self) -> PatternID {
self.pattern
}
/// The position of the match.
///
/// If this match was produced by a forward search, then the offset is
/// exclusive. If this match was produced by a reverse search, then the
/// offset is inclusive.
#[inline]
pub fn offset(&self) -> usize {
self.offset
}
}
/// A representation of a multi match reported by a regex engine.
///
/// A multi match has two essential pieces of information: the identifier of
/// the pattern that matched, along with the start and end offsets of the match
/// in the haystack.
///
/// The pattern is identified by an ID, which corresponds to its position
/// (starting from `0`) relative to other patterns used to construct the
/// corresponding regex engine. If only a single pattern is provided, then all
/// multi matches are guaranteed to have a pattern ID of `0`.
///
/// Every multi match guarantees that `start <= end`.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct MultiMatch {
/// The pattern ID.
pattern: PatternID,
/// The start offset of the match, inclusive.
start: usize,
/// The end offset of the match, exclusive.
end: usize,
}
impl MultiMatch {
/// Create a new match from a pattern ID and a byte offset span.
///
/// # Panics
///
/// This panics if `end < start`.
#[inline]
pub fn new(pattern: PatternID, start: usize, end: usize) -> MultiMatch {
assert!(start <= end);
MultiMatch { pattern, start, end }
}
/// Create a new match from a pattern ID and a byte offset span.
///
/// This is like [`MultiMatch::new`], but accepts a `usize` instead of a
/// [`PatternID`]. This panics if the given `usize` is not representable
/// as a `PatternID`.
///
/// # Panics
///
/// This panics if `end < start` or if `pattern > PatternID::MAX`.
#[inline]
pub fn must(pattern: usize, start: usize, end: usize) -> MultiMatch {
MultiMatch::new(PatternID::new(pattern).unwrap(), start, end)
}
/// Returns the ID of the pattern that matched.
///
/// The ID of a pattern is derived from the position in which it was
/// originally inserted into the corresponding regex engine. The first
/// pattern has identifier `0`, and each subsequent pattern is `1`, `2` and
/// so on.
#[inline]
pub fn pattern(&self) -> PatternID {
self.pattern
}
/// The starting position of the match.
#[inline]
pub fn start(&self) -> usize {
self.start
}
/// The ending position of the match.
#[inline]
pub fn end(&self) -> usize {
self.end
}
/// Returns the match location as a range.
#[inline]
pub fn range(&self) -> core::ops::Range<usize> {
self.start..self.end
}
/// Returns true if and only if this match is empty. That is, when
/// `start() == end()`.
///
/// An empty match can only be returned when the empty string was among
/// the patterns used to build the Aho-Corasick automaton.
#[inline]
pub fn is_empty(&self) -> bool {
self.start == self.end
}
}
/// An error type indicating that a search stopped prematurely without finding
/// a match.
///
/// This error type implies that one cannot assume that no matches occur, since
/// the search stopped before completing.
///
/// Normally, when one searches for something, the response is either an
/// affirmative "it was found at this location" or a negative "not found at
/// all." However, in some cases, a regex engine can be configured to stop its
/// search before concluding whether a match exists or not. When this happens,
/// it may be important for the caller to know why the regex engine gave up and
/// where in the input it gave up at. This error type exposes the 'why' and the
/// 'where.'
///
/// For example, the DFAs provided by this library generally cannot correctly
/// implement Unicode word boundaries. Instead, they provide an option to
/// eagerly support them on ASCII text (since Unicode word boundaries are
/// equivalent to ASCII word boundaries when searching ASCII text), but will
/// "give up" if a non-ASCII byte is seen. In such cases, one is usually
/// required to either report the failure to the caller (unergonomic) or
/// otherwise fall back to some other regex engine (ergonomic, but potentially
/// costly).
///
/// More generally, some regex engines offer the ability for callers to specify
/// certain bytes that will trigger the regex engine to automatically quit if
/// they are seen.
///
/// Still yet, there may be other reasons for a failed match. For example,
/// the hybrid DFA provided by this crate can be configured to give up if it
/// believes that it is not efficient. This in turn permits callers to choose a
/// different regex engine.
///
/// # Advice
///
/// While this form of error reporting adds complexity, it is generally
/// possible for callers to configure regex engines to never give up a search,
/// and thus never return an error. Indeed, the default configuration for every
/// regex engine in this crate is such that they will never stop searching
/// early. Therefore, the only way to get a match error is if the regex engine
/// is explicitly configured to do so. Options that enable this behavior
/// document the new error conditions they imply.
///
/// Regex engines for which no errors are possible for any configuration will
/// return the normal `Option<Match>` and not use this error type at all.
///
/// For example, regex engines in the `dfa` sub-module will only report
/// `MatchError::Quit` if instructed by either
/// [enabling Unicode word boundaries](crate::dfa::dense::Config::unicode_word_boundary)
/// or by
/// [explicitly specifying one or more quit bytes](crate::dfa::dense::Config::quit).
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum MatchError {
// Note that the first version of this type was called `SearchError` and it
// included a third `None` variant to indicate that the search completed
// and no match was found. However, this was problematic for iterator
// APIs where the `None` sentinel for stopping iteration corresponds
// precisely to the "match not found" case. The fact that the `None`
// variant was buried inside this type was in turn quite awkward. So
// instead, I removed the `None` variant, renamed the type and used
// `Result<Option<Match>, MatchError>` in non-iterator APIs instead of the
// conceptually simpler `Result<Match, MatchError>`. However, we "regain"
// ergonomics by only putting the more complex API in the `try_` variants
// ("fallible") of search methods. The infallible APIs will instead just
// return `Option<Match>` and panic on error.
/// The search saw a "quit" byte at which it was instructed to stop
/// searching.
Quit {
/// The "quit" byte that was observed that caused the search to stop.
byte: u8,
/// The offset at which the quit byte was observed.
offset: usize,
},
/// The search, based on heuristics, determined that it would be better
/// to stop, typically to provide the caller an opportunity to use an
/// alternative regex engine.
///
/// Currently, the only way for this to occur is via the lazy DFA and
/// only when it is configured to do so (it will not return this error by
/// default).
GaveUp {
/// The offset at which the search stopped. This corresponds to the
/// position immediately following the last byte scanned.
offset: usize,
},
}
#[cfg(feature = "std")]
impl std::error::Error for MatchError {}
impl core::fmt::Display for MatchError {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match *self {
MatchError::Quit { byte, offset } => write!(
f,
"quit search after observing byte \\x{:02X} at offset {}",
byte, offset,
),
MatchError::GaveUp { offset } => {
write!(f, "gave up searching at offset {}", offset)
}
}
}
}
|
use opengl_graphics::{GlGraphics, GlyphCache};
use piston::input::RenderArgs;
use graphics::Context;
pub struct TextWriter{
}
impl TextWriter {
pub fn new() -> TextWriter {
TextWriter {
}
}
pub fn render_text(
&mut self,
ctx: &Context,
gl: &mut GlGraphics,
glyphs: &mut GlyphCache,
color: [f32; 4],
size: u32,
pos_x: f64,
pos_y: f64,
to_write: &str) {
use graphics::*;
let text_trans = ctx
.transform
.trans(pos_x, pos_y);
text::Text::new_color(color, size).draw(
to_write,
glyphs,
&ctx.draw_state,
text_trans,
gl
).unwrap();
}
} |
// Copyright (C) 2019 Frank Rehberger
//
// Licensed under the Apache License, Version 2.0 or MIT License
//! # Rust build-script dependencies generator
//!
//! Rust build-script dependencies generator is intended for the build-script `build.rs'. All files
//! matching the user defined GLOB pattern will be added to Cargo's dependency-checker. In case
//! those files have been modified since last build-process, the build process is re-ran.
//!
//! Expanding the pattern the set _must_ not contain directories. Cargo only supports files
//! for dependency checking. If the expanded set contains a directory the function will continue
//! with next element in the list but returning with error Error::ExpandedPathExpectedFile(String)
//!
//! This way the calling build-script `build.rs` may interrupt the build-process or ignore
//! the presents of a directory along the GLOB-expansion.
//!
//! For further reading see chapter [Cargo Build-Script Output](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script)
//!
//! Note: The cargo application ist storing the build-script-output in the build directory,
//! for example: `target/debug/build/*/output`.
extern crate glob;
use std::path::{Path};
use self::glob::{glob, Paths};
/// Error cases
#[derive(Clone, Debug)]
pub enum Error {
/// Invalid GLOB pattern
InvalidGlobPattern(String),
/// The pattern contains invalid characters
InvalidOsString(std::ffi::OsString),
/// Expanded pattern contains a path that is no file
ExpandedPathExpectedFile(String),
}
/// Specify a file or directory which, if changed, should trigger a rebuild.
///
/// Reference: This function stems from crate 'build-helper'
fn rerun_if_changed<P: AsRef<Path>>(path: P) {
println!("cargo:rerun-if-changed={}", path.as_ref().display());
}
/// Exapanding the GLOB pattern and adding dependency to Cargo-build-process
///
/// For example:
/// `"res/*"` will enumerate all files/directories in directory "res/" and watchin changes
///
/// `"res/"` - will add the directory itself to the watch-list, triggering a rerun in case new entities are added.
///
/// `"res/**/*.protobuf"` will traverse all sub-directories enumerating all protobuf files.
///
/// `"res/**"` will traverse all sub-directories enumerating all directories
///
/// **Rule of thumb**
/// Add files, if changes to files shall be detected.
///
/// Add directories, if the build-process shall be rerun in case of _new_/_removed_ files.
///
/// ```
/// // declared in Cargo.toml as "[build-dependencies]"
/// extern crate build_deps;
///
/// fn main() {
/// // Enumerate files in sub-folder "res/*", being relevant for the test-generation (as example)
/// // If function returns with error, exit with error message.
/// build_deps::rerun_if_changed_paths( "res/*" ).unwrap();
///
/// // Adding the parent directory "res" to the watch-list will capture new-files being added
/// build_deps::rerun_if_changed_paths( "res" ).unwrap();
/// }
/// ```
///
pub fn rerun_if_changed_paths(pattern: &str) -> Result<(), Error> {
let paths: Paths = glob(&pattern).map_err(|err| Error::InvalidGlobPattern(err.to_string()))?;
for entry in paths {
match entry {
Ok(path) => rerun_if_changed(&path),
Err(e) => return Err(Error::InvalidGlobPattern(e.to_string())),
}
}
Ok(())
}
|
extern crate pairing;
extern crate bellman;
extern crate rand;
extern crate jubjub;
#[macro_use]
extern crate lazy_static;
pub mod base;
pub mod b2c;
pub mod c2b;
pub mod c2p;
pub mod p2c;
pub mod common_verify;
pub mod contract;
pub mod incrementalmerkletree;
pub mod pedersen;
pub mod convert;
pub use convert::{u6442str,str2u644,str2point,str2value,sk2str};
pub fn pedersen_hash(bits: &[bool]) -> [u64; 4] {
assert_eq!(bits.len(), base::PHIN);
jubjub::pedersen_hash_real(bits, &base::ph_generator())
.unwrap()
.serial()
}
pub fn build_coin(address:String,va:[u64;2],rcm:[u64;2])->String{
let coin = pedersen_hash({
let addr = str2point(address).0;
let mut v = Vec::with_capacity(256);
for num in addr.into_iter(){
let mut num = *num;
for _ in 0..64{
v.push(num&1==1);
num>>=1;
}
}
let addr = v;
let mut node = Vec::with_capacity(256);
for num in rcm.into_iter(){
let mut num = *num;
for _ in 0..64{
node.push(num&1==1);
num>>=1;
}
}
for num in va.into_iter(){
let mut num = *num;
for _ in 0..64{
node.push(num&1==1);
num>>=1;
}
}
for b in addr.iter(){
node.push(*b);
}
node
}.as_slice());
u6442str(coin)
}
pub fn pedersen_hash_root(c0: [u64; 4], c1: [u64; 4]) -> [u64; 4] {
let mut v = Vec::with_capacity(512);
for num in c0.into_iter() {
let mut num = *num;
for _ in 0..64 {
v.push(num & 1 == 1);
num >>= 1;
}
}
for num in c1.into_iter() {
let mut num = *num;
for _ in 0..64 {
v.push(num & 1 == 1);
num >>= 1;
}
}
jubjub::pedersen_hash_real(v.as_slice(), &base::ph_generator()).unwrap().serial()
}
pub use base::set_param_path;
use base::gen_ph_generator;
use b2c::gen_b2c_param;
use c2b::gen_c2b_param;
use c2p::gen_c2p_param;
use p2c::gen_p2c_param;
use common_verify::range::gen_range_param;
pub fn gen_params(path: &str) {
use std::path::Path;
use std::fs::{create_dir, remove_dir_all};
{
let path = Path::new(path);
if path.exists() {
remove_dir_all(path).unwrap();
}
create_dir(path).unwrap();
}
set_param_path(path);
gen_ph_generator();
gen_b2c_param();
gen_c2b_param();
gen_c2p_param();
gen_p2c_param();
gen_range_param();
}
|
use actix::MessageResponse;
#[derive(MessageResponse)]
struct Added(usize);
fn main() {}
|
extern crate deunicode;
use deunicode::deunicode;
use std::ffi::OsStr;
use std::fs::{create_dir, DirEntry, File};
use std::io::{self, Read, Write};
use std::path::{Path, PathBuf};
use std::process::Command;
/// Sass spec version targeted.
const VERSION: f32 = 3.6;
fn main() -> Result<(), Error> {
let base = PathBuf::from("sass-spec/spec");
handle_suite(
&base,
"basic",
&[
"14_imports", // Need to handle separate files in tests
"15_arithmetic_and_lists", // requirements changed
"33_ambiguous_imports", // Need to handle separate files in tests
],
)?;
handle_suite(&base, "colors", &[])?;
handle_suite(
&base,
"css",
&[
"bizarrely_formatted_comments", // Strange indent?
"custom_properties", // Most fails :-(
"moz_document", // Deprecated functionality
"ms_long_filter_syntax", // ?
"multi_star_comments", // Some problem with whitespace?
"plain", // Need to access separate files in tests
"selector/slotted", // Requires @extend
"unknown_directive", // ?
],
)?;
handle_suite(
&base,
"libsass",
&[
"Sa\u{301}ss-UT\u{327}F8", // resolves to duplicate name
"at-error/feature-test",
"at-root/ampersand",
"at-root/extend",
"at-root/138_test_at_root_in_media",
"at-root/139_test_at_root_in_bubbled_media",
"at-root/140_test_at_root_in_unknown_directive",
"at-root/with_without",
"at-stuff",
"base-level-parent/imported",
"base-level-parent/nested/at-root-alone-itpl",
"base-level-parent/nested/at-root-postfix-itpl",
"base-level-parent/nested/at-root-prefix-itpl",
"base-level-parent/root/at-root-postfix-itpl",
"base-level-parent/root/at-root-prefix-itpl",
"bool",
"bourbon", // Need to handle separate files in tests
"calc",
"charset", // actually expects to-upper-case('ø...') to NOT work?
"color-functions/opacity/fade-out",
"color-functions/opacity/transparentize",
"color-functions/other/change-color/a",
"color-functions/rgb/rgba/a",
"color-functions/saturate",
"conversions",
"css-import",
"css_nth_selectors",
"css_unicode",
"debug-directive-nested/function",
"debug-directive-nested/mixin",
"delayed",
"div",
"env",
"features/at-error",
"features/extend-selector-pseudoclass",
"http_import",
"import",
"inh", // Requires @extend
"inheritance",
"interpolated-function-call",
"interpolated-urls",
"list-evaluation",
"lists",
"media",
"mixin", // requires arbitrary (unknown) units
"mixins-and-media-queries",
"multi-blocks",
"placeholder-mediaquery",
"placeholder-nested",
"precision/lower", // Expects round() results I think looks broken.
"properties-in-media",
"propsets",
"rel",
"selector-functions/is_superselector",
"selector-functions/selector-length",
"selector-functions/simple-selector",
"selectors/access",
"selectors/interpolation",
"selectors/mixin-argument",
"selectors/simple",
"selectors/variables/multiple/bare",
"selectors/variables/multiple/interpolated",
"selectors/variables/nested/bare",
"selectors/variables/nested/interpolated",
"test",
"unary-ops",
"unicode-bom/utf-16-big", // rsass only handles utf8
"unicode-bom/utf-16-little", // rsass only handles utf8
"units/conversion/angle",
"units/conversion/frequency",
"units/conversion/resolution",
"units/conversion/size",
"units/conversion/time",
"units/simple",
"url",
"variable-scoping/blead-global/expanding/at-root",
"variable-scoping/blead-global/expanding/each",
"variable-scoping/blead-global/expanding/else",
"variable-scoping/blead-global/expanding/elseif",
"variable-scoping/blead-global/expanding/for",
"variable-scoping/blead-global/expanding/if",
"variable-scoping/blead-global/expanding/while",
"variable-scoping/blead-global/functional/each",
"variable-scoping/blead-global/functional/else",
"variable-scoping/blead-global/functional/elseif",
"variable-scoping/blead-global/functional/for",
"variable-scoping/blead-global/functional/if",
"variable-scoping/defaults",
"variable-scoping/lexical-scope",
"variable-scoping/root-scope",
"variables_in_media",
"warn-directive-nested/function",
"warn-directive-nested/mixin",
],
)?;
handle_suite(
&base,
"misc",
&[
"mixin_content", // ?
"JMA-pseudo-test", // Requires @extend
"trailing_comma_in_selector",
"warn-directive",
],
)?;
handle_suite(&base, "number-functions", &[])?;
handle_suite(
&base,
"parser",
&[
"interpolate/11_escaped_literal",
"interpolate/12_escaped_double_quoted/06_escape_interpolation",
"interpolate/13_escaped_single_quoted/06_escape_interpolation",
"interpolate/14_escapes_literal_numbers",
"interpolate/15_escapes_double_quoted_numbers/06_escape_interpolation",
"interpolate/16_escapes_single_quoted_numbers/06_escape_interpolation",
"interpolate/17_escapes_literal_lowercase",
"interpolate/18_escapes_double_quoted_lowercase/06_escape_interpolation",
"interpolate/19_escapes_single_quoted_lowercase/06_escape_interpolation",
"interpolate/20_escapes_literal_uppercase",
"interpolate/21_escapes_double_quoted_uppercase/06_escape_interpolation",
"interpolate/22_escapes_single_quoted_uppercase/06_escape_interpolation",
"interpolate/23_escapes_literal_specials",
"interpolate/24_escapes_double_quoted_specials/todo_05_variable_quoted_double-4.0",
"interpolate/24_escapes_double_quoted_specials/06_escape_interpolation",
"interpolate/25_escapes_single_quoted_specials/todo_05_variable_quoted_double-4.0",
"interpolate/25_escapes_single_quoted_specials/06_escape_interpolation",
"operations/binary-and-unary",
],
)?;
handle_suite(
&base,
"selector-functions",
&[
"extend/nested",
"extend/simple",
"is_superselector",
"parse",
"replace",
"unify/base",
"unify/universal_simple",
],
)?;
handle_suite(
&base,
"scss",
&[
"multiline-var", // name conflict with other test.
"mixin-content", // stack overflow?!?
"huge", // stack overflow
"comparable",
"composed-args",
"ie-functions",
"media/interpolated",
"media/nesting/merged",
"media/nesting/merged_and_retained",
"media/nesting/removed",
"media/nesting/retained",
"media/script_features",
"mixin-content-selectors",
"negation",
"nested-extend",
"newlines_in_selectors",
"placeholder",
"placeholder-with-media",
"precision", // Default prec is 5 in libsass but 10 in scss?!?
"simple-inheritance",
],
)?;
handle_suite(&base, "values", &["ids", "numbers/units/multiple"])?;
Ok(())
}
fn handle_suite(
base: &Path,
suite: &str,
ignored: &[&str],
) -> Result<(), Error> {
eprintln!("Handle suite {:?}", suite);
let suitedir = base.join(suite);
let rssuitedir = PathBuf::from("tests").join(fn_name(suite));
let _may_exist = create_dir(&rssuitedir);
let mut rs = File::create(rssuitedir.join("main.rs"))?;
writeln!(
rs,
"//! Tests auto-converted from {:?}\
\n//! version {}\
\n//! See <https://github.com/sass/sass-spec> for source material.\\n",
suitedir,
String::from_utf8(
Command::new("git")
.args(&["log", "-1", "--format=%h, %ai."])
.current_dir(base)
.output()?
.stdout
)?.trim(),
)?;
if !ignored.is_empty() {
writeln!(
rs,
"//! The following tests are excluded from conversion:\
\n//! {:?}",
ignored,
)?;
}
writeln!(
rs,
"extern crate rsass;\
\nuse rsass::{{compile_scss, OutputStyle}};",
)?;
handle_entries(&mut rs, &suitedir, &rssuitedir, None, ignored)?;
writeln!(
rs,
"\nfn rsass(input: &str) -> Result<String, String> {{\
\n compile_scss(input.as_bytes(), OutputStyle::Expanded)\
\n .map_err(|e| format!(\"rsass failed: {{}}\", e))\
\n .and_then(|s| String::from_utf8(s).map_err(|e| format!(\"{{:?}}\", e)))\
\n}}")?;
Ok(())
}
fn handle_entries(
rs: &mut Write,
suitedir: &Path,
rssuitedir: &Path,
precision: Option<i64>,
ignored: &[&str],
) -> Result<(), Error> {
let mut entries: Vec<DirEntry> =
suitedir.read_dir()?.collect::<Result<_, _>>()?;
entries.sort_by_key(|e| e.file_name());
for entry in entries {
if entry.file_type()?.is_dir() {
if entry.path().join("error").is_file() {
ignore(
rs,
&entry.file_name(),
"tests with expected error not implemented yet",
)?;
} else if ignored.iter().any(|&i| &entry.file_name() == i) {
ignore(rs, &entry.file_name(), "not expected to work yet")?;
} else {
eprintln!("Should handle {:?}", entry.file_name());
let input = entry.path().join("input.scss");
if input.exists() {
spec_to_test(
rs,
&suitedir,
&entry.file_name(),
precision,
)
.map_err(|e| {
Error(format!(
"Failed to handle {:?}: {}",
entry.file_name(),
e,
))
})?;
} else {
let options = load_options(&entry.path())?;
if let Some(ref reason) = options.should_skip {
ignore(rs, &entry.file_name(), reason)?;
} else {
let precision = options.precision.or(precision);
let name = fn_name_os(&entry.file_name());
writeln!(rs, "\nmod {};", name)?;
let rssuitedir = rssuitedir.join(name);
let _may_exist = create_dir(&rssuitedir);
let mut rs = File::create(rssuitedir.join("mod.rs"))?;
writeln!(
rs,
"//! Tests auto-converted from {:?}\
\n#[allow(unused)]\
\nuse super::rsass;\
\n#[allow(unused)]\
\nuse rsass::precision;",
suitedir.join(entry.file_name()),
)?;
let tt = format!(
"{}/",
entry.file_name().to_string_lossy(),
);
let ignored: Vec<&str> = ignored
.iter()
.filter_map(|p| {
if p.starts_with(&tt) {
Some(p.split_at(tt.len()).1)
} else {
None
}
})
.collect();
handle_entries(
&mut rs,
&entry.path(),
&rssuitedir,
precision,
&ignored,
)?;
}
}
}
}
}
Ok(())
}
fn ignore(
rs: &mut Write,
name: &OsStr,
reason: &str,
) -> Result<(), io::Error> {
eprintln!("Ignoring {:?}, {}.", name, reason);
writeln!(rs, "\n// Ignoring {:?}, {}.", name, reason)
}
fn spec_to_test(
rs: &mut Write,
suite: &Path,
test: &OsStr,
precision: Option<i64>,
) -> Result<(), Error> {
let specdir = suite.join(test);
let options = load_options(&specdir)?;
if let Some(ref reason) = options.should_skip {
ignore(rs, &specdir.file_name().unwrap_or_default(), reason)?;
return Ok(());
}
let precision = options.precision.or(precision);
let input = specdir.join("input.scss");
let expected = specdir.join("output.css");
writeln!(
rs,
"\n/// From {:?}\
\n#[test]\
\nfn {}() {{",
specdir,
fn_name_os(test),
)?;
if let Some(precision) = precision {
writeln!(rs, " precision::set({});", precision)?;
}
let input = format!("{:?}", content(&input)?);
let expected = format!("{:?}", content(&expected)?.replace("\r\n", "\n"));
if input.len() + expected.len() < 45 {
writeln!(
rs,
" assert_eq!(rsass({}).unwrap(), {});",
input, expected
)?;
} else if input.len() < 54 {
writeln!(
rs,
" assert_eq!(\
\n rsass({}).unwrap(),\
\n {}\
\n );",
input, expected
)?;
} else if input.len() < 62 {
writeln!(
rs,
" assert_eq!(\
\n rsass({})\
\n .unwrap(),\
\n {}\
\n );",
input, expected
)?;
} else {
writeln!(
rs,
" assert_eq!(\
\n rsass(\
\n {}\
\n )\
\n .unwrap(),\
\n {}\
\n );",
input, expected
)?;
}
writeln!(rs, "}}")?;
Ok(())
}
fn fn_name_os(name: &OsStr) -> String {
fn_name(&name.to_string_lossy())
}
fn fn_name(name: &str) -> String {
let t = deunicode(name)
.to_lowercase()
.replace('-', "_")
.replace('.', "_");
if t.chars().next().unwrap_or('0').is_numeric() {
format!("t{}", t)
} else if t == "else"
|| t == "for"
|| t == "if"
|| t == "static"
|| t == "while"
{
format!("test_{}", t)
} else {
t
}
}
fn content(path: &Path) -> Result<String, io::Error> {
let mut buf = String::new();
File::open(path)?.read_to_string(&mut buf)?;
Ok(buf)
}
#[derive(Debug)]
struct Error(String);
use std::convert::From;
impl From<io::Error> for Error {
fn from(e: io::Error) -> Self {
Error(format!("io error: {}", e))
}
}
impl From<std::string::FromUtf8Error> for Error {
fn from(e: std::string::FromUtf8Error) -> Self {
Error(format!("utf8 error: {}", e))
}
}
impl From<yaml_rust::ScanError> for Error {
fn from(e: yaml_rust::ScanError) -> Self {
Error(format!("utf8 error: {}", e))
}
}
impl From<std::num::ParseFloatError> for Error {
fn from(e: std::num::ParseFloatError) -> Self {
Error(format!("utf8 error: {}", e))
}
}
use std::fmt;
impl fmt::Display for Error {
fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(out)
}
}
extern crate yaml_rust;
use yaml_rust::{Yaml, YamlLoader};
struct Options {
pub precision: Option<i64>,
/// None for tests that should work, or Some(reason to skip).
pub should_skip: Option<String>,
}
/// Load options from options.yml.
fn load_options(path: &Path) -> Result<Options, Error> {
let yml = path.join("options.yml");
if yml.exists() {
let options = content(&yml)?;
let options = YamlLoader::load_from_str(&options)?;
if options.len() > 1 {
Err(Error(format!("Found multiple-doc options {:?}", options)))?;
}
if options.len() == 0 {
Err(Error(format!("Found zero-doc options {:?}", options)))?;
}
let options = &options[0];
eprintln!("Found options: {:?}", options);
Ok(Options {
precision: options[":precision"].as_i64(),
should_skip: {
if let Some(skip) = skip_ended(options)? {
Some(skip)
} else {
skip_unstarted(options)?
}
},
})
} else {
Ok(Options {
precision: None,
should_skip: None,
})
}
}
fn skip_ended(options: &Yaml) -> Result<Option<String>, Error> {
if let Some(end) = options[":end_version"].as_str() {
if end.parse::<f32>()? <= VERSION {
Ok(Some(format!("end_version is {}", end)))
} else {
Ok(None)
}
} else {
Ok(None)
}
}
fn skip_unstarted(options: &Yaml) -> Result<Option<String>, Error> {
if let Some(start) = options[":start_version"].as_str() {
if start.parse::<f32>()? <= VERSION {
Ok(None)
} else {
Ok(Some(format!("start_version is {}", start)))
}
} else {
Ok(None)
}
}
|
use log::error;
/// The central error type for the application. These should be converted by the main program into
/// readable error messages for the user.
#[derive(Debug)]
pub enum Error {
ConfigFileBad(&'static str),
ConfigFileUnreadable(&'static str),
}
impl Error {
/// Log the error, consuming it. Owning it isn't strictly necessary; we could copy them, but its
/// nice for the interface to work this way, as it means that errors will probably only get
/// reported once.
pub fn report(self) -> () {
match self {
Error::ConfigFileBad(config_file) => {
// TODO(sam) Search this file for "Log Configs Note"
error!("Error opening {:?} for reading the Config", config_file)
}
Error::ConfigFileUnreadable(config_file) => {
// TODO(sam) Search this file for "Log Configs Note"
error!("Error parsing the Config from {:?}", config_file)
}
}
}
}
// Log Configs Note
// ================
//
// Is it bad to log configs in general? Perhaps one could use a newtype for obfuscating
// certain fields of : Debug impl neatly.
|
use super::interrupt;
use super::uart;
use crate::{putfmt, phys_to_virt};
use super::consts::*;
//通过MMIO地址对平台级中断控制器PLIC的寄存器进行设置
//基于opensbi后一般运行于Hart0 S态,为Target1
//PLIC是async cause 11
//声明claim会清除中断源上的相应pending位。
//即使mip寄存器的MEIP位没有置位, 也可以claim; 声明不被阀值寄存器的设置影响;
//获取按优先级排序后的下一个可用的中断ID
pub fn next() -> Option<u32> {
let claim_reg = phys_to_virt(PLIC_CLAIM) as *const u32;
let claim_no;
unsafe {
claim_no = claim_reg.read_volatile();
}
if claim_no == 0 {
None //没有可用中断待定
} else {
Some(claim_no)
}
}
//claim时,PLIC不再从该相同设备监听中断
//写claim寄存器,告诉PLIC处理完成该中断
// id 应该来源于next()函数
pub fn complete(id: u32) {
let complete_reg = phys_to_virt(PLIC_CLAIM) as *mut u32; //和claim相同寄存器,只是读或写的区别
unsafe {
complete_reg.write_volatile(id);
}
}
//看的中断ID是否pending
pub fn is_pending(id: u32) -> bool {
let pend = phys_to_virt(PLIC_PENDING) as *const u32;
let actual_id = 1 << id;
let pend_ids;
unsafe {
pend_ids = pend.read_volatile();
}
actual_id & pend_ids != 0
}
//使能target中某个给定ID的中断
//中断ID可查找qemu/include/hw/riscv/virt.h, 如:UART0_IRQ = 10
pub fn enable(id: u32) {
let enables = phys_to_virt(PLIC_INT_ENABLE) as *mut u32; //32位的寄存器
let actual_id = 1 << id;
unsafe {
enables.write_volatile(enables.read_volatile() | actual_id);
// 0x0c00_2000 <=~ (1 << 10)
}
}
//设置中断源的优先级,分0~7级,7是最高级, eg:这里id=10, 表示第10个中断源的设置, prio=1
pub fn set_priority(id: u32, prio: u8) {
let actual_prio = prio as u32 & 7;
let prio_reg = phys_to_virt(PLIC_PRIORITY) as *mut u32;
unsafe {
prio_reg.add(id as usize).write_volatile(actual_prio); //0x0c000000 + 4 * 10 <= 1 = 1 & 7
}
}
//设置中断target的全局阀值[0..7], <= threshold会被屏蔽
pub fn set_threshold(tsh: u8) {
let actual_tsh = tsh & 7; //使用0b111保留最后三位
let tsh_reg = phys_to_virt(PLIC_THRESHOLD) as *mut u32;
unsafe {
tsh_reg.write_volatile(actual_tsh as u32); // 0x0c20_0000 <= 0 = 0 & 7
}
}
pub fn handle_interrupt() {
if let Some(interrupt) = next() {
match interrupt {
1..=8 => {
//virtio::handle_interrupt(interrupt);
bare_println!("plic virtio external interrupt: {}", interrupt);
}
UART0_INT_NUM => {
//UART中断ID是10
uart::handle_interrupt();
//换用sbi的方式获取字符
//interrupt::try_process_serial();
}
_ => {
bare_println!("Unknown external interrupt: {}", interrupt);
}
}
//这将复位pending的中断,允许UART再次中断。
//否则,UART将被“卡住”
complete(interrupt);
}
}
|
mod attributes;
mod raster;
use std::fs::*;
use image::{Rgba, Frame, Delay, gif::Encoder};
use glam::{vec3, Vec3};
use attributes::*;
use raster::*;
use anyhow::Result;
fn main() -> Result <()> {
let file = read_to_string("data/uniform.json")?;
let render_type = RenderType::Png;
let primitive_type = PrimitiveType::Line;
let mut uniform: UniformAttributes = serde_json::from_str(file.as_str())?;
let height: usize = 500;
let mut frame_buffer = FrameBuffer::new((height as f32 * uniform.camera.aspect_ratio) as usize, height);
uniform.calc_matrices();
let vertex_shader = Box::new(
|va: VertexAttributes, uniform: UniformAttributes| {
VertexAttributes {
position: uniform.projection_matrix * uniform.view_matrix * uniform.model_matrix * va.position,
normal: (uniform.normal_matrix * va.normal.extend(0.0)).into(),
frag_pos: (uniform.model_matrix * va.position).into(),
}});
let fragment_shader = Box::new(
|va: VertexAttributes, uniform: UniformAttributes| {
let n = va.normal;
let v = match uniform.camera.is_perspective {
true => (uniform.camera.position - va.frag_pos).normalize(),
false => vec3(0.0, 0.0, -1.0),
};
let li: Vec3 = (uniform.light.position - va.frag_pos).normalize();
let diffuse = uniform.material.diffuse_color * li.dot(n).max(0.0);
let specular = uniform.material.specular_color
* n.dot((li + v).normalize()).max(0.0).powf(uniform.material.specular_exponent);
let d = uniform.light.position - va.frag_pos;
let color = (diffuse + specular) * uniform.light.intensity / d.length_squared();
let out = FragmentAttributes::new(color.extend(1.0), va.position.into(), n);
out
});
let blending_shader = Box::new(
|fa: FragmentAttributes, previous: FrameBufferAttributes| {
let alpha = fa.color[3];
let out = fa.color * alpha + previous.get_color() * (1.0 - alpha);
if fa.position.z < previous.depth {
FrameBufferAttributes {
color: Rgba(
[(out[0] * 255.0) as u8,
(out[1] * 255.0) as u8,
(out[2] * 255.0) as u8,
(out[3] * 255.0)as u8]),
depth: fa.position.z
}
} else { previous }});
let mut program = Program {
vertex_shader,
fragment_shader,
blending_shader,
};
let (vertices, indices) = load_off("data/bunny.off", primitive_type)?;
match render_type {
RenderType::Png => {
rasterize(&mut program, uniform, &vertices, &indices, &mut frame_buffer, primitive_type)?;
// primitive_type = PrimitiveType::Line;
// let (vertices, indices) = load_off("data/bunny.off", primitive_type)?;
// rasterize(&mut program, uniform, &vertices, &indices, &mut frame_buffer, primitive_type)?;
const FILENAME: &str = "img/bunny.png";
frame_buffer.render().save(FILENAME)?;
},
RenderType::Gif => {
let mut frames: Vec<Frame> = vec![];
let gif = File::create("img/anim.gif")?;
let mut encoder = Encoder::new(gif);
for _ in 0..20 {
uniform.transform.angle += 0.1;
uniform.transform.distance -= 0.02;
uniform.calc_matrices();
frame_buffer.clear();
// primitive_type = PrimitiveType::Triangle;
rasterize(&mut program, uniform, &vertices, &indices, &mut frame_buffer, primitive_type)?;
// primitive_type = PrimitiveType::Line;
// let (vertices, indices) = load_off("data/bunny.off", primitive_type)?;
// rasterize(&mut program, uniform, &vertices, &indices, &mut frame_buffer, primitive_type)?;
let frame = Frame::from_parts(frame_buffer.render(), 0, 0,
Delay::from_saturating_duration(std::time::Duration::from_millis(75)));
frames.push(frame);
}
encoder.encode_frames(frames)?;
},
}
Ok(())
}
fn load_off(filename: &str, primitive_type: PrimitiveType) -> Result<(Vec<VertexAttributes>, Vec<usize>)> {
use std::io::BufRead;
let file = std::fs::File::open(filename)?;
let reader = std::io::BufReader::new(file);
let mut i = 0;
let mut nv = 0;
let mut vertices: Vec<VertexAttributes> = vec![];
let mut indices: Vec<usize> = vec![];
for line in reader.lines() {
if i == 0 {
i += 1;
continue;
}
if i == 1 {
let nums: Vec<u32> = line?.split(" ").flat_map(str::parse).collect();
nv = nums[0];
i += 1;
continue;
}
if i > 1 && i <= 1 + nv {
let nums: Vec<f32> = line?.split(" ").flat_map(str::parse).collect();
vertices.push(VertexAttributes::new(vec3(nums[0], nums[1], nums[2]), Vec3::zero()));
i += 1;
continue;
}
if i > 1 + nv {
let id: Vec<usize> = line?.split(" ").flat_map(str::parse).collect();
let normal = (vertices[id[2]].position - vertices[id[1]].position).truncate()
.cross((vertices[id[3]].position - vertices[id[1]].position).truncate()).normalize();
vertices[id[1]].normal += normal;
vertices[id[2]].normal += normal;
vertices[id[3]].normal += normal;
match primitive_type.clone() {
PrimitiveType::Triangle => {
indices.push(id[1] as usize);
indices.push(id[2] as usize);
indices.push(id[3] as usize);
},
PrimitiveType::Line => {
indices.push(id[1] as usize);
indices.push(id[2] as usize);
indices.push(id[2] as usize);
indices.push(id[3] as usize);
indices.push(id[3] as usize);
indices.push(id[1] as usize);
},
}
i += 1;
continue;
}
}
vertices.iter_mut().for_each(|v| {
v.normal = v.normal.normalize();
});
Ok((vertices, indices))
}
|
// use std::io;
use std::io::{self, Write};
fn main() {
print!("Masukan angka yang akan dicari faktornya: ");
let stdout = io::stdout();
let mut handle = stdout.lock();
let _ = handle.flush();
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let limit: i32 = match input.trim().parse() {
Ok(num) => num,
Err(_) => 0,
};
for i in 1..=limit {
if limit % i == 0 {
println!("{}", i);
}
}
}
|
// This file is part of Webb.
// Copyright (C) 2021 Webb Technologies Inc.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Anchor Module
//!
//! A simple module for building Anchors.
//!
//! ## Overview
//!
//! The Anchor module provides functionality for the following:
//!
//! * Inserting elements to the tree
//!
//! The supported dispatchable functions are documented in the [`Call`] enum.
//!
//! ### Terminology
//!
//! ### Goals
//!
//! The Anchor system in Webb is designed to make the following possible:
//!
//! * Define.
//!
//! ## Interface
//!
//! ## Related Modules
//!
//! * [`System`](../frame_system/index.html)
//! * [`Support`](../frame_support/index.html)
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// #[cfg(test)]
// pub mod mock;
// #[cfg(test)]
// mod tests;
pub mod types;
use codec::{Decode, Encode};
use frame_support::{ensure, pallet_prelude::DispatchError};
use pallet_mixer::types::{MixerInspector, MixerInterface};
use types::*;
use darkwebb_primitives::verifier::*;
use frame_support::traits::{Currency, Get, ReservableCurrency};
use frame_system::Config as SystemConfig;
use sp_runtime::traits::{AtLeast32Bit, One, Zero};
use sp_std::prelude::*;
pub use pallet::*;
type BalanceOf<T, I = ()> = <<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
#[frame_support::pallet]
pub mod pallet {
use super::*;
use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*};
use frame_system::pallet_prelude::*;
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T, I = ()>(_);
#[pallet::config]
/// The module configuration trait.
pub trait Config<I: 'static = ()>: frame_system::Config + pallet_mixer::Config<I> {
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
/// ChainID for anchor edges
type ChainId: Encode + Decode + Parameter + AtLeast32Bit + Default + Copy;
/// The mixer type
type Mixer: MixerInterface<Self, I> + MixerInspector<Self, I>;
/// The verifier
type Verifier: VerifierModule;
/// The currency mechanism.
type Currency: ReservableCurrency<Self::AccountId>;
/// The pruning length for neighbor root histories
type HistoryLength: Get<Self::RootIndex>;
}
#[pallet::storage]
#[pallet::getter(fn maintainer)]
/// The parameter maintainer who can change the parameters
pub(super) type Maintainer<T: Config<I>, I: 'static = ()> = StorageValue<_, T::AccountId, ValueQuery>;
/// The map of trees to their anchor metadata
#[pallet::storage]
#[pallet::getter(fn anchors)]
pub type Anchors<T: Config<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, T::TreeId, AnchorMetadata<T::AccountId, BalanceOf<T, I>>, ValueQuery>;
/// The map of trees to the maximum number of anchor edges they can have
#[pallet::storage]
#[pallet::getter(fn max_edges)]
pub type MaxEdges<T: Config<I>, I: 'static = ()> = StorageMap<_, Blake2_128Concat, T::TreeId, u32, ValueQuery>;
/// The map of trees and chain ids to their edge metadata
#[pallet::storage]
#[pallet::getter(fn edge_list)]
pub type EdgeList<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
_,
Blake2_128Concat,
T::TreeId,
Blake2_128Concat,
T::ChainId,
EdgeMetadata<T::ChainId, T::Element, T::BlockNumber>,
ValueQuery,
>;
/// A helper map for denoting whether an anchor is bridged to given chain
#[pallet::storage]
#[pallet::getter(fn anchor_has_edge)]
pub type AnchorHasEdge<T: Config<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, (T::TreeId, T::ChainId), bool, ValueQuery>;
/// The map of (tree, chain id) pairs to their latest recorded merkle root
#[pallet::storage]
#[pallet::getter(fn neighbor_roots)]
pub type NeighborRoots<T: Config<I>, I: 'static = ()> =
StorageDoubleMap<_, Blake2_128Concat, (T::TreeId, T::ChainId), Blake2_128Concat, T::RootIndex, T::Element>;
/// The next neighbor root index to store the merkle root update record
#[pallet::storage]
#[pallet::getter(fn next_neighbor_root_index)]
pub type NextNeighborRootIndex<T: Config<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, (T::TreeId, T::ChainId), T::RootIndex, ValueQuery>;
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
MaintainerSet(T::AccountId, T::AccountId),
/// New tree created
AnchorCreation(T::TreeId),
}
#[pallet::error]
pub enum Error<T, I = ()> {
/// Account does not have correct permissions
InvalidPermissions,
/// Invalid withdraw proof
InvalidWithdrawProof,
/// Invalid neighbor root passed in withdrawal
/// (neighbor root is not in neighbor history)
InvalidNeighborWithdrawRoot,
/// Anchor is at maximum number of edges for the given tree
TooManyEdges,
/// Edge already exists
EdgeAlreadyExists,
EdgeDoesntExists,
}
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {}
#[pallet::call]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pallet::weight(0)]
pub fn create(origin: OriginFor<T>, max_edges: u32, depth: u8) -> DispatchResultWithPostInfo {
ensure_root(origin)?;
let tree_id = <Self as AnchorInterface<_, _>>::create(T::AccountId::default(), depth, max_edges)?;
Self::deposit_event(Event::AnchorCreation(tree_id));
Ok(().into())
}
#[pallet::weight(0)]
pub fn deposit(origin: OriginFor<T>, tree_id: T::TreeId, leaf: T::Element) -> DispatchResultWithPostInfo {
let origin = ensure_signed(origin)?;
<Self as AnchorInterface<_, _>>::deposit(origin, tree_id, leaf)?;
Ok(().into())
}
#[pallet::weight(0)]
pub fn set_maintainer(origin: OriginFor<T>, new_maintainer: T::AccountId) -> DispatchResultWithPostInfo {
let origin = ensure_signed(origin)?;
// ensure parameter setter is the maintainer
ensure!(origin == Self::maintainer(), Error::<T, I>::InvalidPermissions);
// set the new maintainer
Maintainer::<T, I>::try_mutate(|maintainer| {
*maintainer = new_maintainer.clone();
Self::deposit_event(Event::MaintainerSet(origin, new_maintainer));
Ok(().into())
})
}
#[pallet::weight(0)]
pub fn force_set_maintainer(origin: OriginFor<T>, new_maintainer: T::AccountId) -> DispatchResultWithPostInfo {
T::ForceOrigin::ensure_origin(origin)?;
// set the new maintainer
Maintainer::<T, I>::try_mutate(|maintainer| {
*maintainer = new_maintainer.clone();
Self::deposit_event(Event::MaintainerSet(Default::default(), T::AccountId::default()));
Ok(().into())
})
}
}
}
impl<T: Config<I>, I: 'static> AnchorInterface<T, I> for Pallet<T, I> {
fn create(creator: T::AccountId, depth: u8, max_edges: u32) -> Result<T::TreeId, DispatchError> {
// FIXME: is that even correct?
let deposit_size = Zero::zero();
let id = T::Mixer::create(creator, deposit_size, depth)?;
MaxEdges::<T, I>::insert(id, max_edges);
Ok(id)
}
fn deposit(depositor: T::AccountId, id: T::TreeId, leaf: T::Element) -> Result<(), DispatchError> {
T::Mixer::deposit(depositor, id, leaf)
}
fn withdraw(
id: T::TreeId,
proof_bytes: &[u8],
roots: Vec<T::Element>,
nullifier_hash: T::Element,
recipient: T::AccountId,
relayer: T::AccountId,
fee: BalanceOf<T, I>,
refund: BalanceOf<T, I>,
) -> Result<(), DispatchError> {
// Check if local root is known
T::Mixer::ensure_known_root(id, roots[0])?;
if roots.len() > 1 {
for i in 1..roots.len() {
<Self as AnchorInspector<_, _>>::ensure_known_neighbor_root(id, T::ChainId::from(i as u32), roots[i])?;
}
}
// Check nullifier and add or return `InvalidNullifier`
T::Mixer::ensure_nullifier_unused(id, nullifier_hash)?;
T::Mixer::add_nullifier_hash(id, nullifier_hash);
// Format proof public inputs for verification
// FIXME: This is for a specfic gadget so we ought to create a generic handler
// FIXME: Such as a unpack/pack public inputs trait
// FIXME: -> T::PublicInputTrait::validate(public_bytes: &[u8])
let mut bytes = vec![];
bytes.extend_from_slice(&nullifier_hash.encode());
for i in 0..roots.len() {
bytes.extend_from_slice(&roots[i].encode());
}
bytes.extend_from_slice(&recipient.encode());
bytes.extend_from_slice(&relayer.encode());
// TODO: Update gadget being used to include fee as well
// TODO: This is not currently included in
// arkworks_gadgets::setup::mixer::get_public_inputs bytes.extend_from_slice(&
// fee.encode());
let result = <T as pallet::Config<I>>::Verifier::verify(&bytes, proof_bytes)?;
ensure!(result, Error::<T, I>::InvalidWithdrawProof);
// TODO: Transfer assets to the recipient
Ok(())
}
fn add_edge(
id: T::TreeId,
src_chain_id: T::ChainId,
root: T::Element,
height: T::BlockNumber,
) -> Result<(), DispatchError> {
// ensure edge doesn't exists
ensure!(
!EdgeList::<T, I>::contains_key(id, src_chain_id),
Error::<T, I>::EdgeAlreadyExists
);
// ensure anchor isn't at maximum edges
let max_edges: u32 = Self::max_edges(id);
let curr_length = EdgeList::<T, I>::iter_prefix_values(id).into_iter().count();
ensure!(max_edges > curr_length as u32, Error::<T, I>::TooManyEdges);
// craft edge
let e_meta = EdgeMetadata::<T::ChainId, T::Element, T::BlockNumber> {
src_chain_id,
root,
height,
};
// update historical neighbor list for this edge's root
let neighbor_root_inx = NextNeighborRootIndex::<T, I>::get((id, src_chain_id));
NextNeighborRootIndex::<T, I>::insert(
(id, src_chain_id),
neighbor_root_inx + T::RootIndex::one() % T::HistoryLength::get(),
);
NeighborRoots::<T, I>::insert((id, src_chain_id), neighbor_root_inx, root);
// Append new edge to the end of the edge list for the given tree
EdgeList::<T, I>::insert(id, src_chain_id, e_meta);
Ok(())
}
fn update_edge(
id: T::TreeId,
src_chain_id: T::ChainId,
root: T::Element,
height: T::BlockNumber,
) -> Result<(), DispatchError> {
ensure!(
EdgeList::<T, I>::contains_key(id, src_chain_id),
Error::<T, I>::EdgeDoesntExists
);
let e_meta = EdgeMetadata::<T::ChainId, T::Element, T::BlockNumber> {
src_chain_id,
root,
height,
};
let neighbor_root_inx = NextNeighborRootIndex::<T, I>::get((id, src_chain_id));
NextNeighborRootIndex::<T, I>::insert(
(id, src_chain_id),
neighbor_root_inx + T::RootIndex::one() % T::HistoryLength::get(),
);
NeighborRoots::<T, I>::insert((id, src_chain_id), neighbor_root_inx, root);
EdgeList::<T, I>::insert(id, src_chain_id, e_meta);
Ok(())
}
}
impl<T: Config<I>, I: 'static> AnchorInspector<T, I> for Pallet<T, I> {
fn get_neighbor_roots(tree_id: T::TreeId) -> Result<Vec<T::Element>, DispatchError> {
Ok(vec![T::Element::default()])
}
fn is_known_neighbor_root(
tree_id: T::TreeId,
src_chain_id: T::ChainId,
target_root: T::Element,
) -> Result<bool, DispatchError> {
Ok(true)
}
fn has_edge(id: T::TreeId, src_chain_id: T::ChainId) -> bool {
EdgeList::<T, I>::contains_key(id, src_chain_id)
}
}
|
//! # USB peripheral.
//!
//! Mostly builds upon the [`stm32_usbd`] crate.
//!
//! ## Examples
//!
//! See [examples/usb_serial.rs] for a usage example.
//!
//! [examples/usb_serial.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.7.0/examples/usb_serial.rs
use crate::pac::{RCC, USB};
use stm32_usbd::UsbPeripheral;
use crate::gpio::gpioa::{PA11, PA12};
use crate::gpio::{PushPull, AF14};
pub use stm32_usbd::UsbBus;
/// USB Peripheral
///
/// Constructs the peripheral, which
/// than gets passed to the [`UsbBus`].
pub struct Peripheral {
/// USB Register Block
pub usb: USB,
/// Data Negativ Pin
pub pin_dm: PA11<AF14<PushPull>>,
/// Data Positiv Pin
pub pin_dp: PA12<AF14<PushPull>>,
}
unsafe impl Sync for Peripheral {}
unsafe impl UsbPeripheral for Peripheral {
const REGISTERS: *const () = USB::ptr() as *const ();
const DP_PULL_UP_FEATURE: bool = false;
const EP_MEMORY: *const () = 0x4000_6000 as _;
#[cfg(any(feature = "stm32f303xb", feature = "stm32f303xc"))]
const EP_MEMORY_SIZE: usize = 512;
#[cfg(any(feature = "stm32f303xd", feature = "stm32f303xe"))]
const EP_MEMORY_SIZE: usize = 1024;
#[cfg(any(feature = "stm32f303xb", feature = "stm32f303xc"))]
const EP_MEMORY_ACCESS_2X16: bool = false;
#[cfg(any(feature = "stm32f303xd", feature = "stm32f303xe"))]
const EP_MEMORY_ACCESS_2X16: bool = true;
fn enable() {
let rcc = unsafe { &*RCC::ptr() };
cortex_m::interrupt::free(|_| {
// Enable USB peripheral
rcc.apb1enr.modify(|_, w| w.usben().enabled());
// Reset USB peripheral
rcc.apb1rstr.modify(|_, w| w.usbrst().reset());
rcc.apb1rstr.modify(|_, w| w.usbrst().clear_bit());
});
}
fn startup_delay() {
// There is a chip specific startup delay. For STM32F103xx it's 1µs and this should wait for
// at least that long.
// 72 Mhz is the highest frequency, so this ensures a minimum of 1µs wait time.
cortex_m::asm::delay(72);
}
}
/// Type of the UsbBus
///
/// As this MCU family has only USB peripheral,
/// this is the only possible concrete type construction.
pub type UsbBusType = UsbBus<Peripheral>;
|
//! Load WAV files
use crate::audio::GenericMusicStream;
use std::io;
use cpal::Sample;
use either::Either;
pub(super) fn decode<R: io::Read + Send + 'static>(reader: R) -> Result<GenericMusicStream<impl Iterator<Item = f32>>, String> {
let buf_reader = io::BufReader::new(reader);
let wav_reader = hound::WavReader::new(buf_reader).map_err(|e| e.to_string())?;
let format = wav_reader.spec();
let channel_count = format.channels;
let sample_rate = format.sample_rate;
let samples = match format.sample_format {
hound::SampleFormat::Int => {
Either::Left(
wav_reader
.into_samples::<i16>()
.map(|s| {
match s {
Ok(s) => s.to_f32(),
Err(e) => {
remani_warn!("wav read error: {}", e);
0.0
}
}
})
)
}
hound::SampleFormat::Float => {
Either::Right(
wav_reader
.into_samples::<f32>()
.map(|s| {
match s {
Ok(s) => s,
Err(e) => {
remani_warn!("wav read error: {}", e);
0.0
},
}
})
)
}
};
Ok(GenericMusicStream {
samples,
channel_count: channel_count as u8,
sample_rate,
})
}
|
use super::error::{PineError, PineErrorKind, PineResult};
use super::input::{Input, StrRange};
use super::utils::skip_ws;
use nom::{
branch::alt,
bytes::complete::{escaped, is_not, tag, take_until},
character::complete::one_of,
sequence::delimited,
sequence::preceded,
Err,
};
const ESCAPE_CODE: &'static str = "\'\"\\\n0123456789abfnrtv";
#[derive(Clone, Debug, PartialEq)]
pub struct StringNode {
pub value: String,
pub range: StrRange,
}
impl StringNode {
pub fn new(value: String, range: StrRange) -> StringNode {
StringNode { value, range }
}
}
enum ControlChar {
Byte(u8),
}
// Given b, returns the corresponding escaped char for \<b>
fn control_char_lookup(b: u8) -> Option<ControlChar> {
match b {
b'\\' => Some(ControlChar::Byte(b'\\')),
b'\'' => Some(ControlChar::Byte(b'\'')),
b'\"' => Some(ControlChar::Byte(b'\"')),
b'\n' => Some(ControlChar::Byte(b'\n')),
b'0' | b'1' | b'2' | b'3' | b'4' | b'5' | b'6' | b'7' | b'8' | b'9' => {
Some(ControlChar::Byte(b - '0' as u8))
}
b'a' => Some(ControlChar::Byte(0x07)), // bell
b'b' => Some(ControlChar::Byte(0x08)), // backspace
b'f' => Some(ControlChar::Byte(0x0c)), // form feed
b'n' => Some(ControlChar::Byte(b'\n')), // newline
b'r' => Some(ControlChar::Byte(0x0d)), // carriage return
b't' => Some(ControlChar::Byte(0x09)), // horizontal tab
b'v' => Some(ControlChar::Byte(0x0b)), // vertical tab
_ => None,
}
}
pub fn unescape(buf: &str) -> Result<String, PineErrorKind> {
if buf.len() == 0 {
return Ok(String::from(""));
}
match take_until("\\")(buf) {
Ok((buf, matched)) => {
let ctrl_char = buf.as_bytes()[1];
match control_char_lookup(ctrl_char) {
Some(ControlChar::Byte(c)) => Ok([
matched,
String::from_utf8_lossy(&[c]).as_ref(),
unescape(&buf[2..])?.as_ref(),
]
.concat()),
None => Err(PineErrorKind::InvalidCtrlInStrLiteral),
}
}
Err(Err::Error(PineError { errors: _ })) => Ok(String::from(buf)),
_ => Err(PineErrorKind::InvalidStrLiteral),
}
}
fn gen_quote_str(quote_char: &'static str) -> impl Fn(Input) -> PineResult<StringNode> {
move |input: Input| {
let ignore_chars = ["\n\\", quote_char].join("");
let (next_input, out) = delimited(
tag(quote_char),
escaped(is_not(&ignore_chars[..]), '\\', one_of(ESCAPE_CODE)),
tag(quote_char),
)(input)?;
match unescape(out.src) {
Ok(res_str) => Ok((
next_input,
StringNode::new(res_str, StrRange::from_input(&out)),
)),
Err(err_str) => Err(Err::Error(PineError::from_pine_kind(input, err_str))),
}
}
}
pub fn string_lit(input: Input) -> PineResult<StringNode> {
alt((gen_quote_str("\""), gen_quote_str("'")))(input)
}
pub fn string_lit_ws(input: Input) -> PineResult<StringNode> {
preceded(skip_ws, alt((gen_quote_str("\""), gen_quote_str("'"))))(input)
}
#[cfg(test)]
mod tests {
use super::super::input::Position;
use super::*;
use std::convert::TryInto;
#[test]
fn unescape_test() {
assert_eq!(unescape(r"\\hello"), Ok(String::from("\\hello")));
assert_eq!(unescape(r"\\hello\t\'"), Ok(String::from("\\hello\t\'")));
assert_eq!(
unescape("\\\\hello\\t\\\""),
Ok(String::from("\\hello\t\""))
);
}
#[test]
fn string_lit_test() {
let test_input = Input::new_with_str(r"'hello \' world'ding");
let input_len: u32 = test_input.len().try_into().unwrap();
assert_eq!(
string_lit(test_input),
Ok((
Input::new("ding", Position::new(0, input_len - 4), Position::max()),
StringNode::new(
String::from("hello ' world"),
StrRange::new(Position::new(0, 1), Position::new(0, 15))
)
))
);
let test_input = Input::new_with_str("\"hello \' world\"ding");
let input_len: u32 = test_input.len().try_into().unwrap();
assert_eq!(
string_lit(test_input),
Ok((
Input::new("ding", Position::new(0, input_len - 4), Position::max()),
StringNode::new(
String::from("hello ' world"),
StrRange::new(Position::new(0, 1), Position::new(0, 14))
)
))
);
}
}
|
use std::collections::LinkedList;
/// A text editing operation
#[derive(Clone)]
pub enum Operation {
InsertText(String, usize),
RemoveTextBefore(String, usize),
RemoveTextAfter(String, usize),
MoveText(usize, usize, usize),
CompositeOp(Vec<Operation>),
}
/// An undo/redo stack of text editing operations
pub struct UndoStack {
stack_a: LinkedList<Operation>,
stack_b: LinkedList<Operation>,
}
impl UndoStack {
pub fn new() -> UndoStack {
UndoStack {
stack_a: LinkedList::new(),
stack_b: LinkedList::new(),
}
}
pub fn push(&mut self, op: Operation) {
self.stack_a.push_back(op);
self.stack_b.clear();
}
pub fn prev(&mut self) -> Option<Operation> {
if let Some(op) = self.stack_a.pop_back() {
self.stack_b.push_back(op.clone());
return Some(op);
} else {
return None;
}
}
pub fn next(&mut self) -> Option<Operation> {
if let Some(op) = self.stack_b.pop_back() {
self.stack_a.push_back(op.clone());
return Some(op);
} else {
return None;
}
}
}
|
use std::sync::Mutex;
use std::thread;
#[derive(Debug)]
pub struct InnerThread(Mutex<Option<thread::JoinHandle<()>>>);
impl InnerThread {
pub fn new(join_handle: thread::JoinHandle<()>) -> Self {
Self(Mutex::new(Some(join_handle)))
}
pub fn join(&self) {
self.0.lock().unwrap().take().unwrap().join().ok();
}
}
|
mod compiler;
mod scratch;
pub fn compile(
module: &mut impl cranelift_module::Module,
file: impl std::io::Read + std::io::Seek,
) {
let project = scratch::ProjectInfo::new(file).unwrap();
let mut variables = vec![];
let mut procedures = vec![];
let mut scripts = vec![];
for target in project.targets {
let target = scratch::Target::hydrate(target);
for var in target.variables.keys() {
variables.push(var.clone());
}
for proc in target.procedures {
procedures.push(proc);
}
for script in target.scripts {
scripts.push(script);
}
}
compiler::compile(module, &variables, &procedures, &scripts);
}
pub fn compile_native(file: impl std::io::Read + std::io::Seek, out_name: &str) {
let o = {
use cranelift::prelude::*;
let mut flag_builder = settings::builder();
flag_builder.set("is_pic", "true").unwrap();
flag_builder.set("opt_level", "speed_and_size").unwrap();
let flags = settings::Flags::new(flag_builder);
let isa = cranelift_native::builder().unwrap().finish(flags);
let mut module = cranelift_object::ObjectModule::new(
cranelift_object::ObjectBuilder::new(
isa,
"",
cranelift_module::default_libcall_names(),
)
.unwrap(),
);
compile(&mut module, file);
module.finish().emit().unwrap()
};
// FIXME: this is terrible
let tmp = std::env::temp_dir();
std::fs::write(tmp.join("out.o"), o).unwrap();
std::fs::write(
tmp.join("libsupport.a"),
include_bytes!(concat!(env!("OUT_DIR"), "/libsupport.a")),
)
.unwrap();
let mut args = vec![
"-O3".to_owned(),
tmp.join("out.o").to_str().unwrap().to_owned(),
tmp.join("libsupport.a").to_str().unwrap().to_owned(),
"-o".to_owned(),
out_name.to_owned(),
];
for arg in include!(concat!(env!("OUT_DIR"), "/libsupport_libs.rs")) {
args.push(arg.to_string());
}
let r = std::process::Command::new("clang++")
.args(args)
.output()
.unwrap();
if !r.status.success() {
panic!("{}", String::from_utf8(r.stderr).unwrap());
}
}
|
use std::cmp::min;
use line_drawing::Bresenham;
use line_drawing::XiaolinWu;
use Canvas;
use Drawable;
/// A drawable object that represents a line
pub struct Line {
/// The first point of the line
pub pt1: (usize, usize),
/// The second point of the line
pub pt2: (usize, usize),
/// The color of the line
pub color: [u8; 4],
/// Decides whether the line will be antialiased
pub antialiased: bool,
}
impl Line {
/// Creates a new Line object
pub fn new(
pt1: (usize, usize),
pt2: (usize, usize),
color: [u8; 4],
antialiased: bool,
) -> Line {
Line {
pt1,
pt2,
color,
antialiased,
}
}
}
impl Drawable for Line {
fn draw(&self, canvas: &mut Canvas) {
if !self.antialiased {
if self.pt1.0 == self.pt2.0 && self.pt1.0 < canvas.width {
let (min_y, max_y) = if self.pt1.1 > self.pt2.1 {
(self.pt2.1, self.pt1.1)
} else {
(self.pt1.1, self.pt2.1)
};
for y in min_y..min(max_y, canvas.height - 1) + 1 {
canvas.draw_point(self.pt1.0, y, self.color)
}
} else if self.pt1.1 == self.pt2.1 && self.pt1.1 < canvas.height {
let (min_x, max_x) = if self.pt1.0 > self.pt2.0 {
(self.pt2.0, self.pt1.0)
} else {
(self.pt1.0, self.pt2.0)
};
for x in min_x..min(max_x, canvas.width - 1) + 1 {
canvas.draw_point(x, self.pt1.1, self.color)
}
} else {
// Angled line without antialias
for (x, y) in Bresenham::new(
(self.pt1.0 as isize, self.pt1.1 as isize),
(self.pt2.0 as isize, self.pt2.1 as isize),
) {
if x < canvas.width as isize && y < canvas.height as isize {
canvas.draw_point(x as usize, y as usize, self.color)
}
}
}
} else {
// Angled line with antialias
for ((x, y), coverage) in XiaolinWu::<f32, isize>::new(
(self.pt1.0 as f32, self.pt1.1 as f32),
(self.pt2.0 as f32, self.pt2.1 as f32),
) {
if x < canvas.width as isize && y < canvas.height as isize {
let mut color = self.color;
color[3] = (f32::from(color[3]) * coverage) as u8;
canvas.draw_point(x as usize, y as usize, color)
}
}
}
}
}
|
#![allow(non_upper_case_globals)]
extern crate log;
extern crate rand;
extern crate regex;
extern crate etherparse;
extern crate lazy_static;
use lazy_static::lazy_static;
use crate::utils;
use regex::Regex;
use std::sync::{mpsc, Mutex};
use etherparse::PacketBuilder;
use crate::config::tcp_rule::TcpRule;
#[allow(unused_imports)]
use log::{trace, debug, info, warn, error};
lazy_static! {
static ref time_unix: u64 = utils::get_unix_time();
static ref time_formatted: String = utils::get_formatted_time();
static ref module_type: u8 = utils::consts::MODULE_TYPE_ACTIVE;
static ref module_name:&'static str = "TCP Hijack";
static ref module_info:&'static str = "Reset, fuzz or hijack tcp session";
static ref risk_type: u8 = utils::consts::RISK_TYPE_OTHER;
static ref risk_level: u8 = utils::consts::RISK_LEVEL_LOG;
static ref src: Mutex<String> = Mutex::new(String::new());
}
pub fn get_packet(pkt: &[u8], rules: &TcpRule, db_tx: mpsc::Sender<String>) -> Option<Vec<u8>> {
// I was going to use SlicedPacket here, for faster speed...
// However, XXX_HeaderSlice.source() or any other functions return &[u8],
// and PacketBuilder only accepts array with fixed length, like [u8; 8].
// So, we stick to PacketHeaders here...
/* let builder = match pkt.link {
Some(etherparse::LinkSlice::Ethernet2(header)) => {
let dst_mac = header.source();
let src_mac = header.destination();
let dst: [u8;6] = [0;6];
let src: [u8;6] = [0;6];
dst.copy_from_slice(dst_mac);
src.copy_from_slice(src_mac);
PacketBuilder::ethernet2(src, dst)
}
};
*/
let pkt = etherparse::PacketHeaders::from_ethernet_slice(pkt).unwrap();
*src.lock().unwrap() = utils::src_dst_proto_from_IpHeader(&pkt.ip).0;
// handle transport layer first, returns if not in the filter
let dst_mac = pkt.link.as_ref().unwrap().source;
let src_mac = pkt.link.as_ref().unwrap().destination;
let transport = pkt.transport.unwrap().tcp().unwrap();
if transport.rst || transport.fin { return None; }
let mut log_line = String::new();
let (builder, ip_payload_len, action) = match pkt.ip.as_ref().unwrap() {
etherparse::IpHeader::Version4(header) => {
match rules.get_Action(&header.source, transport.source_port, &header.destination, transport.destination_port) {
Some(action) => {
log_line = format!("TCP Hijack: {}.{}.{}.{}:{} => {}.{}.{}.{}:{}, ",
header.source[0],header.source[1],header.source[2],header.source[3], transport.source_port,
header.destination[0],header.destination[1],header.destination[2],header.destination[3],
transport.destination_port);
(
PacketBuilder::ethernet2(src_mac, dst_mac).ipv4(header.destination, header.source, 64),
header.payload_len,
action
)},
None => return None
}
},
etherparse::IpHeader::Version6(header) =>{
// TODO IPv6 addr match, we may use u128 in TcpRule.
match rules.get_Action6(&header.source, transport.source_port, &header.destination, transport.destination_port) {
Some(action) => {
(
PacketBuilder::ethernet2(src_mac, dst_mac).ipv6(header.destination, header.source, 64),
header.payload_length, //include the length of extension headers
action
)},
None => return None
}
}
};
let dst_port = transport.source_port;
let src_port = transport.destination_port;
let seq = transport.acknowledgment_number;
let mut ack = transport.sequence_number
+ ip_payload_len as u32
- transport.header_len() as u32; // minus the TCP header length, options length included
if transport.syn{
if action.reset{
ack += 1; // the handshake, transport.acknowledgment_number == 0
}
else {
log_line = format!("{}action: [none]", log_line);
debug!("{}", log_line);
db_tx.send(format!("insert into t_result values(null, '{}', '{}', '{}', {}, '{}', '{}', {}, {}, '{}', 0 )",
*time_unix, *time_formatted, *src.lock().unwrap(), *module_type, *module_name,
*module_info, *risk_type, *risk_level, log_line )).unwrap();
return None; // too early for TCP inject
}
}
let (builder, payload) = match &action.inject {
None if action.reset => {
// reset
log_line = format!("{}action: [reset]", log_line);
let window = 0;
let payload = b"TCP Reset -- Cylons".to_vec();
(
builder
.tcp(src_port, dst_port, seq, window)
.ack(ack)
.rst(),
payload
)
},
None if action.fuzz => {
// fuzz
let window = 1024; // ??
let mut payload = vec![0u8; rand::random::<usize>() % 1024];
log_line = format!("{}action: [fuzz], random data size: {}", log_line, payload.len());
for i in &mut payload {
*i = rand::random::<u8>();
}
(
builder
.tcp(src_port, dst_port, seq, window)
.ack(ack),
payload
)
},
Some((payload_pattern, payload_response)) if !action.reset && match_payload_pattern(pkt.payload, payload_pattern)=> {
// inject or fuzz
let payload = if action.fuzz { // if action.fuzz, we response random data instead of user specified data
let mut payload_random = vec![0u8; rand::random::<usize>() % 1024];
log_line = format!("{}action: [fuzz on packet pattern], random data size: {}", log_line, payload_random.len());
for i in &mut payload_random {
*i = rand::random::<u8>();
}
payload_random
}
else {
log_line = format!("{}action: [inject]", log_line);
payload_response.to_owned()
};
let window = 1024; // ??
(
builder
.tcp(src_port, dst_port, seq, window)
.ack(ack),
payload
)
},
_ => {
log_line = format!("{}action: [none]", log_line);
debug!("{}", log_line);
db_tx.send(format!("insert into t_result values(null, '{}', '{}', '{}', {}, '{}', '{}', {}, {}, '{}', 0 )",
*time_unix, *time_formatted, *src.lock().unwrap(), *module_type, *module_name,
*module_info, *risk_type, *risk_level, log_line )).unwrap();
return None;
}
};
debug!("{}", log_line);
db_tx.send(format!("insert into t_result values(null, '{}', '{}', '{}', {}, '{}', '{}', {}, {}, '{}', 0 )",
*time_unix, *time_formatted, *src.lock().unwrap(), *module_type, *module_name,
*module_info, *risk_type, *risk_level, log_line )).unwrap();
//get some memory to store the result
let mut result = Vec::<u8>::with_capacity(
builder.size(0));
//serialize
builder.write(&mut result, &payload).unwrap();
Some(result)
}
pub fn match_payload_pattern(packet: &[u8], pattern: &str) -> bool {
// packet to hex string '\x01\x02\x03'
let packet_hex_str = packet.iter().map(|i|format!("{:02x}", i)).collect::<String>();
Regex::new(pattern).unwrap().is_match(&packet_hex_str)
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: clone :: Clone)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct AAAccountingData {
pub userName: super::super::Foundation::BSTR,
pub clientName: super::super::Foundation::BSTR,
pub authType: AAAuthSchemes,
pub resourceName: super::super::Foundation::BSTR,
pub portNumber: i32,
pub protocolName: super::super::Foundation::BSTR,
pub numberOfBytesReceived: i32,
pub numberOfBytesTransfered: i32,
pub reasonForDisconnect: super::super::Foundation::BSTR,
pub mainSessionId: ::windows::core::GUID,
pub subSessionId: i32,
}
#[cfg(feature = "Win32_Foundation")]
impl AAAccountingData {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AAAccountingData {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for AAAccountingData {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AAAccountingData")
.field("userName", &self.userName)
.field("clientName", &self.clientName)
.field("authType", &self.authType)
.field("resourceName", &self.resourceName)
.field("portNumber", &self.portNumber)
.field("protocolName", &self.protocolName)
.field("numberOfBytesReceived", &self.numberOfBytesReceived)
.field("numberOfBytesTransfered", &self.numberOfBytesTransfered)
.field("reasonForDisconnect", &self.reasonForDisconnect)
.field("mainSessionId", &self.mainSessionId)
.field("subSessionId", &self.subSessionId)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AAAccountingData {
fn eq(&self, other: &Self) -> bool {
self.userName == other.userName
&& self.clientName == other.clientName
&& self.authType == other.authType
&& self.resourceName == other.resourceName
&& self.portNumber == other.portNumber
&& self.protocolName == other.protocolName
&& self.numberOfBytesReceived == other.numberOfBytesReceived
&& self.numberOfBytesTransfered == other.numberOfBytesTransfered
&& self.reasonForDisconnect == other.reasonForDisconnect
&& self.mainSessionId == other.mainSessionId
&& self.subSessionId == other.subSessionId
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AAAccountingData {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AAAccountingData {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AAAccountingDataType(pub i32);
pub const AA_MAIN_SESSION_CREATION: AAAccountingDataType = AAAccountingDataType(0i32);
pub const AA_SUB_SESSION_CREATION: AAAccountingDataType = AAAccountingDataType(1i32);
pub const AA_SUB_SESSION_CLOSED: AAAccountingDataType = AAAccountingDataType(2i32);
pub const AA_MAIN_SESSION_CLOSED: AAAccountingDataType = AAAccountingDataType(3i32);
impl ::core::convert::From<i32> for AAAccountingDataType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AAAccountingDataType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AAAuthSchemes(pub i32);
pub const AA_AUTH_MIN: AAAuthSchemes = AAAuthSchemes(0i32);
pub const AA_AUTH_BASIC: AAAuthSchemes = AAAuthSchemes(1i32);
pub const AA_AUTH_NTLM: AAAuthSchemes = AAAuthSchemes(2i32);
pub const AA_AUTH_SC: AAAuthSchemes = AAAuthSchemes(3i32);
pub const AA_AUTH_LOGGEDONCREDENTIALS: AAAuthSchemes = AAAuthSchemes(4i32);
pub const AA_AUTH_NEGOTIATE: AAAuthSchemes = AAAuthSchemes(5i32);
pub const AA_AUTH_ANY: AAAuthSchemes = AAAuthSchemes(6i32);
pub const AA_AUTH_COOKIE: AAAuthSchemes = AAAuthSchemes(7i32);
pub const AA_AUTH_DIGEST: AAAuthSchemes = AAAuthSchemes(8i32);
pub const AA_AUTH_ORGID: AAAuthSchemes = AAAuthSchemes(9i32);
pub const AA_AUTH_CONID: AAAuthSchemes = AAAuthSchemes(10i32);
pub const AA_AUTH_SSPI_NTLM: AAAuthSchemes = AAAuthSchemes(11i32);
pub const AA_AUTH_MAX: AAAuthSchemes = AAAuthSchemes(12i32);
impl ::core::convert::From<i32> for AAAuthSchemes {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AAAuthSchemes {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AATrustClassID(pub i32);
pub const AA_UNTRUSTED: AATrustClassID = AATrustClassID(0i32);
pub const AA_TRUSTEDUSER_UNTRUSTEDCLIENT: AATrustClassID = AATrustClassID(1i32);
pub const AA_TRUSTEDUSER_TRUSTEDCLIENT: AATrustClassID = AATrustClassID(2i32);
impl ::core::convert::From<i32> for AATrustClassID {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AATrustClassID {
type Abi = Self;
}
pub const ACQUIRE_TARGET_LOCK_TIMEOUT: u32 = 300000u32;
pub const ADsTSUserEx: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe2e9cae6_1e7b_4b8e_babd_e9bf6292ac29);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct AE_CURRENT_POSITION {
pub u64DevicePosition: u64,
pub u64StreamPosition: u64,
pub u64PaddingFrames: u64,
pub hnsQPCPosition: i64,
pub f32FramesPerSecond: f32,
pub Flag: AE_POSITION_FLAGS,
}
impl AE_CURRENT_POSITION {}
impl ::core::default::Default for AE_CURRENT_POSITION {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for AE_CURRENT_POSITION {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AE_CURRENT_POSITION")
.field("u64DevicePosition", &self.u64DevicePosition)
.field("u64StreamPosition", &self.u64StreamPosition)
.field("u64PaddingFrames", &self.u64PaddingFrames)
.field("hnsQPCPosition", &self.hnsQPCPosition)
.field("f32FramesPerSecond", &self.f32FramesPerSecond)
.field("Flag", &self.Flag)
.finish()
}
}
impl ::core::cmp::PartialEq for AE_CURRENT_POSITION {
fn eq(&self, other: &Self) -> bool {
self.u64DevicePosition == other.u64DevicePosition && self.u64StreamPosition == other.u64StreamPosition && self.u64PaddingFrames == other.u64PaddingFrames && self.hnsQPCPosition == other.hnsQPCPosition && self.f32FramesPerSecond == other.f32FramesPerSecond && self.Flag == other.Flag
}
}
impl ::core::cmp::Eq for AE_CURRENT_POSITION {}
unsafe impl ::windows::core::Abi for AE_CURRENT_POSITION {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AE_POSITION_FLAGS(pub i32);
pub const POSITION_INVALID: AE_POSITION_FLAGS = AE_POSITION_FLAGS(0i32);
pub const POSITION_DISCONTINUOUS: AE_POSITION_FLAGS = AE_POSITION_FLAGS(1i32);
pub const POSITION_CONTINUOUS: AE_POSITION_FLAGS = AE_POSITION_FLAGS(2i32);
pub const POSITION_QPC_ERROR: AE_POSITION_FLAGS = AE_POSITION_FLAGS(4i32);
impl ::core::convert::From<i32> for AE_POSITION_FLAGS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AE_POSITION_FLAGS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct BITMAP_RENDERER_STATISTICS {
pub dwFramesDelivered: u32,
pub dwFramesDropped: u32,
}
impl BITMAP_RENDERER_STATISTICS {}
impl ::core::default::Default for BITMAP_RENDERER_STATISTICS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for BITMAP_RENDERER_STATISTICS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("BITMAP_RENDERER_STATISTICS").field("dwFramesDelivered", &self.dwFramesDelivered).field("dwFramesDropped", &self.dwFramesDropped).finish()
}
}
impl ::core::cmp::PartialEq for BITMAP_RENDERER_STATISTICS {
fn eq(&self, other: &Self) -> bool {
self.dwFramesDelivered == other.dwFramesDelivered && self.dwFramesDropped == other.dwFramesDropped
}
}
impl ::core::cmp::Eq for BITMAP_RENDERER_STATISTICS {}
unsafe impl ::windows::core::Abi for BITMAP_RENDERER_STATISTICS {
type Abi = Self;
}
pub const CHANNEL_BUFFER_SIZE: u32 = 65535u32;
pub const CHANNEL_CHUNK_LENGTH: u32 = 1600u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct CHANNEL_DEF {
pub name: [super::super::Foundation::CHAR; 8],
pub options: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl CHANNEL_DEF {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for CHANNEL_DEF {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for CHANNEL_DEF {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for CHANNEL_DEF {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for CHANNEL_DEF {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct CHANNEL_ENTRY_POINTS {
pub cbSize: u32,
pub protocolVersion: u32,
pub pVirtualChannelInit: ::core::option::Option<PVIRTUALCHANNELINIT>,
pub pVirtualChannelOpen: ::core::option::Option<PVIRTUALCHANNELOPEN>,
pub pVirtualChannelClose: ::core::option::Option<PVIRTUALCHANNELCLOSE>,
pub pVirtualChannelWrite: ::core::option::Option<PVIRTUALCHANNELWRITE>,
}
#[cfg(feature = "Win32_Foundation")]
impl CHANNEL_ENTRY_POINTS {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for CHANNEL_ENTRY_POINTS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for CHANNEL_ENTRY_POINTS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("CHANNEL_ENTRY_POINTS").field("cbSize", &self.cbSize).field("protocolVersion", &self.protocolVersion).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for CHANNEL_ENTRY_POINTS {
fn eq(&self, other: &Self) -> bool {
self.cbSize == other.cbSize && self.protocolVersion == other.protocolVersion && self.pVirtualChannelInit.map(|f| f as usize) == other.pVirtualChannelInit.map(|f| f as usize) && self.pVirtualChannelOpen.map(|f| f as usize) == other.pVirtualChannelOpen.map(|f| f as usize) && self.pVirtualChannelClose.map(|f| f as usize) == other.pVirtualChannelClose.map(|f| f as usize) && self.pVirtualChannelWrite.map(|f| f as usize) == other.pVirtualChannelWrite.map(|f| f as usize)
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for CHANNEL_ENTRY_POINTS {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for CHANNEL_ENTRY_POINTS {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
pub const CHANNEL_EVENT_CONNECTED: u32 = 1u32;
pub const CHANNEL_EVENT_DATA_RECEIVED: u32 = 10u32;
pub const CHANNEL_EVENT_DISCONNECTED: u32 = 3u32;
pub const CHANNEL_EVENT_INITIALIZED: u32 = 0u32;
pub const CHANNEL_EVENT_TERMINATED: u32 = 4u32;
pub const CHANNEL_EVENT_V1_CONNECTED: u32 = 2u32;
pub const CHANNEL_EVENT_WRITE_CANCELLED: u32 = 12u32;
pub const CHANNEL_EVENT_WRITE_COMPLETE: u32 = 11u32;
pub const CHANNEL_FLAG_FAIL: u32 = 256u32;
pub const CHANNEL_FLAG_FIRST: u32 = 1u32;
pub const CHANNEL_FLAG_LAST: u32 = 2u32;
pub const CHANNEL_FLAG_MIDDLE: u32 = 0u32;
pub const CHANNEL_MAX_COUNT: u32 = 30u32;
pub const CHANNEL_NAME_LEN: u32 = 7u32;
pub const CHANNEL_OPTION_COMPRESS: u32 = 4194304u32;
pub const CHANNEL_OPTION_COMPRESS_RDP: u32 = 8388608u32;
pub const CHANNEL_OPTION_ENCRYPT_CS: u32 = 268435456u32;
pub const CHANNEL_OPTION_ENCRYPT_RDP: u32 = 1073741824u32;
pub const CHANNEL_OPTION_ENCRYPT_SC: u32 = 536870912u32;
pub const CHANNEL_OPTION_INITIALIZED: u32 = 2147483648u32;
pub const CHANNEL_OPTION_PRI_HIGH: u32 = 134217728u32;
pub const CHANNEL_OPTION_PRI_LOW: u32 = 33554432u32;
pub const CHANNEL_OPTION_PRI_MED: u32 = 67108864u32;
pub const CHANNEL_OPTION_REMOTE_CONTROL_PERSISTENT: u32 = 1048576u32;
pub const CHANNEL_OPTION_SHOW_PROTOCOL: u32 = 2097152u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct CHANNEL_PDU_HEADER {
pub length: u32,
pub flags: u32,
}
impl CHANNEL_PDU_HEADER {}
impl ::core::default::Default for CHANNEL_PDU_HEADER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for CHANNEL_PDU_HEADER {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("CHANNEL_PDU_HEADER").field("length", &self.length).field("flags", &self.flags).finish()
}
}
impl ::core::cmp::PartialEq for CHANNEL_PDU_HEADER {
fn eq(&self, other: &Self) -> bool {
self.length == other.length && self.flags == other.flags
}
}
impl ::core::cmp::Eq for CHANNEL_PDU_HEADER {}
unsafe impl ::windows::core::Abi for CHANNEL_PDU_HEADER {
type Abi = Self;
}
pub const CHANNEL_RC_ALREADY_CONNECTED: u32 = 3u32;
pub const CHANNEL_RC_ALREADY_INITIALIZED: u32 = 1u32;
pub const CHANNEL_RC_ALREADY_OPEN: u32 = 14u32;
pub const CHANNEL_RC_BAD_CHANNEL: u32 = 6u32;
pub const CHANNEL_RC_BAD_CHANNEL_HANDLE: u32 = 7u32;
pub const CHANNEL_RC_BAD_INIT_HANDLE: u32 = 9u32;
pub const CHANNEL_RC_BAD_PROC: u32 = 11u32;
pub const CHANNEL_RC_INITIALIZATION_ERROR: u32 = 20u32;
pub const CHANNEL_RC_INVALID_INSTANCE: u32 = 18u32;
pub const CHANNEL_RC_NOT_CONNECTED: u32 = 4u32;
pub const CHANNEL_RC_NOT_INITIALIZED: u32 = 2u32;
pub const CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY: u32 = 15u32;
pub const CHANNEL_RC_NOT_OPEN: u32 = 10u32;
pub const CHANNEL_RC_NO_BUFFER: u32 = 8u32;
pub const CHANNEL_RC_NO_MEMORY: u32 = 12u32;
pub const CHANNEL_RC_NULL_DATA: u32 = 16u32;
pub const CHANNEL_RC_OK: u32 = 0u32;
pub const CHANNEL_RC_TOO_MANY_CHANNELS: u32 = 5u32;
pub const CHANNEL_RC_UNKNOWN_CHANNEL_NAME: u32 = 13u32;
pub const CHANNEL_RC_UNSUPPORTED_VERSION: u32 = 19u32;
pub const CHANNEL_RC_ZERO_LENGTH: u32 = 17u32;
pub const CLIENTADDRESS_LENGTH: u32 = 30u32;
pub const CLIENTNAME_LENGTH: u32 = 20u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct CLIENT_DISPLAY {
pub HorizontalResolution: u32,
pub VerticalResolution: u32,
pub ColorDepth: u32,
}
impl CLIENT_DISPLAY {}
impl ::core::default::Default for CLIENT_DISPLAY {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for CLIENT_DISPLAY {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("CLIENT_DISPLAY").field("HorizontalResolution", &self.HorizontalResolution).field("VerticalResolution", &self.VerticalResolution).field("ColorDepth", &self.ColorDepth).finish()
}
}
impl ::core::cmp::PartialEq for CLIENT_DISPLAY {
fn eq(&self, other: &Self) -> bool {
self.HorizontalResolution == other.HorizontalResolution && self.VerticalResolution == other.VerticalResolution && self.ColorDepth == other.ColorDepth
}
}
impl ::core::cmp::Eq for CLIENT_DISPLAY {}
unsafe impl ::windows::core::Abi for CLIENT_DISPLAY {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct CLIENT_MESSAGE_TYPE(pub i32);
pub const CLIENT_MESSAGE_CONNECTION_INVALID: CLIENT_MESSAGE_TYPE = CLIENT_MESSAGE_TYPE(0i32);
pub const CLIENT_MESSAGE_CONNECTION_STATUS: CLIENT_MESSAGE_TYPE = CLIENT_MESSAGE_TYPE(1i32);
pub const CLIENT_MESSAGE_CONNECTION_ERROR: CLIENT_MESSAGE_TYPE = CLIENT_MESSAGE_TYPE(2i32);
impl ::core::convert::From<i32> for CLIENT_MESSAGE_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for CLIENT_MESSAGE_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct CONNECTION_CHANGE_NOTIFICATION(pub i32);
pub const CONNECTION_REQUEST_INVALID: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(0i32);
pub const CONNECTION_REQUEST_PENDING: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(1i32);
pub const CONNECTION_REQUEST_FAILED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(2i32);
pub const CONNECTION_REQUEST_TIMEDOUT: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(3i32);
pub const CONNECTION_REQUEST_SUCCEEDED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(4i32);
pub const CONNECTION_REQUEST_CANCELLED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(5i32);
pub const CONNECTION_REQUEST_LB_COMPLETED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(6i32);
pub const CONNECTION_REQUEST_QUERY_PL_COMPLETED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(7i32);
pub const CONNECTION_REQUEST_ORCH_COMPLETED: CONNECTION_CHANGE_NOTIFICATION = CONNECTION_CHANGE_NOTIFICATION(8i32);
impl ::core::convert::From<i32> for CONNECTION_CHANGE_NOTIFICATION {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for CONNECTION_CHANGE_NOTIFICATION {
type Abi = Self;
}
pub const CONNECTION_PROPERTY_CURSOR_BLINK_DISABLED: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4b150580_fea4_4d3c_9de4_7433a66618f7);
pub const CONNECTION_PROPERTY_IDLE_TIME_WARNING: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x693f7ff5_0c4e_4d17_b8e0_1f70325e5d58);
pub const DISPID_AX_ADMINMESSAGERECEIVED: u32 = 760u32;
pub const DISPID_AX_AUTORECONNECTED: u32 = 756u32;
pub const DISPID_AX_AUTORECONNECTING: u32 = 755u32;
pub const DISPID_AX_CONNECTED: u32 = 751u32;
pub const DISPID_AX_CONNECTING: u32 = 750u32;
pub const DISPID_AX_DIALOGDISMISSED: u32 = 758u32;
pub const DISPID_AX_DIALOGDISPLAYING: u32 = 757u32;
pub const DISPID_AX_DISCONNECTED: u32 = 753u32;
pub const DISPID_AX_KEYCOMBINATIONPRESSED: u32 = 761u32;
pub const DISPID_AX_LOGINCOMPLETED: u32 = 752u32;
pub const DISPID_AX_NETWORKSTATUSCHANGED: u32 = 759u32;
pub const DISPID_AX_REMOTEDESKTOPSIZECHANGED: u32 = 762u32;
pub const DISPID_AX_STATUSCHANGED: u32 = 754u32;
pub const DISPID_AX_TOUCHPOINTERCURSORMOVED: u32 = 800u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_APPLY_SETTINGS: u32 = 722u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_ATTACH_EVENT: u32 = 706u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_CONNECT: u32 = 701u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_DELETE_SAVED_CREDENTIALS: u32 = 704u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_DETACH_EVENT: u32 = 707u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_DISCONNECT: u32 = 702u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_EXECUTE_REMOTE_ACTION: u32 = 732u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_GET_RDPPROPERTY: u32 = 721u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_GET_SNAPSHOT: u32 = 733u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_RECONNECT: u32 = 703u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_RESUME_SCREEN_UPDATES: u32 = 731u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_RETRIEVE_SETTINGS: u32 = 723u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_SET_RDPPROPERTY: u32 = 720u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_SUSPEND_SCREEN_UPDATES: u32 = 730u32;
pub const DISPID_METHOD_REMOTEDESKTOPCLIENT_UPDATE_SESSION_DISPLAYSETTINGS: u32 = 705u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_ACTIONS: u32 = 711u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_SETTINGS: u32 = 710u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_TOUCHPOINTER_ENABLED: u32 = 740u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_TOUCHPOINTER_EVENTSENABLED: u32 = 741u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_TOUCHPOINTER_POINTERSPEED: u32 = 742u32;
pub const DISPID_PROP_REMOTEDESKTOPCLIENT_TOUCH_POINTER: u32 = 712u32;
pub const DOMAIN_LENGTH: u32 = 17u32;
pub const FORCE_REJOIN: u32 = 2u32;
pub const FORCE_REJOIN_IN_CLUSTERMODE: u32 = 3u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HwtsVirtualChannelHandle(pub isize);
impl ::core::default::Default for HwtsVirtualChannelHandle {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HwtsVirtualChannelHandle {}
unsafe impl ::windows::core::Abi for HwtsVirtualChannelHandle {
type Abi = Self;
}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IADsTSUserEx(pub ::windows::core::IUnknown);
impl IADsTSUserEx {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TerminalServicesProfilePath(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTerminalServicesProfilePath<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pnewval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), pnewval.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TerminalServicesHomeDirectory(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTerminalServicesHomeDirectory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pnewval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), pnewval.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TerminalServicesHomeDrive(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTerminalServicesHomeDrive<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pnewval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), pnewval.into_param().abi()).ok()
}
pub unsafe fn AllowLogon(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetAllowLogon(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn EnableRemoteControl(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetEnableRemoteControl(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn MaxDisconnectionTime(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetMaxDisconnectionTime(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn MaxConnectionTime(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetMaxConnectionTime(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn MaxIdleTime(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetMaxIdleTime(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn ReconnectionAction(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetReconnectionAction(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn BrokenConnectionAction(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetBrokenConnectionAction(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn ConnectClientDrivesAtLogon(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetConnectClientDrivesAtLogon(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn ConnectClientPrintersAtLogon(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetConnectClientPrintersAtLogon(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
pub unsafe fn DefaultToMainPrinter(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn SetDefaultToMainPrinter(&self, newval: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), ::core::mem::transmute(newval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TerminalServicesWorkDirectory(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTerminalServicesWorkDirectory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pnewval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), pnewval.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TerminalServicesInitialProgram(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTerminalServicesInitialProgram<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pnewval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).36)(::core::mem::transmute_copy(self), pnewval.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IADsTSUserEx {
type Vtable = IADsTSUserEx_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc4930e79_2989_4462_8a60_2fcf2f2955ef);
}
impl ::core::convert::From<IADsTSUserEx> for ::windows::core::IUnknown {
fn from(value: IADsTSUserEx) -> Self {
value.0
}
}
impl ::core::convert::From<&IADsTSUserEx> for ::windows::core::IUnknown {
fn from(value: &IADsTSUserEx) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IADsTSUserEx {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IADsTSUserEx {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IADsTSUserEx> for super::Com::IDispatch {
fn from(value: IADsTSUserEx) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IADsTSUserEx> for super::Com::IDispatch {
fn from(value: &IADsTSUserEx) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IADsTSUserEx {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IADsTSUserEx {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IADsTSUserEx_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newval: i32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnewval: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioDeviceEndpoint(pub ::windows::core::IUnknown);
impl IAudioDeviceEndpoint {
pub unsafe fn SetBuffer(&self, maxperiod: i64, u32latencycoefficient: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(maxperiod), ::core::mem::transmute(u32latencycoefficient)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetRTCaps(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetEventDrivenCapable(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn WriteExclusiveModeParametersToSharedMemory(&self, htargetprocess: usize, hnsperiod: i64, hnsbufferduration: i64, u32latencycoefficient: u32, pu32sharedmemorysize: *mut u32, phsharedmemory: *mut usize) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(htargetprocess), ::core::mem::transmute(hnsperiod), ::core::mem::transmute(hnsbufferduration), ::core::mem::transmute(u32latencycoefficient), ::core::mem::transmute(pu32sharedmemorysize), ::core::mem::transmute(phsharedmemory)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioDeviceEndpoint {
type Vtable = IAudioDeviceEndpoint_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd4952f5a_a0b2_4cc4_8b82_9358488dd8ac);
}
impl ::core::convert::From<IAudioDeviceEndpoint> for ::windows::core::IUnknown {
fn from(value: IAudioDeviceEndpoint) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioDeviceEndpoint> for ::windows::core::IUnknown {
fn from(value: &IAudioDeviceEndpoint) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioDeviceEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioDeviceEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioDeviceEndpoint_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, maxperiod: i64, u32latencycoefficient: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbisrtcapable: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbiseventcapable: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, htargetprocess: usize, hnsperiod: i64, hnsbufferduration: i64, u32latencycoefficient: u32, pu32sharedmemorysize: *mut u32, phsharedmemory: *mut usize) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioEndpoint(pub ::windows::core::IUnknown);
impl IAudioEndpoint {
#[cfg(feature = "Win32_Media_Audio")]
pub unsafe fn GetFrameFormat(&self) -> ::windows::core::Result<*mut super::super::Media::Audio::WAVEFORMATEX> {
let mut result__: <*mut super::super::Media::Audio::WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut super::super::Media::Audio::WAVEFORMATEX>(result__)
}
pub unsafe fn GetFramesPerPacket(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLatency(&self) -> ::windows::core::Result<i64> {
let mut result__: <i64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i64>(result__)
}
pub unsafe fn SetStreamFlags(&self, streamflags: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(streamflags)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEventHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(&self, eventhandle: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), eventhandle.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioEndpoint {
type Vtable = IAudioEndpoint_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x30a99515_1527_4451_af9f_00c5f0234daf);
}
impl ::core::convert::From<IAudioEndpoint> for ::windows::core::IUnknown {
fn from(value: IAudioEndpoint) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioEndpoint> for ::windows::core::IUnknown {
fn from(value: &IAudioEndpoint) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioEndpoint_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Media_Audio")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppformat: *mut *mut super::super::Media::Audio::WAVEFORMATEX) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Media_Audio"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pframesperpacket: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, platency: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, streamflags: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventhandle: super::super::Foundation::HANDLE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioEndpointControl(pub ::windows::core::IUnknown);
impl IAudioEndpointControl {
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioEndpointControl {
type Vtable = IAudioEndpointControl_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc684b72a_6df4_4774_bdf9_76b77509b653);
}
impl ::core::convert::From<IAudioEndpointControl> for ::windows::core::IUnknown {
fn from(value: IAudioEndpointControl) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioEndpointControl> for ::windows::core::IUnknown {
fn from(value: &IAudioEndpointControl) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioEndpointControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioEndpointControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioEndpointControl_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioEndpointRT(pub ::windows::core::IUnknown);
impl IAudioEndpointRT {
pub unsafe fn GetCurrentPadding(&self, ppadding: *mut i64, paecurrentposition: *mut AE_CURRENT_POSITION) {
::core::mem::transmute((::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppadding), ::core::mem::transmute(paecurrentposition)))
}
pub unsafe fn ProcessingComplete(&self) {
::core::mem::transmute((::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)))
}
pub unsafe fn SetPinInactive(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn SetPinActive(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioEndpointRT {
type Vtable = IAudioEndpointRT_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdfd2005f_a6e5_4d39_a265_939ada9fbb4d);
}
impl ::core::convert::From<IAudioEndpointRT> for ::windows::core::IUnknown {
fn from(value: IAudioEndpointRT) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioEndpointRT> for ::windows::core::IUnknown {
fn from(value: &IAudioEndpointRT) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioEndpointRT_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppadding: *mut i64, paecurrentposition: *mut AE_CURRENT_POSITION),
pub unsafe extern "system" fn(this: ::windows::core::RawPtr),
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioInputEndpointRT(pub ::windows::core::IUnknown);
impl IAudioInputEndpointRT {
#[cfg(feature = "Win32_Media_Audio_Apo")]
pub unsafe fn GetInputDataPointer(&self, pconnectionproperty: *mut super::super::Media::Audio::Apo::APO_CONNECTION_PROPERTY, paetimestamp: *mut AE_CURRENT_POSITION) {
::core::mem::transmute((::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pconnectionproperty), ::core::mem::transmute(paetimestamp)))
}
pub unsafe fn ReleaseInputDataPointer(&self, u32framecount: u32, pdatapointer: usize) {
::core::mem::transmute((::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(u32framecount), ::core::mem::transmute(pdatapointer)))
}
pub unsafe fn PulseEndpoint(&self) {
::core::mem::transmute((::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)))
}
}
unsafe impl ::windows::core::Interface for IAudioInputEndpointRT {
type Vtable = IAudioInputEndpointRT_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8026ab61_92b2_43c1_a1df_5c37ebd08d82);
}
impl ::core::convert::From<IAudioInputEndpointRT> for ::windows::core::IUnknown {
fn from(value: IAudioInputEndpointRT) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioInputEndpointRT> for ::windows::core::IUnknown {
fn from(value: &IAudioInputEndpointRT) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioInputEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioInputEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioInputEndpointRT_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Media_Audio_Apo")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnectionproperty: *mut super::super::Media::Audio::Apo::APO_CONNECTION_PROPERTY, paetimestamp: *mut AE_CURRENT_POSITION),
#[cfg(not(feature = "Win32_Media_Audio_Apo"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, u32framecount: u32, pdatapointer: usize),
pub unsafe extern "system" fn(this: ::windows::core::RawPtr),
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioOutputEndpointRT(pub ::windows::core::IUnknown);
impl IAudioOutputEndpointRT {
pub unsafe fn GetOutputDataPointer(&self, u32framecount: u32, paetimestamp: *const AE_CURRENT_POSITION) -> usize {
::core::mem::transmute((::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(u32framecount), ::core::mem::transmute(paetimestamp)))
}
#[cfg(feature = "Win32_Media_Audio_Apo")]
pub unsafe fn ReleaseOutputDataPointer(&self, pconnectionproperty: *const super::super::Media::Audio::Apo::APO_CONNECTION_PROPERTY) {
::core::mem::transmute((::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pconnectionproperty)))
}
pub unsafe fn PulseEndpoint(&self) {
::core::mem::transmute((::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)))
}
}
unsafe impl ::windows::core::Interface for IAudioOutputEndpointRT {
type Vtable = IAudioOutputEndpointRT_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8fa906e4_c31c_4e31_932e_19a66385e9aa);
}
impl ::core::convert::From<IAudioOutputEndpointRT> for ::windows::core::IUnknown {
fn from(value: IAudioOutputEndpointRT) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioOutputEndpointRT> for ::windows::core::IUnknown {
fn from(value: &IAudioOutputEndpointRT) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioOutputEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioOutputEndpointRT {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioOutputEndpointRT_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, u32framecount: u32, paetimestamp: *const AE_CURRENT_POSITION) -> usize,
#[cfg(feature = "Win32_Media_Audio_Apo")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnectionproperty: *const super::super::Media::Audio::Apo::APO_CONNECTION_PROPERTY),
#[cfg(not(feature = "Win32_Media_Audio_Apo"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr),
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRemoteDesktopClient(pub ::windows::core::IUnknown);
impl IRemoteDesktopClient {
pub unsafe fn Connect(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Disconnect(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reconnect(&self, width: u32, height: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(width), ::core::mem::transmute(height)).ok()
}
pub unsafe fn Settings(&self) -> ::windows::core::Result<IRemoteDesktopClientSettings> {
let mut result__: <IRemoteDesktopClientSettings as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRemoteDesktopClientSettings>(result__)
}
pub unsafe fn Actions(&self) -> ::windows::core::Result<IRemoteDesktopClientActions> {
let mut result__: <IRemoteDesktopClientActions as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRemoteDesktopClientActions>(result__)
}
pub unsafe fn TouchPointer(&self) -> ::windows::core::Result<IRemoteDesktopClientTouchPointer> {
let mut result__: <IRemoteDesktopClientTouchPointer as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IRemoteDesktopClientTouchPointer>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeleteSavedCredentials<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, servername: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), servername.into_param().abi()).ok()
}
pub unsafe fn UpdateSessionDisplaySettings(&self, width: u32, height: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(width), ::core::mem::transmute(height)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn attachEvent<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::Com::IDispatch>>(&self, eventname: Param0, callback: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), eventname.into_param().abi(), callback.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn detachEvent<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::Com::IDispatch>>(&self, eventname: Param0, callback: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), eventname.into_param().abi(), callback.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IRemoteDesktopClient {
type Vtable = IRemoteDesktopClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x57d25668_625a_4905_be4e_304caa13f89c);
}
impl ::core::convert::From<IRemoteDesktopClient> for ::windows::core::IUnknown {
fn from(value: IRemoteDesktopClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IRemoteDesktopClient> for ::windows::core::IUnknown {
fn from(value: &IRemoteDesktopClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRemoteDesktopClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRemoteDesktopClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IRemoteDesktopClient> for super::Com::IDispatch {
fn from(value: IRemoteDesktopClient) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IRemoteDesktopClient> for super::Com::IDispatch {
fn from(value: &IRemoteDesktopClient) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRemoteDesktopClient {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRemoteDesktopClient {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IRemoteDesktopClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, width: u32, height: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, settings: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, actions: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, touchpointer: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, servername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, width: u32, height: u32) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, callback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, callback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRemoteDesktopClientActions(pub ::windows::core::IUnknown);
impl IRemoteDesktopClientActions {
pub unsafe fn SuspendScreenUpdates(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ResumeScreenUpdates(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ExecuteRemoteAction(&self, remoteaction: RemoteActionType) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(remoteaction)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetSnapshot(&self, snapshotencoding: SnapshotEncodingType, snapshotformat: SnapshotFormatType, snapshotwidth: u32, snapshotheight: u32) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(snapshotencoding), ::core::mem::transmute(snapshotformat), ::core::mem::transmute(snapshotwidth), ::core::mem::transmute(snapshotheight), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
}
unsafe impl ::windows::core::Interface for IRemoteDesktopClientActions {
type Vtable = IRemoteDesktopClientActions_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7d54bc4e_1028_45d4_8b0a_b9b6bffba176);
}
impl ::core::convert::From<IRemoteDesktopClientActions> for ::windows::core::IUnknown {
fn from(value: IRemoteDesktopClientActions) -> Self {
value.0
}
}
impl ::core::convert::From<&IRemoteDesktopClientActions> for ::windows::core::IUnknown {
fn from(value: &IRemoteDesktopClientActions) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRemoteDesktopClientActions {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRemoteDesktopClientActions {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IRemoteDesktopClientActions> for super::Com::IDispatch {
fn from(value: IRemoteDesktopClientActions) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IRemoteDesktopClientActions> for super::Com::IDispatch {
fn from(value: &IRemoteDesktopClientActions) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRemoteDesktopClientActions {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRemoteDesktopClientActions {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IRemoteDesktopClientActions_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, remoteaction: RemoteActionType) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, snapshotencoding: SnapshotEncodingType, snapshotformat: SnapshotFormatType, snapshotwidth: u32, snapshotheight: u32, snapshotdata: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRemoteDesktopClientSettings(pub ::windows::core::IUnknown);
impl IRemoteDesktopClientSettings {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ApplySettings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, rdpfilecontents: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), rdpfilecontents.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RetrieveSettings(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn GetRdpProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, propertyname: Param0) -> ::windows::core::Result<super::Com::VARIANT> {
let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), propertyname.into_param().abi(), &mut result__).from_abi::<super::Com::VARIANT>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn SetRdpProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, propertyname: Param0, value: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), propertyname.into_param().abi(), value.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IRemoteDesktopClientSettings {
type Vtable = IRemoteDesktopClientSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48a0f2a7_2713_431f_bbac_6f4558e7d64d);
}
impl ::core::convert::From<IRemoteDesktopClientSettings> for ::windows::core::IUnknown {
fn from(value: IRemoteDesktopClientSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&IRemoteDesktopClientSettings> for ::windows::core::IUnknown {
fn from(value: &IRemoteDesktopClientSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRemoteDesktopClientSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRemoteDesktopClientSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IRemoteDesktopClientSettings> for super::Com::IDispatch {
fn from(value: IRemoteDesktopClientSettings) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IRemoteDesktopClientSettings> for super::Com::IDispatch {
fn from(value: &IRemoteDesktopClientSettings) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRemoteDesktopClientSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRemoteDesktopClientSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IRemoteDesktopClientSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rdpfilecontents: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rdpfilecontents: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, value: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, value: ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRemoteDesktopClientTouchPointer(pub ::windows::core::IUnknown);
impl IRemoteDesktopClientTouchPointer {
pub unsafe fn SetEnabled(&self, enabled: i16) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(enabled)).ok()
}
pub unsafe fn Enabled(&self) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__)
}
pub unsafe fn SetEventsEnabled(&self, eventsenabled: i16) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(eventsenabled)).ok()
}
pub unsafe fn EventsEnabled(&self) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__)
}
pub unsafe fn SetPointerSpeed(&self, pointerspeed: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pointerspeed)).ok()
}
pub unsafe fn PointerSpeed(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IRemoteDesktopClientTouchPointer {
type Vtable = IRemoteDesktopClientTouchPointer_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x260ec22d_8cbc_44b5_9e88_2a37f6c93ae9);
}
impl ::core::convert::From<IRemoteDesktopClientTouchPointer> for ::windows::core::IUnknown {
fn from(value: IRemoteDesktopClientTouchPointer) -> Self {
value.0
}
}
impl ::core::convert::From<&IRemoteDesktopClientTouchPointer> for ::windows::core::IUnknown {
fn from(value: &IRemoteDesktopClientTouchPointer) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRemoteDesktopClientTouchPointer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRemoteDesktopClientTouchPointer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IRemoteDesktopClientTouchPointer> for super::Com::IDispatch {
fn from(value: IRemoteDesktopClientTouchPointer) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IRemoteDesktopClientTouchPointer> for super::Com::IDispatch {
fn from(value: &IRemoteDesktopClientTouchPointer) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IRemoteDesktopClientTouchPointer {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IRemoteDesktopClientTouchPointer {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IRemoteDesktopClientTouchPointer_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enabled: i16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enabled: *mut i16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventsenabled: i16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventsenabled: *mut i16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pointerspeed: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pointerspeed: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRemoteSystemAdditionalInfoProvider(pub ::windows::core::IUnknown);
impl IRemoteSystemAdditionalInfoProvider {
pub unsafe fn GetAdditionalInfo<T: ::windows::core::Interface>(&self, deduplicationid: *mut ::windows::core::HSTRING) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(deduplicationid), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
}
unsafe impl ::windows::core::Interface for IRemoteSystemAdditionalInfoProvider {
type Vtable = IRemoteSystemAdditionalInfoProvider_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeeaa3d5f_ec63_4d27_af38_e86b1d7292cb);
}
impl ::core::convert::From<IRemoteSystemAdditionalInfoProvider> for ::windows::core::IUnknown {
fn from(value: IRemoteSystemAdditionalInfoProvider) -> Self {
value.0
}
}
impl ::core::convert::From<&IRemoteSystemAdditionalInfoProvider> for ::windows::core::IUnknown {
fn from(value: &IRemoteSystemAdditionalInfoProvider) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IRemoteSystemAdditionalInfoProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IRemoteSystemAdditionalInfoProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IRemoteSystemAdditionalInfoProvider_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deduplicationid: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>, riid: *const ::windows::core::GUID, mapview: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGAccountingEngine(pub ::windows::core::IUnknown);
impl ITSGAccountingEngine {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DoAccounting<'a, Param1: ::windows::core::IntoParam<'a, AAAccountingData>>(&self, accountingdatatype: AAAccountingDataType, accountingdata: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(accountingdatatype), accountingdata.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITSGAccountingEngine {
type Vtable = ITSGAccountingEngine_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4ce2a0c9_e874_4f1a_86f4_06bbb9115338);
}
impl ::core::convert::From<ITSGAccountingEngine> for ::windows::core::IUnknown {
fn from(value: ITSGAccountingEngine) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGAccountingEngine> for ::windows::core::IUnknown {
fn from(value: &ITSGAccountingEngine) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGAccountingEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGAccountingEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGAccountingEngine_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, accountingdatatype: AAAccountingDataType, accountingdata: ::core::mem::ManuallyDrop<AAAccountingData>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGAuthenticateUserSink(pub ::windows::core::IUnknown);
impl ITSGAuthenticateUserSink {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnUserAuthenticated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>>(&self, username: Param0, userdomain: Param1, context: usize, usertoken: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), username.into_param().abi(), userdomain.into_param().abi(), ::core::mem::transmute(context), usertoken.into_param().abi()).ok()
}
pub unsafe fn OnUserAuthenticationFailed(&self, context: usize, genericerrorcode: ::windows::core::HRESULT, specificerrorcode: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(context), ::core::mem::transmute(genericerrorcode), ::core::mem::transmute(specificerrorcode)).ok()
}
pub unsafe fn ReauthenticateUser(&self, context: usize) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(context)).ok()
}
pub unsafe fn DisconnectUser(&self, context: usize) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(context)).ok()
}
}
unsafe impl ::windows::core::Interface for ITSGAuthenticateUserSink {
type Vtable = ITSGAuthenticateUserSink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2c3e2e73_a782_47f9_8dfb_77ee1ed27a03);
}
impl ::core::convert::From<ITSGAuthenticateUserSink> for ::windows::core::IUnknown {
fn from(value: ITSGAuthenticateUserSink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGAuthenticateUserSink> for ::windows::core::IUnknown {
fn from(value: &ITSGAuthenticateUserSink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGAuthenticateUserSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGAuthenticateUserSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGAuthenticateUserSink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, userdomain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, context: usize, usertoken: super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, context: usize, genericerrorcode: ::windows::core::HRESULT, specificerrorcode: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, context: usize) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, context: usize) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGAuthenticationEngine(pub ::windows::core::IUnknown);
impl ITSGAuthenticationEngine {
pub unsafe fn AuthenticateUser<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>, Param4: ::windows::core::IntoParam<'a, ITSGAuthenticateUserSink>>(&self, mainsessionid: Param0, cookiedata: *const u8, numcookiebytes: u32, context: usize, psink: Param4) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), mainsessionid.into_param().abi(), ::core::mem::transmute(cookiedata), ::core::mem::transmute(numcookiebytes), ::core::mem::transmute(context), psink.into_param().abi()).ok()
}
pub unsafe fn CancelAuthentication<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, mainsessionid: Param0, context: usize) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), mainsessionid.into_param().abi(), ::core::mem::transmute(context)).ok()
}
}
unsafe impl ::windows::core::Interface for ITSGAuthenticationEngine {
type Vtable = ITSGAuthenticationEngine_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9ee3e5bf_04ab_4691_998c_d7f622321a56);
}
impl ::core::convert::From<ITSGAuthenticationEngine> for ::windows::core::IUnknown {
fn from(value: ITSGAuthenticationEngine) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGAuthenticationEngine> for ::windows::core::IUnknown {
fn from(value: &ITSGAuthenticationEngine) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGAuthenticationEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGAuthenticationEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGAuthenticationEngine_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mainsessionid: ::windows::core::GUID, cookiedata: *const u8, numcookiebytes: u32, context: usize, psink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mainsessionid: ::windows::core::GUID, context: usize) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGAuthorizeConnectionSink(pub ::windows::core::IUnknown);
impl ITSGAuthorizeConnectionSink {
pub unsafe fn OnConnectionAuthorized<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, hrin: ::windows::core::HRESULT, mainsessionid: Param1, cbsohresponse: u32, pbsohresponse: *const u8, idletimeout: u32, sessiontimeout: u32, sessiontimeoutaction: SESSION_TIMEOUT_ACTION_TYPE, trustclass: AATrustClassID, policyattributes: *const u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(
::core::mem::transmute_copy(self),
::core::mem::transmute(hrin),
mainsessionid.into_param().abi(),
::core::mem::transmute(cbsohresponse),
::core::mem::transmute(pbsohresponse),
::core::mem::transmute(idletimeout),
::core::mem::transmute(sessiontimeout),
::core::mem::transmute(sessiontimeoutaction),
::core::mem::transmute(trustclass),
::core::mem::transmute(policyattributes),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for ITSGAuthorizeConnectionSink {
type Vtable = ITSGAuthorizeConnectionSink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc27ece33_7781_4318_98ef_1cf2da7b7005);
}
impl ::core::convert::From<ITSGAuthorizeConnectionSink> for ::windows::core::IUnknown {
fn from(value: ITSGAuthorizeConnectionSink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGAuthorizeConnectionSink> for ::windows::core::IUnknown {
fn from(value: &ITSGAuthorizeConnectionSink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGAuthorizeConnectionSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGAuthorizeConnectionSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGAuthorizeConnectionSink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrin: ::windows::core::HRESULT, mainsessionid: ::windows::core::GUID, cbsohresponse: u32, pbsohresponse: *const u8, idletimeout: u32, sessiontimeout: u32, sessiontimeoutaction: SESSION_TIMEOUT_ACTION_TYPE, trustclass: AATrustClassID, policyattributes: *const u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGAuthorizeResourceSink(pub ::windows::core::IUnknown);
impl ITSGAuthorizeResourceSink {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnChannelAuthorized<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, hrin: ::windows::core::HRESULT, mainsessionid: Param1, subsessionid: i32, allowedresourcenames: *const super::super::Foundation::BSTR, numallowedresourcenames: u32, failedresourcenames: *const super::super::Foundation::BSTR, numfailedresourcenames: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(
::core::mem::transmute_copy(self),
::core::mem::transmute(hrin),
mainsessionid.into_param().abi(),
::core::mem::transmute(subsessionid),
::core::mem::transmute(allowedresourcenames),
::core::mem::transmute(numallowedresourcenames),
::core::mem::transmute(failedresourcenames),
::core::mem::transmute(numfailedresourcenames),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for ITSGAuthorizeResourceSink {
type Vtable = ITSGAuthorizeResourceSink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfeddfcd4_fa12_4435_ae55_7ad1a9779af7);
}
impl ::core::convert::From<ITSGAuthorizeResourceSink> for ::windows::core::IUnknown {
fn from(value: ITSGAuthorizeResourceSink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGAuthorizeResourceSink> for ::windows::core::IUnknown {
fn from(value: &ITSGAuthorizeResourceSink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGAuthorizeResourceSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGAuthorizeResourceSink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGAuthorizeResourceSink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrin: ::windows::core::HRESULT, mainsessionid: ::windows::core::GUID, subsessionid: i32, allowedresourcenames: *const ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, numallowedresourcenames: u32, failedresourcenames: *const ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, numfailedresourcenames: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITSGPolicyEngine(pub ::windows::core::IUnknown);
impl ITSGPolicyEngine {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn AuthorizeConnection<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param9: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param10: ::windows::core::IntoParam<'a, ITSGAuthorizeConnectionSink>>(
&self,
mainsessionid: Param0,
username: Param1,
authtype: AAAuthSchemes,
clientmachineip: Param3,
clientmachinename: Param4,
sohdata: *const u8,
numsohbytes: u32,
cookiedata: *const u8,
numcookiebytes: u32,
usertoken: Param9,
psink: Param10,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(
::core::mem::transmute_copy(self),
mainsessionid.into_param().abi(),
username.into_param().abi(),
::core::mem::transmute(authtype),
clientmachineip.into_param().abi(),
clientmachinename.into_param().abi(),
::core::mem::transmute(sohdata),
::core::mem::transmute(numsohbytes),
::core::mem::transmute(cookiedata),
::core::mem::transmute(numcookiebytes),
usertoken.into_param().abi(),
psink.into_param().abi(),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn AuthorizeResource<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param8: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param11: ::windows::core::IntoParam<'a, ITSGAuthorizeResourceSink>>(
&self,
mainsessionid: Param0,
subsessionid: i32,
username: Param2,
resourcenames: *const super::super::Foundation::BSTR,
numresources: u32,
alternateresourcenames: *const super::super::Foundation::BSTR,
numalternateresourcename: u32,
portnumber: u32,
operation: Param8,
cookie: *const u8,
numbytesincookie: u32,
psink: Param11,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(
::core::mem::transmute_copy(self),
mainsessionid.into_param().abi(),
::core::mem::transmute(subsessionid),
username.into_param().abi(),
::core::mem::transmute(resourcenames),
::core::mem::transmute(numresources),
::core::mem::transmute(alternateresourcenames),
::core::mem::transmute(numalternateresourcename),
::core::mem::transmute(portnumber),
operation.into_param().abi(),
::core::mem::transmute(cookie),
::core::mem::transmute(numbytesincookie),
psink.into_param().abi(),
)
.ok()
}
pub unsafe fn Refresh(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsQuarantineEnabled(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
}
unsafe impl ::windows::core::Interface for ITSGPolicyEngine {
type Vtable = ITSGPolicyEngine_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8bc24f08_6223_42f4_a5b4_8e37cd135bbd);
}
impl ::core::convert::From<ITSGPolicyEngine> for ::windows::core::IUnknown {
fn from(value: ITSGPolicyEngine) -> Self {
value.0
}
}
impl ::core::convert::From<&ITSGPolicyEngine> for ::windows::core::IUnknown {
fn from(value: &ITSGPolicyEngine) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITSGPolicyEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITSGPolicyEngine {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITSGPolicyEngine_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
mainsessionid: ::windows::core::GUID,
username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
authtype: AAAuthSchemes,
clientmachineip: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
clientmachinename: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
sohdata: *const u8,
numsohbytes: u32,
cookiedata: *const u8,
numcookiebytes: u32,
usertoken: super::super::Foundation::HANDLE_PTR,
psink: ::windows::core::RawPtr,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
mainsessionid: ::windows::core::GUID,
subsessionid: i32,
username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
resourcenames: *const ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
numresources: u32,
alternateresourcenames: *const ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
numalternateresourcename: u32,
portnumber: u32,
operation: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
cookie: *const u8,
numbytesincookie: u32,
psink: ::windows::core::RawPtr,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, quarantineenabled: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbBaseNotifySink(pub ::windows::core::IUnknown);
impl ITsSbBaseNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbBaseNotifySink {
type Vtable = ITsSbBaseNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x808a6537_1282_4989_9e09_f43938b71722);
}
impl ::core::convert::From<ITsSbBaseNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbBaseNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbBaseNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbBaseNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbBaseNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbBaseNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbBaseNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbClientConnection(pub ::windows::core::IUnknown);
impl ITsSbClientConnection {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn UserName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Domain(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn InitialProgram(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn LoadBalanceResult(&self) -> ::windows::core::Result<ITsSbLoadBalanceResult> {
let mut result__: <ITsSbLoadBalanceResult as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbLoadBalanceResult>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn FarmName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn PutContext<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::Com::VARIANT>>(&self, contextid: Param0, context: Param1) -> ::windows::core::Result<super::Com::VARIANT> {
let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), contextid.into_param().abi(), context.into_param().abi(), &mut result__).from_abi::<super::Com::VARIANT>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn GetContext<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, contextid: Param0) -> ::windows::core::Result<super::Com::VARIANT> {
let mut result__: <super::Com::VARIANT as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), contextid.into_param().abi(), &mut result__).from_abi::<super::Com::VARIANT>(result__)
}
pub unsafe fn Environment(&self) -> ::windows::core::Result<ITsSbEnvironment> {
let mut result__: <ITsSbEnvironment as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbEnvironment>(result__)
}
pub unsafe fn ConnectionError(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SamUserAccount(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn ClientConnectionPropertySet(&self) -> ::windows::core::Result<ITsSbClientConnectionPropertySet> {
let mut result__: <ITsSbClientConnectionPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbClientConnectionPropertySet>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsFirstAssignment(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn RdFarmType(&self) -> ::windows::core::Result<RD_FARM_TYPE> {
let mut result__: <RD_FARM_TYPE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RD_FARM_TYPE>(result__)
}
pub unsafe fn UserSidString(&self) -> ::windows::core::Result<*mut i8> {
let mut result__: <*mut i8 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut i8>(result__)
}
pub unsafe fn GetDisconnectedSession(&self) -> ::windows::core::Result<ITsSbSession> {
let mut result__: <ITsSbSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbSession>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbClientConnection {
type Vtable = ITsSbClientConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x18857499_ad61_4b1b_b7df_cbcd41fb8338);
}
impl ::core::convert::From<ITsSbClientConnection> for ::windows::core::IUnknown {
fn from(value: ITsSbClientConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbClientConnection> for ::windows::core::IUnknown {
fn from(value: &ITsSbClientConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbClientConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbClientConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbClientConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppval: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, contextid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, context: ::core::mem::ManuallyDrop<super::Com::VARIANT>, existingcontext: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, contextid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, context: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenvironment: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppval: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, prdfarmtype: *mut RD_FARM_TYPE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszusersidstring: *mut *mut i8) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbClientConnectionPropertySet(pub ::windows::core::IUnknown);
impl ITsSbClientConnectionPropertySet {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Read<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Com::IErrorLog>>(&self, pszpropname: Param0, pvar: *mut super::Com::VARIANT, perrorlog: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar), perrorlog.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Write<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpropname: Param0, pvar: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbClientConnectionPropertySet {
type Vtable = ITsSbClientConnectionPropertySet_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe51995b0_46d6_11dd_aa21_cedc55d89593);
}
impl ::core::convert::From<ITsSbClientConnectionPropertySet> for ::windows::core::IUnknown {
fn from(value: ITsSbClientConnectionPropertySet) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbClientConnectionPropertySet> for ::windows::core::IUnknown {
fn from(value: &ITsSbClientConnectionPropertySet) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbClientConnectionPropertySet> for ITsSbPropertySet {
fn from(value: ITsSbClientConnectionPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbClientConnectionPropertySet> for ITsSbPropertySet {
fn from(value: &ITsSbClientConnectionPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for &ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<ITsSbClientConnectionPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: ITsSbClientConnectionPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<&ITsSbClientConnectionPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: &ITsSbClientConnectionPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for &ITsSbClientConnectionPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbClientConnectionPropertySet_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, perrorlog: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbEnvironment(pub ::windows::core::IUnknown);
impl ITsSbEnvironment {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Name(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn ServerWeight(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn EnvironmentPropertySet(&self) -> ::windows::core::Result<ITsSbEnvironmentPropertySet> {
let mut result__: <ITsSbEnvironmentPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbEnvironmentPropertySet>(result__)
}
pub unsafe fn SetEnvironmentPropertySet<'a, Param0: ::windows::core::IntoParam<'a, ITsSbEnvironmentPropertySet>>(&self, pval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), pval.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbEnvironment {
type Vtable = ITsSbEnvironment_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8c87f7f7_bf51_4a5c_87bf_8e94fb6e2256);
}
impl ::core::convert::From<ITsSbEnvironment> for ::windows::core::IUnknown {
fn from(value: ITsSbEnvironment) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbEnvironment> for ::windows::core::IUnknown {
fn from(value: &ITsSbEnvironment) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbEnvironment {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbEnvironment {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbEnvironment_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbEnvironmentPropertySet(pub ::windows::core::IUnknown);
impl ITsSbEnvironmentPropertySet {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Read<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Com::IErrorLog>>(&self, pszpropname: Param0, pvar: *mut super::Com::VARIANT, perrorlog: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar), perrorlog.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Write<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpropname: Param0, pvar: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbEnvironmentPropertySet {
type Vtable = ITsSbEnvironmentPropertySet_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd0d1bf7e_7acf_11dd_a243_e51156d89593);
}
impl ::core::convert::From<ITsSbEnvironmentPropertySet> for ::windows::core::IUnknown {
fn from(value: ITsSbEnvironmentPropertySet) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbEnvironmentPropertySet> for ::windows::core::IUnknown {
fn from(value: &ITsSbEnvironmentPropertySet) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbEnvironmentPropertySet> for ITsSbPropertySet {
fn from(value: ITsSbEnvironmentPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbEnvironmentPropertySet> for ITsSbPropertySet {
fn from(value: &ITsSbEnvironmentPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for &ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<ITsSbEnvironmentPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: ITsSbEnvironmentPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<&ITsSbEnvironmentPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: &ITsSbEnvironmentPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for &ITsSbEnvironmentPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbEnvironmentPropertySet_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, perrorlog: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbFilterPluginStore(pub ::windows::core::IUnknown);
impl ITsSbFilterPluginStore {
pub unsafe fn SaveProperties<'a, Param0: ::windows::core::IntoParam<'a, ITsSbPropertySet>>(&self, ppropertyset: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn EnumerateProperties(&self) -> ::windows::core::Result<ITsSbPropertySet> {
let mut result__: <ITsSbPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbPropertySet>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeleteProperties<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, propertyname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), propertyname.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbFilterPluginStore {
type Vtable = ITsSbFilterPluginStore_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x85b44b0f_ed78_413f_9702_fa6d3b5ee755);
}
impl ::core::convert::From<ITsSbFilterPluginStore> for ::windows::core::IUnknown {
fn from(value: ITsSbFilterPluginStore) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbFilterPluginStore> for ::windows::core::IUnknown {
fn from(value: &ITsSbFilterPluginStore) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbFilterPluginStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbFilterPluginStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbFilterPluginStore_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbGenericNotifySink(pub ::windows::core::IUnknown);
impl ITsSbGenericNotifySink {
pub unsafe fn OnCompleted(&self, status: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(status)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetWaitTimeout(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbGenericNotifySink {
type Vtable = ITsSbGenericNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4c4c8c4f_300b_46ad_9164_8468a7e7568c);
}
impl ::core::convert::From<ITsSbGenericNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbGenericNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbGenericNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbGenericNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbGenericNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbGenericNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbGenericNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, status: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfttimeout: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbGlobalStore(pub ::windows::core::IUnknown);
impl ITsSbGlobalStore {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QueryTarget<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, providername: Param0, targetname: Param1, farmname: Param2) -> ::windows::core::Result<ITsSbTarget> {
let mut result__: <ITsSbTarget as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), providername.into_param().abi(), targetname.into_param().abi(), farmname.into_param().abi(), &mut result__).from_abi::<ITsSbTarget>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QuerySessionBySessionId<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, providername: Param0, dwsessionid: u32, targetname: Param2) -> ::windows::core::Result<ITsSbSession> {
let mut result__: <ITsSbSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), providername.into_param().abi(), ::core::mem::transmute(dwsessionid), targetname.into_param().abi(), &mut result__).from_abi::<ITsSbSession>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn EnumerateFarms<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, providername: Param0, pdwcount: *mut u32, pval: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), providername.into_param().abi(), ::core::mem::transmute(pdwcount), ::core::mem::transmute(pval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnumerateTargets<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, providername: Param0, farmname: Param1, envname: Param2, pdwcount: *mut u32, pval: *mut *mut ::core::option::Option<ITsSbTarget>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), providername.into_param().abi(), farmname.into_param().abi(), envname.into_param().abi(), ::core::mem::transmute(pdwcount), ::core::mem::transmute(pval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnumerateEnvironmentsByProvider<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, providername: Param0, pdwcount: *mut u32, ppval: *mut *mut ::core::option::Option<ITsSbEnvironment>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), providername.into_param().abi(), ::core::mem::transmute(pdwcount), ::core::mem::transmute(ppval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnumerateSessions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(
&self,
providername: Param0,
targetname: Param1,
username: Param2,
userdomain: Param3,
poolname: Param4,
initialprogram: Param5,
psessionstate: *const TSSESSION_STATE,
pdwcount: *mut u32,
ppval: *mut *mut ::core::option::Option<ITsSbSession>,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(
::core::mem::transmute_copy(self),
providername.into_param().abi(),
targetname.into_param().abi(),
username.into_param().abi(),
userdomain.into_param().abi(),
poolname.into_param().abi(),
initialprogram.into_param().abi(),
::core::mem::transmute(psessionstate),
::core::mem::transmute(pdwcount),
::core::mem::transmute(ppval),
)
.ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn GetFarmProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, farmname: Param0, propertyname: Param1, pvarvalue: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), farmname.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pvarvalue)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbGlobalStore {
type Vtable = ITsSbGlobalStore_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9ab60f7b_bd72_4d9f_8a3a_a0ea5574e635);
}
impl ::core::convert::From<ITsSbGlobalStore> for ::windows::core::IUnknown {
fn from(value: ITsSbGlobalStore) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbGlobalStore> for ::windows::core::IUnknown {
fn from(value: &ITsSbGlobalStore) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbGlobalStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbGlobalStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbGlobalStore_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pptarget: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwsessionid: u32, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pdwcount: *mut u32, pval: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, envname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pdwcount: *mut u32, pval: *mut *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pdwcount: *mut u32, ppval: *mut *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
providername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
userdomain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
initialprogram: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
psessionstate: *const TSSESSION_STATE,
pdwcount: *mut u32,
ppval: *mut *mut ::windows::core::RawPtr,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pvarvalue: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbLoadBalanceResult(pub ::windows::core::IUnknown);
impl ITsSbLoadBalanceResult {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbLoadBalanceResult {
type Vtable = ITsSbLoadBalanceResult_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x24fdb7ac_fea6_11dc_9672_9a8956d89593);
}
impl ::core::convert::From<ITsSbLoadBalanceResult> for ::windows::core::IUnknown {
fn from(value: ITsSbLoadBalanceResult) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbLoadBalanceResult> for ::windows::core::IUnknown {
fn from(value: &ITsSbLoadBalanceResult) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbLoadBalanceResult {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbLoadBalanceResult {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbLoadBalanceResult_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbLoadBalancing(pub ::windows::core::IUnknown);
impl ITsSbLoadBalancing {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
pub unsafe fn GetMostSuitableTarget<'a, Param0: ::windows::core::IntoParam<'a, ITsSbClientConnection>, Param1: ::windows::core::IntoParam<'a, ITsSbLoadBalancingNotifySink>>(&self, pconnection: Param0, plbsink: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pconnection.into_param().abi(), plbsink.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbLoadBalancing {
type Vtable = ITsSbLoadBalancing_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x24329274_9eb7_11dc_ae98_f2b456d89593);
}
impl ::core::convert::From<ITsSbLoadBalancing> for ::windows::core::IUnknown {
fn from(value: ITsSbLoadBalancing) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbLoadBalancing> for ::windows::core::IUnknown {
fn from(value: &ITsSbLoadBalancing) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbLoadBalancing {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbLoadBalancing {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbLoadBalancing> for ITsSbPlugin {
fn from(value: ITsSbLoadBalancing) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbLoadBalancing> for ITsSbPlugin {
fn from(value: &ITsSbLoadBalancing) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbLoadBalancing {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbLoadBalancing {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbLoadBalancing_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnection: ::windows::core::RawPtr, plbsink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbLoadBalancingNotifySink(pub ::windows::core::IUnknown);
impl ITsSbLoadBalancingNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnGetMostSuitableTarget<'a, Param0: ::windows::core::IntoParam<'a, ITsSbLoadBalanceResult>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, plbresult: Param0, fisnewconnection: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), plbresult.into_param().abi(), fisnewconnection.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbLoadBalancingNotifySink {
type Vtable = ITsSbLoadBalancingNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5f8a8297_3244_4e6a_958a_27c822c1e141);
}
impl ::core::convert::From<ITsSbLoadBalancingNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbLoadBalancingNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbLoadBalancingNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbLoadBalancingNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbLoadBalancingNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbLoadBalancingNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbLoadBalancingNotifySink> for ITsSbBaseNotifySink {
fn from(value: ITsSbLoadBalancingNotifySink) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbLoadBalancingNotifySink> for ITsSbBaseNotifySink {
fn from(value: &ITsSbLoadBalancingNotifySink) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for ITsSbLoadBalancingNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for &ITsSbLoadBalancingNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbLoadBalancingNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plbresult: ::windows::core::RawPtr, fisnewconnection: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbOrchestration(pub ::windows::core::IUnknown);
impl ITsSbOrchestration {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
pub unsafe fn PrepareTargetForConnect<'a, Param0: ::windows::core::IntoParam<'a, ITsSbClientConnection>, Param1: ::windows::core::IntoParam<'a, ITsSbOrchestrationNotifySink>>(&self, pconnection: Param0, porchestrationnotifysink: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pconnection.into_param().abi(), porchestrationnotifysink.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbOrchestration {
type Vtable = ITsSbOrchestration_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x64fc1172_9eb7_11dc_8b00_3aba56d89593);
}
impl ::core::convert::From<ITsSbOrchestration> for ::windows::core::IUnknown {
fn from(value: ITsSbOrchestration) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbOrchestration> for ::windows::core::IUnknown {
fn from(value: &ITsSbOrchestration) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbOrchestration {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbOrchestration {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbOrchestration> for ITsSbPlugin {
fn from(value: ITsSbOrchestration) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbOrchestration> for ITsSbPlugin {
fn from(value: &ITsSbOrchestration) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbOrchestration {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbOrchestration {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbOrchestration_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnection: ::windows::core::RawPtr, porchestrationnotifysink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbOrchestrationNotifySink(pub ::windows::core::IUnknown);
impl ITsSbOrchestrationNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
pub unsafe fn OnReadyToConnect<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTarget>>(&self, ptarget: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ptarget.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbOrchestrationNotifySink {
type Vtable = ITsSbOrchestrationNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x36c37d61_926b_442f_bca5_118c6d50dcf2);
}
impl ::core::convert::From<ITsSbOrchestrationNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbOrchestrationNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbOrchestrationNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbOrchestrationNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbOrchestrationNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbOrchestrationNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbOrchestrationNotifySink> for ITsSbBaseNotifySink {
fn from(value: ITsSbOrchestrationNotifySink) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbOrchestrationNotifySink> for ITsSbBaseNotifySink {
fn from(value: &ITsSbOrchestrationNotifySink) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for ITsSbOrchestrationNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for &ITsSbOrchestrationNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbOrchestrationNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptarget: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPlacement(pub ::windows::core::IUnknown);
impl ITsSbPlacement {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
pub unsafe fn QueryEnvironmentForTarget<'a, Param0: ::windows::core::IntoParam<'a, ITsSbClientConnection>, Param1: ::windows::core::IntoParam<'a, ITsSbPlacementNotifySink>>(&self, pconnection: Param0, pplacementsink: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pconnection.into_param().abi(), pplacementsink.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPlacement {
type Vtable = ITsSbPlacement_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdaadee5f_6d32_480e_9e36_ddab2329f06d);
}
impl ::core::convert::From<ITsSbPlacement> for ::windows::core::IUnknown {
fn from(value: ITsSbPlacement) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPlacement> for ::windows::core::IUnknown {
fn from(value: &ITsSbPlacement) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPlacement {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPlacement {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbPlacement> for ITsSbPlugin {
fn from(value: ITsSbPlacement) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbPlacement> for ITsSbPlugin {
fn from(value: &ITsSbPlacement) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbPlacement {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbPlacement {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPlacement_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnection: ::windows::core::RawPtr, pplacementsink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPlacementNotifySink(pub ::windows::core::IUnknown);
impl ITsSbPlacementNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
pub unsafe fn OnQueryEnvironmentCompleted<'a, Param0: ::windows::core::IntoParam<'a, ITsSbEnvironment>>(&self, penvironment: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), penvironment.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPlacementNotifySink {
type Vtable = ITsSbPlacementNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x68a0c487_2b4f_46c2_94a1_6ce685183634);
}
impl ::core::convert::From<ITsSbPlacementNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbPlacementNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPlacementNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbPlacementNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPlacementNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPlacementNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbPlacementNotifySink> for ITsSbBaseNotifySink {
fn from(value: ITsSbPlacementNotifySink) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbPlacementNotifySink> for ITsSbBaseNotifySink {
fn from(value: &ITsSbPlacementNotifySink) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for ITsSbPlacementNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for &ITsSbPlacementNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPlacementNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penvironment: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPlugin(pub ::windows::core::IUnknown);
impl ITsSbPlugin {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPlugin {
type Vtable = ITsSbPlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48cd7406_caab_465f_a5d6_baa863b9ea4f);
}
impl ::core::convert::From<ITsSbPlugin> for ::windows::core::IUnknown {
fn from(value: ITsSbPlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPlugin> for ::windows::core::IUnknown {
fn from(value: &ITsSbPlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPluginNotifySink(pub ::windows::core::IUnknown);
impl ITsSbPluginNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
pub unsafe fn OnInitialized(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
pub unsafe fn OnTerminated(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPluginNotifySink {
type Vtable = ITsSbPluginNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x44dfe30b_c3be_40f5_bf82_7a95bb795adf);
}
impl ::core::convert::From<ITsSbPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbPluginNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbPluginNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbPluginNotifySink> for ITsSbBaseNotifySink {
fn from(value: ITsSbPluginNotifySink) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbPluginNotifySink> for ITsSbBaseNotifySink {
fn from(value: &ITsSbPluginNotifySink) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for ITsSbPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for &ITsSbPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPluginNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPluginPropertySet(pub ::windows::core::IUnknown);
impl ITsSbPluginPropertySet {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Read<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Com::IErrorLog>>(&self, pszpropname: Param0, pvar: *mut super::Com::VARIANT, perrorlog: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar), perrorlog.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Write<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpropname: Param0, pvar: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPluginPropertySet {
type Vtable = ITsSbPluginPropertySet_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x95006e34_7eff_4b6c_bb40_49a4fda7cea6);
}
impl ::core::convert::From<ITsSbPluginPropertySet> for ::windows::core::IUnknown {
fn from(value: ITsSbPluginPropertySet) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPluginPropertySet> for ::windows::core::IUnknown {
fn from(value: &ITsSbPluginPropertySet) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbPluginPropertySet> for ITsSbPropertySet {
fn from(value: ITsSbPluginPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbPluginPropertySet> for ITsSbPropertySet {
fn from(value: &ITsSbPluginPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for &ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<ITsSbPluginPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: ITsSbPluginPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<&ITsSbPluginPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: &ITsSbPluginPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for &ITsSbPluginPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPluginPropertySet_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, perrorlog: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbPropertySet(pub ::windows::core::IUnknown);
impl ITsSbPropertySet {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Read<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Com::IErrorLog>>(&self, pszpropname: Param0, pvar: *mut super::Com::VARIANT, perrorlog: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar), perrorlog.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Write<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpropname: Param0, pvar: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbPropertySet {
type Vtable = ITsSbPropertySet_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c025171_bb1e_4baf_a212_6d5e9774b33b);
}
impl ::core::convert::From<ITsSbPropertySet> for ::windows::core::IUnknown {
fn from(value: ITsSbPropertySet) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbPropertySet> for ::windows::core::IUnknown {
fn from(value: &ITsSbPropertySet) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<ITsSbPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: ITsSbPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<&ITsSbPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: &ITsSbPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for ITsSbPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for &ITsSbPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbPropertySet_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, perrorlog: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbProvider(pub ::windows::core::IUnknown);
impl ITsSbProvider {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateTargetObject<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, environmentname: Param1) -> ::windows::core::Result<ITsSbTarget> {
let mut result__: <ITsSbTarget as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), targetname.into_param().abi(), environmentname.into_param().abi(), &mut result__).from_abi::<ITsSbTarget>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateLoadBalanceResultObject<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0) -> ::windows::core::Result<ITsSbLoadBalanceResult> {
let mut result__: <ITsSbLoadBalanceResult as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), targetname.into_param().abi(), &mut result__).from_abi::<ITsSbLoadBalanceResult>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateSessionObject<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, username: Param1, domain: Param2, sessionid: u32) -> ::windows::core::Result<ITsSbSession> {
let mut result__: <ITsSbSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), targetname.into_param().abi(), username.into_param().abi(), domain.into_param().abi(), ::core::mem::transmute(sessionid), &mut result__).from_abi::<ITsSbSession>(result__)
}
pub unsafe fn CreatePluginPropertySet(&self) -> ::windows::core::Result<ITsSbPluginPropertySet> {
let mut result__: <ITsSbPluginPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbPluginPropertySet>(result__)
}
pub unsafe fn CreateTargetPropertySetObject(&self) -> ::windows::core::Result<ITsSbTargetPropertySet> {
let mut result__: <ITsSbTargetPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbTargetPropertySet>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateEnvironmentObject<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, name: Param0, serverweight: u32) -> ::windows::core::Result<ITsSbEnvironment> {
let mut result__: <ITsSbEnvironment as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), name.into_param().abi(), ::core::mem::transmute(serverweight), &mut result__).from_abi::<ITsSbEnvironment>(result__)
}
pub unsafe fn GetResourcePluginStore(&self) -> ::windows::core::Result<ITsSbResourcePluginStore> {
let mut result__: <ITsSbResourcePluginStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbResourcePluginStore>(result__)
}
pub unsafe fn GetFilterPluginStore(&self) -> ::windows::core::Result<ITsSbFilterPluginStore> {
let mut result__: <ITsSbFilterPluginStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbFilterPluginStore>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RegisterForNotification<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, ITsSbResourceNotification>>(&self, notificationtype: u32, resourcetomonitor: Param1, ppluginnotification: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(notificationtype), resourcetomonitor.into_param().abi(), ppluginnotification.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn UnRegisterForNotification<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, notificationtype: u32, resourcetomonitor: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(notificationtype), resourcetomonitor.into_param().abi()).ok()
}
pub unsafe fn GetInstanceOfGlobalStore(&self) -> ::windows::core::Result<ITsSbGlobalStore> {
let mut result__: <ITsSbGlobalStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbGlobalStore>(result__)
}
pub unsafe fn CreateEnvironmentPropertySetObject(&self) -> ::windows::core::Result<ITsSbEnvironmentPropertySet> {
let mut result__: <ITsSbEnvironmentPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbEnvironmentPropertySet>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbProvider {
type Vtable = ITsSbProvider_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x87a4098f_6d7b_44dd_bc17_8ce44e370d52);
}
impl ::core::convert::From<ITsSbProvider> for ::windows::core::IUnknown {
fn from(value: ITsSbProvider) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbProvider> for ::windows::core::IUnknown {
fn from(value: &ITsSbProvider) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbProvider_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, environmentname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pptarget: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pplbresult: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, domain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, sessionid: u32, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, name: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, serverweight: u32, ppenvironment: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, notificationtype: u32, resourcetomonitor: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppluginnotification: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, notificationtype: u32, resourcetomonitor: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppglobalstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbProvisioning(pub ::windows::core::IUnknown);
impl ITsSbProvisioning {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateVirtualMachines<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, ITsSbProvisioningPluginNotifySink>>(&self, jobxmlstring: Param0, jobguid: Param1, psink: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), jobxmlstring.into_param().abi(), jobguid.into_param().abi(), psink.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn PatchVirtualMachines<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, ITsSbProvisioningPluginNotifySink>>(&self, jobxmlstring: Param0, jobguid: Param1, psink: Param2, pvmpatchinfo: *const VM_PATCH_INFO) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), jobxmlstring.into_param().abi(), jobguid.into_param().abi(), psink.into_param().abi(), ::core::mem::transmute(pvmpatchinfo)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeleteVirtualMachines<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, ITsSbProvisioningPluginNotifySink>>(&self, jobxmlstring: Param0, jobguid: Param1, psink: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), jobxmlstring.into_param().abi(), jobguid.into_param().abi(), psink.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CancelJob<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, jobguid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), jobguid.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbProvisioning {
type Vtable = ITsSbProvisioning_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2f6f0dbb_9e4f_462b_9c3f_fccc3dcb6232);
}
impl ::core::convert::From<ITsSbProvisioning> for ::windows::core::IUnknown {
fn from(value: ITsSbProvisioning) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbProvisioning> for ::windows::core::IUnknown {
fn from(value: &ITsSbProvisioning) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbProvisioning {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbProvisioning {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbProvisioning> for ITsSbPlugin {
fn from(value: ITsSbProvisioning) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbProvisioning> for ITsSbPlugin {
fn from(value: &ITsSbProvisioning) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbProvisioning {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbProvisioning {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbProvisioning_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, jobxmlstring: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, jobguid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, jobxmlstring: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, jobguid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psink: ::windows::core::RawPtr, pvmpatchinfo: *const VM_PATCH_INFO) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, jobxmlstring: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, jobguid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, jobguid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbProvisioningPluginNotifySink(pub ::windows::core::IUnknown);
impl ITsSbProvisioningPluginNotifySink {
pub unsafe fn OnJobCreated(&self, pvmnotifyinfo: *const VM_NOTIFY_INFO) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvmnotifyinfo)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnVirtualMachineStatusChanged<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pvmnotifyentry: *const VM_NOTIFY_ENTRY, vmnotifystatus: VM_NOTIFY_STATUS, errorcode: ::windows::core::HRESULT, errordescr: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvmnotifyentry), ::core::mem::transmute(vmnotifystatus), ::core::mem::transmute(errorcode), errordescr.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnJobCompleted<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, resultcode: ::windows::core::HRESULT, resultdescription: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(resultcode), resultdescription.into_param().abi()).ok()
}
pub unsafe fn OnJobCancelled(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn LockVirtualMachine(&self, pvmnotifyentry: *const VM_NOTIFY_ENTRY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvmnotifyentry)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnVirtualMachineHostStatusChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, vmhost: Param0, vmhostnotifystatus: VM_HOST_NOTIFY_STATUS, errorcode: ::windows::core::HRESULT, errordescr: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), vmhost.into_param().abi(), ::core::mem::transmute(vmhostnotifystatus), ::core::mem::transmute(errorcode), errordescr.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbProvisioningPluginNotifySink {
type Vtable = ITsSbProvisioningPluginNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaca87a8e_818b_4581_a032_49c3dfb9c701);
}
impl ::core::convert::From<ITsSbProvisioningPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbProvisioningPluginNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbProvisioningPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbProvisioningPluginNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbProvisioningPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbProvisioningPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbProvisioningPluginNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvmnotifyinfo: *const VM_NOTIFY_INFO) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvmnotifyentry: *const VM_NOTIFY_ENTRY, vmnotifystatus: VM_NOTIFY_STATUS, errorcode: ::windows::core::HRESULT, errordescr: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, resultcode: ::windows::core::HRESULT, resultdescription: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvmnotifyentry: *const VM_NOTIFY_ENTRY) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, vmhost: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, vmhostnotifystatus: VM_HOST_NOTIFY_STATUS, errorcode: ::windows::core::HRESULT, errordescr: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbResourceNotification(pub ::windows::core::IUnknown);
impl ITsSbResourceNotification {
pub unsafe fn NotifySessionChange<'a, Param1: ::windows::core::IntoParam<'a, ITsSbSession>>(&self, changetype: TSSESSION_STATE, psession: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(changetype), psession.into_param().abi()).ok()
}
pub unsafe fn NotifyTargetChange<'a, Param1: ::windows::core::IntoParam<'a, ITsSbTarget>>(&self, targetchangetype: u32, ptarget: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(targetchangetype), ptarget.into_param().abi()).ok()
}
pub unsafe fn NotifyClientConnectionStateChange<'a, Param1: ::windows::core::IntoParam<'a, ITsSbClientConnection>>(&self, changetype: CONNECTION_CHANGE_NOTIFICATION, pconnection: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(changetype), pconnection.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbResourceNotification {
type Vtable = ITsSbResourceNotification_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x65d3e85a_c39b_11dc_b92d_3cd255d89593);
}
impl ::core::convert::From<ITsSbResourceNotification> for ::windows::core::IUnknown {
fn from(value: ITsSbResourceNotification) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbResourceNotification> for ::windows::core::IUnknown {
fn from(value: &ITsSbResourceNotification) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbResourceNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbResourceNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbResourceNotification_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, changetype: TSSESSION_STATE, psession: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetchangetype: u32, ptarget: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, changetype: CONNECTION_CHANGE_NOTIFICATION, pconnection: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbResourceNotificationEx(pub ::windows::core::IUnknown);
impl ITsSbResourceNotificationEx {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn NotifySessionChangeEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, username: Param1, domain: Param2, sessionid: u32, sessionstate: TSSESSION_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), targetname.into_param().abi(), username.into_param().abi(), domain.into_param().abi(), ::core::mem::transmute(sessionid), ::core::mem::transmute(sessionstate)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn NotifyTargetChangeEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, targetchangetype: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), targetname.into_param().abi(), ::core::mem::transmute(targetchangetype)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn NotifyClientConnectionStateChangeEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(
&self,
username: Param0,
domain: Param1,
initialprogram: Param2,
poolname: Param3,
targetname: Param4,
connectionchangetype: CONNECTION_CHANGE_NOTIFICATION,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), username.into_param().abi(), domain.into_param().abi(), initialprogram.into_param().abi(), poolname.into_param().abi(), targetname.into_param().abi(), ::core::mem::transmute(connectionchangetype)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbResourceNotificationEx {
type Vtable = ITsSbResourceNotificationEx_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa8a47fde_ca91_44d2_b897_3aa28a43b2b7);
}
impl ::core::convert::From<ITsSbResourceNotificationEx> for ::windows::core::IUnknown {
fn from(value: ITsSbResourceNotificationEx) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbResourceNotificationEx> for ::windows::core::IUnknown {
fn from(value: &ITsSbResourceNotificationEx) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbResourceNotificationEx {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbResourceNotificationEx {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbResourceNotificationEx_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, domain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, sessionid: u32, sessionstate: TSSESSION_STATE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, targetchangetype: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, domain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, initialprogram: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, connectionchangetype: CONNECTION_CHANGE_NOTIFICATION) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbResourcePlugin(pub ::windows::core::IUnknown);
impl ITsSbResourcePlugin {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbResourcePlugin {
type Vtable = ITsSbResourcePlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xea8db42c_98ed_4535_a88b_2a164f35490f);
}
impl ::core::convert::From<ITsSbResourcePlugin> for ::windows::core::IUnknown {
fn from(value: ITsSbResourcePlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbResourcePlugin> for ::windows::core::IUnknown {
fn from(value: &ITsSbResourcePlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbResourcePlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbResourcePlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbResourcePlugin> for ITsSbPlugin {
fn from(value: ITsSbResourcePlugin) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbResourcePlugin> for ITsSbPlugin {
fn from(value: &ITsSbResourcePlugin) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbResourcePlugin {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbResourcePlugin {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbResourcePlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbResourcePluginStore(pub ::windows::core::IUnknown);
impl ITsSbResourcePluginStore {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QueryTarget<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, farmname: Param1) -> ::windows::core::Result<ITsSbTarget> {
let mut result__: <ITsSbTarget as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), targetname.into_param().abi(), farmname.into_param().abi(), &mut result__).from_abi::<ITsSbTarget>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QuerySessionBySessionId<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, dwsessionid: u32, targetname: Param1) -> ::windows::core::Result<ITsSbSession> {
let mut result__: <ITsSbSession as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwsessionid), targetname.into_param().abi(), &mut result__).from_abi::<ITsSbSession>(result__)
}
pub unsafe fn AddTargetToStore<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTarget>>(&self, ptarget: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ptarget.into_param().abi()).ok()
}
pub unsafe fn AddSessionToStore<'a, Param0: ::windows::core::IntoParam<'a, ITsSbSession>>(&self, psession: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), psession.into_param().abi()).ok()
}
pub unsafe fn AddEnvironmentToStore<'a, Param0: ::windows::core::IntoParam<'a, ITsSbEnvironment>>(&self, penvironment: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), penvironment.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RemoveEnvironmentFromStore<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, environmentname: Param0, bignoreowner: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), environmentname.into_param().abi(), bignoreowner.into_param().abi()).ok()
}
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn EnumerateFarms(&self, pdwcount: *mut u32, pval: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(pdwcount), ::core::mem::transmute(pval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QueryEnvironment<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, environmentname: Param0) -> ::windows::core::Result<ITsSbEnvironment> {
let mut result__: <ITsSbEnvironment as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), environmentname.into_param().abi(), &mut result__).from_abi::<ITsSbEnvironment>(result__)
}
pub unsafe fn EnumerateEnvironments(&self, pdwcount: *mut u32, pval: *mut *mut ::core::option::Option<ITsSbEnvironment>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pdwcount), ::core::mem::transmute(pval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SaveTarget<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTarget>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, ptarget: Param0, bforcewrite: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ptarget.into_param().abi(), bforcewrite.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SaveEnvironment<'a, Param0: ::windows::core::IntoParam<'a, ITsSbEnvironment>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, penvironment: Param0, bforcewrite: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), penvironment.into_param().abi(), bforcewrite.into_param().abi()).ok()
}
pub unsafe fn SaveSession<'a, Param0: ::windows::core::IntoParam<'a, ITsSbSession>>(&self, psession: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), psession.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn SetTargetProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, propertyname: Param1, pproperty: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), targetname.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pproperty)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn SetEnvironmentProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, environmentname: Param0, propertyname: Param1, pproperty: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), environmentname.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pproperty)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTargetState<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, newstate: TARGET_STATE) -> ::windows::core::Result<TARGET_STATE> {
let mut result__: <TARGET_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), targetname.into_param().abi(), ::core::mem::transmute(newstate), &mut result__).from_abi::<TARGET_STATE>(result__)
}
pub unsafe fn SetSessionState<'a, Param0: ::windows::core::IntoParam<'a, ITsSbSession>>(&self, sbsession: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), sbsession.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnumerateTargets<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, farmname: Param0, envname: Param1, sortbyfieldid: TS_SB_SORT_BY, sortybypropname: Param3, pdwcount: *mut u32, pval: *mut *mut ::core::option::Option<ITsSbTarget>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), farmname.into_param().abi(), envname.into_param().abi(), ::core::mem::transmute(sortbyfieldid), sortybypropname.into_param().abi(), ::core::mem::transmute(pdwcount), ::core::mem::transmute(pval)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnumerateSessions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(
&self,
targetname: Param0,
username: Param1,
userdomain: Param2,
poolname: Param3,
initialprogram: Param4,
psessionstate: *const TSSESSION_STATE,
pdwcount: *mut u32,
ppval: *mut *mut ::core::option::Option<ITsSbSession>,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), targetname.into_param().abi(), username.into_param().abi(), userdomain.into_param().abi(), poolname.into_param().abi(), initialprogram.into_param().abi(), ::core::mem::transmute(psessionstate), ::core::mem::transmute(pdwcount), ::core::mem::transmute(ppval)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn GetFarmProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, farmname: Param0, propertyname: Param1, pvarvalue: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), farmname.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pvarvalue)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeleteTarget<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, hostname: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), targetname.into_param().abi(), hostname.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn SetTargetPropertyWithVersionCheck<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTarget>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, ptarget: Param0, propertyname: Param1, pproperty: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ptarget.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pproperty)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn SetEnvironmentPropertyWithVersionCheck<'a, Param0: ::windows::core::IntoParam<'a, ITsSbEnvironment>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, penvironment: Param0, propertyname: Param1, pproperty: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), penvironment.into_param().abi(), propertyname.into_param().abi(), ::core::mem::transmute(pproperty)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn AcquireTargetLock<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0, dwtimeout: u32) -> ::windows::core::Result<::windows::core::IUnknown> {
let mut result__: <::windows::core::IUnknown as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), targetname.into_param().abi(), ::core::mem::transmute(dwtimeout), &mut result__).from_abi::<::windows::core::IUnknown>(result__)
}
pub unsafe fn ReleaseTargetLock<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>>(&self, pcontext: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), pcontext.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TestAndSetServerState<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, poolname: Param0, serverfqdn: Param1, newstate: TARGET_STATE, teststate: TARGET_STATE) -> ::windows::core::Result<TARGET_STATE> {
let mut result__: <TARGET_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self), poolname.into_param().abi(), serverfqdn.into_param().abi(), ::core::mem::transmute(newstate), ::core::mem::transmute(teststate), &mut result__).from_abi::<TARGET_STATE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetServerWaitingToStart<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, poolname: Param0, servername: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), poolname.into_param().abi(), servername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetServerState<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, poolname: Param0, serverfqdn: Param1) -> ::windows::core::Result<TARGET_STATE> {
let mut result__: <TARGET_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), poolname.into_param().abi(), serverfqdn.into_param().abi(), &mut result__).from_abi::<TARGET_STATE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetServerDrainMode<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, serverfqdn: Param0, drainmode: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), serverfqdn.into_param().abi(), ::core::mem::transmute(drainmode)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbResourcePluginStore {
type Vtable = ITsSbResourcePluginStore_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c38f65f_bcf1_4036_a6bf_9e3cccae0b63);
}
impl ::core::convert::From<ITsSbResourcePluginStore> for ::windows::core::IUnknown {
fn from(value: ITsSbResourcePluginStore) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbResourcePluginStore> for ::windows::core::IUnknown {
fn from(value: &ITsSbResourcePluginStore) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbResourcePluginStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbResourcePluginStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbResourcePluginStore_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pptarget: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwsessionid: u32, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppsession: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptarget: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psession: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penvironment: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, environmentname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bignoreowner: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwcount: *mut u32, pval: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, environmentname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ppenvironment: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwcount: *mut u32, pval: *mut *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptarget: ::windows::core::RawPtr, bforcewrite: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penvironment: ::windows::core::RawPtr, bforcewrite: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psession: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pproperty: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, environmentname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pproperty: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, newstate: TARGET_STATE, poldstate: *mut TARGET_STATE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sbsession: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, envname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, sortbyfieldid: TS_SB_SORT_BY, sortybypropname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pdwcount: *mut u32, pval: *mut *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
username: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
userdomain: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
initialprogram: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
psessionstate: *const TSSESSION_STATE,
pdwcount: *mut u32,
ppval: *mut *mut ::windows::core::RawPtr,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, farmname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pvarvalue: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, hostname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptarget: ::windows::core::RawPtr, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pproperty: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, penvironment: ::windows::core::RawPtr, propertyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pproperty: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwtimeout: u32, ppcontext: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcontext: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, serverfqdn: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, newstate: TARGET_STATE, teststate: TARGET_STATE, pinitstate: *mut TARGET_STATE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, servername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, poolname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, serverfqdn: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pstate: *mut TARGET_STATE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, serverfqdn: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, drainmode: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbServiceNotification(pub ::windows::core::IUnknown);
impl ITsSbServiceNotification {
pub unsafe fn NotifyServiceFailure(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn NotifyServiceSuccess(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbServiceNotification {
type Vtable = ITsSbServiceNotification_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x86cb68ae_86e0_4f57_8a64_bb7406bc5550);
}
impl ::core::convert::From<ITsSbServiceNotification> for ::windows::core::IUnknown {
fn from(value: ITsSbServiceNotification) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbServiceNotification> for ::windows::core::IUnknown {
fn from(value: &ITsSbServiceNotification) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbServiceNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbServiceNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbServiceNotification_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbSession(pub ::windows::core::IUnknown);
impl ITsSbSession {
pub unsafe fn SessionId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTargetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, targetname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), targetname.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Username(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Domain(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn State(&self) -> ::windows::core::Result<TSSESSION_STATE> {
let mut result__: <TSSESSION_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<TSSESSION_STATE>(result__)
}
pub unsafe fn SetState(&self, state: TSSESSION_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(state)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateTime(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetCreateTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::FILETIME>>(&self, time: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), time.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectTime(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetDisconnectTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::FILETIME>>(&self, time: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), time.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn InitialProgram(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetInitialProgram<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, application: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), application.into_param().abi()).ok()
}
pub unsafe fn ClientDisplay(&self) -> ::windows::core::Result<CLIENT_DISPLAY> {
let mut result__: <CLIENT_DISPLAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), &mut result__).from_abi::<CLIENT_DISPLAY>(result__)
}
pub unsafe fn SetClientDisplay<'a, Param0: ::windows::core::IntoParam<'a, CLIENT_DISPLAY>>(&self, pclientdisplay: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), pclientdisplay.into_param().abi()).ok()
}
pub unsafe fn ProtocolType(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn SetProtocolType(&self, val: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(val)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbSession {
type Vtable = ITsSbSession_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd453aac7_b1d8_4c5e_ba34_9afb4c8c5510);
}
impl ::core::convert::From<ITsSbSession> for ::windows::core::IUnknown {
fn from(value: ITsSbSession) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbSession> for ::windows::core::IUnknown {
fn from(value: &ITsSbSession) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbSession {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbSession {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbSession_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, username: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, domain: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstate: *mut TSSESSION_STATE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, state: TSSESSION_STATE) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptime: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, time: super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptime: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, time: super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, app: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, application: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientdisplay: *mut CLIENT_DISPLAY) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientdisplay: CLIENT_DISPLAY) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbTarget(pub ::windows::core::IUnknown);
impl ITsSbTarget {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTargetName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, val: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), val.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn FarmName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetFarmName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, val: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), val.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetFQDN(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTargetFQDN<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, val: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), val.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetNetbios(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTargetNetbios<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, val: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), val.into_param().abi()).ok()
}
pub unsafe fn IpAddresses(&self, sockaddr: *mut TSSD_ConnectionPoint, numaddresses: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(sockaddr), ::core::mem::transmute(numaddresses)).ok()
}
pub unsafe fn SetIpAddresses(&self, sockaddr: *const TSSD_ConnectionPoint, numaddresses: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(sockaddr), ::core::mem::transmute(numaddresses)).ok()
}
pub unsafe fn TargetState(&self) -> ::windows::core::Result<TARGET_STATE> {
let mut result__: <TARGET_STATE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<TARGET_STATE>(result__)
}
pub unsafe fn SetTargetState(&self, state: TARGET_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(state)).ok()
}
pub unsafe fn TargetPropertySet(&self) -> ::windows::core::Result<ITsSbTargetPropertySet> {
let mut result__: <ITsSbTargetPropertySet as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ITsSbTargetPropertySet>(result__)
}
pub unsafe fn SetTargetPropertySet<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTargetPropertySet>>(&self, pval: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), pval.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnvironmentName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEnvironmentName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, val: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), val.into_param().abi()).ok()
}
pub unsafe fn NumSessions(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn NumPendingConnections(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn TargetLoad(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbTarget {
type Vtable = ITsSbTarget_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x16616ecc_272d_411d_b324_126893033856);
}
impl ::core::convert::From<ITsSbTarget> for ::windows::core::IUnknown {
fn from(value: ITsSbTarget) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbTarget> for ::windows::core::IUnknown {
fn from(value: &ITsSbTarget) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbTarget {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbTarget {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbTarget_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetfqdnname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, targetnetbiosname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sockaddr: *mut TSSD_ConnectionPoint, numaddresses: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sockaddr: *const TSSD_ConnectionPoint, numaddresses: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstate: *mut TARGET_STATE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, state: TARGET_STATE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertyset: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, val: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumsessions: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumpendingconnections: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptargetload: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbTargetPropertySet(pub ::windows::core::IUnknown);
impl ITsSbTargetPropertySet {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Read<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Com::IErrorLog>>(&self, pszpropname: Param0, pvar: *mut super::Com::VARIANT, perrorlog: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar), perrorlog.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Write<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpropname: Param0, pvar: *const super::Com::VARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszpropname.into_param().abi(), ::core::mem::transmute(pvar)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbTargetPropertySet {
type Vtable = ITsSbTargetPropertySet_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf7bda5d6_994c_4e11_a079_2763b61830ac);
}
impl ::core::convert::From<ITsSbTargetPropertySet> for ::windows::core::IUnknown {
fn from(value: ITsSbTargetPropertySet) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbTargetPropertySet> for ::windows::core::IUnknown {
fn from(value: &ITsSbTargetPropertySet) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbTargetPropertySet> for ITsSbPropertySet {
fn from(value: ITsSbTargetPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbTargetPropertySet> for ITsSbPropertySet {
fn from(value: &ITsSbTargetPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPropertySet> for &ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPropertySet> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<ITsSbTargetPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: ITsSbTargetPropertySet) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl ::core::convert::From<&ITsSbTargetPropertySet> for super::Com::StructuredStorage::IPropertyBag {
fn from(value: &ITsSbTargetPropertySet) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::StructuredStorage::IPropertyBag> for &ITsSbTargetPropertySet {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::StructuredStorage::IPropertyBag> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbTargetPropertySet_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, perrorlog: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpropname: super::super::Foundation::PWSTR, pvar: *const ::core::mem::ManuallyDrop<super::Com::VARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbTaskInfo(pub ::windows::core::IUnknown);
impl ITsSbTaskInfo {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn TargetId(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EndTime(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Deadline(&self) -> ::windows::core::Result<super::super::Foundation::FILETIME> {
let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Identifier(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Label(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn Context(&self) -> ::windows::core::Result<*mut super::Com::SAFEARRAY> {
let mut result__: <*mut super::Com::SAFEARRAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut super::Com::SAFEARRAY>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Plugin(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn Status(&self) -> ::windows::core::Result<RDV_TASK_STATUS> {
let mut result__: <RDV_TASK_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<RDV_TASK_STATUS>(result__)
}
}
unsafe impl ::windows::core::Interface for ITsSbTaskInfo {
type Vtable = ITsSbTaskInfo_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x523d1083_89be_48dd_99ea_04e82ffa7265);
}
impl ::core::convert::From<ITsSbTaskInfo> for ::windows::core::IUnknown {
fn from(value: ITsSbTaskInfo) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbTaskInfo> for ::windows::core::IUnknown {
fn from(value: &ITsSbTaskInfo) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbTaskInfo {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbTaskInfo {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbTaskInfo_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstarttime: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pendtime: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdeadline: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pidentifier: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plabel: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcontext: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplugin: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstatus: *mut RDV_TASK_STATUS) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbTaskPlugin(pub ::windows::core::IUnknown);
impl ITsSbTaskPlugin {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, ITsSbProvider>, Param1: ::windows::core::IntoParam<'a, ITsSbPluginNotifySink>, Param2: ::windows::core::IntoParam<'a, ITsSbPluginPropertySet>>(&self, pprovider: Param0, pnotifysink: Param1, ppropertyset: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pprovider.into_param().abi(), pnotifysink.into_param().abi(), ppropertyset.into_param().abi()).ok()
}
pub unsafe fn Terminate(&self, hr: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hr)).ok()
}
pub unsafe fn InitializeTaskPlugin<'a, Param0: ::windows::core::IntoParam<'a, ITsSbTaskPluginNotifySink>>(&self, pitssbtaskpluginnotifysink: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pitssbtaskpluginnotifysink.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetTaskQueue<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pszhostname: Param0, sbtaskinfosize: u32, pitssbtaskinfo: *const ::core::option::Option<ITsSbTaskInfo>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), pszhostname.into_param().abi(), ::core::mem::transmute(sbtaskinfosize), ::core::mem::transmute(pitssbtaskinfo)).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbTaskPlugin {
type Vtable = ITsSbTaskPlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfa22ef0f_8705_41be_93bc_44bdbcf1c9c4);
}
impl ::core::convert::From<ITsSbTaskPlugin> for ::windows::core::IUnknown {
fn from(value: ITsSbTaskPlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbTaskPlugin> for ::windows::core::IUnknown {
fn from(value: &ITsSbTaskPlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbTaskPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbTaskPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbTaskPlugin> for ITsSbPlugin {
fn from(value: ITsSbTaskPlugin) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbTaskPlugin> for ITsSbPlugin {
fn from(value: &ITsSbTaskPlugin) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for ITsSbTaskPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbPlugin> for &ITsSbTaskPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbTaskPlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprovider: ::windows::core::RawPtr, pnotifysink: ::windows::core::RawPtr, ppropertyset: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hr: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pitssbtaskpluginnotifysink: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszhostname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, sbtaskinfosize: u32, pitssbtaskinfo: *const ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ITsSbTaskPluginNotifySink(pub ::windows::core::IUnknown);
impl ITsSbTaskPluginNotifySink {
pub unsafe fn OnError(&self, hrerror: ::windows::core::HRESULT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrerror)).ok()
}
pub unsafe fn OnReportStatus(&self, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(messagetype), ::core::mem::transmute(messageid)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn OnSetTaskTime<
'a,
Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param1: ::windows::core::IntoParam<'a, super::super::Foundation::FILETIME>,
Param2: ::windows::core::IntoParam<'a, super::super::Foundation::FILETIME>,
Param3: ::windows::core::IntoParam<'a, super::super::Foundation::FILETIME>,
Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
>(
&self,
sztargetname: Param0,
taskstarttime: Param1,
taskendtime: Param2,
taskdeadline: Param3,
sztasklabel: Param4,
sztaskidentifier: Param5,
sztaskplugin: Param6,
dwtaskstatus: u32,
sacontext: *const super::Com::SAFEARRAY,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(
::core::mem::transmute_copy(self),
sztargetname.into_param().abi(),
taskstarttime.into_param().abi(),
taskendtime.into_param().abi(),
taskdeadline.into_param().abi(),
sztasklabel.into_param().abi(),
sztaskidentifier.into_param().abi(),
sztaskplugin.into_param().abi(),
::core::mem::transmute(dwtaskstatus),
::core::mem::transmute(sacontext),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDeleteTaskTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, sztargetname: Param0, sztaskidentifier: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), sztargetname.into_param().abi(), sztaskidentifier.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnUpdateTaskStatus<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, sztargetname: Param0, taskidentifier: Param1, taskstatus: RDV_TASK_STATUS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), sztargetname.into_param().abi(), taskidentifier.into_param().abi(), ::core::mem::transmute(taskstatus)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnReportTasks<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, szhostname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), szhostname.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ITsSbTaskPluginNotifySink {
type Vtable = ITsSbTaskPluginNotifySink_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6aaf899e_c2ec_45ee_aa37_45e60895261a);
}
impl ::core::convert::From<ITsSbTaskPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: ITsSbTaskPluginNotifySink) -> Self {
value.0
}
}
impl ::core::convert::From<&ITsSbTaskPluginNotifySink> for ::windows::core::IUnknown {
fn from(value: &ITsSbTaskPluginNotifySink) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITsSbTaskPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ITsSbTaskPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ITsSbTaskPluginNotifySink> for ITsSbBaseNotifySink {
fn from(value: ITsSbTaskPluginNotifySink) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ITsSbTaskPluginNotifySink> for ITsSbBaseNotifySink {
fn from(value: &ITsSbTaskPluginNotifySink) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for ITsSbTaskPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ITsSbBaseNotifySink> for &ITsSbTaskPluginNotifySink {
fn into_param(self) -> ::windows::core::Param<'a, ITsSbBaseNotifySink> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ITsSbTaskPluginNotifySink_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrerror: ::windows::core::HRESULT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messagetype: CLIENT_MESSAGE_TYPE, messageid: u32) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
sztargetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
taskstarttime: super::super::Foundation::FILETIME,
taskendtime: super::super::Foundation::FILETIME,
taskdeadline: super::super::Foundation::FILETIME,
sztasklabel: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
sztaskidentifier: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
sztaskplugin: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
dwtaskstatus: u32,
sacontext: *const super::Com::SAFEARRAY,
) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sztargetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, sztaskidentifier: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sztargetname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, taskidentifier: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, taskstatus: RDV_TASK_STATUS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, szhostname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsEnhancedFastReconnectArbitrator(pub ::windows::core::IUnknown);
impl IWRdsEnhancedFastReconnectArbitrator {
pub unsafe fn GetSessionForEnhancedFastReconnect(&self, psessionidarray: *const i32, dwsessioncount: u32) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(psessionidarray), ::core::mem::transmute(dwsessioncount), &mut result__).from_abi::<i32>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsEnhancedFastReconnectArbitrator {
type Vtable = IWRdsEnhancedFastReconnectArbitrator_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5718ae9b_47f2_499f_b634_d8175bd51131);
}
impl ::core::convert::From<IWRdsEnhancedFastReconnectArbitrator> for ::windows::core::IUnknown {
fn from(value: IWRdsEnhancedFastReconnectArbitrator) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsEnhancedFastReconnectArbitrator> for ::windows::core::IUnknown {
fn from(value: &IWRdsEnhancedFastReconnectArbitrator) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsEnhancedFastReconnectArbitrator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsEnhancedFastReconnectArbitrator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsEnhancedFastReconnectArbitrator_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psessionidarray: *const i32, dwsessioncount: u32, presultsessionid: *mut i32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsGraphicsChannel(pub ::windows::core::IUnknown);
impl IWRdsGraphicsChannel {
pub unsafe fn Write<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>>(&self, cbsize: u32, pbuffer: *const u8, pcontext: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(cbsize), ::core::mem::transmute(pbuffer), pcontext.into_param().abi()).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Open<'a, Param0: ::windows::core::IntoParam<'a, IWRdsGraphicsChannelEvents>, Param1: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>>(&self, pchannelevents: Param0, popencontext: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pchannelevents.into_param().abi(), popencontext.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsGraphicsChannel {
type Vtable = IWRdsGraphicsChannel_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x684b7a0b_edff_43ad_d5a2_4a8d5388f401);
}
impl ::core::convert::From<IWRdsGraphicsChannel> for ::windows::core::IUnknown {
fn from(value: IWRdsGraphicsChannel) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsGraphicsChannel> for ::windows::core::IUnknown {
fn from(value: &IWRdsGraphicsChannel) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsGraphicsChannel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsGraphicsChannel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsGraphicsChannel_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cbsize: u32, pbuffer: *const u8, pcontext: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pchannelevents: ::windows::core::RawPtr, popencontext: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsGraphicsChannelEvents(pub ::windows::core::IUnknown);
impl IWRdsGraphicsChannelEvents {
pub unsafe fn OnDataReceived(&self, cbsize: u32, pbuffer: *const u8) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(cbsize), ::core::mem::transmute(pbuffer)).ok()
}
pub unsafe fn OnClose(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn OnChannelOpened<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>>(&self, openresult: ::windows::core::HRESULT, popencontext: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(openresult), popencontext.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDataSent<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, pwritecontext: Param0, bcancelled: Param1, pbuffer: *const u8, cbbuffer: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), pwritecontext.into_param().abi(), bcancelled.into_param().abi(), ::core::mem::transmute(pbuffer), ::core::mem::transmute(cbbuffer)).ok()
}
pub unsafe fn OnMetricsUpdate(&self, bandwidth: u32, rtt: u32, lastsentbyteindex: u64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(bandwidth), ::core::mem::transmute(rtt), ::core::mem::transmute(lastsentbyteindex)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsGraphicsChannelEvents {
type Vtable = IWRdsGraphicsChannelEvents_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x67f2368c_d674_4fae_66a5_d20628a640d2);
}
impl ::core::convert::From<IWRdsGraphicsChannelEvents> for ::windows::core::IUnknown {
fn from(value: IWRdsGraphicsChannelEvents) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsGraphicsChannelEvents> for ::windows::core::IUnknown {
fn from(value: &IWRdsGraphicsChannelEvents) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsGraphicsChannelEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsGraphicsChannelEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsGraphicsChannelEvents_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cbsize: u32, pbuffer: *const u8) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, openresult: ::windows::core::HRESULT, popencontext: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwritecontext: ::windows::core::RawPtr, bcancelled: super::super::Foundation::BOOL, pbuffer: *const u8, cbbuffer: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bandwidth: u32, rtt: u32, lastsentbyteindex: u64) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsGraphicsChannelManager(pub ::windows::core::IUnknown);
impl IWRdsGraphicsChannelManager {
pub unsafe fn CreateChannel(&self, pszchannelname: *const u8, channeltype: WRdsGraphicsChannelType) -> ::windows::core::Result<IWRdsGraphicsChannel> {
let mut result__: <IWRdsGraphicsChannel as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pszchannelname), ::core::mem::transmute(channeltype), &mut result__).from_abi::<IWRdsGraphicsChannel>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsGraphicsChannelManager {
type Vtable = IWRdsGraphicsChannelManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0fd57159_e83e_476a_a8b9_4a7976e71e18);
}
impl ::core::convert::From<IWRdsGraphicsChannelManager> for ::windows::core::IUnknown {
fn from(value: IWRdsGraphicsChannelManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsGraphicsChannelManager> for ::windows::core::IUnknown {
fn from(value: &IWRdsGraphicsChannelManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsGraphicsChannelManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsGraphicsChannelManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsGraphicsChannelManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszchannelname: *const u8, channeltype: WRdsGraphicsChannelType, ppvirtualchannel: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolConnection(pub ::windows::core::IUnknown);
impl IWRdsProtocolConnection {
pub unsafe fn GetLogonErrorRedirector(&self) -> ::windows::core::Result<IWRdsProtocolLogonErrorRedirector> {
let mut result__: <IWRdsProtocolLogonErrorRedirector as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWRdsProtocolLogonErrorRedirector>(result__)
}
pub unsafe fn AcceptConnection(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetClientData(&self) -> ::windows::core::Result<WTS_CLIENT_DATA> {
let mut result__: <WTS_CLIENT_DATA as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_CLIENT_DATA>(result__)
}
pub unsafe fn GetClientMonitorData(&self, pnummonitors: *mut u32, pprimarymonitor: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(pnummonitors), ::core::mem::transmute(pprimarymonitor)).ok()
}
pub unsafe fn GetUserCredentials(&self) -> ::windows::core::Result<WTS_USER_CREDENTIAL> {
let mut result__: <WTS_USER_CREDENTIAL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_USER_CREDENTIAL>(result__)
}
pub unsafe fn GetLicenseConnection(&self) -> ::windows::core::Result<IWRdsProtocolLicenseConnection> {
let mut result__: <IWRdsProtocolLicenseConnection as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWRdsProtocolLicenseConnection>(result__)
}
pub unsafe fn AuthenticateClientToSession(&self) -> ::windows::core::Result<WTS_SESSION_ID> {
let mut result__: <WTS_SESSION_ID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_SESSION_ID>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn NotifySessionId<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>>(&self, sessionid: *const WTS_SESSION_ID, sessionhandle: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), sessionhandle.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetInputHandles(&self, pkeyboardhandle: *mut super::super::Foundation::HANDLE_PTR, pmousehandle: *mut super::super::Foundation::HANDLE_PTR, pbeephandle: *mut super::super::Foundation::HANDLE_PTR) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pkeyboardhandle), ::core::mem::transmute(pmousehandle), ::core::mem::transmute(pbeephandle)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetVideoHandle(&self) -> ::windows::core::Result<super::super::Foundation::HANDLE_PTR> {
let mut result__: <super::super::Foundation::HANDLE_PTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::HANDLE_PTR>(result__)
}
pub unsafe fn ConnectNotify(&self, sessionid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsUserAllowedToLogon<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, sessionid: u32, usertoken: Param1, pdomainname: Param2, pusername: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), usertoken.into_param().abi(), pdomainname.into_param().abi(), pusername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SessionArbitrationEnumeration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, husertoken: Param0, bsinglesessionperuserenabled: Param1, psessionidarray: *mut u32, pdwsessionidentifiercount: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), husertoken.into_param().abi(), bsinglesessionperuserenabled.into_param().abi(), ::core::mem::transmute(psessionidarray), ::core::mem::transmute(pdwsessionidentifiercount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn LogonNotify<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hclienttoken: Param0, wszusername: Param1, wszdomainname: Param2, sessionid: *const WTS_SESSION_ID, pwrdsconnectionsettings: *mut WRDS_CONNECTION_SETTINGS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), hclienttoken.into_param().abi(), wszusername.into_param().abi(), wszdomainname.into_param().abi(), ::core::mem::transmute(sessionid), ::core::mem::transmute(pwrdsconnectionsettings)).ok()
}
pub unsafe fn PreDisconnect(&self, disconnectreason: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(disconnectreason)).ok()
}
pub unsafe fn DisconnectNotify(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn GetProtocolStatus(&self) -> ::windows::core::Result<WTS_PROTOCOL_STATUS> {
let mut result__: <WTS_PROTOCOL_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_PROTOCOL_STATUS>(result__)
}
pub unsafe fn GetLastInputTime(&self) -> ::windows::core::Result<u64> {
let mut result__: <u64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u64>(result__)
}
pub unsafe fn SetErrorInfo(&self, ulerror: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(ulerror)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateVirtualChannel<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, szendpointname: Param0, bstatic: Param1, requestedpriority: u32) -> ::windows::core::Result<usize> {
let mut result__: <usize as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), szendpointname.into_param().abi(), bstatic.into_param().abi(), ::core::mem::transmute(requestedpriority), &mut result__).from_abi::<usize>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QueryProperty<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, querytype: Param0, ulnumentriesin: u32, ulnumentriesout: u32, ppropertyentriesin: *const WTS_PROPERTY_VALUE, ppropertyentriesout: *mut WTS_PROPERTY_VALUE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), querytype.into_param().abi(), ::core::mem::transmute(ulnumentriesin), ::core::mem::transmute(ulnumentriesout), ::core::mem::transmute(ppropertyentriesin), ::core::mem::transmute(ppropertyentriesout)).ok()
}
pub unsafe fn GetShadowConnection(&self) -> ::windows::core::Result<IWRdsProtocolShadowConnection> {
let mut result__: <IWRdsProtocolShadowConnection as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWRdsProtocolShadowConnection>(result__)
}
pub unsafe fn NotifyCommandProcessCreated(&self, sessionid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolConnection {
type Vtable = IWRdsProtocolConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x324ed94f_fdaf_4ff6_81a8_42abe755830b);
}
impl ::core::convert::From<IWRdsProtocolConnection> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolConnection> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplogonerrorredir: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientdata: *mut WTS_CLIENT_DATA) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnummonitors: *mut u32, pprimarymonitor: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pusercreds: *mut WTS_USER_CREDENTIAL) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplicenseconnection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *mut WTS_SESSION_ID) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID, sessionhandle: super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pkeyboardhandle: *mut super::super::Foundation::HANDLE_PTR, pmousehandle: *mut super::super::Foundation::HANDLE_PTR, pbeephandle: *mut super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvideohandle: *mut super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32, usertoken: super::super::Foundation::HANDLE_PTR, pdomainname: super::super::Foundation::PWSTR, pusername: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, husertoken: super::super::Foundation::HANDLE_PTR, bsinglesessionperuserenabled: super::super::Foundation::BOOL, psessionidarray: *mut u32, pdwsessionidentifiercount: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hclienttoken: super::super::Foundation::HANDLE_PTR, wszusername: super::super::Foundation::PWSTR, wszdomainname: super::super::Foundation::PWSTR, sessionid: *const WTS_SESSION_ID, pwrdsconnectionsettings: *mut WRDS_CONNECTION_SETTINGS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, disconnectreason: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprotocolstatus: *mut WTS_PROTOCOL_STATUS) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plastinputtime: *mut u64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ulerror: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, szendpointname: super::super::Foundation::PSTR, bstatic: super::super::Foundation::BOOL, requestedpriority: u32, phchannel: *mut usize) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, querytype: ::windows::core::GUID, ulnumentriesin: u32, ulnumentriesout: u32, ppropertyentriesin: *const WTS_PROPERTY_VALUE, ppropertyentriesout: *mut WTS_PROPERTY_VALUE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppshadowconnection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolConnectionCallback(pub ::windows::core::IUnknown);
impl IWRdsProtocolConnectionCallback {
pub unsafe fn OnReady(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BrokenConnection(&self, reason: u32, source: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(reason), ::core::mem::transmute(source)).ok()
}
pub unsafe fn StopScreenUpdates(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn RedrawWindow(&self, rect: *const WTS_SMALL_RECT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(rect)).ok()
}
pub unsafe fn GetConnectionId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolConnectionCallback {
type Vtable = IWRdsProtocolConnectionCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf1d70332_d070_4ef1_a088_78313536c2d6);
}
impl ::core::convert::From<IWRdsProtocolConnectionCallback> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolConnectionCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolConnectionCallback> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolConnectionCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolConnectionCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolConnectionCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolConnectionCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, reason: u32, source: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rect: *const WTS_SMALL_RECT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnectionid: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolConnectionSettings(pub ::windows::core::IUnknown);
impl IWRdsProtocolConnectionSettings {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetConnectionSetting<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, propertyid: Param0, ppropertyentriesin: *const WTS_PROPERTY_VALUE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), propertyid.into_param().abi(), ::core::mem::transmute(ppropertyentriesin)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetConnectionSetting<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, propertyid: Param0) -> ::windows::core::Result<WTS_PROPERTY_VALUE> {
let mut result__: <WTS_PROPERTY_VALUE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), propertyid.into_param().abi(), &mut result__).from_abi::<WTS_PROPERTY_VALUE>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolConnectionSettings {
type Vtable = IWRdsProtocolConnectionSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x83fcf5d3_f6f4_ea94_9cd2_32f280e1e510);
}
impl ::core::convert::From<IWRdsProtocolConnectionSettings> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolConnectionSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolConnectionSettings> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolConnectionSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolConnectionSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolConnectionSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolConnectionSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, propertyid: ::windows::core::GUID, ppropertyentriesin: *const WTS_PROPERTY_VALUE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, propertyid: ::windows::core::GUID, ppropertyentriesout: *mut WTS_PROPERTY_VALUE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolLicenseConnection(pub ::windows::core::IUnknown);
impl IWRdsProtocolLicenseConnection {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RequestLicensingCapabilities(&self, pplicensecapabilities: *mut WTS_LICENSE_CAPABILITIES, pcblicensecapabilities: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pplicensecapabilities), ::core::mem::transmute(pcblicensecapabilities)).ok()
}
pub unsafe fn SendClientLicense(&self, pclientlicense: *const u8, cbclientlicense: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pclientlicense), ::core::mem::transmute(cbclientlicense)).ok()
}
pub unsafe fn RequestClientLicense(&self, reserve1: *const u8, reserve2: u32, ppclientlicense: *mut u8, pcbclientlicense: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(reserve1), ::core::mem::transmute(reserve2), ::core::mem::transmute(ppclientlicense), ::core::mem::transmute(pcbclientlicense)).ok()
}
pub unsafe fn ProtocolComplete(&self, ulcomplete: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(ulcomplete)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolLicenseConnection {
type Vtable = IWRdsProtocolLicenseConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1d6a145f_d095_4424_957a_407fae822d84);
}
impl ::core::convert::From<IWRdsProtocolLicenseConnection> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolLicenseConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolLicenseConnection> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolLicenseConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolLicenseConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolLicenseConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolLicenseConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplicensecapabilities: *mut WTS_LICENSE_CAPABILITIES, pcblicensecapabilities: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientlicense: *const u8, cbclientlicense: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, reserve1: *const u8, reserve2: u32, ppclientlicense: *mut u8, pcbclientlicense: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ulcomplete: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolListener(pub ::windows::core::IUnknown);
impl IWRdsProtocolListener {
pub unsafe fn GetSettings(&self, wrdslistenersettinglevel: WRDS_LISTENER_SETTING_LEVEL) -> ::windows::core::Result<WRDS_LISTENER_SETTINGS> {
let mut result__: <WRDS_LISTENER_SETTINGS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(wrdslistenersettinglevel), &mut result__).from_abi::<WRDS_LISTENER_SETTINGS>(result__)
}
pub unsafe fn StartListen<'a, Param0: ::windows::core::IntoParam<'a, IWRdsProtocolListenerCallback>>(&self, pcallback: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pcallback.into_param().abi()).ok()
}
pub unsafe fn StopListen(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolListener {
type Vtable = IWRdsProtocolListener_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfcbc131b_c686_451d_a773_e279e230f540);
}
impl ::core::convert::From<IWRdsProtocolListener> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolListener) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolListener> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolListener) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolListener_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, wrdslistenersettinglevel: WRDS_LISTENER_SETTING_LEVEL, pwrdslistenersettings: *mut WRDS_LISTENER_SETTINGS) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcallback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolListenerCallback(pub ::windows::core::IUnknown);
impl IWRdsProtocolListenerCallback {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnConnected<'a, Param0: ::windows::core::IntoParam<'a, IWRdsProtocolConnection>>(&self, pconnection: Param0, pwrdsconnectionsettings: *const WRDS_CONNECTION_SETTINGS) -> ::windows::core::Result<IWRdsProtocolConnectionCallback> {
let mut result__: <IWRdsProtocolConnectionCallback as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pconnection.into_param().abi(), ::core::mem::transmute(pwrdsconnectionsettings), &mut result__).from_abi::<IWRdsProtocolConnectionCallback>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolListenerCallback {
type Vtable = IWRdsProtocolListenerCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3ab27e5b_4449_4dc1_b74a_91621d4fe984);
}
impl ::core::convert::From<IWRdsProtocolListenerCallback> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolListenerCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolListenerCallback> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolListenerCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolListenerCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnection: ::windows::core::RawPtr, pwrdsconnectionsettings: *const WRDS_CONNECTION_SETTINGS, pcallback: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolLogonErrorRedirector(pub ::windows::core::IUnknown);
impl IWRdsProtocolLogonErrorRedirector {
pub unsafe fn OnBeginPainting(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectStatus<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmessage: Param0) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszmessage.into_param().abi(), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectMessage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszcaption: Param0, pszmessage: Param1, utype: u32) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pszcaption.into_param().abi(), pszmessage.into_param().abi(), ::core::mem::transmute(utype), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectLogonError<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, ntsstatus: i32, ntssubstatus: i32, pszcaption: Param2, pszmessage: Param3, utype: u32) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(ntsstatus), ::core::mem::transmute(ntssubstatus), pszcaption.into_param().abi(), pszmessage.into_param().abi(), ::core::mem::transmute(utype), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolLogonErrorRedirector {
type Vtable = IWRdsProtocolLogonErrorRedirector_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x519fe83b_142a_4120_a3d5_a405d315281a);
}
impl ::core::convert::From<IWRdsProtocolLogonErrorRedirector> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolLogonErrorRedirector) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolLogonErrorRedirector> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolLogonErrorRedirector) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolLogonErrorRedirector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolLogonErrorRedirector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolLogonErrorRedirector_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmessage: super::super::Foundation::PWSTR, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszcaption: super::super::Foundation::PWSTR, pszmessage: super::super::Foundation::PWSTR, utype: u32, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ntsstatus: i32, ntssubstatus: i32, pszcaption: super::super::Foundation::PWSTR, pszmessage: super::super::Foundation::PWSTR, utype: u32, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolManager(pub ::windows::core::IUnknown);
impl IWRdsProtocolManager {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, IWRdsProtocolSettings>>(&self, piwrdssettings: Param0, pwrdssettings: *const WRDS_SETTINGS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), piwrdssettings.into_param().abi(), ::core::mem::transmute(pwrdssettings)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateListener<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, wszlistenername: Param0) -> ::windows::core::Result<IWRdsProtocolListener> {
let mut result__: <IWRdsProtocolListener as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), wszlistenername.into_param().abi(), &mut result__).from_abi::<IWRdsProtocolListener>(result__)
}
pub unsafe fn NotifyServiceStateChange(&self, ptsservicestatechange: *const WTS_SERVICE_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(ptsservicestatechange)).ok()
}
pub unsafe fn NotifySessionOfServiceStart(&self, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
pub unsafe fn NotifySessionOfServiceStop(&self, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
pub unsafe fn NotifySessionStateChange(&self, sessionid: *const WTS_SESSION_ID, eventid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), ::core::mem::transmute(eventid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn NotifySettingsChange(&self, pwrdssettings: *const WRDS_SETTINGS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(pwrdssettings)).ok()
}
pub unsafe fn Uninitialize(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolManager {
type Vtable = IWRdsProtocolManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdc796967_3abb_40cd_a446_105276b58950);
}
impl ::core::convert::From<IWRdsProtocolManager> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolManager> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piwrdssettings: ::windows::core::RawPtr, pwrdssettings: *const WRDS_SETTINGS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, wszlistenername: super::super::Foundation::PWSTR, pprotocollistener: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptsservicestatechange: *const WTS_SERVICE_STATE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID, eventid: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwrdssettings: *const WRDS_SETTINGS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolSettings(pub ::windows::core::IUnknown);
impl IWRdsProtocolSettings {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetSettings(&self, wrdssettingtype: WRDS_SETTING_TYPE, wrdssettinglevel: WRDS_SETTING_LEVEL) -> ::windows::core::Result<WRDS_SETTINGS> {
let mut result__: <WRDS_SETTINGS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(wrdssettingtype), ::core::mem::transmute(wrdssettinglevel), &mut result__).from_abi::<WRDS_SETTINGS>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn MergeSettings(&self, pwrdssettings: *const WRDS_SETTINGS, wrdsconnectionsettinglevel: WRDS_CONNECTION_SETTING_LEVEL, pwrdsconnectionsettings: *mut WRDS_CONNECTION_SETTINGS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pwrdssettings), ::core::mem::transmute(wrdsconnectionsettinglevel), ::core::mem::transmute(pwrdsconnectionsettings)).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolSettings {
type Vtable = IWRdsProtocolSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x654a5a6a_2550_47eb_b6f7_ebd637475265);
}
impl ::core::convert::From<IWRdsProtocolSettings> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolSettings> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, wrdssettingtype: WRDS_SETTING_TYPE, wrdssettinglevel: WRDS_SETTING_LEVEL, pwrdssettings: *mut WRDS_SETTINGS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwrdssettings: *const WRDS_SETTINGS, wrdsconnectionsettinglevel: WRDS_CONNECTION_SETTING_LEVEL, pwrdsconnectionsettings: *mut WRDS_CONNECTION_SETTINGS) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolShadowCallback(pub ::windows::core::IUnknown);
impl IWRdsProtocolShadowCallback {
pub unsafe fn StopShadow(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn InvokeTargetShadow<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param10: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, ptargetservername: Param0, targetsessionid: u32, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: Param10) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(
::core::mem::transmute_copy(self),
ptargetservername.into_param().abi(),
::core::mem::transmute(targetsessionid),
::core::mem::transmute(pparam1),
::core::mem::transmute(param1size),
::core::mem::transmute(pparam2),
::core::mem::transmute(param2size),
::core::mem::transmute(pparam3),
::core::mem::transmute(param3size),
::core::mem::transmute(pparam4),
::core::mem::transmute(param4size),
pclientname.into_param().abi(),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolShadowCallback {
type Vtable = IWRdsProtocolShadowCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe0667ce0_0372_40d6_adb2_a0f3322674d6);
}
impl ::core::convert::From<IWRdsProtocolShadowCallback> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolShadowCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolShadowCallback> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolShadowCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolShadowCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolShadowCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolShadowCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptargetservername: super::super::Foundation::PWSTR, targetsessionid: u32, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsProtocolShadowConnection(pub ::windows::core::IUnknown);
impl IWRdsProtocolShadowConnection {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Start<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, IWRdsProtocolShadowCallback>>(&self, ptargetservername: Param0, targetsessionid: u32, hotkeyvk: u8, hotkeymodifiers: u16, pshadowcallback: Param4) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ptargetservername.into_param().abi(), ::core::mem::transmute(targetsessionid), ::core::mem::transmute(hotkeyvk), ::core::mem::transmute(hotkeymodifiers), pshadowcallback.into_param().abi()).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DoTarget<'a, Param8: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: Param8) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(
::core::mem::transmute_copy(self),
::core::mem::transmute(pparam1),
::core::mem::transmute(param1size),
::core::mem::transmute(pparam2),
::core::mem::transmute(param2size),
::core::mem::transmute(pparam3),
::core::mem::transmute(param3size),
::core::mem::transmute(pparam4),
::core::mem::transmute(param4size),
pclientname.into_param().abi(),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsProtocolShadowConnection {
type Vtable = IWRdsProtocolShadowConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9ae85ce6_cade_4548_8feb_99016597f60a);
}
impl ::core::convert::From<IWRdsProtocolShadowConnection> for ::windows::core::IUnknown {
fn from(value: IWRdsProtocolShadowConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsProtocolShadowConnection> for ::windows::core::IUnknown {
fn from(value: &IWRdsProtocolShadowConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsProtocolShadowConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsProtocolShadowConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsProtocolShadowConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptargetservername: super::super::Foundation::PWSTR, targetsessionid: u32, hotkeyvk: u8, hotkeymodifiers: u16, pshadowcallback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWRdsWddmIddProps(pub ::windows::core::IUnknown);
impl IWRdsWddmIddProps {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetHardwareId<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pdisplaydriverhardwareid: Param0, count: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pdisplaydriverhardwareid.into_param().abi(), ::core::mem::transmute(count)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDriverLoad<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>>(&self, sessionid: u32, driverhandle: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), driverhandle.into_param().abi()).ok()
}
pub unsafe fn OnDriverUnload(&self, sessionid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn EnableWddmIdd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, enabled: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), enabled.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWRdsWddmIddProps {
type Vtable = IWRdsWddmIddProps_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1382df4d_a289_43d1_a184_144726f9af90);
}
impl ::core::convert::From<IWRdsWddmIddProps> for ::windows::core::IUnknown {
fn from(value: IWRdsWddmIddProps) -> Self {
value.0
}
}
impl ::core::convert::From<&IWRdsWddmIddProps> for ::windows::core::IUnknown {
fn from(value: &IWRdsWddmIddProps) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWRdsWddmIddProps {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWRdsWddmIddProps {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWRdsWddmIddProps_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdisplaydriverhardwareid: super::super::Foundation::PWSTR, count: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32, driverhandle: super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enabled: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSBitmapRenderService(pub ::windows::core::IUnknown);
impl IWTSBitmapRenderService {
pub unsafe fn GetMappedRenderer<'a, Param1: ::windows::core::IntoParam<'a, IWTSBitmapRendererCallback>>(&self, mappingid: u64, pmappedrenderercallback: Param1) -> ::windows::core::Result<IWTSBitmapRenderer> {
let mut result__: <IWTSBitmapRenderer as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(mappingid), pmappedrenderercallback.into_param().abi(), &mut result__).from_abi::<IWTSBitmapRenderer>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSBitmapRenderService {
type Vtable = IWTSBitmapRenderService_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xea326091_05fe_40c1_b49c_3d2ef4626a0e);
}
impl ::core::convert::From<IWTSBitmapRenderService> for ::windows::core::IUnknown {
fn from(value: IWTSBitmapRenderService) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSBitmapRenderService> for ::windows::core::IUnknown {
fn from(value: &IWTSBitmapRenderService) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSBitmapRenderService {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSBitmapRenderService {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSBitmapRenderService_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mappingid: u64, pmappedrenderercallback: ::windows::core::RawPtr, ppmappedrenderer: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSBitmapRenderer(pub ::windows::core::IUnknown);
impl IWTSBitmapRenderer {
pub unsafe fn Render<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, imageformat: Param0, dwwidth: u32, dwheight: u32, cbstride: i32, cbimagebuffer: u32, pimagebuffer: *const u8) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), imageformat.into_param().abi(), ::core::mem::transmute(dwwidth), ::core::mem::transmute(dwheight), ::core::mem::transmute(cbstride), ::core::mem::transmute(cbimagebuffer), ::core::mem::transmute(pimagebuffer)).ok()
}
pub unsafe fn GetRendererStatistics(&self) -> ::windows::core::Result<BITMAP_RENDERER_STATISTICS> {
let mut result__: <BITMAP_RENDERER_STATISTICS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<BITMAP_RENDERER_STATISTICS>(result__)
}
pub unsafe fn RemoveMapping(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSBitmapRenderer {
type Vtable = IWTSBitmapRenderer_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5b7acc97_f3c9_46f7_8c5b_fa685d3441b1);
}
impl ::core::convert::From<IWTSBitmapRenderer> for ::windows::core::IUnknown {
fn from(value: IWTSBitmapRenderer) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSBitmapRenderer> for ::windows::core::IUnknown {
fn from(value: &IWTSBitmapRenderer) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSBitmapRenderer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSBitmapRenderer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSBitmapRenderer_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, imageformat: ::windows::core::GUID, dwwidth: u32, dwheight: u32, cbstride: i32, cbimagebuffer: u32, pimagebuffer: *const u8) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstatistics: *mut BITMAP_RENDERER_STATISTICS) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSBitmapRendererCallback(pub ::windows::core::IUnknown);
impl IWTSBitmapRendererCallback {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnTargetSizeChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::RECT>>(&self, rcnewsize: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), rcnewsize.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSBitmapRendererCallback {
type Vtable = IWTSBitmapRendererCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd782928e_fe4e_4e77_ae90_9cd0b3e3b353);
}
impl ::core::convert::From<IWTSBitmapRendererCallback> for ::windows::core::IUnknown {
fn from(value: IWTSBitmapRendererCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSBitmapRendererCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSBitmapRendererCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSBitmapRendererCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSBitmapRendererCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSBitmapRendererCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rcnewsize: super::super::Foundation::RECT) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSListener(pub ::windows::core::IUnknown);
impl IWTSListener {
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
pub unsafe fn GetConfiguration(&self) -> ::windows::core::Result<super::Com::StructuredStorage::IPropertyBag> {
let mut result__: <super::Com::StructuredStorage::IPropertyBag as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::Com::StructuredStorage::IPropertyBag>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSListener {
type Vtable = IWTSListener_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230206_9a39_4d58_8674_cdb4dff4e73b);
}
impl ::core::convert::From<IWTSListener> for ::windows::core::IUnknown {
fn from(value: IWTSListener) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSListener> for ::windows::core::IUnknown {
fn from(value: &IWTSListener) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSListener_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_System_Com_StructuredStorage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pppropertybag: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com_StructuredStorage"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSListenerCallback(pub ::windows::core::IUnknown);
impl IWTSListenerCallback {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnNewChannelConnection<'a, Param0: ::windows::core::IntoParam<'a, IWTSVirtualChannel>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, pchannel: Param0, data: Param1, pbaccept: *mut super::super::Foundation::BOOL, ppcallback: *mut ::core::option::Option<IWTSVirtualChannelCallback>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pchannel.into_param().abi(), data.into_param().abi(), ::core::mem::transmute(pbaccept), ::core::mem::transmute(ppcallback)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSListenerCallback {
type Vtable = IWTSListenerCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230203_d6a7_11d8_b9fd_000bdbd1f198);
}
impl ::core::convert::From<IWTSListenerCallback> for ::windows::core::IUnknown {
fn from(value: IWTSListenerCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSListenerCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSListenerCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSListenerCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pchannel: ::windows::core::RawPtr, data: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbaccept: *mut super::super::Foundation::BOOL, ppcallback: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSPlugin(pub ::windows::core::IUnknown);
impl IWTSPlugin {
pub unsafe fn Initialize<'a, Param0: ::windows::core::IntoParam<'a, IWTSVirtualChannelManager>>(&self, pchannelmgr: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pchannelmgr.into_param().abi()).ok()
}
pub unsafe fn Connected(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Disconnected(&self, dwdisconnectcode: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwdisconnectcode)).ok()
}
pub unsafe fn Terminated(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSPlugin {
type Vtable = IWTSPlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230201_1439_4e62_a414_190d0ac3d40e);
}
impl ::core::convert::From<IWTSPlugin> for ::windows::core::IUnknown {
fn from(value: IWTSPlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSPlugin> for ::windows::core::IUnknown {
fn from(value: &IWTSPlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSPlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pchannelmgr: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwdisconnectcode: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSPluginServiceProvider(pub ::windows::core::IUnknown);
impl IWTSPluginServiceProvider {
pub unsafe fn GetService<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, serviceid: Param0) -> ::windows::core::Result<::windows::core::IUnknown> {
let mut result__: <::windows::core::IUnknown as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), serviceid.into_param().abi(), &mut result__).from_abi::<::windows::core::IUnknown>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSPluginServiceProvider {
type Vtable = IWTSPluginServiceProvider_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd3e07363_087c_476c_86a7_dbb15f46ddb4);
}
impl ::core::convert::From<IWTSPluginServiceProvider> for ::windows::core::IUnknown {
fn from(value: IWTSPluginServiceProvider) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSPluginServiceProvider> for ::windows::core::IUnknown {
fn from(value: &IWTSPluginServiceProvider) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSPluginServiceProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSPluginServiceProvider {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSPluginServiceProvider_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, serviceid: ::windows::core::GUID, ppunkobject: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolConnection(pub ::windows::core::IUnknown);
impl IWTSProtocolConnection {
pub unsafe fn GetLogonErrorRedirector(&self) -> ::windows::core::Result<IWTSProtocolLogonErrorRedirector> {
let mut result__: <IWTSProtocolLogonErrorRedirector as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWTSProtocolLogonErrorRedirector>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SendPolicyData(&self, ppolicydata: *const WTS_POLICY_DATA) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppolicydata)).ok()
}
pub unsafe fn AcceptConnection(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetClientData(&self) -> ::windows::core::Result<WTS_CLIENT_DATA> {
let mut result__: <WTS_CLIENT_DATA as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_CLIENT_DATA>(result__)
}
pub unsafe fn GetUserCredentials(&self) -> ::windows::core::Result<WTS_USER_CREDENTIAL> {
let mut result__: <WTS_USER_CREDENTIAL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_USER_CREDENTIAL>(result__)
}
pub unsafe fn GetLicenseConnection(&self) -> ::windows::core::Result<IWTSProtocolLicenseConnection> {
let mut result__: <IWTSProtocolLicenseConnection as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWTSProtocolLicenseConnection>(result__)
}
pub unsafe fn AuthenticateClientToSession(&self) -> ::windows::core::Result<WTS_SESSION_ID> {
let mut result__: <WTS_SESSION_ID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_SESSION_ID>(result__)
}
pub unsafe fn NotifySessionId(&self, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetProtocolHandles(&self, pkeyboardhandle: *mut super::super::Foundation::HANDLE_PTR, pmousehandle: *mut super::super::Foundation::HANDLE_PTR, pbeephandle: *mut super::super::Foundation::HANDLE_PTR, pvideohandle: *mut super::super::Foundation::HANDLE_PTR) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pkeyboardhandle), ::core::mem::transmute(pmousehandle), ::core::mem::transmute(pbeephandle), ::core::mem::transmute(pvideohandle)).ok()
}
pub unsafe fn ConnectNotify(&self, sessionid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsUserAllowedToLogon<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, sessionid: u32, usertoken: Param1, pdomainname: Param2, pusername: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), usertoken.into_param().abi(), pdomainname.into_param().abi(), pusername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SessionArbitrationEnumeration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, husertoken: Param0, bsinglesessionperuserenabled: Param1, psessionidarray: *mut u32, pdwsessionidentifiercount: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), husertoken.into_param().abi(), bsinglesessionperuserenabled.into_param().abi(), ::core::mem::transmute(psessionidarray), ::core::mem::transmute(pdwsessionidentifiercount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn LogonNotify<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE_PTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hclienttoken: Param0, wszusername: Param1, wszdomainname: Param2, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), hclienttoken.into_param().abi(), wszusername.into_param().abi(), wszdomainname.into_param().abi(), ::core::mem::transmute(sessionid)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetUserData(&self, ppolicydata: *const WTS_POLICY_DATA, pclientdata: *mut WTS_USER_DATA) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppolicydata), ::core::mem::transmute(pclientdata)).ok()
}
pub unsafe fn DisconnectNotify(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn GetProtocolStatus(&self) -> ::windows::core::Result<WTS_PROTOCOL_STATUS> {
let mut result__: <WTS_PROTOCOL_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), &mut result__).from_abi::<WTS_PROTOCOL_STATUS>(result__)
}
pub unsafe fn GetLastInputTime(&self) -> ::windows::core::Result<u64> {
let mut result__: <u64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u64>(result__)
}
pub unsafe fn SetErrorInfo(&self, ulerror: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(ulerror)).ok()
}
pub unsafe fn SendBeep(&self, frequency: u32, duration: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), ::core::mem::transmute(frequency), ::core::mem::transmute(duration)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateVirtualChannel<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, szendpointname: Param0, bstatic: Param1, requestedpriority: u32) -> ::windows::core::Result<usize> {
let mut result__: <usize as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), szendpointname.into_param().abi(), bstatic.into_param().abi(), ::core::mem::transmute(requestedpriority), &mut result__).from_abi::<usize>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn QueryProperty<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, querytype: Param0, ulnumentriesin: u32, ulnumentriesout: u32, ppropertyentriesin: *const WTS_PROPERTY_VALUE, ppropertyentriesout: *mut WTS_PROPERTY_VALUE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), querytype.into_param().abi(), ::core::mem::transmute(ulnumentriesin), ::core::mem::transmute(ulnumentriesout), ::core::mem::transmute(ppropertyentriesin), ::core::mem::transmute(ppropertyentriesout)).ok()
}
pub unsafe fn GetShadowConnection(&self) -> ::windows::core::Result<IWTSProtocolShadowConnection> {
let mut result__: <IWTSProtocolShadowConnection as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IWTSProtocolShadowConnection>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolConnection {
type Vtable = IWTSProtocolConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23083765_9095_4648_98bf_ef81c914032d);
}
impl ::core::convert::From<IWTSProtocolConnection> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolConnection> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplogonerrorredir: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppolicydata: *const WTS_POLICY_DATA) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientdata: *mut WTS_CLIENT_DATA) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pusercreds: *mut WTS_USER_CREDENTIAL) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplicenseconnection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *mut WTS_SESSION_ID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pkeyboardhandle: *mut super::super::Foundation::HANDLE_PTR, pmousehandle: *mut super::super::Foundation::HANDLE_PTR, pbeephandle: *mut super::super::Foundation::HANDLE_PTR, pvideohandle: *mut super::super::Foundation::HANDLE_PTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: u32, usertoken: super::super::Foundation::HANDLE_PTR, pdomainname: super::super::Foundation::PWSTR, pusername: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, husertoken: super::super::Foundation::HANDLE_PTR, bsinglesessionperuserenabled: super::super::Foundation::BOOL, psessionidarray: *mut u32, pdwsessionidentifiercount: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hclienttoken: super::super::Foundation::HANDLE_PTR, wszusername: super::super::Foundation::PWSTR, wszdomainname: super::super::Foundation::PWSTR, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppolicydata: *const WTS_POLICY_DATA, pclientdata: *mut WTS_USER_DATA) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pprotocolstatus: *mut WTS_PROTOCOL_STATUS) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plastinputtime: *mut u64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ulerror: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, frequency: u32, duration: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, szendpointname: super::super::Foundation::PSTR, bstatic: super::super::Foundation::BOOL, requestedpriority: u32, phchannel: *mut usize) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, querytype: ::windows::core::GUID, ulnumentriesin: u32, ulnumentriesout: u32, ppropertyentriesin: *const WTS_PROPERTY_VALUE, ppropertyentriesout: *mut WTS_PROPERTY_VALUE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppshadowconnection: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolConnectionCallback(pub ::windows::core::IUnknown);
impl IWTSProtocolConnectionCallback {
pub unsafe fn OnReady(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BrokenConnection(&self, reason: u32, source: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(reason), ::core::mem::transmute(source)).ok()
}
pub unsafe fn StopScreenUpdates(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn RedrawWindow(&self, rect: *const WTS_SMALL_RECT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(rect)).ok()
}
pub unsafe fn DisplayIOCtl(&self, displayioctl: *const WTS_DISPLAY_IOCTL) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(displayioctl)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolConnectionCallback {
type Vtable = IWTSProtocolConnectionCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23083765_75eb_41fe_b4fb_e086242afa0f);
}
impl ::core::convert::From<IWTSProtocolConnectionCallback> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolConnectionCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolConnectionCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolConnectionCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolConnectionCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolConnectionCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolConnectionCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, reason: u32, source: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, rect: *const WTS_SMALL_RECT) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, displayioctl: *const WTS_DISPLAY_IOCTL) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolLicenseConnection(pub ::windows::core::IUnknown);
impl IWTSProtocolLicenseConnection {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RequestLicensingCapabilities(&self, pplicensecapabilities: *mut WTS_LICENSE_CAPABILITIES, pcblicensecapabilities: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pplicensecapabilities), ::core::mem::transmute(pcblicensecapabilities)).ok()
}
pub unsafe fn SendClientLicense(&self, pclientlicense: *const u8, cbclientlicense: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pclientlicense), ::core::mem::transmute(cbclientlicense)).ok()
}
pub unsafe fn RequestClientLicense(&self, reserve1: *const u8, reserve2: u32, ppclientlicense: *mut u8, pcbclientlicense: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(reserve1), ::core::mem::transmute(reserve2), ::core::mem::transmute(ppclientlicense), ::core::mem::transmute(pcbclientlicense)).ok()
}
pub unsafe fn ProtocolComplete(&self, ulcomplete: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(ulcomplete)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolLicenseConnection {
type Vtable = IWTSProtocolLicenseConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23083765_178c_4079_8e4a_fea6496a4d70);
}
impl ::core::convert::From<IWTSProtocolLicenseConnection> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolLicenseConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolLicenseConnection> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolLicenseConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolLicenseConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolLicenseConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolLicenseConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pplicensecapabilities: *mut WTS_LICENSE_CAPABILITIES, pcblicensecapabilities: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclientlicense: *const u8, cbclientlicense: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, reserve1: *const u8, reserve2: u32, ppclientlicense: *mut u8, pcbclientlicense: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ulcomplete: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolListener(pub ::windows::core::IUnknown);
impl IWTSProtocolListener {
pub unsafe fn StartListen<'a, Param0: ::windows::core::IntoParam<'a, IWTSProtocolListenerCallback>>(&self, pcallback: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pcallback.into_param().abi()).ok()
}
pub unsafe fn StopListen(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolListener {
type Vtable = IWTSProtocolListener_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23083765_45f0_4394_8f69_32b2bc0ef4ca);
}
impl ::core::convert::From<IWTSProtocolListener> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolListener) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolListener> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolListener) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolListener {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolListener_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcallback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolListenerCallback(pub ::windows::core::IUnknown);
impl IWTSProtocolListenerCallback {
pub unsafe fn OnConnected<'a, Param0: ::windows::core::IntoParam<'a, IWTSProtocolConnection>>(&self, pconnection: Param0) -> ::windows::core::Result<IWTSProtocolConnectionCallback> {
let mut result__: <IWTSProtocolConnectionCallback as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pconnection.into_param().abi(), &mut result__).from_abi::<IWTSProtocolConnectionCallback>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolListenerCallback {
type Vtable = IWTSProtocolListenerCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23083765_1a2d_4de2_97de_4a35f260f0b3);
}
impl ::core::convert::From<IWTSProtocolListenerCallback> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolListenerCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolListenerCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolListenerCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolListenerCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolListenerCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnection: ::windows::core::RawPtr, pcallback: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolLogonErrorRedirector(pub ::windows::core::IUnknown);
impl IWTSProtocolLogonErrorRedirector {
pub unsafe fn OnBeginPainting(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectStatus<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmessage: Param0) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pszmessage.into_param().abi(), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectMessage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszcaption: Param0, pszmessage: Param1, utype: u32) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pszcaption.into_param().abi(), pszmessage.into_param().abi(), ::core::mem::transmute(utype), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RedirectLogonError<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, ntsstatus: i32, ntssubstatus: i32, pszcaption: Param2, pszmessage: Param3, utype: u32) -> ::windows::core::Result<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE> {
let mut result__: <WTS_LOGON_ERROR_REDIRECTOR_RESPONSE as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(ntsstatus), ::core::mem::transmute(ntssubstatus), pszcaption.into_param().abi(), pszmessage.into_param().abi(), ::core::mem::transmute(utype), &mut result__).from_abi::<WTS_LOGON_ERROR_REDIRECTOR_RESPONSE>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolLogonErrorRedirector {
type Vtable = IWTSProtocolLogonErrorRedirector_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfd9b61a7_2916_4627_8dee_4328711ad6cb);
}
impl ::core::convert::From<IWTSProtocolLogonErrorRedirector> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolLogonErrorRedirector) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolLogonErrorRedirector> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolLogonErrorRedirector) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolLogonErrorRedirector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolLogonErrorRedirector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolLogonErrorRedirector_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmessage: super::super::Foundation::PWSTR, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszcaption: super::super::Foundation::PWSTR, pszmessage: super::super::Foundation::PWSTR, utype: u32, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ntsstatus: i32, ntssubstatus: i32, pszcaption: super::super::Foundation::PWSTR, pszmessage: super::super::Foundation::PWSTR, utype: u32, presponse: *mut WTS_LOGON_ERROR_REDIRECTOR_RESPONSE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolManager(pub ::windows::core::IUnknown);
impl IWTSProtocolManager {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn CreateListener<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, wszlistenername: Param0) -> ::windows::core::Result<IWTSProtocolListener> {
let mut result__: <IWTSProtocolListener as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), wszlistenername.into_param().abi(), &mut result__).from_abi::<IWTSProtocolListener>(result__)
}
pub unsafe fn NotifyServiceStateChange(&self, ptsservicestatechange: *const WTS_SERVICE_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(ptsservicestatechange)).ok()
}
pub unsafe fn NotifySessionOfServiceStart(&self, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
pub unsafe fn NotifySessionOfServiceStop(&self, sessionid: *const WTS_SESSION_ID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid)).ok()
}
pub unsafe fn NotifySessionStateChange(&self, sessionid: *const WTS_SESSION_ID, eventid: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessionid), ::core::mem::transmute(eventid)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolManager {
type Vtable = IWTSProtocolManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf9eaf6cc_ed79_4f01_821d_1f881b9f66cc);
}
impl ::core::convert::From<IWTSProtocolManager> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolManager> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, wszlistenername: super::super::Foundation::PWSTR, pprotocollistener: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptsservicestatechange: *const WTS_SERVICE_STATE) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: *const WTS_SESSION_ID, eventid: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolShadowCallback(pub ::windows::core::IUnknown);
impl IWTSProtocolShadowCallback {
pub unsafe fn StopShadow(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn InvokeTargetShadow<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param10: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, ptargetservername: Param0, targetsessionid: u32, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: Param10) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(
::core::mem::transmute_copy(self),
ptargetservername.into_param().abi(),
::core::mem::transmute(targetsessionid),
::core::mem::transmute(pparam1),
::core::mem::transmute(param1size),
::core::mem::transmute(pparam2),
::core::mem::transmute(param2size),
::core::mem::transmute(pparam3),
::core::mem::transmute(param3size),
::core::mem::transmute(pparam4),
::core::mem::transmute(param4size),
pclientname.into_param().abi(),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolShadowCallback {
type Vtable = IWTSProtocolShadowCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x503a2504_aae5_4ab1_93e0_6d1c4bc6f71a);
}
impl ::core::convert::From<IWTSProtocolShadowCallback> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolShadowCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolShadowCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolShadowCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolShadowCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolShadowCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolShadowCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptargetservername: super::super::Foundation::PWSTR, targetsessionid: u32, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSProtocolShadowConnection(pub ::windows::core::IUnknown);
impl IWTSProtocolShadowConnection {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn Start<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, IWTSProtocolShadowCallback>>(&self, ptargetservername: Param0, targetsessionid: u32, hotkeyvk: u8, hotkeymodifiers: u16, pshadowcallback: Param4) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ptargetservername.into_param().abi(), ::core::mem::transmute(targetsessionid), ::core::mem::transmute(hotkeyvk), ::core::mem::transmute(hotkeymodifiers), pshadowcallback.into_param().abi()).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DoTarget<'a, Param8: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: Param8) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(
::core::mem::transmute_copy(self),
::core::mem::transmute(pparam1),
::core::mem::transmute(param1size),
::core::mem::transmute(pparam2),
::core::mem::transmute(param2size),
::core::mem::transmute(pparam3),
::core::mem::transmute(param3size),
::core::mem::transmute(pparam4),
::core::mem::transmute(param4size),
pclientname.into_param().abi(),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWTSProtocolShadowConnection {
type Vtable = IWTSProtocolShadowConnection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xee3b0c14_37fb_456b_bab3_6d6cd51e13bf);
}
impl ::core::convert::From<IWTSProtocolShadowConnection> for ::windows::core::IUnknown {
fn from(value: IWTSProtocolShadowConnection) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSProtocolShadowConnection> for ::windows::core::IUnknown {
fn from(value: &IWTSProtocolShadowConnection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSProtocolShadowConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSProtocolShadowConnection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSProtocolShadowConnection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptargetservername: super::super::Foundation::PWSTR, targetsessionid: u32, hotkeyvk: u8, hotkeymodifiers: u16, pshadowcallback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pparam1: *const u8, param1size: u32, pparam2: *const u8, param2size: u32, pparam3: *const u8, param3size: u32, pparam4: *const u8, param4size: u32, pclientname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSSBPlugin(pub ::windows::core::IUnknown);
impl IWTSSBPlugin {
pub unsafe fn Initialize(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn WTSSBX_MachineChangeNotification(&self, notificationtype: WTSSBX_NOTIFICATION_TYPE, machineid: i32, pmachineinfo: *const WTSSBX_MACHINE_INFO) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(notificationtype), ::core::mem::transmute(machineid), ::core::mem::transmute(pmachineinfo)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn WTSSBX_SessionChangeNotification(&self, notificationtype: WTSSBX_NOTIFICATION_TYPE, machineid: i32, numofsessions: u32, sessioninfo: *const WTSSBX_SESSION_INFO) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(notificationtype), ::core::mem::transmute(machineid), ::core::mem::transmute(numofsessions), ::core::mem::transmute(sessioninfo)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn WTSSBX_GetMostSuitableServer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, username: Param0, domainname: Param1, applicationtype: Param2, farmname: Param3, pmachineid: *mut i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), username.into_param().abi(), domainname.into_param().abi(), applicationtype.into_param().abi(), farmname.into_param().abi(), ::core::mem::transmute(pmachineid)).ok()
}
pub unsafe fn Terminated(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn WTSSBX_GetUserExternalSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, username: Param0, domainname: Param1, applicationtype: Param2, redirectorinternalip: *const WTSSBX_IP_ADDRESS, psessionid: *mut u32, pmachineconnectinfo: *mut WTSSBX_MACHINE_CONNECT_INFO) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), username.into_param().abi(), domainname.into_param().abi(), applicationtype.into_param().abi(), ::core::mem::transmute(redirectorinternalip), ::core::mem::transmute(psessionid), ::core::mem::transmute(pmachineconnectinfo)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSSBPlugin {
type Vtable = IWTSSBPlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdc44be78_b18d_4399_b210_641bf67a002c);
}
impl ::core::convert::From<IWTSSBPlugin> for ::windows::core::IUnknown {
fn from(value: IWTSSBPlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSSBPlugin> for ::windows::core::IUnknown {
fn from(value: &IWTSSBPlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSSBPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSSBPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSSBPlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plugincapabilities: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, notificationtype: WTSSBX_NOTIFICATION_TYPE, machineid: i32, pmachineinfo: *const WTSSBX_MACHINE_INFO) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, notificationtype: WTSSBX_NOTIFICATION_TYPE, machineid: i32, numofsessions: u32, sessioninfo: *const WTSSBX_SESSION_INFO) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, username: super::super::Foundation::PWSTR, domainname: super::super::Foundation::PWSTR, applicationtype: super::super::Foundation::PWSTR, farmname: super::super::Foundation::PWSTR, pmachineid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, username: super::super::Foundation::PWSTR, domainname: super::super::Foundation::PWSTR, applicationtype: super::super::Foundation::PWSTR, redirectorinternalip: *const WTSSBX_IP_ADDRESS, psessionid: *mut u32, pmachineconnectinfo: *mut WTSSBX_MACHINE_CONNECT_INFO) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSVirtualChannel(pub ::windows::core::IUnknown);
impl IWTSVirtualChannel {
pub unsafe fn Write<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::IUnknown>>(&self, cbsize: u32, pbuffer: *const u8, preserved: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(cbsize), ::core::mem::transmute(pbuffer), preserved.into_param().abi()).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSVirtualChannel {
type Vtable = IWTSVirtualChannel_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230207_d6a7_11d8_b9fd_000bdbd1f198);
}
impl ::core::convert::From<IWTSVirtualChannel> for ::windows::core::IUnknown {
fn from(value: IWTSVirtualChannel) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSVirtualChannel> for ::windows::core::IUnknown {
fn from(value: &IWTSVirtualChannel) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSVirtualChannel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSVirtualChannel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSVirtualChannel_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cbsize: u32, pbuffer: *const u8, preserved: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSVirtualChannelCallback(pub ::windows::core::IUnknown);
impl IWTSVirtualChannelCallback {
pub unsafe fn OnDataReceived(&self, cbsize: u32, pbuffer: *const u8) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(cbsize), ::core::mem::transmute(pbuffer)).ok()
}
pub unsafe fn OnClose(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWTSVirtualChannelCallback {
type Vtable = IWTSVirtualChannelCallback_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230204_d6a7_11d8_b9fd_000bdbd1f198);
}
impl ::core::convert::From<IWTSVirtualChannelCallback> for ::windows::core::IUnknown {
fn from(value: IWTSVirtualChannelCallback) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSVirtualChannelCallback> for ::windows::core::IUnknown {
fn from(value: &IWTSVirtualChannelCallback) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSVirtualChannelCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSVirtualChannelCallback {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSVirtualChannelCallback_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cbsize: u32, pbuffer: *const u8) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWTSVirtualChannelManager(pub ::windows::core::IUnknown);
impl IWTSVirtualChannelManager {
pub unsafe fn CreateListener<'a, Param2: ::windows::core::IntoParam<'a, IWTSListenerCallback>>(&self, pszchannelname: *const u8, uflags: u32, plistenercallback: Param2) -> ::windows::core::Result<IWTSListener> {
let mut result__: <IWTSListener as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pszchannelname), ::core::mem::transmute(uflags), plistenercallback.into_param().abi(), &mut result__).from_abi::<IWTSListener>(result__)
}
}
unsafe impl ::windows::core::Interface for IWTSVirtualChannelManager {
type Vtable = IWTSVirtualChannelManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1230205_d6a7_11d8_b9fd_000bdbd1f198);
}
impl ::core::convert::From<IWTSVirtualChannelManager> for ::windows::core::IUnknown {
fn from(value: IWTSVirtualChannelManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IWTSVirtualChannelManager> for ::windows::core::IUnknown {
fn from(value: &IWTSVirtualChannelManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWTSVirtualChannelManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWTSVirtualChannelManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWTSVirtualChannelManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszchannelname: *const u8, uflags: u32, plistenercallback: ::windows::core::RawPtr, pplistener: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspace(pub ::windows::core::IUnknown);
impl IWorkspace {
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetWorkspaceNames(&self) -> ::windows::core::Result<*mut super::Com::SAFEARRAY> {
let mut result__: <*mut super::Com::SAFEARRAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut super::Com::SAFEARRAY>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn StartRemoteApplication<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(psaparams)).ok()
}
pub unsafe fn GetProcessId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IWorkspace {
type Vtable = IWorkspace_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb922bbb8_4c55_4fea_8496_beb0b44285e5);
}
impl ::core::convert::From<IWorkspace> for ::windows::core::IUnknown {
fn from(value: IWorkspace) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspace> for ::windows::core::IUnknown {
fn from(value: &IWorkspace) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspace {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspace {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspace_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psawkspnames: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pulprocessid: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspace2(pub ::windows::core::IUnknown);
impl IWorkspace2 {
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetWorkspaceNames(&self) -> ::windows::core::Result<*mut super::Com::SAFEARRAY> {
let mut result__: <*mut super::Com::SAFEARRAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut super::Com::SAFEARRAY>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn StartRemoteApplication<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(psaparams)).ok()
}
pub unsafe fn GetProcessId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn StartRemoteApplicationEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(
&self,
bstrworkspaceid: Param0,
bstrrequestingappid: Param1,
bstrrequestingappfamilyname: Param2,
blaunchintoimmersiveclient: i16,
bstrimmersiveclientactivationcontext: Param4,
psaparams: *const super::Com::SAFEARRAY,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(
::core::mem::transmute_copy(self),
bstrworkspaceid.into_param().abi(),
bstrrequestingappid.into_param().abi(),
bstrrequestingappfamilyname.into_param().abi(),
::core::mem::transmute(blaunchintoimmersiveclient),
bstrimmersiveclientactivationcontext.into_param().abi(),
::core::mem::transmute(psaparams),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspace2 {
type Vtable = IWorkspace2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x96d8d7cf_783e_4286_834c_ebc0e95f783c);
}
impl ::core::convert::From<IWorkspace2> for ::windows::core::IUnknown {
fn from(value: IWorkspace2) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspace2> for ::windows::core::IUnknown {
fn from(value: &IWorkspace2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspace2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspace2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IWorkspace2> for IWorkspace {
fn from(value: IWorkspace2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspace2> for IWorkspace {
fn from(value: &IWorkspace2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace> for IWorkspace2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace> for &IWorkspace2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspace2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psawkspnames: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pulprocessid: *mut u32) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrrequestingappid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrrequestingappfamilyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
blaunchintoimmersiveclient: i16,
bstrimmersiveclientactivationcontext: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
psaparams: *const super::Com::SAFEARRAY,
) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspace3(pub ::windows::core::IUnknown);
impl IWorkspace3 {
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetWorkspaceNames(&self) -> ::windows::core::Result<*mut super::Com::SAFEARRAY> {
let mut result__: <*mut super::Com::SAFEARRAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut super::Com::SAFEARRAY>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn StartRemoteApplication<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(psaparams)).ok()
}
pub unsafe fn GetProcessId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe fn StartRemoteApplicationEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(
&self,
bstrworkspaceid: Param0,
bstrrequestingappid: Param1,
bstrrequestingappfamilyname: Param2,
blaunchintoimmersiveclient: i16,
bstrimmersiveclientactivationcontext: Param4,
psaparams: *const super::Com::SAFEARRAY,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(
::core::mem::transmute_copy(self),
bstrworkspaceid.into_param().abi(),
bstrrequestingappid.into_param().abi(),
bstrrequestingappfamilyname.into_param().abi(),
::core::mem::transmute(blaunchintoimmersiveclient),
bstrimmersiveclientactivationcontext.into_param().abi(),
::core::mem::transmute(psaparams),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetClaimsToken2<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::RECT>>(&self, bstrclaimshint: Param0, bstruserhint: Param1, claimcookie: u32, hwndcreduiparent: u32, rectcreduiparent: Param4) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), bstrclaimshint.into_param().abi(), bstruserhint.into_param().abi(), ::core::mem::transmute(claimcookie), ::core::mem::transmute(hwndcreduiparent), rectcreduiparent.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetClaimsToken<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstraccesstoken: Param0, ullaccesstokenexpiration: u64, bstrrefreshtoken: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstraccesstoken.into_param().abi(), ::core::mem::transmute(ullaccesstokenexpiration), bstrrefreshtoken.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspace3 {
type Vtable = IWorkspace3_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1becbe4a_d654_423b_afeb_be8d532c13c6);
}
impl ::core::convert::From<IWorkspace3> for ::windows::core::IUnknown {
fn from(value: IWorkspace3) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspace3> for ::windows::core::IUnknown {
fn from(value: &IWorkspace3) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IWorkspace3> for IWorkspace2 {
fn from(value: IWorkspace3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspace3> for IWorkspace2 {
fn from(value: &IWorkspace3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace2> for IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace2> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace2> for &IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace2> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
impl ::core::convert::From<IWorkspace3> for IWorkspace {
fn from(value: IWorkspace3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspace3> for IWorkspace {
fn from(value: &IWorkspace3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace> for IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspace> for &IWorkspace3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspace> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspace3_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psawkspnames: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, psaparams: *const super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pulprocessid: *mut u32) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrrequestingappid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrrequestingappfamilyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
blaunchintoimmersiveclient: i16,
bstrimmersiveclientactivationcontext: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
psaparams: *const super::Com::SAFEARRAY,
) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrclaimshint: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstruserhint: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, claimcookie: u32, hwndcreduiparent: u32, rectcreduiparent: super::super::Foundation::RECT, pbstraccesstoken: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstraccesstoken: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ullaccesstokenexpiration: u64, bstrrefreshtoken: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceClientExt(pub ::windows::core::IUnknown);
impl IWorkspaceClientExt {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResourceId(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResourceDisplayName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
pub unsafe fn IssueDisconnect(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceClientExt {
type Vtable = IWorkspaceClientExt_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x12b952f4_41ca_4f21_a829_a6d07d9a16e5);
}
impl ::core::convert::From<IWorkspaceClientExt> for ::windows::core::IUnknown {
fn from(value: IWorkspaceClientExt) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceClientExt> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceClientExt) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceClientExt {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceClientExt {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceClientExt_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspacedisplayname: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceRegistration(pub ::windows::core::IUnknown);
impl IWorkspaceRegistration {
pub unsafe fn AddResource<'a, Param0: ::windows::core::IntoParam<'a, IWorkspaceClientExt>>(&self, punk: Param0) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), punk.into_param().abi(), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn RemoveResource(&self, dwcookieconnection: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcookieconnection)).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceRegistration {
type Vtable = IWorkspaceRegistration_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb922bbb8_4c55_4fea_8496_beb0b44285e6);
}
impl ::core::convert::From<IWorkspaceRegistration> for ::windows::core::IUnknown {
fn from(value: IWorkspaceRegistration) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceRegistration> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceRegistration) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceRegistration {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceRegistration {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceRegistration_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, punk: ::windows::core::RawPtr, pdwcookie: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcookieconnection: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceRegistration2(pub ::windows::core::IUnknown);
impl IWorkspaceRegistration2 {
pub unsafe fn AddResource<'a, Param0: ::windows::core::IntoParam<'a, IWorkspaceClientExt>>(&self, punk: Param0) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), punk.into_param().abi(), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn RemoveResource(&self, dwcookieconnection: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcookieconnection)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn AddResourceEx<'a, Param0: ::windows::core::IntoParam<'a, IWorkspaceClientExt>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, punk: Param0, bstreventloguploadaddress: Param1, pdwcookie: *mut u32, correlationid: Param3) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), punk.into_param().abi(), bstreventloguploadaddress.into_param().abi(), ::core::mem::transmute(pdwcookie), correlationid.into_param().abi()).ok()
}
pub unsafe fn RemoveResourceEx<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, dwcookieconnection: u32, correlationid: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcookieconnection), correlationid.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceRegistration2 {
type Vtable = IWorkspaceRegistration2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcf59f654_39bb_44d8_94d0_4635728957e9);
}
impl ::core::convert::From<IWorkspaceRegistration2> for ::windows::core::IUnknown {
fn from(value: IWorkspaceRegistration2) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceRegistration2> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceRegistration2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceRegistration2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceRegistration2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IWorkspaceRegistration2> for IWorkspaceRegistration {
fn from(value: IWorkspaceRegistration2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspaceRegistration2> for IWorkspaceRegistration {
fn from(value: &IWorkspaceRegistration2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceRegistration> for IWorkspaceRegistration2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceRegistration> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceRegistration> for &IWorkspaceRegistration2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceRegistration> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceRegistration2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, punk: ::windows::core::RawPtr, pdwcookie: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcookieconnection: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, punk: ::windows::core::RawPtr, bstreventloguploadaddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pdwcookie: *mut u32, correlationid: ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcookieconnection: u32, correlationid: ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceReportMessage(pub ::windows::core::IUnknown);
impl IWorkspaceReportMessage {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RegisterErrorLogMessage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrmessage: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bstrmessage.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsErrorMessageRegistered<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrwkspid: Param0, dwerrortype: u32, bstrerrormessagetype: Param2, dwerrorcode: u32) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), bstrwkspid.into_param().abi(), ::core::mem::transmute(dwerrortype), bstrerrormessagetype.into_param().abi(), ::core::mem::transmute(dwerrorcode), &mut result__).from_abi::<i16>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RegisterErrorEvent<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrwkspid: Param0, dwerrortype: u32, bstrerrormessagetype: Param2, dwerrorcode: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), bstrwkspid.into_param().abi(), ::core::mem::transmute(dwerrortype), bstrerrormessagetype.into_param().abi(), ::core::mem::transmute(dwerrorcode)).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceReportMessage {
type Vtable = IWorkspaceReportMessage_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa7c06739_500f_4e8c_99a8_2bd6955899eb);
}
impl ::core::convert::From<IWorkspaceReportMessage> for ::windows::core::IUnknown {
fn from(value: IWorkspaceReportMessage) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceReportMessage> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceReportMessage) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceReportMessage {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceReportMessage {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceReportMessage_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrmessage: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrwkspid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwerrortype: u32, bstrerrormessagetype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwerrorcode: u32, pferrorexist: *mut i16) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrwkspid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwerrortype: u32, bstrerrormessagetype: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, dwerrorcode: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceResTypeRegistry(pub ::windows::core::IUnknown);
impl IWorkspaceResTypeRegistry {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn AddResourceType<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, fmachinewide: i16, bstrfileextension: Param1, bstrlauncher: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fmachinewide), bstrfileextension.into_param().abi(), bstrlauncher.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeleteResourceType<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, fmachinewide: i16, bstrfileextension: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(fmachinewide), bstrfileextension.into_param().abi()).ok()
}
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetRegisteredFileExtensions(&self, fmachinewide: i16) -> ::windows::core::Result<*mut super::Com::SAFEARRAY> {
let mut result__: <*mut super::Com::SAFEARRAY as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(fmachinewide), &mut result__).from_abi::<*mut super::Com::SAFEARRAY>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResourceTypeInfo<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, fmachinewide: i16, bstrfileextension: Param1) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(fmachinewide), bstrfileextension.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ModifyResourceType<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, fmachinewide: i16, bstrfileextension: Param1, bstrlauncher: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(fmachinewide), bstrfileextension.into_param().abi(), bstrlauncher.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceResTypeRegistry {
type Vtable = IWorkspaceResTypeRegistry_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1d428c79_6e2e_4351_a361_c0401a03a0ba);
}
impl ::core::convert::From<IWorkspaceResTypeRegistry> for ::windows::core::IUnknown {
fn from(value: IWorkspaceResTypeRegistry) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceResTypeRegistry> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceResTypeRegistry) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceResTypeRegistry {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceResTypeRegistry {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IWorkspaceResTypeRegistry> for super::Com::IDispatch {
fn from(value: IWorkspaceResTypeRegistry) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IWorkspaceResTypeRegistry> for super::Com::IDispatch {
fn from(value: &IWorkspaceResTypeRegistry) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IWorkspaceResTypeRegistry {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IWorkspaceResTypeRegistry {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceResTypeRegistry_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fmachinewide: i16, bstrfileextension: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrlauncher: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fmachinewide: i16, bstrfileextension: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fmachinewide: i16, psafileextensions: *mut *mut super::Com::SAFEARRAY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fmachinewide: i16, bstrfileextension: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, pbstrlauncher: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fmachinewide: i16, bstrfileextension: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrlauncher: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceScriptable(pub ::windows::core::IUnknown);
impl IWorkspaceScriptable {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1, bstrpassword: Param2, bstrworkspaceparams: Param3, ltimeout: i32, lflags: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi(), bstrpassword.into_param().abi(), bstrworkspaceparams.into_param().abi(), ::core::mem::transmute(ltimeout), ::core::mem::transmute(lflags)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsWorkspaceCredentialSpecified<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bcountunauthenticatedcredentials: i16) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(bcountunauthenticatedcredentials), &mut result__).from_abi::<i16>(result__)
}
pub unsafe fn IsWorkspaceSSOEnabled(&self) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ClearWorkspaceCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnAuthenticated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspaceByFriendlyName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspacefriendlyname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), bstrworkspacefriendlyname.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceScriptable {
type Vtable = IWorkspaceScriptable_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xefea49a2_dda5_429d_8f42_b23b92c4c347);
}
impl ::core::convert::From<IWorkspaceScriptable> for ::windows::core::IUnknown {
fn from(value: IWorkspaceScriptable) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceScriptable> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceScriptable) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceScriptable {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceScriptable {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IWorkspaceScriptable> for super::Com::IDispatch {
fn from(value: IWorkspaceScriptable) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IWorkspaceScriptable> for super::Com::IDispatch {
fn from(value: &IWorkspaceScriptable) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IWorkspaceScriptable {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IWorkspaceScriptable {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceScriptable_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ltimeout: i32, lflags: i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bcountunauthenticatedcredentials: i16, pbcredexist: *mut i16) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbssoenabled: *mut i16) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceScriptable2(pub ::windows::core::IUnknown);
impl IWorkspaceScriptable2 {
pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> {
let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(
::core::mem::transmute_copy(self),
::core::mem::transmute(dispidmember),
::core::mem::transmute(riid),
::core::mem::transmute(lcid),
::core::mem::transmute(wflags),
::core::mem::transmute(pdispparams),
::core::mem::transmute(pvarresult),
::core::mem::transmute(pexcepinfo),
::core::mem::transmute(puargerr),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1, bstrpassword: Param2, bstrworkspaceparams: Param3, ltimeout: i32, lflags: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi(), bstrpassword.into_param().abi(), bstrworkspaceparams.into_param().abi(), ::core::mem::transmute(ltimeout), ::core::mem::transmute(lflags)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsWorkspaceCredentialSpecified<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bcountunauthenticatedcredentials: i16) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(bcountunauthenticatedcredentials), &mut result__).from_abi::<i16>(result__)
}
pub unsafe fn IsWorkspaceSSOEnabled(&self) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ClearWorkspaceCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnAuthenticated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspaceByFriendlyName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspacefriendlyname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), bstrworkspacefriendlyname.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspaceEx<
'a,
Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
>(
&self,
bstrworkspaceid: Param0,
bstrworkspacefriendlyname: Param1,
bstrredirectorname: Param2,
bstrusername: Param3,
bstrpassword: Param4,
bstrappcontainer: Param5,
bstrworkspaceparams: Param6,
ltimeout: i32,
lflags: i32,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(
::core::mem::transmute_copy(self),
bstrworkspaceid.into_param().abi(),
bstrworkspacefriendlyname.into_param().abi(),
bstrredirectorname.into_param().abi(),
bstrusername.into_param().abi(),
bstrpassword.into_param().abi(),
bstrappcontainer.into_param().abi(),
bstrworkspaceparams.into_param().abi(),
::core::mem::transmute(ltimeout),
::core::mem::transmute(lflags),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ResourceDismissed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrworkspacefriendlyname: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrworkspacefriendlyname.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceScriptable2 {
type Vtable = IWorkspaceScriptable2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xefea49a2_dda5_429d_8f42_b33ba2c4c348);
}
impl ::core::convert::From<IWorkspaceScriptable2> for ::windows::core::IUnknown {
fn from(value: IWorkspaceScriptable2) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceScriptable2> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceScriptable2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IWorkspaceScriptable2> for IWorkspaceScriptable {
fn from(value: IWorkspaceScriptable2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspaceScriptable2> for IWorkspaceScriptable {
fn from(value: &IWorkspaceScriptable2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable> for IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable> for &IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IWorkspaceScriptable2> for super::Com::IDispatch {
fn from(value: IWorkspaceScriptable2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IWorkspaceScriptable2> for super::Com::IDispatch {
fn from(value: &IWorkspaceScriptable2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IWorkspaceScriptable2 {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceScriptable2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ltimeout: i32, lflags: i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bcountunauthenticatedcredentials: i16, pbcredexist: *mut i16) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbssoenabled: *mut i16) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrredirectorname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrappcontainer: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
ltimeout: i32,
lflags: i32,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IWorkspaceScriptable3(pub ::windows::core::IUnknown);
impl IWorkspaceScriptable3 {
pub unsafe fn GetTypeInfoCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn GetTypeInfo(&self, itinfo: u32, lcid: u32) -> ::windows::core::Result<super::Com::ITypeInfo> {
let mut result__: <super::Com::ITypeInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(itinfo), ::core::mem::transmute(lcid), &mut result__).from_abi::<super::Com::ITypeInfo>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetIDsOfNames(&self, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(rgsznames), ::core::mem::transmute(cnames), ::core::mem::transmute(lcid), ::core::mem::transmute(rgdispid)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))]
pub unsafe fn Invoke(&self, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut super::Com::VARIANT, pexcepinfo: *mut super::Com::EXCEPINFO, puargerr: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(
::core::mem::transmute_copy(self),
::core::mem::transmute(dispidmember),
::core::mem::transmute(riid),
::core::mem::transmute(lcid),
::core::mem::transmute(wflags),
::core::mem::transmute(pdispparams),
::core::mem::transmute(pvarresult),
::core::mem::transmute(pexcepinfo),
::core::mem::transmute(puargerr),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspace<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1, bstrpassword: Param2, bstrworkspaceparams: Param3, ltimeout: i32, lflags: i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi(), bstrpassword.into_param().abi(), bstrworkspaceparams.into_param().abi(), ::core::mem::transmute(ltimeout), ::core::mem::transmute(lflags)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsWorkspaceCredentialSpecified<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bcountunauthenticatedcredentials: i16) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), ::core::mem::transmute(bcountunauthenticatedcredentials), &mut result__).from_abi::<i16>(result__)
}
pub unsafe fn IsWorkspaceSSOEnabled(&self) -> ::windows::core::Result<i16> {
let mut result__: <i16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i16>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ClearWorkspaceCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnAuthenticated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrusername: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrusername.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DisconnectWorkspaceByFriendlyName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspacefriendlyname: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), bstrworkspacefriendlyname.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspaceEx<
'a,
Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
>(
&self,
bstrworkspaceid: Param0,
bstrworkspacefriendlyname: Param1,
bstrredirectorname: Param2,
bstrusername: Param3,
bstrpassword: Param4,
bstrappcontainer: Param5,
bstrworkspaceparams: Param6,
ltimeout: i32,
lflags: i32,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(
::core::mem::transmute_copy(self),
bstrworkspaceid.into_param().abi(),
bstrworkspacefriendlyname.into_param().abi(),
bstrredirectorname.into_param().abi(),
bstrusername.into_param().abi(),
bstrpassword.into_param().abi(),
bstrappcontainer.into_param().abi(),
bstrworkspaceparams.into_param().abi(),
::core::mem::transmute(ltimeout),
::core::mem::transmute(lflags),
)
.ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ResourceDismissed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>>(&self, bstrworkspaceid: Param0, bstrworkspacefriendlyname: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), bstrworkspaceid.into_param().abi(), bstrworkspacefriendlyname.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn StartWorkspaceEx2<
'a,
Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param9: ::windows::core::IntoParam<'a, super::super::Foundation::BSTR>,
Param10: ::windows::core::IntoParam<'a, ::windows::core::GUID>,
>(
&self,
bstrworkspaceid: Param0,
bstrworkspacefriendlyname: Param1,
bstrredirectorname: Param2,
bstrusername: Param3,
bstrpassword: Param4,
bstrappcontainer: Param5,
bstrworkspaceparams: Param6,
ltimeout: i32,
lflags: i32,
bstreventloguploadaddress: Param9,
correlationid: Param10,
) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(
::core::mem::transmute_copy(self),
bstrworkspaceid.into_param().abi(),
bstrworkspacefriendlyname.into_param().abi(),
bstrredirectorname.into_param().abi(),
bstrusername.into_param().abi(),
bstrpassword.into_param().abi(),
bstrappcontainer.into_param().abi(),
bstrworkspaceparams.into_param().abi(),
::core::mem::transmute(ltimeout),
::core::mem::transmute(lflags),
bstreventloguploadaddress.into_param().abi(),
correlationid.into_param().abi(),
)
.ok()
}
}
unsafe impl ::windows::core::Interface for IWorkspaceScriptable3 {
type Vtable = IWorkspaceScriptable3_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x531e6512_2cbf_4bd2_80a5_d90a71636a9a);
}
impl ::core::convert::From<IWorkspaceScriptable3> for ::windows::core::IUnknown {
fn from(value: IWorkspaceScriptable3) -> Self {
value.0
}
}
impl ::core::convert::From<&IWorkspaceScriptable3> for ::windows::core::IUnknown {
fn from(value: &IWorkspaceScriptable3) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IWorkspaceScriptable3> for IWorkspaceScriptable2 {
fn from(value: IWorkspaceScriptable3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspaceScriptable3> for IWorkspaceScriptable2 {
fn from(value: &IWorkspaceScriptable3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable2> for IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable2> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable2> for &IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable2> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
impl ::core::convert::From<IWorkspaceScriptable3> for IWorkspaceScriptable {
fn from(value: IWorkspaceScriptable3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IWorkspaceScriptable3> for IWorkspaceScriptable {
fn from(value: &IWorkspaceScriptable3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable> for IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IWorkspaceScriptable> for &IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, IWorkspaceScriptable> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<IWorkspaceScriptable3> for super::Com::IDispatch {
fn from(value: IWorkspaceScriptable3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&IWorkspaceScriptable3> for super::Com::IDispatch {
fn from(value: &IWorkspaceScriptable3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &IWorkspaceScriptable3 {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IWorkspaceScriptable3_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, ltimeout: i32, lflags: i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bcountunauthenticatedcredentials: i16, pbcredexist: *mut i16) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbssoenabled: *mut i16) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrredirectorname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrappcontainer: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
ltimeout: i32,
lflags: i32,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>, bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")]
pub unsafe extern "system" fn(
this: ::windows::core::RawPtr,
bstrworkspaceid: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspacefriendlyname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrredirectorname: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrusername: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrpassword: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrappcontainer: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
bstrworkspaceparams: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
ltimeout: i32,
lflags: i32,
bstreventloguploadaddress: ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>,
correlationid: ::windows::core::GUID,
) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ItsPubPlugin(pub ::windows::core::IUnknown);
impl ItsPubPlugin {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResourceList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, userid: Param0, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), userid.into_param().abi(), ::core::mem::transmute(pceapplistsize), ::core::mem::transmute(resourcelist)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResource<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, alias: Param0, flags: i32) -> ::windows::core::Result<pluginResource> {
let mut result__: <pluginResource as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), alias.into_param().abi(), ::core::mem::transmute(flags), &mut result__).from_abi::<pluginResource>(result__)
}
pub unsafe fn GetCacheLastUpdateTime(&self) -> ::windows::core::Result<u64> {
let mut result__: <u64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u64>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn pluginName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn pluginVersion(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ResolveResource<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, resourcetype: *mut u32, resourcelocation: super::super::Foundation::PWSTR, endpointname: super::super::Foundation::PWSTR, userid: Param3, alias: Param4) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(resourcetype), ::core::mem::transmute(resourcelocation), ::core::mem::transmute(endpointname), userid.into_param().abi(), alias.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ItsPubPlugin {
type Vtable = ItsPubPlugin_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x70c04b05_f347_412b_822f_36c99c54ca45);
}
impl ::core::convert::From<ItsPubPlugin> for ::windows::core::IUnknown {
fn from(value: ItsPubPlugin) -> Self {
value.0
}
}
impl ::core::convert::From<&ItsPubPlugin> for ::windows::core::IUnknown {
fn from(value: &ItsPubPlugin) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ItsPubPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ItsPubPlugin {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ItsPubPlugin_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, userid: super::super::Foundation::PWSTR, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alias: super::super::Foundation::PWSTR, flags: i32, resource: *mut pluginResource) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lastupdatetime: *mut u64) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, resourcetype: *mut u32, resourcelocation: super::super::Foundation::PWSTR, endpointname: super::super::Foundation::PWSTR, userid: super::super::Foundation::PWSTR, alias: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ItsPubPlugin2(pub ::windows::core::IUnknown);
impl ItsPubPlugin2 {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResourceList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, userid: Param0, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), userid.into_param().abi(), ::core::mem::transmute(pceapplistsize), ::core::mem::transmute(resourcelist)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResource<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, alias: Param0, flags: i32) -> ::windows::core::Result<pluginResource> {
let mut result__: <pluginResource as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), alias.into_param().abi(), ::core::mem::transmute(flags), &mut result__).from_abi::<pluginResource>(result__)
}
pub unsafe fn GetCacheLastUpdateTime(&self) -> ::windows::core::Result<u64> {
let mut result__: <u64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u64>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn pluginName(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn pluginVersion(&self) -> ::windows::core::Result<super::super::Foundation::BSTR> {
let mut result__: <super::super::Foundation::BSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ResolveResource<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, resourcetype: *mut u32, resourcelocation: super::super::Foundation::PWSTR, endpointname: super::super::Foundation::PWSTR, userid: Param3, alias: Param4) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(resourcetype), ::core::mem::transmute(resourcelocation), ::core::mem::transmute(endpointname), userid.into_param().abi(), alias.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResource2List<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, userid: Param0, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), userid.into_param().abi(), ::core::mem::transmute(pceapplistsize), ::core::mem::transmute(resourcelist)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetResource2<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, alias: Param0, flags: i32) -> ::windows::core::Result<pluginResource2> {
let mut result__: <pluginResource2 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), alias.into_param().abi(), ::core::mem::transmute(flags), &mut result__).from_abi::<pluginResource2>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn ResolvePersonalDesktop<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, userid: Param0, poolid: Param1, epdresolutiontype: TSPUB_PLUGIN_PD_RESOLUTION_TYPE, ppdassignmenttype: *mut TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE, endpointname: super::super::Foundation::PWSTR) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), userid.into_param().abi(), poolid.into_param().abi(), ::core::mem::transmute(epdresolutiontype), ::core::mem::transmute(ppdassignmenttype), ::core::mem::transmute(endpointname)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn DeletePersonalDesktopAssignment<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, userid: Param0, poolid: Param1, endpointname: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), userid.into_param().abi(), poolid.into_param().abi(), endpointname.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for ItsPubPlugin2 {
type Vtable = ItsPubPlugin2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfa4ce418_aad7_4ec6_bad1_0a321ba465d5);
}
impl ::core::convert::From<ItsPubPlugin2> for ::windows::core::IUnknown {
fn from(value: ItsPubPlugin2) -> Self {
value.0
}
}
impl ::core::convert::From<&ItsPubPlugin2> for ::windows::core::IUnknown {
fn from(value: &ItsPubPlugin2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ItsPubPlugin2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ItsPubPlugin2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ItsPubPlugin2> for ItsPubPlugin {
fn from(value: ItsPubPlugin2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ItsPubPlugin2> for ItsPubPlugin {
fn from(value: &ItsPubPlugin2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ItsPubPlugin> for ItsPubPlugin2 {
fn into_param(self) -> ::windows::core::Param<'a, ItsPubPlugin> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ItsPubPlugin> for &ItsPubPlugin2 {
fn into_param(self) -> ::windows::core::Param<'a, ItsPubPlugin> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ItsPubPlugin2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, userid: super::super::Foundation::PWSTR, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alias: super::super::Foundation::PWSTR, flags: i32, resource: *mut pluginResource) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lastupdatetime: *mut u64) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pval: *mut ::core::mem::ManuallyDrop<super::super::Foundation::BSTR>) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, resourcetype: *mut u32, resourcelocation: super::super::Foundation::PWSTR, endpointname: super::super::Foundation::PWSTR, userid: super::super::Foundation::PWSTR, alias: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, userid: super::super::Foundation::PWSTR, pceapplistsize: *mut i32, resourcelist: *mut *mut pluginResource2) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alias: super::super::Foundation::PWSTR, flags: i32, resource: *mut pluginResource2) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, userid: super::super::Foundation::PWSTR, poolid: super::super::Foundation::PWSTR, epdresolutiontype: TSPUB_PLUGIN_PD_RESOLUTION_TYPE, ppdassignmenttype: *mut TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE, endpointname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, userid: super::super::Foundation::PWSTR, poolid: super::super::Foundation::PWSTR, endpointname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
pub const KEEP_EXISTING_SESSIONS: u32 = 8u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct KeyCombinationType(pub i32);
pub const KeyCombinationHome: KeyCombinationType = KeyCombinationType(0i32);
pub const KeyCombinationLeft: KeyCombinationType = KeyCombinationType(1i32);
pub const KeyCombinationUp: KeyCombinationType = KeyCombinationType(2i32);
pub const KeyCombinationRight: KeyCombinationType = KeyCombinationType(3i32);
pub const KeyCombinationDown: KeyCombinationType = KeyCombinationType(4i32);
pub const KeyCombinationScroll: KeyCombinationType = KeyCombinationType(5i32);
impl ::core::convert::From<i32> for KeyCombinationType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for KeyCombinationType {
type Abi = Self;
}
pub const MAX_DATE_TIME_LENGTH: u32 = 56u32;
pub const MAX_ELAPSED_TIME_LENGTH: u32 = 15u32;
pub const MAX_POLICY_ATTRIBUTES: u32 = 20u32;
pub const MaxAppName_Len: u32 = 256u32;
pub const MaxDomainName_Len: u32 = 256u32;
pub const MaxFQDN_Len: u32 = 256u32;
pub const MaxFarm_Len: u32 = 256u32;
pub const MaxNetBiosName_Len: u32 = 16u32;
pub const MaxNumOfExposed_IPs: u32 = 12u32;
pub const MaxUserName_Len: u32 = 104u32;
pub const NOTIFY_FOR_ALL_SESSIONS: u32 = 1u32;
pub const NOTIFY_FOR_THIS_SESSION: u32 = 0u32;
pub type PCHANNEL_INIT_EVENT_FN = unsafe extern "system" fn(pinithandle: *mut ::core::ffi::c_void, event: u32, pdata: *mut ::core::ffi::c_void, datalength: u32);
pub type PCHANNEL_OPEN_EVENT_FN = unsafe extern "system" fn(openhandle: u32, event: u32, pdata: *mut ::core::ffi::c_void, datalength: u32, totallength: u32, dataflags: u32);
pub const PLUGIN_CAPABILITY_EXTERNAL_REDIRECTION: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct PLUGIN_TYPE(pub i32);
pub const UNKNOWN_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(0i32);
pub const POLICY_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(1i32);
pub const RESOURCE_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(2i32);
pub const LOAD_BALANCING_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(4i32);
pub const PLACEMENT_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(8i32);
pub const ORCHESTRATION_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(16i32);
pub const PROVISIONING_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(32i32);
pub const TASK_PLUGIN: PLUGIN_TYPE = PLUGIN_TYPE(64i32);
impl ::core::convert::From<i32> for PLUGIN_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for PLUGIN_TYPE {
type Abi = Self;
}
pub const PRODUCTINFO_COMPANYNAME_LENGTH: u32 = 256u32;
pub const PRODUCTINFO_PRODUCTID_LENGTH: u32 = 4u32;
pub const PROPERTY_DYNAMIC_TIME_ZONE_INFORMATION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0cdfd28e_d0b9_4c1f_a5eb_6d1f6c6535b9);
pub const PROPERTY_TYPE_ENABLE_UNIVERSAL_APPS_FOR_CUSTOM_SHELL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xed2c3fda_338d_4d3f_81a3_e767310d908e);
pub const PROPERTY_TYPE_GET_FAST_RECONNECT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6212d757_0043_4862_99c3_9f3059ac2a3b);
pub const PROPERTY_TYPE_GET_FAST_RECONNECT_USER_SID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x197c427a_0135_4b6d_9c5e_e6579a0ab625);
pub type PVIRTUALCHANNELCLOSE = unsafe extern "system" fn(openhandle: u32) -> u32;
#[cfg(feature = "Win32_Foundation")]
pub type PVIRTUALCHANNELENTRY = unsafe extern "system" fn(pentrypoints: *mut ::core::mem::ManuallyDrop<CHANNEL_ENTRY_POINTS>) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
pub type PVIRTUALCHANNELINIT = unsafe extern "system" fn(ppinithandle: *mut *mut ::core::ffi::c_void, pchannel: *mut CHANNEL_DEF, channelcount: i32, versionrequested: u32, pchanneliniteventproc: ::windows::core::RawPtr) -> u32;
#[cfg(feature = "Win32_Foundation")]
pub type PVIRTUALCHANNELOPEN = unsafe extern "system" fn(pinithandle: *mut ::core::ffi::c_void, popenhandle: *mut u32, pchannelname: super::super::Foundation::PSTR, pchannelopeneventproc: ::windows::core::RawPtr) -> u32;
pub type PVIRTUALCHANNELWRITE = unsafe extern "system" fn(openhandle: u32, pdata: *mut ::core::ffi::c_void, datalength: u32, puserdata: *mut ::core::ffi::c_void) -> u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct PasswordEncodingType(pub i32);
pub const PasswordEncodingUTF8: PasswordEncodingType = PasswordEncodingType(0i32);
pub const PasswordEncodingUTF16LE: PasswordEncodingType = PasswordEncodingType(1i32);
pub const PasswordEncodingUTF16BE: PasswordEncodingType = PasswordEncodingType(2i32);
impl ::core::convert::From<i32> for PasswordEncodingType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for PasswordEncodingType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct PolicyAttributeType(pub i32);
pub const EnableAllRedirections: PolicyAttributeType = PolicyAttributeType(0i32);
pub const DisableAllRedirections: PolicyAttributeType = PolicyAttributeType(1i32);
pub const DriveRedirectionDisabled: PolicyAttributeType = PolicyAttributeType(2i32);
pub const PrinterRedirectionDisabled: PolicyAttributeType = PolicyAttributeType(3i32);
pub const PortRedirectionDisabled: PolicyAttributeType = PolicyAttributeType(4i32);
pub const ClipboardRedirectionDisabled: PolicyAttributeType = PolicyAttributeType(5i32);
pub const PnpRedirectionDisabled: PolicyAttributeType = PolicyAttributeType(6i32);
pub const AllowOnlySDRServers: PolicyAttributeType = PolicyAttributeType(7i32);
impl ::core::convert::From<i32> for PolicyAttributeType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for PolicyAttributeType {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn ProcessIdToSessionId(dwprocessid: u32, psessionid: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn ProcessIdToSessionId(dwprocessid: u32, psessionid: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(ProcessIdToSessionId(::core::mem::transmute(dwprocessid), ::core::mem::transmute(psessionid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
pub const RDCLIENT_BITMAP_RENDER_SERVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe4cc08cb_942e_4b19_8504_bd5a89a747f5);
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct RDV_TASK_STATUS(pub i32);
pub const RDV_TASK_STATUS_UNKNOWN: RDV_TASK_STATUS = RDV_TASK_STATUS(0i32);
pub const RDV_TASK_STATUS_SEARCHING: RDV_TASK_STATUS = RDV_TASK_STATUS(1i32);
pub const RDV_TASK_STATUS_DOWNLOADING: RDV_TASK_STATUS = RDV_TASK_STATUS(2i32);
pub const RDV_TASK_STATUS_APPLYING: RDV_TASK_STATUS = RDV_TASK_STATUS(3i32);
pub const RDV_TASK_STATUS_REBOOTING: RDV_TASK_STATUS = RDV_TASK_STATUS(4i32);
pub const RDV_TASK_STATUS_REBOOTED: RDV_TASK_STATUS = RDV_TASK_STATUS(5i32);
pub const RDV_TASK_STATUS_SUCCESS: RDV_TASK_STATUS = RDV_TASK_STATUS(6i32);
pub const RDV_TASK_STATUS_FAILED: RDV_TASK_STATUS = RDV_TASK_STATUS(7i32);
pub const RDV_TASK_STATUS_TIMEOUT: RDV_TASK_STATUS = RDV_TASK_STATUS(8i32);
impl ::core::convert::From<i32> for RDV_TASK_STATUS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for RDV_TASK_STATUS {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct RD_FARM_TYPE(pub i32);
pub const RD_FARM_RDSH: RD_FARM_TYPE = RD_FARM_TYPE(0i32);
pub const RD_FARM_TEMP_VM: RD_FARM_TYPE = RD_FARM_TYPE(1i32);
pub const RD_FARM_MANUAL_PERSONAL_VM: RD_FARM_TYPE = RD_FARM_TYPE(2i32);
pub const RD_FARM_AUTO_PERSONAL_VM: RD_FARM_TYPE = RD_FARM_TYPE(3i32);
pub const RD_FARM_MANUAL_PERSONAL_RDSH: RD_FARM_TYPE = RD_FARM_TYPE(4i32);
pub const RD_FARM_AUTO_PERSONAL_RDSH: RD_FARM_TYPE = RD_FARM_TYPE(5i32);
pub const RD_FARM_TYPE_UNKNOWN: RD_FARM_TYPE = RD_FARM_TYPE(-1i32);
impl ::core::convert::From<i32> for RD_FARM_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for RD_FARM_TYPE {
type Abi = Self;
}
pub const REMOTECONTROL_KBDALT_HOTKEY: u32 = 4u32;
pub const REMOTECONTROL_KBDCTRL_HOTKEY: u32 = 2u32;
pub const REMOTECONTROL_KBDSHIFT_HOTKEY: u32 = 1u32;
pub const RENDER_HINT_CLEAR: u32 = 0u32;
pub const RENDER_HINT_MAPPEDWINDOW: u32 = 2u32;
pub const RENDER_HINT_VIDEO: u32 = 1u32;
pub const RESERVED_FOR_LEGACY: u32 = 4u32;
pub const RFX_CLIENT_ID_LENGTH: u32 = 32u32;
pub const RFX_GFX_MAX_SUPPORTED_MONITORS: u32 = 16u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct RFX_GFX_MONITOR_INFO {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
pub physicalWidth: u32,
pub physicalHeight: u32,
pub orientation: u32,
pub primary: super::super::Foundation::BOOL,
}
#[cfg(feature = "Win32_Foundation")]
impl RFX_GFX_MONITOR_INFO {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for RFX_GFX_MONITOR_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for RFX_GFX_MONITOR_INFO {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for RFX_GFX_MONITOR_INFO {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for RFX_GFX_MONITOR_INFO {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {
pub channelHdr: RFX_GFX_MSG_HEADER,
}
impl RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {}
impl ::core::default::Default for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_REQUEST {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub reserved: u32,
pub monitorCount: u32,
pub MonitorData: [RFX_GFX_MONITOR_INFO; 16],
pub clientUniqueId: [u16; 32],
}
#[cfg(feature = "Win32_Foundation")]
impl RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_CLIENT_DESKTOP_INFO_RESPONSE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {
pub channelHdr: RFX_GFX_MSG_HEADER,
}
impl RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {}
impl ::core::default::Default for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_CONFIRM {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub ulWidth: u32,
pub ulHeight: u32,
pub ulBpp: u32,
pub Reserved: u32,
}
impl RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {}
impl ::core::default::Default for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_DESKTOP_CONFIG_CHANGE_NOTIFY {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct RFX_GFX_MSG_DESKTOP_INPUT_RESET {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub ulWidth: u32,
pub ulHeight: u32,
}
impl RFX_GFX_MSG_DESKTOP_INPUT_RESET {}
impl ::core::default::Default for RFX_GFX_MSG_DESKTOP_INPUT_RESET {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_DESKTOP_INPUT_RESET {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_DESKTOP_INPUT_RESET {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_DESKTOP_INPUT_RESET {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub RedrawRect: RFX_GFX_RECT,
}
impl RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {}
impl ::core::default::Default for RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_DESKTOP_RESEND_REQUEST {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct RFX_GFX_MSG_DISCONNECT_NOTIFY {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub DisconnectReason: u32,
}
impl RFX_GFX_MSG_DISCONNECT_NOTIFY {}
impl ::core::default::Default for RFX_GFX_MSG_DISCONNECT_NOTIFY {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_DISCONNECT_NOTIFY {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_DISCONNECT_NOTIFY {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_DISCONNECT_NOTIFY {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct RFX_GFX_MSG_HEADER {
pub uMSGType: u16,
pub cbSize: u16,
}
impl RFX_GFX_MSG_HEADER {}
impl ::core::default::Default for RFX_GFX_MSG_HEADER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_HEADER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_HEADER {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_HEADER {
type Abi = Self;
}
pub const RFX_GFX_MSG_PREFIX: u32 = 48u32;
pub const RFX_GFX_MSG_PREFIX_MASK: u32 = 48u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct RFX_GFX_MSG_RDP_DATA {
pub channelHdr: RFX_GFX_MSG_HEADER,
pub rdpData: [u8; 1],
}
impl RFX_GFX_MSG_RDP_DATA {}
impl ::core::default::Default for RFX_GFX_MSG_RDP_DATA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_MSG_RDP_DATA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_MSG_RDP_DATA {}
unsafe impl ::windows::core::Abi for RFX_GFX_MSG_RDP_DATA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct RFX_GFX_RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
impl RFX_GFX_RECT {}
impl ::core::default::Default for RFX_GFX_RECT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for RFX_GFX_RECT {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for RFX_GFX_RECT {}
unsafe impl ::windows::core::Abi for RFX_GFX_RECT {
type Abi = Self;
}
pub const RFX_RDP_MSG_PREFIX: u32 = 0u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct RemoteActionType(pub i32);
pub const RemoteActionCharms: RemoteActionType = RemoteActionType(0i32);
pub const RemoteActionAppbar: RemoteActionType = RemoteActionType(1i32);
pub const RemoteActionSnap: RemoteActionType = RemoteActionType(2i32);
pub const RemoteActionStartScreen: RemoteActionType = RemoteActionType(3i32);
pub const RemoteActionAppSwitch: RemoteActionType = RemoteActionType(4i32);
impl ::core::convert::From<i32> for RemoteActionType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for RemoteActionType {
type Abi = Self;
}
pub const SB_SYNCH_CONFLICT_MAX_WRITE_ATTEMPTS: u32 = 100u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SESSION_TIMEOUT_ACTION_TYPE(pub i32);
pub const SESSION_TIMEOUT_ACTION_DISCONNECT: SESSION_TIMEOUT_ACTION_TYPE = SESSION_TIMEOUT_ACTION_TYPE(0i32);
pub const SESSION_TIMEOUT_ACTION_SILENT_REAUTH: SESSION_TIMEOUT_ACTION_TYPE = SESSION_TIMEOUT_ACTION_TYPE(1i32);
impl ::core::convert::From<i32> for SESSION_TIMEOUT_ACTION_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SESSION_TIMEOUT_ACTION_TYPE {
type Abi = Self;
}
pub const SINGLE_SESSION: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SnapshotEncodingType(pub i32);
pub const SnapshotEncodingDataUri: SnapshotEncodingType = SnapshotEncodingType(0i32);
impl ::core::convert::From<i32> for SnapshotEncodingType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SnapshotEncodingType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SnapshotFormatType(pub i32);
pub const SnapshotFormatPng: SnapshotFormatType = SnapshotFormatType(0i32);
pub const SnapshotFormatJpeg: SnapshotFormatType = SnapshotFormatType(1i32);
pub const SnapshotFormatBmp: SnapshotFormatType = SnapshotFormatType(2i32);
impl ::core::convert::From<i32> for SnapshotFormatType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SnapshotFormatType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TARGET_CHANGE_TYPE(pub i32);
pub const TARGET_CHANGE_UNSPEC: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(1i32);
pub const TARGET_EXTERNALIP_CHANGED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(2i32);
pub const TARGET_INTERNALIP_CHANGED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(4i32);
pub const TARGET_JOINED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(8i32);
pub const TARGET_REMOVED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(16i32);
pub const TARGET_STATE_CHANGED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(32i32);
pub const TARGET_IDLE: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(64i32);
pub const TARGET_PENDING: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(128i32);
pub const TARGET_INUSE: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(256i32);
pub const TARGET_PATCH_STATE_CHANGED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(512i32);
pub const TARGET_FARM_MEMBERSHIP_CHANGED: TARGET_CHANGE_TYPE = TARGET_CHANGE_TYPE(1024i32);
impl ::core::convert::From<i32> for TARGET_CHANGE_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TARGET_CHANGE_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TARGET_OWNER(pub i32);
pub const OWNER_UNKNOWN: TARGET_OWNER = TARGET_OWNER(0i32);
pub const OWNER_MS_TS_PLUGIN: TARGET_OWNER = TARGET_OWNER(1i32);
pub const OWNER_MS_VM_PLUGIN: TARGET_OWNER = TARGET_OWNER(2i32);
impl ::core::convert::From<i32> for TARGET_OWNER {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TARGET_OWNER {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TARGET_PATCH_STATE(pub i32);
pub const TARGET_PATCH_UNKNOWN: TARGET_PATCH_STATE = TARGET_PATCH_STATE(0i32);
pub const TARGET_PATCH_NOT_STARTED: TARGET_PATCH_STATE = TARGET_PATCH_STATE(1i32);
pub const TARGET_PATCH_IN_PROGRESS: TARGET_PATCH_STATE = TARGET_PATCH_STATE(2i32);
pub const TARGET_PATCH_COMPLETED: TARGET_PATCH_STATE = TARGET_PATCH_STATE(3i32);
pub const TARGET_PATCH_FAILED: TARGET_PATCH_STATE = TARGET_PATCH_STATE(4i32);
impl ::core::convert::From<i32> for TARGET_PATCH_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TARGET_PATCH_STATE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TARGET_STATE(pub i32);
pub const TARGET_UNKNOWN: TARGET_STATE = TARGET_STATE(1i32);
pub const TARGET_INITIALIZING: TARGET_STATE = TARGET_STATE(2i32);
pub const TARGET_RUNNING: TARGET_STATE = TARGET_STATE(3i32);
pub const TARGET_DOWN: TARGET_STATE = TARGET_STATE(4i32);
pub const TARGET_HIBERNATED: TARGET_STATE = TARGET_STATE(5i32);
pub const TARGET_CHECKED_OUT: TARGET_STATE = TARGET_STATE(6i32);
pub const TARGET_STOPPED: TARGET_STATE = TARGET_STATE(7i32);
pub const TARGET_INVALID: TARGET_STATE = TARGET_STATE(8i32);
pub const TARGET_STARTING: TARGET_STATE = TARGET_STATE(9i32);
pub const TARGET_STOPPING: TARGET_STATE = TARGET_STATE(10i32);
pub const TARGET_MAXSTATE: TARGET_STATE = TARGET_STATE(11i32);
impl ::core::convert::From<i32> for TARGET_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TARGET_STATE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TARGET_TYPE(pub i32);
pub const UNKNOWN: TARGET_TYPE = TARGET_TYPE(0i32);
pub const FARM: TARGET_TYPE = TARGET_TYPE(1i32);
pub const NONFARM: TARGET_TYPE = TARGET_TYPE(2i32);
impl ::core::convert::From<i32> for TARGET_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TARGET_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE(pub i32);
pub const TSPUB_PLUGIN_PD_ASSIGNMENT_NEW: TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE = TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE(0i32);
pub const TSPUB_PLUGIN_PD_ASSIGNMENT_EXISTING: TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE = TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE(1i32);
impl ::core::convert::From<i32> for TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TSPUB_PLUGIN_PD_ASSIGNMENT_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TSPUB_PLUGIN_PD_RESOLUTION_TYPE(pub i32);
pub const TSPUB_PLUGIN_PD_QUERY_OR_CREATE: TSPUB_PLUGIN_PD_RESOLUTION_TYPE = TSPUB_PLUGIN_PD_RESOLUTION_TYPE(0i32);
pub const TSPUB_PLUGIN_PD_QUERY_EXISTING: TSPUB_PLUGIN_PD_RESOLUTION_TYPE = TSPUB_PLUGIN_PD_RESOLUTION_TYPE(1i32);
impl ::core::convert::From<i32> for TSPUB_PLUGIN_PD_RESOLUTION_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TSPUB_PLUGIN_PD_RESOLUTION_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TSSB_NOTIFICATION_TYPE(pub i32);
pub const TSSB_NOTIFY_INVALID: TSSB_NOTIFICATION_TYPE = TSSB_NOTIFICATION_TYPE(0i32);
pub const TSSB_NOTIFY_TARGET_CHANGE: TSSB_NOTIFICATION_TYPE = TSSB_NOTIFICATION_TYPE(1i32);
pub const TSSB_NOTIFY_SESSION_CHANGE: TSSB_NOTIFICATION_TYPE = TSSB_NOTIFICATION_TYPE(2i32);
pub const TSSB_NOTIFY_CONNECTION_REQUEST_CHANGE: TSSB_NOTIFICATION_TYPE = TSSB_NOTIFICATION_TYPE(4i32);
impl ::core::convert::From<i32> for TSSB_NOTIFICATION_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TSSB_NOTIFICATION_TYPE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TSSD_AddrV46Type(pub i32);
pub const TSSD_ADDR_UNDEFINED: TSSD_AddrV46Type = TSSD_AddrV46Type(0i32);
pub const TSSD_ADDR_IPv4: TSSD_AddrV46Type = TSSD_AddrV46Type(4i32);
pub const TSSD_ADDR_IPv6: TSSD_AddrV46Type = TSSD_AddrV46Type(6i32);
impl ::core::convert::From<i32> for TSSD_AddrV46Type {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TSSD_AddrV46Type {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct TSSD_ConnectionPoint {
pub ServerAddressB: [u8; 16],
pub AddressType: TSSD_AddrV46Type,
pub PortNumber: u16,
pub AddressScope: u32,
}
impl TSSD_ConnectionPoint {}
impl ::core::default::Default for TSSD_ConnectionPoint {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for TSSD_ConnectionPoint {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("TSSD_ConnectionPoint").field("ServerAddressB", &self.ServerAddressB).field("AddressType", &self.AddressType).field("PortNumber", &self.PortNumber).field("AddressScope", &self.AddressScope).finish()
}
}
impl ::core::cmp::PartialEq for TSSD_ConnectionPoint {
fn eq(&self, other: &Self) -> bool {
self.ServerAddressB == other.ServerAddressB && self.AddressType == other.AddressType && self.PortNumber == other.PortNumber && self.AddressScope == other.AddressScope
}
}
impl ::core::cmp::Eq for TSSD_ConnectionPoint {}
unsafe impl ::windows::core::Abi for TSSD_ConnectionPoint {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TSSESSION_STATE(pub i32);
pub const STATE_INVALID: TSSESSION_STATE = TSSESSION_STATE(-1i32);
pub const STATE_ACTIVE: TSSESSION_STATE = TSSESSION_STATE(0i32);
pub const STATE_CONNECTED: TSSESSION_STATE = TSSESSION_STATE(1i32);
pub const STATE_CONNECTQUERY: TSSESSION_STATE = TSSESSION_STATE(2i32);
pub const STATE_SHADOW: TSSESSION_STATE = TSSESSION_STATE(3i32);
pub const STATE_DISCONNECTED: TSSESSION_STATE = TSSESSION_STATE(4i32);
pub const STATE_IDLE: TSSESSION_STATE = TSSESSION_STATE(5i32);
pub const STATE_LISTEN: TSSESSION_STATE = TSSESSION_STATE(6i32);
pub const STATE_RESET: TSSESSION_STATE = TSSESSION_STATE(7i32);
pub const STATE_DOWN: TSSESSION_STATE = TSSESSION_STATE(8i32);
pub const STATE_INIT: TSSESSION_STATE = TSSESSION_STATE(9i32);
pub const STATE_MAX: TSSESSION_STATE = TSSESSION_STATE(10i32);
impl ::core::convert::From<i32> for TSSESSION_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TSSESSION_STATE {
type Abi = Self;
}
pub const TSUserExInterfaces: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0910dd01_df8c_11d1_ae27_00c04fa35813);
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct TS_SB_SORT_BY(pub i32);
pub const TS_SB_SORT_BY_NONE: TS_SB_SORT_BY = TS_SB_SORT_BY(0i32);
pub const TS_SB_SORT_BY_NAME: TS_SB_SORT_BY = TS_SB_SORT_BY(1i32);
pub const TS_SB_SORT_BY_PROP: TS_SB_SORT_BY = TS_SB_SORT_BY(2i32);
impl ::core::convert::From<i32> for TS_SB_SORT_BY {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for TS_SB_SORT_BY {
type Abi = Self;
}
pub const TS_VC_LISTENER_STATIC_CHANNEL: u32 = 1u32;
pub const USERNAME_LENGTH: u32 = 20u32;
pub const VALIDATIONINFORMATION_HARDWAREID_LENGTH: u32 = 20u32;
pub const VALIDATIONINFORMATION_LICENSE_LENGTH: u32 = 16384u32;
pub const VIRTUAL_CHANNEL_VERSION_WIN2000: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct VM_HOST_NOTIFY_STATUS(pub i32);
pub const VM_HOST_STATUS_INIT_PENDING: VM_HOST_NOTIFY_STATUS = VM_HOST_NOTIFY_STATUS(0i32);
pub const VM_HOST_STATUS_INIT_IN_PROGRESS: VM_HOST_NOTIFY_STATUS = VM_HOST_NOTIFY_STATUS(1i32);
pub const VM_HOST_STATUS_INIT_COMPLETE: VM_HOST_NOTIFY_STATUS = VM_HOST_NOTIFY_STATUS(2i32);
pub const VM_HOST_STATUS_INIT_FAILED: VM_HOST_NOTIFY_STATUS = VM_HOST_NOTIFY_STATUS(3i32);
impl ::core::convert::From<i32> for VM_HOST_NOTIFY_STATUS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for VM_HOST_NOTIFY_STATUS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct VM_NOTIFY_ENTRY {
pub VmName: [u16; 128],
pub VmHost: [u16; 128],
}
impl VM_NOTIFY_ENTRY {}
impl ::core::default::Default for VM_NOTIFY_ENTRY {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for VM_NOTIFY_ENTRY {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("VM_NOTIFY_ENTRY").field("VmName", &self.VmName).field("VmHost", &self.VmHost).finish()
}
}
impl ::core::cmp::PartialEq for VM_NOTIFY_ENTRY {
fn eq(&self, other: &Self) -> bool {
self.VmName == other.VmName && self.VmHost == other.VmHost
}
}
impl ::core::cmp::Eq for VM_NOTIFY_ENTRY {}
unsafe impl ::windows::core::Abi for VM_NOTIFY_ENTRY {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct VM_NOTIFY_INFO {
pub dwNumEntries: u32,
pub ppVmEntries: *mut *mut VM_NOTIFY_ENTRY,
}
impl VM_NOTIFY_INFO {}
impl ::core::default::Default for VM_NOTIFY_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for VM_NOTIFY_INFO {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("VM_NOTIFY_INFO").field("dwNumEntries", &self.dwNumEntries).field("ppVmEntries", &self.ppVmEntries).finish()
}
}
impl ::core::cmp::PartialEq for VM_NOTIFY_INFO {
fn eq(&self, other: &Self) -> bool {
self.dwNumEntries == other.dwNumEntries && self.ppVmEntries == other.ppVmEntries
}
}
impl ::core::cmp::Eq for VM_NOTIFY_INFO {}
unsafe impl ::windows::core::Abi for VM_NOTIFY_INFO {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct VM_NOTIFY_STATUS(pub i32);
pub const VM_NOTIFY_STATUS_PENDING: VM_NOTIFY_STATUS = VM_NOTIFY_STATUS(0i32);
pub const VM_NOTIFY_STATUS_IN_PROGRESS: VM_NOTIFY_STATUS = VM_NOTIFY_STATUS(1i32);
pub const VM_NOTIFY_STATUS_COMPLETE: VM_NOTIFY_STATUS = VM_NOTIFY_STATUS(2i32);
pub const VM_NOTIFY_STATUS_FAILED: VM_NOTIFY_STATUS = VM_NOTIFY_STATUS(3i32);
pub const VM_NOTIFY_STATUS_CANCELED: VM_NOTIFY_STATUS = VM_NOTIFY_STATUS(4i32);
impl ::core::convert::From<i32> for VM_NOTIFY_STATUS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for VM_NOTIFY_STATUS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct VM_PATCH_INFO {
pub dwNumEntries: u32,
pub pVmNames: *mut super::super::Foundation::PWSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl VM_PATCH_INFO {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for VM_PATCH_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for VM_PATCH_INFO {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("VM_PATCH_INFO").field("dwNumEntries", &self.dwNumEntries).field("pVmNames", &self.pVmNames).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for VM_PATCH_INFO {
fn eq(&self, other: &Self) -> bool {
self.dwNumEntries == other.dwNumEntries && self.pVmNames == other.pVmNames
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for VM_PATCH_INFO {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for VM_PATCH_INFO {
type Abi = Self;
}
pub const WINSTATIONNAME_LENGTH: u32 = 32u32;
pub const WKS_FLAG_CLEAR_CREDS_ON_LAST_RESOURCE: u32 = 1u32;
pub const WKS_FLAG_CREDS_AUTHENTICATED: u32 = 4u32;
pub const WKS_FLAG_PASSWORD_ENCRYPTED: u32 = 2u32;
pub const WRDS_CLIENTADDRESS_LENGTH: u32 = 30u32;
pub const WRDS_CLIENTNAME_LENGTH: u32 = 20u32;
pub const WRDS_CLIENT_PRODUCT_ID_LENGTH: u32 = 32u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub union WRDS_CONNECTION_SETTING {
pub WRdsConnectionSettings1: WRDS_CONNECTION_SETTINGS_1,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_CONNECTION_SETTING {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_CONNECTION_SETTING {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_CONNECTION_SETTING {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_CONNECTION_SETTING {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_CONNECTION_SETTING {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WRDS_CONNECTION_SETTINGS {
pub WRdsConnectionSettingLevel: WRDS_CONNECTION_SETTING_LEVEL,
pub WRdsConnectionSetting: WRDS_CONNECTION_SETTING,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_CONNECTION_SETTINGS {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_CONNECTION_SETTINGS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_CONNECTION_SETTINGS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_CONNECTION_SETTINGS {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_CONNECTION_SETTINGS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WRDS_CONNECTION_SETTINGS_1 {
pub fInheritInitialProgram: super::super::Foundation::BOOLEAN,
pub fInheritColorDepth: super::super::Foundation::BOOLEAN,
pub fHideTitleBar: super::super::Foundation::BOOLEAN,
pub fInheritAutoLogon: super::super::Foundation::BOOLEAN,
pub fMaximizeShell: super::super::Foundation::BOOLEAN,
pub fDisablePNP: super::super::Foundation::BOOLEAN,
pub fPasswordIsScPin: super::super::Foundation::BOOLEAN,
pub fPromptForPassword: super::super::Foundation::BOOLEAN,
pub fDisableCpm: super::super::Foundation::BOOLEAN,
pub fDisableCdm: super::super::Foundation::BOOLEAN,
pub fDisableCcm: super::super::Foundation::BOOLEAN,
pub fDisableLPT: super::super::Foundation::BOOLEAN,
pub fDisableClip: super::super::Foundation::BOOLEAN,
pub fResetBroken: super::super::Foundation::BOOLEAN,
pub fDisableEncryption: super::super::Foundation::BOOLEAN,
pub fDisableAutoReconnect: super::super::Foundation::BOOLEAN,
pub fDisableCtrlAltDel: super::super::Foundation::BOOLEAN,
pub fDoubleClickDetect: super::super::Foundation::BOOLEAN,
pub fEnableWindowsKey: super::super::Foundation::BOOLEAN,
pub fUsingSavedCreds: super::super::Foundation::BOOLEAN,
pub fMouse: super::super::Foundation::BOOLEAN,
pub fNoAudioPlayback: super::super::Foundation::BOOLEAN,
pub fRemoteConsoleAudio: super::super::Foundation::BOOLEAN,
pub EncryptionLevel: u8,
pub ColorDepth: u16,
pub ProtocolType: u16,
pub HRes: u16,
pub VRes: u16,
pub ClientProductId: u16,
pub OutBufCountHost: u16,
pub OutBufCountClient: u16,
pub OutBufLength: u16,
pub KeyboardLayout: u32,
pub MaxConnectionTime: u32,
pub MaxDisconnectionTime: u32,
pub MaxIdleTime: u32,
pub PerformanceFlags: u32,
pub KeyboardType: u32,
pub KeyboardSubType: u32,
pub KeyboardFunctionKey: u32,
pub ActiveInputLocale: u32,
pub SerialNumber: u32,
pub ClientAddressFamily: u32,
pub ClientBuildNumber: u32,
pub ClientSessionId: u32,
pub WorkDirectory: [u16; 257],
pub InitialProgram: [u16; 257],
pub UserName: [u16; 256],
pub Domain: [u16; 256],
pub Password: [u16; 256],
pub ProtocolName: [u16; 9],
pub DisplayDriverName: [u16; 9],
pub DisplayDeviceName: [u16; 20],
pub imeFileName: [u16; 33],
pub AudioDriverName: [u16; 9],
pub ClientName: [u16; 21],
pub ClientAddress: [u16; 31],
pub ClientDirectory: [u16; 257],
pub ClientDigProductId: [u16; 33],
pub ClientSockAddress: WTS_SOCKADDR,
pub ClientTimeZone: WTS_TIME_ZONE_INFORMATION,
pub WRdsListenerSettings: WRDS_LISTENER_SETTINGS,
pub EventLogActivityId: ::windows::core::GUID,
pub ContextSize: u32,
pub ContextData: *mut u8,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_CONNECTION_SETTINGS_1 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_CONNECTION_SETTINGS_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_CONNECTION_SETTINGS_1 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_CONNECTION_SETTINGS_1 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_CONNECTION_SETTINGS_1 {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRDS_CONNECTION_SETTING_LEVEL(pub i32);
pub const WRDS_CONNECTION_SETTING_LEVEL_INVALID: WRDS_CONNECTION_SETTING_LEVEL = WRDS_CONNECTION_SETTING_LEVEL(0i32);
pub const WRDS_CONNECTION_SETTING_LEVEL_1: WRDS_CONNECTION_SETTING_LEVEL = WRDS_CONNECTION_SETTING_LEVEL(1i32);
impl ::core::convert::From<i32> for WRDS_CONNECTION_SETTING_LEVEL {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRDS_CONNECTION_SETTING_LEVEL {
type Abi = Self;
}
pub const WRDS_DEVICE_NAME_LENGTH: u32 = 19u32;
pub const WRDS_DIRECTORY_LENGTH: u32 = 256u32;
pub const WRDS_DOMAIN_LENGTH: u32 = 255u32;
pub const WRDS_DRIVER_NAME_LENGTH: u32 = 8u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WRDS_DYNAMIC_TIME_ZONE_INFORMATION {
pub Bias: i32,
pub StandardName: [u16; 32],
pub StandardDate: WTS_SYSTEMTIME,
pub StandardBias: i32,
pub DaylightName: [u16; 32],
pub DaylightDate: WTS_SYSTEMTIME,
pub DaylightBias: i32,
pub TimeZoneKeyName: [u16; 128],
pub DynamicDaylightTimeDisabled: u16,
}
impl WRDS_DYNAMIC_TIME_ZONE_INFORMATION {}
impl ::core::default::Default for WRDS_DYNAMIC_TIME_ZONE_INFORMATION {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WRDS_DYNAMIC_TIME_ZONE_INFORMATION {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WRDS_DYNAMIC_TIME_ZONE_INFORMATION")
.field("Bias", &self.Bias)
.field("StandardName", &self.StandardName)
.field("StandardDate", &self.StandardDate)
.field("StandardBias", &self.StandardBias)
.field("DaylightName", &self.DaylightName)
.field("DaylightDate", &self.DaylightDate)
.field("DaylightBias", &self.DaylightBias)
.field("TimeZoneKeyName", &self.TimeZoneKeyName)
.field("DynamicDaylightTimeDisabled", &self.DynamicDaylightTimeDisabled)
.finish()
}
}
impl ::core::cmp::PartialEq for WRDS_DYNAMIC_TIME_ZONE_INFORMATION {
fn eq(&self, other: &Self) -> bool {
self.Bias == other.Bias && self.StandardName == other.StandardName && self.StandardDate == other.StandardDate && self.StandardBias == other.StandardBias && self.DaylightName == other.DaylightName && self.DaylightDate == other.DaylightDate && self.DaylightBias == other.DaylightBias && self.TimeZoneKeyName == other.TimeZoneKeyName && self.DynamicDaylightTimeDisabled == other.DynamicDaylightTimeDisabled
}
}
impl ::core::cmp::Eq for WRDS_DYNAMIC_TIME_ZONE_INFORMATION {}
unsafe impl ::windows::core::Abi for WRDS_DYNAMIC_TIME_ZONE_INFORMATION {
type Abi = Self;
}
pub const WRDS_IMEFILENAME_LENGTH: u32 = 32u32;
pub const WRDS_INITIALPROGRAM_LENGTH: u32 = 256u32;
pub const WRDS_KEY_EXCHANGE_ALG_DH: u32 = 2u32;
pub const WRDS_KEY_EXCHANGE_ALG_RSA: u32 = 1u32;
pub const WRDS_LICENSE_PREAMBLE_VERSION: u32 = 3u32;
pub const WRDS_LICENSE_PROTOCOL_VERSION: u32 = 65536u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union WRDS_LISTENER_SETTING {
pub WRdsListenerSettings1: WRDS_LISTENER_SETTINGS_1,
}
impl WRDS_LISTENER_SETTING {}
impl ::core::default::Default for WRDS_LISTENER_SETTING {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WRDS_LISTENER_SETTING {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WRDS_LISTENER_SETTING {}
unsafe impl ::windows::core::Abi for WRDS_LISTENER_SETTING {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WRDS_LISTENER_SETTINGS {
pub WRdsListenerSettingLevel: WRDS_LISTENER_SETTING_LEVEL,
pub WRdsListenerSetting: WRDS_LISTENER_SETTING,
}
impl WRDS_LISTENER_SETTINGS {}
impl ::core::default::Default for WRDS_LISTENER_SETTINGS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WRDS_LISTENER_SETTINGS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WRDS_LISTENER_SETTINGS {}
unsafe impl ::windows::core::Abi for WRDS_LISTENER_SETTINGS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WRDS_LISTENER_SETTINGS_1 {
pub MaxProtocolListenerConnectionCount: u32,
pub SecurityDescriptorSize: u32,
pub pSecurityDescriptor: *mut u8,
}
impl WRDS_LISTENER_SETTINGS_1 {}
impl ::core::default::Default for WRDS_LISTENER_SETTINGS_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WRDS_LISTENER_SETTINGS_1 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WRDS_LISTENER_SETTINGS_1").field("MaxProtocolListenerConnectionCount", &self.MaxProtocolListenerConnectionCount).field("SecurityDescriptorSize", &self.SecurityDescriptorSize).field("pSecurityDescriptor", &self.pSecurityDescriptor).finish()
}
}
impl ::core::cmp::PartialEq for WRDS_LISTENER_SETTINGS_1 {
fn eq(&self, other: &Self) -> bool {
self.MaxProtocolListenerConnectionCount == other.MaxProtocolListenerConnectionCount && self.SecurityDescriptorSize == other.SecurityDescriptorSize && self.pSecurityDescriptor == other.pSecurityDescriptor
}
}
impl ::core::cmp::Eq for WRDS_LISTENER_SETTINGS_1 {}
unsafe impl ::windows::core::Abi for WRDS_LISTENER_SETTINGS_1 {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRDS_LISTENER_SETTING_LEVEL(pub i32);
pub const WRDS_LISTENER_SETTING_LEVEL_INVALID: WRDS_LISTENER_SETTING_LEVEL = WRDS_LISTENER_SETTING_LEVEL(0i32);
pub const WRDS_LISTENER_SETTING_LEVEL_1: WRDS_LISTENER_SETTING_LEVEL = WRDS_LISTENER_SETTING_LEVEL(1i32);
impl ::core::convert::From<i32> for WRDS_LISTENER_SETTING_LEVEL {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRDS_LISTENER_SETTING_LEVEL {
type Abi = Self;
}
pub const WRDS_MAX_CACHE_RESERVED: u32 = 20u32;
pub const WRDS_MAX_COUNTERS: u32 = 100u32;
pub const WRDS_MAX_DISPLAY_IOCTL_DATA: u32 = 256u32;
pub const WRDS_MAX_PROTOCOL_CACHE: u32 = 4u32;
pub const WRDS_MAX_RESERVED: u32 = 100u32;
pub const WRDS_PASSWORD_LENGTH: u32 = 255u32;
pub const WRDS_PERF_DISABLE_CURSORSETTINGS: u32 = 64u32;
pub const WRDS_PERF_DISABLE_CURSOR_SHADOW: u32 = 32u32;
pub const WRDS_PERF_DISABLE_FULLWINDOWDRAG: u32 = 2u32;
pub const WRDS_PERF_DISABLE_MENUANIMATIONS: u32 = 4u32;
pub const WRDS_PERF_DISABLE_NOTHING: u32 = 0u32;
pub const WRDS_PERF_DISABLE_THEMING: u32 = 8u32;
pub const WRDS_PERF_DISABLE_WALLPAPER: u32 = 1u32;
pub const WRDS_PERF_ENABLE_DESKTOP_COMPOSITION: u32 = 256u32;
pub const WRDS_PERF_ENABLE_ENHANCED_GRAPHICS: u32 = 16u32;
pub const WRDS_PERF_ENABLE_FONT_SMOOTHING: u32 = 128u32;
pub const WRDS_PROTOCOL_NAME_LENGTH: u32 = 8u32;
pub const WRDS_SERVICE_ID_GRAPHICS_GUID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd2993f4d_02cf_4280_8c48_1624b44f8706);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub union WRDS_SETTING {
pub WRdsSettings1: WRDS_SETTINGS_1,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_SETTING {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_SETTING {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_SETTING {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_SETTING {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_SETTING {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WRDS_SETTINGS {
pub WRdsSettingType: WRDS_SETTING_TYPE,
pub WRdsSettingLevel: WRDS_SETTING_LEVEL,
pub WRdsSetting: WRDS_SETTING,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_SETTINGS {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_SETTINGS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_SETTINGS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_SETTINGS {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_SETTINGS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WRDS_SETTINGS_1 {
pub WRdsDisableClipStatus: WRDS_SETTING_STATUS,
pub WRdsDisableClipValue: u32,
pub WRdsDisableLPTStatus: WRDS_SETTING_STATUS,
pub WRdsDisableLPTValue: u32,
pub WRdsDisableCcmStatus: WRDS_SETTING_STATUS,
pub WRdsDisableCcmValue: u32,
pub WRdsDisableCdmStatus: WRDS_SETTING_STATUS,
pub WRdsDisableCdmValue: u32,
pub WRdsDisableCpmStatus: WRDS_SETTING_STATUS,
pub WRdsDisableCpmValue: u32,
pub WRdsDisablePnpStatus: WRDS_SETTING_STATUS,
pub WRdsDisablePnpValue: u32,
pub WRdsEncryptionLevelStatus: WRDS_SETTING_STATUS,
pub WRdsEncryptionValue: u32,
pub WRdsColorDepthStatus: WRDS_SETTING_STATUS,
pub WRdsColorDepthValue: u32,
pub WRdsDisableAutoReconnecetStatus: WRDS_SETTING_STATUS,
pub WRdsDisableAutoReconnecetValue: u32,
pub WRdsDisableEncryptionStatus: WRDS_SETTING_STATUS,
pub WRdsDisableEncryptionValue: u32,
pub WRdsResetBrokenStatus: WRDS_SETTING_STATUS,
pub WRdsResetBrokenValue: u32,
pub WRdsMaxIdleTimeStatus: WRDS_SETTING_STATUS,
pub WRdsMaxIdleTimeValue: u32,
pub WRdsMaxDisconnectTimeStatus: WRDS_SETTING_STATUS,
pub WRdsMaxDisconnectTimeValue: u32,
pub WRdsMaxConnectTimeStatus: WRDS_SETTING_STATUS,
pub WRdsMaxConnectTimeValue: u32,
pub WRdsKeepAliveStatus: WRDS_SETTING_STATUS,
pub WRdsKeepAliveStartValue: super::super::Foundation::BOOLEAN,
pub WRdsKeepAliveIntervalValue: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl WRDS_SETTINGS_1 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WRDS_SETTINGS_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WRDS_SETTINGS_1 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WRDS_SETTINGS_1")
.field("WRdsDisableClipStatus", &self.WRdsDisableClipStatus)
.field("WRdsDisableClipValue", &self.WRdsDisableClipValue)
.field("WRdsDisableLPTStatus", &self.WRdsDisableLPTStatus)
.field("WRdsDisableLPTValue", &self.WRdsDisableLPTValue)
.field("WRdsDisableCcmStatus", &self.WRdsDisableCcmStatus)
.field("WRdsDisableCcmValue", &self.WRdsDisableCcmValue)
.field("WRdsDisableCdmStatus", &self.WRdsDisableCdmStatus)
.field("WRdsDisableCdmValue", &self.WRdsDisableCdmValue)
.field("WRdsDisableCpmStatus", &self.WRdsDisableCpmStatus)
.field("WRdsDisableCpmValue", &self.WRdsDisableCpmValue)
.field("WRdsDisablePnpStatus", &self.WRdsDisablePnpStatus)
.field("WRdsDisablePnpValue", &self.WRdsDisablePnpValue)
.field("WRdsEncryptionLevelStatus", &self.WRdsEncryptionLevelStatus)
.field("WRdsEncryptionValue", &self.WRdsEncryptionValue)
.field("WRdsColorDepthStatus", &self.WRdsColorDepthStatus)
.field("WRdsColorDepthValue", &self.WRdsColorDepthValue)
.field("WRdsDisableAutoReconnecetStatus", &self.WRdsDisableAutoReconnecetStatus)
.field("WRdsDisableAutoReconnecetValue", &self.WRdsDisableAutoReconnecetValue)
.field("WRdsDisableEncryptionStatus", &self.WRdsDisableEncryptionStatus)
.field("WRdsDisableEncryptionValue", &self.WRdsDisableEncryptionValue)
.field("WRdsResetBrokenStatus", &self.WRdsResetBrokenStatus)
.field("WRdsResetBrokenValue", &self.WRdsResetBrokenValue)
.field("WRdsMaxIdleTimeStatus", &self.WRdsMaxIdleTimeStatus)
.field("WRdsMaxIdleTimeValue", &self.WRdsMaxIdleTimeValue)
.field("WRdsMaxDisconnectTimeStatus", &self.WRdsMaxDisconnectTimeStatus)
.field("WRdsMaxDisconnectTimeValue", &self.WRdsMaxDisconnectTimeValue)
.field("WRdsMaxConnectTimeStatus", &self.WRdsMaxConnectTimeStatus)
.field("WRdsMaxConnectTimeValue", &self.WRdsMaxConnectTimeValue)
.field("WRdsKeepAliveStatus", &self.WRdsKeepAliveStatus)
.field("WRdsKeepAliveStartValue", &self.WRdsKeepAliveStartValue)
.field("WRdsKeepAliveIntervalValue", &self.WRdsKeepAliveIntervalValue)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WRDS_SETTINGS_1 {
fn eq(&self, other: &Self) -> bool {
self.WRdsDisableClipStatus == other.WRdsDisableClipStatus
&& self.WRdsDisableClipValue == other.WRdsDisableClipValue
&& self.WRdsDisableLPTStatus == other.WRdsDisableLPTStatus
&& self.WRdsDisableLPTValue == other.WRdsDisableLPTValue
&& self.WRdsDisableCcmStatus == other.WRdsDisableCcmStatus
&& self.WRdsDisableCcmValue == other.WRdsDisableCcmValue
&& self.WRdsDisableCdmStatus == other.WRdsDisableCdmStatus
&& self.WRdsDisableCdmValue == other.WRdsDisableCdmValue
&& self.WRdsDisableCpmStatus == other.WRdsDisableCpmStatus
&& self.WRdsDisableCpmValue == other.WRdsDisableCpmValue
&& self.WRdsDisablePnpStatus == other.WRdsDisablePnpStatus
&& self.WRdsDisablePnpValue == other.WRdsDisablePnpValue
&& self.WRdsEncryptionLevelStatus == other.WRdsEncryptionLevelStatus
&& self.WRdsEncryptionValue == other.WRdsEncryptionValue
&& self.WRdsColorDepthStatus == other.WRdsColorDepthStatus
&& self.WRdsColorDepthValue == other.WRdsColorDepthValue
&& self.WRdsDisableAutoReconnecetStatus == other.WRdsDisableAutoReconnecetStatus
&& self.WRdsDisableAutoReconnecetValue == other.WRdsDisableAutoReconnecetValue
&& self.WRdsDisableEncryptionStatus == other.WRdsDisableEncryptionStatus
&& self.WRdsDisableEncryptionValue == other.WRdsDisableEncryptionValue
&& self.WRdsResetBrokenStatus == other.WRdsResetBrokenStatus
&& self.WRdsResetBrokenValue == other.WRdsResetBrokenValue
&& self.WRdsMaxIdleTimeStatus == other.WRdsMaxIdleTimeStatus
&& self.WRdsMaxIdleTimeValue == other.WRdsMaxIdleTimeValue
&& self.WRdsMaxDisconnectTimeStatus == other.WRdsMaxDisconnectTimeStatus
&& self.WRdsMaxDisconnectTimeValue == other.WRdsMaxDisconnectTimeValue
&& self.WRdsMaxConnectTimeStatus == other.WRdsMaxConnectTimeStatus
&& self.WRdsMaxConnectTimeValue == other.WRdsMaxConnectTimeValue
&& self.WRdsKeepAliveStatus == other.WRdsKeepAliveStatus
&& self.WRdsKeepAliveStartValue == other.WRdsKeepAliveStartValue
&& self.WRdsKeepAliveIntervalValue == other.WRdsKeepAliveIntervalValue
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WRDS_SETTINGS_1 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WRDS_SETTINGS_1 {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRDS_SETTING_LEVEL(pub i32);
pub const WRDS_SETTING_LEVEL_INVALID: WRDS_SETTING_LEVEL = WRDS_SETTING_LEVEL(0i32);
pub const WRDS_SETTING_LEVEL_1: WRDS_SETTING_LEVEL = WRDS_SETTING_LEVEL(1i32);
impl ::core::convert::From<i32> for WRDS_SETTING_LEVEL {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRDS_SETTING_LEVEL {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRDS_SETTING_STATUS(pub i32);
pub const WRDS_SETTING_STATUS_NOTAPPLICABLE: WRDS_SETTING_STATUS = WRDS_SETTING_STATUS(-1i32);
pub const WRDS_SETTING_STATUS_DISABLED: WRDS_SETTING_STATUS = WRDS_SETTING_STATUS(0i32);
pub const WRDS_SETTING_STATUS_ENABLED: WRDS_SETTING_STATUS = WRDS_SETTING_STATUS(1i32);
pub const WRDS_SETTING_STATUS_NOTCONFIGURED: WRDS_SETTING_STATUS = WRDS_SETTING_STATUS(2i32);
impl ::core::convert::From<i32> for WRDS_SETTING_STATUS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRDS_SETTING_STATUS {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRDS_SETTING_TYPE(pub i32);
pub const WRDS_SETTING_TYPE_INVALID: WRDS_SETTING_TYPE = WRDS_SETTING_TYPE(0i32);
pub const WRDS_SETTING_TYPE_MACHINE: WRDS_SETTING_TYPE = WRDS_SETTING_TYPE(1i32);
pub const WRDS_SETTING_TYPE_USER: WRDS_SETTING_TYPE = WRDS_SETTING_TYPE(2i32);
pub const WRDS_SETTING_TYPE_SAM: WRDS_SETTING_TYPE = WRDS_SETTING_TYPE(3i32);
impl ::core::convert::From<i32> for WRDS_SETTING_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRDS_SETTING_TYPE {
type Abi = Self;
}
pub const WRDS_USERNAME_LENGTH: u32 = 255u32;
pub const WRDS_VALUE_TYPE_BINARY: u32 = 3u32;
pub const WRDS_VALUE_TYPE_GUID: u32 = 4u32;
pub const WRDS_VALUE_TYPE_STRING: u32 = 2u32;
pub const WRDS_VALUE_TYPE_ULONG: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WRdsGraphicsChannelType(pub i32);
pub const WRdsGraphicsChannelType_GuaranteedDelivery: WRdsGraphicsChannelType = WRdsGraphicsChannelType(0i32);
pub const WRdsGraphicsChannelType_BestEffortDelivery: WRdsGraphicsChannelType = WRdsGraphicsChannelType(1i32);
impl ::core::convert::From<i32> for WRdsGraphicsChannelType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WRdsGraphicsChannelType {
type Abi = Self;
}
pub const WRdsGraphicsChannels_LossyChannelMaxMessageSize: u32 = 988u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSCLIENTA {
pub ClientName: [super::super::Foundation::CHAR; 21],
pub Domain: [super::super::Foundation::CHAR; 18],
pub UserName: [super::super::Foundation::CHAR; 21],
pub WorkDirectory: [super::super::Foundation::CHAR; 261],
pub InitialProgram: [super::super::Foundation::CHAR; 261],
pub EncryptionLevel: u8,
pub ClientAddressFamily: u32,
pub ClientAddress: [u16; 31],
pub HRes: u16,
pub VRes: u16,
pub ColorDepth: u16,
pub ClientDirectory: [super::super::Foundation::CHAR; 261],
pub ClientBuildNumber: u32,
pub ClientHardwareId: u32,
pub ClientProductId: u16,
pub OutBufCountHost: u16,
pub OutBufCountClient: u16,
pub OutBufLength: u16,
pub DeviceId: [super::super::Foundation::CHAR; 261],
}
#[cfg(feature = "Win32_Foundation")]
impl WTSCLIENTA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSCLIENTA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSCLIENTA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSCLIENTA")
.field("ClientName", &self.ClientName)
.field("Domain", &self.Domain)
.field("UserName", &self.UserName)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.field("EncryptionLevel", &self.EncryptionLevel)
.field("ClientAddressFamily", &self.ClientAddressFamily)
.field("ClientAddress", &self.ClientAddress)
.field("HRes", &self.HRes)
.field("VRes", &self.VRes)
.field("ColorDepth", &self.ColorDepth)
.field("ClientDirectory", &self.ClientDirectory)
.field("ClientBuildNumber", &self.ClientBuildNumber)
.field("ClientHardwareId", &self.ClientHardwareId)
.field("ClientProductId", &self.ClientProductId)
.field("OutBufCountHost", &self.OutBufCountHost)
.field("OutBufCountClient", &self.OutBufCountClient)
.field("OutBufLength", &self.OutBufLength)
.field("DeviceId", &self.DeviceId)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSCLIENTA {
fn eq(&self, other: &Self) -> bool {
self.ClientName == other.ClientName
&& self.Domain == other.Domain
&& self.UserName == other.UserName
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
&& self.EncryptionLevel == other.EncryptionLevel
&& self.ClientAddressFamily == other.ClientAddressFamily
&& self.ClientAddress == other.ClientAddress
&& self.HRes == other.HRes
&& self.VRes == other.VRes
&& self.ColorDepth == other.ColorDepth
&& self.ClientDirectory == other.ClientDirectory
&& self.ClientBuildNumber == other.ClientBuildNumber
&& self.ClientHardwareId == other.ClientHardwareId
&& self.ClientProductId == other.ClientProductId
&& self.OutBufCountHost == other.OutBufCountHost
&& self.OutBufCountClient == other.OutBufCountClient
&& self.OutBufLength == other.OutBufLength
&& self.DeviceId == other.DeviceId
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSCLIENTA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSCLIENTA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSCLIENTW {
pub ClientName: [u16; 21],
pub Domain: [u16; 18],
pub UserName: [u16; 21],
pub WorkDirectory: [u16; 261],
pub InitialProgram: [u16; 261],
pub EncryptionLevel: u8,
pub ClientAddressFamily: u32,
pub ClientAddress: [u16; 31],
pub HRes: u16,
pub VRes: u16,
pub ColorDepth: u16,
pub ClientDirectory: [u16; 261],
pub ClientBuildNumber: u32,
pub ClientHardwareId: u32,
pub ClientProductId: u16,
pub OutBufCountHost: u16,
pub OutBufCountClient: u16,
pub OutBufLength: u16,
pub DeviceId: [u16; 261],
}
impl WTSCLIENTW {}
impl ::core::default::Default for WTSCLIENTW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSCLIENTW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSCLIENTW")
.field("ClientName", &self.ClientName)
.field("Domain", &self.Domain)
.field("UserName", &self.UserName)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.field("EncryptionLevel", &self.EncryptionLevel)
.field("ClientAddressFamily", &self.ClientAddressFamily)
.field("ClientAddress", &self.ClientAddress)
.field("HRes", &self.HRes)
.field("VRes", &self.VRes)
.field("ColorDepth", &self.ColorDepth)
.field("ClientDirectory", &self.ClientDirectory)
.field("ClientBuildNumber", &self.ClientBuildNumber)
.field("ClientHardwareId", &self.ClientHardwareId)
.field("ClientProductId", &self.ClientProductId)
.field("OutBufCountHost", &self.OutBufCountHost)
.field("OutBufCountClient", &self.OutBufCountClient)
.field("OutBufLength", &self.OutBufLength)
.field("DeviceId", &self.DeviceId)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSCLIENTW {
fn eq(&self, other: &Self) -> bool {
self.ClientName == other.ClientName
&& self.Domain == other.Domain
&& self.UserName == other.UserName
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
&& self.EncryptionLevel == other.EncryptionLevel
&& self.ClientAddressFamily == other.ClientAddressFamily
&& self.ClientAddress == other.ClientAddress
&& self.HRes == other.HRes
&& self.VRes == other.VRes
&& self.ColorDepth == other.ColorDepth
&& self.ClientDirectory == other.ClientDirectory
&& self.ClientBuildNumber == other.ClientBuildNumber
&& self.ClientHardwareId == other.ClientHardwareId
&& self.ClientProductId == other.ClientProductId
&& self.OutBufCountHost == other.OutBufCountHost
&& self.OutBufCountClient == other.OutBufCountClient
&& self.OutBufLength == other.OutBufLength
&& self.DeviceId == other.DeviceId
}
}
impl ::core::cmp::Eq for WTSCLIENTW {}
unsafe impl ::windows::core::Abi for WTSCLIENTW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSCONFIGINFOA {
pub version: u32,
pub fConnectClientDrivesAtLogon: u32,
pub fConnectPrinterAtLogon: u32,
pub fDisablePrinterRedirection: u32,
pub fDisableDefaultMainClientPrinter: u32,
pub ShadowSettings: u32,
pub LogonUserName: [super::super::Foundation::CHAR; 21],
pub LogonDomain: [super::super::Foundation::CHAR; 18],
pub WorkDirectory: [super::super::Foundation::CHAR; 261],
pub InitialProgram: [super::super::Foundation::CHAR; 261],
pub ApplicationName: [super::super::Foundation::CHAR; 261],
}
#[cfg(feature = "Win32_Foundation")]
impl WTSCONFIGINFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSCONFIGINFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSCONFIGINFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSCONFIGINFOA")
.field("version", &self.version)
.field("fConnectClientDrivesAtLogon", &self.fConnectClientDrivesAtLogon)
.field("fConnectPrinterAtLogon", &self.fConnectPrinterAtLogon)
.field("fDisablePrinterRedirection", &self.fDisablePrinterRedirection)
.field("fDisableDefaultMainClientPrinter", &self.fDisableDefaultMainClientPrinter)
.field("ShadowSettings", &self.ShadowSettings)
.field("LogonUserName", &self.LogonUserName)
.field("LogonDomain", &self.LogonDomain)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.field("ApplicationName", &self.ApplicationName)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSCONFIGINFOA {
fn eq(&self, other: &Self) -> bool {
self.version == other.version
&& self.fConnectClientDrivesAtLogon == other.fConnectClientDrivesAtLogon
&& self.fConnectPrinterAtLogon == other.fConnectPrinterAtLogon
&& self.fDisablePrinterRedirection == other.fDisablePrinterRedirection
&& self.fDisableDefaultMainClientPrinter == other.fDisableDefaultMainClientPrinter
&& self.ShadowSettings == other.ShadowSettings
&& self.LogonUserName == other.LogonUserName
&& self.LogonDomain == other.LogonDomain
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
&& self.ApplicationName == other.ApplicationName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSCONFIGINFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSCONFIGINFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSCONFIGINFOW {
pub version: u32,
pub fConnectClientDrivesAtLogon: u32,
pub fConnectPrinterAtLogon: u32,
pub fDisablePrinterRedirection: u32,
pub fDisableDefaultMainClientPrinter: u32,
pub ShadowSettings: u32,
pub LogonUserName: [u16; 21],
pub LogonDomain: [u16; 18],
pub WorkDirectory: [u16; 261],
pub InitialProgram: [u16; 261],
pub ApplicationName: [u16; 261],
}
impl WTSCONFIGINFOW {}
impl ::core::default::Default for WTSCONFIGINFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSCONFIGINFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSCONFIGINFOW")
.field("version", &self.version)
.field("fConnectClientDrivesAtLogon", &self.fConnectClientDrivesAtLogon)
.field("fConnectPrinterAtLogon", &self.fConnectPrinterAtLogon)
.field("fDisablePrinterRedirection", &self.fDisablePrinterRedirection)
.field("fDisableDefaultMainClientPrinter", &self.fDisableDefaultMainClientPrinter)
.field("ShadowSettings", &self.ShadowSettings)
.field("LogonUserName", &self.LogonUserName)
.field("LogonDomain", &self.LogonDomain)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.field("ApplicationName", &self.ApplicationName)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSCONFIGINFOW {
fn eq(&self, other: &Self) -> bool {
self.version == other.version
&& self.fConnectClientDrivesAtLogon == other.fConnectClientDrivesAtLogon
&& self.fConnectPrinterAtLogon == other.fConnectPrinterAtLogon
&& self.fDisablePrinterRedirection == other.fDisablePrinterRedirection
&& self.fDisableDefaultMainClientPrinter == other.fDisableDefaultMainClientPrinter
&& self.ShadowSettings == other.ShadowSettings
&& self.LogonUserName == other.LogonUserName
&& self.LogonDomain == other.LogonDomain
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
&& self.ApplicationName == other.ApplicationName
}
}
impl ::core::cmp::Eq for WTSCONFIGINFOW {}
unsafe impl ::windows::core::Abi for WTSCONFIGINFOW {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSCloseServer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0) {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSCloseServer(hserver: super::super::Foundation::HANDLE);
}
::core::mem::transmute(WTSCloseServer(hserver.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSConnectSessionA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(logonid: u32, targetlogonid: u32, ppassword: Param2, bwait: Param3) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSConnectSessionA(logonid: u32, targetlogonid: u32, ppassword: super::super::Foundation::PSTR, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSConnectSessionA(::core::mem::transmute(logonid), ::core::mem::transmute(targetlogonid), ppassword.into_param().abi(), bwait.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSConnectSessionW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(logonid: u32, targetlogonid: u32, ppassword: Param2, bwait: Param3) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSConnectSessionW(logonid: u32, targetlogonid: u32, ppassword: super::super::Foundation::PWSTR, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSConnectSessionW(::core::mem::transmute(logonid), ::core::mem::transmute(targetlogonid), ppassword.into_param().abi(), bwait.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSCreateListenerA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, pbuffer: *const WTSLISTENERCONFIGA, flag: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSCreateListenerA(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PSTR, pbuffer: *const WTSLISTENERCONFIGA, flag: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSCreateListenerA(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(pbuffer), ::core::mem::transmute(flag)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSCreateListenerW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, pbuffer: *const WTSLISTENERCONFIGW, flag: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSCreateListenerW(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PWSTR, pbuffer: *const WTSLISTENERCONFIGW, flag: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSCreateListenerW(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(pbuffer), ::core::mem::transmute(flag)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSDisconnectSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hserver: Param0, sessionid: u32, bwait: Param2) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSDisconnectSession(hserver: super::super::Foundation::HANDLE, sessionid: u32, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSDisconnectSession(hserver.into_param().abi(), ::core::mem::transmute(sessionid), bwait.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnableChildSessions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(benable: Param0) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnableChildSessions(benable: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnableChildSessions(benable.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateListenersA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plisteners: *mut *mut i8, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateListenersA(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plisteners: *mut *mut i8, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateListenersA(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), ::core::mem::transmute(plisteners), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateListenersW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plisteners: *mut *mut u16, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateListenersW(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plisteners: *mut *mut u16, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateListenersW(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), ::core::mem::transmute(plisteners), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateProcessesA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, reserved: u32, version: u32, ppprocessinfo: *mut *mut WTS_PROCESS_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateProcessesA(hserver: super::super::Foundation::HANDLE, reserved: u32, version: u32, ppprocessinfo: *mut *mut WTS_PROCESS_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateProcessesA(hserver.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppprocessinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateProcessesExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, plevel: *mut u32, sessionid: u32, ppprocessinfo: *mut super::super::Foundation::PSTR, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateProcessesExA(hserver: super::super::Foundation::HANDLE, plevel: *mut u32, sessionid: u32, ppprocessinfo: *mut super::super::Foundation::PSTR, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateProcessesExA(hserver.into_param().abi(), ::core::mem::transmute(plevel), ::core::mem::transmute(sessionid), ::core::mem::transmute(ppprocessinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateProcessesExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, plevel: *mut u32, sessionid: u32, ppprocessinfo: *mut super::super::Foundation::PWSTR, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateProcessesExW(hserver: super::super::Foundation::HANDLE, plevel: *mut u32, sessionid: u32, ppprocessinfo: *mut super::super::Foundation::PWSTR, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateProcessesExW(hserver.into_param().abi(), ::core::mem::transmute(plevel), ::core::mem::transmute(sessionid), ::core::mem::transmute(ppprocessinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateProcessesW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, reserved: u32, version: u32, ppprocessinfo: *mut *mut WTS_PROCESS_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateProcessesW(hserver: super::super::Foundation::HANDLE, reserved: u32, version: u32, ppprocessinfo: *mut *mut WTS_PROCESS_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateProcessesW(hserver.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppprocessinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateServersA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pdomainname: Param0, reserved: u32, version: u32, ppserverinfo: *mut *mut WTS_SERVER_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateServersA(pdomainname: super::super::Foundation::PSTR, reserved: u32, version: u32, ppserverinfo: *mut *mut WTS_SERVER_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateServersA(pdomainname.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppserverinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateServersW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pdomainname: Param0, reserved: u32, version: u32, ppserverinfo: *mut *mut WTS_SERVER_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateServersW(pdomainname: super::super::Foundation::PWSTR, reserved: u32, version: u32, ppserverinfo: *mut *mut WTS_SERVER_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateServersW(pdomainname.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppserverinfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateSessionsA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, reserved: u32, version: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateSessionsA(hserver: super::super::Foundation::HANDLE, reserved: u32, version: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFOA, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateSessionsA(hserver.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppsessioninfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateSessionsExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, plevel: *mut u32, filter: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFO_1A, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateSessionsExA(hserver: super::super::Foundation::HANDLE, plevel: *mut u32, filter: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFO_1A, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateSessionsExA(hserver.into_param().abi(), ::core::mem::transmute(plevel), ::core::mem::transmute(filter), ::core::mem::transmute(ppsessioninfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateSessionsExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, plevel: *mut u32, filter: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFO_1W, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateSessionsExW(hserver: super::super::Foundation::HANDLE, plevel: *mut u32, filter: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFO_1W, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateSessionsExW(hserver.into_param().abi(), ::core::mem::transmute(plevel), ::core::mem::transmute(filter), ::core::mem::transmute(ppsessioninfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSEnumerateSessionsW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, reserved: u32, version: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSEnumerateSessionsW(hserver: super::super::Foundation::HANDLE, reserved: u32, version: u32, ppsessioninfo: *mut *mut WTS_SESSION_INFOW, pcount: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSEnumerateSessionsW(hserver.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(version), ::core::mem::transmute(ppsessioninfo), ::core::mem::transmute(pcount)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn WTSFreeMemory(pmemory: *mut ::core::ffi::c_void) {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSFreeMemory(pmemory: *mut ::core::ffi::c_void);
}
::core::mem::transmute(WTSFreeMemory(::core::mem::transmute(pmemory)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSFreeMemoryExA(wtstypeclass: WTS_TYPE_CLASS, pmemory: *const ::core::ffi::c_void, numberofentries: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSFreeMemoryExA(wtstypeclass: WTS_TYPE_CLASS, pmemory: *const ::core::ffi::c_void, numberofentries: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSFreeMemoryExA(::core::mem::transmute(wtstypeclass), ::core::mem::transmute(pmemory), ::core::mem::transmute(numberofentries)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSFreeMemoryExW(wtstypeclass: WTS_TYPE_CLASS, pmemory: *const ::core::ffi::c_void, numberofentries: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSFreeMemoryExW(wtstypeclass: WTS_TYPE_CLASS, pmemory: *const ::core::ffi::c_void, numberofentries: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSFreeMemoryExW(::core::mem::transmute(wtstypeclass), ::core::mem::transmute(pmemory), ::core::mem::transmute(numberofentries)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn WTSGetActiveConsoleSessionId() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSGetActiveConsoleSessionId() -> u32;
}
::core::mem::transmute(WTSGetActiveConsoleSessionId())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSGetChildSessionId(psessionid: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSGetChildSessionId(psessionid: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSGetChildSessionId(::core::mem::transmute(psessionid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security"))]
#[inline]
pub unsafe fn WTSGetListenerSecurityA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, securityinformation: u32, psecuritydescriptor: *mut super::super::Security::SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSGetListenerSecurityA(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PSTR, securityinformation: u32, psecuritydescriptor: *mut super::super::Security::SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSGetListenerSecurityA(
hserver.into_param().abi(),
::core::mem::transmute(preserved),
::core::mem::transmute(reserved),
plistenername.into_param().abi(),
::core::mem::transmute(securityinformation),
::core::mem::transmute(psecuritydescriptor),
::core::mem::transmute(nlength),
::core::mem::transmute(lpnlengthneeded),
))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security"))]
#[inline]
pub unsafe fn WTSGetListenerSecurityW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, securityinformation: u32, psecuritydescriptor: *mut super::super::Security::SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSGetListenerSecurityW(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PWSTR, securityinformation: u32, psecuritydescriptor: *mut super::super::Security::SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSGetListenerSecurityW(
hserver.into_param().abi(),
::core::mem::transmute(preserved),
::core::mem::transmute(reserved),
plistenername.into_param().abi(),
::core::mem::transmute(securityinformation),
::core::mem::transmute(psecuritydescriptor),
::core::mem::transmute(nlength),
::core::mem::transmute(lpnlengthneeded),
))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSINFOA {
pub State: WTS_CONNECTSTATE_CLASS,
pub SessionId: u32,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBy: u32,
pub WinStationName: [super::super::Foundation::CHAR; 32],
pub Domain: [super::super::Foundation::CHAR; 17],
pub UserName: [super::super::Foundation::CHAR; 21],
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub LogonTime: i64,
pub CurrentTime: i64,
}
#[cfg(feature = "Win32_Foundation")]
impl WTSINFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSINFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSINFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSINFOA")
.field("State", &self.State)
.field("SessionId", &self.SessionId)
.field("IncomingBytes", &self.IncomingBytes)
.field("OutgoingBytes", &self.OutgoingBytes)
.field("IncomingFrames", &self.IncomingFrames)
.field("OutgoingFrames", &self.OutgoingFrames)
.field("IncomingCompressedBytes", &self.IncomingCompressedBytes)
.field("OutgoingCompressedBy", &self.OutgoingCompressedBy)
.field("WinStationName", &self.WinStationName)
.field("Domain", &self.Domain)
.field("UserName", &self.UserName)
.field("ConnectTime", &self.ConnectTime)
.field("DisconnectTime", &self.DisconnectTime)
.field("LastInputTime", &self.LastInputTime)
.field("LogonTime", &self.LogonTime)
.field("CurrentTime", &self.CurrentTime)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSINFOA {
fn eq(&self, other: &Self) -> bool {
self.State == other.State
&& self.SessionId == other.SessionId
&& self.IncomingBytes == other.IncomingBytes
&& self.OutgoingBytes == other.OutgoingBytes
&& self.IncomingFrames == other.IncomingFrames
&& self.OutgoingFrames == other.OutgoingFrames
&& self.IncomingCompressedBytes == other.IncomingCompressedBytes
&& self.OutgoingCompressedBy == other.OutgoingCompressedBy
&& self.WinStationName == other.WinStationName
&& self.Domain == other.Domain
&& self.UserName == other.UserName
&& self.ConnectTime == other.ConnectTime
&& self.DisconnectTime == other.DisconnectTime
&& self.LastInputTime == other.LastInputTime
&& self.LogonTime == other.LogonTime
&& self.CurrentTime == other.CurrentTime
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSINFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSINFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSINFOEXA {
pub Level: u32,
pub Data: WTSINFOEX_LEVEL_A,
}
#[cfg(feature = "Win32_Foundation")]
impl WTSINFOEXA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSINFOEXA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSINFOEXA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSINFOEXA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSINFOEXA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSINFOEXW {
pub Level: u32,
pub Data: WTSINFOEX_LEVEL_W,
}
impl WTSINFOEXW {}
impl ::core::default::Default for WTSINFOEXW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTSINFOEXW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTSINFOEXW {}
unsafe impl ::windows::core::Abi for WTSINFOEXW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSINFOEX_LEVEL1_A {
pub SessionId: u32,
pub SessionState: WTS_CONNECTSTATE_CLASS,
pub SessionFlags: i32,
pub WinStationName: [super::super::Foundation::CHAR; 33],
pub UserName: [super::super::Foundation::CHAR; 21],
pub DomainName: [super::super::Foundation::CHAR; 18],
pub LogonTime: i64,
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub CurrentTime: i64,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBytes: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl WTSINFOEX_LEVEL1_A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSINFOEX_LEVEL1_A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSINFOEX_LEVEL1_A {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSINFOEX_LEVEL1_A")
.field("SessionId", &self.SessionId)
.field("SessionState", &self.SessionState)
.field("SessionFlags", &self.SessionFlags)
.field("WinStationName", &self.WinStationName)
.field("UserName", &self.UserName)
.field("DomainName", &self.DomainName)
.field("LogonTime", &self.LogonTime)
.field("ConnectTime", &self.ConnectTime)
.field("DisconnectTime", &self.DisconnectTime)
.field("LastInputTime", &self.LastInputTime)
.field("CurrentTime", &self.CurrentTime)
.field("IncomingBytes", &self.IncomingBytes)
.field("OutgoingBytes", &self.OutgoingBytes)
.field("IncomingFrames", &self.IncomingFrames)
.field("OutgoingFrames", &self.OutgoingFrames)
.field("IncomingCompressedBytes", &self.IncomingCompressedBytes)
.field("OutgoingCompressedBytes", &self.OutgoingCompressedBytes)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSINFOEX_LEVEL1_A {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId
&& self.SessionState == other.SessionState
&& self.SessionFlags == other.SessionFlags
&& self.WinStationName == other.WinStationName
&& self.UserName == other.UserName
&& self.DomainName == other.DomainName
&& self.LogonTime == other.LogonTime
&& self.ConnectTime == other.ConnectTime
&& self.DisconnectTime == other.DisconnectTime
&& self.LastInputTime == other.LastInputTime
&& self.CurrentTime == other.CurrentTime
&& self.IncomingBytes == other.IncomingBytes
&& self.OutgoingBytes == other.OutgoingBytes
&& self.IncomingFrames == other.IncomingFrames
&& self.OutgoingFrames == other.OutgoingFrames
&& self.IncomingCompressedBytes == other.IncomingCompressedBytes
&& self.OutgoingCompressedBytes == other.OutgoingCompressedBytes
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSINFOEX_LEVEL1_A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSINFOEX_LEVEL1_A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSINFOEX_LEVEL1_W {
pub SessionId: u32,
pub SessionState: WTS_CONNECTSTATE_CLASS,
pub SessionFlags: i32,
pub WinStationName: [u16; 33],
pub UserName: [u16; 21],
pub DomainName: [u16; 18],
pub LogonTime: i64,
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub CurrentTime: i64,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBytes: u32,
}
impl WTSINFOEX_LEVEL1_W {}
impl ::core::default::Default for WTSINFOEX_LEVEL1_W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSINFOEX_LEVEL1_W {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSINFOEX_LEVEL1_W")
.field("SessionId", &self.SessionId)
.field("SessionState", &self.SessionState)
.field("SessionFlags", &self.SessionFlags)
.field("WinStationName", &self.WinStationName)
.field("UserName", &self.UserName)
.field("DomainName", &self.DomainName)
.field("LogonTime", &self.LogonTime)
.field("ConnectTime", &self.ConnectTime)
.field("DisconnectTime", &self.DisconnectTime)
.field("LastInputTime", &self.LastInputTime)
.field("CurrentTime", &self.CurrentTime)
.field("IncomingBytes", &self.IncomingBytes)
.field("OutgoingBytes", &self.OutgoingBytes)
.field("IncomingFrames", &self.IncomingFrames)
.field("OutgoingFrames", &self.OutgoingFrames)
.field("IncomingCompressedBytes", &self.IncomingCompressedBytes)
.field("OutgoingCompressedBytes", &self.OutgoingCompressedBytes)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSINFOEX_LEVEL1_W {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId
&& self.SessionState == other.SessionState
&& self.SessionFlags == other.SessionFlags
&& self.WinStationName == other.WinStationName
&& self.UserName == other.UserName
&& self.DomainName == other.DomainName
&& self.LogonTime == other.LogonTime
&& self.ConnectTime == other.ConnectTime
&& self.DisconnectTime == other.DisconnectTime
&& self.LastInputTime == other.LastInputTime
&& self.CurrentTime == other.CurrentTime
&& self.IncomingBytes == other.IncomingBytes
&& self.OutgoingBytes == other.OutgoingBytes
&& self.IncomingFrames == other.IncomingFrames
&& self.OutgoingFrames == other.OutgoingFrames
&& self.IncomingCompressedBytes == other.IncomingCompressedBytes
&& self.OutgoingCompressedBytes == other.OutgoingCompressedBytes
}
}
impl ::core::cmp::Eq for WTSINFOEX_LEVEL1_W {}
unsafe impl ::windows::core::Abi for WTSINFOEX_LEVEL1_W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub union WTSINFOEX_LEVEL_A {
pub WTSInfoExLevel1: WTSINFOEX_LEVEL1_A,
}
#[cfg(feature = "Win32_Foundation")]
impl WTSINFOEX_LEVEL_A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSINFOEX_LEVEL_A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSINFOEX_LEVEL_A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSINFOEX_LEVEL_A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSINFOEX_LEVEL_A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union WTSINFOEX_LEVEL_W {
pub WTSInfoExLevel1: WTSINFOEX_LEVEL1_W,
}
impl WTSINFOEX_LEVEL_W {}
impl ::core::default::Default for WTSINFOEX_LEVEL_W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTSINFOEX_LEVEL_W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTSINFOEX_LEVEL_W {}
unsafe impl ::windows::core::Abi for WTSINFOEX_LEVEL_W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSINFOW {
pub State: WTS_CONNECTSTATE_CLASS,
pub SessionId: u32,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBytes: u32,
pub WinStationName: [u16; 32],
pub Domain: [u16; 17],
pub UserName: [u16; 21],
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub LogonTime: i64,
pub CurrentTime: i64,
}
impl WTSINFOW {}
impl ::core::default::Default for WTSINFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSINFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSINFOW")
.field("State", &self.State)
.field("SessionId", &self.SessionId)
.field("IncomingBytes", &self.IncomingBytes)
.field("OutgoingBytes", &self.OutgoingBytes)
.field("IncomingFrames", &self.IncomingFrames)
.field("OutgoingFrames", &self.OutgoingFrames)
.field("IncomingCompressedBytes", &self.IncomingCompressedBytes)
.field("OutgoingCompressedBytes", &self.OutgoingCompressedBytes)
.field("WinStationName", &self.WinStationName)
.field("Domain", &self.Domain)
.field("UserName", &self.UserName)
.field("ConnectTime", &self.ConnectTime)
.field("DisconnectTime", &self.DisconnectTime)
.field("LastInputTime", &self.LastInputTime)
.field("LogonTime", &self.LogonTime)
.field("CurrentTime", &self.CurrentTime)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSINFOW {
fn eq(&self, other: &Self) -> bool {
self.State == other.State
&& self.SessionId == other.SessionId
&& self.IncomingBytes == other.IncomingBytes
&& self.OutgoingBytes == other.OutgoingBytes
&& self.IncomingFrames == other.IncomingFrames
&& self.OutgoingFrames == other.OutgoingFrames
&& self.IncomingCompressedBytes == other.IncomingCompressedBytes
&& self.OutgoingCompressedBytes == other.OutgoingCompressedBytes
&& self.WinStationName == other.WinStationName
&& self.Domain == other.Domain
&& self.UserName == other.UserName
&& self.ConnectTime == other.ConnectTime
&& self.DisconnectTime == other.DisconnectTime
&& self.LastInputTime == other.LastInputTime
&& self.LogonTime == other.LogonTime
&& self.CurrentTime == other.CurrentTime
}
}
impl ::core::cmp::Eq for WTSINFOW {}
unsafe impl ::windows::core::Abi for WTSINFOW {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSIsChildSessionsEnabled(pbenabled: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSIsChildSessionsEnabled(pbenabled: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSIsChildSessionsEnabled(::core::mem::transmute(pbenabled)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSLISTENERCONFIGA {
pub version: u32,
pub fEnableListener: u32,
pub MaxConnectionCount: u32,
pub fPromptForPassword: u32,
pub fInheritColorDepth: u32,
pub ColorDepth: u32,
pub fInheritBrokenTimeoutSettings: u32,
pub BrokenTimeoutSettings: u32,
pub fDisablePrinterRedirection: u32,
pub fDisableDriveRedirection: u32,
pub fDisableComPortRedirection: u32,
pub fDisableLPTPortRedirection: u32,
pub fDisableClipboardRedirection: u32,
pub fDisableAudioRedirection: u32,
pub fDisablePNPRedirection: u32,
pub fDisableDefaultMainClientPrinter: u32,
pub LanAdapter: u32,
pub PortNumber: u32,
pub fInheritShadowSettings: u32,
pub ShadowSettings: u32,
pub TimeoutSettingsConnection: u32,
pub TimeoutSettingsDisconnection: u32,
pub TimeoutSettingsIdle: u32,
pub SecurityLayer: u32,
pub MinEncryptionLevel: u32,
pub UserAuthentication: u32,
pub Comment: [super::super::Foundation::CHAR; 61],
pub LogonUserName: [super::super::Foundation::CHAR; 21],
pub LogonDomain: [super::super::Foundation::CHAR; 18],
pub WorkDirectory: [super::super::Foundation::CHAR; 261],
pub InitialProgram: [super::super::Foundation::CHAR; 261],
}
#[cfg(feature = "Win32_Foundation")]
impl WTSLISTENERCONFIGA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSLISTENERCONFIGA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSLISTENERCONFIGA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSLISTENERCONFIGA")
.field("version", &self.version)
.field("fEnableListener", &self.fEnableListener)
.field("MaxConnectionCount", &self.MaxConnectionCount)
.field("fPromptForPassword", &self.fPromptForPassword)
.field("fInheritColorDepth", &self.fInheritColorDepth)
.field("ColorDepth", &self.ColorDepth)
.field("fInheritBrokenTimeoutSettings", &self.fInheritBrokenTimeoutSettings)
.field("BrokenTimeoutSettings", &self.BrokenTimeoutSettings)
.field("fDisablePrinterRedirection", &self.fDisablePrinterRedirection)
.field("fDisableDriveRedirection", &self.fDisableDriveRedirection)
.field("fDisableComPortRedirection", &self.fDisableComPortRedirection)
.field("fDisableLPTPortRedirection", &self.fDisableLPTPortRedirection)
.field("fDisableClipboardRedirection", &self.fDisableClipboardRedirection)
.field("fDisableAudioRedirection", &self.fDisableAudioRedirection)
.field("fDisablePNPRedirection", &self.fDisablePNPRedirection)
.field("fDisableDefaultMainClientPrinter", &self.fDisableDefaultMainClientPrinter)
.field("LanAdapter", &self.LanAdapter)
.field("PortNumber", &self.PortNumber)
.field("fInheritShadowSettings", &self.fInheritShadowSettings)
.field("ShadowSettings", &self.ShadowSettings)
.field("TimeoutSettingsConnection", &self.TimeoutSettingsConnection)
.field("TimeoutSettingsDisconnection", &self.TimeoutSettingsDisconnection)
.field("TimeoutSettingsIdle", &self.TimeoutSettingsIdle)
.field("SecurityLayer", &self.SecurityLayer)
.field("MinEncryptionLevel", &self.MinEncryptionLevel)
.field("UserAuthentication", &self.UserAuthentication)
.field("Comment", &self.Comment)
.field("LogonUserName", &self.LogonUserName)
.field("LogonDomain", &self.LogonDomain)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSLISTENERCONFIGA {
fn eq(&self, other: &Self) -> bool {
self.version == other.version
&& self.fEnableListener == other.fEnableListener
&& self.MaxConnectionCount == other.MaxConnectionCount
&& self.fPromptForPassword == other.fPromptForPassword
&& self.fInheritColorDepth == other.fInheritColorDepth
&& self.ColorDepth == other.ColorDepth
&& self.fInheritBrokenTimeoutSettings == other.fInheritBrokenTimeoutSettings
&& self.BrokenTimeoutSettings == other.BrokenTimeoutSettings
&& self.fDisablePrinterRedirection == other.fDisablePrinterRedirection
&& self.fDisableDriveRedirection == other.fDisableDriveRedirection
&& self.fDisableComPortRedirection == other.fDisableComPortRedirection
&& self.fDisableLPTPortRedirection == other.fDisableLPTPortRedirection
&& self.fDisableClipboardRedirection == other.fDisableClipboardRedirection
&& self.fDisableAudioRedirection == other.fDisableAudioRedirection
&& self.fDisablePNPRedirection == other.fDisablePNPRedirection
&& self.fDisableDefaultMainClientPrinter == other.fDisableDefaultMainClientPrinter
&& self.LanAdapter == other.LanAdapter
&& self.PortNumber == other.PortNumber
&& self.fInheritShadowSettings == other.fInheritShadowSettings
&& self.ShadowSettings == other.ShadowSettings
&& self.TimeoutSettingsConnection == other.TimeoutSettingsConnection
&& self.TimeoutSettingsDisconnection == other.TimeoutSettingsDisconnection
&& self.TimeoutSettingsIdle == other.TimeoutSettingsIdle
&& self.SecurityLayer == other.SecurityLayer
&& self.MinEncryptionLevel == other.MinEncryptionLevel
&& self.UserAuthentication == other.UserAuthentication
&& self.Comment == other.Comment
&& self.LogonUserName == other.LogonUserName
&& self.LogonDomain == other.LogonDomain
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSLISTENERCONFIGA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSLISTENERCONFIGA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSLISTENERCONFIGW {
pub version: u32,
pub fEnableListener: u32,
pub MaxConnectionCount: u32,
pub fPromptForPassword: u32,
pub fInheritColorDepth: u32,
pub ColorDepth: u32,
pub fInheritBrokenTimeoutSettings: u32,
pub BrokenTimeoutSettings: u32,
pub fDisablePrinterRedirection: u32,
pub fDisableDriveRedirection: u32,
pub fDisableComPortRedirection: u32,
pub fDisableLPTPortRedirection: u32,
pub fDisableClipboardRedirection: u32,
pub fDisableAudioRedirection: u32,
pub fDisablePNPRedirection: u32,
pub fDisableDefaultMainClientPrinter: u32,
pub LanAdapter: u32,
pub PortNumber: u32,
pub fInheritShadowSettings: u32,
pub ShadowSettings: u32,
pub TimeoutSettingsConnection: u32,
pub TimeoutSettingsDisconnection: u32,
pub TimeoutSettingsIdle: u32,
pub SecurityLayer: u32,
pub MinEncryptionLevel: u32,
pub UserAuthentication: u32,
pub Comment: [u16; 61],
pub LogonUserName: [u16; 21],
pub LogonDomain: [u16; 18],
pub WorkDirectory: [u16; 261],
pub InitialProgram: [u16; 261],
}
impl WTSLISTENERCONFIGW {}
impl ::core::default::Default for WTSLISTENERCONFIGW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSLISTENERCONFIGW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSLISTENERCONFIGW")
.field("version", &self.version)
.field("fEnableListener", &self.fEnableListener)
.field("MaxConnectionCount", &self.MaxConnectionCount)
.field("fPromptForPassword", &self.fPromptForPassword)
.field("fInheritColorDepth", &self.fInheritColorDepth)
.field("ColorDepth", &self.ColorDepth)
.field("fInheritBrokenTimeoutSettings", &self.fInheritBrokenTimeoutSettings)
.field("BrokenTimeoutSettings", &self.BrokenTimeoutSettings)
.field("fDisablePrinterRedirection", &self.fDisablePrinterRedirection)
.field("fDisableDriveRedirection", &self.fDisableDriveRedirection)
.field("fDisableComPortRedirection", &self.fDisableComPortRedirection)
.field("fDisableLPTPortRedirection", &self.fDisableLPTPortRedirection)
.field("fDisableClipboardRedirection", &self.fDisableClipboardRedirection)
.field("fDisableAudioRedirection", &self.fDisableAudioRedirection)
.field("fDisablePNPRedirection", &self.fDisablePNPRedirection)
.field("fDisableDefaultMainClientPrinter", &self.fDisableDefaultMainClientPrinter)
.field("LanAdapter", &self.LanAdapter)
.field("PortNumber", &self.PortNumber)
.field("fInheritShadowSettings", &self.fInheritShadowSettings)
.field("ShadowSettings", &self.ShadowSettings)
.field("TimeoutSettingsConnection", &self.TimeoutSettingsConnection)
.field("TimeoutSettingsDisconnection", &self.TimeoutSettingsDisconnection)
.field("TimeoutSettingsIdle", &self.TimeoutSettingsIdle)
.field("SecurityLayer", &self.SecurityLayer)
.field("MinEncryptionLevel", &self.MinEncryptionLevel)
.field("UserAuthentication", &self.UserAuthentication)
.field("Comment", &self.Comment)
.field("LogonUserName", &self.LogonUserName)
.field("LogonDomain", &self.LogonDomain)
.field("WorkDirectory", &self.WorkDirectory)
.field("InitialProgram", &self.InitialProgram)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSLISTENERCONFIGW {
fn eq(&self, other: &Self) -> bool {
self.version == other.version
&& self.fEnableListener == other.fEnableListener
&& self.MaxConnectionCount == other.MaxConnectionCount
&& self.fPromptForPassword == other.fPromptForPassword
&& self.fInheritColorDepth == other.fInheritColorDepth
&& self.ColorDepth == other.ColorDepth
&& self.fInheritBrokenTimeoutSettings == other.fInheritBrokenTimeoutSettings
&& self.BrokenTimeoutSettings == other.BrokenTimeoutSettings
&& self.fDisablePrinterRedirection == other.fDisablePrinterRedirection
&& self.fDisableDriveRedirection == other.fDisableDriveRedirection
&& self.fDisableComPortRedirection == other.fDisableComPortRedirection
&& self.fDisableLPTPortRedirection == other.fDisableLPTPortRedirection
&& self.fDisableClipboardRedirection == other.fDisableClipboardRedirection
&& self.fDisableAudioRedirection == other.fDisableAudioRedirection
&& self.fDisablePNPRedirection == other.fDisablePNPRedirection
&& self.fDisableDefaultMainClientPrinter == other.fDisableDefaultMainClientPrinter
&& self.LanAdapter == other.LanAdapter
&& self.PortNumber == other.PortNumber
&& self.fInheritShadowSettings == other.fInheritShadowSettings
&& self.ShadowSettings == other.ShadowSettings
&& self.TimeoutSettingsConnection == other.TimeoutSettingsConnection
&& self.TimeoutSettingsDisconnection == other.TimeoutSettingsDisconnection
&& self.TimeoutSettingsIdle == other.TimeoutSettingsIdle
&& self.SecurityLayer == other.SecurityLayer
&& self.MinEncryptionLevel == other.MinEncryptionLevel
&& self.UserAuthentication == other.UserAuthentication
&& self.Comment == other.Comment
&& self.LogonUserName == other.LogonUserName
&& self.LogonDomain == other.LogonDomain
&& self.WorkDirectory == other.WorkDirectory
&& self.InitialProgram == other.InitialProgram
}
}
impl ::core::cmp::Eq for WTSLISTENERCONFIGW {}
unsafe impl ::windows::core::Abi for WTSLISTENERCONFIGW {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSLogoffSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hserver: Param0, sessionid: u32, bwait: Param2) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSLogoffSession(hserver: super::super::Foundation::HANDLE, sessionid: u32, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSLogoffSession(hserver.into_param().abi(), ::core::mem::transmute(sessionid), bwait.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSOpenServerA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pservername: Param0) -> super::super::Foundation::HANDLE {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSOpenServerA(pservername: super::super::Foundation::PSTR) -> super::super::Foundation::HANDLE;
}
::core::mem::transmute(WTSOpenServerA(pservername.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSOpenServerExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pservername: Param0) -> super::super::Foundation::HANDLE {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSOpenServerExA(pservername: super::super::Foundation::PSTR) -> super::super::Foundation::HANDLE;
}
::core::mem::transmute(WTSOpenServerExA(pservername.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSOpenServerExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pservername: Param0) -> super::super::Foundation::HANDLE {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSOpenServerExW(pservername: super::super::Foundation::PWSTR) -> super::super::Foundation::HANDLE;
}
::core::mem::transmute(WTSOpenServerExW(pservername.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSOpenServerW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pservername: Param0) -> super::super::Foundation::HANDLE {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSOpenServerW(pservername: super::super::Foundation::PWSTR) -> super::super::Foundation::HANDLE;
}
::core::mem::transmute(WTSOpenServerW(pservername.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQueryListenerConfigA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, pbuffer: *mut WTSLISTENERCONFIGA) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQueryListenerConfigA(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PSTR, pbuffer: *mut WTSLISTENERCONFIGA) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQueryListenerConfigA(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(pbuffer)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQueryListenerConfigW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, pbuffer: *mut WTSLISTENERCONFIGW) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQueryListenerConfigW(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PWSTR, pbuffer: *mut WTSLISTENERCONFIGW) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQueryListenerConfigW(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(pbuffer)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQuerySessionInformationA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, sessionid: u32, wtsinfoclass: WTS_INFO_CLASS, ppbuffer: *mut super::super::Foundation::PSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQuerySessionInformationA(hserver: super::super::Foundation::HANDLE, sessionid: u32, wtsinfoclass: WTS_INFO_CLASS, ppbuffer: *mut super::super::Foundation::PSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQuerySessionInformationA(hserver.into_param().abi(), ::core::mem::transmute(sessionid), ::core::mem::transmute(wtsinfoclass), ::core::mem::transmute(ppbuffer), ::core::mem::transmute(pbytesreturned)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQuerySessionInformationW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, sessionid: u32, wtsinfoclass: WTS_INFO_CLASS, ppbuffer: *mut super::super::Foundation::PWSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQuerySessionInformationW(hserver: super::super::Foundation::HANDLE, sessionid: u32, wtsinfoclass: WTS_INFO_CLASS, ppbuffer: *mut super::super::Foundation::PWSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQuerySessionInformationW(hserver.into_param().abi(), ::core::mem::transmute(sessionid), ::core::mem::transmute(wtsinfoclass), ::core::mem::transmute(ppbuffer), ::core::mem::transmute(pbytesreturned)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQueryUserConfigA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pservername: Param0, pusername: Param1, wtsconfigclass: WTS_CONFIG_CLASS, ppbuffer: *mut super::super::Foundation::PSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQueryUserConfigA(pservername: super::super::Foundation::PSTR, pusername: super::super::Foundation::PSTR, wtsconfigclass: WTS_CONFIG_CLASS, ppbuffer: *mut super::super::Foundation::PSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQueryUserConfigA(pservername.into_param().abi(), pusername.into_param().abi(), ::core::mem::transmute(wtsconfigclass), ::core::mem::transmute(ppbuffer), ::core::mem::transmute(pbytesreturned)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQueryUserConfigW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pservername: Param0, pusername: Param1, wtsconfigclass: WTS_CONFIG_CLASS, ppbuffer: *mut super::super::Foundation::PWSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQueryUserConfigW(pservername: super::super::Foundation::PWSTR, pusername: super::super::Foundation::PWSTR, wtsconfigclass: WTS_CONFIG_CLASS, ppbuffer: *mut super::super::Foundation::PWSTR, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQueryUserConfigW(pservername.into_param().abi(), pusername.into_param().abi(), ::core::mem::transmute(wtsconfigclass), ::core::mem::transmute(ppbuffer), ::core::mem::transmute(pbytesreturned)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSQueryUserToken(sessionid: u32, phtoken: *mut super::super::Foundation::HANDLE) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSQueryUserToken(sessionid: u32, phtoken: *mut super::super::Foundation::HANDLE) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSQueryUserToken(::core::mem::transmute(sessionid), ::core::mem::transmute(phtoken)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSRegisterSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwnd: Param0, dwflags: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSRegisterSessionNotification(hwnd: super::super::Foundation::HWND, dwflags: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSRegisterSessionNotification(hwnd.into_param().abi(), ::core::mem::transmute(dwflags)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSRegisterSessionNotificationEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hserver: Param0, hwnd: Param1, dwflags: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSRegisterSessionNotificationEx(hserver: super::super::Foundation::HANDLE, hwnd: super::super::Foundation::HWND, dwflags: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSRegisterSessionNotificationEx(hserver.into_param().abi(), hwnd.into_param().abi(), ::core::mem::transmute(dwflags)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_ADDRESS_FAMILY(pub i32);
pub const WTSSBX_ADDRESS_FAMILY_AF_UNSPEC: WTSSBX_ADDRESS_FAMILY = WTSSBX_ADDRESS_FAMILY(0i32);
pub const WTSSBX_ADDRESS_FAMILY_AF_INET: WTSSBX_ADDRESS_FAMILY = WTSSBX_ADDRESS_FAMILY(1i32);
pub const WTSSBX_ADDRESS_FAMILY_AF_INET6: WTSSBX_ADDRESS_FAMILY = WTSSBX_ADDRESS_FAMILY(2i32);
pub const WTSSBX_ADDRESS_FAMILY_AF_IPX: WTSSBX_ADDRESS_FAMILY = WTSSBX_ADDRESS_FAMILY(3i32);
pub const WTSSBX_ADDRESS_FAMILY_AF_NETBIOS: WTSSBX_ADDRESS_FAMILY = WTSSBX_ADDRESS_FAMILY(4i32);
impl ::core::convert::From<i32> for WTSSBX_ADDRESS_FAMILY {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_ADDRESS_FAMILY {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSSBX_IP_ADDRESS {
pub AddressFamily: WTSSBX_ADDRESS_FAMILY,
pub Address: [u8; 16],
pub PortNumber: u16,
pub dwScope: u32,
}
impl WTSSBX_IP_ADDRESS {}
impl ::core::default::Default for WTSSBX_IP_ADDRESS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSSBX_IP_ADDRESS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSSBX_IP_ADDRESS").field("AddressFamily", &self.AddressFamily).field("Address", &self.Address).field("PortNumber", &self.PortNumber).field("dwScope", &self.dwScope).finish()
}
}
impl ::core::cmp::PartialEq for WTSSBX_IP_ADDRESS {
fn eq(&self, other: &Self) -> bool {
self.AddressFamily == other.AddressFamily && self.Address == other.Address && self.PortNumber == other.PortNumber && self.dwScope == other.dwScope
}
}
impl ::core::cmp::Eq for WTSSBX_IP_ADDRESS {}
unsafe impl ::windows::core::Abi for WTSSBX_IP_ADDRESS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSSBX_MACHINE_CONNECT_INFO {
pub wczMachineFQDN: [u16; 257],
pub wczMachineNetBiosName: [u16; 17],
pub dwNumOfIPAddr: u32,
pub IPaddr: [WTSSBX_IP_ADDRESS; 12],
}
impl WTSSBX_MACHINE_CONNECT_INFO {}
impl ::core::default::Default for WTSSBX_MACHINE_CONNECT_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSSBX_MACHINE_CONNECT_INFO {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSSBX_MACHINE_CONNECT_INFO").field("wczMachineFQDN", &self.wczMachineFQDN).field("wczMachineNetBiosName", &self.wczMachineNetBiosName).field("dwNumOfIPAddr", &self.dwNumOfIPAddr).field("IPaddr", &self.IPaddr).finish()
}
}
impl ::core::cmp::PartialEq for WTSSBX_MACHINE_CONNECT_INFO {
fn eq(&self, other: &Self) -> bool {
self.wczMachineFQDN == other.wczMachineFQDN && self.wczMachineNetBiosName == other.wczMachineNetBiosName && self.dwNumOfIPAddr == other.dwNumOfIPAddr && self.IPaddr == other.IPaddr
}
}
impl ::core::cmp::Eq for WTSSBX_MACHINE_CONNECT_INFO {}
unsafe impl ::windows::core::Abi for WTSSBX_MACHINE_CONNECT_INFO {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_MACHINE_DRAIN(pub i32);
pub const WTSSBX_MACHINE_DRAIN_UNSPEC: WTSSBX_MACHINE_DRAIN = WTSSBX_MACHINE_DRAIN(0i32);
pub const WTSSBX_MACHINE_DRAIN_OFF: WTSSBX_MACHINE_DRAIN = WTSSBX_MACHINE_DRAIN(1i32);
pub const WTSSBX_MACHINE_DRAIN_ON: WTSSBX_MACHINE_DRAIN = WTSSBX_MACHINE_DRAIN(2i32);
impl ::core::convert::From<i32> for WTSSBX_MACHINE_DRAIN {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_MACHINE_DRAIN {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSSBX_MACHINE_INFO {
pub ClientConnectInfo: WTSSBX_MACHINE_CONNECT_INFO,
pub wczFarmName: [u16; 257],
pub InternalIPAddress: WTSSBX_IP_ADDRESS,
pub dwMaxSessionsLimit: u32,
pub ServerWeight: u32,
pub SingleSessionMode: WTSSBX_MACHINE_SESSION_MODE,
pub InDrain: WTSSBX_MACHINE_DRAIN,
pub MachineState: WTSSBX_MACHINE_STATE,
}
impl WTSSBX_MACHINE_INFO {}
impl ::core::default::Default for WTSSBX_MACHINE_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSSBX_MACHINE_INFO {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSSBX_MACHINE_INFO")
.field("ClientConnectInfo", &self.ClientConnectInfo)
.field("wczFarmName", &self.wczFarmName)
.field("InternalIPAddress", &self.InternalIPAddress)
.field("dwMaxSessionsLimit", &self.dwMaxSessionsLimit)
.field("ServerWeight", &self.ServerWeight)
.field("SingleSessionMode", &self.SingleSessionMode)
.field("InDrain", &self.InDrain)
.field("MachineState", &self.MachineState)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSSBX_MACHINE_INFO {
fn eq(&self, other: &Self) -> bool {
self.ClientConnectInfo == other.ClientConnectInfo && self.wczFarmName == other.wczFarmName && self.InternalIPAddress == other.InternalIPAddress && self.dwMaxSessionsLimit == other.dwMaxSessionsLimit && self.ServerWeight == other.ServerWeight && self.SingleSessionMode == other.SingleSessionMode && self.InDrain == other.InDrain && self.MachineState == other.MachineState
}
}
impl ::core::cmp::Eq for WTSSBX_MACHINE_INFO {}
unsafe impl ::windows::core::Abi for WTSSBX_MACHINE_INFO {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_MACHINE_SESSION_MODE(pub i32);
pub const WTSSBX_MACHINE_SESSION_MODE_UNSPEC: WTSSBX_MACHINE_SESSION_MODE = WTSSBX_MACHINE_SESSION_MODE(0i32);
pub const WTSSBX_MACHINE_SESSION_MODE_SINGLE: WTSSBX_MACHINE_SESSION_MODE = WTSSBX_MACHINE_SESSION_MODE(1i32);
pub const WTSSBX_MACHINE_SESSION_MODE_MULTIPLE: WTSSBX_MACHINE_SESSION_MODE = WTSSBX_MACHINE_SESSION_MODE(2i32);
impl ::core::convert::From<i32> for WTSSBX_MACHINE_SESSION_MODE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_MACHINE_SESSION_MODE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_MACHINE_STATE(pub i32);
pub const WTSSBX_MACHINE_STATE_UNSPEC: WTSSBX_MACHINE_STATE = WTSSBX_MACHINE_STATE(0i32);
pub const WTSSBX_MACHINE_STATE_READY: WTSSBX_MACHINE_STATE = WTSSBX_MACHINE_STATE(1i32);
pub const WTSSBX_MACHINE_STATE_SYNCHRONIZING: WTSSBX_MACHINE_STATE = WTSSBX_MACHINE_STATE(2i32);
impl ::core::convert::From<i32> for WTSSBX_MACHINE_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_MACHINE_STATE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_NOTIFICATION_TYPE(pub i32);
pub const WTSSBX_NOTIFICATION_REMOVED: WTSSBX_NOTIFICATION_TYPE = WTSSBX_NOTIFICATION_TYPE(1i32);
pub const WTSSBX_NOTIFICATION_CHANGED: WTSSBX_NOTIFICATION_TYPE = WTSSBX_NOTIFICATION_TYPE(2i32);
pub const WTSSBX_NOTIFICATION_ADDED: WTSSBX_NOTIFICATION_TYPE = WTSSBX_NOTIFICATION_TYPE(4i32);
pub const WTSSBX_NOTIFICATION_RESYNC: WTSSBX_NOTIFICATION_TYPE = WTSSBX_NOTIFICATION_TYPE(8i32);
impl ::core::convert::From<i32> for WTSSBX_NOTIFICATION_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_NOTIFICATION_TYPE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSSBX_SESSION_INFO {
pub wszUserName: [u16; 105],
pub wszDomainName: [u16; 257],
pub ApplicationType: [u16; 257],
pub dwSessionId: u32,
pub CreateTime: super::super::Foundation::FILETIME,
pub DisconnectTime: super::super::Foundation::FILETIME,
pub SessionState: WTSSBX_SESSION_STATE,
}
#[cfg(feature = "Win32_Foundation")]
impl WTSSBX_SESSION_INFO {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSSBX_SESSION_INFO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSSBX_SESSION_INFO {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSSBX_SESSION_INFO")
.field("wszUserName", &self.wszUserName)
.field("wszDomainName", &self.wszDomainName)
.field("ApplicationType", &self.ApplicationType)
.field("dwSessionId", &self.dwSessionId)
.field("CreateTime", &self.CreateTime)
.field("DisconnectTime", &self.DisconnectTime)
.field("SessionState", &self.SessionState)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSSBX_SESSION_INFO {
fn eq(&self, other: &Self) -> bool {
self.wszUserName == other.wszUserName && self.wszDomainName == other.wszDomainName && self.ApplicationType == other.ApplicationType && self.dwSessionId == other.dwSessionId && self.CreateTime == other.CreateTime && self.DisconnectTime == other.DisconnectTime && self.SessionState == other.SessionState
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSSBX_SESSION_INFO {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSSBX_SESSION_INFO {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTSSBX_SESSION_STATE(pub i32);
pub const WTSSBX_SESSION_STATE_UNSPEC: WTSSBX_SESSION_STATE = WTSSBX_SESSION_STATE(0i32);
pub const WTSSBX_SESSION_STATE_ACTIVE: WTSSBX_SESSION_STATE = WTSSBX_SESSION_STATE(1i32);
pub const WTSSBX_SESSION_STATE_DISCONNECTED: WTSSBX_SESSION_STATE = WTSSBX_SESSION_STATE(2i32);
impl ::core::convert::From<i32> for WTSSBX_SESSION_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTSSBX_SESSION_STATE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSSESSION_NOTIFICATION {
pub cbSize: u32,
pub dwSessionId: u32,
}
impl WTSSESSION_NOTIFICATION {}
impl ::core::default::Default for WTSSESSION_NOTIFICATION {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSSESSION_NOTIFICATION {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSSESSION_NOTIFICATION").field("cbSize", &self.cbSize).field("dwSessionId", &self.dwSessionId).finish()
}
}
impl ::core::cmp::PartialEq for WTSSESSION_NOTIFICATION {
fn eq(&self, other: &Self) -> bool {
self.cbSize == other.cbSize && self.dwSessionId == other.dwSessionId
}
}
impl ::core::cmp::Eq for WTSSESSION_NOTIFICATION {}
unsafe impl ::windows::core::Abi for WTSSESSION_NOTIFICATION {
type Abi = Self;
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
#[inline]
pub unsafe fn WTSSendMessageA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param9: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(
hserver: Param0,
sessionid: u32,
ptitle: Param2,
titlelength: u32,
pmessage: Param4,
messagelength: u32,
style: super::super::UI::WindowsAndMessaging::MESSAGEBOX_STYLE,
timeout: u32,
presponse: *mut super::super::UI::WindowsAndMessaging::MESSAGEBOX_RESULT,
bwait: Param9,
) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSendMessageA(hserver: super::super::Foundation::HANDLE, sessionid: u32, ptitle: super::super::Foundation::PSTR, titlelength: u32, pmessage: super::super::Foundation::PSTR, messagelength: u32, style: super::super::UI::WindowsAndMessaging::MESSAGEBOX_STYLE, timeout: u32, presponse: *mut super::super::UI::WindowsAndMessaging::MESSAGEBOX_RESULT, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSendMessageA(
hserver.into_param().abi(),
::core::mem::transmute(sessionid),
ptitle.into_param().abi(),
::core::mem::transmute(titlelength),
pmessage.into_param().abi(),
::core::mem::transmute(messagelength),
::core::mem::transmute(style),
::core::mem::transmute(timeout),
::core::mem::transmute(presponse),
bwait.into_param().abi(),
))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
#[inline]
pub unsafe fn WTSSendMessageW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param9: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(
hserver: Param0,
sessionid: u32,
ptitle: Param2,
titlelength: u32,
pmessage: Param4,
messagelength: u32,
style: super::super::UI::WindowsAndMessaging::MESSAGEBOX_STYLE,
timeout: u32,
presponse: *mut super::super::UI::WindowsAndMessaging::MESSAGEBOX_RESULT,
bwait: Param9,
) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSendMessageW(hserver: super::super::Foundation::HANDLE, sessionid: u32, ptitle: super::super::Foundation::PWSTR, titlelength: u32, pmessage: super::super::Foundation::PWSTR, messagelength: u32, style: super::super::UI::WindowsAndMessaging::MESSAGEBOX_STYLE, timeout: u32, presponse: *mut super::super::UI::WindowsAndMessaging::MESSAGEBOX_RESULT, bwait: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSendMessageW(
hserver.into_param().abi(),
::core::mem::transmute(sessionid),
ptitle.into_param().abi(),
::core::mem::transmute(titlelength),
pmessage.into_param().abi(),
::core::mem::transmute(messagelength),
::core::mem::transmute(style),
::core::mem::transmute(timeout),
::core::mem::transmute(presponse),
bwait.into_param().abi(),
))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security"))]
#[inline]
pub unsafe fn WTSSetListenerSecurityA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, securityinformation: u32, psecuritydescriptor: *const super::super::Security::SECURITY_DESCRIPTOR) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSetListenerSecurityA(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PSTR, securityinformation: u32, psecuritydescriptor: *const super::super::Security::SECURITY_DESCRIPTOR) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSetListenerSecurityA(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(securityinformation), ::core::mem::transmute(psecuritydescriptor)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security"))]
#[inline]
pub unsafe fn WTSSetListenerSecurityW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hserver: Param0, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: Param3, securityinformation: u32, psecuritydescriptor: *const super::super::Security::SECURITY_DESCRIPTOR) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSetListenerSecurityW(hserver: super::super::Foundation::HANDLE, preserved: *const ::core::ffi::c_void, reserved: u32, plistenername: super::super::Foundation::PWSTR, securityinformation: u32, psecuritydescriptor: *const super::super::Security::SECURITY_DESCRIPTOR) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSetListenerSecurityW(hserver.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(reserved), plistenername.into_param().abi(), ::core::mem::transmute(securityinformation), ::core::mem::transmute(psecuritydescriptor)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSSetRenderHint<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(prenderhintid: *mut u64, hwndowner: Param1, renderhinttype: u32, cbhintdatalength: u32, phintdata: *const u8) -> ::windows::core::Result<()> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSetRenderHint(prenderhintid: *mut u64, hwndowner: super::super::Foundation::HWND, renderhinttype: u32, cbhintdatalength: u32, phintdata: *const u8) -> ::windows::core::HRESULT;
}
WTSSetRenderHint(::core::mem::transmute(prenderhintid), hwndowner.into_param().abi(), ::core::mem::transmute(renderhinttype), ::core::mem::transmute(cbhintdatalength), ::core::mem::transmute(phintdata)).ok()
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSSetUserConfigA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pservername: Param0, pusername: Param1, wtsconfigclass: WTS_CONFIG_CLASS, pbuffer: Param3, datalength: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSetUserConfigA(pservername: super::super::Foundation::PSTR, pusername: super::super::Foundation::PSTR, wtsconfigclass: WTS_CONFIG_CLASS, pbuffer: super::super::Foundation::PSTR, datalength: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSetUserConfigA(pservername.into_param().abi(), pusername.into_param().abi(), ::core::mem::transmute(wtsconfigclass), pbuffer.into_param().abi(), ::core::mem::transmute(datalength)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSSetUserConfigW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pservername: Param0, pusername: Param1, wtsconfigclass: WTS_CONFIG_CLASS, pbuffer: Param3, datalength: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSSetUserConfigW(pservername: super::super::Foundation::PWSTR, pusername: super::super::Foundation::PWSTR, wtsconfigclass: WTS_CONFIG_CLASS, pbuffer: super::super::Foundation::PWSTR, datalength: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSSetUserConfigW(pservername.into_param().abi(), pusername.into_param().abi(), ::core::mem::transmute(wtsconfigclass), pbuffer.into_param().abi(), ::core::mem::transmute(datalength)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSShutdownSystem<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, shutdownflag: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSShutdownSystem(hserver: super::super::Foundation::HANDLE, shutdownflag: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSShutdownSystem(hserver.into_param().abi(), ::core::mem::transmute(shutdownflag)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSStartRemoteControlSessionA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(ptargetservername: Param0, targetlogonid: u32, hotkeyvk: u8, hotkeymodifiers: u16) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSStartRemoteControlSessionA(ptargetservername: super::super::Foundation::PSTR, targetlogonid: u32, hotkeyvk: u8, hotkeymodifiers: u16) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSStartRemoteControlSessionA(ptargetservername.into_param().abi(), ::core::mem::transmute(targetlogonid), ::core::mem::transmute(hotkeyvk), ::core::mem::transmute(hotkeymodifiers)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSStartRemoteControlSessionW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(ptargetservername: Param0, targetlogonid: u32, hotkeyvk: u8, hotkeymodifiers: u16) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSStartRemoteControlSessionW(ptargetservername: super::super::Foundation::PWSTR, targetlogonid: u32, hotkeyvk: u8, hotkeymodifiers: u16) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSStartRemoteControlSessionW(ptargetservername.into_param().abi(), ::core::mem::transmute(targetlogonid), ::core::mem::transmute(hotkeyvk), ::core::mem::transmute(hotkeymodifiers)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSStopRemoteControlSession(logonid: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSStopRemoteControlSession(logonid: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSStopRemoteControlSession(::core::mem::transmute(logonid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSTerminateProcess<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, processid: u32, exitcode: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSTerminateProcess(hserver: super::super::Foundation::HANDLE, processid: u32, exitcode: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSTerminateProcess(hserver.into_param().abi(), ::core::mem::transmute(processid), ::core::mem::transmute(exitcode)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTSUSERCONFIGA {
pub Source: u32,
pub InheritInitialProgram: u32,
pub AllowLogonTerminalServer: u32,
pub TimeoutSettingsConnections: u32,
pub TimeoutSettingsDisconnections: u32,
pub TimeoutSettingsIdle: u32,
pub DeviceClientDrives: u32,
pub DeviceClientPrinters: u32,
pub ClientDefaultPrinter: u32,
pub BrokenTimeoutSettings: u32,
pub ReconnectSettings: u32,
pub ShadowingSettings: u32,
pub TerminalServerRemoteHomeDir: u32,
pub InitialProgram: [super::super::Foundation::CHAR; 261],
pub WorkDirectory: [super::super::Foundation::CHAR; 261],
pub TerminalServerProfilePath: [super::super::Foundation::CHAR; 261],
pub TerminalServerHomeDir: [super::super::Foundation::CHAR; 261],
pub TerminalServerHomeDirDrive: [super::super::Foundation::CHAR; 4],
}
#[cfg(feature = "Win32_Foundation")]
impl WTSUSERCONFIGA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTSUSERCONFIGA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTSUSERCONFIGA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSUSERCONFIGA")
.field("Source", &self.Source)
.field("InheritInitialProgram", &self.InheritInitialProgram)
.field("AllowLogonTerminalServer", &self.AllowLogonTerminalServer)
.field("TimeoutSettingsConnections", &self.TimeoutSettingsConnections)
.field("TimeoutSettingsDisconnections", &self.TimeoutSettingsDisconnections)
.field("TimeoutSettingsIdle", &self.TimeoutSettingsIdle)
.field("DeviceClientDrives", &self.DeviceClientDrives)
.field("DeviceClientPrinters", &self.DeviceClientPrinters)
.field("ClientDefaultPrinter", &self.ClientDefaultPrinter)
.field("BrokenTimeoutSettings", &self.BrokenTimeoutSettings)
.field("ReconnectSettings", &self.ReconnectSettings)
.field("ShadowingSettings", &self.ShadowingSettings)
.field("TerminalServerRemoteHomeDir", &self.TerminalServerRemoteHomeDir)
.field("InitialProgram", &self.InitialProgram)
.field("WorkDirectory", &self.WorkDirectory)
.field("TerminalServerProfilePath", &self.TerminalServerProfilePath)
.field("TerminalServerHomeDir", &self.TerminalServerHomeDir)
.field("TerminalServerHomeDirDrive", &self.TerminalServerHomeDirDrive)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTSUSERCONFIGA {
fn eq(&self, other: &Self) -> bool {
self.Source == other.Source
&& self.InheritInitialProgram == other.InheritInitialProgram
&& self.AllowLogonTerminalServer == other.AllowLogonTerminalServer
&& self.TimeoutSettingsConnections == other.TimeoutSettingsConnections
&& self.TimeoutSettingsDisconnections == other.TimeoutSettingsDisconnections
&& self.TimeoutSettingsIdle == other.TimeoutSettingsIdle
&& self.DeviceClientDrives == other.DeviceClientDrives
&& self.DeviceClientPrinters == other.DeviceClientPrinters
&& self.ClientDefaultPrinter == other.ClientDefaultPrinter
&& self.BrokenTimeoutSettings == other.BrokenTimeoutSettings
&& self.ReconnectSettings == other.ReconnectSettings
&& self.ShadowingSettings == other.ShadowingSettings
&& self.TerminalServerRemoteHomeDir == other.TerminalServerRemoteHomeDir
&& self.InitialProgram == other.InitialProgram
&& self.WorkDirectory == other.WorkDirectory
&& self.TerminalServerProfilePath == other.TerminalServerProfilePath
&& self.TerminalServerHomeDir == other.TerminalServerHomeDir
&& self.TerminalServerHomeDirDrive == other.TerminalServerHomeDirDrive
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTSUSERCONFIGA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTSUSERCONFIGA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTSUSERCONFIGW {
pub Source: u32,
pub InheritInitialProgram: u32,
pub AllowLogonTerminalServer: u32,
pub TimeoutSettingsConnections: u32,
pub TimeoutSettingsDisconnections: u32,
pub TimeoutSettingsIdle: u32,
pub DeviceClientDrives: u32,
pub DeviceClientPrinters: u32,
pub ClientDefaultPrinter: u32,
pub BrokenTimeoutSettings: u32,
pub ReconnectSettings: u32,
pub ShadowingSettings: u32,
pub TerminalServerRemoteHomeDir: u32,
pub InitialProgram: [u16; 261],
pub WorkDirectory: [u16; 261],
pub TerminalServerProfilePath: [u16; 261],
pub TerminalServerHomeDir: [u16; 261],
pub TerminalServerHomeDirDrive: [u16; 4],
}
impl WTSUSERCONFIGW {}
impl ::core::default::Default for WTSUSERCONFIGW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTSUSERCONFIGW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTSUSERCONFIGW")
.field("Source", &self.Source)
.field("InheritInitialProgram", &self.InheritInitialProgram)
.field("AllowLogonTerminalServer", &self.AllowLogonTerminalServer)
.field("TimeoutSettingsConnections", &self.TimeoutSettingsConnections)
.field("TimeoutSettingsDisconnections", &self.TimeoutSettingsDisconnections)
.field("TimeoutSettingsIdle", &self.TimeoutSettingsIdle)
.field("DeviceClientDrives", &self.DeviceClientDrives)
.field("DeviceClientPrinters", &self.DeviceClientPrinters)
.field("ClientDefaultPrinter", &self.ClientDefaultPrinter)
.field("BrokenTimeoutSettings", &self.BrokenTimeoutSettings)
.field("ReconnectSettings", &self.ReconnectSettings)
.field("ShadowingSettings", &self.ShadowingSettings)
.field("TerminalServerRemoteHomeDir", &self.TerminalServerRemoteHomeDir)
.field("InitialProgram", &self.InitialProgram)
.field("WorkDirectory", &self.WorkDirectory)
.field("TerminalServerProfilePath", &self.TerminalServerProfilePath)
.field("TerminalServerHomeDir", &self.TerminalServerHomeDir)
.field("TerminalServerHomeDirDrive", &self.TerminalServerHomeDirDrive)
.finish()
}
}
impl ::core::cmp::PartialEq for WTSUSERCONFIGW {
fn eq(&self, other: &Self) -> bool {
self.Source == other.Source
&& self.InheritInitialProgram == other.InheritInitialProgram
&& self.AllowLogonTerminalServer == other.AllowLogonTerminalServer
&& self.TimeoutSettingsConnections == other.TimeoutSettingsConnections
&& self.TimeoutSettingsDisconnections == other.TimeoutSettingsDisconnections
&& self.TimeoutSettingsIdle == other.TimeoutSettingsIdle
&& self.DeviceClientDrives == other.DeviceClientDrives
&& self.DeviceClientPrinters == other.DeviceClientPrinters
&& self.ClientDefaultPrinter == other.ClientDefaultPrinter
&& self.BrokenTimeoutSettings == other.BrokenTimeoutSettings
&& self.ReconnectSettings == other.ReconnectSettings
&& self.ShadowingSettings == other.ShadowingSettings
&& self.TerminalServerRemoteHomeDir == other.TerminalServerRemoteHomeDir
&& self.InitialProgram == other.InitialProgram
&& self.WorkDirectory == other.WorkDirectory
&& self.TerminalServerProfilePath == other.TerminalServerProfilePath
&& self.TerminalServerHomeDir == other.TerminalServerHomeDir
&& self.TerminalServerHomeDirDrive == other.TerminalServerHomeDirDrive
}
}
impl ::core::cmp::Eq for WTSUSERCONFIGW {}
unsafe impl ::windows::core::Abi for WTSUSERCONFIGW {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSUnRegisterSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwnd: Param0) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSUnRegisterSessionNotification(hwnd: super::super::Foundation::HWND) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSUnRegisterSessionNotification(hwnd.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSUnRegisterSessionNotificationEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hserver: Param0, hwnd: Param1) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSUnRegisterSessionNotificationEx(hserver: super::super::Foundation::HANDLE, hwnd: super::super::Foundation::HWND) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSUnRegisterSessionNotificationEx(hserver.into_param().abi(), hwnd.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelClose<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hchannelhandle: Param0) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelClose(hchannelhandle: super::super::Foundation::HANDLE) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelClose(hchannelhandle.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelOpen<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hserver: Param0, sessionid: u32, pvirtualname: Param2) -> HwtsVirtualChannelHandle {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelOpen(hserver: super::super::Foundation::HANDLE, sessionid: u32, pvirtualname: super::super::Foundation::PSTR) -> HwtsVirtualChannelHandle;
}
::core::mem::transmute(WTSVirtualChannelOpen(hserver.into_param().abi(), ::core::mem::transmute(sessionid), pvirtualname.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelOpenEx<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(sessionid: u32, pvirtualname: Param1, flags: u32) -> HwtsVirtualChannelHandle {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelOpenEx(sessionid: u32, pvirtualname: super::super::Foundation::PSTR, flags: u32) -> HwtsVirtualChannelHandle;
}
::core::mem::transmute(WTSVirtualChannelOpenEx(::core::mem::transmute(sessionid), pvirtualname.into_param().abi(), ::core::mem::transmute(flags)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelPurgeInput<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hchannelhandle: Param0) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelPurgeInput(hchannelhandle: super::super::Foundation::HANDLE) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelPurgeInput(hchannelhandle.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelPurgeOutput<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hchannelhandle: Param0) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelPurgeOutput(hchannelhandle: super::super::Foundation::HANDLE) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelPurgeOutput(hchannelhandle.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelQuery<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hchannelhandle: Param0, param1: WTS_VIRTUAL_CLASS, ppbuffer: *mut *mut ::core::ffi::c_void, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelQuery(hchannelhandle: super::super::Foundation::HANDLE, param1: WTS_VIRTUAL_CLASS, ppbuffer: *mut *mut ::core::ffi::c_void, pbytesreturned: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelQuery(hchannelhandle.into_param().abi(), ::core::mem::transmute(param1), ::core::mem::transmute(ppbuffer), ::core::mem::transmute(pbytesreturned)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelRead<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hchannelhandle: Param0, timeout: u32, buffer: super::super::Foundation::PSTR, buffersize: u32, pbytesread: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelRead(hchannelhandle: super::super::Foundation::HANDLE, timeout: u32, buffer: super::super::Foundation::PSTR, buffersize: u32, pbytesread: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelRead(hchannelhandle.into_param().abi(), ::core::mem::transmute(timeout), ::core::mem::transmute(buffer), ::core::mem::transmute(buffersize), ::core::mem::transmute(pbytesread)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSVirtualChannelWrite<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hchannelhandle: Param0, buffer: Param1, length: u32, pbyteswritten: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSVirtualChannelWrite(hchannelhandle: super::super::Foundation::HANDLE, buffer: super::super::Foundation::PSTR, length: u32, pbyteswritten: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSVirtualChannelWrite(hchannelhandle.into_param().abi(), buffer.into_param().abi(), ::core::mem::transmute(length), ::core::mem::transmute(pbyteswritten)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn WTSWaitSystemEvent<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hserver: Param0, eventmask: u32, peventflags: *mut u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn WTSWaitSystemEvent(hserver: super::super::Foundation::HANDLE, eventmask: u32, peventflags: *mut u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(WTSWaitSystemEvent(hserver.into_param().abi(), ::core::mem::transmute(eventmask), ::core::mem::transmute(peventflags)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_CACHE_STATS {
pub Specific: u32,
pub Data: WTS_CACHE_STATS_UN,
pub ProtocolType: u16,
pub Length: u16,
}
impl WTS_CACHE_STATS {}
impl ::core::default::Default for WTS_CACHE_STATS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTS_CACHE_STATS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTS_CACHE_STATS {}
unsafe impl ::windows::core::Abi for WTS_CACHE_STATS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union WTS_CACHE_STATS_UN {
pub ProtocolCache: [WTS_PROTOCOL_CACHE; 4],
pub TShareCacheStats: u32,
pub Reserved: [u32; 20],
}
impl WTS_CACHE_STATS_UN {}
impl ::core::default::Default for WTS_CACHE_STATS_UN {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTS_CACHE_STATS_UN {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTS_CACHE_STATS_UN {}
unsafe impl ::windows::core::Abi for WTS_CACHE_STATS_UN {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_CERT_TYPE(pub i32);
pub const WTS_CERT_TYPE_INVALID: WTS_CERT_TYPE = WTS_CERT_TYPE(0i32);
pub const WTS_CERT_TYPE_PROPRIETORY: WTS_CERT_TYPE = WTS_CERT_TYPE(1i32);
pub const WTS_CERT_TYPE_X509: WTS_CERT_TYPE = WTS_CERT_TYPE(2i32);
impl ::core::convert::From<i32> for WTS_CERT_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_CERT_TYPE {
type Abi = Self;
}
pub const WTS_CHANNEL_OPTION_DYNAMIC: u32 = 1u32;
pub const WTS_CHANNEL_OPTION_DYNAMIC_NO_COMPRESS: u32 = 8u32;
pub const WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH: u32 = 4u32;
pub const WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW: u32 = 0u32;
pub const WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED: u32 = 2u32;
pub const WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL: u32 = 6u32;
pub const WTS_CLIENTADDRESS_LENGTH: u32 = 30u32;
pub const WTS_CLIENTNAME_LENGTH: u32 = 20u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_CLIENT_ADDRESS {
pub AddressFamily: u32,
pub Address: [u8; 20],
}
impl WTS_CLIENT_ADDRESS {}
impl ::core::default::Default for WTS_CLIENT_ADDRESS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_CLIENT_ADDRESS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_CLIENT_ADDRESS").field("AddressFamily", &self.AddressFamily).field("Address", &self.Address).finish()
}
}
impl ::core::cmp::PartialEq for WTS_CLIENT_ADDRESS {
fn eq(&self, other: &Self) -> bool {
self.AddressFamily == other.AddressFamily && self.Address == other.Address
}
}
impl ::core::cmp::Eq for WTS_CLIENT_ADDRESS {}
unsafe impl ::windows::core::Abi for WTS_CLIENT_ADDRESS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_CLIENT_DATA {
pub fDisableCtrlAltDel: super::super::Foundation::BOOLEAN,
pub fDoubleClickDetect: super::super::Foundation::BOOLEAN,
pub fEnableWindowsKey: super::super::Foundation::BOOLEAN,
pub fHideTitleBar: super::super::Foundation::BOOLEAN,
pub fInheritAutoLogon: super::super::Foundation::BOOL,
pub fPromptForPassword: super::super::Foundation::BOOLEAN,
pub fUsingSavedCreds: super::super::Foundation::BOOLEAN,
pub Domain: [u16; 256],
pub UserName: [u16; 256],
pub Password: [u16; 256],
pub fPasswordIsScPin: super::super::Foundation::BOOLEAN,
pub fInheritInitialProgram: super::super::Foundation::BOOL,
pub WorkDirectory: [u16; 257],
pub InitialProgram: [u16; 257],
pub fMaximizeShell: super::super::Foundation::BOOLEAN,
pub EncryptionLevel: u8,
pub PerformanceFlags: u32,
pub ProtocolName: [u16; 9],
pub ProtocolType: u16,
pub fInheritColorDepth: super::super::Foundation::BOOL,
pub HRes: u16,
pub VRes: u16,
pub ColorDepth: u16,
pub DisplayDriverName: [u16; 9],
pub DisplayDeviceName: [u16; 20],
pub fMouse: super::super::Foundation::BOOLEAN,
pub KeyboardLayout: u32,
pub KeyboardType: u32,
pub KeyboardSubType: u32,
pub KeyboardFunctionKey: u32,
pub imeFileName: [u16; 33],
pub ActiveInputLocale: u32,
pub fNoAudioPlayback: super::super::Foundation::BOOLEAN,
pub fRemoteConsoleAudio: super::super::Foundation::BOOLEAN,
pub AudioDriverName: [u16; 9],
pub ClientTimeZone: WTS_TIME_ZONE_INFORMATION,
pub ClientName: [u16; 21],
pub SerialNumber: u32,
pub ClientAddressFamily: u32,
pub ClientAddress: [u16; 31],
pub ClientSockAddress: WTS_SOCKADDR,
pub ClientDirectory: [u16; 257],
pub ClientBuildNumber: u32,
pub ClientProductId: u16,
pub OutBufCountHost: u16,
pub OutBufCountClient: u16,
pub OutBufLength: u16,
pub ClientSessionId: u32,
pub ClientDigProductId: [u16; 33],
pub fDisableCpm: super::super::Foundation::BOOLEAN,
pub fDisableCdm: super::super::Foundation::BOOLEAN,
pub fDisableCcm: super::super::Foundation::BOOLEAN,
pub fDisableLPT: super::super::Foundation::BOOLEAN,
pub fDisableClip: super::super::Foundation::BOOLEAN,
pub fDisablePNP: super::super::Foundation::BOOLEAN,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_CLIENT_DATA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_CLIENT_DATA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_CLIENT_DATA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_CLIENT_DATA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_CLIENT_DATA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_CLIENT_DISPLAY {
pub HorizontalResolution: u32,
pub VerticalResolution: u32,
pub ColorDepth: u32,
}
impl WTS_CLIENT_DISPLAY {}
impl ::core::default::Default for WTS_CLIENT_DISPLAY {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_CLIENT_DISPLAY {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_CLIENT_DISPLAY").field("HorizontalResolution", &self.HorizontalResolution).field("VerticalResolution", &self.VerticalResolution).field("ColorDepth", &self.ColorDepth).finish()
}
}
impl ::core::cmp::PartialEq for WTS_CLIENT_DISPLAY {
fn eq(&self, other: &Self) -> bool {
self.HorizontalResolution == other.HorizontalResolution && self.VerticalResolution == other.VerticalResolution && self.ColorDepth == other.ColorDepth
}
}
impl ::core::cmp::Eq for WTS_CLIENT_DISPLAY {}
unsafe impl ::windows::core::Abi for WTS_CLIENT_DISPLAY {
type Abi = Self;
}
pub const WTS_CLIENT_PRODUCT_ID_LENGTH: u32 = 32u32;
pub const WTS_COMMENT_LENGTH: u32 = 60u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_CONFIG_CLASS(pub i32);
pub const WTSUserConfigInitialProgram: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(0i32);
pub const WTSUserConfigWorkingDirectory: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(1i32);
pub const WTSUserConfigfInheritInitialProgram: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(2i32);
pub const WTSUserConfigfAllowLogonTerminalServer: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(3i32);
pub const WTSUserConfigTimeoutSettingsConnections: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(4i32);
pub const WTSUserConfigTimeoutSettingsDisconnections: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(5i32);
pub const WTSUserConfigTimeoutSettingsIdle: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(6i32);
pub const WTSUserConfigfDeviceClientDrives: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(7i32);
pub const WTSUserConfigfDeviceClientPrinters: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(8i32);
pub const WTSUserConfigfDeviceClientDefaultPrinter: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(9i32);
pub const WTSUserConfigBrokenTimeoutSettings: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(10i32);
pub const WTSUserConfigReconnectSettings: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(11i32);
pub const WTSUserConfigModemCallbackSettings: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(12i32);
pub const WTSUserConfigModemCallbackPhoneNumber: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(13i32);
pub const WTSUserConfigShadowingSettings: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(14i32);
pub const WTSUserConfigTerminalServerProfilePath: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(15i32);
pub const WTSUserConfigTerminalServerHomeDir: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(16i32);
pub const WTSUserConfigTerminalServerHomeDirDrive: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(17i32);
pub const WTSUserConfigfTerminalServerRemoteHomeDir: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(18i32);
pub const WTSUserConfigUser: WTS_CONFIG_CLASS = WTS_CONFIG_CLASS(19i32);
impl ::core::convert::From<i32> for WTS_CONFIG_CLASS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_CONFIG_CLASS {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_CONFIG_SOURCE(pub i32);
pub const WTSUserConfigSourceSAM: WTS_CONFIG_SOURCE = WTS_CONFIG_SOURCE(0i32);
impl ::core::convert::From<i32> for WTS_CONFIG_SOURCE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_CONFIG_SOURCE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_CONNECTSTATE_CLASS(pub i32);
pub const WTSActive: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(0i32);
pub const WTSConnected: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(1i32);
pub const WTSConnectQuery: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(2i32);
pub const WTSShadow: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(3i32);
pub const WTSDisconnected: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(4i32);
pub const WTSIdle: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(5i32);
pub const WTSListen: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(6i32);
pub const WTSReset: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(7i32);
pub const WTSDown: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(8i32);
pub const WTSInit: WTS_CONNECTSTATE_CLASS = WTS_CONNECTSTATE_CLASS(9i32);
impl ::core::convert::From<i32> for WTS_CONNECTSTATE_CLASS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_CONNECTSTATE_CLASS {
type Abi = Self;
}
pub const WTS_CURRENT_SESSION: u32 = 4294967295u32;
pub const WTS_DEVICE_NAME_LENGTH: u32 = 19u32;
pub const WTS_DIRECTORY_LENGTH: u32 = 256u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_DISPLAY_IOCTL {
pub pDisplayIOCtlData: [u8; 256],
pub cbDisplayIOCtlData: u32,
}
impl WTS_DISPLAY_IOCTL {}
impl ::core::default::Default for WTS_DISPLAY_IOCTL {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_DISPLAY_IOCTL {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_DISPLAY_IOCTL").field("pDisplayIOCtlData", &self.pDisplayIOCtlData).field("cbDisplayIOCtlData", &self.cbDisplayIOCtlData).finish()
}
}
impl ::core::cmp::PartialEq for WTS_DISPLAY_IOCTL {
fn eq(&self, other: &Self) -> bool {
self.pDisplayIOCtlData == other.pDisplayIOCtlData && self.cbDisplayIOCtlData == other.cbDisplayIOCtlData
}
}
impl ::core::cmp::Eq for WTS_DISPLAY_IOCTL {}
unsafe impl ::windows::core::Abi for WTS_DISPLAY_IOCTL {
type Abi = Self;
}
pub const WTS_DOMAIN_LENGTH: u32 = 255u32;
pub const WTS_DRIVER_NAME_LENGTH: u32 = 8u32;
pub const WTS_DRIVE_LENGTH: u32 = 3u32;
pub const WTS_EVENT_ALL: u32 = 2147483647u32;
pub const WTS_EVENT_CONNECT: u32 = 8u32;
pub const WTS_EVENT_CREATE: u32 = 1u32;
pub const WTS_EVENT_DELETE: u32 = 2u32;
pub const WTS_EVENT_DISCONNECT: u32 = 16u32;
pub const WTS_EVENT_FLUSH: u32 = 2147483648u32;
pub const WTS_EVENT_LICENSE: u32 = 256u32;
pub const WTS_EVENT_LOGOFF: u32 = 64u32;
pub const WTS_EVENT_LOGON: u32 = 32u32;
pub const WTS_EVENT_NONE: u32 = 0u32;
pub const WTS_EVENT_RENAME: u32 = 4u32;
pub const WTS_EVENT_STATECHANGE: u32 = 128u32;
pub const WTS_IMEFILENAME_LENGTH: u32 = 32u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_INFO_CLASS(pub i32);
pub const WTSInitialProgram: WTS_INFO_CLASS = WTS_INFO_CLASS(0i32);
pub const WTSApplicationName: WTS_INFO_CLASS = WTS_INFO_CLASS(1i32);
pub const WTSWorkingDirectory: WTS_INFO_CLASS = WTS_INFO_CLASS(2i32);
pub const WTSOEMId: WTS_INFO_CLASS = WTS_INFO_CLASS(3i32);
pub const WTSSessionId: WTS_INFO_CLASS = WTS_INFO_CLASS(4i32);
pub const WTSUserName: WTS_INFO_CLASS = WTS_INFO_CLASS(5i32);
pub const WTSWinStationName: WTS_INFO_CLASS = WTS_INFO_CLASS(6i32);
pub const WTSDomainName: WTS_INFO_CLASS = WTS_INFO_CLASS(7i32);
pub const WTSConnectState: WTS_INFO_CLASS = WTS_INFO_CLASS(8i32);
pub const WTSClientBuildNumber: WTS_INFO_CLASS = WTS_INFO_CLASS(9i32);
pub const WTSClientName: WTS_INFO_CLASS = WTS_INFO_CLASS(10i32);
pub const WTSClientDirectory: WTS_INFO_CLASS = WTS_INFO_CLASS(11i32);
pub const WTSClientProductId: WTS_INFO_CLASS = WTS_INFO_CLASS(12i32);
pub const WTSClientHardwareId: WTS_INFO_CLASS = WTS_INFO_CLASS(13i32);
pub const WTSClientAddress: WTS_INFO_CLASS = WTS_INFO_CLASS(14i32);
pub const WTSClientDisplay: WTS_INFO_CLASS = WTS_INFO_CLASS(15i32);
pub const WTSClientProtocolType: WTS_INFO_CLASS = WTS_INFO_CLASS(16i32);
pub const WTSIdleTime: WTS_INFO_CLASS = WTS_INFO_CLASS(17i32);
pub const WTSLogonTime: WTS_INFO_CLASS = WTS_INFO_CLASS(18i32);
pub const WTSIncomingBytes: WTS_INFO_CLASS = WTS_INFO_CLASS(19i32);
pub const WTSOutgoingBytes: WTS_INFO_CLASS = WTS_INFO_CLASS(20i32);
pub const WTSIncomingFrames: WTS_INFO_CLASS = WTS_INFO_CLASS(21i32);
pub const WTSOutgoingFrames: WTS_INFO_CLASS = WTS_INFO_CLASS(22i32);
pub const WTSClientInfo: WTS_INFO_CLASS = WTS_INFO_CLASS(23i32);
pub const WTSSessionInfo: WTS_INFO_CLASS = WTS_INFO_CLASS(24i32);
pub const WTSSessionInfoEx: WTS_INFO_CLASS = WTS_INFO_CLASS(25i32);
pub const WTSConfigInfo: WTS_INFO_CLASS = WTS_INFO_CLASS(26i32);
pub const WTSValidationInfo: WTS_INFO_CLASS = WTS_INFO_CLASS(27i32);
pub const WTSSessionAddressV4: WTS_INFO_CLASS = WTS_INFO_CLASS(28i32);
pub const WTSIsRemoteSession: WTS_INFO_CLASS = WTS_INFO_CLASS(29i32);
impl ::core::convert::From<i32> for WTS_INFO_CLASS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_INFO_CLASS {
type Abi = Self;
}
pub const WTS_INITIALPROGRAM_LENGTH: u32 = 256u32;
pub const WTS_KEY_EXCHANGE_ALG_DH: u32 = 2u32;
pub const WTS_KEY_EXCHANGE_ALG_RSA: u32 = 1u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_LICENSE_CAPABILITIES {
pub KeyExchangeAlg: u32,
pub ProtocolVer: u32,
pub fAuthenticateServer: super::super::Foundation::BOOL,
pub CertType: WTS_CERT_TYPE,
pub cbClientName: u32,
pub rgbClientName: [u8; 42],
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_LICENSE_CAPABILITIES {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_LICENSE_CAPABILITIES {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_LICENSE_CAPABILITIES {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_LICENSE_CAPABILITIES")
.field("KeyExchangeAlg", &self.KeyExchangeAlg)
.field("ProtocolVer", &self.ProtocolVer)
.field("fAuthenticateServer", &self.fAuthenticateServer)
.field("CertType", &self.CertType)
.field("cbClientName", &self.cbClientName)
.field("rgbClientName", &self.rgbClientName)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_LICENSE_CAPABILITIES {
fn eq(&self, other: &Self) -> bool {
self.KeyExchangeAlg == other.KeyExchangeAlg && self.ProtocolVer == other.ProtocolVer && self.fAuthenticateServer == other.fAuthenticateServer && self.CertType == other.CertType && self.cbClientName == other.cbClientName && self.rgbClientName == other.rgbClientName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_LICENSE_CAPABILITIES {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_LICENSE_CAPABILITIES {
type Abi = Self;
}
pub const WTS_LICENSE_PREAMBLE_VERSION: u32 = 3u32;
pub const WTS_LICENSE_PROTOCOL_VERSION: u32 = 65536u32;
pub const WTS_LISTENER_CREATE: u32 = 1u32;
pub const WTS_LISTENER_NAME_LENGTH: u32 = 32u32;
pub const WTS_LISTENER_UPDATE: u32 = 16u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(pub i32);
pub const WTS_LOGON_ERR_INVALID: WTS_LOGON_ERROR_REDIRECTOR_RESPONSE = WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(0i32);
pub const WTS_LOGON_ERR_NOT_HANDLED: WTS_LOGON_ERROR_REDIRECTOR_RESPONSE = WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(1i32);
pub const WTS_LOGON_ERR_HANDLED_SHOW: WTS_LOGON_ERROR_REDIRECTOR_RESPONSE = WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(2i32);
pub const WTS_LOGON_ERR_HANDLED_DONT_SHOW: WTS_LOGON_ERROR_REDIRECTOR_RESPONSE = WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(3i32);
pub const WTS_LOGON_ERR_HANDLED_DONT_SHOW_START_OVER: WTS_LOGON_ERROR_REDIRECTOR_RESPONSE = WTS_LOGON_ERROR_REDIRECTOR_RESPONSE(4i32);
impl ::core::convert::From<i32> for WTS_LOGON_ERROR_REDIRECTOR_RESPONSE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_LOGON_ERROR_REDIRECTOR_RESPONSE {
type Abi = Self;
}
pub const WTS_MAX_CACHE_RESERVED: u32 = 20u32;
pub const WTS_MAX_COUNTERS: u32 = 100u32;
pub const WTS_MAX_DISPLAY_IOCTL_DATA: u32 = 256u32;
pub const WTS_MAX_PROTOCOL_CACHE: u32 = 4u32;
pub const WTS_MAX_RESERVED: u32 = 100u32;
pub const WTS_PASSWORD_LENGTH: u32 = 255u32;
pub const WTS_PERF_DISABLE_CURSORSETTINGS: u32 = 64u32;
pub const WTS_PERF_DISABLE_CURSOR_SHADOW: u32 = 32u32;
pub const WTS_PERF_DISABLE_FULLWINDOWDRAG: u32 = 2u32;
pub const WTS_PERF_DISABLE_MENUANIMATIONS: u32 = 4u32;
pub const WTS_PERF_DISABLE_NOTHING: u32 = 0u32;
pub const WTS_PERF_DISABLE_THEMING: u32 = 8u32;
pub const WTS_PERF_DISABLE_WALLPAPER: u32 = 1u32;
pub const WTS_PERF_ENABLE_DESKTOP_COMPOSITION: u32 = 256u32;
pub const WTS_PERF_ENABLE_ENHANCED_GRAPHICS: u32 = 16u32;
pub const WTS_PERF_ENABLE_FONT_SMOOTHING: u32 = 128u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_POLICY_DATA {
pub fDisableEncryption: super::super::Foundation::BOOLEAN,
pub fDisableAutoReconnect: super::super::Foundation::BOOLEAN,
pub ColorDepth: u32,
pub MinEncryptionLevel: u8,
pub fDisableCpm: super::super::Foundation::BOOLEAN,
pub fDisableCdm: super::super::Foundation::BOOLEAN,
pub fDisableCcm: super::super::Foundation::BOOLEAN,
pub fDisableLPT: super::super::Foundation::BOOLEAN,
pub fDisableClip: super::super::Foundation::BOOLEAN,
pub fDisablePNPRedir: super::super::Foundation::BOOLEAN,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_POLICY_DATA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_POLICY_DATA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_POLICY_DATA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_POLICY_DATA")
.field("fDisableEncryption", &self.fDisableEncryption)
.field("fDisableAutoReconnect", &self.fDisableAutoReconnect)
.field("ColorDepth", &self.ColorDepth)
.field("MinEncryptionLevel", &self.MinEncryptionLevel)
.field("fDisableCpm", &self.fDisableCpm)
.field("fDisableCdm", &self.fDisableCdm)
.field("fDisableCcm", &self.fDisableCcm)
.field("fDisableLPT", &self.fDisableLPT)
.field("fDisableClip", &self.fDisableClip)
.field("fDisablePNPRedir", &self.fDisablePNPRedir)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_POLICY_DATA {
fn eq(&self, other: &Self) -> bool {
self.fDisableEncryption == other.fDisableEncryption && self.fDisableAutoReconnect == other.fDisableAutoReconnect && self.ColorDepth == other.ColorDepth && self.MinEncryptionLevel == other.MinEncryptionLevel && self.fDisableCpm == other.fDisableCpm && self.fDisableCdm == other.fDisableCdm && self.fDisableCcm == other.fDisableCcm && self.fDisableLPT == other.fDisableLPT && self.fDisableClip == other.fDisableClip && self.fDisablePNPRedir == other.fDisablePNPRedir
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_POLICY_DATA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_POLICY_DATA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROCESS_INFOA {
pub SessionId: u32,
pub ProcessId: u32,
pub pProcessName: super::super::Foundation::PSTR,
pub pUserSid: super::super::Foundation::PSID,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROCESS_INFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROCESS_INFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROCESS_INFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROCESS_INFOA").field("SessionId", &self.SessionId).field("ProcessId", &self.ProcessId).field("pProcessName", &self.pProcessName).field("pUserSid", &self.pUserSid).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROCESS_INFOA {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId && self.ProcessId == other.ProcessId && self.pProcessName == other.pProcessName && self.pUserSid == other.pUserSid
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROCESS_INFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROCESS_INFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROCESS_INFOW {
pub SessionId: u32,
pub ProcessId: u32,
pub pProcessName: super::super::Foundation::PWSTR,
pub pUserSid: super::super::Foundation::PSID,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROCESS_INFOW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROCESS_INFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROCESS_INFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROCESS_INFOW").field("SessionId", &self.SessionId).field("ProcessId", &self.ProcessId).field("pProcessName", &self.pProcessName).field("pUserSid", &self.pUserSid).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROCESS_INFOW {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId && self.ProcessId == other.ProcessId && self.pProcessName == other.pProcessName && self.pUserSid == other.pUserSid
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROCESS_INFOW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROCESS_INFOW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROCESS_INFO_EXA {
pub SessionId: u32,
pub ProcessId: u32,
pub pProcessName: super::super::Foundation::PSTR,
pub pUserSid: super::super::Foundation::PSID,
pub NumberOfThreads: u32,
pub HandleCount: u32,
pub PagefileUsage: u32,
pub PeakPagefileUsage: u32,
pub WorkingSetSize: u32,
pub PeakWorkingSetSize: u32,
pub UserTime: i64,
pub KernelTime: i64,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROCESS_INFO_EXA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROCESS_INFO_EXA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROCESS_INFO_EXA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROCESS_INFO_EXA")
.field("SessionId", &self.SessionId)
.field("ProcessId", &self.ProcessId)
.field("pProcessName", &self.pProcessName)
.field("pUserSid", &self.pUserSid)
.field("NumberOfThreads", &self.NumberOfThreads)
.field("HandleCount", &self.HandleCount)
.field("PagefileUsage", &self.PagefileUsage)
.field("PeakPagefileUsage", &self.PeakPagefileUsage)
.field("WorkingSetSize", &self.WorkingSetSize)
.field("PeakWorkingSetSize", &self.PeakWorkingSetSize)
.field("UserTime", &self.UserTime)
.field("KernelTime", &self.KernelTime)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROCESS_INFO_EXA {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId
&& self.ProcessId == other.ProcessId
&& self.pProcessName == other.pProcessName
&& self.pUserSid == other.pUserSid
&& self.NumberOfThreads == other.NumberOfThreads
&& self.HandleCount == other.HandleCount
&& self.PagefileUsage == other.PagefileUsage
&& self.PeakPagefileUsage == other.PeakPagefileUsage
&& self.WorkingSetSize == other.WorkingSetSize
&& self.PeakWorkingSetSize == other.PeakWorkingSetSize
&& self.UserTime == other.UserTime
&& self.KernelTime == other.KernelTime
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROCESS_INFO_EXA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROCESS_INFO_EXA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROCESS_INFO_EXW {
pub SessionId: u32,
pub ProcessId: u32,
pub pProcessName: super::super::Foundation::PWSTR,
pub pUserSid: super::super::Foundation::PSID,
pub NumberOfThreads: u32,
pub HandleCount: u32,
pub PagefileUsage: u32,
pub PeakPagefileUsage: u32,
pub WorkingSetSize: u32,
pub PeakWorkingSetSize: u32,
pub UserTime: i64,
pub KernelTime: i64,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROCESS_INFO_EXW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROCESS_INFO_EXW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROCESS_INFO_EXW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROCESS_INFO_EXW")
.field("SessionId", &self.SessionId)
.field("ProcessId", &self.ProcessId)
.field("pProcessName", &self.pProcessName)
.field("pUserSid", &self.pUserSid)
.field("NumberOfThreads", &self.NumberOfThreads)
.field("HandleCount", &self.HandleCount)
.field("PagefileUsage", &self.PagefileUsage)
.field("PeakPagefileUsage", &self.PeakPagefileUsage)
.field("WorkingSetSize", &self.WorkingSetSize)
.field("PeakWorkingSetSize", &self.PeakWorkingSetSize)
.field("UserTime", &self.UserTime)
.field("KernelTime", &self.KernelTime)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROCESS_INFO_EXW {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId
&& self.ProcessId == other.ProcessId
&& self.pProcessName == other.pProcessName
&& self.pUserSid == other.pUserSid
&& self.NumberOfThreads == other.NumberOfThreads
&& self.HandleCount == other.HandleCount
&& self.PagefileUsage == other.PagefileUsage
&& self.PeakPagefileUsage == other.PeakPagefileUsage
&& self.WorkingSetSize == other.WorkingSetSize
&& self.PeakWorkingSetSize == other.PeakWorkingSetSize
&& self.UserTime == other.UserTime
&& self.KernelTime == other.KernelTime
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROCESS_INFO_EXW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROCESS_INFO_EXW {
type Abi = Self;
}
pub const WTS_PROCESS_INFO_LEVEL_0: u32 = 0u32;
pub const WTS_PROCESS_INFO_LEVEL_1: u32 = 1u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROPERTY_VALUE {
pub Type: u16,
pub u: WTS_PROPERTY_VALUE_0,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROPERTY_VALUE {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROPERTY_VALUE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROPERTY_VALUE {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROPERTY_VALUE {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROPERTY_VALUE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub union WTS_PROPERTY_VALUE_0 {
pub ulVal: u32,
pub strVal: WTS_PROPERTY_VALUE_0_1,
pub bVal: WTS_PROPERTY_VALUE_0_0,
pub guidVal: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROPERTY_VALUE_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROPERTY_VALUE_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROPERTY_VALUE_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROPERTY_VALUE_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROPERTY_VALUE_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROPERTY_VALUE_0_0 {
pub size: u32,
pub pbVal: super::super::Foundation::PSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROPERTY_VALUE_0_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROPERTY_VALUE_0_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROPERTY_VALUE_0_0 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_bVal_e__Struct").field("size", &self.size).field("pbVal", &self.pbVal).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROPERTY_VALUE_0_0 {
fn eq(&self, other: &Self) -> bool {
self.size == other.size && self.pbVal == other.pbVal
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROPERTY_VALUE_0_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROPERTY_VALUE_0_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_PROPERTY_VALUE_0_1 {
pub size: u32,
pub pstrVal: super::super::Foundation::PWSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_PROPERTY_VALUE_0_1 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_PROPERTY_VALUE_0_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_PROPERTY_VALUE_0_1 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_strVal_e__Struct").field("size", &self.size).field("pstrVal", &self.pstrVal).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_PROPERTY_VALUE_0_1 {
fn eq(&self, other: &Self) -> bool {
self.size == other.size && self.pstrVal == other.pstrVal
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_PROPERTY_VALUE_0_1 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_PROPERTY_VALUE_0_1 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_PROTOCOL_CACHE {
pub CacheReads: u32,
pub CacheHits: u32,
}
impl WTS_PROTOCOL_CACHE {}
impl ::core::default::Default for WTS_PROTOCOL_CACHE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_PROTOCOL_CACHE {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROTOCOL_CACHE").field("CacheReads", &self.CacheReads).field("CacheHits", &self.CacheHits).finish()
}
}
impl ::core::cmp::PartialEq for WTS_PROTOCOL_CACHE {
fn eq(&self, other: &Self) -> bool {
self.CacheReads == other.CacheReads && self.CacheHits == other.CacheHits
}
}
impl ::core::cmp::Eq for WTS_PROTOCOL_CACHE {}
unsafe impl ::windows::core::Abi for WTS_PROTOCOL_CACHE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_PROTOCOL_COUNTERS {
pub WdBytes: u32,
pub WdFrames: u32,
pub WaitForOutBuf: u32,
pub Frames: u32,
pub Bytes: u32,
pub CompressedBytes: u32,
pub CompressFlushes: u32,
pub Errors: u32,
pub Timeouts: u32,
pub AsyncFramingError: u32,
pub AsyncOverrunError: u32,
pub AsyncOverflowError: u32,
pub AsyncParityError: u32,
pub TdErrors: u32,
pub ProtocolType: u16,
pub Length: u16,
pub Specific: u16,
pub Reserved: [u32; 100],
}
impl WTS_PROTOCOL_COUNTERS {}
impl ::core::default::Default for WTS_PROTOCOL_COUNTERS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_PROTOCOL_COUNTERS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_PROTOCOL_COUNTERS")
.field("WdBytes", &self.WdBytes)
.field("WdFrames", &self.WdFrames)
.field("WaitForOutBuf", &self.WaitForOutBuf)
.field("Frames", &self.Frames)
.field("Bytes", &self.Bytes)
.field("CompressedBytes", &self.CompressedBytes)
.field("CompressFlushes", &self.CompressFlushes)
.field("Errors", &self.Errors)
.field("Timeouts", &self.Timeouts)
.field("AsyncFramingError", &self.AsyncFramingError)
.field("AsyncOverrunError", &self.AsyncOverrunError)
.field("AsyncOverflowError", &self.AsyncOverflowError)
.field("AsyncParityError", &self.AsyncParityError)
.field("TdErrors", &self.TdErrors)
.field("ProtocolType", &self.ProtocolType)
.field("Length", &self.Length)
.field("Specific", &self.Specific)
.field("Reserved", &self.Reserved)
.finish()
}
}
impl ::core::cmp::PartialEq for WTS_PROTOCOL_COUNTERS {
fn eq(&self, other: &Self) -> bool {
self.WdBytes == other.WdBytes
&& self.WdFrames == other.WdFrames
&& self.WaitForOutBuf == other.WaitForOutBuf
&& self.Frames == other.Frames
&& self.Bytes == other.Bytes
&& self.CompressedBytes == other.CompressedBytes
&& self.CompressFlushes == other.CompressFlushes
&& self.Errors == other.Errors
&& self.Timeouts == other.Timeouts
&& self.AsyncFramingError == other.AsyncFramingError
&& self.AsyncOverrunError == other.AsyncOverrunError
&& self.AsyncOverflowError == other.AsyncOverflowError
&& self.AsyncParityError == other.AsyncParityError
&& self.TdErrors == other.TdErrors
&& self.ProtocolType == other.ProtocolType
&& self.Length == other.Length
&& self.Specific == other.Specific
&& self.Reserved == other.Reserved
}
}
impl ::core::cmp::Eq for WTS_PROTOCOL_COUNTERS {}
unsafe impl ::windows::core::Abi for WTS_PROTOCOL_COUNTERS {
type Abi = Self;
}
pub const WTS_PROTOCOL_NAME_LENGTH: u32 = 8u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_PROTOCOL_STATUS {
pub Output: WTS_PROTOCOL_COUNTERS,
pub Input: WTS_PROTOCOL_COUNTERS,
pub Cache: WTS_CACHE_STATS,
pub AsyncSignal: u32,
pub AsyncSignalMask: u32,
pub Counters: [i64; 100],
}
impl WTS_PROTOCOL_STATUS {}
impl ::core::default::Default for WTS_PROTOCOL_STATUS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTS_PROTOCOL_STATUS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTS_PROTOCOL_STATUS {}
unsafe impl ::windows::core::Abi for WTS_PROTOCOL_STATUS {
type Abi = Self;
}
pub const WTS_PROTOCOL_TYPE_CONSOLE: u32 = 0u32;
pub const WTS_PROTOCOL_TYPE_ICA: u32 = 1u32;
pub const WTS_PROTOCOL_TYPE_RDP: u32 = 2u32;
pub const WTS_QUERY_ALLOWED_INITIAL_APP: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc77d1b30_5be1_4c6b_a0e1_bd6d2e5c9fcc);
pub const WTS_QUERY_AUDIOENUM_DLL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9bf4fa97_c883_4c2a_80ab_5a39c9af00db);
pub const WTS_QUERY_LOGON_SCREEN_SIZE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8b8e0fe7_0804_4a0e_b279_8660b1df0049);
pub const WTS_QUERY_MF_FORMAT_SUPPORT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x41869ad0_6332_4dc8_95d5_db749e2f1d94);
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_RCM_DRAIN_STATE(pub i32);
pub const WTS_DRAIN_STATE_NONE: WTS_RCM_DRAIN_STATE = WTS_RCM_DRAIN_STATE(0i32);
pub const WTS_DRAIN_IN_DRAIN: WTS_RCM_DRAIN_STATE = WTS_RCM_DRAIN_STATE(1i32);
pub const WTS_DRAIN_NOT_IN_DRAIN: WTS_RCM_DRAIN_STATE = WTS_RCM_DRAIN_STATE(2i32);
impl ::core::convert::From<i32> for WTS_RCM_DRAIN_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_RCM_DRAIN_STATE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_RCM_SERVICE_STATE(pub i32);
pub const WTS_SERVICE_NONE: WTS_RCM_SERVICE_STATE = WTS_RCM_SERVICE_STATE(0i32);
pub const WTS_SERVICE_START: WTS_RCM_SERVICE_STATE = WTS_RCM_SERVICE_STATE(1i32);
pub const WTS_SERVICE_STOP: WTS_RCM_SERVICE_STATE = WTS_RCM_SERVICE_STATE(2i32);
impl ::core::convert::From<i32> for WTS_RCM_SERVICE_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_RCM_SERVICE_STATE {
type Abi = Self;
}
pub const WTS_SECURITY_CONNECT: u32 = 256u32;
pub const WTS_SECURITY_DISCONNECT: u32 = 512u32;
pub const WTS_SECURITY_GUEST_ACCESS: u32 = 32u32;
pub const WTS_SECURITY_LOGOFF: u32 = 64u32;
pub const WTS_SECURITY_LOGON: u32 = 32u32;
pub const WTS_SECURITY_MESSAGE: u32 = 128u32;
pub const WTS_SECURITY_QUERY_INFORMATION: u32 = 1u32;
pub const WTS_SECURITY_REMOTE_CONTROL: u32 = 16u32;
pub const WTS_SECURITY_RESET: u32 = 4u32;
pub const WTS_SECURITY_SET_INFORMATION: u32 = 2u32;
pub const WTS_SECURITY_VIRTUAL_CHANNELS: u32 = 8u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SERVER_INFOA {
pub pServerName: super::super::Foundation::PSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SERVER_INFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SERVER_INFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SERVER_INFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SERVER_INFOA").field("pServerName", &self.pServerName).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SERVER_INFOA {
fn eq(&self, other: &Self) -> bool {
self.pServerName == other.pServerName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SERVER_INFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SERVER_INFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SERVER_INFOW {
pub pServerName: super::super::Foundation::PWSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SERVER_INFOW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SERVER_INFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SERVER_INFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SERVER_INFOW").field("pServerName", &self.pServerName).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SERVER_INFOW {
fn eq(&self, other: &Self) -> bool {
self.pServerName == other.pServerName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SERVER_INFOW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SERVER_INFOW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SERVICE_STATE {
pub RcmServiceState: WTS_RCM_SERVICE_STATE,
pub RcmDrainState: WTS_RCM_DRAIN_STATE,
}
impl WTS_SERVICE_STATE {}
impl ::core::default::Default for WTS_SERVICE_STATE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SERVICE_STATE {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SERVICE_STATE").field("RcmServiceState", &self.RcmServiceState).field("RcmDrainState", &self.RcmDrainState).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SERVICE_STATE {
fn eq(&self, other: &Self) -> bool {
self.RcmServiceState == other.RcmServiceState && self.RcmDrainState == other.RcmDrainState
}
}
impl ::core::cmp::Eq for WTS_SERVICE_STATE {}
unsafe impl ::windows::core::Abi for WTS_SERVICE_STATE {
type Abi = Self;
}
pub const WTS_SESSIONSTATE_LOCK: u32 = 0u32;
pub const WTS_SESSIONSTATE_UNKNOWN: u32 = 4294967295u32;
pub const WTS_SESSIONSTATE_UNLOCK: u32 = 1u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SESSION_ADDRESS {
pub AddressFamily: u32,
pub Address: [u8; 20],
}
impl WTS_SESSION_ADDRESS {}
impl ::core::default::Default for WTS_SESSION_ADDRESS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SESSION_ADDRESS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_ADDRESS").field("AddressFamily", &self.AddressFamily).field("Address", &self.Address).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SESSION_ADDRESS {
fn eq(&self, other: &Self) -> bool {
self.AddressFamily == other.AddressFamily && self.Address == other.Address
}
}
impl ::core::cmp::Eq for WTS_SESSION_ADDRESS {}
unsafe impl ::windows::core::Abi for WTS_SESSION_ADDRESS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SESSION_ID {
pub SessionUniqueGuid: ::windows::core::GUID,
pub SessionId: u32,
}
impl WTS_SESSION_ID {}
impl ::core::default::Default for WTS_SESSION_ID {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SESSION_ID {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_ID").field("SessionUniqueGuid", &self.SessionUniqueGuid).field("SessionId", &self.SessionId).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SESSION_ID {
fn eq(&self, other: &Self) -> bool {
self.SessionUniqueGuid == other.SessionUniqueGuid && self.SessionId == other.SessionId
}
}
impl ::core::cmp::Eq for WTS_SESSION_ID {}
unsafe impl ::windows::core::Abi for WTS_SESSION_ID {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SESSION_INFOA {
pub SessionId: u32,
pub pWinStationName: super::super::Foundation::PSTR,
pub State: WTS_CONNECTSTATE_CLASS,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SESSION_INFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SESSION_INFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SESSION_INFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_INFOA").field("SessionId", &self.SessionId).field("pWinStationName", &self.pWinStationName).field("State", &self.State).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SESSION_INFOA {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId && self.pWinStationName == other.pWinStationName && self.State == other.State
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SESSION_INFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SESSION_INFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SESSION_INFOW {
pub SessionId: u32,
pub pWinStationName: super::super::Foundation::PWSTR,
pub State: WTS_CONNECTSTATE_CLASS,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SESSION_INFOW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SESSION_INFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SESSION_INFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_INFOW").field("SessionId", &self.SessionId).field("pWinStationName", &self.pWinStationName).field("State", &self.State).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SESSION_INFOW {
fn eq(&self, other: &Self) -> bool {
self.SessionId == other.SessionId && self.pWinStationName == other.pWinStationName && self.State == other.State
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SESSION_INFOW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SESSION_INFOW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SESSION_INFO_1A {
pub ExecEnvId: u32,
pub State: WTS_CONNECTSTATE_CLASS,
pub SessionId: u32,
pub pSessionName: super::super::Foundation::PSTR,
pub pHostName: super::super::Foundation::PSTR,
pub pUserName: super::super::Foundation::PSTR,
pub pDomainName: super::super::Foundation::PSTR,
pub pFarmName: super::super::Foundation::PSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SESSION_INFO_1A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SESSION_INFO_1A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SESSION_INFO_1A {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_INFO_1A")
.field("ExecEnvId", &self.ExecEnvId)
.field("State", &self.State)
.field("SessionId", &self.SessionId)
.field("pSessionName", &self.pSessionName)
.field("pHostName", &self.pHostName)
.field("pUserName", &self.pUserName)
.field("pDomainName", &self.pDomainName)
.field("pFarmName", &self.pFarmName)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SESSION_INFO_1A {
fn eq(&self, other: &Self) -> bool {
self.ExecEnvId == other.ExecEnvId && self.State == other.State && self.SessionId == other.SessionId && self.pSessionName == other.pSessionName && self.pHostName == other.pHostName && self.pUserName == other.pUserName && self.pDomainName == other.pDomainName && self.pFarmName == other.pFarmName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SESSION_INFO_1A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SESSION_INFO_1A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_SESSION_INFO_1W {
pub ExecEnvId: u32,
pub State: WTS_CONNECTSTATE_CLASS,
pub SessionId: u32,
pub pSessionName: super::super::Foundation::PWSTR,
pub pHostName: super::super::Foundation::PWSTR,
pub pUserName: super::super::Foundation::PWSTR,
pub pDomainName: super::super::Foundation::PWSTR,
pub pFarmName: super::super::Foundation::PWSTR,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_SESSION_INFO_1W {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_SESSION_INFO_1W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_SESSION_INFO_1W {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SESSION_INFO_1W")
.field("ExecEnvId", &self.ExecEnvId)
.field("State", &self.State)
.field("SessionId", &self.SessionId)
.field("pSessionName", &self.pSessionName)
.field("pHostName", &self.pHostName)
.field("pUserName", &self.pUserName)
.field("pDomainName", &self.pDomainName)
.field("pFarmName", &self.pFarmName)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_SESSION_INFO_1W {
fn eq(&self, other: &Self) -> bool {
self.ExecEnvId == other.ExecEnvId && self.State == other.State && self.SessionId == other.SessionId && self.pSessionName == other.pSessionName && self.pHostName == other.pHostName && self.pUserName == other.pUserName && self.pDomainName == other.pDomainName && self.pFarmName == other.pFarmName
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_SESSION_INFO_1W {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_SESSION_INFO_1W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SMALL_RECT {
pub Left: i16,
pub Top: i16,
pub Right: i16,
pub Bottom: i16,
}
impl WTS_SMALL_RECT {}
impl ::core::default::Default for WTS_SMALL_RECT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SMALL_RECT {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SMALL_RECT").field("Left", &self.Left).field("Top", &self.Top).field("Right", &self.Right).field("Bottom", &self.Bottom).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SMALL_RECT {
fn eq(&self, other: &Self) -> bool {
self.Left == other.Left && self.Top == other.Top && self.Right == other.Right && self.Bottom == other.Bottom
}
}
impl ::core::cmp::Eq for WTS_SMALL_RECT {}
unsafe impl ::windows::core::Abi for WTS_SMALL_RECT {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SOCKADDR {
pub sin_family: u16,
pub u: WTS_SOCKADDR_0,
}
impl WTS_SOCKADDR {}
impl ::core::default::Default for WTS_SOCKADDR {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTS_SOCKADDR {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTS_SOCKADDR {}
unsafe impl ::windows::core::Abi for WTS_SOCKADDR {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union WTS_SOCKADDR_0 {
pub ipv4: WTS_SOCKADDR_0_0,
pub ipv6: WTS_SOCKADDR_0_1,
}
impl WTS_SOCKADDR_0 {}
impl ::core::default::Default for WTS_SOCKADDR_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WTS_SOCKADDR_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WTS_SOCKADDR_0 {}
unsafe impl ::windows::core::Abi for WTS_SOCKADDR_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SOCKADDR_0_0 {
pub sin_port: u16,
pub IN_ADDR: u32,
pub sin_zero: [u8; 8],
}
impl WTS_SOCKADDR_0_0 {}
impl ::core::default::Default for WTS_SOCKADDR_0_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SOCKADDR_0_0 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_ipv4_e__Struct").field("sin_port", &self.sin_port).field("IN_ADDR", &self.IN_ADDR).field("sin_zero", &self.sin_zero).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SOCKADDR_0_0 {
fn eq(&self, other: &Self) -> bool {
self.sin_port == other.sin_port && self.IN_ADDR == other.IN_ADDR && self.sin_zero == other.sin_zero
}
}
impl ::core::cmp::Eq for WTS_SOCKADDR_0_0 {}
unsafe impl ::windows::core::Abi for WTS_SOCKADDR_0_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SOCKADDR_0_1 {
pub sin6_port: u16,
pub sin6_flowinfo: u32,
pub sin6_addr: [u16; 8],
pub sin6_scope_id: u32,
}
impl WTS_SOCKADDR_0_1 {}
impl ::core::default::Default for WTS_SOCKADDR_0_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SOCKADDR_0_1 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_ipv6_e__Struct").field("sin6_port", &self.sin6_port).field("sin6_flowinfo", &self.sin6_flowinfo).field("sin6_addr", &self.sin6_addr).field("sin6_scope_id", &self.sin6_scope_id).finish()
}
}
impl ::core::cmp::PartialEq for WTS_SOCKADDR_0_1 {
fn eq(&self, other: &Self) -> bool {
self.sin6_port == other.sin6_port && self.sin6_flowinfo == other.sin6_flowinfo && self.sin6_addr == other.sin6_addr && self.sin6_scope_id == other.sin6_scope_id
}
}
impl ::core::cmp::Eq for WTS_SOCKADDR_0_1 {}
unsafe impl ::windows::core::Abi for WTS_SOCKADDR_0_1 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_SYSTEMTIME {
pub wYear: u16,
pub wMonth: u16,
pub wDayOfWeek: u16,
pub wDay: u16,
pub wHour: u16,
pub wMinute: u16,
pub wSecond: u16,
pub wMilliseconds: u16,
}
impl WTS_SYSTEMTIME {}
impl ::core::default::Default for WTS_SYSTEMTIME {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_SYSTEMTIME {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_SYSTEMTIME")
.field("wYear", &self.wYear)
.field("wMonth", &self.wMonth)
.field("wDayOfWeek", &self.wDayOfWeek)
.field("wDay", &self.wDay)
.field("wHour", &self.wHour)
.field("wMinute", &self.wMinute)
.field("wSecond", &self.wSecond)
.field("wMilliseconds", &self.wMilliseconds)
.finish()
}
}
impl ::core::cmp::PartialEq for WTS_SYSTEMTIME {
fn eq(&self, other: &Self) -> bool {
self.wYear == other.wYear && self.wMonth == other.wMonth && self.wDayOfWeek == other.wDayOfWeek && self.wDay == other.wDay && self.wHour == other.wHour && self.wMinute == other.wMinute && self.wSecond == other.wSecond && self.wMilliseconds == other.wMilliseconds
}
}
impl ::core::cmp::Eq for WTS_SYSTEMTIME {}
unsafe impl ::windows::core::Abi for WTS_SYSTEMTIME {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_TIME_ZONE_INFORMATION {
pub Bias: i32,
pub StandardName: [u16; 32],
pub StandardDate: WTS_SYSTEMTIME,
pub StandardBias: i32,
pub DaylightName: [u16; 32],
pub DaylightDate: WTS_SYSTEMTIME,
pub DaylightBias: i32,
}
impl WTS_TIME_ZONE_INFORMATION {}
impl ::core::default::Default for WTS_TIME_ZONE_INFORMATION {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_TIME_ZONE_INFORMATION {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_TIME_ZONE_INFORMATION")
.field("Bias", &self.Bias)
.field("StandardName", &self.StandardName)
.field("StandardDate", &self.StandardDate)
.field("StandardBias", &self.StandardBias)
.field("DaylightName", &self.DaylightName)
.field("DaylightDate", &self.DaylightDate)
.field("DaylightBias", &self.DaylightBias)
.finish()
}
}
impl ::core::cmp::PartialEq for WTS_TIME_ZONE_INFORMATION {
fn eq(&self, other: &Self) -> bool {
self.Bias == other.Bias && self.StandardName == other.StandardName && self.StandardDate == other.StandardDate && self.StandardBias == other.StandardBias && self.DaylightName == other.DaylightName && self.DaylightDate == other.DaylightDate && self.DaylightBias == other.DaylightBias
}
}
impl ::core::cmp::Eq for WTS_TIME_ZONE_INFORMATION {}
unsafe impl ::windows::core::Abi for WTS_TIME_ZONE_INFORMATION {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_TYPE_CLASS(pub i32);
pub const WTSTypeProcessInfoLevel0: WTS_TYPE_CLASS = WTS_TYPE_CLASS(0i32);
pub const WTSTypeProcessInfoLevel1: WTS_TYPE_CLASS = WTS_TYPE_CLASS(1i32);
pub const WTSTypeSessionInfoLevel1: WTS_TYPE_CLASS = WTS_TYPE_CLASS(2i32);
impl ::core::convert::From<i32> for WTS_TYPE_CLASS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_TYPE_CLASS {
type Abi = Self;
}
pub const WTS_USERNAME_LENGTH: u32 = 255u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_USER_CREDENTIAL {
pub UserName: [u16; 256],
pub Password: [u16; 256],
pub Domain: [u16; 256],
}
impl WTS_USER_CREDENTIAL {}
impl ::core::default::Default for WTS_USER_CREDENTIAL {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_USER_CREDENTIAL {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_USER_CREDENTIAL").field("UserName", &self.UserName).field("Password", &self.Password).field("Domain", &self.Domain).finish()
}
}
impl ::core::cmp::PartialEq for WTS_USER_CREDENTIAL {
fn eq(&self, other: &Self) -> bool {
self.UserName == other.UserName && self.Password == other.Password && self.Domain == other.Domain
}
}
impl ::core::cmp::Eq for WTS_USER_CREDENTIAL {}
unsafe impl ::windows::core::Abi for WTS_USER_CREDENTIAL {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_USER_DATA {
pub WorkDirectory: [u16; 257],
pub InitialProgram: [u16; 257],
pub UserTimeZone: WTS_TIME_ZONE_INFORMATION,
}
impl WTS_USER_DATA {}
impl ::core::default::Default for WTS_USER_DATA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_USER_DATA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_USER_DATA").field("WorkDirectory", &self.WorkDirectory).field("InitialProgram", &self.InitialProgram).field("UserTimeZone", &self.UserTimeZone).finish()
}
}
impl ::core::cmp::PartialEq for WTS_USER_DATA {
fn eq(&self, other: &Self) -> bool {
self.WorkDirectory == other.WorkDirectory && self.InitialProgram == other.InitialProgram && self.UserTimeZone == other.UserTimeZone
}
}
impl ::core::cmp::Eq for WTS_USER_DATA {}
unsafe impl ::windows::core::Abi for WTS_USER_DATA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct WTS_VALIDATION_INFORMATIONA {
pub ProductInfo: _WTS_PRODUCT_INFOA,
pub License: [u8; 16384],
pub LicenseLength: u32,
pub HardwareID: [u8; 20],
pub HardwareIDLength: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl WTS_VALIDATION_INFORMATIONA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WTS_VALIDATION_INFORMATIONA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for WTS_VALIDATION_INFORMATIONA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_VALIDATION_INFORMATIONA").field("ProductInfo", &self.ProductInfo).field("License", &self.License).field("LicenseLength", &self.LicenseLength).field("HardwareID", &self.HardwareID).field("HardwareIDLength", &self.HardwareIDLength).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WTS_VALIDATION_INFORMATIONA {
fn eq(&self, other: &Self) -> bool {
self.ProductInfo == other.ProductInfo && self.License == other.License && self.LicenseLength == other.LicenseLength && self.HardwareID == other.HardwareID && self.HardwareIDLength == other.HardwareIDLength
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WTS_VALIDATION_INFORMATIONA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WTS_VALIDATION_INFORMATIONA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct WTS_VALIDATION_INFORMATIONW {
pub ProductInfo: _WTS_PRODUCT_INFOW,
pub License: [u8; 16384],
pub LicenseLength: u32,
pub HardwareID: [u8; 20],
pub HardwareIDLength: u32,
}
impl WTS_VALIDATION_INFORMATIONW {}
impl ::core::default::Default for WTS_VALIDATION_INFORMATIONW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for WTS_VALIDATION_INFORMATIONW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("WTS_VALIDATION_INFORMATIONW").field("ProductInfo", &self.ProductInfo).field("License", &self.License).field("LicenseLength", &self.LicenseLength).field("HardwareID", &self.HardwareID).field("HardwareIDLength", &self.HardwareIDLength).finish()
}
}
impl ::core::cmp::PartialEq for WTS_VALIDATION_INFORMATIONW {
fn eq(&self, other: &Self) -> bool {
self.ProductInfo == other.ProductInfo && self.License == other.License && self.LicenseLength == other.LicenseLength && self.HardwareID == other.HardwareID && self.HardwareIDLength == other.HardwareIDLength
}
}
impl ::core::cmp::Eq for WTS_VALIDATION_INFORMATIONW {}
unsafe impl ::windows::core::Abi for WTS_VALIDATION_INFORMATIONW {
type Abi = Self;
}
pub const WTS_VALUE_TYPE_BINARY: u32 = 3u32;
pub const WTS_VALUE_TYPE_GUID: u32 = 4u32;
pub const WTS_VALUE_TYPE_STRING: u32 = 2u32;
pub const WTS_VALUE_TYPE_ULONG: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct WTS_VIRTUAL_CLASS(pub i32);
pub const WTSVirtualClientData: WTS_VIRTUAL_CLASS = WTS_VIRTUAL_CLASS(0i32);
pub const WTSVirtualFileHandle: WTS_VIRTUAL_CLASS = WTS_VIRTUAL_CLASS(1i32);
impl ::core::convert::From<i32> for WTS_VIRTUAL_CLASS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for WTS_VIRTUAL_CLASS {
type Abi = Self;
}
pub const WTS_WSD_FASTREBOOT: u32 = 16u32;
pub const WTS_WSD_LOGOFF: u32 = 1u32;
pub const WTS_WSD_POWEROFF: u32 = 8u32;
pub const WTS_WSD_REBOOT: u32 = 4u32;
pub const WTS_WSD_SHUTDOWN: u32 = 2u32;
pub const Workspace: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f1dfca6_3aad_48e1_8406_4bc21a501d7c);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct _ITSWkspEvents(pub ::windows::core::IUnknown);
impl _ITSWkspEvents {}
unsafe impl ::windows::core::Interface for _ITSWkspEvents {
type Vtable = _ITSWkspEvents_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb922bbb8_4c55_4fea_8496_beb0b44285e9);
}
impl ::core::convert::From<_ITSWkspEvents> for ::windows::core::IUnknown {
fn from(value: _ITSWkspEvents) -> Self {
value.0
}
}
impl ::core::convert::From<&_ITSWkspEvents> for ::windows::core::IUnknown {
fn from(value: &_ITSWkspEvents) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for _ITSWkspEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a _ITSWkspEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<_ITSWkspEvents> for super::Com::IDispatch {
fn from(value: _ITSWkspEvents) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
#[cfg(feature = "Win32_System_Com")]
impl ::core::convert::From<&_ITSWkspEvents> for super::Com::IDispatch {
fn from(value: &_ITSWkspEvents) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for _ITSWkspEvents {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
#[cfg(feature = "Win32_System_Com")]
impl<'a> ::windows::core::IntoParam<'a, super::Com::IDispatch> for &_ITSWkspEvents {
fn into_param(self) -> ::windows::core::Param<'a, super::Com::IDispatch> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct _ITSWkspEvents_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pctinfo: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itinfo: u32, lcid: u32, pptinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_System_Com"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, rgsznames: *const super::super::Foundation::PWSTR, cnames: u32, lcid: u32, rgdispid: *mut i32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dispidmember: i32, riid: *const ::windows::core::GUID, lcid: u32, wflags: u16, pdispparams: *const super::Com::DISPPARAMS, pvarresult: *mut ::core::mem::ManuallyDrop<super::Com::VARIANT>, pexcepinfo: *mut ::core::mem::ManuallyDrop<super::Com::EXCEPINFO>, puargerr: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Ole")))] usize,
);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct _WTS_PRODUCT_INFOA {
pub CompanyName: [super::super::Foundation::CHAR; 256],
pub ProductID: [super::super::Foundation::CHAR; 4],
}
#[cfg(feature = "Win32_Foundation")]
impl _WTS_PRODUCT_INFOA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for _WTS_PRODUCT_INFOA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for _WTS_PRODUCT_INFOA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_WTS_PRODUCT_INFOA").field("CompanyName", &self.CompanyName).field("ProductID", &self.ProductID).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for _WTS_PRODUCT_INFOA {
fn eq(&self, other: &Self) -> bool {
self.CompanyName == other.CompanyName && self.ProductID == other.ProductID
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for _WTS_PRODUCT_INFOA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for _WTS_PRODUCT_INFOA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct _WTS_PRODUCT_INFOW {
pub CompanyName: [u16; 256],
pub ProductID: [u16; 4],
}
impl _WTS_PRODUCT_INFOW {}
impl ::core::default::Default for _WTS_PRODUCT_INFOW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for _WTS_PRODUCT_INFOW {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("_WTS_PRODUCT_INFOW").field("CompanyName", &self.CompanyName).field("ProductID", &self.ProductID).finish()
}
}
impl ::core::cmp::PartialEq for _WTS_PRODUCT_INFOW {
fn eq(&self, other: &Self) -> bool {
self.CompanyName == other.CompanyName && self.ProductID == other.ProductID
}
}
impl ::core::cmp::Eq for _WTS_PRODUCT_INFOW {}
unsafe impl ::windows::core::Abi for _WTS_PRODUCT_INFOW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct pluginResource {
pub alias: [u16; 256],
pub name: [u16; 256],
pub resourceFileContents: super::super::Foundation::PWSTR,
pub fileExtension: [u16; 256],
pub resourcePluginType: [u16; 256],
pub isDiscoverable: u8,
pub resourceType: i32,
pub pceIconSize: u32,
pub iconContents: *mut u8,
pub pcePluginBlobSize: u32,
pub blobContents: *mut u8,
}
#[cfg(feature = "Win32_Foundation")]
impl pluginResource {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for pluginResource {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for pluginResource {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("pluginResource")
.field("alias", &self.alias)
.field("name", &self.name)
.field("resourceFileContents", &self.resourceFileContents)
.field("fileExtension", &self.fileExtension)
.field("resourcePluginType", &self.resourcePluginType)
.field("isDiscoverable", &self.isDiscoverable)
.field("resourceType", &self.resourceType)
.field("pceIconSize", &self.pceIconSize)
.field("iconContents", &self.iconContents)
.field("pcePluginBlobSize", &self.pcePluginBlobSize)
.field("blobContents", &self.blobContents)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for pluginResource {
fn eq(&self, other: &Self) -> bool {
self.alias == other.alias && self.name == other.name && self.resourceFileContents == other.resourceFileContents && self.fileExtension == other.fileExtension && self.resourcePluginType == other.resourcePluginType && self.isDiscoverable == other.isDiscoverable && self.resourceType == other.resourceType && self.pceIconSize == other.pceIconSize && self.iconContents == other.iconContents && self.pcePluginBlobSize == other.pcePluginBlobSize && self.blobContents == other.blobContents
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for pluginResource {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for pluginResource {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct pluginResource2 {
pub resourceV1: pluginResource,
pub pceFileAssocListSize: u32,
pub fileAssocList: *mut pluginResource2FileAssociation,
pub securityDescriptor: super::super::Foundation::PWSTR,
pub pceFolderListSize: u32,
pub folderList: *mut *mut u16,
}
#[cfg(feature = "Win32_Foundation")]
impl pluginResource2 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for pluginResource2 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for pluginResource2 {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("pluginResource2")
.field("resourceV1", &self.resourceV1)
.field("pceFileAssocListSize", &self.pceFileAssocListSize)
.field("fileAssocList", &self.fileAssocList)
.field("securityDescriptor", &self.securityDescriptor)
.field("pceFolderListSize", &self.pceFolderListSize)
.field("folderList", &self.folderList)
.finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for pluginResource2 {
fn eq(&self, other: &Self) -> bool {
self.resourceV1 == other.resourceV1 && self.pceFileAssocListSize == other.pceFileAssocListSize && self.fileAssocList == other.fileAssocList && self.securityDescriptor == other.securityDescriptor && self.pceFolderListSize == other.pceFolderListSize && self.folderList == other.folderList
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for pluginResource2 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for pluginResource2 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct pluginResource2FileAssociation {
pub extName: [u16; 256],
pub primaryHandler: u8,
pub pceIconSize: u32,
pub iconContents: *mut u8,
}
impl pluginResource2FileAssociation {}
impl ::core::default::Default for pluginResource2FileAssociation {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for pluginResource2FileAssociation {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("pluginResource2FileAssociation").field("extName", &self.extName).field("primaryHandler", &self.primaryHandler).field("pceIconSize", &self.pceIconSize).field("iconContents", &self.iconContents).finish()
}
}
impl ::core::cmp::PartialEq for pluginResource2FileAssociation {
fn eq(&self, other: &Self) -> bool {
self.extName == other.extName && self.primaryHandler == other.primaryHandler && self.pceIconSize == other.pceIconSize && self.iconContents == other.iconContents
}
}
impl ::core::cmp::Eq for pluginResource2FileAssociation {}
unsafe impl ::windows::core::Abi for pluginResource2FileAssociation {
type Abi = Self;
}
|
use sea_schema::migration::prelude::*;
pub struct Migration;
impl MigrationName for Migration {
fn name(&self) -> &str {
"m20220424_000004_create_payments_table"
}
}
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let _res = manager
.create_table(
Table::create()
.table(Payment::Table)
.if_not_exists()
.col(
ColumnDef::new(Payment::Id)
.string()
.not_null()
.primary_key(),
)
.col(ColumnDef::new(Payment::CreatedAt).big_integer().not_null())
.col(ColumnDef::new(Payment::UpdatedAt).big_integer().not_null())
.col(ColumnDef::new(Payment::NodeId).string().not_null())
.col(ColumnDef::new(Payment::ReceivedByNodeId).string())
.col(ColumnDef::new(Payment::CreatedByNodeId).string().not_null())
.col(ColumnDef::new(Payment::PaymentHash).string().not_null())
.col(ColumnDef::new(Payment::Preimage).string())
.col(ColumnDef::new(Payment::Secret).string())
.col(ColumnDef::new(Payment::Status).string().not_null())
.col(ColumnDef::new(Payment::Origin).string().not_null())
.col(ColumnDef::new(Payment::AmtMsat).big_integer())
.col(ColumnDef::new(Payment::FeePaidMsat).big_integer())
.col(ColumnDef::new(Payment::Label).string())
.col(ColumnDef::new(Payment::Invoice).text())
.to_owned(),
)
.await;
manager
.create_index(
Index::create()
.table(Payment::Table)
.name("idx-nodeid-paymenthash")
.col(Payment::NodeId)
.col(Payment::PaymentHash)
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let mut stmt = Table::drop();
stmt.table(Payment::Table);
manager.drop_table(stmt).await
}
}
#[derive(Iden)]
enum Payment {
Table,
Id,
NodeId,
ReceivedByNodeId,
CreatedByNodeId,
PaymentHash,
Preimage,
Secret,
Status,
Origin,
AmtMsat,
FeePaidMsat,
CreatedAt,
UpdatedAt,
Label,
Invoice,
}
|
use std::thread;
use std::sync::mpsc::{channel,sync_channel};
use std::os::unix::net::{UnixListener};
use std::io::{BufReader,BufWriter};
use std::path::Path;
use crate::control::{Request,Response,Config,Manifest,ManagementInterface,ManagementTicket,Status,LastResult};
pub fn start_server(socket_path: &Path) -> ManagementInterface {
let (request_sender, request_receiver) = sync_channel(0);
if socket_path.exists() {
// Could probably check to make sure this is actually a unix domain
// socket before deleting it.
std::fs::remove_file(socket_path).expect("Unable to delete the existing file at the management socket path");
}
let listener = UnixListener::bind(socket_path).unwrap();
eprintln!("Management server listening on socket: {}", socket_path.display());
thread::spawn(move || {
for handler in listener.incoming() {
match handler {
Ok(stream) => {
let request_sender = request_sender.clone();
thread::spawn(move || {
let mut request_reader = BufReader::new(&stream);
let mut response_writer = BufWriter::new(&stream);
loop {
match serde_json::from_reader(&mut request_reader as &mut dyn std::io::Read) {
Ok(request) => {
let (response_sender, response_receiver) = channel();
let ticket = ManagementTicket::new(request, response_sender);
request_sender.send(ticket).expect("Could not send management ticket");
let response = response_receiver.recv().expect("Did not receive management response");
serde_json::to_writer(&mut response_writer as &mut dyn std::io::Write, &response).unwrap();
},
Err(e) => {
if let serde_json::error::Category::Eof = e.classify() {
break;
} else {
panic!("Management socket deserialization error: {:?}", e);
}
},
}
}
});
},
Err(e) => {
panic!("Server socket error {:?}\n", e);
},
}
}
});
ManagementInterface::new(Some(request_receiver))
}
pub fn task_loop(config: &Config, management_interface: &ManagementInterface, initial_manifest: Option<Manifest>) {
let mut last_result: Option<LastResult> = None;
let run = |manifest| {
eprintln!("Starting backup");
let result = crate::copier::run(config, &manifest, management_interface);
if let Err(e) = result {
eprintln!("Backup failed: {:?}", e);
}
Some(LastResult {
manifest,
time: std::time::SystemTime::now(),
result,
})
};
if let Some(manifest) = initial_manifest {
last_result = run(manifest);
}
loop {
let ticket = management_interface.get_ticket_blocking();
match ticket.request.clone() {
Request::Start(manifest) => {
ticket.respond(Response::Start(Ok(())));
last_result = run(manifest.clone());
},
Request::Cancel => {
ticket.respond(Response::Cancel(Err(String::from("There is currently no running backup to cancel"))));
},
Request::Pause => {
ticket.respond(Response::Pause(Err(String::from("There is currently no running backup to pause"))));
},
Request::Resume => {
ticket.respond(Response::Resume(Err(String::from("There is currently no running backup to resume"))));
},
Request::Query(_) => {
let status =
match &last_result {
Some(last_result) => {
Status::Ended(last_result.clone())
},
None => {
Status::Waiting
},
};
ticket.respond(Response::Query(status));
},
}
}
}
|
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_create_cell(
input: &crate::input::CreateCellInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_create_cell_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_cross_account_authorization(
input: &crate::input::CreateCrossAccountAuthorizationInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_create_cross_account_authorization_input(
&mut object,
input,
);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_readiness_check(
input: &crate::input::CreateReadinessCheckInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_create_readiness_check_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_recovery_group(
input: &crate::input::CreateRecoveryGroupInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_create_recovery_group_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_resource_set(
input: &crate::input::CreateResourceSetInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_create_resource_set_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_tag_resource(
input: &crate::input::TagResourceInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_tag_resource_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_update_cell(
input: &crate::input::UpdateCellInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_update_cell_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_update_readiness_check(
input: &crate::input::UpdateReadinessCheckInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_update_readiness_check_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_update_recovery_group(
input: &crate::input::UpdateRecoveryGroupInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_update_recovery_group_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_update_resource_set(
input: &crate::input::UpdateResourceSetInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::json_ser::serialize_structure_update_resource_set_input(&mut object, input);
object.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
|
use std::fs::File;
use std::io::Read;
use std::collections::HashMap;
fn get_orbiting<'a>(obj: &str, orbits: &'a Vec<(String, String)>) -> &'a String {
&orbits.iter().find(|&orbit| orbit.1 == *obj).unwrap().0
}
fn calculate_orbits(obj: &String, orbits: &Vec<(String, String)>, num_orbits: &mut HashMap<String, u64>) -> u64 {
if obj == "COM" {
return 0;
}
if let Some(num) = num_orbits.get(obj) {
return *num;
}
// Find object it's orbiting
let orbiting = get_orbiting(obj, orbits);
// Current object is one orbit away from the object it's orbiting
let obj_orbits = calculate_orbits(orbiting, orbits, num_orbits) + 1;
num_orbits.insert(obj.clone(), obj_orbits);
obj_orbits
}
fn list_systems(obj: &str, orbits: &Vec<(String, String)>) -> Vec<String> {
let mut vec = Vec::new();
if obj == "COM" {
vec.push("COM".to_string());
return vec;
}
for orbit in orbits {
if orbit.1 == obj {
vec.push(obj.to_string());
vec.extend(list_systems(&orbit.0, orbits));
return vec;
}
}
panic!("Object {} not found orbiting anything", obj);
}
pub fn run_puzzle() {
let mut file = File::open("input_day6.txt").expect("Failed to open input_day6.txt");
let mut ops_string = String::new();
file.read_to_string(&mut ops_string).unwrap();
let mut orbits: Vec<(String, String)> = Vec::new();
let lines = ops_string.lines();
for line in lines {
let elements: Vec<&str> = line.split(')').collect();
orbits.push((elements[0].to_string(), elements[1].to_string()));
}
let mut num_orbits: HashMap<String, u64> = HashMap::new();
for orbit in &orbits {
calculate_orbits(&orbit.1, &orbits, &mut num_orbits);
}
let you_orbiting = get_orbiting("YOU", &orbits);
let san_orbiting = get_orbiting("SAN", &orbits);
let you_systems = list_systems(&you_orbiting, &orbits);
let san_systems = list_systems(&san_orbiting, &orbits);
for sys in &you_systems {
if let Some(common) = san_systems.iter().find(|&dasys| *dasys == *sys) {
let distance_you = *num_orbits.get(you_orbiting).unwrap();
let distance_san = *num_orbits.get(san_orbiting).unwrap();
let distance_common = *num_orbits.get(common).unwrap();
let distance = (distance_you - distance_common) + (distance_san - distance_common);
println!("Distance between systems: {}", distance);
return;
}
}
println!("No common system found?!?");
}
|
use prettytable::{Attr, color};
use crate::node_module::*;
use crate::node_module::standard_module::StandardModule;
use crate::semver::Semver;
pub struct DiffedPair<'a> {
pub name: &'a str,
pub version: (&'a Option<Semver>, &'a Option<Semver>),
pub dep_type: (&'a DepType, &'a DepType),
}
impl<'a> DiffedPair<'a>{
pub fn from(dependency: &'a StandardModule) -> Self {
DiffedPair {
name: &dependency.name,
version: (&dependency.version, &None),
dep_type: (&dependency.dep_type, &DepType::ChildDependency),
}
}
pub fn get_pairs(dependencies: &'a Vec<StandardModule>, diff_dependencies: &'a Vec<StandardModule>) -> Vec<Self> {
let mut diffed_pairs = Vec::new();
let mut found_deps = Vec::new();
for dependency in dependencies {
let mut new_pair = DiffedPair::from(&dependency);
for diff_dependency in diff_dependencies.iter() {
if dependency.name == diff_dependency.name {
new_pair.version.1 = &diff_dependency.version;
found_deps.push(diff_dependency.name.clone());
break;
}
if dependency.name < diff_dependency.name {
break;
}
}
diffed_pairs.push(new_pair);
}
//Add left over diff_dependencies
for diff_dependency in diff_dependencies {
if !found_deps.contains(&diff_dependency.name) {
diffed_pairs.push(DiffedPair{
name: &diff_dependency.name,
dep_type: (&DepType::ChildDependency, &diff_dependency.dep_type),
version: (&None, &diff_dependency.version),
});
}
}
diffed_pairs.sort_by(|a, b| a.name.cmp(&b.name));
diffed_pairs
}
}
impl<'a> PrintTable for DiffedPair<'a> {
fn table_row(&self) -> Row {
let (version_one, version_two) = diffed_cells(&self.version.0, &self.version.1);
Row::new(vec![
new_cell(&self.name),
get_pjson_version_cell(&self.dep_type.0),
version_one,
get_pjson_version_cell(&self.dep_type.1),
version_two,
])
}
}
fn diffed_cells(version_one: &Option<Semver>, version_two: &Option<Semver>) -> (Cell, Cell) {
fn cell(version: &Option<Semver>) -> Cell {
let cell_contents = match &version {
Some(contents) => contents.to_string(),
None => String::new(),
};
new_cell(&cell_contents)
}
let mut cells = (cell(version_one), cell(version_two));
if version_one.is_none() || version_two.is_none() { return cells; }
fn coloured_cell(cell: Cell, color: color::Color) -> Cell {
cell.with_style(Attr::ForegroundColor(color))
}
if version_one < version_two {
cells = (
coloured_cell(cells.0, color::RED),
coloured_cell(cells.1, color::GREEN),
)
}
if version_one > version_two {
cells = (
coloured_cell(cells.0, color::GREEN),
coloured_cell(cells.1, color::RED),
)
}
cells
}
|
use fraction::ToPrimitive;
use crate::rse::*;
use crate::io::*;
use crate::gp::*;
/// A mix table item describes a mix parameter, e.g. volume or reverb
#[derive(Debug,Clone,PartialEq,Eq,Default)]
pub struct MixTableItem {
pub value: u8,
pub duration: u8,
pub all_tracks: bool,
}
//impl Default for MixTableItem { fn default() -> Self { MixTableItem { value: 0, duration: 0, all_tracks: false }}}
const WAH_EFFECT_OFF: i8 = -2;
const WAH_EFFECT_NONE: i8 = -1;
#[derive(Debug,Clone,PartialEq,Eq)]
pub struct WahEffect {
value: i8,
display: bool,
}
impl Default for WahEffect { fn default() -> Self { WahEffect { value: WAH_EFFECT_NONE, display: false }}}
impl WahEffect {
pub(crate) fn _check_value(value: i8) {
if !(WAH_EFFECT_OFF..=100).contains(&value) {panic!("Value for a wah effect must be in range from -2 to 100")}
}
pub(crate) fn _is_on(&self) -> bool {self.value <= 0 && self.value <= 100}
pub(crate) fn _is_off(&self) -> bool {self.value == WAH_EFFECT_OFF}
pub(crate) fn _is_none(&self) -> bool {self.value == WAH_EFFECT_NONE}
}
/// A MixTableChange describes a change in mix parameters
#[derive(Debug,Clone,PartialEq,Eq)]
pub struct MixTableChange {
pub instrument: Option<MixTableItem>,
pub rse: RseInstrument,
pub volume: Option<MixTableItem>,
pub balance: Option<MixTableItem>,
pub chorus: Option<MixTableItem>,
pub reverb: Option<MixTableItem>,
pub phaser: Option<MixTableItem>,
pub tremolo: Option<MixTableItem>,
pub tempo_name: String,
pub tempo: Option<MixTableItem>,
pub hide_tempo: bool,
pub wah: Option<WahEffect>,
pub use_rse: bool,
}
impl Default for MixTableChange { fn default() -> Self { MixTableChange { instrument:None, rse:RseInstrument::default(), volume:None, balance:None, chorus:None, reverb:None, phaser:None, tremolo:None,
tempo_name:String::new(), tempo:None, hide_tempo:true, wah:None, use_rse:false,
}}}
impl MixTableChange {
pub(crate) fn is_just_wah(&self) -> bool {
self.instrument.is_none() && self.volume.is_none() && self.balance.is_none() && self.chorus.is_none() && self.reverb.is_none() && self.phaser.is_none() && self.tremolo.is_none() && self.tempo.is_none() && self.wah.is_none()
}
}
impl Song {
/// Read mix table change. List of values is read first. See `read_values()`.
///
/// List of values is followed by the list of durations for parameters that have changed. See `read_durations()`.
///
/// Mix table change in Guitar Pro 4 format extends Guitar Pro 3 format. It constists of `values <read_mix_table_change_values()>`,
/// `durations <read_mix_table_change_durations()>`, and, new to GP3, `flags <read_mix_table_change_flags()>`.
///
/// Mix table change was modified to support RSE instruments. It is read as in Guitar Pro 3 and is followed by:
/// - Wah effect. See :meth:`read_wah_effect()`.
/// - RSE instrument effect. See :meth:`read_rse_instrument_effect()`.
pub(crate) fn read_mix_table_change(&mut self, data: &[u8], seek: &mut usize) -> MixTableChange {
let mut tc = MixTableChange::default();
self.read_mix_table_change_values(data, seek, &mut tc);
self.read_mix_table_change_durations(data, seek, &mut tc);
//println!("read_mix_table_change()");
if self.version.number >= (4,0,0) {
let flags = self.read_mix_table_change_flags(data, seek, &mut tc);
if self.version.number >= (5,0,0) {
tc.wah = Some(self.read_wah_effect(data, seek, flags));
self.read_rse_instrument_effect(data, seek, &mut tc.rse);
}
}
tc
}
/// Read mix table change values. Mix table change values consist of 7 `signed-byte` and an `int`, which correspond to:
/// - instrument
/// - RSE instrument. See `read_rse_instrument()` (GP5).
/// - volume
/// - balance
/// - chorus
/// - reverb
/// - phaser
/// - tremolo
/// - Tempo name: `int-byte-size-string` (GP5).
/// - tempo
///
/// If signed byte is *-1* then corresponding parameter hasn't changed.
fn read_mix_table_change_values(&mut self, data: &[u8], seek: &mut usize, mtc: &mut MixTableChange) {
//instrument
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.instrument = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//RSE instrument GP5
if self.version.number.0 == 5 {mtc.rse = self.read_rse_instrument(data, seek);}
if self.version.number == (5,0,0) { *seek += 1; }
//volume
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.volume = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//balance
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.balance = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//chorus
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.chorus = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//reverb
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.reverb = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//phaser
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.phaser = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//tremolo
let b = read_signed_byte(data, seek);
if b >= 0 {mtc.tremolo = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
//tempo
if self.version.number >= (5,0,0) {mtc.tempo_name = read_int_byte_size_string(data, seek);}
let b = read_int(data, seek);
if b >= 0 {mtc.tempo = Some(MixTableItem{value: b.to_u8().unwrap(), ..Default::default()});}
}
/// Read mix table change durations. Durations are read for each non-null `MixTableItem`. Durations are encoded in `signed-byte`.
///
/// If tempo did change, then one :ref:`bool` is read. If it's true, then tempo change won't be displayed on the score.
fn read_mix_table_change_durations(&self, data: &[u8], seek: &mut usize, mtc: &mut MixTableChange) {
if mtc.volume.is_some() {mtc.volume.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.balance.is_some() {mtc.balance.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.chorus.is_some() {mtc.chorus.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.reverb.is_some() {mtc.reverb.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.phaser.is_some() {mtc.phaser.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.tremolo.is_some() {mtc.tremolo.take().unwrap().duration = read_signed_byte(data, seek).to_u8().unwrap();}
if mtc.tempo.is_some() {
let mut t = mtc.tempo.take().unwrap();
t.duration = read_signed_byte(data, seek).to_u8().unwrap();
mtc.tempo = Some(t);
mtc.hide_tempo = false;
if self.version.number >= (5,0,0) {mtc.hide_tempo = read_bool(data, seek);}
}
}
/// Read mix table change flags (Guitar Pro 4). The meaning of flags:
/// - *0x01*: change volume for all tracks
/// - *0x02*: change balance for all tracks
/// - *0x04*: change chorus for all tracks
/// - *0x08*: change reverb for all tracks
/// - *0x10*: change phaser for all tracks
/// - *0x20*: change tremolo for all tracks
///
/// In GP5, there is one additional flag:
/// - *0x40*: use RSE
/// - *0x80*: show wah-wah
fn read_mix_table_change_flags(&self, data: &[u8], seek: &mut usize, mtc: &mut MixTableChange) -> i8 {
let flags = read_signed_byte(data, seek);
//println!("read_mix_table_change_flags(), flags: {}", flags);
if mtc.volume.is_some() {
let mut e = mtc.volume.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.volume = Some(e);
}
if mtc.balance.is_some() {
let mut e = mtc.balance.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.balance = Some(e);
}
if mtc.chorus.is_some() {
let mut e = mtc.chorus.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.chorus = Some(e);
}
if mtc.reverb.is_some() {
let mut e = mtc.reverb.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.reverb = Some(e);
}
if mtc.phaser.is_some() {
let mut e = mtc.phaser.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.phaser = Some(e);
}
if mtc.tremolo.is_some() {
let mut e = mtc.tremolo.take().unwrap();
e.all_tracks = (flags & 0x01) == 0x01;
mtc.tremolo = Some(e);
}
if self.version.number >= (5,0,0) {mtc.use_rse = (flags & 0x40) == 0x40;}
flags
}
/// Read wah-wah.
/// - Wah value: :ref:`signed-byte`. See `WahEffect` for value mapping.
fn read_wah_effect(&self, data: &[u8], seek: &mut usize, flags: i8) -> WahEffect {WahEffect{value: read_signed_byte(data, seek), display: (flags & -0x80) == -0x80 /*(flags & 0x80) == 0x80*/}}
pub(crate) fn write_mix_table_change(&self, data: &mut Vec<u8>, mix_table_change: &Option<MixTableChange>, version: &(u8,u8,u8)) {
if let Some(mtc) = mix_table_change {
self.write_mix_table_change_values(data, mtc, version);
self.write_mix_table_change_durations(data, mtc, version);
if version.0 == 4 {self.write_mix_table_change_flags_v4(data, mtc);}
if version.0 == 5 {
self.write_mix_table_change_flags_v5(data, mtc);
if let Some(w) = &mtc.wah {write_signed_byte(data, w.value);} else {write_signed_byte(data, WAH_EFFECT_NONE);} //write wah effect
self.write_rse_instrument_effect(data, &mtc.rse);
}
}
}
fn write_mix_table_change_values(&self, data: &mut Vec<u8>, mix_table_change: &MixTableChange, version: &(u8,u8,u8)) {
//instrument
if let Some(i) = &mix_table_change.instrument {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
if version.0 >= 5 {self.write_rse_instrument(data, &mix_table_change.rse, version);}
if version == &(5,0,0) {write_placeholder_default(data, 1);}
//volume
if let Some(i) = &mix_table_change.volume {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//balance
if let Some(i) = &mix_table_change.balance {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//chorus
if let Some(i) = &mix_table_change.chorus {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//reverb
if let Some(i) = &mix_table_change.reverb {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//phaser
if let Some(i) = &mix_table_change.phaser {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//tremolo
if let Some(i) = &mix_table_change.tremolo {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//tempo
if let Some(i) = &mix_table_change.tempo {write_signed_byte(data, i.value.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
if version.0 >= 5 {
write_int_byte_size_string(data, &mix_table_change.tempo_name);
if let Some(t) = &mix_table_change.tempo {write_i32(data, t.value.to_i32().unwrap());}
else {write_i32(data, -1);}
}
}
fn write_mix_table_change_durations(&self, data: &mut Vec<u8>, mix_table_change: &MixTableChange, version: &(u8,u8,u8)) {
//volume
if let Some(i) = &mix_table_change.volume {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//balance
if let Some(i) = &mix_table_change.balance {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//chorus
if let Some(i) = &mix_table_change.chorus {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//reverb
if let Some(i) = &mix_table_change.reverb {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//phaser
if let Some(i) = &mix_table_change.phaser {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//tremolo
if let Some(i) = &mix_table_change.tremolo {write_signed_byte(data, i.duration.to_i8().unwrap());}
else {write_signed_byte(data, -1);}
//tempo
if let Some(i) = &mix_table_change.tempo {
write_signed_byte(data, i.duration.to_i8().unwrap());
if version > &(5,0,0) {write_bool(data, mix_table_change.hide_tempo);}
} else {write_signed_byte(data, -1);}
}
fn write_mix_table_change_flags_v4(&self, data: &mut Vec<u8>, mix_table_change: &MixTableChange) {
let mut flags = 0i8;
if let Some(i) = &mix_table_change.volume {if i.all_tracks {flags |= 0x01;}}
if let Some(i) = &mix_table_change.balance {if i.all_tracks {flags |= 0x02;}}
if let Some(i) = &mix_table_change.chorus {if i.all_tracks {flags |= 0x04;}}
if let Some(i) = &mix_table_change.reverb {if i.all_tracks {flags |= 0x08;}}
if let Some(i) = &mix_table_change.phaser {if i.all_tracks {flags |= 0x10;}}
if let Some(i) = &mix_table_change.tremolo {if i.all_tracks {flags |= 0x20;}}
write_signed_byte(data, flags);
}
fn write_mix_table_change_flags_v5(&self, data: &mut Vec<u8>, mix_table_change: &MixTableChange) {
let mut flags = 0u8;
if let Some(i) = &mix_table_change.volume {if i.all_tracks {flags |= 0x01;}}
if let Some(i) = &mix_table_change.balance {if i.all_tracks {flags |= 0x02;}}
if let Some(i) = &mix_table_change.chorus {if i.all_tracks {flags |= 0x04;}}
if let Some(i) = &mix_table_change.reverb {if i.all_tracks {flags |= 0x08;}}
if let Some(i) = &mix_table_change.phaser {if i.all_tracks {flags |= 0x10;}}
if let Some(i) = &mix_table_change.tremolo {if i.all_tracks {flags |= 0x20;}}
if mix_table_change.use_rse {flags |= 0x40;}
if let Some(w) = &mix_table_change.wah {if w.display {flags |= 0x80;}}
write_byte(data, flags);
}
} |
use std::mem;
/// Represents a value that is not checked at first, and upon being checked it might be available
/// or unavailable.
pub enum MaybeUnavailable<T> {
// I'm not that great at naming.
NotChecked,
Unavailable,
Available(T),
}
impl<T> MaybeUnavailable<T> {
/// Resets this value to the not checked state.
#[inline]
pub fn reset(&mut self) {
*self = MaybeUnavailable::NotChecked;
}
/// If the value is available, returns it, otherwise returns `None`.
#[inline]
pub fn available(self) -> Option<T> {
match self {
MaybeUnavailable::Available(x) => Some(x),
_ => None,
}
}
/// Takes a value out of the `MaybeUnavailable`, leaving `NotChecked` in its place if it was
/// `Available` and retains the value otherwise.
#[inline]
pub fn take(&mut self) -> Option<T> {
let new_value = match self {
MaybeUnavailable::NotChecked => MaybeUnavailable::NotChecked,
MaybeUnavailable::Unavailable => MaybeUnavailable::Unavailable,
MaybeUnavailable::Available(_) => MaybeUnavailable::NotChecked,
};
mem::replace(self, new_value).available()
}
/// Moves the value `v` out of the `MaybeUnavailable<T>` if it is `Available(v)`.
///
/// # Panics
///
/// Panics if the self value does not equal `Available(v)`.
#[inline]
pub fn unwrap(self) -> T {
match self {
MaybeUnavailable::Available(x) => x,
MaybeUnavailable::NotChecked => {
panic!("called `MaybeUnavailable::unwrap()` on a `NotChecked` value")
}
MaybeUnavailable::Unavailable => {
panic!("called `MaybeUnavailable::unwrap()` on a `Unavailable` value")
}
}
}
/// Returns `true` if the value is `NotChecked`.
#[inline]
pub fn is_not_checked(&self) -> bool {
match self {
MaybeUnavailable::NotChecked => true,
_ => false,
}
}
/// Converts from `MaybeUnavailable<T>` to `MaybeUnavailable<&T>`.
#[inline]
pub fn as_ref(&self) -> MaybeUnavailable<&T> {
match *self {
MaybeUnavailable::NotChecked => MaybeUnavailable::NotChecked,
MaybeUnavailable::Unavailable => MaybeUnavailable::Unavailable,
MaybeUnavailable::Available(ref x) => MaybeUnavailable::Available(x),
}
}
/// Converts from `MaybeUnavailable<T>` to `MaybeUnavailable<&mut T>`.
#[inline]
pub fn as_mut(&mut self) -> MaybeUnavailable<&mut T> {
match *self {
MaybeUnavailable::NotChecked => MaybeUnavailable::NotChecked,
MaybeUnavailable::Unavailable => MaybeUnavailable::Unavailable,
MaybeUnavailable::Available(ref mut x) => MaybeUnavailable::Available(x),
}
}
/// Returns `Available(x)` if passed `Some(x)` and `Unavailable` otherwise.
#[inline]
pub fn from_check_result(x: Option<T>) -> Self {
match x {
Some(x) => MaybeUnavailable::Available(x),
None => MaybeUnavailable::Unavailable,
}
}
}
|
use core::alloc::Layout;
use core::iter;
use core::ptr;
use core::slice;
use core::str;
use liblumen_core::offset_of;
use liblumen_term::{Encoding as EncodingTrait, Tag};
use crate::borrow::CloneToProcess;
use crate::erts::exception::AllocResult;
use crate::erts::process::alloc::TermAlloc;
use crate::erts::string::{self, Encoding};
use crate::erts::term::prelude::*;
/// This struct is used to represent binary literals which are compiled into
/// the final executable. At runtime, we identify them by the fact that they
/// are boxed literals, which point to a header flagged as a ProcBin. In these
/// cases, rather than reifying a ProcBin, we reify a BinaryLiteral instead.
///
/// We are able to do this because the header struct of BinaryLiteral and ProcBin are
/// structured so that the header field comes first, and the flags field (a usize)
/// comes second in BinaryLiteral while the field containing the pointer to the
/// ProcBinInner comes second in ProcBin. Since pointers are always 8-byte aligned on
/// all target platforms, BinaryLiteral sets the lowest bit to 1 in its flags field,
/// allowing us to unambiguously identify BinaryLiteral from ProcBin. Due to this, the
/// byte size of a BinaryLiteral is shifted left one bit, unlike the other binary types.
///
/// BinaryLiterals always have an effective static lifetime, as the underlying
/// bytes are stored as constant values in the executable. They can not be modified,
/// and cloning is extremely cheap as it is effectively the same as cloning a pointer.
///
/// Since they share the same header tag as a ProcBin, some care is necessary to ensure
/// that a BinaryLiteral is not ever reified as a ProcBin, but as all references to a
/// BinaryLiteral occur through a box flagged as literal, this is easily avoided. Likewise,
/// the garbage collector does not ever try to interact with literals, beyond copying the
/// references to them.
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct BinaryLiteral {
header: Header<BinaryLiteral>,
flags: BinaryFlags,
bytes: *mut u8,
}
unsafe impl Send for BinaryLiteral {}
unsafe impl Sync for BinaryLiteral {}
impl_static_header!(BinaryLiteral, Term::HEADER_BINARY_LITERAL);
impl BinaryLiteral {
#[inline]
pub fn flags_offset() -> usize {
offset_of!(BinaryLiteral, flags)
}
#[inline]
pub fn from_raw_bytes(bytes: *mut u8, size: usize, encoding: Option<Encoding>) -> Self {
let flags = BinaryFlags::new_literal(encoding.unwrap_or(Encoding::Raw)).set_size(size);
Self {
header: Default::default(),
flags,
bytes,
}
}
#[inline]
pub fn make_parts_from_str<E>(s: &str) -> (u64, u64)
where
E: EncodingTrait,
{
let header_val = <E::Type as TryFrom<usize>>::try_from(0).ok().unwrap();
let header = E::encode_header_with_tag(header_val, Tag::ProcBin)
.try_into()
.ok()
.unwrap();
let encoding = if string::is_latin1(s) {
Encoding::Latin1
} else {
Encoding::Utf8
};
let flags = BinaryFlags::new_literal(encoding)
.set_size(s.len())
.as_u64();
(header, flags)
}
#[inline]
pub fn make_parts_from_slice<E>(s: &[u8]) -> (u64, u64)
where
E: EncodingTrait,
{
let header_val = <E::Type as TryFrom<usize>>::try_from(0).ok().unwrap();
let header = E::encode_header_with_tag(header_val, Tag::ProcBin)
.try_into()
.ok()
.unwrap();
let encoding = if s.is_ascii() {
Encoding::Latin1
} else {
Encoding::Raw
};
let flags = BinaryFlags::new_literal(encoding)
.set_size(s.len())
.as_u64();
(header, flags)
}
#[inline]
pub fn full_byte_iter<'a>(&'a self) -> iter::Copied<slice::Iter<'a, u8>> {
self.as_bytes().iter().copied()
}
}
impl Bitstring for BinaryLiteral {
#[inline]
fn full_byte_len(&self) -> usize {
self.flags.get_size()
}
#[inline]
unsafe fn as_byte_ptr(&self) -> *mut u8 {
self.bytes
}
}
impl Binary for BinaryLiteral {
#[inline]
fn flags(&self) -> &BinaryFlags {
&self.flags
}
}
impl AlignedBinary for BinaryLiteral {
fn as_bytes(&self) -> &[u8] {
unsafe { slice::from_raw_parts(self.bytes, self.full_byte_len()) }
}
}
impl IndexByte for BinaryLiteral {
#[inline]
fn byte(&self, index: usize) -> u8 {
self.as_bytes()[index]
}
}
impl CloneToProcess for BinaryLiteral {
fn clone_to_heap<A>(&self, heap: &mut A) -> AllocResult<Term>
where
A: ?Sized + TermAlloc,
{
unsafe {
// Allocate space for the header
let layout = Layout::new::<Self>();
let ptr = heap.alloc_layout(layout)?.as_ptr() as *mut Self;
// Write the binary header
ptr::write(ptr, self.clone());
// Reify result term
Ok(ptr.into())
}
}
fn size_in_words(&self) -> usize {
crate::erts::to_word_size(Layout::for_value(self).size())
}
}
|
import syntax::ast;
import ast::mutability;
import ast::local_def;
import ast::respan;
import ast::spanned;
import syntax::visit;
import metadata::csearch;
import driver::session;
import util::common;
import util::common::*;
import syntax::codemap::span;
import std::map::new_int_hash;
import std::map::new_str_hash;
import middle::ty;
import middle::ty::node_id_to_type;
import middle::ty::arg;
import middle::ty::bind_params_in_type;
import middle::ty::block_ty;
import middle::ty::expr_ty;
import middle::ty::field;
import middle::ty::method;
import middle::ty::mo_val;
import middle::ty::mo_alias;
import middle::ty::node_type_table;
import middle::ty::pat_ty;
import middle::ty::ty_param_substs_opt_and_ty;
import util::ppaux::ty_to_str;
import middle::ty::ty_param_kinds_and_ty;
import middle::ty::ty_nil;
import middle::ty::unify::ures_ok;
import middle::ty::unify::ures_err;
import middle::ty::unify::fixup_result;
import middle::ty::unify::fix_ok;
import middle::ty::unify::fix_err;
import std::int;
import std::ivec;
import std::str;
import std::uint;
import std::map;
import std::map::hashmap;
import std::option;
import std::option::none;
import std::option::some;
import std::option::from_maybe;
import std::smallintmap;
import middle::tstate::ann::ts_ann;
import syntax::print::pprust::*;
export check_crate;
type ty_table = hashmap[ast::def_id, ty::t];
// Used for typechecking the methods of an object.
tag obj_info {
// Regular objects have a node_id at compile time.
regular_obj(ast::obj_field[], ast::node_id);
// Anonymous objects only have a type at compile time. It's optional
// because not all anonymous objects have a inner_obj to attach to.
anon_obj(ast::obj_field[], option::t[ty::sty]);
}
type crate_ctxt = {mutable obj_infos: obj_info[], tcx: ty::ctxt};
type fn_ctxt =
// var_bindings, locals, local_names, and next_var_id are shared
// with any nested functions that capture the environment
// (and with any functions whose environment is being captured).
{ret_ty: ty::t,
purity: ast::purity,
proto: ast::proto,
var_bindings: @ty::unify::var_bindings,
locals: hashmap[ast::node_id, int],
local_names: hashmap[ast::node_id, ast::ident],
next_var_id: @mutable int,
mutable fixups: ast::node_id[],
ccx: @crate_ctxt};
// Used for ast_ty_to_ty() below.
type ty_getter = fn(&ast::def_id) -> ty::ty_param_kinds_and_ty ;
fn lookup_local(fcx: &@fn_ctxt, sp: &span, id: ast::node_id) -> int {
alt fcx.locals.find(id) {
some(x) { x }
_ {
fcx.ccx.tcx.sess.span_fatal
(sp, "internal error looking up a local var")
}
}
}
fn lookup_def(fcx: &@fn_ctxt, sp: &span, id: ast::node_id) -> ast::def {
alt fcx.ccx.tcx.def_map.find(id) {
some(x) { x }
_ {
fcx.ccx.tcx.sess.span_fatal
(sp, "internal error looking up a definition")
}
}
}
fn ident_for_local(loc: &@ast::local) -> ast::ident {
ret alt loc.node.pat.node {
ast::pat_bind(name) { name }
_ { "local" } // FIXME DESTR
};
}
// Returns the type parameter count and the type for the given definition.
fn ty_param_kinds_and_ty_for_def(fcx: &@fn_ctxt, sp: &span, defn: &ast::def)
-> ty_param_kinds_and_ty {
let no_kinds: ast::kind[] = ~[];
alt defn {
ast::def_arg(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ret {kinds: no_kinds, ty: typ};
}
ast::def_local(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ret {kinds: no_kinds, ty: typ};
}
ast::def_obj_field(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ret {kinds: no_kinds, ty: typ};
}
ast::def_fn(id, _) { ret ty::lookup_item_type(fcx.ccx.tcx, id); }
ast::def_native_fn(id) { ret ty::lookup_item_type(fcx.ccx.tcx, id); }
ast::def_const(id) { ret ty::lookup_item_type(fcx.ccx.tcx, id); }
ast::def_variant(_, vid) { ret ty::lookup_item_type(fcx.ccx.tcx, vid); }
ast::def_binding(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ret {kinds: no_kinds, ty: typ};
}
ast::def_mod(_) {
// Hopefully part of a path.
// TODO: return a type that's more poisonous, perhaps?
ret {kinds: no_kinds, ty: ty::mk_nil(fcx.ccx.tcx)};
}
ast::def_ty(_) {
fcx.ccx.tcx.sess.span_fatal(sp, "expected value but found type");
}
_ {
// FIXME: handle other names.
fcx.ccx.tcx.sess.unimpl("definition variant");
}
}
}
// Instantiates the given path, which must refer to an item with the given
// number of type parameters and type.
fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path,
tpt: &ty_param_kinds_and_ty, sp: &span) ->
ty_param_substs_opt_and_ty {
let ty_param_count = ivec::len(tpt.kinds);
let bind_result =
bind_params_in_type(sp, fcx.ccx.tcx, bind next_ty_var_id(fcx), tpt.ty,
ty_param_count);
let ty_param_vars = bind_result.ids;
let ty_substs_opt;
let ty_substs_len = ivec::len[@ast::ty](pth.node.types);
if ty_substs_len > 0u {
let param_var_len = ivec::len(ty_param_vars);
if param_var_len == 0u {
fcx.ccx.tcx.sess.span_fatal
(sp, "this item does not take type parameters");
} else if (ty_substs_len > param_var_len) {
fcx.ccx.tcx.sess.span_fatal
(sp, "too many type parameter provided for this item");
} else if (ty_substs_len < param_var_len) {
fcx.ccx.tcx.sess.span_fatal
(sp, "not enough type parameters provided for this item");
}
let ty_substs: ty::t[] = ~[];
let i = 0u;
while i < ty_substs_len {
let ty_var = ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i));
let ty_subst = ast_ty_to_ty_crate(fcx.ccx, pth.node.types.(i));
let res_ty = demand::simple(fcx, pth.span, ty_var, ty_subst);
ty_substs += ~[res_ty];
i += 1u;
}
ty_substs_opt = some[ty::t[]](ty_substs);
if ty_param_count == 0u {
fcx.ccx.tcx.sess.span_fatal(sp,
"this item does not take type \
parameters");
}
} else {
// We will acquire the type parameters through unification.
let ty_substs: ty::t[] = ~[];
let i = 0u;
while i < ty_param_count {
ty_substs += ~[ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i))];
i += 1u;
}
ty_substs_opt = some[ty::t[]](ty_substs);
}
ret {substs: ty_substs_opt, ty: tpt.ty};
}
fn ast_mode_to_mode(mode: ast::mode) -> ty::mode {
let ty_mode;
alt mode {
ast::val. { ty_mode = mo_val; }
ast::alias(mut) { ty_mode = mo_alias(mut); }
}
ret ty_mode;
}
// Type tests
fn structurally_resolved_type(fcx: &@fn_ctxt, sp: &span, tp: ty::t) ->
ty::t {
alt ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, tp) {
fix_ok(typ_s) { ret typ_s; }
fix_err(_) {
fcx.ccx.tcx.sess.span_fatal
(sp, "the type of this value must be known in this context");
}
}
}
// Returns the one-level-deep structure of the given type.
fn structure_of(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> ty::sty {
ret ty::struct(fcx.ccx.tcx, structurally_resolved_type(fcx, sp, typ));
}
// Returns the one-level-deep structure of the given type or none if it
// is not known yet.
fn structure_of_maybe(fcx: &@fn_ctxt, sp: &span, typ: ty::t) ->
option::t[ty::sty] {
let r =
ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ);
ret alt r {
fix_ok(typ_s) { some(ty::struct(fcx.ccx.tcx, typ_s)) }
fix_err(_) { none }
}
}
fn type_is_integral(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
ret ty::type_is_integral(fcx.ccx.tcx, typ_s);
}
fn type_is_scalar(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
ret ty::type_is_scalar(fcx.ccx.tcx, typ_s);
}
// Parses the programmer's textual representation of a type into our internal
// notion of a type. `getter` is a function that returns the type
// corresponding to a definition ID:
fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) ->
ty::t {
alt tcx.ast_ty_to_ty_cache.find(ast_ty) {
some(some(ty)) { ret ty; }
some(none.) {
tcx.sess.span_fatal(ast_ty.span,
"illegal recursive type \
insert a tag in the cycle, \
if this is desired)");
}
none. { }
} /* go on */
tcx.ast_ty_to_ty_cache.insert(ast_ty, none[ty::t]);
fn ast_arg_to_arg(tcx: &ty::ctxt, getter: &ty_getter, arg: &ast::ty_arg)
-> {mode: ty::mode, ty: ty::t} {
let ty_mode = ast_mode_to_mode(arg.node.mode);
ret {mode: ty_mode, ty: ast_ty_to_ty(tcx, getter, arg.node.ty)};
}
fn ast_mt_to_mt(tcx: &ty::ctxt, getter: &ty_getter, mt: &ast::mt) ->
ty::mt {
ret {ty: ast_ty_to_ty(tcx, getter, mt.ty), mut: mt.mut};
}
fn instantiate(tcx: &ty::ctxt, sp: &span, getter: &ty_getter,
id: &ast::def_id, args: &(@ast::ty)[]) -> ty::t {
// TODO: maybe record cname chains so we can do
// "foo = int" like OCaml?
let ty_param_kinds_and_ty = getter(id);
if ivec::len(ty_param_kinds_and_ty.kinds) == 0u {
ret ty_param_kinds_and_ty.ty;
}
// The typedef is type-parametric. Do the type substitution.
//
let param_bindings: ty::t[] = ~[];
for ast_ty: @ast::ty in args {
param_bindings += ~[ast_ty_to_ty(tcx, getter, ast_ty)];
}
if ivec::len(param_bindings) !=
ivec::len(ty_param_kinds_and_ty.kinds) {
tcx.sess.span_fatal(sp,
"Wrong number of type arguments for a \
polymorphic type");
}
let typ =
ty::substitute_type_params(tcx, param_bindings,
ty_param_kinds_and_ty.ty);
ret typ;
}
let typ;
let cname = none[str];
alt ast_ty.node {
ast::ty_nil. { typ = ty::mk_nil(tcx); }
ast::ty_bot. { typ = ty::mk_bot(tcx); }
ast::ty_bool. { typ = ty::mk_bool(tcx); }
ast::ty_int. { typ = ty::mk_int(tcx); }
ast::ty_uint. { typ = ty::mk_uint(tcx); }
ast::ty_float. { typ = ty::mk_float(tcx); }
ast::ty_machine(tm) { typ = ty::mk_mach(tcx, tm); }
ast::ty_char. { typ = ty::mk_char(tcx); }
ast::ty_str. { typ = ty::mk_str(tcx); }
ast::ty_istr. { typ = ty::mk_istr(tcx); }
ast::ty_box(mt) {
typ = ty::mk_box(tcx, ast_mt_to_mt(tcx, getter, mt));
}
ast::ty_vec(mt) {
typ = ty::mk_vec(tcx, ast_mt_to_mt(tcx, getter, mt));
}
ast::ty_ivec(mt) {
typ = ty::mk_ivec(tcx, ast_mt_to_mt(tcx, getter, mt));
}
ast::ty_ptr(mt) {
typ = ty::mk_ptr(tcx, ast_mt_to_mt(tcx, getter, mt));
}
ast::ty_task. { typ = ty::mk_task(tcx); }
ast::ty_port(t) {
typ = ty::mk_port(tcx, ast_ty_to_ty(tcx, getter, t));
}
ast::ty_chan(t) {
typ = ty::mk_chan(tcx, ast_ty_to_ty(tcx, getter, t));
}
ast::ty_rec(fields) {
let flds: field[] = ~[];
for f: ast::ty_field in fields {
let tm = ast_mt_to_mt(tcx, getter, f.node.mt);
flds += ~[{ident: f.node.ident, mt: tm}];
}
typ = ty::mk_rec(tcx, flds);
}
ast::ty_fn(proto, inputs, output, cf, constrs) {
let i = ~[];
for ta: ast::ty_arg in inputs {
i += ~[ast_arg_to_arg(tcx, getter, ta)];
}
let out_ty = ast_ty_to_ty(tcx, getter, output);
let out_constrs = ~[];
for constr: @ast::constr in constrs {
out_constrs += ~[ty::ast_constr_to_constr(tcx, constr)];
}
typ = ty::mk_fn(tcx, proto, i, out_ty, cf, out_constrs);
}
ast::ty_path(path, id) {
alt tcx.def_map.find(id) {
some(ast::def_ty(id)) {
typ = instantiate(tcx, ast_ty.span, getter, id, path.node.types);
}
some(ast::def_native_ty(id)) { typ = getter(id).ty; }
some(ast::def_ty_arg(id,k)) { typ = ty::mk_param(tcx, id, k); }
some(_) {
tcx.sess.span_fatal(ast_ty.span,
"found type name used as a variable");
}
_ {
tcx.sess.span_fatal(ast_ty.span, "internal error in instantiate");
}
}
cname = some(path_to_str(path));
}
ast::ty_obj(meths) {
let tmeths: ty::method[] = ~[];
for m: ast::ty_method in meths {
let ins = ~[];
for ta: ast::ty_arg in m.node.inputs {
ins += ~[ast_arg_to_arg(tcx, getter, ta)];
}
let out = ast_ty_to_ty(tcx, getter, m.node.output);
let out_constrs = ~[];
for constr: @ast::constr in m.node.constrs {
out_constrs += ~[ty::ast_constr_to_constr(tcx, constr)];
}
let new_m: ty::method =
{proto: m.node.proto,
ident: m.node.ident,
inputs: ins,
output: out,
cf: m.node.cf,
constrs: out_constrs};
tmeths += ~[new_m];
}
typ = ty::mk_obj(tcx, ty::sort_methods(tmeths));
}
ast::ty_constr(t, cs) {
let out_cs = ~[];
for constr: @ast::ty_constr in cs {
out_cs += ~[ty::ast_constr_to_constr(tcx, constr)];
}
typ = ty::mk_constr(tcx, ast_ty_to_ty(tcx, getter, t), out_cs);
}
}
alt cname {
none. {/* no-op */ }
some(cname_str) { typ = ty::rename(tcx, typ, cname_str); }
}
tcx.ast_ty_to_ty_cache.insert(ast_ty, some(typ));
ret typ;
}
// A convenience function to use a crate_ctxt to resolve names for
// ast_ty_to_ty.
fn ast_ty_to_ty_crate(ccx: @crate_ctxt, ast_ty: &@ast::ty) -> ty::t {
fn getter(ccx: @crate_ctxt, id: &ast::def_id) ->
ty::ty_param_kinds_and_ty {
ret ty::lookup_item_type(ccx.tcx, id);
}
let f = bind getter(ccx, _);
ret ast_ty_to_ty(ccx.tcx, f, ast_ty);
}
// Functions that write types into the node type table.
mod write {
fn inner(ntt: &node_type_table, node_id: ast::node_id,
tpot: &ty_param_substs_opt_and_ty) {
smallintmap::insert(*ntt, node_id as uint, tpot);
}
// Writes a type parameter count and type pair into the node type table.
fn ty(tcx: &ty::ctxt, node_id: ast::node_id,
tpot: &ty_param_substs_opt_and_ty) {
assert (!ty::type_contains_vars(tcx, tpot.ty));
inner(tcx.node_types, node_id, tpot);
}
// Writes a type parameter count and type pair into the node type table.
// This function allows for the possibility of type variables, which will
// be rewritten later during the fixup phase.
fn ty_fixup(fcx: @fn_ctxt, node_id: ast::node_id,
tpot: &ty_param_substs_opt_and_ty) {
inner(fcx.ccx.tcx.node_types, node_id, tpot);
if ty::type_contains_vars(fcx.ccx.tcx, tpot.ty) {
fcx.fixups += ~[node_id];
}
}
// Writes a type with no type parameters into the node type table.
fn ty_only(tcx: &ty::ctxt, node_id: ast::node_id, typ: ty::t) {
ty(tcx, node_id, {substs: none[ty::t[]], ty: typ});
}
// Writes a type with no type parameters into the node type table. This
// function allows for the possibility of type variables.
fn ty_only_fixup(fcx: @fn_ctxt, node_id: ast::node_id, typ: ty::t) {
ret ty_fixup(fcx, node_id, {substs: none[ty::t[]], ty: typ});
}
// Writes a nil type into the node type table.
fn nil_ty(tcx: &ty::ctxt, node_id: ast::node_id) {
ret ty(tcx, node_id, {substs: none[ty::t[]], ty: ty::mk_nil(tcx)});
}
// Writes the bottom type into the node type table.
fn bot_ty(tcx: &ty::ctxt, node_id: ast::node_id) {
ret ty(tcx, node_id, {substs: none[ty::t[]], ty: ty::mk_bot(tcx)});
}
}
// Determine the proto for a fn type given the proto for its associated
// code. This is needed because fn and lambda have fn type while iter
// has iter type and block has block type. This may end up changing.
fn proto_to_ty_proto(proto: &ast::proto) -> ast::proto {
ret alt proto {
ast::proto_iter. | ast::proto_block. { proto }
_ { ast::proto_fn }
};
}
// Item collection - a pair of bootstrap passes:
//
// (1) Collect the IDs of all type items (typedefs) and store them in a table.
//
// (2) Translate the AST fragments that describe types to determine a type for
// each item. When we encounter a named type, we consult the table built
// in pass 1 to find its item, and recursively translate it.
//
// We then annotate the AST with the resulting types and return the annotated
// AST, along with a table mapping item IDs to their types.
//
// TODO: This logic is quite convoluted; it's a relic of the time when we
// actually wrote types directly into the AST and didn't have a type cache.
// Could use some cleanup. Consider topologically sorting in phase (1) above.
mod collect {
type ctxt = {tcx: ty::ctxt};
fn mk_ty_params(cx: &@ctxt, atps: &ast::ty_param[]) -> ty::t[] {
let tps = ~[];
let i = 0u;
for atp: ast::ty_param in atps {
tps += ~[ty::mk_param(cx.tcx, i, atp.kind)];
i += 1u;
}
ret tps;
}
fn ty_param_kinds(tps: &ast::ty_param[]) -> ast::kind[] {
let k: ast::kind[] = ~[];
for p: ast::ty_param in tps {
k += ~[p.kind]
}
ret k;
}
fn ty_of_fn_decl(cx: &@ctxt, convert: &fn(&@ast::ty) -> ty::t ,
ty_of_arg: &fn(&ast::arg) -> arg , decl: &ast::fn_decl,
proto: ast::proto, ty_params: &ast::ty_param[],
def_id: &option::t[ast::def_id]) ->
ty::ty_param_kinds_and_ty {
let input_tys = ~[];
for a: ast::arg in decl.inputs { input_tys += ~[ty_of_arg(a)]; }
let output_ty = convert(decl.output);
let out_constrs = ~[];
for constr: @ast::constr in decl.constraints {
out_constrs += ~[ty::ast_constr_to_constr(cx.tcx, constr)];
}
let t_fn =
ty::mk_fn(cx.tcx, proto_to_ty_proto(proto), input_tys, output_ty,
decl.cf, out_constrs);
let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
alt def_id { some(did) { cx.tcx.tcache.insert(did, tpt); } _ { } }
ret tpt;
}
fn ty_of_native_fn_decl(cx: &@ctxt, convert: &fn(&@ast::ty) -> ty::t ,
ty_of_arg: &fn(&ast::arg) -> arg ,
decl: &ast::fn_decl, abi: ast::native_abi,
ty_params: &ast::ty_param[], def_id: &ast::def_id)
-> ty::ty_param_kinds_and_ty {
let input_tys = ~[];
for a: ast::arg in decl.inputs { input_tys += ~[ty_of_arg(a)]; }
let output_ty = convert(decl.output);
let t_fn = ty::mk_native_fn(cx.tcx, abi, input_tys, output_ty);
let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
cx.tcx.tcache.insert(def_id, tpt);
ret tpt;
}
fn getter(cx: @ctxt, id: &ast::def_id) -> ty::ty_param_kinds_and_ty {
if id.crate != ast::local_crate {
// This is a type we need to load in from the crate reader.
ret csearch::get_type(cx.tcx, id);
}
let it = cx.tcx.items.find(id.node);
let tpt;
alt it {
some(ast_map::node_item(item)) { tpt = ty_of_item(cx, item); }
some(ast_map::node_native_item(native_item)) {
tpt = ty_of_native_item(cx, native_item, ast::native_abi_cdecl);
}
_ { cx.tcx.sess.fatal("internal error " + std::int::str(id.node)); }
}
ret tpt;
}
fn ty_of_arg(cx: @ctxt, a: &ast::arg) -> ty::arg {
let ty_mode = ast_mode_to_mode(a.mode);
let f = bind getter(cx, _);
let tt = ast_ty_to_ty(cx.tcx, f, a.ty);
if ty::type_has_dynamic_size(cx.tcx, tt) {
alt ty_mode {
mo_val. {
cx.tcx.sess.span_fatal(a.ty.span,
"Dynamically sized arguments \
must be passed by alias");
}
_ { }
}
}
ret {mode: ty_mode, ty: tt};
}
fn ty_of_method(cx: @ctxt, m: &@ast::method) -> ty::method {
let get = bind getter(cx, _);
let convert = bind ast_ty_to_ty(cx.tcx, get, _);
let inputs = ~[];
for a: ast::arg in m.node.meth.decl.inputs {
inputs += ~[ty_of_arg(cx, a)];
}
let output = convert(m.node.meth.decl.output);
let out_constrs = ~[];
for constr: @ast::constr in m.node.meth.decl.constraints {
out_constrs += ~[ty::ast_constr_to_constr(cx.tcx, constr)];
}
ret {proto: proto_to_ty_proto(m.node.meth.proto),
ident: m.node.ident,
inputs: inputs,
output: output,
cf: m.node.meth.decl.cf,
constrs: out_constrs};
}
fn ty_of_obj(cx: @ctxt, id: &ast::ident, ob: &ast::_obj,
ty_params: &ast::ty_param[]) -> ty::ty_param_kinds_and_ty {
let methods = get_obj_method_types(cx, ob);
let t_obj = ty::mk_obj(cx.tcx, ty::sort_methods(methods));
t_obj = ty::rename(cx.tcx, t_obj, id);
ret {kinds: ty_param_kinds(ty_params), ty: t_obj};
}
fn ty_of_obj_ctor(cx: @ctxt, id: &ast::ident, ob: &ast::_obj,
ctor_id: ast::node_id, ty_params: &ast::ty_param[]) ->
ty::ty_param_kinds_and_ty {
let t_obj = ty_of_obj(cx, id, ob, ty_params);
let t_inputs: arg[] = ~[];
for f: ast::obj_field in ob.fields {
let g = bind getter(cx, _);
let t_field = ast_ty_to_ty(cx.tcx, g, f.ty);
t_inputs += ~[{mode: ty::mo_alias(false), ty: t_field}];
}
let t_fn =
ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj.ty, ast::return,
~[]);
let tpt = {kinds: ty_param_kinds(ty_params), ty: t_fn};
cx.tcx.tcache.insert(local_def(ctor_id), tpt);
ret tpt;
}
fn ty_of_item(cx: &@ctxt, it: &@ast::item) -> ty::ty_param_kinds_and_ty {
let get = bind getter(cx, _);
let convert = bind ast_ty_to_ty(cx.tcx, get, _);
let no_kinds: ast::kind[] = ~[];
alt it.node {
ast::item_const(t, _) {
let typ = convert(t);
let tpt = {kinds: no_kinds, ty: typ};
cx.tcx.tcache.insert(local_def(it.id), tpt);
ret tpt;
}
ast::item_fn(fn_info, tps) {
let f = bind ty_of_arg(cx, _);
ret ty_of_fn_decl(cx, convert, f, fn_info.decl, fn_info.proto,
tps, some(local_def(it.id)));
}
ast::item_obj(ob, tps, _) {
let t_obj = ty_of_obj(cx, it.ident, ob, tps);
cx.tcx.tcache.insert(local_def(it.id), t_obj);
ret t_obj;
}
ast::item_ty(t, tps) {
alt cx.tcx.tcache.find(local_def(it.id)) {
some(tpt) { ret tpt; }
none. { }
}
// Tell ast_ty_to_ty() that we want to perform a recursive
// call to resolve any named types.
let typ = convert(t);
let tpt = {kinds: ty_param_kinds(tps), ty: typ};
cx.tcx.tcache.insert(local_def(it.id), tpt);
ret tpt;
}
ast::item_res(f, _, tps, _) {
let t_arg = ty_of_arg(cx, f.decl.inputs.(0));
let t_res =
{kinds: ty_param_kinds(tps),
ty:
ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
mk_ty_params(cx, tps))};
cx.tcx.tcache.insert(local_def(it.id), t_res);
ret t_res;
}
ast::item_tag(_, tps) {
// Create a new generic polytype.
let subtys: ty::t[] = mk_ty_params(cx, tps);
let t = ty::mk_tag(cx.tcx, local_def(it.id), subtys);
let tpt = {kinds: ty_param_kinds(tps), ty: t};
cx.tcx.tcache.insert(local_def(it.id), tpt);
ret tpt;
}
ast::item_mod(_) { fail; }
ast::item_native_mod(_) { fail; }
}
}
fn ty_of_native_item(cx: &@ctxt, it: &@ast::native_item,
abi: ast::native_abi) -> ty::ty_param_kinds_and_ty {
let no_kinds: ast::kind[] = ~[];
alt it.node {
ast::native_item_fn(_, fn_decl, params) {
let get = bind getter(cx, _);
let convert = bind ast_ty_to_ty(cx.tcx, get, _);
let f = bind ty_of_arg(cx, _);
ret ty_of_native_fn_decl(cx, convert, f, fn_decl, abi, params,
ast::local_def(it.id));
}
ast::native_item_ty. {
alt cx.tcx.tcache.find(local_def(it.id)) {
some(tpt) { ret tpt; }
none. { }
}
let t = ty::mk_native(cx.tcx, ast::local_def(it.id));
let tpt = {kinds: no_kinds, ty: t};
cx.tcx.tcache.insert(local_def(it.id), tpt);
ret tpt;
}
}
}
fn get_tag_variant_types(cx: &@ctxt, tag_id: &ast::def_id,
variants: &ast::variant[],
ty_params: &ast::ty_param[]) {
// Create a set of parameter types shared among all the variants.
let ty_param_tys: ty::t[] = mk_ty_params(cx, ty_params);
for variant: ast::variant in variants {
// Nullary tag constructors get turned into constants; n-ary tag
// constructors get turned into functions.
let result_ty;
if ivec::len[ast::variant_arg](variant.node.args) == 0u {
result_ty = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
} else {
// As above, tell ast_ty_to_ty() that trans_ty_item_to_ty()
// should be called to resolve named types.
let f = bind getter(cx, _);
let args: arg[] = ~[];
for va: ast::variant_arg in variant.node.args {
let arg_ty = ast_ty_to_ty(cx.tcx, f, va.ty);
args += ~[{mode: ty::mo_alias(false), ty: arg_ty}];
}
let tag_t = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
// FIXME: this will be different for constrained types
result_ty =
ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t, ast::return,
~[]);
}
let tpt = {kinds: ty_param_kinds(ty_params), ty: result_ty};
cx.tcx.tcache.insert(local_def(variant.node.id), tpt);
write::ty_only(cx.tcx, variant.node.id, result_ty);
}
}
fn get_obj_method_types(cx: &@ctxt, object: &ast::_obj) -> ty::method[] {
let meths = ~[];
for m: @ast::method in object.methods {
meths += ~[ty_of_method(cx, m)];
}
ret meths;
}
fn convert(cx: @ctxt, abi: @mutable option::t[ast::native_abi],
it: &@ast::item) {
alt it.node {
ast::item_mod(_) {
// ignore item_mod, it has no type.
}
ast::item_native_mod(native_mod) {
// Propagate the native ABI down to convert_native() below,
// but otherwise do nothing, as native modules have no types.
*abi = some[ast::native_abi](native_mod.abi);
}
ast::item_tag(variants, ty_params) {
let tpt = ty_of_item(cx, it);
write::ty_only(cx.tcx, it.id, tpt.ty);
get_tag_variant_types(cx, local_def(it.id), variants, ty_params);
}
ast::item_obj(object, ty_params, ctor_id) {
// Now we need to call ty_of_obj_ctor(); this is the type that
// we write into the table for this item.
ty_of_item(cx, it);
let tpt = ty_of_obj_ctor(cx, it.ident, object,
ctor_id, ty_params);
write::ty_only(cx.tcx, ctor_id, tpt.ty);
// Write the methods into the type table.
//
// FIXME: Inefficient; this ends up calling
// get_obj_method_types() twice. (The first time was above in
// ty_of_obj().)
let method_types = get_obj_method_types(cx, object);
let i = 0u;
while i < ivec::len[@ast::method](object.methods) {
write::ty_only(cx.tcx, object.methods.(i).node.id,
ty::method_ty_to_fn_ty(cx.tcx,
method_types.(i)));
i += 1u;
}
// Write in the types of the object fields.
//
// FIXME: We want to use uint::range() here, but that causes
// an assertion in trans.
let args = ty::ty_fn_args(cx.tcx, tpt.ty);
i = 0u;
while i < ivec::len[ty::arg](args) {
let fld = object.fields.(i);
write::ty_only(cx.tcx, fld.id, args.(i).ty);
i += 1u;
}
}
ast::item_res(f, dtor_id, tps, ctor_id) {
let t_arg = ty_of_arg(cx, f.decl.inputs.(0));
let t_res =
ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
mk_ty_params(cx, tps));
let t_ctor =
ty::mk_fn(cx.tcx, ast::proto_fn, ~[t_arg], t_res, ast::return,
~[]);
let t_dtor =
ty::mk_fn(cx.tcx, ast::proto_fn, ~[t_arg], ty::mk_nil(cx.tcx),
ast::return, ~[]);
write::ty_only(cx.tcx, it.id, t_res);
write::ty_only(cx.tcx, ctor_id, t_ctor);
cx.tcx.tcache.insert(local_def(ctor_id),
{kinds: ty_param_kinds(tps), ty: t_ctor});
write::ty_only(cx.tcx, dtor_id, t_dtor);
}
_ {
// This call populates the type cache with the converted type
// of the item in passing. All we have to do here is to write
// it into the node type table.
let tpt = ty_of_item(cx, it);
write::ty_only(cx.tcx, it.id, tpt.ty);
}
}
}
fn convert_native(cx: @ctxt, abi: @mutable option::t[ast::native_abi],
i: &@ast::native_item) {
// As above, this call populates the type table with the converted
// type of the native item. We simply write it into the node type
// table.
let tpt =
ty_of_native_item(cx, i, option::get[ast::native_abi]({ *abi }));
alt i.node {
ast::native_item_ty. {
// FIXME: Native types have no annotation. Should they? --pcw
}
ast::native_item_fn(_, _, _) {
write::ty_only(cx.tcx, i.id, tpt.ty);
}
}
}
fn collect_item_types(tcx: &ty::ctxt, crate: &@ast::crate) {
// We have to propagate the surrounding ABI to the native items
// contained within the native module.
let abi = @mutable none[ast::native_abi];
let cx = @{tcx: tcx};
let visit = visit::mk_simple_visitor
(@{visit_item: bind convert(cx, abi, _),
visit_native_item: bind convert_native(cx, abi, _)
with *visit::default_simple_visitor()});
visit::visit_crate(*crate, (), visit);
}
}
// Type unification
// TODO: rename to just "unify"
mod unify {
fn simple(fcx: &@fn_ctxt, expected: &ty::t, actual: &ty::t) ->
ty::unify::result {
ret ty::unify::unify(expected, actual, fcx.var_bindings, fcx.ccx.tcx);
}
}
tag autoderef_kind { AUTODEREF_OK; NO_AUTODEREF; AUTODEREF_BLOCK_COERCE; }
// FIXME This is almost a duplicate of ty::type_autoderef, with structure_of
// instead of ty::struct.
fn do_autoderef(fcx: &@fn_ctxt, sp: &span, t: &ty::t) -> ty::t {
let t1 = t;
while true {
alt structure_of(fcx, sp, t1) {
ty::ty_box(inner) { t1 = inner.ty; }
ty::ty_res(_, inner, tps) {
t1 = ty::substitute_type_params(fcx.ccx.tcx, tps, inner);
}
ty::ty_tag(did, tps) {
let variants = ty::tag_variants(fcx.ccx.tcx, did);
if ivec::len(variants) != 1u || ivec::len(variants.(0).args) != 1u
{
ret t1;
}
t1 =
ty::substitute_type_params(fcx.ccx.tcx, tps,
variants.(0).args.(0));
}
_ { ret t1; }
}
}
fail;
}
fn add_boxes(ccx: &@crate_ctxt, n: uint, t: &ty::t) -> ty::t {
let t1 = t;
while n != 0u { t1 = ty::mk_imm_box(ccx.tcx, t1); n -= 1u; }
ret t1;
}
fn count_boxes(fcx: &@fn_ctxt, sp: &span, t: &ty::t) -> uint {
let n = 0u;
let t1 = t;
while true {
alt structure_of(fcx, sp, t1) {
ty::ty_box(inner) { n += 1u; t1 = inner.ty; }
_ { ret n; }
}
}
fail;
}
fn do_fn_block_coerce(fcx: &@fn_ctxt, sp: &span, actual: &ty::t,
expected: &ty::t) -> ty::t {
// fns can be silently coerced to blocks when being used as
// function call or bind arguments, but not the reverse.
// If our actual type is a fn and our expected type is a block,
// build up a new expected type that is identical to the old one
// except for its proto. If we don't know the expected or actual
// types, that's fine, but we can't do the coercion.
ret alt structure_of_maybe(fcx, sp, actual) {
some(ty::ty_fn(ast::proto_fn., args, ret_ty, cf, constrs)) {
alt structure_of_maybe(fcx, sp, expected) {
some(ty::ty_fn(ast::proto_block., _, _, _, _)) {
ty::mk_fn(fcx.ccx.tcx, ast::proto_block, args, ret_ty, cf,
constrs)
}
_ { actual }
}
}
_ { actual }
}
}
fn resolve_type_vars_if_possible(fcx: &@fn_ctxt, typ: ty::t) -> ty::t {
alt ty::unify::fixup_vars(fcx.ccx.tcx, fcx.var_bindings, typ) {
fix_ok(new_type) { ret new_type; }
fix_err(_) { ret typ; }
}
}
// Demands - procedures that require that two types unify and emit an error
// message if they don't.
type ty_param_substs_and_ty = {substs: ty::t[], ty: ty::t};
mod demand {
fn simple(fcx: &@fn_ctxt, sp: &span, expected: &ty::t, actual: &ty::t) ->
ty::t {
ret full(fcx, sp, expected, actual, ~[], NO_AUTODEREF).ty;
}
fn autoderef(fcx: &@fn_ctxt, sp: &span, expected: &ty::t, actual: &ty::t,
adk: autoderef_kind) -> ty::t {
ret full(fcx, sp, expected, actual, ~[], adk).ty;
}
// Requires that the two types unify, and prints an error message if they
// don't. Returns the unified type and the type parameter substitutions.
fn full(fcx: &@fn_ctxt, sp: &span, expected: &ty::t, actual: &ty::t,
ty_param_substs_0: &ty::t[], adk: autoderef_kind) ->
ty_param_substs_and_ty {
let expected_1 = expected;
let actual_1 = actual;
let implicit_boxes = 0u;
if adk == AUTODEREF_OK {
expected_1 = do_autoderef(fcx, sp, expected_1);
actual_1 = do_autoderef(fcx, sp, actual_1);
implicit_boxes = count_boxes(fcx, sp, actual);
} else if (adk == AUTODEREF_BLOCK_COERCE) {
actual_1 = do_fn_block_coerce(fcx, sp, actual, expected);
}
let ty_param_substs: ty::t[mutable ] = ~[mutable ];
let ty_param_subst_var_ids: int[] = ~[];
for ty_param_subst: ty::t in ty_param_substs_0 {
// Generate a type variable and unify it with the type parameter
// substitution. We will then pull out these type variables.
let t_0 = next_ty_var(fcx);
ty_param_substs += ~[mutable t_0];
ty_param_subst_var_ids += ~[ty::ty_var_id(fcx.ccx.tcx, t_0)];
simple(fcx, sp, ty_param_subst, t_0);
}
fn mk_result(fcx: &@fn_ctxt, result_ty: &ty::t,
ty_param_subst_var_ids: &int[], implicit_boxes: uint) ->
ty_param_substs_and_ty {
let result_ty_param_substs: ty::t[] = ~[];
for var_id: int in ty_param_subst_var_ids {
let tp_subst = ty::mk_var(fcx.ccx.tcx, var_id);
result_ty_param_substs += ~[tp_subst];
}
ret {substs: result_ty_param_substs,
ty: add_boxes(fcx.ccx, implicit_boxes, result_ty)};
}
alt unify::simple(fcx, expected_1, actual_1) {
ures_ok(t) {
ret mk_result(fcx, t, ty_param_subst_var_ids, implicit_boxes);
}
ures_err(err) {
let e_err = resolve_type_vars_if_possible(fcx, expected_1);
let a_err = resolve_type_vars_if_possible(fcx, actual_1);
fcx.ccx.tcx.sess.span_err(sp,
"mismatched types: expected " +
ty_to_str(fcx.ccx.tcx, e_err) +
" but found " +
ty_to_str(fcx.ccx.tcx, a_err) + " ("
+ ty::type_err_to_str(err) + ")");
ret mk_result(fcx, expected_1, ty_param_subst_var_ids,
implicit_boxes);
}
}
}
}
// Returns true if the two types unify and false if they don't.
fn are_compatible(fcx: &@fn_ctxt, expected: &ty::t, actual: &ty::t) -> bool {
alt unify::simple(fcx, expected, actual) {
ures_ok(_) { ret true; }
ures_err(_) { ret false; }
}
}
// Returns the types of the arguments to a tag variant.
fn variant_arg_types(ccx: &@crate_ctxt, sp: &span, vid: &ast::def_id,
tag_ty_params: &ty::t[]) -> ty::t[] {
let result: ty::t[] = ~[];
let tpt = ty::lookup_item_type(ccx.tcx, vid);
alt ty::struct(ccx.tcx, tpt.ty) {
ty::ty_fn(_, ins, _, _, _) {
// N-ary variant.
for arg: ty::arg in ins {
let arg_ty =
ty::substitute_type_params(ccx.tcx, tag_ty_params, arg.ty);
result += ~[arg_ty];
}
}
_ {
// Nullary variant. Do nothing, as there are no arguments.
}
}
/* result is a vector of the *expected* types of all the fields */
ret result;
}
// Type resolution: the phase that finds all the types in the AST with
// unresolved type variables and replaces "ty_var" types with their
// substitutions.
//
// TODO: inefficient since not all types have vars in them. It would be better
// to maintain a list of fixups.
mod writeback {
export resolve_type_vars_in_block;
fn resolve_type_vars_in_type(fcx: &@fn_ctxt, sp: &span, typ: ty::t) ->
option::t[ty::t] {
if !ty::type_contains_vars(fcx.ccx.tcx, typ) { ret some(typ); }
alt ty::unify::fixup_vars(fcx.ccx.tcx, fcx.var_bindings, typ) {
fix_ok(new_type) { ret some(new_type); }
fix_err(vid) {
fcx.ccx.tcx.sess.span_err(sp,
"cannot determine a type \
for this expression");
ret none;
}
}
}
fn resolve_type_vars_for_node(wbcx: &wb_ctxt, sp: &span,
id: ast::node_id) {
let fcx = wbcx.fcx;
let tpot = ty::node_id_to_ty_param_substs_opt_and_ty(fcx.ccx.tcx, id);
let new_ty =
alt resolve_type_vars_in_type(fcx, sp, tpot.ty) {
some(t) { t }
none. { wbcx.success = false; ret }
};
let new_substs_opt;
alt tpot.substs {
none[ty::t[]]. { new_substs_opt = none[ty::t[]]; }
some[ty::t[]](substs) {
let new_substs: ty::t[] = ~[];
for subst: ty::t in substs {
alt resolve_type_vars_in_type(fcx, sp, subst) {
some(t) { new_substs += ~[t]; }
none. { wbcx.success = false; ret; }
}
}
new_substs_opt = some[ty::t[]](new_substs);
}
}
write::ty(fcx.ccx.tcx, id, {substs: new_substs_opt, ty: new_ty});
}
type wb_ctxt =
// As soon as we hit an error we have to stop resolving
// the entire function
{fcx: @fn_ctxt, mutable success: bool};
type wb_vt = visit::vt[wb_ctxt];
fn visit_stmt(s: &@ast::stmt, wbcx: &wb_ctxt, v: &wb_vt) {
if !wbcx.success { ret; }
resolve_type_vars_for_node(wbcx, s.span, ty::stmt_node_id(s));
visit::visit_stmt(s, wbcx, v);
}
fn visit_expr(e: &@ast::expr, wbcx: &wb_ctxt, v: &wb_vt) {
if !wbcx.success { ret; }
resolve_type_vars_for_node(wbcx, e.span, e.id);
visit::visit_expr(e, wbcx, v);
}
fn visit_block(b: &ast::blk, wbcx: &wb_ctxt, v: &wb_vt) {
if !wbcx.success { ret; }
resolve_type_vars_for_node(wbcx, b.span, b.node.id);
visit::visit_block(b, wbcx, v);
}
fn visit_pat(p: &@ast::pat, wbcx: &wb_ctxt, v: &wb_vt) {
if !wbcx.success { ret; }
resolve_type_vars_for_node(wbcx, p.span, p.id);
visit::visit_pat(p, wbcx, v);
}
fn visit_local(l: &@ast::local, wbcx: &wb_ctxt, v: &wb_vt) {
if !wbcx.success { ret; }
let var_id = lookup_local(wbcx.fcx, l.span, l.node.id);
let fix_rslt =
ty::unify::resolve_type_var(wbcx.fcx.ccx.tcx,
wbcx.fcx.var_bindings, var_id);
alt fix_rslt {
fix_ok(lty) { write::ty_only(wbcx.fcx.ccx.tcx, l.node.id, lty); }
fix_err(_) {
wbcx.fcx.ccx.tcx.sess.span_err(l.span,
"cannot determine a type \
for this local variable");
wbcx.success = false;
}
}
visit::visit_local(l, wbcx, v);
}
fn visit_item(item: &@ast::item, wbcx: &wb_ctxt, v: &wb_vt) {
// Ignore items
}
fn visit_fn(f: &ast::_fn, tps: &ast::ty_param[],
sp: &span, i: &ast::fn_ident, d: ast::node_id,
wbcx: &wb_ctxt, v: &wb_vt) {
// Ignore fns
}
fn resolve_type_vars_in_block(fcx: &@fn_ctxt, blk: &ast::blk) -> bool {
let wbcx = {fcx: fcx, mutable success: true};
let visit = visit::mk_vt
(@{visit_item: visit_item,
visit_fn: visit_fn,
visit_stmt: visit_stmt,
visit_expr: visit_expr,
visit_block: visit_block,
visit_pat: visit_pat,
visit_local: visit_local
with *visit::default_visitor()});
visit::visit_block(blk, wbcx, visit);
ret wbcx.success;
}
}
// Local variable gathering. We gather up all locals and create variable IDs
// for them before typechecking the function.
type gather_result =
{var_bindings: @ty::unify::var_bindings,
locals: hashmap[ast::node_id, int],
local_names: hashmap[ast::node_id, ast::ident],
next_var_id: @mutable int};
// Used only as a helper for check_fn.
fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
old_fcx: &option::t[@fn_ctxt]) -> gather_result {
fn next_var_id(nvi: @mutable int) -> int {
let rv = *nvi;
*nvi += 1;
ret rv;
}
fn assign(tcx: &ty::ctxt, var_bindings: &@ty::unify::var_bindings,
locals: &hashmap[ast::node_id, int],
local_names: &hashmap[ast::node_id, ast::ident],
nvi: @mutable int, nid: ast::node_id, ident: &ast::ident,
ty_opt: option::t[ty::t]) {
let var_id = next_var_id(nvi);
locals.insert(nid, var_id);
local_names.insert(nid, ident);
alt ty_opt {
none[ty::t]. {/* nothing to do */ }
some[ty::t](typ) {
ty::unify::unify(ty::mk_var(tcx, var_id), typ, var_bindings, tcx);
}
}
}
let vb;
let locals;
let local_names;
let nvi;
alt old_fcx {
none. {
vb = ty::unify::mk_var_bindings();
locals = new_int_hash[int]();
local_names = new_int_hash[ast::ident]();
nvi = @mutable 0;
}
some(fcx) {
vb = fcx.var_bindings;
locals = fcx.locals;
local_names = fcx.local_names;
nvi = fcx.next_var_id;
}
}
// Add object fields, if any.
let obj_fields = ~[];
alt get_obj_info(ccx) {
some(oinfo) {
alt oinfo {
regular_obj(ofs, _) { obj_fields = ofs; }
anon_obj(ofs, _) { obj_fields = ofs; }
}
}
none. {/* no fields */ }
}
for f: ast::obj_field in obj_fields {
let field_ty = ty::node_id_to_type(ccx.tcx, f.id);
assign(ccx.tcx, vb, locals, local_names, nvi, f.id, f.ident,
some(field_ty));
}
// Add formal parameters.
let args = ty::ty_fn_args(ccx.tcx, ty::node_id_to_type(ccx.tcx, id));
let i = 0u;
for arg: ty::arg in args {
assign(ccx.tcx, vb, locals, local_names, nvi, f.decl.inputs.(i).id,
f.decl.inputs.(i).ident, some[ty::t](arg.ty));
i += 1u;
}
// Add explicitly-declared locals.
fn visit_local(ccx: @crate_ctxt, vb: @ty::unify::var_bindings,
locals: hashmap[ast::node_id, int],
local_names: hashmap[ast::node_id, ast::ident],
nvi: @mutable int, local: &@ast::local, e: &(),
v: &visit::vt[()]) {
alt local.node.ty {
none. {
// Auto slot.
assign(ccx.tcx, vb, locals, local_names, nvi, local.node.id,
ident_for_local(local), none);
}
some(ast_ty) {
// Explicitly typed slot.
let local_ty = ast_ty_to_ty_crate(ccx, ast_ty);
assign(ccx.tcx, vb, locals, local_names, nvi, local.node.id,
ident_for_local(local), some(local_ty));
}
}
visit::visit_local(local, e, v);
}
// Add pattern bindings.
fn visit_pat(ccx: @crate_ctxt, vb: @ty::unify::var_bindings,
locals: hashmap[ast::node_id, int],
local_names: hashmap[ast::node_id, ast::ident],
nvi: @mutable int, p: &@ast::pat, e: &(),
v: &visit::vt[()]) {
alt p.node {
ast::pat_bind(ident) {
assign(ccx.tcx, vb, locals, local_names, nvi, p.id, ident, none);
}
_ {/* no-op */ }
}
visit::visit_pat(p, e, v);
}
// Don't descend into fns and items
fn visit_fn[E](f: &ast::_fn, tp: &ast::ty_param[], sp: &span,
i: &ast::fn_ident, id: ast::node_id, e: &E,
v: &visit::vt[E]) {
}
fn visit_item[E](i: &@ast::item, e: &E, v: &visit::vt[E]) { }
let visit =
@{visit_local:
bind visit_local(ccx, vb, locals, local_names, nvi, _, _, _),
visit_pat:
bind visit_pat(ccx, vb, locals, local_names, nvi, _, _, _),
visit_fn: visit_fn,
visit_item: visit_item with *visit::default_visitor()};
visit::visit_block(f.body, (), visit::mk_vt(visit));
ret {var_bindings: vb,
locals: locals,
local_names: local_names,
next_var_id: nvi};
}
// AST fragment checking
fn check_lit(ccx: @crate_ctxt, lit: &@ast::lit) -> ty::t {
alt lit.node {
ast::lit_str(_, ast::sk_rc.) { ret ty::mk_str(ccx.tcx); }
ast::lit_str(_, ast::sk_unique.) { ret ty::mk_istr(ccx.tcx); }
ast::lit_char(_) { ret ty::mk_char(ccx.tcx); }
ast::lit_int(_) { ret ty::mk_int(ccx.tcx); }
ast::lit_float(_) { ret ty::mk_float(ccx.tcx); }
ast::lit_mach_float(tm, _) { ret ty::mk_mach(ccx.tcx, tm); }
ast::lit_uint(_) { ret ty::mk_uint(ccx.tcx); }
ast::lit_mach_int(tm, _) { ret ty::mk_mach(ccx.tcx, tm); }
ast::lit_nil. { ret ty::mk_nil(ccx.tcx); }
ast::lit_bool(_) { ret ty::mk_bool(ccx.tcx); }
}
}
// Pattern checking is top-down rather than bottom-up so that bindings get
// their types immediately.
fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat,
expected: ty::t) {
alt pat.node {
ast::pat_wild. { write::ty_only_fixup(fcx, pat.id, expected); }
ast::pat_lit(lt) {
let typ = check_lit(fcx.ccx, lt);
typ = demand::simple(fcx, pat.span, expected, typ);
write::ty_only_fixup(fcx, pat.id, typ);
}
ast::pat_bind(name) {
let vid = lookup_local(fcx, pat.span, pat.id);
let typ = ty::mk_var(fcx.ccx.tcx, vid);
typ = demand::simple(fcx, pat.span, expected, typ);
let canon_id = map.get(name);
if canon_id != pat.id {
let ct =
ty::mk_var(fcx.ccx.tcx,
lookup_local(fcx, pat.span, canon_id));
typ = demand::simple(fcx, pat.span, ct, typ);
}
write::ty_only_fixup(fcx, pat.id, typ);
}
ast::pat_tag(path, subpats) {
// Typecheck the path.
let v_def = lookup_def(fcx, path.span, pat.id);
let v_def_ids = ast::variant_def_ids(v_def);
let tag_tpt = ty::lookup_item_type(fcx.ccx.tcx, v_def_ids.tg);
let path_tpot = instantiate_path(fcx, path, tag_tpt, pat.span);
// Take the tag type params out of `expected`.
alt structure_of(fcx, pat.span, expected) {
ty::ty_tag(_, expected_tps) {
// Unify with the expected tag type.
let ctor_ty =
ty::ty_param_substs_opt_and_ty_to_monotype(fcx.ccx.tcx,
path_tpot);
let path_tpt =
demand::full(fcx, pat.span, expected, ctor_ty, expected_tps,
NO_AUTODEREF);
path_tpot =
{substs: some[ty::t[]](path_tpt.substs), ty: path_tpt.ty};
// Get the number of arguments in this tag variant.
let arg_types =
variant_arg_types(fcx.ccx, pat.span, v_def_ids.var,
expected_tps);
let subpats_len = std::ivec::len[@ast::pat](subpats);
if std::ivec::len[ty::t](arg_types) > 0u {
// N-ary variant.
let arg_len = ivec::len[ty::t](arg_types);
if arg_len != subpats_len {
// TODO: note definition of tag variant
// TODO (issue #448): Wrap a #fmt string over multiple
// lines...
let s =
#fmt("this pattern has %u field%s, but the \
corresponding variant has %u field%s",
subpats_len,
if subpats_len == 1u { "" } else { "s" },
arg_len, if arg_len == 1u { "" } else { "s" });
fcx.ccx.tcx.sess.span_fatal(pat.span, s);
}
// TODO: ivec::iter2
let i = 0u;
for subpat: @ast::pat in subpats {
check_pat(fcx, map, subpat, arg_types.(i));
i += 1u;
}
} else if (subpats_len > 0u) {
// TODO: note definition of tag variant
// TODO (issue #448): Wrap a #fmt string over multiple
// lines...
fcx.ccx.tcx.sess.span_fatal
(pat.span, #fmt("this pattern has %u field%s, \
but the corresponding \
variant has no fields",
subpats_len,
if subpats_len == 1u { "" }
else { "s" }));
}
write::ty_fixup(fcx, pat.id, path_tpot);
}
_ {
// FIXME: Switch expected and actual in this message? I
// can never tell.
fcx.ccx.tcx.sess.span_fatal(pat.span,
#fmt("mismatched types: \
expected %s, found tag",
ty_to_str(fcx.ccx.tcx,
expected)));
}
}
write::ty_fixup(fcx, pat.id, path_tpot);
}
ast::pat_rec(fields, etc) {
let ex_fields;
alt structure_of(fcx, pat.span, expected) {
ty::ty_rec(fields) { ex_fields = fields; }
_ {
fcx.ccx.tcx.sess.span_fatal(pat.span,
#fmt("mismatched types: expected %s, \
found record",
ty_to_str(fcx.ccx.tcx,
expected)));
}
}
let f_count = ivec::len(fields);
let ex_f_count = ivec::len(ex_fields);
if ex_f_count < f_count || !etc && ex_f_count > f_count {
fcx.ccx.tcx.sess.span_fatal
(pat.span, #fmt("mismatched types: expected a record \
with %u fields, found one with %u \
fields", ex_f_count, f_count));
}
fn matches(name: &str, f: &ty::field) -> bool {
ret str::eq(name, f.ident);
}
for f: ast::field_pat in fields {
alt ivec::find(bind matches(f.ident, _), ex_fields) {
some(field) { check_pat(fcx, map, f.pat, field.mt.ty); }
none. {
fcx.ccx.tcx.sess.span_fatal(pat.span,
#fmt("mismatched types: did not \
expect a record with a field %s",
f.ident));
}
}
}
write::ty_only_fixup(fcx, pat.id, expected);
}
ast::pat_box(inner) {
alt structure_of(fcx, pat.span, expected) {
ty::ty_box(e_inner) {
check_pat(fcx, map, inner, e_inner.ty);
write::ty_only_fixup(fcx, pat.id, expected);
}
_ {
fcx.ccx.tcx.sess.span_fatal(pat.span,
"mismatched types: expected " +
ty_to_str(fcx.ccx.tcx, expected) +
" found box");
}
}
}
}
}
fn require_impure(sess: &session::session, f_purity: &ast::purity,
sp: &span) {
alt f_purity {
ast::impure_fn. { ret; }
ast::pure_fn. {
sess.span_fatal(sp, "Found impure expression in pure function decl");
}
}
}
fn require_pure_call(ccx: @crate_ctxt, caller_purity: &ast::purity,
callee: &@ast::expr, sp: &span) {
alt caller_purity {
ast::impure_fn. { ret; }
ast::pure_fn. {
alt ccx.tcx.def_map.find(callee.id) {
some(ast::def_fn(_, ast::pure_fn.)) { ret; }
_ {
ccx.tcx.sess.span_fatal
(sp, "Pure function calls function not known to be pure");
}
}
}
}
}
fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) -> bool {
// fcx.ccx.tcx.sess.span_warn(expr.span, "typechecking expr " +
// syntax::print::pprust::expr_to_str(expr));
// A generic function to factor out common logic from call and bind
// expressions.
fn check_call_or_bind(fcx: &@fn_ctxt, sp: &span, f: &@ast::expr,
args: &(option::t[@ast::expr])[],
call_kind: call_kind) -> bool {
// Check the function.
let bot = check_expr(fcx, f);
// Get the function type.
let fty = expr_ty(fcx.ccx.tcx, f);
// We want to autoderef calls but not binds
let fty_stripped =
alt call_kind {
kind_call. { do_autoderef(fcx, sp, fty) }
_ { fty }
};
let sty = structure_of(fcx, sp, fty_stripped);
// Check that we aren't confusing iter calls and fn calls
alt sty {
ty::ty_fn(ast::proto_iter., _, _, _, _) {
if call_kind != kind_for_each {
fcx.ccx.tcx.sess.span_err(
sp, "calling iter outside of for each loop");
}
}
_ {
if call_kind == kind_for_each {
fcx.ccx.tcx.sess.span_err(
sp, "calling non-iter as sequence of for each loop");
}
}
}
// Grab the argument types
let arg_tys;
alt sty {
ty::ty_fn(_, arg_tys_0, _, _, _) |
ty::ty_native_fn(_, arg_tys_0, _) { arg_tys = arg_tys_0; }
_ {
fcx.ccx.tcx.sess.span_fatal(f.span,
"mismatched types: \
expected function or native \
function but found "
+ ty_to_str(fcx.ccx.tcx, fty));
}
}
// Check that the correct number of arguments were supplied.
let expected_arg_count = ivec::len[ty::arg](arg_tys);
let supplied_arg_count = ivec::len[option::t[@ast::expr]](args);
if expected_arg_count != supplied_arg_count {
fcx.ccx.tcx.sess.span_fatal(sp,
#fmt("this function takes %u \
parameter%s but %u parameter%s \
supplied",
expected_arg_count,
if expected_arg_count == 1u {
""
} else { "s" },
supplied_arg_count,
if supplied_arg_count == 1u {
" was"
} else { "s were" }));
}
// Check the arguments.
// TODO: iter2
let i = 0u;
for a_opt: option::t[@ast::expr] in args {
alt a_opt {
some(a) {
bot |= check_expr(fcx, a);
demand::full(fcx, a.span, arg_tys.(i).ty,
expr_ty(fcx.ccx.tcx, a), ~[],
AUTODEREF_BLOCK_COERCE);
}
none. { }
}
i += 1u;
}
ret bot;
}
// A generic function for checking assignment expressions
fn check_assignment(fcx: &@fn_ctxt, sp: &span, lhs: &@ast::expr,
rhs: &@ast::expr, id: &ast::node_id) -> bool {
let bot = check_expr(fcx, lhs) | check_expr(fcx, rhs);
demand::simple(fcx, sp, expr_ty(fcx.ccx.tcx, lhs),
expr_ty(fcx.ccx.tcx, rhs));
write::ty_only_fixup(fcx, id, ty::mk_nil(fcx.ccx.tcx));
ret bot;
}
// A generic function for checking call expressions
fn check_call(fcx: &@fn_ctxt, sp: &span, f: &@ast::expr,
args: &(@ast::expr)[], call_kind: call_kind) -> bool {
let args_opt_0: (option::t[@ast::expr])[] = ~[];
for arg: @ast::expr in args {
args_opt_0 += ~[some[@ast::expr](arg)];
}
// Call the generic checker.
ret check_call_or_bind(fcx, sp, f, args_opt_0, call_kind);
}
// A generic function for doing all of the checking for call expressions
fn check_call_full(fcx: &@fn_ctxt, sp: &span, f: &@ast::expr,
args: &(@ast::expr)[], call_kind: call_kind,
id: ast::node_id) -> bool {
/* here we're kind of hosed, as f can be any expr
need to restrict it to being an explicit expr_path if we're
inside a pure function, and need an environment mapping from
function name onto purity-designation */
require_pure_call(fcx.ccx, fcx.purity, f, sp);
let bot = check_call(fcx, sp, f, args, call_kind);
// Pull the return type out of the type of the function.
let rt_1;
let fty = do_autoderef(fcx, sp, ty::expr_ty(fcx.ccx.tcx, f));
alt structure_of(fcx, sp, fty) {
ty::ty_fn(_, _, rt, cf, _) {
bot |= cf == ast::noreturn;
rt_1 = rt;
}
ty::ty_native_fn(_, _, rt) { rt_1 = rt; }
_ { fail "LHS of call expr didn't have a function type?!"; }
}
write::ty_only_fixup(fcx, id, rt_1);
ret bot;
}
// A generic function for checking for or for-each loops
fn check_for_or_for_each(fcx: &@fn_ctxt, local: &@ast::local,
element_ty: ty::t, body: &ast::blk,
node_id: ast::node_id) -> bool {
let locid = lookup_local(fcx, local.span, local.node.id);
element_ty = demand::simple(fcx, local.span, element_ty,
ty::mk_var(fcx.ccx.tcx, locid));
let bot = check_decl_local(fcx, local);
check_block(fcx, body);
// Unify type of decl with element type of the seq
demand::simple(fcx, local.span,
ty::node_id_to_type(fcx.ccx.tcx, local.node.id),
element_ty);
let typ = ty::mk_nil(fcx.ccx.tcx);
write::ty_only_fixup(fcx, node_id, typ);
ret bot;
}
// A generic function for checking the pred in a check
// or if-check
fn check_pred_expr(fcx: &@fn_ctxt, e: &@ast::expr) -> bool {
let bot = check_expr(fcx, e);
demand::simple(fcx, e.span, ty::mk_bool(fcx.ccx.tcx),
expr_ty(fcx.ccx.tcx, e));
/* e must be a call expr where all arguments are either
literals or slots */
alt e.node {
ast::expr_call(operator, operands) {
alt operator.node {
ast::expr_path(oper_name) {
alt fcx.ccx.tcx.def_map.find(operator.id) {
some(ast::def_fn(_, ast::pure_fn.)) {
// do nothing
}
_ {
fcx.ccx.tcx.sess.span_fatal(operator.span,
"non-predicate as operator \
in constraint");
}
}
for operand: @ast::expr in operands {
if !ast::is_constraint_arg(operand) {
let s =
"Constraint args must be \
slot variables or literals";
fcx.ccx.tcx.sess.span_fatal(e.span, s);
}
}
}
_ {
let s =
"In a constraint, expected the \
constraint name to be an explicit name";
fcx.ccx.tcx.sess.span_fatal(e.span, s);
}
}
}
_ { fcx.ccx.tcx.sess.span_fatal(e.span, "check on non-predicate"); }
}
ret bot;
}
// A generic function for checking the then and else in an if
// or if-check
fn check_then_else(fcx: &@fn_ctxt, thn: &ast::blk,
elsopt: &option::t[@ast::expr], id: ast::node_id,
sp: &span) -> bool {
let then_bot = check_block(fcx, thn);
let els_bot = false;
let if_t =
alt elsopt {
some(els) {
els_bot = check_expr(fcx, els);
let thn_t = block_ty(fcx.ccx.tcx, thn);
let elsopt_t = expr_ty(fcx.ccx.tcx, els);
demand::simple(fcx, sp, thn_t, elsopt_t);
if !ty::type_is_bot(fcx.ccx.tcx, elsopt_t) {
elsopt_t
} else { thn_t }
}
none. { ty::mk_nil(fcx.ccx.tcx) }
};
write::ty_only_fixup(fcx, id, if_t);
ret then_bot & els_bot;
}
// Checks the compatibility
fn check_binop_type_compat(fcx: &@fn_ctxt, span: span, ty: ty::t,
binop: ast::binop) {
let resolved_t = resolve_type_vars_if_possible(fcx, ty);
if !ty::is_binopable(fcx.ccx.tcx, resolved_t, binop) {
let binopstr = ast::binop_to_str(binop);
let t_str = ty_to_str(fcx.ccx.tcx, resolved_t);
let errmsg =
"binary operation " + binopstr +
" cannot be applied to type `" + t_str + "`";
fcx.ccx.tcx.sess.span_fatal(span, errmsg);
}
}
let tcx = fcx.ccx.tcx;
let id = expr.id;
let bot = false;
alt expr.node {
ast::expr_lit(lit) {
let typ = check_lit(fcx.ccx, lit);
write::ty_only_fixup(fcx, id, typ);
}
ast::expr_binary(binop, lhs, rhs) {
bot = check_expr(fcx, lhs);
if ast::lazy_binop(binop) {
check_expr(fcx, rhs);
} else {
bot |= check_expr(fcx, rhs);
}
let lhs_t = expr_ty(tcx, lhs);
let rhs_t = expr_ty(tcx, rhs);
demand::autoderef(fcx, rhs.span, lhs_t, rhs_t, AUTODEREF_OK);
let deref_t = do_autoderef(fcx, expr.span, lhs_t);
check_binop_type_compat(fcx, expr.span, deref_t, binop);
let t =
alt binop {
ast::eq. { ty::mk_bool(tcx) }
ast::lt. { ty::mk_bool(tcx) }
ast::le. { ty::mk_bool(tcx) }
ast::ne. { ty::mk_bool(tcx) }
ast::ge. { ty::mk_bool(tcx) }
ast::gt. { ty::mk_bool(tcx) }
_ { deref_t }
};
write::ty_only_fixup(fcx, id, t);
}
ast::expr_unary(unop, oper) {
bot = check_expr(fcx, oper);
let oper_t = expr_ty(tcx, oper);
alt unop {
ast::box(mut) {
oper_t = ty::mk_box(tcx, {ty: oper_t, mut: mut});
}
ast::deref. {
alt structure_of(fcx, expr.span, oper_t) {
ty::ty_box(inner) { oper_t = inner.ty; }
ty::ty_res(_, inner, _) { oper_t = inner; }
ty::ty_tag(id, tps) {
let variants = ty::tag_variants(tcx, id);
if ivec::len(variants) != 1u ||
ivec::len(variants.(0).args) != 1u {
tcx.sess.span_fatal
(expr.span, "can only dereference tags " +
"with a single variant which has a "
+ "single argument");
}
oper_t =
ty::substitute_type_params(tcx, tps,
variants.(0).args.(0));
}
ty::ty_ptr(inner) { oper_t = inner.ty; }
_ {
tcx.sess.span_fatal(expr.span,
"dereferencing non-" +
"dereferenceable type: " +
ty_to_str(tcx, oper_t));
}
}
}
ast::not. {
if !type_is_integral(fcx, oper.span, oper_t) &&
structure_of(fcx, oper.span, oper_t) != ty::ty_bool {
tcx.sess.span_fatal(expr.span,
#fmt("mismatched types: expected bool \
or integer but found %s",
ty_to_str(tcx, oper_t)));
}
}
_ { oper_t = do_autoderef(fcx, expr.span, oper_t); }
}
write::ty_only_fixup(fcx, id, oper_t);
}
ast::expr_path(pth) {
let defn = lookup_def(fcx, pth.span, id);
let tpt = ty_param_kinds_and_ty_for_def(fcx, expr.span, defn);
if ty::def_has_ty_params(defn) {
let path_tpot = instantiate_path(fcx, pth, tpt, expr.span);
write::ty_fixup(fcx, id, path_tpot);
ret false;
}
// The definition doesn't take type parameters. If the programmer
// supplied some, that's an error.
if ivec::len[@ast::ty](pth.node.types) > 0u {
tcx.sess.span_fatal(expr.span,
"this kind of value does not \
take type parameters");
}
write::ty_only_fixup(fcx, id, tpt.ty);
}
ast::expr_mac(_) { tcx.sess.bug("unexpanded macro"); }
ast::expr_fail(expr_opt) {
bot = true;
alt expr_opt {
none. {/* do nothing */ }
some(e) {
check_expr(fcx, e);
let ety = expr_ty(tcx, e);
demand::simple(fcx, e.span, ty::mk_str(tcx), ety);
}
}
write::bot_ty(tcx, id);
}
ast::expr_break. { write::bot_ty(tcx, id); bot = true; }
ast::expr_cont. { write::bot_ty(tcx, id); bot = true; }
ast::expr_ret(expr_opt) {
bot = true;
alt expr_opt {
none. {
let nil = ty::mk_nil(tcx);
if !are_compatible(fcx, fcx.ret_ty, nil) {
tcx.sess.span_fatal(expr.span,
"ret; in function returning non-nil");
}
write::bot_ty(tcx, id);
}
some(e) {
check_expr(fcx, e);
demand::simple(fcx, expr.span, fcx.ret_ty,
expr_ty(tcx, e));
write::bot_ty(tcx, id);
}
}
}
ast::expr_put(expr_opt) {
require_impure(tcx.sess, fcx.purity, expr.span);
if (fcx.proto != ast::proto_iter) {
tcx.sess.span_fatal(expr.span, "put in non-iterator");
}
alt expr_opt {
none. {
let nil = ty::mk_nil(tcx);
if !are_compatible(fcx, fcx.ret_ty, nil) {
tcx.sess.span_fatal(expr.span,
"put; in iterator yielding non-nil");
}
}
some(e) {
bot = check_expr(fcx, e);
demand::simple(fcx, expr.span, fcx.ret_ty,
expr_ty(tcx, e));
}
}
write::nil_ty(tcx, id);
}
ast::expr_be(e) {
// FIXME: prove instead of assert
assert (ast::is_call_expr(e));
check_expr(fcx, e);
bot = true;
demand::simple(fcx, e.span, fcx.ret_ty, expr_ty(tcx, e));
write::nil_ty(tcx, id);
}
ast::expr_log(l, e) {
bot = check_expr(fcx, e);
write::nil_ty(tcx, id);
}
ast::expr_check(_, e) {
bot = check_pred_expr(fcx, e);
write::nil_ty(tcx, id);
}
ast::expr_if_check(cond, thn, elsopt) {
bot = check_pred_expr(fcx, cond) |
check_then_else(fcx, thn, elsopt, id, expr.span);
}
ast::expr_ternary(_, _, _) {
bot = check_expr(fcx, ast::ternary_to_if(expr));
}
ast::expr_assert(e) {
bot = check_expr(fcx, e);
let ety = expr_ty(tcx, e);
demand::simple(fcx, expr.span, ty::mk_bool(tcx), ety);
write::nil_ty(tcx, id);
}
ast::expr_move(lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_assignment(fcx, expr.span, lhs, rhs, id);
}
ast::expr_assign(lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_assignment(fcx, expr.span, lhs, rhs, id);
}
ast::expr_swap(lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_assignment(fcx, expr.span, lhs, rhs, id);
}
ast::expr_assign_op(op, lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_assignment(fcx, expr.span, lhs, rhs, id);
check_binop_type_compat(fcx, expr.span, expr_ty(tcx, lhs),
op);
}
ast::expr_send(lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_expr(fcx, lhs) | check_expr(fcx, rhs);
let rhs_t = expr_ty(tcx, rhs);
let chan_t = ty::mk_chan(tcx, rhs_t);
let lhs_t = expr_ty(tcx, lhs);
alt structure_of(fcx, expr.span, lhs_t) {
ty::ty_chan(it) { }
_ {
let s = #fmt("mismatched types: expected chan but found %s",
ty_to_str(tcx, lhs_t));
tcx.sess.span_fatal(expr.span, s);
}
}
demand::simple(fcx, expr.span, chan_t, lhs_t);
write::ty_only_fixup(fcx, id, chan_t);
}
ast::expr_recv(lhs, rhs) {
require_impure(tcx.sess, fcx.purity, expr.span);
bot = check_expr(fcx, lhs) | check_expr(fcx, rhs);
let item_t = expr_ty(tcx, rhs);
let port_t = ty::mk_port(tcx, item_t);
demand::simple(fcx, expr.span, port_t, expr_ty(tcx, lhs));
write::ty_only_fixup(fcx, id, item_t);
}
ast::expr_if(cond, thn, elsopt) {
bot = check_expr(fcx, cond) |
check_then_else(fcx, thn, elsopt, id, expr.span);
demand::simple(fcx, cond.span, ty::mk_bool(tcx),
expr_ty(tcx, cond));
}
ast::expr_for(decl, seq, body) {
bot = check_expr(fcx, seq);
let elt_ty;
let ety = expr_ty(tcx, seq);
alt structure_of(fcx, expr.span, ety) {
ty::ty_vec(vec_elt_ty) { elt_ty = vec_elt_ty.ty; }
ty::ty_str. { elt_ty = ty::mk_mach(tcx, ast::ty_u8); }
ty::ty_ivec(vec_elt_ty) { elt_ty = vec_elt_ty.ty; }
ty::ty_istr. { elt_ty = ty::mk_mach(tcx, ast::ty_u8); }
_ {
tcx.sess.span_fatal
(expr.span, "mismatched types: expected vector or string but "
+ "found " + ty_to_str(tcx, ety));
}
}
bot |= check_for_or_for_each(fcx, decl, elt_ty, body, id);
}
ast::expr_for_each(decl, seq, body) {
alt (seq.node) {
ast::expr_call(f, args) {
bot = check_call_full(fcx, seq.span, f, args,
kind_for_each, seq.id);
}
_ { tcx.sess.span_fatal(
expr.span, "sequence in for each loop not a call"); }
}
bot |= check_for_or_for_each(fcx, decl, expr_ty(tcx, seq),
body, id);
}
ast::expr_while(cond, body) {
bot = check_expr(fcx, cond);
check_block(fcx, body);
demand::simple(fcx, cond.span, ty::mk_bool(tcx),
expr_ty(tcx, cond));
let typ = ty::mk_nil(tcx);
write::ty_only_fixup(fcx, id, typ);
}
ast::expr_do_while(body, cond) {
bot = check_expr(fcx, cond);
check_block(fcx, body);
let typ = block_ty(tcx, body);
write::ty_only_fixup(fcx, id, typ);
}
ast::expr_alt(expr, arms) {
bot = check_expr(fcx, expr);
// Typecheck the patterns first, so that we get types for all the
// bindings.
let pattern_ty = ty::expr_ty(tcx, expr);
for arm: ast::arm in arms {
let id_map = ast::pat_id_map(arm.pats.(0));
for p: @ast::pat in arm.pats {
check_pat(fcx, id_map, p, pattern_ty);
}
}
// Now typecheck the blocks.
let result_ty = next_ty_var(fcx);
let arm_non_bot = false;
for arm: ast::arm in arms {
if !check_block(fcx, arm.block) { arm_non_bot = true; }
let bty = block_ty(tcx, arm.block);
// Failing alt arms don't need to have a matching type
if !ty::type_is_bot(tcx, bty) {
result_ty =
demand::simple(fcx, arm.block.span, result_ty, bty);
}
}
bot |= !arm_non_bot;
if !arm_non_bot { result_ty = ty::mk_bot(tcx); }
write::ty_only_fixup(fcx, id, result_ty);
}
ast::expr_fn(f) {
let cx = @{tcx: tcx};
let convert =
bind ast_ty_to_ty(cx.tcx, bind collect::getter(cx, _), _);
let ty_of_arg = bind collect::ty_of_arg(cx, _);
let fty =
collect::ty_of_fn_decl(cx, convert, ty_of_arg, f.decl, f.proto,
~[], none).ty;
write::ty_only_fixup(fcx, id, fty);
check_fn(fcx.ccx, f, id, some(fcx));
}
ast::expr_block(b) {
bot = check_block(fcx, b);
alt b.node.expr {
some(expr) {
let typ = expr_ty(tcx, expr);
write::ty_only_fixup(fcx, id, typ);
}
none. {
let typ = ty::mk_nil(tcx);
write::ty_only_fixup(fcx, id, typ);
}
}
}
ast::expr_bind(f, args) {
// Call the generic checker.
bot = check_call_or_bind(fcx, expr.span, f, args, kind_bind);
// Pull the argument and return types out.
let proto_1;
let arg_tys_1: ty::arg[] = ~[];
let rt_1;
let fty = expr_ty(tcx, f);
let t_1;
alt structure_of(fcx, expr.span, fty) {
ty::ty_fn(proto, arg_tys, rt, cf, constrs) {
proto_1 = proto;
rt_1 = rt;
// FIXME:
// probably need to munge the constrs to drop constraints
// for any bound args
// For each blank argument, add the type of that argument
// to the resulting function type.
let i = 0u;
while i < ivec::len[option::t[@ast::expr]](args) {
alt args.(i) {
some(_) {/* no-op */ }
none. { arg_tys_1 += ~[arg_tys.(i)]; }
}
i += 1u;
}
t_1 = ty::mk_fn(tcx, proto_1, arg_tys_1, rt_1, cf, constrs);
}
_ {
fail "LHS of bind expr didn't have a function type?!";
}
}
write::ty_only_fixup(fcx, id, t_1);
}
ast::expr_call(f, args) {
bot = check_call_full(fcx, expr.span, f, args, kind_call, expr.id);
}
ast::expr_self_method(ident) {
let t = ty::mk_nil(tcx);
let this_obj_sty: option::t[ty::sty] =
some(structure_of(fcx, expr.span, ty::mk_nil(tcx)));
let this_obj_info: option::t[obj_info] = get_obj_info(fcx.ccx);
alt this_obj_info {
some(oinfo) {
alt oinfo {
regular_obj(_, obj_id) {
let did = local_def(obj_id);
// Try looking up the current object in the type
// cache.
alt tcx.tcache.find(did) {
some(tpt) {
// If we're typechecking a self-method on
// a regular object, this lookup should
// succeed.
this_obj_sty = some(structure_of(fcx, expr.span, tpt.ty));
}
none. {
tcx.sess.bug("didn't find " + int::str(did.node) +
" in type cache");
}
}
}
anon_obj(_, obj_sty) { this_obj_sty = obj_sty; }
}
}
none. {
// Shouldn't happen.
tcx.sess.span_err(expr.span, "self-call in non-object context");
}
}
// Grab this method's type out of the current object type.
alt this_obj_sty {
some(sty) {
alt sty {
ty::ty_obj(methods) {
for method: ty::method in methods {
if method.ident == ident {
t = ty::method_ty_to_fn_ty(tcx, method);
}
}
}
_ { fail; }
}
}
none. { }
}
write::ty_only_fixup(fcx, id, t);
require_impure(tcx.sess, fcx.purity, expr.span);
}
ast::expr_spawn(_, _, f, args) {
bot = check_call(fcx, expr.span, f, args, kind_spawn);
let fty = expr_ty(tcx, f);
let ret_ty = alt structure_of(fcx, expr.span, fty) {
ty::ty_fn(_, _, rt, _, _) { rt }
ty::ty_native_fn(_, _, rt) { rt }
_ { fail "LHS of spawn expr didn't have a function type?!" }
};
demand::simple(fcx, f.span, ty::mk_nil(tcx), ret_ty);
// make sure they aren't spawning a function with type params
if ty::expr_has_ty_params(tcx, f) {
tcx.sess.span_fatal(
f.span,
"spawning functions with type params not allowed (for now)");
}
// FIXME: Other typechecks needed
let typ = ty::mk_task(tcx);
write::ty_only_fixup(fcx, id, typ);
}
ast::expr_cast(e, t) {
bot = check_expr(fcx, e);
let t_1 = ast_ty_to_ty_crate(fcx.ccx, t);
// FIXME: there are more forms of cast to support, eventually.
if !(type_is_scalar(fcx, expr.span, expr_ty(tcx, e)) &&
type_is_scalar(fcx, expr.span, t_1)) {
tcx.sess.span_fatal(expr.span,
"non-scalar cast: " +
ty_to_str(tcx, expr_ty(tcx, e))
+ " as " + ty_to_str(tcx, t_1));
}
write::ty_only_fixup(fcx, id, t_1);
}
ast::expr_vec(args, mut, kind) {
let t: ty::t;
if ivec::len[@ast::expr](args) == 0u {
t = next_ty_var(fcx);
} else {
bot |= check_expr(fcx, args.(0));
t = expr_ty(tcx, args.(0));
}
for e: @ast::expr in args {
bot |= check_expr(fcx, e);
let expr_t = expr_ty(tcx, e);
demand::simple(fcx, expr.span, t, expr_t);
}
let typ;
alt kind {
ast::sk_rc. { typ = ty::mk_vec(tcx, {ty: t, mut: mut}); }
ast::sk_unique. {
typ = ty::mk_ivec(tcx, {ty: t, mut: mut});
}
}
write::ty_only_fixup(fcx, id, typ);
}
ast::expr_rec(fields, base) {
alt base { none. {/* no-op */ } some(b_0) { check_expr(fcx, b_0); } }
let fields_t: (spanned[field])[] = ~[];
for f: ast::field in fields {
bot |= check_expr(fcx, f.node.expr);
let expr_t = expr_ty(tcx, f.node.expr);
let expr_mt = {ty: expr_t, mut: f.node.mut};
// for the most precise error message,
// should be f.node.expr.span, not f.span
fields_t +=
~[respan(f.node.expr.span,
{ident: f.node.ident, mt: expr_mt})];
}
alt base {
none. {
fn get_node(f: &spanned[field]) -> field { f.node }
let typ = ty::mk_rec(tcx, ivec::map(get_node, fields_t));
write::ty_only_fixup(fcx, id, typ);
}
some(bexpr) {
bot |= check_expr(fcx, bexpr);
let bexpr_t = expr_ty(tcx, bexpr);
let base_fields: field[] = ~[];
alt structure_of(fcx, expr.span, bexpr_t) {
ty::ty_rec(flds) { base_fields = flds; }
_ {
tcx.sess.span_fatal(expr.span,
"record update has non-record base");
}
}
write::ty_only_fixup(fcx, id, bexpr_t);
for f: spanned[ty::field] in fields_t {
let found = false;
for bf: ty::field in base_fields {
if str::eq(f.node.ident, bf.ident) {
demand::simple(fcx, f.span, bf.mt.ty, f.node.mt.ty);
found = true;
}
}
if !found {
tcx.sess.span_fatal(f.span,
"unknown field in record update: "
+ f.node.ident);
}
}
}
}
}
ast::expr_field(base, field) {
bot |= check_expr(fcx, base);
let base_t = expr_ty(tcx, base);
base_t = do_autoderef(fcx, expr.span, base_t);
alt structure_of(fcx, expr.span, base_t) {
ty::ty_rec(fields) {
let ix: uint =
ty::field_idx(tcx.sess, expr.span, field, fields);
if ix >= ivec::len[ty::field](fields) {
tcx.sess.span_fatal(expr.span, "bad index on record");
}
write::ty_only_fixup(fcx, id, fields.(ix).mt.ty);
}
ty::ty_obj(methods) {
let ix: uint =
ty::method_idx(tcx.sess, expr.span, field, methods);
if ix >= ivec::len[ty::method](methods) {
tcx.sess.span_fatal(expr.span, "bad index on obj");
}
let meth = methods.(ix);
let t =
ty::mk_fn(tcx, meth.proto, meth.inputs, meth.output,
meth.cf, meth.constrs);
write::ty_only_fixup(fcx, id, t);
}
_ {
let t_err = resolve_type_vars_if_possible(fcx, base_t);
let msg =
#fmt("attempted field access on type %s",
ty_to_str(tcx, t_err));
tcx.sess.span_fatal(expr.span, msg);
}
}
}
ast::expr_index(base, idx) {
bot |= check_expr(fcx, base);
let base_t = expr_ty(tcx, base);
base_t = do_autoderef(fcx, expr.span, base_t);
bot |= check_expr(fcx, idx);
let idx_t = expr_ty(tcx, idx);
if !type_is_integral(fcx, idx.span, idx_t) {
tcx.sess.span_fatal(idx.span,
"mismatched types: expected \
integer but found "
+ ty_to_str(tcx, idx_t));
}
alt structure_of(fcx, expr.span, base_t) {
ty::ty_vec(mt) { write::ty_only_fixup(fcx, id, mt.ty); }
ty::ty_ivec(mt) { write::ty_only_fixup(fcx, id, mt.ty); }
ty::ty_str. {
let typ = ty::mk_mach(tcx, ast::ty_u8);
write::ty_only_fixup(fcx, id, typ);
}
ty::ty_istr. {
let typ = ty::mk_mach(tcx, ast::ty_u8);
write::ty_only_fixup(fcx, id, typ);
}
_ {
tcx.sess.span_fatal(expr.span,
"vector-indexing bad type: " +
ty_to_str(tcx, base_t));
}
}
}
ast::expr_port(typ) {
let t = next_ty_var(fcx);
alt typ {
some(_t) {
demand::simple(fcx, expr.span, ast_ty_to_ty_crate(fcx.ccx, _t),
t);
}
none. { }
}
let pt = ty::mk_port(tcx, t);
write::ty_only_fixup(fcx, id, pt);
}
ast::expr_chan(x) {
check_expr(fcx, x);
let port_t = expr_ty(tcx, x);
alt structure_of(fcx, expr.span, port_t) {
ty::ty_port(subtype) {
let ct = ty::mk_chan(tcx, subtype);
write::ty_only_fixup(fcx, id, ct);
}
_ {
tcx.sess.span_fatal(expr.span,
"bad port type: " + ty_to_str(tcx, port_t));
}
}
}
ast::expr_anon_obj(ao) {
let fields: ast::anon_obj_field[] = ~[];
alt ao.fields { none. { } some(v) { fields = v; } }
// FIXME: These next three functions are largely ripped off from
// similar ones in collect::. Is there a better way to do this?
fn ty_of_arg(ccx: @crate_ctxt, a: &ast::arg) -> ty::arg {
let ty_mode = ast_mode_to_mode(a.mode);
ret {mode: ty_mode, ty: ast_ty_to_ty_crate(ccx, a.ty)};
}
fn ty_of_method(ccx: @crate_ctxt, m: &@ast::method) -> ty::method {
let convert = bind ast_ty_to_ty_crate(ccx, _);
let inputs = ~[];
for aa: ast::arg in m.node.meth.decl.inputs {
inputs += ~[ty_of_arg(ccx, aa)];
}
let output = convert(m.node.meth.decl.output);
let out_constrs = ~[];
for constr: @ast::constr in m.node.meth.decl.constraints {
out_constrs += ~[ty::ast_constr_to_constr(ccx.tcx, constr)];
}
ret {proto: m.node.meth.proto,
ident: m.node.ident,
inputs: inputs,
output: output,
cf: m.node.meth.decl.cf,
constrs: out_constrs};
}
let method_types: ty::method[] = ~[];
{
// Outer methods.
for m: @ast::method in ao.methods {
method_types += ~[ty_of_method(fcx.ccx, m)];
}
// Inner methods.
// Typecheck 'inner_obj'. If it exists, it had better have object
// type.
let inner_obj_methods: ty::method[] = ~[];
let inner_obj_ty: ty::t = ty::mk_nil(tcx);
let inner_obj_sty: option::t[ty::sty] = none;
alt ao.inner_obj {
none. { }
some(e) {
// If there's a inner_obj, we push it onto the obj_infos stack
// so that self-calls can be checked within its context later.
bot |= check_expr(fcx, e);
inner_obj_ty = expr_ty(tcx, e);
inner_obj_sty = some(structure_of(fcx, e.span, inner_obj_ty));
alt inner_obj_sty {
none. { }
some(sty) {
alt sty {
ty::ty_obj(ms) { inner_obj_methods = ms; }
_ {
// The user is trying to extend a non-object.
tcx.sess.span_fatal
(e.span, syntax::print::pprust::expr_to_str(e) +
" does not have object type");
}
}
}
}
}
}
fcx.ccx.obj_infos +=
~[anon_obj(ivec::map(ast::obj_field_from_anon_obj_field,
fields), inner_obj_sty)];
// Whenever an outer method overrides an inner, we need to remove
// that inner from the type. Filter inner_obj_methods to remove
// any methods that share a name with an outer method.
fn filtering_fn(ccx: @crate_ctxt,
m: &ty::method,
outer_obj_methods: (@ast::method)[]) ->
option::t[ty::method] {
for om: @ast::method in outer_obj_methods {
if str::eq(om.node.ident, m.ident) {
// We'd better be overriding with one of the same
// type. Check to make sure.
let new_type = ty_of_method(ccx, om);
if new_type != m {
ccx.tcx.sess.span_fatal(
om.span,
"Attempted to override method " +
m.ident + " with one of a different type");
}
ret none;
}
}
ret some(m);
}
let f = bind filtering_fn(fcx.ccx, _, ao.methods);
inner_obj_methods =
std::ivec::filter_map[ty::method,
ty::method](f, inner_obj_methods);
method_types += inner_obj_methods;
}
let ot = ty::mk_obj(tcx, ty::sort_methods(method_types));
write::ty_only_fixup(fcx, id, ot);
// Write the methods into the node type table. (This happens in
// collect::convert for regular objects.)
let i = 0u;
while i < ivec::len[@ast::method](ao.methods) {
write::ty_only(tcx, ao.methods.(i).node.id,
ty::method_ty_to_fn_ty(tcx,
method_types.(i)));
i += 1u;
}
// Typecheck the methods.
for method: @ast::method in ao.methods {
check_method(fcx.ccx, method);
}
next_ty_var(fcx);
// Now remove the info from the stack.
ivec::pop[obj_info](fcx.ccx.obj_infos);
}
_ { tcx.sess.unimpl("expr type in typeck::check_expr"); }
}
if bot {
write::ty_only_fixup(fcx, expr.id, ty::mk_bot(tcx));
}
ret bot;
}
fn next_ty_var_id(fcx: @fn_ctxt) -> int {
let id = *fcx.next_var_id;
*fcx.next_var_id = fcx.next_var_id + 1;
ret id;
}
fn next_ty_var(fcx: &@fn_ctxt) -> ty::t {
ret ty::mk_var(fcx.ccx.tcx, next_ty_var_id(fcx));
}
fn get_obj_info(ccx: &@crate_ctxt) -> option::t[obj_info] {
ret ivec::last[obj_info](ccx.obj_infos);
}
fn check_decl_initializer(fcx: &@fn_ctxt, nid: ast::node_id,
init: &ast::initializer) -> bool {
let bot = check_expr(fcx, init.expr);
let lty = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, init.expr.span, nid));
alt init.op {
ast::init_assign. {
demand::simple(fcx, init.expr.span, lty,
expr_ty(fcx.ccx.tcx, init.expr));
}
ast::init_move. {
demand::simple(fcx, init.expr.span, lty,
expr_ty(fcx.ccx.tcx, init.expr));
}
ast::init_recv. {
let port_ty = ty::mk_port(fcx.ccx.tcx, lty);
demand::simple(fcx, init.expr.span, port_ty,
expr_ty(fcx.ccx.tcx, init.expr));
}
}
ret bot;
}
fn check_decl_local(fcx: &@fn_ctxt, local: &@ast::local) -> bool {
let bot = false;
alt fcx.locals.find(local.node.id) {
none. {
fcx.ccx.tcx.sess.bug("check_decl_local: local id not found " +
ident_for_local(local));
}
some(i) {
let t = ty::mk_var(fcx.ccx.tcx, i);
write::ty_only_fixup(fcx, local.node.id, t);
alt local.node.init {
some(init) {
bot = check_decl_initializer(fcx, local.node.id, init);
}
_ {/* fall through */ }
}
let id_map = ast::pat_id_map(local.node.pat);
check_pat(fcx, id_map, local.node.pat, t);
}
}
ret bot;
}
fn check_stmt(fcx: &@fn_ctxt, stmt: &@ast::stmt) -> bool {
let node_id;
let bot = false;
alt stmt.node {
ast::stmt_decl(decl, id) {
node_id = id;
alt decl.node {
ast::decl_local(ls) {
for l: @ast::local in ls { bot |= check_decl_local(fcx, l); }
}
ast::decl_item(_) {/* ignore for now */ }
}
}
ast::stmt_expr(expr, id) { node_id = id; bot = check_expr(fcx, expr); }
}
write::nil_ty(fcx.ccx.tcx, node_id);
ret bot;
}
fn check_block(fcx: &@fn_ctxt, blk: &ast::blk) -> bool {
let bot = false;
let warned = false;
for s: @ast::stmt in blk.node.stmts {
if bot && !warned &&
alt s.node {
ast::stmt_decl(@{node: ast::decl_local(_), _}, _) |
ast::stmt_expr(_, _) { true }
_ { false }
} {
fcx.ccx.tcx.sess.span_warn(s.span, "unreachable statement");
warned = true;
}
bot |= check_stmt(fcx, s);
}
alt blk.node.expr {
none. { write::nil_ty(fcx.ccx.tcx, blk.node.id); }
some(e) {
if bot && !warned {
fcx.ccx.tcx.sess.span_warn(e.span, "unreachable expression");
}
bot |= check_expr(fcx, e);
let ety = expr_ty(fcx.ccx.tcx, e);
write::ty_only_fixup(fcx, blk.node.id, ety);
}
}
if bot {
write::ty_only_fixup(fcx, blk.node.id, ty::mk_bot(fcx.ccx.tcx));
}
ret bot;
}
fn check_const(ccx: &@crate_ctxt, sp: &span, e: &@ast::expr,
id: &ast::node_id) {
// FIXME: this is kinda a kludge; we manufacture a fake function context
// and statement context for checking the initializer expression.
let rty = node_id_to_type(ccx.tcx, id);
let fixups: ast::node_id[] = ~[];
let fcx: @fn_ctxt =
@{ret_ty: rty,
purity: ast::pure_fn,
proto: ast::proto_fn,
var_bindings: ty::unify::mk_var_bindings(),
locals: new_int_hash[int](),
local_names: new_int_hash[ast::ident](),
next_var_id: @mutable 0,
mutable fixups: fixups,
ccx: ccx};
check_expr(fcx, e);
}
fn check_fn(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
old_fcx: &option::t[@fn_ctxt]) {
let decl = f.decl;
let body = f.body;
let gather_result = gather_locals(ccx, f, id, old_fcx);
let fixups: ast::node_id[] = ~[];
let fcx: @fn_ctxt =
@{ret_ty: ast_ty_to_ty_crate(ccx, decl.output),
purity: decl.purity,
proto: f.proto,
var_bindings: gather_result.var_bindings,
locals: gather_result.locals,
local_names: gather_result.local_names,
next_var_id: gather_result.next_var_id,
mutable fixups: fixups,
ccx: ccx};
check_block(fcx, body);
alt decl.purity {
ast::pure_fn. {
// This just checks that the declared type is bool, and trusts
// that that's the actual return type.
if !ty::type_is_bool(ccx.tcx, fcx.ret_ty) {
ccx.tcx.sess.span_fatal(body.span,
"Non-boolean return type in pred");
}
}
_ { }
}
if option::is_some(body.node.expr) {
let tail_expr = option::get(body.node.expr);
let tail_expr_ty = expr_ty(ccx.tcx, tail_expr);
// Have to exclude ty_nil to allow functions to end in
// while expressions, etc.
let nil = ty::mk_nil(fcx.ccx.tcx);
if !are_compatible(fcx, nil, tail_expr_ty) {
demand::simple(fcx, tail_expr.span, fcx.ret_ty, tail_expr_ty);
}
}
writeback::resolve_type_vars_in_block(fcx, body);
}
fn check_method(ccx: &@crate_ctxt, method: &@ast::method) {
check_fn(ccx, method.node.meth, method.node.id, none);
}
fn check_item(ccx: @crate_ctxt, it: &@ast::item) {
alt it.node {
ast::item_const(_, e) { check_const(ccx, it.span, e, it.id); }
ast::item_fn(f, _) { check_fn(ccx, f, it.id, none); }
ast::item_res(f, dtor_id, _, _) { check_fn(ccx, f, dtor_id, none); }
ast::item_obj(ob, _, _) {
// We're entering an object, so gather up the info we need.
ccx.obj_infos += ~[regular_obj(ob.fields, it.id)];
// Typecheck the methods.
for method: @ast::method in ob.methods { check_method(ccx, method); }
// Now remove the info from the stack.
ivec::pop[obj_info](ccx.obj_infos);
}
_ {/* nothing to do */ }
}
}
fn arg_is_argv_ty(tcx: &ty::ctxt, a: &ty::arg) -> bool {
alt ty::struct(tcx, a.ty) {
ty::ty_vec(mt) {
if mt.mut != ast::imm { ret false; }
alt ty::struct(tcx, mt.ty) {
ty::ty_str. { ret true; }
_ { ret false; }
}
}
_ { ret false; }
}
}
fn check_main_fn_ty(tcx: &ty::ctxt, main_id: &ast::node_id) {
let main_t = ty::node_id_to_monotype(tcx, main_id);
alt ty::struct(tcx, main_t) {
ty::ty_fn(ast::proto_fn., args, rs, ast::return., constrs) {
let ok = ivec::len(constrs) == 0u;
ok &= ty::type_is_nil(tcx, rs);
let num_args = ivec::len(args);
ok &=
num_args == 0u || num_args == 1u && arg_is_argv_ty(tcx, args.(0));
if !ok {
tcx.sess.err("Wrong type in main function: found " +
ty_to_str(tcx, main_t));
}
}
_ {
tcx.sess.err("Main has a non-function type: found" +
ty_to_str(tcx, main_t));
}
}
}
fn check_for_main_fn(tcx: &ty::ctxt, crate: &@ast::crate) {
if !tcx.sess.get_opts().library {
alt tcx.sess.get_main_id() {
some(id) { check_main_fn_ty(tcx, id); }
none. { tcx.sess.span_err(crate.span, "Main function not found"); }
}
}
}
fn check_crate(tcx: &ty::ctxt, crate: &@ast::crate) {
collect::collect_item_types(tcx, crate);
let obj_infos: obj_info[] = ~[];
let ccx = @{mutable obj_infos: obj_infos, tcx: tcx};
let visit = visit::mk_simple_visitor
(@{visit_item: bind check_item(ccx, _)
with *visit::default_simple_visitor()});
visit::visit_crate(*crate, (), visit);
check_for_main_fn(tcx, crate);
tcx.sess.abort_if_errors();
}
//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//
|
mod conn;
mod payload;
use serde::{Deserialize, Serialize};
use tokio::net::{TcpListener, TcpStream};
use conn::Conn;
use payload::Payload;
#[derive(Debug, Serialize, Deserialize)]
enum Frame {
Version(u32),
Message(String),
Bye,
}
// what do we do
// we do replies and responses
// then we implement a basic protocol with some context, that can work
// as a state machine to handle communications
// then we generate our protocol from a specification at build time, allowing
// Rust to validate it
#[tokio::main]
async fn main() {
let server = tokio::spawn(async {
let listener = TcpListener::bind("127.0.0.1:8080")
.await
.expect("could not bind socket.");
loop {
if let Ok((stream, _)) = listener.accept().await {
print!("serving... ");
process_server(stream).await;
}
}
});
if let Ok(stream) = TcpStream::connect("127.0.0.1:8080").await {
process_client(stream).await;
} else {
println!("could not connect.")
}
server.abort();
}
async fn process_server(stream: TcpStream) {
let mut conn: Conn<Frame> = Conn::new(stream);
loop {
match conn::receive(&mut conn).await {
Ok(frame) => match frame {
Frame::Version(v) => println!("got version: {}", v),
Frame::Message(m) => println!("got message: {}", m),
Frame::Bye => {
println!("client closed connection");
break;
}
},
Err(e) => {
eprintln!("err: {}", e);
break;
}
}
}
}
async fn process_client(stream: TcpStream) {
let mut conn: Conn<Frame> = Conn::new(stream);
let frames = vec![
Frame::Version(64),
Frame::Message("szevasz".to_string()),
Frame::Bye,
];
for frame in frames.into_iter() {
if let Err(e) = conn::send(&mut conn, frame).await {
eprintln!("could not send frame: {}", e);
}
}
}
|
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::fmt::Debug;
use std::io::Read;
use std::io::Write;
use std::sync::Arc;
use byteorder::BigEndian;
use byteorder::ReadBytesExt;
use byteorder::WriteBytesExt;
use common_exception::ErrorCode;
use common_exception::Result;
use common_exception::ToErrorCode;
use common_expression::BlockMetaInfoPtr;
use common_expression::DataBlock;
use crate::sessions::QueryContext;
use crate::sessions::TableContext;
// PrecommitBlock only use block.meta for data transfer.
#[derive(Clone, Debug)]
pub struct PrecommitBlock(pub DataBlock);
impl PrecommitBlock {
pub fn precommit(&self, ctx: &Arc<QueryContext>) {
ctx.push_precommit_block(self.0.clone());
}
pub fn write<T: Write>(self, bytes: &mut T) -> Result<()> {
let data_block = self.0;
let serialized_meta = bincode::serialize(&data_block.get_meta()).map_err_to_code(
ErrorCode::BadBytes,
|| "precommit block serialize error when exchange",
)?;
bytes.write_u64::<BigEndian>(serialized_meta.len() as u64)?;
bytes.write_all(&serialized_meta)?;
Ok(())
}
pub fn read<T: Read>(bytes: &mut T) -> Result<PrecommitBlock> {
let meta_len = bytes.read_u64::<BigEndian>()? as usize;
let mut meta = vec![0; meta_len];
bytes.read_exact(&mut meta)?;
let block_meta: Option<BlockMetaInfoPtr> = bincode::deserialize(&meta).map_err_to_code(
ErrorCode::BadBytes,
|| "precommit block deserialize error when exchange",
)?;
Ok(PrecommitBlock(DataBlock::new_with_meta(
vec![],
0,
block_meta,
)))
}
}
|
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::sync::Arc;
use common_config::InnerConfig;
use common_exception::Result;
use common_meta_types::NodeInfo;
use crate::api::rpc::flight_actions::InitNodesChannel;
use crate::api::rpc::packets::packet::create_client;
use crate::api::rpc::Packet;
use crate::api::FlightAction;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ConnectionInfo {
pub source: Arc<NodeInfo>,
pub fragments: Vec<usize>,
}
impl ConnectionInfo {
pub fn create(source: Arc<NodeInfo>, fragments: Vec<usize>) -> ConnectionInfo {
ConnectionInfo { source, fragments }
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct InitNodesChannelPacket {
pub query_id: String,
pub executor: Arc<NodeInfo>,
pub fragment_connections_info: Vec<ConnectionInfo>,
pub statistics_connections_info: Vec<ConnectionInfo>,
}
impl InitNodesChannelPacket {
pub fn create(
query_id: String,
executor: Arc<NodeInfo>,
fragment_connections_info: Vec<ConnectionInfo>,
statistics_connections_info: Vec<ConnectionInfo>,
) -> InitNodesChannelPacket {
InitNodesChannelPacket {
query_id,
executor,
fragment_connections_info,
statistics_connections_info,
}
}
}
#[async_trait::async_trait]
impl Packet for InitNodesChannelPacket {
async fn commit(&self, config: &InnerConfig, timeout: u64) -> Result<()> {
let executor_info = &self.executor;
let mut conn = create_client(config, &executor_info.flight_address).await?;
let action = FlightAction::InitNodesChannel(InitNodesChannel {
init_nodes_channel_packet: self.clone(),
});
conn.execute_action(action, timeout).await
}
}
|
use crate::input::eventsystem::EventSystem;
use crate::prelude::*;
use crate::vri::openvrintegration::OpenVRIntegration;
use crate::wsi::windowsystemintegration::WindowSystemIntegration;
use crate::xri::openxrintegration::OpenXRIntegration;
use utilities::prelude::*;
use vulkan_rs::prelude::*;
use sdl2::Sdl;
use std::sync::{Arc, Mutex};
#[derive(Debug)]
pub enum PresentationBackend {
Window(WindowSystemIntegration),
OpenXR(OpenXRIntegration),
OpenVR(OpenVRIntegration),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VRMode {
OpenXR,
OpenVR,
}
#[derive(Debug, Clone)]
pub struct ApplicationInfo {
pub application_name: String,
pub application_version: u32,
pub engine_name: String,
pub engine_version: u32,
}
impl Default for ApplicationInfo {
fn default() -> Self {
ApplicationInfo {
application_name: "empty".to_string(),
application_version: 0,
engine_name: "empty".to_string(),
engine_version: 0,
}
}
}
#[cfg(feature = "OpenXR")]
impl ApplicationInfo {
fn as_openxr_info<'a>(&'a self) -> openxr::ApplicationInfo<'a> {
openxr::ApplicationInfo {
application_name: &self.application_name,
application_version: self.application_version,
engine_name: &self.engine_name,
engine_version: self.engine_version,
}
}
}
#[cfg(not(feature = "OpenXR"))]
impl ApplicationInfo {
fn as_openxr_info(&self) -> ApplicationInfo {
self.clone()
}
}
pub struct PresentationCore {
_sdl_context: Mutex<Sdl>,
event_system: EventSystem,
backend: PresentationBackend,
}
impl PresentationCore {
pub fn enabled_vr_modes() -> Vec<VRMode> {
let mut _modes = Vec::new();
#[cfg(feature = "OpenXR")]
_modes.push(VRMode::OpenXR);
#[cfg(feature = "OpenVR")]
_modes.push(VRMode::OpenVR);
_modes
}
pub fn new(
use_vr: Option<VRMode>,
window_create_info: &WindowCreateInfo,
appl_info: ApplicationInfo,
) -> VerboseResult<PresentationCore> {
// create sdl2 context
let context = sdl2::init()?;
Ok(PresentationCore {
event_system: EventSystem::new(&context)?,
backend: match use_vr {
Some(vr_mode) => match vr_mode {
VRMode::OpenXR => PresentationBackend::OpenXR(OpenXRIntegration::new(
appl_info.as_openxr_info(),
)?),
VRMode::OpenVR => PresentationBackend::OpenVR(OpenVRIntegration::new()?),
},
None => PresentationBackend::Window(WindowSystemIntegration::new(
window_create_info,
&context,
)?),
},
_sdl_context: Mutex::new(context),
})
}
pub fn event_system(&self) -> &EventSystem {
&self.event_system
}
pub fn activate_vulkan_instance_extensions(
&self,
extensions: &mut InstanceExtensions,
) -> VerboseResult<()> {
match &self.backend {
PresentationBackend::Window(wsi) => {
wsi.activate_vulkan_instance_extensions(extensions)?;
}
PresentationBackend::OpenXR(xri) => {
xri.activate_vulkan_instance_extensions(extensions)?;
}
PresentationBackend::OpenVR(vri) => {
vri.activate_vulkan_instance_extensions(extensions)?;
}
}
Ok(())
}
pub fn activate_vulkan_device_extensions(
&self,
extensions: &mut DeviceExtensions,
physical_device: &Arc<PhysicalDevice>,
) -> VerboseResult<()> {
match &self.backend {
PresentationBackend::Window(wsi) => {
wsi.activate_vulkan_device_extensions(extensions)?;
}
PresentationBackend::OpenXR(xri) => {
xri.activate_vulkan_device_extensions(extensions)?;
}
PresentationBackend::OpenVR(vri) => {
vri.activate_vulkan_device_extensions(extensions, physical_device)?;
}
}
Ok(())
}
pub fn backend(&self) -> &PresentationBackend {
&self.backend
}
}
impl std::fmt::Debug for PresentationCore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "WindowSystemIntegration {{ sdl_context: SDL2, eventsystem: EventSystem, backend: {:#?} }}", self.backend)
}
}
unsafe impl Send for PresentationCore {}
unsafe impl Sync for PresentationCore {}
|
use std::collections::HashMap;
use url::Url;
use crate::*;
#[derive(Clone)]
/// Ergonomic wrapper around the popular Url crate
pub struct Url2(pub(crate) Box<(Url, Option<HashMap<String, String>>)>);
impl Url2 {
// would love to use std::convert::TryFrom, except for conflicting
// blanket implementation: https://github.com/rust-lang/rust/issues/50133
/// Try to parse a utf8 slice into a Url2 instance.
/// May result in a UrlParseError
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// assert_eq!(
/// "Err(Url2Error(UrlParseError(RelativeUrlWithoutBase)))",
/// &format!("{:?}", Url2::try_parse("")),
/// );
/// assert_eq!(
/// "Ok(Url2 { url: \"none:\" })",
/// &format!("{:?}", Url2::try_parse("none:")),
/// );
/// ```
pub fn try_parse<S: AsRef<str>>(s: S) -> Url2Result<Self> {
Ok(Url2::priv_new(Url::parse(s.as_ref())?))
}
// would love to use std::convert::From, except for conflicting
// blanket implementation: https://github.com/rust-lang/rust/issues/50133
/// Try to parse a utf8 slice into a Url2 instance.
/// If this results in a UrlParseError, this method will panic!
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// assert_eq!("none:", Url2::parse("none:").as_str());
/// ```
pub fn parse<S: AsRef<str>>(s: S) -> Self {
Self::try_parse(s).unwrap()
}
/// convert this Url2 instance into a string
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// assert_eq!("none:", Url2::default().as_str());
/// ```
pub fn into_string(self) -> String {
self.into()
}
/// Access query string entries as a unique key map.
///
/// Url query strings support multiple instances of the same key
/// However, many common use-cases treat the query string
/// keys as unique entries in a map. An optional API viewing the
/// query string in this manner can be more ergonomic.
///
/// The HashMap that backs this view is only created the first time this
/// function (or the following query_unique_* functions) are invoked.
/// If you do not use them, there is no additional overhead.
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// let mut url = Url2::default();
/// url.query_unique().set_pair("a", "1").set_pair("a", "2");
///
/// assert_eq!("none:?a=2", url.as_str());
/// ```
pub fn query_unique(&mut self) -> Url2QueryUnique {
self.priv_ensure_query_unique_cache();
Url2QueryUnique { url_ref: self }
}
/// When parsed as a unique map, does the query string contain given key?
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// let mut url = Url2::parse("none:?a=1");
///
/// assert!(url.query_unique_contains_key("a"));
/// assert!(!url.query_unique_contains_key("b"));
/// ```
pub fn query_unique_contains_key(&mut self, key: &str) -> bool {
self.priv_ensure_query_unique_cache();
(self.0).1.as_ref().unwrap().contains_key(key)
}
/// When parsed as a unique map, get the value for given key
///
/// # Example
///
/// ```rust
/// use url2::prelude::*;
///
/// let mut url = Url2::parse("none:?a=1");
///
/// assert_eq!(
/// "Some(\"1\")",
/// &format!("{:?}", url.query_unique_get("a")),
/// );
/// assert_eq!(
/// "None",
/// &format!("{:?}", url.query_unique_get("b")),
/// );
/// ```
pub fn query_unique_get(&mut self, key: &str) -> Option<&str> {
self.priv_ensure_query_unique_cache();
match (self.0).1.as_ref().unwrap().get(key) {
None => None,
// silly dance to convert &String to &str
Some(s) => Some(s),
}
}
// -- private -- //
/// private constructor, you probably want `Url2::try_parse()`
fn priv_new(url: Url) -> Self {
Self(Box::new((url, None)))
}
/// generate our unique query string entry cache if we haven't already
fn priv_ensure_query_unique_cache(&mut self) {
if (self.0).1.is_none() {
let _ = std::mem::replace(&mut (self.0).1, Some(HashMap::new()));
for (k, v) in (self.0).0.query_pairs() {
(self.0)
.1
.as_mut()
.unwrap()
.insert(k.to_string(), v.to_string());
}
}
}
/// if changes have been made to our query unique cache, apply them
pub(crate) fn priv_sync_query_unique_cache(&mut self) {
let mut all = (self.0).1.as_mut().unwrap().drain().collect::<Vec<_>>();
{
let mut pairs = self.query_pairs_mut();
pairs.clear();
for (k, v) in all.iter() {
pairs.append_pair(k, v);
}
}
for (k, v) in all.drain(..) {
(self.0).1.as_mut().unwrap().insert(k, v);
}
}
}
impl serde::Serialize for Url2 {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
(self.0).0.serialize(serializer)
}
}
impl<'de> serde::Deserialize<'de> for Url2 {
fn deserialize<D>(deserializer: D) -> Result<Url2, D::Error>
where
D: serde::Deserializer<'de>,
{
let url: Url = serde::Deserialize::deserialize(deserializer)?;
Ok(Url2::priv_new(url))
}
}
impl std::fmt::Debug for Url2 {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Url2")
.field("url", &(self.0).0.as_str())
.finish()
}
}
impl std::cmp::PartialOrd for Url2 {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
(self.0).0.partial_cmp(&(other.0).0)
}
}
impl std::cmp::PartialOrd<Url> for Url2 {
fn partial_cmp(&self, other: &Url) -> Option<std::cmp::Ordering> {
(self.0).0.partial_cmp(other)
}
}
impl std::cmp::Ord for Url2 {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
(self.0).0.cmp(&(other.0).0)
}
}
impl std::cmp::PartialEq for Url2 {
fn eq(&self, other: &Self) -> bool {
(self.0).0.eq(&(other.0).0)
}
}
impl std::cmp::Eq for Url2 {}
impl std::cmp::PartialEq<Url> for Url2 {
fn eq(&self, other: &Url) -> bool {
(self.0).0.eq(&other)
}
}
impl std::hash::Hash for Url2 {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
(self.0).0.hash(state);
}
}
impl std::fmt::Display for Url2 {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", (self.0).0)
}
}
impl std::convert::From<Url2> for String {
fn from(url: Url2) -> String {
url.to_string()
}
}
impl std::default::Default for Url2 {
fn default() -> Self {
Url2::priv_new(Url::parse("none:").unwrap())
}
}
impl std::convert::AsRef<str> for Url2 {
fn as_ref(&self) -> &str {
(self.0).0.as_ref()
}
}
impl std::borrow::Borrow<str> for Url2 {
fn borrow(&self) -> &str {
(self.0).0.as_ref()
}
}
impl std::ops::Deref for Url2 {
type Target = Url;
fn deref(&self) -> &Self::Target {
&(self.0).0
}
}
impl std::ops::DerefMut for Url2 {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut (self.0).0
}
}
impl std::borrow::Borrow<Url> for Url2 {
fn borrow(&self) -> &Url {
&(self.0).0
}
}
impl std::borrow::BorrowMut<Url> for Url2 {
fn borrow_mut(&mut self) -> &mut Url {
&mut (self.0).0
}
}
impl std::convert::AsRef<Url> for Url2 {
fn as_ref(&self) -> &Url {
&(self.0).0
}
}
impl std::convert::AsMut<Url> for Url2 {
fn as_mut(&mut self) -> &mut Url {
&mut (self.0).0
}
}
impl std::convert::From<Url> for Url2 {
fn from(url: Url) -> Url2 {
Url2::priv_new(url)
}
}
impl std::convert::From<&Url> for Url2 {
fn from(url: &Url) -> Url2 {
Url2::priv_new(url.clone())
}
}
impl std::convert::From<Url2> for Url {
fn from(url: Url2) -> Url {
(url.0).0
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_is_small_for_enum_usage() {
assert_eq!(std::mem::size_of::<usize>(), std::mem::size_of::<Url2>());
}
#[test]
fn it_can_serialize_deserialize() {
let url = Url2::parse("s://u:p@h:42/a/b?a=b&c=d#e");
let json = serde_json::to_string(&url).unwrap();
assert_eq!("\"s://u:p@h:42/a/b?a=b&c=d#e\"", json);
let de: Url2 = serde_json::from_str(&json).unwrap();
assert_eq!(url, de);
}
#[test]
fn it_can_display() {
assert_eq!("test:foo", &format!("{}", Url2::parse("test:foo")));
assert_eq!("test:foo", &Url2::parse("test:foo").into_string());
}
#[test]
fn it_can_parse() {
let url_a = Url2::try_parse("test:bob").unwrap();
let url_b = Url2::parse("test:bob");
let url_c = try_url2!("{}:{}", "test", "bob").unwrap();
let url_d = url2!("{}:{}", "test", "bob");
assert_eq!(url_a, url_b);
assert_eq!(url_a, url_c);
assert_eq!(url_a, url_d);
}
#[test]
fn it_can_convert_from() {
let url = Url2::default();
let url: Url = url.into();
let url: Url2 = url.into();
let url: Url = url.into();
let url: Url2 = (&url).into();
assert_eq!("none:", url.as_str());
}
#[test]
fn it_can_edit_query_unique() {
let mut url = Url2::default();
url.query_unique()
.set_pair("a", "test1")
.set_pair("b", "test2");
assert!(
"none:?a=test1&b=test2" == url.as_str()
|| "none:?b=test2&a=test1" == url.as_str()
);
assert_eq!(true, url.query_unique_contains_key("a"));
assert_eq!(false, url.query_unique_contains_key("c"));
assert_eq!(Some("test1"), url.query_unique_get("a"));
assert_eq!(None, url.query_unique_get("c"));
}
}
|
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use std::ops::{Index, IndexMut};
#[derive(Debug)]
pub struct Arena<T> {
data: Vec<Node<T>>,
first_free: Option<usize>,
}
#[derive(Debug)]
enum Node<T> {
Free { next_free: Option<usize> },
Occupied(T),
}
#[derive(Debug)]
pub struct ArenaId<Tag> {
ix: usize,
tag: std::marker::PhantomData<Tag>,
}
impl<T> Arena<T> {
pub fn new() -> Self {
Arena {
data: vec![],
first_free: None,
}
}
pub fn push(&mut self, v: T) -> ArenaId<T> {
match self.first_free {
None => {
self.data.push(Node::Occupied(v));
ArenaId::new(self.data.len() - 1)
}
Some(f) => {
match self.data[f] {
Node::Free { next_free } => {
self.first_free = next_free;
}
Node::Occupied(_) => panic!("bug"),
};
self.data[f] = Node::Occupied(v);
ArenaId::new(f)
}
}
}
pub fn remove(&mut self, id: ArenaId<T>) -> Option<T> {
match self.data.get_mut(id.ix)? {
cell @ Node::Occupied(_) => {
let mut out = Node::Free {
next_free: self.first_free,
};
std::mem::swap(&mut out, cell);
self.first_free = Some(id.ix);
match out {
Node::Occupied(t) => Some(t),
Node::Free { .. } => unreachable!(),
}
}
Node::Free { .. } => None,
}
}
pub fn get(&self, id: ArenaId<T>) -> Option<&T> {
match self.data.get(id.ix)? {
Node::Occupied(t) => Some(t),
Node::Free { .. } => None,
}
}
pub fn get_mut(&mut self, id: ArenaId<T>) -> Option<&mut T> {
match self.data.get_mut(id.ix)? {
Node::Occupied(t) => Some(t),
Node::Free { .. } => None,
}
}
pub fn iter(&self) -> impl Iterator<Item = &T> {
self.enumerate().map(|(_, n)| n)
}
pub fn enumerate(&self) -> impl Iterator<Item = (ArenaId<T>, &T)> {
self.data.iter().enumerate().filter_map(|(i, n)| match n {
Node::Occupied(t) => Some((ArenaId::new(i), t)),
Node::Free { .. } => None,
})
}
}
impl<T> Default for Arena<T> {
fn default() -> Self {
Arena::new()
}
}
impl<T> Index<ArenaId<T>> for Arena<T> {
type Output = T;
fn index(&self, ix: ArenaId<T>) -> &Self::Output {
self.get(ix).unwrap()
}
}
impl<T> IndexMut<ArenaId<T>> for Arena<T> {
fn index_mut(&mut self, ix: ArenaId<T>) -> &mut T {
self.get_mut(ix).unwrap()
}
}
impl<Tag> ArenaId<Tag> {
fn new(ix: usize) -> Self {
ArenaId {
ix,
tag: PhantomData,
}
}
}
impl<T> Copy for ArenaId<T> {}
impl<T> Clone for ArenaId<T> {
fn clone(&self) -> Self {
ArenaId {
ix: self.ix,
tag: self.tag,
}
}
}
impl<T> Eq for ArenaId<T> {}
impl<T> PartialEq for ArenaId<T> {
fn eq(&self, rhs: &ArenaId<T>) -> bool {
self.ix == rhs.ix
}
}
impl<T> Hash for ArenaId<T> {
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
self.ix.hash(state);
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic() {
let mut arena: Arena<u32> = Arena::new();
assert!(arena.get(ArenaId::new(0)).is_none());
let id42 = arena.push(42);
assert_eq!(arena[id42], 42);
let id73 = arena.push(73);
arena.remove(id42);
assert!(arena.get(id42).is_none());
assert_eq!(arena[id73], 73);
let id0 = arena.push(0);
assert_eq!(arena[id73], 73);
assert_eq!(arena[id0], 0);
arena[id0] = 69;
assert_eq!(arena[id73], 73);
assert_eq!(arena[id0], 69);
}
#[test]
fn test_iterators() {
let mut arena = Arena::new();
arena.push(42);
arena.push(73);
arena.push(0);
assert_eq!(arena.iter().collect::<Vec<_>>(), vec![&42, &73, &0]);
for (i, e) in arena.enumerate() {
assert_eq!(&arena[i], e);
}
}
}
|
#![allow(dead_code)]
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_json;
use structopt::StructOpt;
mod args;
mod error;
use error::GenericResult;
mod logging;
mod server;
#[tokio::main]
async fn main()
{
if let Err(error) = run().await
{
error!("{}", error);
std::process::exit(1);
}
}
async fn run() -> GenericResult<()>
{
// Initialize the logger
logging::initialize_logging();
// Load options from arguments
let opts = args::Arguments::from_args();
// Connect to the server
info!("Connecting to server");
let ip = "35.225.173.218"; //"35.225.173.218";
let (conn, listener, event_channel) = aci::connect(ip, 8766).await?;
let conn = std::sync::Arc::new(conn);
// Start the listener
info!("Spawning Listener");
tokio::spawn(listener);
// Start the server process
match server::execute(conn.clone(), opts, event_channel).await
{
// If the server process exits normally, close the connection
Ok(()) =>
{
// Close the connection
conn.close().await?;
},
Err(e) =>
{
// Attempt to close the connection, if closing the connection fails, display the nested error
if let Err(error) = conn.close().await
{
error!("{}", error);
}
// Return the first error
return Err(e);
}
}
info!("Server process exited normally");
// The server is done
Ok(())
} |
fn foo<T: <caret>Send + Sync>(t: T, f: F) {
}
|
//! A lazy connector for Tonic gRPC [`Channel`] instances.
use std::{
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
time::Duration,
};
use async_trait::async_trait;
use generated_types::influxdata::iox::ingester::v1::{
write_service_client::WriteServiceClient, WriteRequest,
};
use observability_deps::tracing::*;
use parking_lot::Mutex;
use tokio::task::JoinHandle;
use tonic::{
metadata::AsciiMetadataValue,
transport::{Channel, Endpoint},
Code,
};
use trace::ctx::SpanContext;
use super::client::{RpcWriteClientError, TracePropagatingWriteClient, WriteClient};
const RETRY_INTERVAL: Duration = Duration::from_secs(1);
const CONNECT_TIMEOUT: Duration = Duration::from_secs(1);
/// How many consecutive errors must be observed before opening a new connection
/// (at most once per [`RETRY_INTERVAL]).
const RECONNECT_ERROR_COUNT: usize = 10;
/// Define a safe maximum ingester write response size.
const MAX_INCOMING_MSG_BYTES: usize = 1024 * 1024; // 1 MiB
/// Lazy [`Channel`] connector.
///
/// Connections are attempted in a background thread every [`RETRY_INTERVAL`].
/// once a connection has been established, the [`Channel`] internally handles
/// reconnections as needed.
///
/// Returns [`RpcWriteClientError::UpstreamNotConnected`] when no connection is
/// available.
#[derive(Debug)]
pub struct LazyConnector {
addr: Endpoint,
connection: Arc<Mutex<Option<Channel>>>,
/// The maximum outgoing message size.
///
/// The incoming size remains bounded at [`MAX_INCOMING_MSG_BYTES`] as the
/// ingester SHOULD NOT ever generate a response larger than this.
max_outgoing_msg_bytes: usize,
/// The number of request errors observed without a single success.
consecutive_errors: Arc<AtomicUsize>,
/// A task that periodically opens a new connection to `addr` when
/// `consecutive_errors` is more than [`RECONNECT_ERROR_COUNT`].
connection_task: JoinHandle<()>,
trace_context_header_name: String,
}
impl LazyConnector {
/// Lazily connect to `addr`.
pub fn new(
addr: Endpoint,
request_timeout: Duration,
max_outgoing_msg_bytes: usize,
trace_context_header_name: String,
) -> Self {
let addr = addr
.connect_timeout(CONNECT_TIMEOUT)
.timeout(request_timeout);
let connection = Default::default();
// Drive first connection by setting it above the connection limit.
let consecutive_errors = Arc::new(AtomicUsize::new(RECONNECT_ERROR_COUNT + 1));
Self {
addr: addr.clone(),
max_outgoing_msg_bytes,
connection: Arc::clone(&connection),
connection_task: tokio::spawn(try_connect(
addr,
connection,
Arc::clone(&consecutive_errors),
)),
consecutive_errors,
trace_context_header_name,
}
}
/// Returns `true` if a connection was established at some point in the
/// past.
///
/// If true, the connection may be active and healthy, or currently
/// unusable.
pub fn did_connect(&self) -> bool {
self.connection.lock().is_some()
}
}
#[async_trait]
impl WriteClient for LazyConnector {
async fn write(
&self,
op: WriteRequest,
span_ctx: Option<SpanContext>,
) -> Result<(), RpcWriteClientError> {
let conn = self.connection.lock().clone();
let conn = conn.ok_or_else(|| {
RpcWriteClientError::UpstreamNotConnected(self.addr.uri().to_string())
})?;
match TracePropagatingWriteClient::new(
WriteServiceClient::new(conn)
.max_encoding_message_size(self.max_outgoing_msg_bytes)
.max_decoding_message_size(MAX_INCOMING_MSG_BYTES),
&self.trace_context_header_name,
)
.write(op, span_ctx)
.await
{
Err(e) if is_envoy_unavailable_error(&e) => {
warn!(error=%e, "detected envoy proxy upstream network error translation, reconnecting");
self.consecutive_errors
.store(RECONNECT_ERROR_COUNT + 1, Ordering::Relaxed);
return Err(e);
}
Err(e) => {
self.consecutive_errors.fetch_add(1, Ordering::Relaxed);
return Err(e);
}
Ok(_) => {
self.consecutive_errors.store(0, Ordering::Relaxed);
Ok(())
}
}
}
}
/// Returns `true` if `e` is a gRPC error with the status [`Code::Unavailable`],
/// and a metadata entry indicating the response was generated by an envoy proxy
/// instance.
///
/// This is needed because the envoy proxy effectively converts network errors
/// (dial & I/O errors) into application-level (gRPC) errors, much like a pure
/// HTTP proxy would. Unfortunately this is a breaking change in behaviour for
/// networking code like [`tonic`]'s transport implementation, which can no
/// longer easily differentiate network errors from actual application errors.
fn is_envoy_unavailable_error(e: &RpcWriteClientError) -> bool {
match e {
RpcWriteClientError::Upstream(e) if e.code() == Code::Unavailable => e
.metadata()
.get("server")
.map(|v| v == AsciiMetadataValue::from_static("envoy"))
.unwrap_or(false),
RpcWriteClientError::Upstream(_) => false,
RpcWriteClientError::MisconfiguredMetadataKey(_) => false,
RpcWriteClientError::MisconfiguredMetadataValue(_) => false,
RpcWriteClientError::UpstreamNotConnected(_) => unreachable!(),
}
}
impl Drop for LazyConnector {
fn drop(&mut self) {
self.connection_task.abort();
}
}
async fn try_connect(
addr: Endpoint,
connection: Arc<Mutex<Option<Channel>>>,
consecutive_errors: Arc<AtomicUsize>,
) {
loop {
if consecutive_errors.load(Ordering::Relaxed) > RECONNECT_ERROR_COUNT {
match addr.connect().await {
Ok(v) => {
info!(endpoint = %addr.uri(), "connected to upstream ingester");
*connection.lock() = Some(v);
consecutive_errors.store(0, Ordering::Relaxed);
}
Err(e) => warn!(
endpoint = %addr.uri(),
error=%e,
"failed to connect to upstream ingester"
),
}
}
tokio::time::sleep(RETRY_INTERVAL).await;
}
}
|
pub use VkSparseImageFormatFlags::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkSparseImageFormatFlags {
VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x0000_0001,
VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x0000_0002,
VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x0000_0004,
}
use crate::SetupVkFlags;
#[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct VkSparseImageFormatFlagBits(u32);
SetupVkFlags!(VkSparseImageFormatFlags, VkSparseImageFormatFlagBits);
|
use std::{
collections::HashMap,
io::{Cursor, Read, Write},
net::{TcpListener, TcpStream},
sync::Arc,
};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use lazy_static::lazy_static;
use rustls::Session;
use zenith_utils::postgres_backend::{AuthType, Handler, PostgresBackend};
fn make_tcp_pair() -> (TcpStream, TcpStream) {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let addr = listener.local_addr().unwrap();
let client_stream = TcpStream::connect(addr).unwrap();
let (server_stream, _) = listener.accept().unwrap();
(server_stream, client_stream)
}
lazy_static! {
static ref KEY: rustls::PrivateKey = {
let mut cursor = Cursor::new(include_bytes!("key.pem"));
rustls::internal::pemfile::rsa_private_keys(&mut cursor).unwrap()[0].clone()
};
static ref CERT: rustls::Certificate = {
let mut cursor = Cursor::new(include_bytes!("cert.pem"));
rustls::internal::pemfile::certs(&mut cursor).unwrap()[0].clone()
};
}
#[test]
fn ssl() {
let (mut client_sock, server_sock) = make_tcp_pair();
const QUERY: &[u8] = b"hello world";
let client_jh = std::thread::spawn(move || {
// SSLRequest
client_sock.write_u32::<BigEndian>(8).unwrap();
client_sock.write_u32::<BigEndian>(80877103).unwrap();
let ssl_response = client_sock.read_u8().unwrap();
assert_eq!(b'S', ssl_response);
let mut cfg = rustls::ClientConfig::new();
cfg.root_store.add(&CERT).unwrap();
let client_config = Arc::new(cfg);
let dns_name = webpki::DNSNameRef::try_from_ascii_str("localhost").unwrap();
let mut session = rustls::ClientSession::new(&client_config, dns_name);
session.complete_io(&mut client_sock).unwrap();
assert!(!session.is_handshaking());
let mut stream = rustls::Stream::new(&mut session, &mut client_sock);
// StartupMessage
stream.write_u32::<BigEndian>(9).unwrap();
stream.write_u32::<BigEndian>(196608).unwrap();
stream.write_u8(0).unwrap();
stream.flush().unwrap();
// wait for ReadyForQuery
let mut msg_buf = Vec::new();
loop {
let msg = stream.read_u8().unwrap();
let size = stream.read_u32::<BigEndian>().unwrap() - 4;
msg_buf.resize(size as usize, 0);
stream.read_exact(&mut msg_buf).unwrap();
if msg == b'Z' {
// ReadyForQuery
break;
}
}
// Query
stream.write_u8(b'Q').unwrap();
stream
.write_u32::<BigEndian>(4u32 + QUERY.len() as u32)
.unwrap();
stream.write_all(QUERY).unwrap();
stream.flush().unwrap();
// ReadyForQuery
let msg = stream.read_u8().unwrap();
assert_eq!(msg, b'Z');
});
struct TestHandler {
got_query: bool,
}
impl Handler for TestHandler {
fn process_query(
&mut self,
_pgb: &mut PostgresBackend,
query_string: bytes::Bytes,
) -> anyhow::Result<()> {
self.got_query = query_string.as_ref() == QUERY;
Ok(())
}
}
let mut handler = TestHandler { got_query: false };
let mut cfg = rustls::ServerConfig::new(rustls::NoClientAuth::new());
cfg.set_single_cert(vec![CERT.clone()], KEY.clone())
.unwrap();
let tls_config = Some(Arc::new(cfg));
let pgb = PostgresBackend::new(server_sock, AuthType::Trust, tls_config).unwrap();
pgb.run(&mut handler).unwrap();
assert!(handler.got_query);
client_jh.join().unwrap();
// TODO consider shutdown behavior
}
#[test]
fn no_ssl() {
let (mut client_sock, server_sock) = make_tcp_pair();
let client_jh = std::thread::spawn(move || {
let mut buf = BytesMut::new();
// SSLRequest
buf.put_u32(8);
buf.put_u32(80877103);
client_sock.write_all(&buf).unwrap();
buf.clear();
let ssl_response = client_sock.read_u8().unwrap();
assert_eq!(b'N', ssl_response);
});
struct TestHandler;
impl Handler for TestHandler {
fn process_query(
&mut self,
_pgb: &mut PostgresBackend,
_query_string: bytes::Bytes,
) -> anyhow::Result<()> {
panic!()
}
}
let mut handler = TestHandler;
let pgb = PostgresBackend::new(server_sock, AuthType::Trust, None).unwrap();
pgb.run(&mut handler).unwrap();
client_jh.join().unwrap();
}
#[test]
fn server_forces_ssl() {
let (mut client_sock, server_sock) = make_tcp_pair();
let client_jh = std::thread::spawn(move || {
// StartupMessage
client_sock.write_u32::<BigEndian>(9).unwrap();
client_sock.write_u32::<BigEndian>(196608).unwrap();
client_sock.write_u8(0).unwrap();
client_sock.flush().unwrap();
// ErrorResponse
assert_eq!(client_sock.read_u8().unwrap(), b'E');
let len = client_sock.read_u32::<BigEndian>().unwrap() - 4;
let mut body = vec![0; len as usize];
client_sock.read_exact(&mut body).unwrap();
let mut body = Bytes::from(body);
let mut errors = HashMap::new();
loop {
let field_type = body.get_u8();
if field_type == 0u8 {
break;
}
let end_idx = body.iter().position(|&b| b == 0u8).unwrap();
let mut value = body.split_to(end_idx + 1);
assert_eq!(value[end_idx], 0u8);
value.truncate(end_idx);
let old = errors.insert(field_type, value);
assert!(old.is_none());
}
assert!(!body.has_remaining());
assert_eq!("must connect with TLS", errors.get(&b'M').unwrap());
// TODO read failure
});
struct TestHandler;
impl Handler for TestHandler {
fn process_query(
&mut self,
_pgb: &mut PostgresBackend,
_query_string: bytes::Bytes,
) -> anyhow::Result<()> {
panic!()
}
}
let mut handler = TestHandler;
let mut cfg = rustls::ServerConfig::new(rustls::NoClientAuth::new());
cfg.set_single_cert(vec![CERT.clone()], KEY.clone())
.unwrap();
let tls_config = Some(Arc::new(cfg));
let pgb = PostgresBackend::new(server_sock, AuthType::Trust, tls_config).unwrap();
let res = pgb.run(&mut handler).unwrap_err();
assert_eq!("client did not connect with TLS", format!("{}", res));
client_jh.join().unwrap();
// TODO consider shutdown behavior
}
|
use rand::Rng;
use std::{fmt, io};
const WORDS: &[&str] = &[
"abruptly",
"absurd",
"abyss",
"affix",
"askew",
"avenue",
"awkward",
"axiom",
"azure",
"bagpipes",
"bandwagon",
"banjo",
"bayou",
"beekeeper",
"bikini",
"blitz",
"blizzard",
"boggle",
"bookworm",
"boxcar",
"boxful",
"buckaroo",
"buffalo",
"buffoon",
"buxom",
"buzzard",
"buzzing",
"buzzwords",
"caliph",
"cobweb",
"cockiness",
"croquet",
"crypt",
"curacao",
"cycle",
"daiquiri",
"dirndl",
"disavow",
"dizzying",
"duplex",
"dwarves",
"embezzle",
"equip",
"espionage",
"euouae",
"exodus",
"faking",
"fishhook",
"fixable",
"fjord",
"flapjack",
"flopping",
"fluffiness",
"flyby",
"foxglove",
"frazzled",
"frizzled",
"fuchsia",
"funny",
"gabby",
"galaxy",
"galvanize",
"gazebo",
"giaour",
"gizmo",
"glowworm",
"glyph",
"gnarly",
"gnostic",
"gossip",
"grogginess",
"haiku",
"haphazard",
"hyphen",
"iatrogenic",
"icebox",
"injury",
"ivory",
"ivy",
"jackpot",
"jaundice",
"jawbreaker",
"jaywalk",
"jazziest",
"jazzy",
"jelly",
"jigsaw",
"jinx",
"jiujitsu",
"jockey",
"jogging",
"joking",
"jovial",
"joyful",
"juicy",
"jukebox",
"jumbo",
"kayak",
"kazoo",
"keyhole",
"khaki",
"kilobyte",
"kiosk",
"kitsch",
"kiwifruit",
"klutz",
"knapsack",
"larynx",
"lengths",
"lucky",
"luxury",
"lymph",
"marquis",
"matrix",
"megahertz",
"microwave",
"mnemonic",
"mystify",
"naphtha",
"nightclub",
"nowadays",
"numbskull",
"nymph",
"onyx",
"ovary",
"oxidize",
"oxygen",
"pajama",
"peekaboo",
"phlegm",
"pixel",
"pizazz",
"pneumonia",
"polka",
"pshaw",
"psyche",
"puppy",
"puzzling",
"quartz",
"queue",
"quips",
"quixotic",
"quiz",
"quizzes",
"quorum",
"razzmatazz",
"rhubarb",
"rhythm",
"rickshaw",
"schnapps",
"scratch",
"shiv",
"snazzy",
"sphinx",
"spritz",
"squawk",
"staff",
"strength",
"strengths",
"stretch",
"stronghold",
"stymied",
"subway",
"swivel",
"syndrome",
"thriftless",
"thumbscrew",
"topaz",
"transcript",
"transgress",
"transplant",
"triphthong",
"twelfth",
"twelfths",
"unknown",
"unworthy",
"unzip",
"uptown",
"vaporize",
"vixen",
"vodka",
"voodoo",
"vortex",
"voyeurism",
"walkway",
"waltz",
"wave",
"wavy",
"waxy",
"wellspring",
"wheezy",
"whiskey",
"whizzing",
"whomever",
"wimpy",
"witchcraft",
"wizard",
"woozy",
"wristwatch",
"wyvern",
"xylophone",
"yachtsman",
"yippee",
"yoked",
"youthful",
"yummy",
"zephyr",
"zigzag",
"zigzagging",
"zilch",
"zipper",
"zodiac",
"zombie",
];
/* Stuff to think about
1. Instead of using a builder you can implement a new function inside the struct
2. Or you could use Default::default()
Benefits
- able to create generic methods for anytype that implements default::defult
*/
// Represents each letter the user must guess
// hidden represents if the letter has been
// guessed (false) or not (true)
#[derive(Debug, Default)]
struct Letter {
letter: char,
hidden: bool,
num: i32,
other: Option<bool>,
stuff: String,
}
impl fmt::Display for Letter {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.hidden {
write!(f, "*")
} else {
write!(f, "{} ", self.letter)
}
}
}
fn create<T>() -> T
where
T: Default,
{
Default::default()
}
struct Word {
letters: Vec<Letter>,
}
impl fmt::Display for Word {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let word: String = self.letters.iter().map(|l| format!("{}", l)).collect();
write!(f, "-- {} --", word)
}
}
impl Default for Word {
fn default() -> Self {
let random_number = rand::thread_rng().gen_range(0, WORDS.len());
let to_guess = WORDS[random_number].to_owned();
let letters: Vec<Letter> = to_guess
.chars()
.map(|letter| Letter {
letter,
num: 2,
..Default::default()
})
.collect();
Word { letters }
}
}
impl Word {
fn win(&self) -> bool {
let discovered: Vec<_> = self.letters.iter().filter(|letter| letter.hidden).collect();
discovered.len() == 0
}
// Update the displayed word after a guess
// @Returns if the word was updated
fn update_letters(&mut self, guess: Vec<char>) {
self.letters.iter_mut().for_each(|l| {
if guess.contains(&l.letter) {
l.hidden = false;
}
});
}
}
fn main() {
// Generates a word for the player to guess "word"
// The word representing the player's progress "w _ o _"
let l: Letter = create();
let w: Word = create();
let mut displayed_word: Word = Default::default();
println!("{}", displayed_word);
while !displayed_word.win() {
displayed_word.update_letters(guess());
println!("{}", displayed_word);
// update_displayed_word
}
println!("You Win!")
}
// @Return the the user's guess
fn guess() -> Vec<char> {
let mut input = String::new();
while input.is_empty() {
println!("Guess a letter or a word!");
io::stdin().read_line(&mut input).unwrap();
input = input.to_lowercase().trim().to_string();
}
let mut guess: Vec<char> = Vec::new();
for c in input.chars() {
guess.push(c);
}
guess
}
|
use libc;
use core::ptr;
use alloc::borrow::ToOwned;
use super::KAuthResult;
use kernel::KAuthVNodeAction;
#[derive(Debug)]
pub struct ScopeListener(*const libc::c_void);
impl Drop for ScopeListener {
fn drop(&mut self) {
extern "C" {
fn kauth_unlisten_scope(scope: *const libc::c_void);
}
println!("Freeing ScopeListener");
let &mut ScopeListener(ref mut inner) = self;
if !inner.is_null() {
unsafe {
kauth_unlisten_scope(inner.to_owned());
}
}
}
}
#[derive(Debug)]
pub enum Scope {
KAUTH_SCOPE_VNODE = 1,
KAUTH_SCOPE_GENERIC = 2,
KAUTH_SCOPE_PROCESS = 3,
KAUTH_SCOPE_FILEOP = 4,
}
pub type ScopeCallback = extern "C" fn(*const libc::c_void,
*const libc::c_void,
libc::c_int,
*const libc::c_void,
*const libc::c_void,
*const libc::c_void,
*const libc::c_int)
-> libc::c_int;
impl Scope {
pub fn register(scope: Scope, callback: ScopeCallback) -> Result<ScopeListener, ()> {
extern "C" {
pub fn kauth_listen_scope(scope_str: *const libc::c_char,
callback: ScopeCallback,
idata: *const libc::c_void)
-> *const libc::c_void;
}
let scope_str = scope.value();
println!("Registering {:?} {}", scope, scope_str);
unsafe {
let listener = kauth_listen_scope(scope_str.as_ptr() as *const libc::c_char,
callback,
ptr::null());
if listener.is_null() {
Err(())
} else {
Ok(ScopeListener(listener))
}
}
}
pub fn value(&self) -> &str {
match *self {
Scope::KAUTH_SCOPE_VNODE => "com.apple.kauth.vnode\0",
Scope::KAUTH_SCOPE_GENERIC => "com.apple.kauth.generic\0",
Scope::KAUTH_SCOPE_PROCESS => "com.apple.kauth.process\0",
Scope::KAUTH_SCOPE_FILEOP => "com.apple.kauth.fileop\0",
}
}
}
pub enum Actions {
KAUTH_GENERIC_ISSUSER = 1,
KAUTH_PROCESS_CANSIGNAL = 2,
KAUTH_PROCESS_CANTRACE = 3,
}
|
extern crate byteorder;
mod nes;
fn main() {
let mut nes = nes::NES::new();
let file_name = "roms/donkey.nes";
println!("Loading ROM file {}:", file_name);
match nes::load_nes_file(file_name) {
Ok(rom) => {
println!(" number of PRGROM banks: {}", rom.num_prg_banks);
println!(" number of CHRROM banks: {}", rom.num_chr_banks);
println!(" number of RAM banks: {}", rom.num_ram_banks);
println!(" mapper id: {}", rom.mapper_id);
nes.run(&rom);
},
Err(err) => println!("Error: {}", err)
}
}
|
// Configuration Management module
pub mod cli; |
//! A module for caching or updating git repositories.
use crate::db_queries::{update_repo, UpdateUrlError};
use crate::elm_package::{ElmPackage, ElmPackageError};
use crate::git_repo::GitError;
use fn_search_backend::Config;
use std::path::Path;
use std::{error::Error, fmt};
/// Configuration options for caching the repositories.
pub struct RepoCacheOptions {
/// root path for cache
pub cache_path: String,
pub chromium_bin_path: String,
pub git_bin_path: String,
}
pub enum SyncResult {
Update,
Clone,
}
/// Download or update all packages in an [ElmPackageMetadataRaw](../elm_package/struct.ElmPackageMetadataRaw.html)
/// # Errors
/// An error is returned on network error or git error
/// # Example
/// ```ignore
/// use fn_search_backend_scrape::elm_package::get_elm_libs;
///
/// let options = RepoCacheOptions{cache_path: String::from("/path/to/cache")}
/// let res = get_elm_libs()?
/// .into_iter()
/// .map(|pkg| {
/// sync_repo(&pkg, &options)
/// });
/// // Potentially do something with the results/errors
/// ```
pub fn sync_repo(
m: &ElmPackage,
o: &RepoCacheOptions,
config: &Config,
) -> Result<SyncResult, SyncRepoError> {
let repo_path = m.get_repo_path(o)?;
let git_repo = m.find_git_repo(config, o)?;
update_repo(
&config.db,
m.name.as_str(),
git_repo.url.as_str(),
git_repo.version.as_str(),
)?;
if Path::new(repo_path.as_str()).exists() {
git_repo.update_repo(repo_path.as_str(), config, o)?;
Ok(SyncResult::Update)
} else {
git_repo.clone_repo(repo_path.as_str(), config, o)?;
Ok(SyncResult::Clone)
}
}
#[derive(Debug)]
pub enum SyncRepoError {
GitError(GitError),
ElmPackageError(ElmPackageError),
UpdateUrlError(UpdateUrlError),
}
impl Error for SyncRepoError {}
impl fmt::Display for SyncRepoError {
fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> Result<(), fmt::Error> {
match self {
SyncRepoError::GitError(e) => write!(f, "{}", e),
SyncRepoError::ElmPackageError(e) => write!(f, "{}", e),
SyncRepoError::UpdateUrlError(e) => write!(f, "{}", e),
}
}
}
impl From<GitError> for SyncRepoError {
fn from(e: GitError) -> Self {
SyncRepoError::GitError(e)
}
}
impl From<ElmPackageError> for SyncRepoError {
fn from(e: ElmPackageError) -> Self {
SyncRepoError::ElmPackageError(e)
}
}
impl From<UpdateUrlError> for SyncRepoError {
fn from(e: UpdateUrlError) -> Self {
SyncRepoError::UpdateUrlError(e)
}
}
|
// auto generated, do not modify.
// created: Wed Jan 20 00:44:03 2016
// src-file: /QtNetwork/qsslerror.h
// dst-file: /src/network/qsslerror.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= main block end
// use block begin =>
use std::ops::Deref;
use super::qsslcertificate::QSslCertificate; // 773
use super::super::core::qstring::QString; // 771
// <= use block end
// ext block begin =>
// #[link(name = "Qt5Core")]
// #[link(name = "Qt5Gui")]
// #[link(name = "Qt5Widgets")]
// #[link(name = "QtInline")]
extern {
fn QSslError_Class_Size() -> c_int;
// proto: void QSslError::QSslError();
fn _ZN9QSslErrorC2Ev(qthis: u64 /* *mut c_void*/);
// proto: void QSslError::swap(QSslError & other);
fn _ZN9QSslError4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QSslError::QSslError(const QSslError & other);
fn _ZN9QSslErrorC2ERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QSslCertificate QSslError::certificate();
fn _ZNK9QSslError11certificateEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QString QSslError::errorString();
fn _ZNK9QSslError11errorStringEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QSslError::~QSslError();
fn _ZN9QSslErrorD2Ev(qthis: u64 /* *mut c_void*/);
} // <= ext block end
// body block begin =>
// class sizeof(QSslError)=1
#[derive(Default)]
pub struct QSslError {
// qbase: None,
pub qclsinst: u64 /* *mut c_void*/,
}
impl /*struct*/ QSslError {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QSslError {
return QSslError{qclsinst: qthis, ..Default::default()};
}
}
// proto: void QSslError::QSslError();
impl /*struct*/ QSslError {
pub fn new<T: QSslError_new>(value: T) -> QSslError {
let rsthis = value.new();
return rsthis;
// return 1;
}
}
pub trait QSslError_new {
fn new(self) -> QSslError;
}
// proto: void QSslError::QSslError();
impl<'a> /*trait*/ QSslError_new for () {
fn new(self) -> QSslError {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN9QSslErrorC2Ev()};
let ctysz: c_int = unsafe{QSslError_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
unsafe {_ZN9QSslErrorC2Ev(qthis_ph)};
let qthis: u64 = qthis_ph;
let rsthis = QSslError{qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: void QSslError::swap(QSslError & other);
impl /*struct*/ QSslError {
pub fn swap<RetType, T: QSslError_swap<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.swap(self);
// return 1;
}
}
pub trait QSslError_swap<RetType> {
fn swap(self , rsthis: & QSslError) -> RetType;
}
// proto: void QSslError::swap(QSslError & other);
impl<'a> /*trait*/ QSslError_swap<()> for (&'a QSslError) {
fn swap(self , rsthis: & QSslError) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN9QSslError4swapERS_()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {_ZN9QSslError4swapERS_(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QSslError::QSslError(const QSslError & other);
impl<'a> /*trait*/ QSslError_new for (&'a QSslError) {
fn new(self) -> QSslError {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN9QSslErrorC2ERKS_()};
let ctysz: c_int = unsafe{QSslError_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
let arg0 = self.qclsinst as *mut c_void;
unsafe {_ZN9QSslErrorC2ERKS_(qthis_ph, arg0)};
let qthis: u64 = qthis_ph;
let rsthis = QSslError{qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: QSslCertificate QSslError::certificate();
impl /*struct*/ QSslError {
pub fn certificate<RetType, T: QSslError_certificate<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.certificate(self);
// return 1;
}
}
pub trait QSslError_certificate<RetType> {
fn certificate(self , rsthis: & QSslError) -> RetType;
}
// proto: QSslCertificate QSslError::certificate();
impl<'a> /*trait*/ QSslError_certificate<QSslCertificate> for () {
fn certificate(self , rsthis: & QSslError) -> QSslCertificate {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK9QSslError11certificateEv()};
let mut ret = unsafe {_ZNK9QSslError11certificateEv(rsthis.qclsinst)};
let mut ret1 = QSslCertificate::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QString QSslError::errorString();
impl /*struct*/ QSslError {
pub fn errorString<RetType, T: QSslError_errorString<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.errorString(self);
// return 1;
}
}
pub trait QSslError_errorString<RetType> {
fn errorString(self , rsthis: & QSslError) -> RetType;
}
// proto: QString QSslError::errorString();
impl<'a> /*trait*/ QSslError_errorString<QString> for () {
fn errorString(self , rsthis: & QSslError) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK9QSslError11errorStringEv()};
let mut ret = unsafe {_ZNK9QSslError11errorStringEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QSslError::~QSslError();
impl /*struct*/ QSslError {
pub fn free<RetType, T: QSslError_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QSslError_free<RetType> {
fn free(self , rsthis: & QSslError) -> RetType;
}
// proto: void QSslError::~QSslError();
impl<'a> /*trait*/ QSslError_free<()> for () {
fn free(self , rsthis: & QSslError) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN9QSslErrorD2Ev()};
unsafe {_ZN9QSslErrorD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// <= body block end
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AccountPictureKind(pub i32);
impl AccountPictureKind {
pub const SmallImage: AccountPictureKind = AccountPictureKind(0i32);
pub const LargeImage: AccountPictureKind = AccountPictureKind(1i32);
pub const Video: AccountPictureKind = AccountPictureKind(2i32);
}
impl ::core::convert::From<i32> for AccountPictureKind {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AccountPictureKind {
type Abi = Self;
}
unsafe impl ::windows::core::RuntimeType for AccountPictureKind {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.System.UserProfile.AccountPictureKind;i4)");
}
impl ::windows::core::DefaultType for AccountPictureKind {
type DefaultType = Self;
}
pub struct AdvertisingManager {}
impl AdvertisingManager {
pub fn AdvertisingId() -> ::windows::core::Result<::windows::core::HSTRING> {
Self::IAdvertisingManagerStatics(|this| unsafe {
let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__)
})
}
pub fn GetForUser<'a, Param0: ::windows::core::IntoParam<'a, super::User>>(user: Param0) -> ::windows::core::Result<AdvertisingManagerForUser> {
Self::IAdvertisingManagerStatics2(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), user.into_param().abi(), &mut result__).from_abi::<AdvertisingManagerForUser>(result__)
})
}
pub fn IAdvertisingManagerStatics<R, F: FnOnce(&IAdvertisingManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AdvertisingManager, IAdvertisingManagerStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
pub fn IAdvertisingManagerStatics2<R, F: FnOnce(&IAdvertisingManagerStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AdvertisingManager, IAdvertisingManagerStatics2> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
impl ::windows::core::RuntimeName for AdvertisingManager {
const NAME: &'static str = "Windows.System.UserProfile.AdvertisingManager";
}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct AdvertisingManagerForUser(pub ::windows::core::IInspectable);
impl AdvertisingManagerForUser {
pub fn AdvertisingId(&self) -> ::windows::core::Result<::windows::core::HSTRING> {
let this = self;
unsafe {
let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__)
}
}
pub fn User(&self) -> ::windows::core::Result<super::User> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::User>(result__)
}
}
}
unsafe impl ::windows::core::RuntimeType for AdvertisingManagerForUser {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.AdvertisingManagerForUser;{928bf3d0-cf7c-4ab0-a7dc-6dc5bcd44252})");
}
unsafe impl ::windows::core::Interface for AdvertisingManagerForUser {
type Vtable = IAdvertisingManagerForUser_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x928bf3d0_cf7c_4ab0_a7dc_6dc5bcd44252);
}
impl ::windows::core::RuntimeName for AdvertisingManagerForUser {
const NAME: &'static str = "Windows.System.UserProfile.AdvertisingManagerForUser";
}
impl ::core::convert::From<AdvertisingManagerForUser> for ::windows::core::IUnknown {
fn from(value: AdvertisingManagerForUser) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&AdvertisingManagerForUser> for ::windows::core::IUnknown {
fn from(value: &AdvertisingManagerForUser) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AdvertisingManagerForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a AdvertisingManagerForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<AdvertisingManagerForUser> for ::windows::core::IInspectable {
fn from(value: AdvertisingManagerForUser) -> Self {
value.0
}
}
impl ::core::convert::From<&AdvertisingManagerForUser> for ::windows::core::IInspectable {
fn from(value: &AdvertisingManagerForUser) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AdvertisingManagerForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a AdvertisingManagerForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
unsafe impl ::core::marker::Send for AdvertisingManagerForUser {}
unsafe impl ::core::marker::Sync for AdvertisingManagerForUser {}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct AssignedAccessSettings(pub ::windows::core::IInspectable);
impl AssignedAccessSettings {
pub fn IsEnabled(&self) -> ::windows::core::Result<bool> {
let this = self;
unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
}
}
pub fn IsSingleAppKioskMode(&self) -> ::windows::core::Result<bool> {
let this = self;
unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
}
}
pub fn User(&self) -> ::windows::core::Result<super::User> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::User>(result__)
}
}
pub fn GetDefault() -> ::windows::core::Result<AssignedAccessSettings> {
Self::IAssignedAccessSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AssignedAccessSettings>(result__)
})
}
pub fn GetForUser<'a, Param0: ::windows::core::IntoParam<'a, super::User>>(user: Param0) -> ::windows::core::Result<AssignedAccessSettings> {
Self::IAssignedAccessSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), user.into_param().abi(), &mut result__).from_abi::<AssignedAccessSettings>(result__)
})
}
pub fn IAssignedAccessSettingsStatics<R, F: FnOnce(&IAssignedAccessSettingsStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<AssignedAccessSettings, IAssignedAccessSettingsStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
unsafe impl ::windows::core::RuntimeType for AssignedAccessSettings {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.AssignedAccessSettings;{1bc57f1c-e971-5757-b8e0-512f8b8c46d2})");
}
unsafe impl ::windows::core::Interface for AssignedAccessSettings {
type Vtable = IAssignedAccessSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1bc57f1c_e971_5757_b8e0_512f8b8c46d2);
}
impl ::windows::core::RuntimeName for AssignedAccessSettings {
const NAME: &'static str = "Windows.System.UserProfile.AssignedAccessSettings";
}
impl ::core::convert::From<AssignedAccessSettings> for ::windows::core::IUnknown {
fn from(value: AssignedAccessSettings) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&AssignedAccessSettings> for ::windows::core::IUnknown {
fn from(value: &AssignedAccessSettings) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AssignedAccessSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a AssignedAccessSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<AssignedAccessSettings> for ::windows::core::IInspectable {
fn from(value: AssignedAccessSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&AssignedAccessSettings> for ::windows::core::IInspectable {
fn from(value: &AssignedAccessSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AssignedAccessSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a AssignedAccessSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
unsafe impl ::core::marker::Send for AssignedAccessSettings {}
unsafe impl ::core::marker::Sync for AssignedAccessSettings {}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct DiagnosticsSettings(pub ::windows::core::IInspectable);
impl DiagnosticsSettings {
pub fn CanUseDiagnosticsToTailorExperiences(&self) -> ::windows::core::Result<bool> {
let this = self;
unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
}
}
pub fn User(&self) -> ::windows::core::Result<super::User> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::User>(result__)
}
}
pub fn GetDefault() -> ::windows::core::Result<DiagnosticsSettings> {
Self::IDiagnosticsSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<DiagnosticsSettings>(result__)
})
}
pub fn GetForUser<'a, Param0: ::windows::core::IntoParam<'a, super::User>>(user: Param0) -> ::windows::core::Result<DiagnosticsSettings> {
Self::IDiagnosticsSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), user.into_param().abi(), &mut result__).from_abi::<DiagnosticsSettings>(result__)
})
}
pub fn IDiagnosticsSettingsStatics<R, F: FnOnce(&IDiagnosticsSettingsStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<DiagnosticsSettings, IDiagnosticsSettingsStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
unsafe impl ::windows::core::RuntimeType for DiagnosticsSettings {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.DiagnosticsSettings;{e5e9eccd-2711-44e0-973c-491d78048d24})");
}
unsafe impl ::windows::core::Interface for DiagnosticsSettings {
type Vtable = IDiagnosticsSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe5e9eccd_2711_44e0_973c_491d78048d24);
}
impl ::windows::core::RuntimeName for DiagnosticsSettings {
const NAME: &'static str = "Windows.System.UserProfile.DiagnosticsSettings";
}
impl ::core::convert::From<DiagnosticsSettings> for ::windows::core::IUnknown {
fn from(value: DiagnosticsSettings) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&DiagnosticsSettings> for ::windows::core::IUnknown {
fn from(value: &DiagnosticsSettings) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DiagnosticsSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DiagnosticsSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<DiagnosticsSettings> for ::windows::core::IInspectable {
fn from(value: DiagnosticsSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&DiagnosticsSettings> for ::windows::core::IInspectable {
fn from(value: &DiagnosticsSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DiagnosticsSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DiagnosticsSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
unsafe impl ::core::marker::Send for DiagnosticsSettings {}
unsafe impl ::core::marker::Sync for DiagnosticsSettings {}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct FirstSignInSettings(pub ::windows::core::IInspectable);
impl FirstSignInSettings {
#[cfg(feature = "Foundation_Collections")]
pub fn First(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IIterator<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>> {
let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>>(self)?;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IIterator<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Lookup<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, key: Param0) -> ::windows::core::Result<::windows::core::IInspectable> {
let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>(self)?;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), key.into_param().abi(), &mut result__).from_abi::<::windows::core::IInspectable>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Size(&self) -> ::windows::core::Result<u32> {
let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>(self)?;
unsafe {
let mut result__: u32 = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn HasKey<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, key: Param0) -> ::windows::core::Result<bool> {
let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>(self)?;
unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), key.into_param().abi(), &mut result__).from_abi::<bool>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Split(&self, first: &mut ::core::option::Option<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>, second: &mut ::core::option::Option<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>) -> ::windows::core::Result<()> {
let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>(self)?;
unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), first as *mut _ as _, second as *mut _ as _).ok() }
}
pub fn GetDefault() -> ::windows::core::Result<FirstSignInSettings> {
Self::IFirstSignInSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<FirstSignInSettings>(result__)
})
}
pub fn IFirstSignInSettingsStatics<R, F: FnOnce(&IFirstSignInSettingsStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<FirstSignInSettings, IFirstSignInSettingsStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
unsafe impl ::windows::core::RuntimeType for FirstSignInSettings {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.FirstSignInSettings;{3e945153-3a5e-452e-a601-f5baad2a4870})");
}
unsafe impl ::windows::core::Interface for FirstSignInSettings {
type Vtable = IFirstSignInSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3e945153_3a5e_452e_a601_f5baad2a4870);
}
impl ::windows::core::RuntimeName for FirstSignInSettings {
const NAME: &'static str = "Windows.System.UserProfile.FirstSignInSettings";
}
impl ::core::convert::From<FirstSignInSettings> for ::windows::core::IUnknown {
fn from(value: FirstSignInSettings) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&FirstSignInSettings> for ::windows::core::IUnknown {
fn from(value: &FirstSignInSettings) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<FirstSignInSettings> for ::windows::core::IInspectable {
fn from(value: FirstSignInSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&FirstSignInSettings> for ::windows::core::IInspectable {
fn from(value: &FirstSignInSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[cfg(feature = "Foundation_Collections")]
impl ::core::convert::TryFrom<FirstSignInSettings> for super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>> {
type Error = ::windows::core::Error;
fn try_from(value: FirstSignInSettings) -> ::windows::core::Result<Self> {
::core::convert::TryFrom::try_from(&value)
}
}
#[cfg(feature = "Foundation_Collections")]
impl ::core::convert::TryFrom<&FirstSignInSettings> for super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>> {
type Error = ::windows::core::Error;
fn try_from(value: &FirstSignInSettings) -> ::windows::core::Result<Self> {
::windows::core::Interface::cast(value)
}
}
#[cfg(feature = "Foundation_Collections")]
impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>> for FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>> {
::windows::core::IntoParam::into_param(&self)
}
}
#[cfg(feature = "Foundation_Collections")]
impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>> for &FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>> {
::core::convert::TryInto::<super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>>>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None)
}
}
#[cfg(feature = "Foundation_Collections")]
impl ::core::convert::TryFrom<FirstSignInSettings> for super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable> {
type Error = ::windows::core::Error;
fn try_from(value: FirstSignInSettings) -> ::windows::core::Result<Self> {
::core::convert::TryFrom::try_from(&value)
}
}
#[cfg(feature = "Foundation_Collections")]
impl ::core::convert::TryFrom<&FirstSignInSettings> for super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable> {
type Error = ::windows::core::Error;
fn try_from(value: &FirstSignInSettings) -> ::windows::core::Result<Self> {
::windows::core::Interface::cast(value)
}
}
#[cfg(feature = "Foundation_Collections")]
impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>> for FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>> {
::windows::core::IntoParam::into_param(&self)
}
}
#[cfg(feature = "Foundation_Collections")]
impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>> for &FirstSignInSettings {
fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>> {
::core::convert::TryInto::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, ::windows::core::IInspectable>>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None)
}
}
unsafe impl ::core::marker::Send for FirstSignInSettings {}
unsafe impl ::core::marker::Sync for FirstSignInSettings {}
#[cfg(all(feature = "Foundation_Collections"))]
impl ::core::iter::IntoIterator for FirstSignInSettings {
type Item = super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>;
type IntoIter = super::super::Foundation::Collections::IIterator<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
::core::iter::IntoIterator::into_iter(&self)
}
}
#[cfg(all(feature = "Foundation_Collections"))]
impl ::core::iter::IntoIterator for &FirstSignInSettings {
type Item = super::super::Foundation::Collections::IKeyValuePair<::windows::core::HSTRING, ::windows::core::IInspectable>;
type IntoIter = super::super::Foundation::Collections::IIterator<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
self.First().unwrap()
}
}
pub struct GlobalizationPreferences {}
impl GlobalizationPreferences {
#[cfg(feature = "Foundation_Collections")]
pub fn Calendars() -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "Foundation_Collections")]
pub fn Clocks() -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "Foundation_Collections")]
pub fn Currencies() -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "Foundation_Collections")]
pub fn Languages() -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
})
}
pub fn HomeGeographicRegion() -> ::windows::core::Result<::windows::core::HSTRING> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__)
})
}
#[cfg(feature = "Globalization")]
pub fn WeekStartsOn() -> ::windows::core::Result<super::super::Globalization::DayOfWeek> {
Self::IGlobalizationPreferencesStatics(|this| unsafe {
let mut result__: super::super::Globalization::DayOfWeek = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Globalization::DayOfWeek>(result__)
})
}
pub fn TrySetHomeGeographicRegion<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(region: Param0) -> ::windows::core::Result<bool> {
Self::IGlobalizationPreferencesStatics2(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), region.into_param().abi(), &mut result__).from_abi::<bool>(result__)
})
}
#[cfg(feature = "Foundation_Collections")]
pub fn TrySetLanguages<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<::windows::core::HSTRING>>>(languagetags: Param0) -> ::windows::core::Result<bool> {
Self::IGlobalizationPreferencesStatics2(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), languagetags.into_param().abi(), &mut result__).from_abi::<bool>(result__)
})
}
pub fn GetForUser<'a, Param0: ::windows::core::IntoParam<'a, super::User>>(user: Param0) -> ::windows::core::Result<GlobalizationPreferencesForUser> {
Self::IGlobalizationPreferencesStatics3(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), user.into_param().abi(), &mut result__).from_abi::<GlobalizationPreferencesForUser>(result__)
})
}
pub fn IGlobalizationPreferencesStatics<R, F: FnOnce(&IGlobalizationPreferencesStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<GlobalizationPreferences, IGlobalizationPreferencesStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
pub fn IGlobalizationPreferencesStatics2<R, F: FnOnce(&IGlobalizationPreferencesStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<GlobalizationPreferences, IGlobalizationPreferencesStatics2> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
pub fn IGlobalizationPreferencesStatics3<R, F: FnOnce(&IGlobalizationPreferencesStatics3) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<GlobalizationPreferences, IGlobalizationPreferencesStatics3> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
impl ::windows::core::RuntimeName for GlobalizationPreferences {
const NAME: &'static str = "Windows.System.UserProfile.GlobalizationPreferences";
}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct GlobalizationPreferencesForUser(pub ::windows::core::IInspectable);
impl GlobalizationPreferencesForUser {
pub fn User(&self) -> ::windows::core::Result<super::User> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::User>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Calendars(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Clocks(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Currencies(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
}
}
#[cfg(feature = "Foundation_Collections")]
pub fn Languages(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__)
}
}
pub fn HomeGeographicRegion(&self) -> ::windows::core::Result<::windows::core::HSTRING> {
let this = self;
unsafe {
let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__)
}
}
#[cfg(feature = "Globalization")]
pub fn WeekStartsOn(&self) -> ::windows::core::Result<super::super::Globalization::DayOfWeek> {
let this = self;
unsafe {
let mut result__: super::super::Globalization::DayOfWeek = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Globalization::DayOfWeek>(result__)
}
}
}
unsafe impl ::windows::core::RuntimeType for GlobalizationPreferencesForUser {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.GlobalizationPreferencesForUser;{150f0795-4f6e-40ba-a010-e27d81bda7f5})");
}
unsafe impl ::windows::core::Interface for GlobalizationPreferencesForUser {
type Vtable = IGlobalizationPreferencesForUser_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x150f0795_4f6e_40ba_a010_e27d81bda7f5);
}
impl ::windows::core::RuntimeName for GlobalizationPreferencesForUser {
const NAME: &'static str = "Windows.System.UserProfile.GlobalizationPreferencesForUser";
}
impl ::core::convert::From<GlobalizationPreferencesForUser> for ::windows::core::IUnknown {
fn from(value: GlobalizationPreferencesForUser) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&GlobalizationPreferencesForUser> for ::windows::core::IUnknown {
fn from(value: &GlobalizationPreferencesForUser) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GlobalizationPreferencesForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a GlobalizationPreferencesForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<GlobalizationPreferencesForUser> for ::windows::core::IInspectable {
fn from(value: GlobalizationPreferencesForUser) -> Self {
value.0
}
}
impl ::core::convert::From<&GlobalizationPreferencesForUser> for ::windows::core::IInspectable {
fn from(value: &GlobalizationPreferencesForUser) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GlobalizationPreferencesForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a GlobalizationPreferencesForUser {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
unsafe impl ::core::marker::Send for GlobalizationPreferencesForUser {}
unsafe impl ::core::marker::Sync for GlobalizationPreferencesForUser {}
#[repr(transparent)]
#[doc(hidden)]
pub struct IAdvertisingManagerForUser(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IAdvertisingManagerForUser {
type Vtable = IAdvertisingManagerForUser_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x928bf3d0_cf7c_4ab0_a7dc_6dc5bcd44252);
}
#[repr(C)]
#[doc(hidden)]
pub struct IAdvertisingManagerForUser_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IAdvertisingManagerStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IAdvertisingManagerStatics {
type Vtable = IAdvertisingManagerStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xadd3468c_a273_48cb_b346_3544522d5581);
}
#[repr(C)]
#[doc(hidden)]
pub struct IAdvertisingManagerStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IAdvertisingManagerStatics2(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IAdvertisingManagerStatics2 {
type Vtable = IAdvertisingManagerStatics2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdd0947af_1a6d_46b0_95bc_f3f9d6beb9fb);
}
#[repr(C)]
#[doc(hidden)]
pub struct IAdvertisingManagerStatics2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, user: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IAssignedAccessSettings(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IAssignedAccessSettings {
type Vtable = IAssignedAccessSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1bc57f1c_e971_5757_b8e0_512f8b8c46d2);
}
#[repr(C)]
#[doc(hidden)]
pub struct IAssignedAccessSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IAssignedAccessSettingsStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IAssignedAccessSettingsStatics {
type Vtable = IAssignedAccessSettingsStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x34a81d0d_8a29_5ef3_a7be_618e6ac3bd01);
}
#[repr(C)]
#[doc(hidden)]
pub struct IAssignedAccessSettingsStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, user: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IDiagnosticsSettings(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IDiagnosticsSettings {
type Vtable = IDiagnosticsSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe5e9eccd_2711_44e0_973c_491d78048d24);
}
#[repr(C)]
#[doc(hidden)]
pub struct IDiagnosticsSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IDiagnosticsSettingsStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IDiagnosticsSettingsStatics {
type Vtable = IDiagnosticsSettingsStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x72d2e80f_5390_4793_990b_3ccc7d6ac9c8);
}
#[repr(C)]
#[doc(hidden)]
pub struct IDiagnosticsSettingsStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, user: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IFirstSignInSettings(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IFirstSignInSettings {
type Vtable = IFirstSignInSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3e945153_3a5e_452e_a601_f5baad2a4870);
}
#[repr(C)]
#[doc(hidden)]
pub struct IFirstSignInSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IFirstSignInSettingsStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IFirstSignInSettingsStatics {
type Vtable = IFirstSignInSettingsStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ce18f0f_1c41_4ea0_b7a2_6f0c1c7e8438);
}
#[repr(C)]
#[doc(hidden)]
pub struct IFirstSignInSettingsStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesForUser(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IGlobalizationPreferencesForUser {
type Vtable = IGlobalizationPreferencesForUser_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x150f0795_4f6e_40ba_a010_e27d81bda7f5);
}
#[repr(C)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesForUser_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT,
#[cfg(feature = "Globalization")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Globalization::DayOfWeek) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Globalization"))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IGlobalizationPreferencesStatics {
type Vtable = IGlobalizationPreferencesStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x01bf4326_ed37_4e96_b0e9_c1340d1ea158);
}
#[repr(C)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT,
#[cfg(feature = "Globalization")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Globalization::DayOfWeek) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Globalization"))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics2(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IGlobalizationPreferencesStatics2 {
type Vtable = IGlobalizationPreferencesStatics2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfcce85f1_4300_4cd0_9cac_1a8e7b7e18f4);
}
#[repr(C)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, region: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut bool) -> ::windows::core::HRESULT,
#[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, languagetags: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation_Collections"))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics3(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IGlobalizationPreferencesStatics3 {
type Vtable = IGlobalizationPreferencesStatics3_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1e059733_35f5_40d8_b9e8_aef3ef856fce);
}
#[repr(C)]
#[doc(hidden)]
pub struct IGlobalizationPreferencesStatics3_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, user: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct ILockScreenImageFeedStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for ILockScreenImageFeedStatics {
type Vtable = ILockScreenImageFeedStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2c0d73f6_03a9_41a6_9b01_495251ff51d5);
}
#[repr(C)]
#[doc(hidden)]
pub struct ILockScreenImageFeedStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, syndicationfeeduri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct ILockScreenStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for ILockScreenStatics {
type Vtable = ILockScreenStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3ee9d3ad_b607_40ae_b426_7631d9821269);
}
#[repr(C)]
#[doc(hidden)]
pub struct ILockScreenStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Storage_Streams"))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IUserInformationStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IUserInformationStatics {
type Vtable = IUserInformationStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x77f3a910_48fa_489c_934e_2ae85ba8f772);
}
#[repr(C)]
#[doc(hidden)]
pub struct IUserInformationStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
#[cfg(feature = "Storage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, kind: AccountPictureKind, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Storage"))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, image: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, smallimage: ::windows::core::RawPtr, largeimage: ::windows::core::RawPtr, video: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, image: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, smallimage: ::windows::core::RawPtr, largeimage: ::windows::core::RawPtr, video: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, changehandler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
#[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Foundation"))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IUserProfilePersonalizationSettings(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IUserProfilePersonalizationSettings {
type Vtable = IUserProfilePersonalizationSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8ceddab4_7998_46d5_8dd3_184f1c5f9ab9);
}
#[repr(C)]
#[doc(hidden)]
pub struct IUserProfilePersonalizationSettings_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, imagefile: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize,
#[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, imagefile: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize,
);
#[repr(transparent)]
#[doc(hidden)]
pub struct IUserProfilePersonalizationSettingsStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IUserProfilePersonalizationSettingsStatics {
type Vtable = IUserProfilePersonalizationSettingsStatics_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x91acb841_5037_454b_9883_bb772d08dd16);
}
#[repr(C)]
#[doc(hidden)]
pub struct IUserProfilePersonalizationSettingsStatics_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT,
);
pub struct LockScreen {}
impl LockScreen {
#[cfg(feature = "Foundation")]
pub fn RequestSetImageFeedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(syndicationfeeduri: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<SetImageFeedResult>> {
Self::ILockScreenImageFeedStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), syndicationfeeduri.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<SetImageFeedResult>>(result__)
})
}
pub fn TryRemoveImageFeed() -> ::windows::core::Result<bool> {
Self::ILockScreenImageFeedStatics(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
})
}
#[cfg(feature = "Foundation")]
pub fn OriginalImageFile() -> ::windows::core::Result<super::super::Foundation::Uri> {
Self::ILockScreenStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__)
})
}
#[cfg(feature = "Storage_Streams")]
pub fn GetImageStream() -> ::windows::core::Result<super::super::Storage::Streams::IRandomAccessStream> {
Self::ILockScreenStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::Streams::IRandomAccessStream>(result__)
})
}
#[cfg(all(feature = "Foundation", feature = "Storage"))]
pub fn SetImageFileAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>>(value: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncAction> {
Self::ILockScreenStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncAction>(result__)
})
}
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))]
pub fn SetImageStreamAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>>(value: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncAction> {
Self::ILockScreenStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncAction>(result__)
})
}
pub fn ILockScreenImageFeedStatics<R, F: FnOnce(&ILockScreenImageFeedStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<LockScreen, ILockScreenImageFeedStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
pub fn ILockScreenStatics<R, F: FnOnce(&ILockScreenStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<LockScreen, ILockScreenStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
impl ::windows::core::RuntimeName for LockScreen {
const NAME: &'static str = "Windows.System.UserProfile.LockScreen";
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SetAccountPictureResult(pub i32);
impl SetAccountPictureResult {
pub const Success: SetAccountPictureResult = SetAccountPictureResult(0i32);
pub const ChangeDisabled: SetAccountPictureResult = SetAccountPictureResult(1i32);
pub const LargeOrDynamicError: SetAccountPictureResult = SetAccountPictureResult(2i32);
pub const VideoFrameSizeError: SetAccountPictureResult = SetAccountPictureResult(3i32);
pub const FileSizeError: SetAccountPictureResult = SetAccountPictureResult(4i32);
pub const Failure: SetAccountPictureResult = SetAccountPictureResult(5i32);
}
impl ::core::convert::From<i32> for SetAccountPictureResult {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SetAccountPictureResult {
type Abi = Self;
}
unsafe impl ::windows::core::RuntimeType for SetAccountPictureResult {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.System.UserProfile.SetAccountPictureResult;i4)");
}
impl ::windows::core::DefaultType for SetAccountPictureResult {
type DefaultType = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SetImageFeedResult(pub i32);
impl SetImageFeedResult {
pub const Success: SetImageFeedResult = SetImageFeedResult(0i32);
pub const ChangeDisabled: SetImageFeedResult = SetImageFeedResult(1i32);
pub const UserCanceled: SetImageFeedResult = SetImageFeedResult(2i32);
}
impl ::core::convert::From<i32> for SetImageFeedResult {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SetImageFeedResult {
type Abi = Self;
}
unsafe impl ::windows::core::RuntimeType for SetImageFeedResult {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.System.UserProfile.SetImageFeedResult;i4)");
}
impl ::windows::core::DefaultType for SetImageFeedResult {
type DefaultType = Self;
}
pub struct UserInformation {}
impl UserInformation {
#[cfg(feature = "deprecated")]
pub fn AccountPictureChangeEnabled() -> ::windows::core::Result<bool> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
})
}
#[cfg(feature = "deprecated")]
pub fn NameAccessAllowed() -> ::windows::core::Result<bool> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Storage")]
pub fn GetAccountPicture(kind: AccountPictureKind) -> ::windows::core::Result<super::super::Storage::IStorageFile> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), kind, &mut result__).from_abi::<super::super::Storage::IStorageFile>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(all(feature = "Foundation", feature = "Storage"))]
pub fn SetAccountPictureAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>>(image: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), image.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(all(feature = "Foundation", feature = "Storage"))]
pub fn SetAccountPicturesAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>, Param1: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>, Param2: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>>(smallimage: Param0, largeimage: Param1, video: Param2) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), smallimage.into_param().abi(), largeimage.into_param().abi(), video.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))]
pub fn SetAccountPictureFromStreamAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>>(image: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), image.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(all(feature = "Foundation", feature = "Storage_Streams"))]
pub fn SetAccountPicturesFromStreamsAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param2: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>>(smallimage: Param0, largeimage: Param1, video: Param2) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), smallimage.into_param().abi(), largeimage.into_param().abi(), video.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<SetAccountPictureResult>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn AccountPictureChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventHandler<::windows::core::IInspectable>>>(changehandler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), changehandler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn RemoveAccountPictureChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(token: Param0) -> ::windows::core::Result<()> {
Self::IUserInformationStatics(|this| unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() })
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetDisplayNameAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetFirstNameAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetLastNameAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetPrincipalNameAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetSessionInitiationProtocolUriAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Uri>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Uri>>(result__)
})
}
#[cfg(feature = "deprecated")]
#[cfg(feature = "Foundation")]
pub fn GetDomainNameAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>> {
Self::IUserInformationStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<::windows::core::HSTRING>>(result__)
})
}
pub fn IUserInformationStatics<R, F: FnOnce(&IUserInformationStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<UserInformation, IUserInformationStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
impl ::windows::core::RuntimeName for UserInformation {
const NAME: &'static str = "Windows.System.UserProfile.UserInformation";
}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct UserProfilePersonalizationSettings(pub ::windows::core::IInspectable);
impl UserProfilePersonalizationSettings {
#[cfg(all(feature = "Foundation", feature = "Storage"))]
pub fn TrySetLockScreenImageAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::StorageFile>>(&self, imagefile: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<bool>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), imagefile.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<bool>>(result__)
}
}
#[cfg(all(feature = "Foundation", feature = "Storage"))]
pub fn TrySetWallpaperImageAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::StorageFile>>(&self, imagefile: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<bool>> {
let this = self;
unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), imagefile.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<bool>>(result__)
}
}
pub fn Current() -> ::windows::core::Result<UserProfilePersonalizationSettings> {
Self::IUserProfilePersonalizationSettingsStatics(|this| unsafe {
let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<UserProfilePersonalizationSettings>(result__)
})
}
pub fn IsSupported() -> ::windows::core::Result<bool> {
Self::IUserProfilePersonalizationSettingsStatics(|this| unsafe {
let mut result__: bool = ::core::mem::zeroed();
(::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__)
})
}
pub fn IUserProfilePersonalizationSettingsStatics<R, F: FnOnce(&IUserProfilePersonalizationSettingsStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
static mut SHARED: ::windows::core::FactoryCache<UserProfilePersonalizationSettings, IUserProfilePersonalizationSettingsStatics> = ::windows::core::FactoryCache::new();
unsafe { SHARED.call(callback) }
}
}
unsafe impl ::windows::core::RuntimeType for UserProfilePersonalizationSettings {
const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.System.UserProfile.UserProfilePersonalizationSettings;{8ceddab4-7998-46d5-8dd3-184f1c5f9ab9})");
}
unsafe impl ::windows::core::Interface for UserProfilePersonalizationSettings {
type Vtable = IUserProfilePersonalizationSettings_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8ceddab4_7998_46d5_8dd3_184f1c5f9ab9);
}
impl ::windows::core::RuntimeName for UserProfilePersonalizationSettings {
const NAME: &'static str = "Windows.System.UserProfile.UserProfilePersonalizationSettings";
}
impl ::core::convert::From<UserProfilePersonalizationSettings> for ::windows::core::IUnknown {
fn from(value: UserProfilePersonalizationSettings) -> Self {
value.0 .0
}
}
impl ::core::convert::From<&UserProfilePersonalizationSettings> for ::windows::core::IUnknown {
fn from(value: &UserProfilePersonalizationSettings) -> Self {
value.0 .0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for UserProfilePersonalizationSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0 .0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a UserProfilePersonalizationSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0 .0)
}
}
impl ::core::convert::From<UserProfilePersonalizationSettings> for ::windows::core::IInspectable {
fn from(value: UserProfilePersonalizationSettings) -> Self {
value.0
}
}
impl ::core::convert::From<&UserProfilePersonalizationSettings> for ::windows::core::IInspectable {
fn from(value: &UserProfilePersonalizationSettings) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for UserProfilePersonalizationSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a UserProfilePersonalizationSettings {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> {
::windows::core::Param::Borrowed(&self.0)
}
}
unsafe impl ::core::marker::Send for UserProfilePersonalizationSettings {}
unsafe impl ::core::marker::Sync for UserProfilePersonalizationSettings {}
|
use std::env;
use std::fs;
fn compute_fuel_for_module(module_weight: i32) -> i32 {
return (((module_weight as f64) / 3_f64).floor() as i32) - 2;
}
fn compute_recursive_fuel_for_module(weight: i32) -> i32 {
let intermediate = compute_fuel_for_module(weight);
if intermediate <= 0 {
return 0;
}
return intermediate + compute_recursive_fuel_for_module(intermediate);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_compute_fuel_for_module() {
assert_eq!(compute_fuel_for_module(12), 2);
assert_eq!(compute_fuel_for_module(14), 2);
assert_eq!(compute_fuel_for_module(1969), 654);
assert_eq!(compute_fuel_for_module(100756), 33583);
}
#[test]
fn test_recursive_compute_fuel_for_module() {
assert_eq!(compute_recursive_fuel_for_module(14), 2);
assert_eq!(compute_recursive_fuel_for_module(1969), 966);
assert_eq!(compute_recursive_fuel_for_module(100756), 50346);
}
}
fn main() {
let args: Vec<String> = env::args().collect();
let filename = &args[1];
println!("Reading {}...", filename);
let content = fs::read_to_string(filename).expect("Error while reading the file");
let lines = content.lines().map(|line| String::from(line));
let modules = lines.map(|module| {
i32::from_str_radix(&module, 10).expect("Error while casting a string to i32")
});
println!("Computing the fuel for modules...");
let result = modules
.clone()
.map(|module_weight| compute_fuel_for_module(module_weight))
.fold(0, |acc, fuel_for_module| acc + fuel_for_module);
println!("PART 1: The total fuel needed is {}", result);
let result_part_2 = modules
.clone()
.map(|module_weight| compute_recursive_fuel_for_module(module_weight))
.fold(0, |acc, fuel_for_module| acc + fuel_for_module);
println!(
"PART 2: The total fuel needed (recursively) is {}",
result_part_2
);
}
|
use ffmpeg::format;
use ocl::{self, OclPrm};
use super::*;
use crate::capture;
use crate::hooks::hw::FrameCapture;
use crate::utils::MaybeUnavailable;
/// Resampling FPS converter which averages input frames for smooth motion.
pub struct SamplingConverter {
/// Difference, in video frames, between how much time passed in-game and how much video we
/// output.
remainder: f64,
/// The target time_base.
time_base: f64,
/// Data with a destructor, wrapped so `SamplingConverter` can be put in a static variable.
private: SamplingConverterPrivate,
}
/// Data with a destructor.
struct SamplingConverterPrivate {
/// Data used for OpenCL operations.
///
/// This is Some(None) if OpenCL is unavailable and None during an engine restart.
ocl_runtime_data: MaybeUnavailable<OclRuntimeData>,
/// Pixels from the buffer are stored here when the engine restarts.
ocl_backup_buffer: Option<Vec<ocl::prm::Float>>,
/// The video resolution.
video_resolution: (u32, u32),
/// The OpenGL sampling buffer.
gl_sampling_buffer: Vec<f32>,
/// The OpenGL read buffer.
gl_read_buffer: Vec<u8>,
}
/// Data used at runtime by OpenCL sampling.
struct OclRuntimeData {
/// Buffer images.
ocl_buffers: [ocl::Image<ocl::prm::Float>; 2],
/// Output image.
ocl_output_image: ocl::Image<ocl::prm::Float>,
/// Index of the last written to OpenCL buffer.
ocl_current_buffer_index: usize,
}
impl SamplingConverter {
#[inline]
pub fn new(engine: &mut Engine, time_base: f64, video_resolution: (u32, u32)) -> Self {
assert!(time_base > 0f64);
Self { remainder: 0f64,
time_base,
private: SamplingConverterPrivate::new(engine, video_resolution) }
}
/// This should be called before an engine restart.
#[inline]
pub fn backup_and_free_ocl_data(&mut self, engine: &mut Engine) {
self.private.backup_and_free_ocl_data(engine);
}
}
impl FPSConverter for SamplingConverter {
fn time_passed<F>(&mut self, engine: &mut Engine, frametime: f64, capture: F)
where F: FnOnce(&mut Engine) -> FrameCapture
{
assert!(frametime >= 0.0f64);
let frame_capture = capture(engine);
let old_remainder = self.remainder;
self.remainder += frametime / self.time_base;
let exposure = capture::get_capture_parameters(engine).sampling_exposure;
if self.remainder <= (1f64 - exposure) {
// Do nothing.
} else if self.remainder < 1f64 {
let weight = (self.remainder - old_remainder.max(1f64 - exposure)) * (1f64 / exposure);
match frame_capture {
FrameCapture::OpenGL(read_pixels) => {
let (w, h) = self.private.video_resolution;
self.private.gl_read_buffer.resize((w * h * 3) as usize, 0);
self.private
.gl_sampling_buffer
.resize((w * h * 3) as usize, 0f32);
read_pixels(engine.marker().1, (w, h), &mut self.private.gl_read_buffer);
let private: &mut SamplingConverterPrivate = &mut self.private;
weighted_image_add(&mut private.gl_sampling_buffer,
&private.gl_read_buffer,
weight as f32);
}
FrameCapture::OpenCL(ocl_gl_texture) => {
let ocl_data = self.private.get_ocl_data(engine).unwrap();
ocl_weighted_image_add(engine,
ocl_gl_texture.as_ref(),
ocl_data.src_buffer(),
ocl_data.dst_buffer(),
weight as f32);
ocl_data.switch_buffer_index();
}
}
} else {
let weight = (1f64 - old_remainder.max(1f64 - exposure)) * (1f64 / exposure);
match frame_capture {
FrameCapture::OpenGL(read_pixels) => {
let (w, h) = self.private.video_resolution;
self.private.gl_read_buffer.resize((w * h * 3) as usize, 0);
self.private
.gl_sampling_buffer
.resize((w * h * 3) as usize, 0f32);
read_pixels(engine.marker().1, (w, h), &mut self.private.gl_read_buffer);
let mut buf = capture::get_buffer(engine.marker().1, (w, h));
buf.set_format(format::Pixel::RGB24);
weighted_image_add_to(&self.private.gl_sampling_buffer,
&self.private.gl_read_buffer,
buf.as_mut_slice(),
weight as f32);
capture::capture(engine.marker().1, buf, 1);
fill_with_black(&mut self.private.gl_sampling_buffer);
self.remainder -= 1f64;
// Output it more times if needed.
let additional_frames = self.remainder as usize;
if additional_frames > 0 {
let mut buf = capture::get_buffer(engine.marker().1, (w, h));
buf.set_format(format::Pixel::RGB24);
buf.as_mut_slice()
.copy_from_slice(&self.private.gl_read_buffer);
capture::capture(engine.marker().1, buf, additional_frames);
self.remainder -= additional_frames as f64;
}
// Add the remaining image into the buffer.
if self.remainder > (1f64 - exposure) {
let private: &mut SamplingConverterPrivate = &mut self.private;
weighted_image_add(&mut private.gl_sampling_buffer,
&private.gl_read_buffer,
((self.remainder - (1f64 - exposure))
* (1f64 / exposure))
as f32);
}
}
FrameCapture::OpenCL(ocl_gl_texture) => {
let ocl_data = self.private.get_ocl_data(engine).unwrap();
ocl_weighted_image_add(engine,
ocl_gl_texture.as_ref(),
ocl_data.src_buffer(),
ocl_data.output_image(),
weight as f32);
ocl_fill_with_black(engine, ocl_data.dst_buffer());
ocl_data.switch_buffer_index();
// Output the frame.
let (w, h) = hw::get_resolution(engine.marker().1);
let mut buf = capture::get_buffer(engine.marker().1, (w, h));
hw::read_ocl_image_into_buf(engine, ocl_data.output_image(), &mut buf);
capture::capture(engine.marker().1, buf, 1);
self.remainder -= 1f64;
// Output it more times if needed.
let additional_frames = self.remainder as usize;
if additional_frames > 0 {
let mut buf = capture::get_buffer(engine.marker().1, (w, h));
hw::read_ocl_image_into_buf(engine, ocl_gl_texture.as_ref(), &mut buf);
capture::capture(engine.marker().1, buf, additional_frames);
self.remainder -= additional_frames as f64;
}
// Add the remaining image into the buffer.
if self.remainder > (1f64 - exposure) {
ocl_weighted_image_add(engine,
ocl_gl_texture.as_ref(),
ocl_data.src_buffer(),
ocl_data.dst_buffer(),
((self.remainder - (1f64 - exposure))
* (1f64 / exposure))
as f32);
ocl_data.switch_buffer_index();
}
}
}
}
}
}
impl SamplingConverterPrivate {
#[inline]
fn new(engine: &mut Engine, video_resolution: (u32, u32)) -> Self {
Self { ocl_runtime_data:
MaybeUnavailable::from_check_result(OclRuntimeData::new(engine,
video_resolution)),
ocl_backup_buffer: None,
video_resolution,
gl_sampling_buffer: Vec::new(),
gl_read_buffer: Vec::new() }
}
#[inline]
fn get_ocl_data(&mut self, engine: &mut Engine) -> Option<&mut OclRuntimeData> {
if self.ocl_runtime_data.is_not_checked() {
self.restore_ocl_data(engine);
}
self.ocl_runtime_data.as_mut().available()
}
/// This should be called before an engine restart.
fn backup_and_free_ocl_data(&mut self, engine: &mut Engine) {
let reset = if let MaybeUnavailable::Available(ref ocl_data) = self.ocl_runtime_data {
// Copy the src buffer into the output image.
ocl_weighted_image_add(engine,
ocl_data.dst_buffer(),
ocl_data.src_buffer(),
ocl_data.output_image(),
0f32);
let image = ocl_data.output_image();
let mut backup_buffer = Vec::with_capacity(image.element_count());
backup_buffer.resize(image.element_count(), 0f32.into());
image.read(&mut backup_buffer).enq().expect("image.read()");
self.ocl_backup_buffer = Some(backup_buffer);
true
} else {
false
};
if reset {
self.ocl_runtime_data.reset();
}
}
/// This should be called after an engine restart.
fn restore_ocl_data(&mut self, engine: &mut Engine) {
if !self.ocl_runtime_data.is_not_checked() {
panic!("tried to restore already existing OpenCL data");
}
let ocl_data = OclRuntimeData::new(engine, self.video_resolution)
.expect("changing from fullscreen to windowed is not supported");
let temp_image = {
let pro_que = hw::get_pro_que(engine).unwrap();
hw::build_ocl_image(pro_que,
ocl::MemFlags::new().read_only().host_write_only(),
ocl::enums::ImageChannelDataType::Float,
self.video_resolution.into()).expect("building an OpenCL image")
};
let backup_buffer = self.ocl_backup_buffer.take().unwrap();
temp_image.write(&backup_buffer)
.enq()
.expect("image.write()");
// Copy the backup buffer into the src buffer.
ocl_weighted_image_add(engine,
ocl_data.dst_buffer(),
&temp_image,
ocl_data.src_buffer(),
0f32);
self.ocl_runtime_data = MaybeUnavailable::Available(ocl_data);
}
}
impl OclRuntimeData {
fn new(engine: &mut Engine, (w, h): (u32, u32)) -> Option<Self> {
let mut rv = if let Some(pro_que) = hw::get_pro_que(engine) {
Some(Self { ocl_buffers:
[hw::build_ocl_image(pro_que,
ocl::MemFlags::new().read_write()
.host_no_access(),
ocl::enums::ImageChannelDataType::Float,
(w, h).into()).expect("building an OpenCL image"),
hw::build_ocl_image(pro_que,
ocl::MemFlags::new().read_write()
.host_no_access(),
ocl::enums::ImageChannelDataType::Float,
(w, h).into()).expect("building an OpenCL image")],
ocl_output_image:
hw::build_ocl_image(pro_que,
ocl::MemFlags::new().read_write().host_read_only(),
ocl::enums::ImageChannelDataType::Float,
(w, h).into()).expect("building an OpenCL image"),
ocl_current_buffer_index: 0 })
} else {
None
};
if let Some(ref mut rv) = rv {
ocl_fill_with_black(engine, rv.src_buffer());
}
rv
}
#[inline]
fn src_buffer(&self) -> &ocl::Image<ocl::prm::Float> {
&self.ocl_buffers[self.ocl_current_buffer_index]
}
#[inline]
fn dst_buffer(&self) -> &ocl::Image<ocl::prm::Float> {
&self.ocl_buffers[self.ocl_current_buffer_index ^ 1]
}
#[inline]
fn output_image(&self) -> &ocl::Image<ocl::prm::Float> {
&self.ocl_output_image
}
#[inline]
fn switch_buffer_index(&mut self) {
self.ocl_current_buffer_index ^= 1;
}
}
#[inline]
fn ocl_weighted_image_add<T: OclPrm, U: OclPrm, V: OclPrm>(engine: &mut Engine,
src: &ocl::Image<T>,
buf: &ocl::Image<U>,
dst: &ocl::Image<V>,
weight: f32) {
let pro_que = hw::get_pro_que(engine).unwrap();
let kernel = pro_que.kernel_builder("weighted_image_add")
.global_work_size(src.dims())
.arg(src)
.arg(buf)
.arg(dst)
.arg(weight)
.build()
.unwrap();
unsafe {
kernel.enq().expect("sampling kernel enq()");
}
}
#[inline]
fn ocl_fill_with_black<T: OclPrm>(engine: &mut Engine, image: &ocl::Image<T>) {
let pro_que = hw::get_pro_que(engine).unwrap();
let kernel = pro_que.kernel_builder("fill_with_black")
.global_work_size(image.dims())
.arg(image)
.build()
.unwrap();
unsafe {
kernel.enq().expect("sampling kernel enq()");
}
}
#[inline]
fn weighted_image_add(buf: &mut [f32], image: &[u8], weight: f32) {
assert_eq!(buf.len(), image.len());
for i in 0..buf.len() {
buf[i] += f32::from(image[i]) * weight;
}
}
#[inline]
fn weighted_image_add_to(buf: &[f32], image: &[u8], dst: &mut [u8], weight: f32) {
assert_eq!(buf.len(), image.len());
assert_eq!(buf.len(), dst.len());
for i in 0..buf.len() {
dst[i] = (buf[i] + f32::from(image[i]) * weight).round() as u8;
}
}
#[inline]
fn fill_with_black(buf: &mut [f32]) {
buf.iter_mut().for_each(|x| *x = 0.);
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn fill_with_black_test() {
let mut buf = [1f32, 2f32, 3f32, 4f32, 5f32];
fill_with_black(&mut buf[..]);
assert_eq!(buf, [0f32, 0f32, 0f32, 0f32, 0f32]);
}
#[test]
fn weighted_image_add_test() {
let mut buf = [1f32, 2f32, 3f32, 4f32, 5f32];
let image = [10, 20, 30, 40, 50];
weighted_image_add(&mut buf, &image, 0.5f32);
assert_eq!(buf, [6f32, 12f32, 18f32, 24f32, 30f32]);
}
#[test]
#[should_panic]
fn weighted_image_add_len_mismatch_test() {
let mut buf = [1f32, 2f32, 3f32, 4f32, 5f32];
let image = [10, 20, 30, 40, 50, 60];
weighted_image_add(&mut buf, &image, 0.5f32);
}
#[test]
fn weighted_image_add_to_test() {
let buf = [1f32, 2f32, 3f32, 4f32, 5f32];
let image = [10, 20, 30, 40, 50];
let mut dst = [5, 4, 3, 2, 1];
weighted_image_add_to(&buf, &image, &mut dst, 0.5f32);
assert_eq!(dst, [6, 12, 18, 24, 30]);
}
#[test]
#[should_panic]
fn weighted_image_add_to_len_mismatch_test() {
let buf = [1f32, 2f32, 3f32, 4f32, 5f32];
let image = [10, 20, 30, 40, 50, 60];
let mut dst = [5, 4, 3, 2, 1];
weighted_image_add_to(&buf, &image, &mut dst, 0.5f32);
}
#[test]
#[should_panic]
fn weighted_image_add_to_dst_len_mismatch_test() {
let buf = [1f32, 2f32, 3f32, 4f32, 5f32];
let image = [10, 20, 30, 40, 50];
let mut dst = [5, 4, 3, 2, 1, 0];
weighted_image_add_to(&buf, &image, &mut dst, 0.5f32);
}
}
|
// Copyright 2020 IOTA Stiftung
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
use crate::ternary::bigint::{
binary_representation::{U32Repr, U8Repr},
endianness::{BigEndian, LittleEndian},
I384,
};
/// I384 big-endian `u8` represented 0.
pub const BE_U8_0: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]);
/// I384 big-endian `u8` represented 1.
pub const BE_U8_1: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
]);
/// I384 big-endian `u8` represented -1.
pub const BE_U8_NEG_1: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);
/// I384 big-endian `u8` represented 2.
pub const BE_U8_2: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
]);
/// I384 big-endian `u8` represented -2.
pub const BE_U8_NEG_2: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
]);
/// I384 big-endian `u8` represented maximum value.
pub const BE_U8_MAX: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);
/// I384 big-endian `u8` represented minimum value.
pub const BE_U8_MIN: I384<BigEndian, U8Repr> = I384::<BigEndian, U8Repr>::from_array([
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]);
/// I384 big-endian `u32` represented 0.
pub const BE_U32_0: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
]);
/// I384 big-endian `u32` represented 1.
pub const BE_U32_1: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0001,
]);
/// I384 big-endian `u32` represented -1.
pub const BE_U32_NEG_1: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
]);
/// I384 big-endian `u32` represented 2.
pub const BE_U32_2: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0002,
]);
/// I384 big-endian `u32` represented -2.
pub const BE_U32_NEG_2: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_fffe,
]);
/// I384 big-endian `u32` represented maximum value.
pub const BE_U32_MAX: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0x7fff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
]);
/// I384 big-endian `u32` represented mminimum value.
pub const BE_U32_MIN: I384<BigEndian, U32Repr> = I384::<BigEndian, U32Repr>::from_array([
0x8000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
]);
/// I384 little-endian `u8` represented 0.
pub const LE_U8_0: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array(BE_U8_0.inner);
/// I384 little-endian `u8` represented 1.
pub const LE_U8_1: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]);
/// I384 little-endian `u8` represented -1.
pub const LE_U8_NEG_1: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);
/// I384 little-endian `u8` represented 2.
pub const LE_U8_2: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]);
/// I384 little-endian `u8` represented 2.
pub const LE_U8_NEG_2: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);
/// I384 little-endian `u8` represented maximum value.
pub const LE_U8_MAX: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
]);
/// I384 little-endian `u8` represented minimum value.
pub const LE_U8_MIN: I384<LittleEndian, U8Repr> = I384::<LittleEndian, U8Repr>::from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
]);
/// I384 little-endian `u32` represented 0.
pub const LE_U32_0: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array(BE_U32_0.inner);
/// I384 little-endian `u32` represented 1.
pub const LE_U32_1: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0x0000_0001,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
]);
/// I384 little-endian `u32` represented -1.
pub const LE_U32_NEG_1: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
]);
/// I384 little-endian `u32` represented 2.
pub const LE_U32_2: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0x0000_0002,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
]);
/// I384 little-endian `u32` represented -2.
pub const LE_U32_NEG_2: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0xffff_fffe,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
]);
/// I384 little-endian `u32` represented maximum value.
pub const LE_U32_MAX: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0xffff_ffff,
0x7fff_ffff,
]);
/// I384 little-endian `u32` represented minimum value.
pub const LE_U32_MIN: I384<LittleEndian, U32Repr> = I384::<LittleEndian, U32Repr>::from_array([
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x0000_0000,
0x8000_0000,
]);
|
use amethyst::{
animation::AnimationControlSet,
ecs::{Entities, Join, ReadStorage, System, WriteStorage},
renderer::SpriteRender,
};
use crate::components::{animation, Direction, Player, PlayerState};
#[derive(Default)]
pub struct PlayerAnimationSystem;
impl<'s> System<'s> for PlayerAnimationSystem {
type SystemData = (
Entities<'s>,
ReadStorage<'s, Player>,
WriteStorage<'s, animation::Animation>,
WriteStorage<'s, AnimationControlSet<animation::AnimationId, SpriteRender>>,
);
fn run(&mut self, data: Self::SystemData) {
let (entities, marines, mut animations, mut animation_control_sets) = data;
for (entity, marine, mut animation, animation_control_set) in (
&entities,
&marines,
&mut animations,
&mut animation_control_sets,
)
.join()
{
let new_animation_id = match marine.state {
PlayerState::Running(direction) => match direction {
Direction::Left => animation::AnimationId::MoveLeft,
Direction::Right => animation::AnimationId::MoveRight,
Direction::Up => animation::AnimationId::MoveUp,
Direction::Down => animation::AnimationId::MoveDown,
},
_ => animation::AnimationId::Idle,
};
// If the new AnimationId is different to the current one, abort the
// current animation and start the new one
if animation.current != new_animation_id {
println!(
"Updating animation for entity: {:?} from={:?}, to={:?}",
entity, animation.current, new_animation_id
);
animation_control_set.abort(animation.current);
animation_control_set.start(new_animation_id);
animation.current = new_animation_id;
}
}
}
}
|
use hdbconnect_async::HdbResult;
mod test_utils;
#[tokio::test]
async fn test_080_conn_pooling_for_rocket() -> HdbResult<()> {
let _log_handle = test_utils::init_logger();
if cfg!(feature = "rocket_pool") {
log::info!("testing feature 'rocket_pool'");
#[cfg(feature = "rocket_pool")]
inner::test_rocket_pool().await?;
Ok(())
} else {
log::info!("Nothing tested, because feature 'rocket_pool' is not active");
Ok(())
}
}
#[cfg(feature = "rocket_pool")]
mod inner {
extern crate serde;
use hdbconnect_async::{HanaPoolForRocket, HdbError, HdbResult};
use log::trace;
use rocket_db_pools::Pool;
use tokio::task::JoinHandle;
const NO_OF_WORKERS: usize = 20;
pub(super) async fn test_rocket_pool() -> HdbResult<()> {
let pool = HanaPoolForRocket::new(super::test_utils::get_std_cp_builder()?)?;
let mut worker_handles: Vec<JoinHandle<u8>> = Default::default();
for _ in 0..NO_OF_WORKERS {
let pool_clone = pool.clone();
worker_handles.push(tokio::spawn(async move {
let conn = pool_clone.get().await.unwrap();
trace!("connection[{}]: Firing query", conn.id().await.unwrap());
conn.query("select 1 from dummy").await.unwrap();
0_u8
}));
}
for worker_handle in worker_handles {
assert_eq!(
0_u8,
worker_handle
.await
.map_err(|e| HdbError::UsageDetailed(format!(
"Joining worker thread failed: {e:?}"
)))?
);
}
Ok(())
}
}
|
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(
missing_debug_implementations,
missing_docs,
rust_2018_idioms,
unreachable_pub
)]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]
//! Pre-allocated storage for a uniform data type.
//!
//! `Slab` provides pre-allocated storage for a single data type. If many values
//! of a single type are being allocated, it can be more efficient to
//! pre-allocate the necessary storage. Since the size of the type is uniform,
//! memory fragmentation can be avoided. Storing, clearing, and lookup
//! operations become very cheap.
//!
//! While `Slab` may look like other Rust collections, it is not intended to be
//! used as a general purpose collection. The primary difference between `Slab`
//! and `Vec` is that `Slab` returns the key when storing the value.
//!
//! It is important to note that keys may be reused. In other words, once a
//! value associated with a given key is removed from a slab, that key may be
//! returned from future calls to `insert`.
//!
//! # Examples
//!
//! Basic storing and retrieval.
//!
//! ```
//! # use slab::*;
//! let mut slab = Slab::new();
//!
//! let hello = slab.insert("hello");
//! let world = slab.insert("world");
//!
//! assert_eq!(slab[hello], "hello");
//! assert_eq!(slab[world], "world");
//!
//! slab[world] = "earth";
//! assert_eq!(slab[world], "earth");
//! ```
//!
//! Sometimes it is useful to be able to associate the key with the value being
//! inserted in the slab. This can be done with the `vacant_entry` API as such:
//!
//! ```
//! # use slab::*;
//! let mut slab = Slab::new();
//!
//! let hello = {
//! let entry = slab.vacant_entry();
//! let key = entry.key();
//!
//! entry.insert((key, "hello"));
//! key
//! };
//!
//! assert_eq!(hello, slab[hello].0);
//! assert_eq!("hello", slab[hello].1);
//! ```
//!
//! It is generally a good idea to specify the desired capacity of a slab at
//! creation time. Note that `Slab` will grow the internal capacity when
//! attempting to insert a new value once the existing capacity has been reached.
//! To avoid this, add a check.
//!
//! ```
//! # use slab::*;
//! let mut slab = Slab::with_capacity(1024);
//!
//! // ... use the slab
//!
//! if slab.len() == slab.capacity() {
//! panic!("slab full");
//! }
//!
//! slab.insert("the slab is not at capacity yet");
//! ```
//!
//! # Capacity and reallocation
//!
//! The capacity of a slab is the amount of space allocated for any future
//! values that will be inserted in the slab. This is not to be confused with
//! the *length* of the slab, which specifies the number of actual values
//! currently being inserted. If a slab's length is equal to its capacity, the
//! next value inserted into the slab will require growing the slab by
//! reallocating.
//!
//! For example, a slab with capacity 10 and length 0 would be an empty slab
//! with space for 10 more stored values. Storing 10 or fewer elements into the
//! slab will not change its capacity or cause reallocation to occur. However,
//! if the slab length is increased to 11 (due to another `insert`), it will
//! have to reallocate, which can be slow. For this reason, it is recommended to
//! use [`Slab::with_capacity`] whenever possible to specify how many values the
//! slab is expected to store.
//!
//! # Implementation
//!
//! `Slab` is backed by a `Vec` of slots. Each slot is either occupied or
//! vacant. `Slab` maintains a stack of vacant slots using a linked list. To
//! find a vacant slot, the stack is popped. When a slot is released, it is
//! pushed onto the stack.
//!
//! If there are no more available slots in the stack, then `Vec::reserve(1)` is
//! called and a new slot is created.
//!
//! [`Slab::with_capacity`]: struct.Slab.html#with_capacity
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std as alloc;
#[cfg(feature = "serde")]
mod serde;
mod builder;
use alloc::vec::{self, Vec};
use core::iter::{self, FromIterator, FusedIterator};
use core::{fmt, mem, ops, slice};
/// Pre-allocated storage for a uniform data type
///
/// See the [module documentation] for more details.
///
/// [module documentation]: index.html
pub struct Slab<T> {
// Chunk of memory
entries: Vec<Entry<T>>,
// Number of Filled elements currently in the slab
len: usize,
// Offset of the next available slot in the slab. Set to the slab's
// capacity when the slab is full.
next: usize,
}
impl<T> Clone for Slab<T>
where
T: Clone,
{
fn clone(&self) -> Self {
Self {
entries: self.entries.clone(),
len: self.len,
next: self.next,
}
}
fn clone_from(&mut self, source: &Self) {
self.entries.clone_from(&source.entries);
self.len = source.len;
self.next = source.next;
}
}
impl<T> Default for Slab<T> {
fn default() -> Self {
Slab::new()
}
}
/// A handle to a vacant entry in a `Slab`.
///
/// `VacantEntry` allows constructing values with the key that they will be
/// assigned to.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = {
/// let entry = slab.vacant_entry();
/// let key = entry.key();
///
/// entry.insert((key, "hello"));
/// key
/// };
///
/// assert_eq!(hello, slab[hello].0);
/// assert_eq!("hello", slab[hello].1);
/// ```
#[derive(Debug)]
pub struct VacantEntry<'a, T> {
slab: &'a mut Slab<T>,
key: usize,
}
/// A consuming iterator over the values stored in a `Slab`
pub struct IntoIter<T> {
entries: iter::Enumerate<vec::IntoIter<Entry<T>>>,
len: usize,
}
/// An iterator over the values stored in the `Slab`
pub struct Iter<'a, T> {
entries: iter::Enumerate<slice::Iter<'a, Entry<T>>>,
len: usize,
}
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Self {
Self {
entries: self.entries.clone(),
len: self.len,
}
}
}
/// A mutable iterator over the values stored in the `Slab`
pub struct IterMut<'a, T> {
entries: iter::Enumerate<slice::IterMut<'a, Entry<T>>>,
len: usize,
}
/// A draining iterator for `Slab`
pub struct Drain<'a, T> {
inner: vec::Drain<'a, Entry<T>>,
len: usize,
}
#[derive(Clone)]
enum Entry<T> {
Vacant(usize),
Occupied(T),
}
impl<T> Slab<T> {
/// Construct a new, empty `Slab`.
///
/// The function does not allocate and the returned slab will have no
/// capacity until `insert` is called or capacity is explicitly reserved.
///
/// This is `const fn` on Rust 1.39+.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let slab: Slab<i32> = Slab::new();
/// ```
#[cfg(not(slab_no_const_vec_new))]
pub const fn new() -> Self {
Self {
entries: Vec::new(),
next: 0,
len: 0,
}
}
/// Construct a new, empty `Slab`.
///
/// The function does not allocate and the returned slab will have no
/// capacity until `insert` is called or capacity is explicitly reserved.
///
/// This is `const fn` on Rust 1.39+.
#[cfg(slab_no_const_vec_new)]
pub fn new() -> Self {
Self {
entries: Vec::new(),
next: 0,
len: 0,
}
}
/// Construct a new, empty `Slab` with the specified capacity.
///
/// The returned slab will be able to store exactly `capacity` without
/// reallocating. If `capacity` is 0, the slab will not allocate.
///
/// It is important to note that this function does not specify the *length*
/// of the returned slab, but only the capacity. For an explanation of the
/// difference between length and capacity, see [Capacity and
/// reallocation](index.html#capacity-and-reallocation).
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::with_capacity(10);
///
/// // The slab contains no values, even though it has capacity for more
/// assert_eq!(slab.len(), 0);
///
/// // These are all done without reallocating...
/// for i in 0..10 {
/// slab.insert(i);
/// }
///
/// // ...but this may make the slab reallocate
/// slab.insert(11);
/// ```
pub fn with_capacity(capacity: usize) -> Slab<T> {
Slab {
entries: Vec::with_capacity(capacity),
next: 0,
len: 0,
}
}
/// Return the number of values the slab can store without reallocating.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let slab: Slab<i32> = Slab::with_capacity(10);
/// assert_eq!(slab.capacity(), 10);
/// ```
pub fn capacity(&self) -> usize {
self.entries.capacity()
}
/// Reserve capacity for at least `additional` more values to be stored
/// without allocating.
///
/// `reserve` does nothing if the slab already has sufficient capacity for
/// `additional` more values. If more capacity is required, a new segment of
/// memory will be allocated and all existing values will be copied into it.
/// As such, if the slab is already very large, a call to `reserve` can end
/// up being expensive.
///
/// The slab may reserve more than `additional` extra space in order to
/// avoid frequent reallocations. Use `reserve_exact` instead to guarantee
/// that only the requested space is allocated.
///
/// # Panics
///
/// Panics if the new capacity exceeds `isize::MAX` bytes.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// slab.insert("hello");
/// slab.reserve(10);
/// assert!(slab.capacity() >= 11);
/// ```
pub fn reserve(&mut self, additional: usize) {
if self.capacity() - self.len >= additional {
return;
}
let need_add = additional - (self.entries.len() - self.len);
self.entries.reserve(need_add);
}
/// Reserve the minimum capacity required to store exactly `additional`
/// more values.
///
/// `reserve_exact` does nothing if the slab already has sufficient capacity
/// for `additional` more values. If more capacity is required, a new segment
/// of memory will be allocated and all existing values will be copied into
/// it. As such, if the slab is already very large, a call to `reserve` can
/// end up being expensive.
///
/// Note that the allocator may give the slab more space than it requests.
/// Therefore capacity can not be relied upon to be precisely minimal.
/// Prefer `reserve` if future insertions are expected.
///
/// # Panics
///
/// Panics if the new capacity exceeds `isize::MAX` bytes.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// slab.insert("hello");
/// slab.reserve_exact(10);
/// assert!(slab.capacity() >= 11);
/// ```
pub fn reserve_exact(&mut self, additional: usize) {
if self.capacity() - self.len >= additional {
return;
}
let need_add = additional - (self.entries.len() - self.len);
self.entries.reserve_exact(need_add);
}
/// Shrink the capacity of the slab as much as possible without invalidating keys.
///
/// Because values cannot be moved to a different index, the slab cannot
/// shrink past any stored values.
/// It will drop down as close as possible to the length but the allocator may
/// still inform the underlying vector that there is space for a few more elements.
///
/// This function can take O(n) time even when the capacity cannot be reduced
/// or the allocation is shrunk in place. Repeated calls run in O(1) though.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::with_capacity(10);
///
/// for i in 0..3 {
/// slab.insert(i);
/// }
///
/// slab.shrink_to_fit();
/// assert!(slab.capacity() >= 3 && slab.capacity() < 10);
/// ```
///
/// The slab cannot shrink past the last present value even if previous
/// values are removed:
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::with_capacity(10);
///
/// for i in 0..4 {
/// slab.insert(i);
/// }
///
/// slab.remove(0);
/// slab.remove(3);
///
/// slab.shrink_to_fit();
/// assert!(slab.capacity() >= 3 && slab.capacity() < 10);
/// ```
pub fn shrink_to_fit(&mut self) {
// Remove all vacant entries after the last occupied one, so that
// the capacity can be reduced to what is actually needed.
// If the slab is empty the vector can simply be cleared, but that
// optimization would not affect time complexity when T: Drop.
let len_before = self.entries.len();
while let Some(&Entry::Vacant(_)) = self.entries.last() {
self.entries.pop();
}
// Removing entries breaks the list of vacant entries,
// so it must be repaired
if self.entries.len() != len_before {
// Some vacant entries were removed, so the list now likely¹
// either contains references to the removed entries, or has an
// invalid end marker. Fix this by recreating the list.
self.recreate_vacant_list();
// ¹: If the removed entries formed the tail of the list, with the
// most recently popped entry being the head of them, (so that its
// index is now the end marker) the list is still valid.
// Checking for that unlikely scenario of this infrequently called
// is not worth the code complexity.
}
self.entries.shrink_to_fit();
}
/// Iterate through all entries to recreate and repair the vacant list.
/// self.len must be correct and is not modified.
fn recreate_vacant_list(&mut self) {
self.next = self.entries.len();
// We can stop once we've found all vacant entries
let mut remaining_vacant = self.entries.len() - self.len;
if remaining_vacant == 0 {
return;
}
// Iterate in reverse order so that lower keys are at the start of
// the vacant list. This way future shrinks are more likely to be
// able to remove vacant entries.
for (i, entry) in self.entries.iter_mut().enumerate().rev() {
if let Entry::Vacant(ref mut next) = *entry {
*next = self.next;
self.next = i;
remaining_vacant -= 1;
if remaining_vacant == 0 {
break;
}
}
}
}
/// Reduce the capacity as much as possible, changing the key for elements when necessary.
///
/// To allow updating references to the elements which must be moved to a new key,
/// this function takes a closure which is called before moving each element.
/// The second and third parameters to the closure are the current key and
/// new key respectively.
/// In case changing the key for one element turns out not to be possible,
/// the move can be cancelled by returning `false` from the closure.
/// In that case no further attempts at relocating elements is made.
/// If the closure unwinds, the slab will be left in a consistent state,
/// but the value that the closure panicked on might be removed.
///
/// # Examples
///
/// ```
/// # use slab::*;
///
/// let mut slab = Slab::with_capacity(10);
/// let a = slab.insert('a');
/// slab.insert('b');
/// slab.insert('c');
/// slab.remove(a);
/// slab.compact(|&mut value, from, to| {
/// assert_eq!((value, from, to), ('c', 2, 0));
/// true
/// });
/// assert!(slab.capacity() >= 2 && slab.capacity() < 10);
/// ```
///
/// The value is not moved when the closure returns `Err`:
///
/// ```
/// # use slab::*;
///
/// let mut slab = Slab::with_capacity(100);
/// let a = slab.insert('a');
/// let b = slab.insert('b');
/// slab.remove(a);
/// slab.compact(|&mut value, from, to| false);
/// assert_eq!(slab.iter().next(), Some((b, &'b')));
/// ```
pub fn compact<F>(&mut self, mut rekey: F)
where
F: FnMut(&mut T, usize, usize) -> bool,
{
// If the closure unwinds, we need to restore a valid list of vacant entries
struct CleanupGuard<'a, T> {
slab: &'a mut Slab<T>,
decrement: bool,
}
impl<T> Drop for CleanupGuard<'_, T> {
fn drop(&mut self) {
if self.decrement {
// Value was popped and not pushed back on
self.slab.len -= 1;
}
self.slab.recreate_vacant_list();
}
}
let mut guard = CleanupGuard {
slab: self,
decrement: true,
};
let mut occupied_until = 0;
// While there are vacant entries
while guard.slab.entries.len() > guard.slab.len {
// Find a value that needs to be moved,
// by popping entries until we find an occupied one.
// (entries cannot be empty because 0 is not greater than anything)
if let Some(Entry::Occupied(mut value)) = guard.slab.entries.pop() {
// Found one, now find a vacant entry to move it to
while let Some(&Entry::Occupied(_)) = guard.slab.entries.get(occupied_until) {
occupied_until += 1;
}
// Let the caller try to update references to the key
if !rekey(&mut value, guard.slab.entries.len(), occupied_until) {
// Changing the key failed, so push the entry back on at its old index.
guard.slab.entries.push(Entry::Occupied(value));
guard.decrement = false;
guard.slab.entries.shrink_to_fit();
return;
// Guard drop handles cleanup
}
// Put the value in its new spot
guard.slab.entries[occupied_until] = Entry::Occupied(value);
// ... and mark it as occupied (this is optional)
occupied_until += 1;
}
}
guard.slab.next = guard.slab.len;
guard.slab.entries.shrink_to_fit();
// Normal cleanup is not necessary
mem::forget(guard);
}
/// Clear the slab of all values.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// for i in 0..3 {
/// slab.insert(i);
/// }
///
/// slab.clear();
/// assert!(slab.is_empty());
/// ```
pub fn clear(&mut self) {
self.entries.clear();
self.len = 0;
self.next = 0;
}
/// Return the number of stored values.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// for i in 0..3 {
/// slab.insert(i);
/// }
///
/// assert_eq!(3, slab.len());
/// ```
pub fn len(&self) -> usize {
self.len
}
/// Return `true` if there are no values stored in the slab.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// assert!(slab.is_empty());
///
/// slab.insert(1);
/// assert!(!slab.is_empty());
/// ```
pub fn is_empty(&self) -> bool {
self.len == 0
}
/// Return an iterator over the slab.
///
/// This function should generally be **avoided** as it is not efficient.
/// Iterators must iterate over every slot in the slab even if it is
/// vacant. As such, a slab with a capacity of 1 million but only one
/// stored value must still iterate the million slots.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// for i in 0..3 {
/// slab.insert(i);
/// }
///
/// let mut iterator = slab.iter();
///
/// assert_eq!(iterator.next(), Some((0, &0)));
/// assert_eq!(iterator.next(), Some((1, &1)));
/// assert_eq!(iterator.next(), Some((2, &2)));
/// assert_eq!(iterator.next(), None);
/// ```
pub fn iter(&self) -> Iter<'_, T> {
Iter {
entries: self.entries.iter().enumerate(),
len: self.len,
}
}
/// Return an iterator that allows modifying each value.
///
/// This function should generally be **avoided** as it is not efficient.
/// Iterators must iterate over every slot in the slab even if it is
/// vacant. As such, a slab with a capacity of 1 million but only one
/// stored value must still iterate the million slots.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let key1 = slab.insert(0);
/// let key2 = slab.insert(1);
///
/// for (key, val) in slab.iter_mut() {
/// if key == key1 {
/// *val += 2;
/// }
/// }
///
/// assert_eq!(slab[key1], 2);
/// assert_eq!(slab[key2], 1);
/// ```
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
IterMut {
entries: self.entries.iter_mut().enumerate(),
len: self.len,
}
}
/// Return a reference to the value associated with the given key.
///
/// If the given key is not associated with a value, then `None` is
/// returned.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// let key = slab.insert("hello");
///
/// assert_eq!(slab.get(key), Some(&"hello"));
/// assert_eq!(slab.get(123), None);
/// ```
pub fn get(&self, key: usize) -> Option<&T> {
match self.entries.get(key) {
Some(Entry::Occupied(val)) => Some(val),
_ => None,
}
}
/// Return a mutable reference to the value associated with the given key.
///
/// If the given key is not associated with a value, then `None` is
/// returned.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// let key = slab.insert("hello");
///
/// *slab.get_mut(key).unwrap() = "world";
///
/// assert_eq!(slab[key], "world");
/// assert_eq!(slab.get_mut(123), None);
/// ```
pub fn get_mut(&mut self, key: usize) -> Option<&mut T> {
match self.entries.get_mut(key) {
Some(&mut Entry::Occupied(ref mut val)) => Some(val),
_ => None,
}
}
/// Return two mutable references to the values associated with the two
/// given keys simultaneously.
///
/// If any one of the given keys is not associated with a value, then `None`
/// is returned.
///
/// This function can be used to get two mutable references out of one slab,
/// so that you can manipulate both of them at the same time, eg. swap them.
///
/// # Panics
///
/// This function will panic if `key1` and `key2` are the same.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// use std::mem;
///
/// let mut slab = Slab::new();
/// let key1 = slab.insert(1);
/// let key2 = slab.insert(2);
/// let (value1, value2) = slab.get2_mut(key1, key2).unwrap();
/// mem::swap(value1, value2);
/// assert_eq!(slab[key1], 2);
/// assert_eq!(slab[key2], 1);
/// ```
pub fn get2_mut(&mut self, key1: usize, key2: usize) -> Option<(&mut T, &mut T)> {
assert!(key1 != key2);
let (entry1, entry2);
if key1 > key2 {
let (slice1, slice2) = self.entries.split_at_mut(key1);
entry1 = slice2.get_mut(0);
entry2 = slice1.get_mut(key2);
} else {
let (slice1, slice2) = self.entries.split_at_mut(key2);
entry1 = slice1.get_mut(key1);
entry2 = slice2.get_mut(0);
}
match (entry1, entry2) {
(
Some(&mut Entry::Occupied(ref mut val1)),
Some(&mut Entry::Occupied(ref mut val2)),
) => Some((val1, val2)),
_ => None,
}
}
/// Return a reference to the value associated with the given key without
/// performing bounds checking.
///
/// For a safe alternative see [`get`](Slab::get).
///
/// This function should be used with care.
///
/// # Safety
///
/// The key must be within bounds.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// let key = slab.insert(2);
///
/// unsafe {
/// assert_eq!(slab.get_unchecked(key), &2);
/// }
/// ```
pub unsafe fn get_unchecked(&self, key: usize) -> &T {
match *self.entries.get_unchecked(key) {
Entry::Occupied(ref val) => val,
_ => unreachable!(),
}
}
/// Return a mutable reference to the value associated with the given key
/// without performing bounds checking.
///
/// For a safe alternative see [`get_mut`](Slab::get_mut).
///
/// This function should be used with care.
///
/// # Safety
///
/// The key must be within bounds.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// let key = slab.insert(2);
///
/// unsafe {
/// let val = slab.get_unchecked_mut(key);
/// *val = 13;
/// }
///
/// assert_eq!(slab[key], 13);
/// ```
pub unsafe fn get_unchecked_mut(&mut self, key: usize) -> &mut T {
match *self.entries.get_unchecked_mut(key) {
Entry::Occupied(ref mut val) => val,
_ => unreachable!(),
}
}
/// Return two mutable references to the values associated with the two
/// given keys simultaneously without performing bounds checking and safety
/// condition checking.
///
/// For a safe alternative see [`get2_mut`](Slab::get2_mut).
///
/// This function should be used with care.
///
/// # Safety
///
/// - Both keys must be within bounds.
/// - The condition `key1 != key2` must hold.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// use std::mem;
///
/// let mut slab = Slab::new();
/// let key1 = slab.insert(1);
/// let key2 = slab.insert(2);
/// let (value1, value2) = unsafe { slab.get2_unchecked_mut(key1, key2) };
/// mem::swap(value1, value2);
/// assert_eq!(slab[key1], 2);
/// assert_eq!(slab[key2], 1);
/// ```
pub unsafe fn get2_unchecked_mut(&mut self, key1: usize, key2: usize) -> (&mut T, &mut T) {
debug_assert_ne!(key1, key2);
let ptr = self.entries.as_mut_ptr();
let ptr1 = ptr.add(key1);
let ptr2 = ptr.add(key2);
match (&mut *ptr1, &mut *ptr2) {
(&mut Entry::Occupied(ref mut val1), &mut Entry::Occupied(ref mut val2)) => {
(val1, val2)
}
_ => unreachable!(),
}
}
/// Get the key for an element in the slab.
///
/// The reference must point to an element owned by the slab.
/// Otherwise this function will panic.
/// This is a constant-time operation because the key can be calculated
/// from the reference with pointer arithmetic.
///
/// # Panics
///
/// This function will panic if the reference does not point to an element
/// of the slab.
///
/// # Examples
///
/// ```
/// # use slab::*;
///
/// let mut slab = Slab::new();
/// let key = slab.insert(String::from("foo"));
/// let value = &slab[key];
/// assert_eq!(slab.key_of(value), key);
/// ```
///
/// Values are not compared, so passing a reference to a different location
/// will result in a panic:
///
/// ```should_panic
/// # use slab::*;
///
/// let mut slab = Slab::new();
/// let key = slab.insert(0);
/// let bad = &0;
/// slab.key_of(bad); // this will panic
/// unreachable!();
/// ```
#[cfg_attr(not(slab_no_track_caller), track_caller)]
pub fn key_of(&self, present_element: &T) -> usize {
let element_ptr = present_element as *const T as usize;
let base_ptr = self.entries.as_ptr() as usize;
// Use wrapping subtraction in case the reference is bad
let byte_offset = element_ptr.wrapping_sub(base_ptr);
// The division rounds away any offset of T inside Entry
// The size of Entry<T> is never zero even if T is due to Vacant(usize)
let key = byte_offset / mem::size_of::<Entry<T>>();
// Prevent returning unspecified (but out of bounds) values
if key >= self.entries.len() {
panic!("The reference points to a value outside this slab");
}
// The reference cannot point to a vacant entry, because then it would not be valid
key
}
/// Insert a value in the slab, returning key assigned to the value.
///
/// The returned key can later be used to retrieve or remove the value using indexed
/// lookup and `remove`. Additional capacity is allocated if needed. See
/// [Capacity and reallocation](index.html#capacity-and-reallocation).
///
/// # Panics
///
/// Panics if the new storage in the vector exceeds `isize::MAX` bytes.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// let key = slab.insert("hello");
/// assert_eq!(slab[key], "hello");
/// ```
pub fn insert(&mut self, val: T) -> usize {
let key = self.next;
self.insert_at(key, val);
key
}
/// Returns the key of the next vacant entry.
///
/// This function returns the key of the vacant entry which will be used
/// for the next insertion. This is equivalent to
/// `slab.vacant_entry().key()`, but it doesn't require mutable access.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
/// assert_eq!(slab.vacant_key(), 0);
///
/// slab.insert(0);
/// assert_eq!(slab.vacant_key(), 1);
///
/// slab.insert(1);
/// slab.remove(0);
/// assert_eq!(slab.vacant_key(), 0);
/// ```
pub fn vacant_key(&self) -> usize {
self.next
}
/// Return a handle to a vacant entry allowing for further manipulation.
///
/// This function is useful when creating values that must contain their
/// slab key. The returned `VacantEntry` reserves a slot in the slab and is
/// able to query the associated key.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = {
/// let entry = slab.vacant_entry();
/// let key = entry.key();
///
/// entry.insert((key, "hello"));
/// key
/// };
///
/// assert_eq!(hello, slab[hello].0);
/// assert_eq!("hello", slab[hello].1);
/// ```
pub fn vacant_entry(&mut self) -> VacantEntry<'_, T> {
VacantEntry {
key: self.next,
slab: self,
}
}
fn insert_at(&mut self, key: usize, val: T) {
self.len += 1;
if key == self.entries.len() {
self.entries.push(Entry::Occupied(val));
self.next = key + 1;
} else {
self.next = match self.entries.get(key) {
Some(&Entry::Vacant(next)) => next,
_ => unreachable!(),
};
self.entries[key] = Entry::Occupied(val);
}
}
/// Tries to remove the value associated with the given key,
/// returning the value if the key existed.
///
/// The key is then released and may be associated with future stored
/// values.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = slab.insert("hello");
///
/// assert_eq!(slab.try_remove(hello), Some("hello"));
/// assert!(!slab.contains(hello));
/// ```
pub fn try_remove(&mut self, key: usize) -> Option<T> {
if let Some(entry) = self.entries.get_mut(key) {
// Swap the entry at the provided value
let prev = mem::replace(entry, Entry::Vacant(self.next));
match prev {
Entry::Occupied(val) => {
self.len -= 1;
self.next = key;
return val.into();
}
_ => {
// Woops, the entry is actually vacant, restore the state
*entry = prev;
}
}
}
None
}
/// Remove and return the value associated with the given key.
///
/// The key is then released and may be associated with future stored
/// values.
///
/// # Panics
///
/// Panics if `key` is not associated with a value.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = slab.insert("hello");
///
/// assert_eq!(slab.remove(hello), "hello");
/// assert!(!slab.contains(hello));
/// ```
#[cfg_attr(not(slab_no_track_caller), track_caller)]
pub fn remove(&mut self, key: usize) -> T {
self.try_remove(key).expect("invalid key")
}
/// Return `true` if a value is associated with the given key.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = slab.insert("hello");
/// assert!(slab.contains(hello));
///
/// slab.remove(hello);
///
/// assert!(!slab.contains(hello));
/// ```
pub fn contains(&self, key: usize) -> bool {
match self.entries.get(key) {
Some(&Entry::Occupied(_)) => true,
_ => false,
}
}
/// Retain only the elements specified by the predicate.
///
/// In other words, remove all elements `e` such that `f(usize, &mut e)`
/// returns false. This method operates in place and preserves the key
/// associated with the retained values.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let k1 = slab.insert(0);
/// let k2 = slab.insert(1);
/// let k3 = slab.insert(2);
///
/// slab.retain(|key, val| key == k1 || *val == 1);
///
/// assert!(slab.contains(k1));
/// assert!(slab.contains(k2));
/// assert!(!slab.contains(k3));
///
/// assert_eq!(2, slab.len());
/// ```
pub fn retain<F>(&mut self, mut f: F)
where
F: FnMut(usize, &mut T) -> bool,
{
for i in 0..self.entries.len() {
let keep = match self.entries[i] {
Entry::Occupied(ref mut v) => f(i, v),
_ => true,
};
if !keep {
self.remove(i);
}
}
}
/// Return a draining iterator that removes all elements from the slab and
/// yields the removed items.
///
/// Note: Elements are removed even if the iterator is only partially
/// consumed or not consumed at all.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let _ = slab.insert(0);
/// let _ = slab.insert(1);
/// let _ = slab.insert(2);
///
/// {
/// let mut drain = slab.drain();
///
/// assert_eq!(Some(0), drain.next());
/// assert_eq!(Some(1), drain.next());
/// assert_eq!(Some(2), drain.next());
/// assert_eq!(None, drain.next());
/// }
///
/// assert!(slab.is_empty());
/// ```
pub fn drain(&mut self) -> Drain<'_, T> {
let old_len = self.len;
self.len = 0;
self.next = 0;
Drain {
inner: self.entries.drain(..),
len: old_len,
}
}
}
impl<T> ops::Index<usize> for Slab<T> {
type Output = T;
#[cfg_attr(not(slab_no_track_caller), track_caller)]
fn index(&self, key: usize) -> &T {
match self.entries.get(key) {
Some(Entry::Occupied(v)) => v,
_ => panic!("invalid key"),
}
}
}
impl<T> ops::IndexMut<usize> for Slab<T> {
#[cfg_attr(not(slab_no_track_caller), track_caller)]
fn index_mut(&mut self, key: usize) -> &mut T {
match self.entries.get_mut(key) {
Some(&mut Entry::Occupied(ref mut v)) => v,
_ => panic!("invalid key"),
}
}
}
impl<T> IntoIterator for Slab<T> {
type Item = (usize, T);
type IntoIter = IntoIter<T>;
fn into_iter(self) -> IntoIter<T> {
IntoIter {
entries: self.entries.into_iter().enumerate(),
len: self.len,
}
}
}
impl<'a, T> IntoIterator for &'a Slab<T> {
type Item = (usize, &'a T);
type IntoIter = Iter<'a, T>;
fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}
impl<'a, T> IntoIterator for &'a mut Slab<T> {
type Item = (usize, &'a mut T);
type IntoIter = IterMut<'a, T>;
fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
}
}
/// Create a slab from an iterator of key-value pairs.
///
/// If the iterator produces duplicate keys, the previous value is replaced with the later one.
/// The keys does not need to be sorted beforehand, and this function always
/// takes O(n) time.
/// Note that the returned slab will use space proportional to the largest key,
/// so don't use `Slab` with untrusted keys.
///
/// # Examples
///
/// ```
/// # use slab::*;
///
/// let vec = vec![(2,'a'), (6,'b'), (7,'c')];
/// let slab = vec.into_iter().collect::<Slab<char>>();
/// assert_eq!(slab.len(), 3);
/// assert!(slab.capacity() >= 8);
/// assert_eq!(slab[2], 'a');
/// ```
///
/// With duplicate and unsorted keys:
///
/// ```
/// # use slab::*;
///
/// let vec = vec![(20,'a'), (10,'b'), (11,'c'), (10,'d')];
/// let slab = vec.into_iter().collect::<Slab<char>>();
/// assert_eq!(slab.len(), 3);
/// assert_eq!(slab[10], 'd');
/// ```
impl<T> FromIterator<(usize, T)> for Slab<T> {
fn from_iter<I>(iterable: I) -> Self
where
I: IntoIterator<Item = (usize, T)>,
{
let iterator = iterable.into_iter();
let mut builder = builder::Builder::with_capacity(iterator.size_hint().0);
for (key, value) in iterator {
builder.pair(key, value)
}
builder.build()
}
}
impl<T> fmt::Debug for Slab<T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
if fmt.alternate() {
fmt.debug_map().entries(self.iter()).finish()
} else {
fmt.debug_struct("Slab")
.field("len", &self.len)
.field("cap", &self.capacity())
.finish()
}
}
}
impl<T> fmt::Debug for IntoIter<T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("IntoIter")
.field("remaining", &self.len)
.finish()
}
}
impl<T> fmt::Debug for Iter<'_, T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Iter")
.field("remaining", &self.len)
.finish()
}
}
impl<T> fmt::Debug for IterMut<'_, T>
where
T: fmt::Debug,
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("IterMut")
.field("remaining", &self.len)
.finish()
}
}
impl<T> fmt::Debug for Drain<'_, T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Drain").finish()
}
}
// ===== VacantEntry =====
impl<'a, T> VacantEntry<'a, T> {
/// Insert a value in the entry, returning a mutable reference to the value.
///
/// To get the key associated with the value, use `key` prior to calling
/// `insert`.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = {
/// let entry = slab.vacant_entry();
/// let key = entry.key();
///
/// entry.insert((key, "hello"));
/// key
/// };
///
/// assert_eq!(hello, slab[hello].0);
/// assert_eq!("hello", slab[hello].1);
/// ```
pub fn insert(self, val: T) -> &'a mut T {
self.slab.insert_at(self.key, val);
match self.slab.entries.get_mut(self.key) {
Some(&mut Entry::Occupied(ref mut v)) => v,
_ => unreachable!(),
}
}
/// Return the key associated with this entry.
///
/// A value stored in this entry will be associated with this key.
///
/// # Examples
///
/// ```
/// # use slab::*;
/// let mut slab = Slab::new();
///
/// let hello = {
/// let entry = slab.vacant_entry();
/// let key = entry.key();
///
/// entry.insert((key, "hello"));
/// key
/// };
///
/// assert_eq!(hello, slab[hello].0);
/// assert_eq!("hello", slab[hello].1);
/// ```
pub fn key(&self) -> usize {
self.key
}
}
// ===== IntoIter =====
impl<T> Iterator for IntoIter<T> {
type Item = (usize, T);
fn next(&mut self) -> Option<Self::Item> {
for (key, entry) in &mut self.entries {
if let Entry::Occupied(v) = entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.len, Some(self.len))
}
}
impl<T> DoubleEndedIterator for IntoIter<T> {
fn next_back(&mut self) -> Option<Self::Item> {
while let Some((key, entry)) = self.entries.next_back() {
if let Entry::Occupied(v) = entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
}
impl<T> ExactSizeIterator for IntoIter<T> {
fn len(&self) -> usize {
self.len
}
}
impl<T> FusedIterator for IntoIter<T> {}
// ===== Iter =====
impl<'a, T> Iterator for Iter<'a, T> {
type Item = (usize, &'a T);
fn next(&mut self) -> Option<Self::Item> {
for (key, entry) in &mut self.entries {
if let Entry::Occupied(ref v) = *entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.len, Some(self.len))
}
}
impl<T> DoubleEndedIterator for Iter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
while let Some((key, entry)) = self.entries.next_back() {
if let Entry::Occupied(ref v) = *entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
}
impl<T> ExactSizeIterator for Iter<'_, T> {
fn len(&self) -> usize {
self.len
}
}
impl<T> FusedIterator for Iter<'_, T> {}
// ===== IterMut =====
impl<'a, T> Iterator for IterMut<'a, T> {
type Item = (usize, &'a mut T);
fn next(&mut self) -> Option<Self::Item> {
for (key, entry) in &mut self.entries {
if let Entry::Occupied(ref mut v) = *entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.len, Some(self.len))
}
}
impl<T> DoubleEndedIterator for IterMut<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
while let Some((key, entry)) = self.entries.next_back() {
if let Entry::Occupied(ref mut v) = *entry {
self.len -= 1;
return Some((key, v));
}
}
debug_assert_eq!(self.len, 0);
None
}
}
impl<T> ExactSizeIterator for IterMut<'_, T> {
fn len(&self) -> usize {
self.len
}
}
impl<T> FusedIterator for IterMut<'_, T> {}
// ===== Drain =====
impl<T> Iterator for Drain<'_, T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
for entry in &mut self.inner {
if let Entry::Occupied(v) = entry {
self.len -= 1;
return Some(v);
}
}
debug_assert_eq!(self.len, 0);
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.len, Some(self.len))
}
}
impl<T> DoubleEndedIterator for Drain<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
while let Some(entry) = self.inner.next_back() {
if let Entry::Occupied(v) = entry {
self.len -= 1;
return Some(v);
}
}
debug_assert_eq!(self.len, 0);
None
}
}
impl<T> ExactSizeIterator for Drain<'_, T> {
fn len(&self) -> usize {
self.len
}
}
impl<T> FusedIterator for Drain<'_, T> {}
|
use tonic_ws_transport::WsConnection;
use futures_util::StreamExt;
use tokio::net::TcpListener;
use tokio_stream::wrappers::TcpListenerStream;
use tonic::{transport::Server, Request, Response, Status};
use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
pub mod hello_world {
tonic::include_proto!("helloworld");
}
#[derive(Default)]
pub struct MyGreeter {}
#[tonic::async_trait]
impl Greeter for MyGreeter {
async fn say_hello(
&self,
request: Request<HelloRequest>,
) -> Result<Response<HelloReply>, Status> {
println!("Got a request: {:?}", request);
let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "127.0.0.1:3012";
let listener = TcpListener::bind(addr).await?;
let listener_stream = TcpListenerStream::new(listener);
let incoming = listener_stream.then(|connection| async {
match connection {
Ok(tcp_stream) => {
let ws_stream = tokio_tungstenite::accept_async(tcp_stream).await.unwrap();
Ok(WsConnection::from_combined_channel(ws_stream))
}
Err(e) => Err(e),
}
});
let greeter = MyGreeter::default();
println!("GreeterServer listening on {}", addr);
Server::builder()
.add_service(GreeterServer::new(greeter))
.serve_with_incoming(incoming)
.await?;
Ok(())
}
|
use super::*;
use rand::Rng;
use regex::Regex;
pub fn ontest_config(cfg: &mut web::ServiceConfig) {
cfg.service(do_login)
.service(do_login_phone)
.service(do_login_refresh)
.service(do_login_status)
.service(do_logout)
.service(user_playlist)
.service(song_url)
.service(playlist_detail)
.service(song_detail);
}
use actix_web::dev::Body;
use futures::stream::StreamExt;
use rustc_serialize::json::{Json, ToJson};
async fn add_cookie(resp: HttpResponse) -> Result<HttpResponse, Error> {
if resp.status().as_u16() != 200 {
return Ok(resp);
}
let mut resp = resp;
let str_cookie = resp.headers().get("cookie").unwrap().to_str().unwrap().to_string();
if !str_cookie.is_empty() {
let mut body = resp.take_body();
let mut body_vec = Vec::new();
while let Some(chunk) = body.next().await {
body_vec.extend_from_slice(&chunk?);
}
let mut body = Json::from_str(String::from_utf8(body_vec).unwrap().as_str()).unwrap();
let body = body.as_object_mut().unwrap();
body.insert("cookie".to_string(), Json::String(str_cookie));
let body_string = body.to_json().to_string();
Ok(resp.set_body(Body::from_slice(body_string.as_bytes())))
}else{
Ok(HttpResponse::ExpectationFailed().finish())
}
}
async fn _extract_info(resp: HttpResponse) -> Result<HttpResponse, Error> {
let mut resp = resp;
let mut body = resp.take_body();
let mut body_vec = Vec::new();
while let Some(chunk) = body.next().await {
body_vec.extend_from_slice(&chunk?);
}
let body = String::from_utf8(body_vec).unwrap();
let rgx = Regex::new(r"GUser\s*=\s*([^;]+);").unwrap();
let mut profile = Json::Null;
if let Some(caps) = rgx.captures(&body) {
let caps = caps.get(1).unwrap().as_str();
profile = Json::from_str(caps).unwrap();
}
let rgx = Regex::new(r"GBinds\s*=\s*([^;]+);").unwrap();
let mut bindings = Json::Null;
if let Some(caps) = rgx.captures(&body) {
let caps = caps.get(1).unwrap().as_str();
bindings = Json::from_str(caps).unwrap();
}
let mut body = std::collections::BTreeMap::new();
body.insert("profile".to_string(),profile);
body.insert("bindings".to_string(),bindings);
body.insert("code".to_string(),Json::U64(200));
let body_string = body.to_json().to_string();
Ok(resp.set_body(Body::from_slice(body_string.as_bytes())))
}
#[get("/login")]
async fn do_login(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let mut query = req.query();
if let Some(cookie) = query["cookie"].as_object_mut() {
cookie.insert("os".to_string(), Value::String("pc".to_string()));
} else {
query["cookie"] = json!({
"os":"pc"
});
}
let mut data: Value = json!({
"phone":query["email"],
"password":md5::compute(&query["password"].to_string()).to_hex(),
"rememberLogin":"true",
});
let mut options = json!({
"crypto": "weapi",
"ua":"pc",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/login".to_string();
let resp = ForwordRequest::new("login")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await?;
add_cookie(resp).await
}
#[get("/login/cellphone")]
async fn do_login_phone(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let mut query = req.query();
if let Some(cookie) = query["cookie"].as_object_mut() {
cookie.insert("os".to_string(), Value::String("pc".to_string()));
} else {
query["cookie"] = json!({
"os":"pc"
});
}
if query["countrycode"].is_null() {
query["countrycode"] = Value::String("86".to_string());
}
let mut data: Value = json!({
"phone":query["phone"],
"countrycode":query["countrycode"],
"password":md5::compute(query["password"].as_str().unwrap()).to_hex(),
"rememberLogin":"true",
});
let mut options = json!({
"crypto": "weapi",
"ua":"pc",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/login/cellphone".to_string();
let resp = ForwordRequest::new("login")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await?;
add_cookie(resp).await
}
#[get("/login/refresh")]
async fn do_login_refresh(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let mut query = req.query();
if let Some(cookie) = query["cookie"].as_object_mut() {
cookie.insert("os".to_string(), Value::String("pc".to_string()));
} else {
query["cookie"] = json!({
"os":"pc"
});
}
let mut data: Value = Value::Null;
let mut options = json!({
"crypto": "weapi",
"ua":"pc",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/login/token/refresh".to_string();
ForwordRequest::new("do_login_refresh")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/login/status")]
async fn do_login_status(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let query = req.query();
let mut data = json!(null);
let mut options = json!({
"crypto": "weapi",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/w/nuser/account/get".to_string();
ForwordRequest::new("do_login_status")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/logout")]
async fn do_logout(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let mut query = req.query();
if let Some(cookie) = query["cookie"].as_object_mut() {
cookie.insert("os".to_string(), Value::String("pc".to_string()));
} else {
query["cookie"] = json!({
"os":"pc"
});
}
let mut data: Value = Value::Null;
let mut options = json!({
"crypto": "weapi",
"ua":"pc",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/logout".to_string();
ForwordRequest::new("do_login_status")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/user/playlist")]
async fn user_playlist(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let query = req.query();
let mut data: Value = json!({
"uid":query["uid"],
"limit":query["limit"].as_u64().unwrap_or_else(||30),
"offset":query["offset"].as_u64().unwrap_or_else(||0),
"includeVideo":true
});
let mut options = json!({
"crypto": "weapi",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/api/user/playlist".to_string();
ForwordRequest::new("artist")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/song/url")]
async fn song_url(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let mut query = req.query();
if let Some(cookie) = query["cookie"].as_object_mut() {
if !cookie.contains_key("MUSIC_U") {
let mut rng = rand::thread_rng();
let bytes: String = (0..16)
.map(|_| rng.gen_range(0, 255))
.collect::<Vec<u8>>()
.to_hex();
cookie.insert("_ntes_nuid".to_string(), Value::from(bytes));
}
cookie.insert("os".to_string(), Value::from("pc"));
}
let mut data: Value = json!({
"ids":format!("[{}]",query["id"].as_str().unwrap()),
"br":query["br"].as_u64().unwrap_or_else(||999000),
});
let mut options = json!({
"crypto": "eapi",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
"url":"/api/song/enhance/player/url",
});
let mut url = "https://interface3.music.163.com/eapi/song/enhance/player/url".to_string();
ForwordRequest::new("song_url")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/playlist/detail")]
async fn playlist_detail(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let query = req.query();
let mut data: Value = json!({
"id": query["id"],
"n":100000,
"s":query["s"].as_u64().unwrap_or_else(||8)
});
let mut options = json!({
"crypto": "weapi",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/api/v6/playlist/detail".to_string();
ForwordRequest::new("playlist_detail")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
#[get("/song/detail")]
async fn song_detail(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> {
let query = req.query();
let ids1 = query["ids"].as_str().unwrap_or_else(|| "");
let ids2 = ids1.split(',').collect::<Vec<_>>();
let ids3 = ids2
.iter()
.map(|&id| format!("{{\"id\":{}}}", id))
.collect::<Vec<_>>()
.join(",");
let mut c = "[".to_string();
c.push_str(&ids3);
c.push(']');
let ids4 = ids2.join(",");
let mut ids = "[".to_string();
ids.push_str(&ids4);
ids.push(']');
let mut data: Value = json!({
"c" : c,
"ids" : ids,
});
let mut options = json!({
"crypto": "weapi",
"cookie":query["cookie"],
"proxy":query["proxy"],
"realIp":query["realIp"],
});
let mut url = "https://music.163.com/weapi/v3/song/detail".to_string();
ForwordRequest::new("song_detail")
.forward(Method::POST, &mut url, &mut data, &mut options, req, stream)
.await
}
|
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::cmp::Ordering;
use serde::Deserialize;
use serde::Serialize;
/// The meta data of a record in kv
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct KVMeta {
/// expiration time in second since 1970
pub expire_at: Option<u64>,
}
/// Value of StateMachine generic-kv
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
pub struct KVValue<T = Vec<u8>> {
pub meta: Option<KVMeta>,
pub value: T,
}
impl<T> KVValue<T> {
pub fn set_meta(mut self, m: Option<KVMeta>) -> KVValue<T> {
self.meta = m;
self
}
pub fn set_value(mut self, v: T) -> KVValue<T> {
self.value = v;
self
}
}
/// Compare with a timestamp to check if it is expired.
impl<T> PartialEq<u64> for KVValue<T> {
fn eq(&self, other: &u64) -> bool {
match self.meta {
None => false,
Some(ref m) => match m.expire_at {
None => false,
Some(ref exp) => exp == other,
},
}
}
}
/// Compare with a timestamp to check if it is expired.
impl<T> PartialOrd<u64> for KVValue<T> {
fn partial_cmp(&self, other: &u64) -> Option<Ordering> {
match self.meta {
None => None,
Some(ref m) => m.expire_at.as_ref().map(|exp| exp.cmp(other)),
}
}
}
|
use std::ascii::escape_default;
pub fn bytes_to_string(s: &[u8]) -> String {
s.iter()
.map(|c| escape_default(*c).map(|sc| sc as char).collect::<String>())
.collect::<Vec<String>>()
.concat()
}
|
#[cfg(all(
any(target_arch = "x86", target_arch = "x86_64"),
all(target_feature = "aes", target_feature = "sse2")
))]
#[path = "./aesni_x86.rs"]
mod platform;
// AArch64 CPU 特性名称:
// https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/src/detect/arch/aarch64.rs
#[cfg(all(
target_arch = "aarch64",
all(target_feature = "neon", target_feature = "crypto")
))]
#[path = "./aesni_aarch64.rs"]
mod platform;
#[cfg(not(any(
all(
any(target_arch = "x86", target_arch = "x86_64"),
all(target_feature = "aes", target_feature = "sse2")
),
all(
target_arch = "aarch64",
all(target_feature = "neon", target_feature = "crypto")
)
)))]
#[path = "./generic.rs"]
mod platform;
pub use self::platform::*;
|
#[doc = "Reader of register TXCSRL3"]
pub type R = crate::R<u8, super::TXCSRL3>;
#[doc = "Writer for register TXCSRL3"]
pub type W = crate::W<u8, super::TXCSRL3>;
#[doc = "Register TXCSRL3 `reset()`'s with value 0"]
impl crate::ResetValue for super::TXCSRL3 {
type Type = u8;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `TXRDY`"]
pub type TXRDY_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TXRDY`"]
pub struct TXRDY_W<'a> {
w: &'a mut W,
}
impl<'a> TXRDY_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u8) & 0x01);
self.w
}
}
#[doc = "Reader of field `FIFONE`"]
pub type FIFONE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `FIFONE`"]
pub struct FIFONE_W<'a> {
w: &'a mut W,
}
impl<'a> FIFONE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1);
self.w
}
}
#[doc = "Reader of field `ERROR`"]
pub type ERROR_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `ERROR`"]
pub struct ERROR_W<'a> {
w: &'a mut W,
}
impl<'a> ERROR_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u8) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `UNDRN`"]
pub type UNDRN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `UNDRN`"]
pub struct UNDRN_W<'a> {
w: &'a mut W,
}
impl<'a> UNDRN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u8) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `FLUSH`"]
pub type FLUSH_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `FLUSH`"]
pub struct FLUSH_W<'a> {
w: &'a mut W,
}
impl<'a> FLUSH_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u8) & 0x01) << 3);
self.w
}
}
#[doc = "Reader of field `SETUP`"]
pub type SETUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SETUP`"]
pub struct SETUP_W<'a> {
w: &'a mut W,
}
impl<'a> SETUP_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `STALL`"]
pub type STALL_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `STALL`"]
pub struct STALL_W<'a> {
w: &'a mut W,
}
impl<'a> STALL_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `STALLED`"]
pub type STALLED_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `STALLED`"]
pub struct STALLED_W<'a> {
w: &'a mut W,
}
impl<'a> STALLED_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u8) & 0x01) << 5);
self.w
}
}
#[doc = "Reader of field `CLRDT`"]
pub type CLRDT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CLRDT`"]
pub struct CLRDT_W<'a> {
w: &'a mut W,
}
impl<'a> CLRDT_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
self.w
}
}
#[doc = "Reader of field `NAKTO`"]
pub type NAKTO_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `NAKTO`"]
pub struct NAKTO_W<'a> {
w: &'a mut W,
}
impl<'a> NAKTO_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
self.w
}
}
impl R {
#[doc = "Bit 0 - Transmit Packet Ready"]
#[inline(always)]
pub fn txrdy(&self) -> TXRDY_R {
TXRDY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - FIFO Not Empty"]
#[inline(always)]
pub fn fifone(&self) -> FIFONE_R {
FIFONE_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Error"]
#[inline(always)]
pub fn error(&self) -> ERROR_R {
ERROR_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 2 - Underrun"]
#[inline(always)]
pub fn undrn(&self) -> UNDRN_R {
UNDRN_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Flush FIFO"]
#[inline(always)]
pub fn flush(&self) -> FLUSH_R {
FLUSH_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Setup Packet"]
#[inline(always)]
pub fn setup(&self) -> SETUP_R {
SETUP_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 4 - Send STALL"]
#[inline(always)]
pub fn stall(&self) -> STALL_R {
STALL_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Endpoint Stalled"]
#[inline(always)]
pub fn stalled(&self) -> STALLED_R {
STALLED_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - Clear Data Toggle"]
#[inline(always)]
pub fn clrdt(&self) -> CLRDT_R {
CLRDT_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - NAK Timeout"]
#[inline(always)]
pub fn nakto(&self) -> NAKTO_R {
NAKTO_R::new(((self.bits >> 7) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Transmit Packet Ready"]
#[inline(always)]
pub fn txrdy(&mut self) -> TXRDY_W {
TXRDY_W { w: self }
}
#[doc = "Bit 1 - FIFO Not Empty"]
#[inline(always)]
pub fn fifone(&mut self) -> FIFONE_W {
FIFONE_W { w: self }
}
#[doc = "Bit 2 - Error"]
#[inline(always)]
pub fn error(&mut self) -> ERROR_W {
ERROR_W { w: self }
}
#[doc = "Bit 2 - Underrun"]
#[inline(always)]
pub fn undrn(&mut self) -> UNDRN_W {
UNDRN_W { w: self }
}
#[doc = "Bit 3 - Flush FIFO"]
#[inline(always)]
pub fn flush(&mut self) -> FLUSH_W {
FLUSH_W { w: self }
}
#[doc = "Bit 4 - Setup Packet"]
#[inline(always)]
pub fn setup(&mut self) -> SETUP_W {
SETUP_W { w: self }
}
#[doc = "Bit 4 - Send STALL"]
#[inline(always)]
pub fn stall(&mut self) -> STALL_W {
STALL_W { w: self }
}
#[doc = "Bit 5 - Endpoint Stalled"]
#[inline(always)]
pub fn stalled(&mut self) -> STALLED_W {
STALLED_W { w: self }
}
#[doc = "Bit 6 - Clear Data Toggle"]
#[inline(always)]
pub fn clrdt(&mut self) -> CLRDT_W {
CLRDT_W { w: self }
}
#[doc = "Bit 7 - NAK Timeout"]
#[inline(always)]
pub fn nakto(&mut self) -> NAKTO_W {
NAKTO_W { w: self }
}
}
|
use reqwest::get;
use std::collections::HashMap;
#[derive(Debug, Deserialize)]
struct List {
#[serde(rename = "Data")]
data: HashMap<String, LCoin>,
}
#[derive(Debug, Deserialize)]
struct LCoin {
#[serde(rename = "FullName")]
name: String,
}
#[derive(Debug, Deserialize)]
struct History {
#[serde(rename = "Data")]
data: Vec<HCoin>,
}
#[derive(Debug, Deserialize)]
struct HCoin {
close: f32,
}
#[derive(Debug, Deserialize)]
struct Current {
#[serde(flatten, rename = "Data")]
data: HashMap<String, f32>,
}
const BASE_URL: &str = "https://min-api.cryptocompare.com/data/";
pub(crate) fn history(time: &str, coin: &str, currency: &str, past: &str) -> Vec<f32> {
get(&history_url(time, coin, currency, past))
.expect("cannot get coin history")
.json::<History>()
.expect("cannot parse coin history")
.data
.iter()
.map(|coin| coin.close)
.collect()
}
pub(crate) fn current(coin: &str, currency: &str) -> f32 {
get(¤t_url(coin, currency))
.expect("cannot get coin price")
.json::<Current>()
.expect("cannot parse coin price")
.data
.get(currency)
.cloned()
.unwrap()
}
pub(crate) fn list() -> Vec<String> {
get(&list_url())
.expect("cannot get coin list")
.json::<List>()
.expect("cannot parse coin list")
.data
.values()
.map(|coin| coin.name.trim().to_owned())
.collect()
}
fn history_url(time: &str, coin: &str, currency: &str, past: &str) -> String {
[
BASE_URL,
time,
"?fsym=",
coin,
"&tsym=",
currency,
"&limit=",
past,
"&e=CCCAGG",
]
.join("")
}
fn current_url(coin: &str, currency: &str) -> String {
[BASE_URL, "price?fsym=", coin, "&tsyms=", currency].join("")
}
fn list_url() -> String {
[BASE_URL, "all/coinlist"].join("")
}
|
// =========
struct SegTree<T> {
// num: 葉(元データ)の数, data: ノードの値, neutral: 単位元, merge: 区間クエリ, update_point: 点更新
num: usize,
data: Vec<T>,
neutral: T,
merge: Box<Fn(T, T) -> T>,
update_point: Box<Fn(T, T) -> T>,
}
impl<T: Clone + Copy + std::fmt::Debug> SegTree<T> {
// v...元配列, neutral...初期値かつ単位元, merge...区間クエリ, update:
fn new(
v: Vec<T>,
neutral: T,
merge: Box<Fn(T, T) -> T>,
update_point: Box<Fn(T, T) -> T>,
) -> Self {
let n = v.len().checked_next_power_of_two().unwrap();
let mut data: Vec<T> = vec![neutral; 2 * n - 1];
for i in 0..v.len() {
data[i + n - 1] = v[i];
}
if n > 1 {
for i in (0..(n - 2)).rev() {
data[i] = merge(data[2 * i + 1], data[2 * i + 2]);
}
}
SegTree {
num: n,
data: data,
neutral: neutral,
merge: merge,
update_point: update_point,
}
}
// 点更新, i番目の値をxで更新
fn update(&mut self, i: usize, x: T) {
let mut i = i + self.num - 1; // 対応する葉のNodeへ
self.data[i] = (self.update_point)(self.data[i], x);
while i > 0 {
i = (i - 1) / 2;
// 親の値を更新する
self.data[i] = (self.merge)(self.data[i * 2 + 1], self.data[i * 2 + 2]);
}
}
// [a, b): クエリの区間, k: valueのNode, [l,r): k-Nodeの担当区間
// 0-indexedで来たら[a, b+1]をする
fn query(&self, a: usize, b: usize, k: usize, l: usize, r: usize) -> T {
if r <= a || b <= l {
self.neutral // 区間がかぶらないので単位元
} else if a <= l && r <= b {
self.data[k] //もろの区間なので値を返す
} else {
//半端な区間なので左右にqueryしてもう一回評価をする
let l_val = self.query(a, b, 2 * k + 1, l, (l + r) / 2);
let r_val = self.query(a, b, 2 * k + 2, (l + r) / 2, r);
(self.merge)(l_val, r_val)
}
}
}
// adjl...隣接リスト, u...今の点, depth...各頂点の深さを持つ, d...深さの値, fid...各頂点がはじめて出るet上のIndex
fn eulertour(
adjl: &Vec<Vec<usize>>,
u: usize,
p: usize,
et: &mut Vec<usize>,
depth: &mut Vec<usize>,
d: usize,
fid: &mut Vec<usize>,
) {
depth[u] = d;
fid[u] = et.len();
et.push(u);
for v in &adjl[u] {
if *v != p {
eulertour(adjl, *v, u, et, depth, d + 1, fid);
et.push(u);
}
}
}
fn main() {}
mod tests {
use super::*;
#[test]
fn check_euler_tour() {
let adjl = vec![
vec![1, 2, 3],
vec![4, 5],
vec![],
vec![],
vec![],
vec![6, 7],
vec![],
vec![],
];
// euler tour... DFSで辿る頂点を順に保存したもの
let mut et: Vec<usize> = vec![];
// 各頂点の深さ
let mut depth: Vec<usize> = vec![std::usize::MAX; adjl.len()];
// 各頂点が初めて現れるetのIndex
let mut fid: Vec<usize> = vec![std::usize::MAX; adjl.len()];
eulertour(&adjl, 0, 0, &mut et, &mut depth, 0, &mut fid);
assert_eq!(et, vec![0, 1, 4, 1, 5, 6, 5, 7, 5, 1, 0, 2, 0, 3, 0]);
println!("{:?}", et);
assert_eq!(depth, vec![0, 1, 1, 1, 2, 2, 3, 3]);
println!("{:?}", depth);
assert_eq!(fid, vec![0, 1, 1, 1, 2, 2, 3, 3]);
println!("{:?}", fid);
}
#[test]
fn check_lca() {
let adjl = vec![
vec![1, 2, 3],
vec![4, 5],
vec![],
vec![],
vec![],
vec![6, 7],
vec![],
vec![],
];
// euler tour
let mut et: Vec<usize> = vec![];
// 各頂点の深さ
let mut depth: Vec<usize> = vec![std::usize::MAX; adjl.len()];
// 各頂点が初めて現れるetのIndex
let mut fid: Vec<usize> = vec![std::usize::MAX; adjl.len()];
eulertour(&adjl, 0, 0, &mut et, &mut depth, 0, &mut fid);
let v = et
.iter()
.map(|e| (*e, depth[*e]))
.collect::<Vec<(usize, usize)>>();
// オイラーツアーの最小値Indexを求めるセグ木
let st = SegTree::<(usize, usize)>::new(
v,
(std::usize::MAX, std::usize::MAX),
Box::new(
|l: (usize, usize), r: (usize, usize)| {
if l.1 < r.1 {
l
} else {
r
}
},
),
Box::new(|_old: (usize, usize), new: (usize, usize)| new),
);
let u = 6;
let v = 7;
if fid[u] < fid[v] {
assert_eq!(5, st.query(fid[u], fid[v], 0, 0, st.num).0);
} else {
assert_eq!(5, st.query(fid[v], fid[u], 0, 0, st.num).0)
}
}
}
|
use core::str::Split;
use std::borrow::Cow;
use regex::Regex;
static OLD_FILE_NAME_HEADER: &str = "--- ";
static NEW_FILE_NAME_HEADER: &str = "+++ ";
static HUNK_HEADER_PREFIX: &str = "@@";
pub fn parse_diff(diff: &str) -> Vec<File> {
let mut state = ParseState::new();
let diff: Cow<'_, str> = Cow::Borrowed(diff);
lazy_static! {
static ref NO_NEWLINE: Regex = Regex::new(r#"\\ No newline at end of file"#).unwrap();
static ref REPLACE_LINE: Regex = Regex::new(r#"\r\n?"#).unwrap();
// Diff
static ref OLD_MODE: Regex = Regex::new(r#"old mode (\d{6})"#).unwrap();
static ref NEW_MODE: Regex = Regex::new(r#"new mode (\d{6})"#).unwrap();
static ref DELETED_FILE_MODE: Regex = Regex::new(r#"deleted file mode (\d{6})"#).unwrap();
static ref NEW_FILE_MODE: Regex = Regex::new(r#"new file mode (\d{6})"#).unwrap();
static ref COPY_FROM: Regex = Regex::new(r#"copy from "?(.+)"?"#).unwrap();
static ref COPY_TO: Regex = Regex::new(r#"copy to "?(.+)"?"#).unwrap();
static ref RENAME_FROM: Regex = Regex::new(r#"rename from "?(.+)"?"#).unwrap();
static ref RENAME_TO: Regex = Regex::new(r#"rename to "?(.+)"?"#).unwrap();
static ref SIMILARITY_INDEX: Regex = Regex::new(r#"similarity index (\d+)%"#).unwrap();
static ref DISSIMILARITY_INDEX: Regex = Regex::new(r#"dissimilarity index (\d+)%"#).unwrap();
static ref INDEX: Regex = Regex::new(r#"index ([0-9a-z]+)\.\.([0-9a-z]+)\s*(\d{6})?"#).unwrap();
static ref BINARY_FILES: Regex = Regex::new(r#"Binary files (.*) and (.*) differ"#).unwrap();
static ref BINARY_DIFF: Regex = Regex::new(r#"GIT binary patch"#).unwrap();
// Combined Diff
static ref COMBINED_INDEX: Regex = Regex::new(r#"index ([0-9a-z]+),([0-9a-z]+)\.\.([0-9a-z]+)"#).unwrap();
static ref COMBINED_MODE: Regex = Regex::new(r#"mode (\d{6}),(\d{6})\.\.(\d{6})"#).unwrap();
static ref COMBINED_NEW_FILE: Regex = Regex::new(r#"new file mode (\d{6})"#).unwrap();
static ref COMBINED_DELETED_FILE: Regex = Regex::new(r#"deleted file mode (\d{6}),(\d{6})"#).unwrap();
static ref GIT_DIFF_START: Regex = Regex::new(r#"^diff --git "?(.+)"? "?(.+)"?"#).unwrap();
}
let diff = NO_NEWLINE.replace_all(&diff, "");
let diff = REPLACE_LINE.replace_all(&diff, "\n");
let diff_lines: Split<&str> = diff.split("\n");
let diff_lines: Vec<&str> = diff_lines.collect();
for (i, line) in diff_lines.iter().enumerate() {
if *line == "" || line.starts_with("*") {
continue;
}
// Collect some lines.
let prev_line = if i == 0 { None } else { diff_lines.get(i - 1) };
let next_line = diff_lines.get(i + 1);
let after_next_line = diff_lines.get(i + 2);
if line.starts_with("diff") {
//println!("got new file");
state.start_file();
let captures = GIT_DIFF_START.captures(line);
if let Some(captures) = captures {
state.possible_old_name =
get_filename(None, captures.get(1).unwrap().as_str(), None);
state.possible_new_name =
get_filename(None, captures.get(2).unwrap().as_str(), None);
}
state.current_file.as_mut().unwrap().is_git_diff = true;
continue;
}
if
// If we do not have a file yet, create one.
state.current_file.is_none()
|| (
// We already have some file in progress.
!state.current_file.as_ref().unwrap().is_git_diff
&& (
// If we get to an old file path header line
line.starts_with(OLD_FILE_NAME_HEADER)
// And it's followed by the new file path header...
&& next_line.unwrap().starts_with(NEW_FILE_NAME_HEADER)
// ...and the hunk header line.
&& after_next_line.unwrap().starts_with(HUNK_HEADER_PREFIX)
)
)
{
state.start_file();
}
if (next_line.is_some()
&& line.starts_with(OLD_FILE_NAME_HEADER)
&& next_line.unwrap().starts_with(NEW_FILE_NAME_HEADER))
|| (prev_line.is_some()
&& line.starts_with(NEW_FILE_NAME_HEADER)
&& prev_line.unwrap().starts_with(OLD_FILE_NAME_HEADER))
{
if state.current_file.is_some()
&& state.current_file.as_ref().unwrap().old_name.is_none()
&& line.starts_with("--- ")
{
state.current_file.as_mut().map(|file| {
file.old_name = get_src_filename(line, None);
file.language = get_extension(
file.old_name.as_ref().unwrap(),
file.language.as_ref().map(|v| v.as_str()),
);
file
});
continue;
}
if state.current_file.is_some()
&& state.current_file.as_ref().unwrap().new_name.is_none()
&& line.starts_with("+++ ")
{
state.current_file.as_mut().map(|file| {
file.new_name = get_dst_filename(line, None);
file.language = get_extension(
file.new_name.as_ref().unwrap(),
file.language.as_ref().map(|v| v.as_str()),
);
file
});
continue;
}
}
if (state.current_file.is_some() && line.starts_with(HUNK_HEADER_PREFIX))
|| (state
.current_file
.as_ref()
.map(|file| file.is_git_diff && file.old_name.is_some() && file.new_name.is_some())
== Some(true)
&& state.current_block.is_none())
{
state.start_block(line);
continue;
}
if state.current_block.is_some()
&& (line.starts_with("+") || line.starts_with("-") || line.starts_with(" "))
{
state.create_line(line);
continue;
}
let does_not_exist_hunk_header = exist_hunk_header(line, &diff_lines, i);
/*
* Git diffs provide more information regarding files modes, renames, copies,
* commits between changes and similarity indexes
*/
if let Some(captures) = OLD_MODE.captures(line) {
state.current_file.as_mut().map(|file| {
file.old_mode = Some(vec![captures.get(1).unwrap().as_str().to_owned()]);
});
} else if let Some(captures) = NEW_MODE.captures(line) {
state.current_file.as_mut().map(|file| {
file.new_mode = captures.get(1).map(|v| v.as_str().to_owned());
});
} else if let Some(captures) = DELETED_FILE_MODE.captures(line) {
state.current_file.as_mut().map(|file| {
file.deleted_file_mode = captures.get(1).map(|v| v.as_str().to_owned());
file.is_deleted = true;
});
} else if let Some(captures) = NEW_FILE_MODE.captures(line) {
state.current_file.as_mut().map(|file| {
file.new_file_mode = captures.get(1).map(|v| v.as_str().to_owned());
file.is_new = true;
});
} else if let Some(captures) = COPY_FROM.captures(line) {
state.current_file.as_mut().map(|file| {
if does_not_exist_hunk_header {
file.old_name = captures.get(1).map(|v| v.as_str().to_owned());
}
file.is_copy = true;
});
} else if let Some(captures) = COPY_TO.captures(line) {
state.current_file.as_mut().map(|file| {
if does_not_exist_hunk_header {
file.new_name = captures.get(1).map(|v| v.as_str().to_owned());
}
file.is_copy = true;
});
} else if let Some(captures) = RENAME_FROM.captures(line) {
state.current_file.as_mut().map(|file| {
if does_not_exist_hunk_header {
file.old_name = captures.get(1).map(|v| v.as_str().to_owned());
}
file.is_rename = true;
});
} else if let Some(captures) = RENAME_TO.captures(line) {
state.current_file.as_mut().map(|file| {
if does_not_exist_hunk_header {
file.new_name = captures.get(1).map(|v| v.as_str().to_owned());
}
file.is_rename = true;
});
} else if let Some(captures) = BINARY_FILES.captures(line) {
state.current_file.as_mut().map(|file| {
file.is_binary = true;
file.old_name =
get_filename(None, captures.get(1).map(|v| v.as_str()).unwrap(), None);
file.new_name =
get_filename(None, captures.get(2).map(|v| v.as_str()).unwrap(), None);
});
state.start_block("Binary file");
} else if let Some(_captures) = BINARY_DIFF.captures(line) {
state.current_file.as_mut().map(|file| {
file.is_binary = true;
});
state.start_block(line);
} else if let Some(captures) = SIMILARITY_INDEX.captures(line) {
state.current_file.as_mut().map(|file| {
file.unchanged_percentage = captures.get(1).map(|v| v.as_str().parse().unwrap());
});
} else if let Some(captures) = DISSIMILARITY_INDEX.captures(line) {
state.current_file.as_mut().map(|file| {
file.changed_percentage = captures.get(1).map(|v| v.as_str().parse().unwrap());
});
} else if let Some(captures) = INDEX.captures(line) {
state.current_file.as_mut().map(|file| {
file.checksum_before = Some(vec![captures.get(1).unwrap().as_str().to_owned()]);
file.checksum_after = captures.get(2).map(|v| v.as_str().to_owned());
if let Some(mode) = captures.get(3) {
file.mode = Some(mode.as_str().to_owned());
}
});
} else if let Some(captures) = COMBINED_INDEX.captures(line) {
state.current_file.as_mut().map(|file| {
file.checksum_before = Some(vec![
captures.get(1).unwrap().as_str().to_owned(),
captures.get(2).unwrap().as_str().to_owned(),
]);
file.checksum_after = captures.get(3).map(|v| v.as_str().to_owned());
});
} else if let Some(captures) = COMBINED_MODE.captures(line) {
state.current_file.as_mut().map(|file| {
file.old_mode = Some(vec![
captures.get(1).unwrap().as_str().to_owned(),
captures.get(2).unwrap().as_str().to_owned(),
]);
file.new_mode = captures.get(3).map(|v| v.as_str().to_owned());
});
} else if let Some(captures) = COMBINED_NEW_FILE.captures(line) {
state.current_file.as_mut().map(|file| {
file.new_file_mode = captures.get(1).map(|v| v.as_str().to_owned());
file.is_new = true;
});
} else if let Some(captures) = COMBINED_DELETED_FILE.captures(line) {
state.current_file.as_mut().map(|file| {
file.deleted_file_mode = captures.get(1).map(|v| v.as_str().to_owned());
file.is_deleted = true;
});
}
//println!("{}, {}", i, line);
}
state.save_block();
state.save_file();
//println!("{:#?}", &state.files);
state.files
}
struct ParseState {
files: Vec<File>,
current_file: Option<File>,
current_block: Option<Block>,
// TODO: Why is this not used.
//current_line: Option<Line>,
old_line: Option<usize>,
old_line_2: Option<usize>,
new_line: Option<usize>,
possible_old_name: Option<String>,
possible_new_name: Option<String>,
}
impl ParseState {
fn new() -> ParseState {
ParseState {
files: Vec::new(),
current_file: None,
current_block: None,
old_line: None,
old_line_2: None,
new_line: None,
possible_old_name: None,
possible_new_name: None,
}
}
fn start_file(&mut self) {
self.save_block();
self.save_file();
let file = File::new();
self.current_file = Some(file);
}
fn save_file(&mut self) {
if self.current_file.is_some() && {
let file = self.current_file.as_mut().unwrap();
if file.old_name.is_none() {
file.old_name = self.possible_old_name.take();
}
if file.new_name.is_none() {
file.new_name = self.possible_new_name.take();
}
file.new_name.is_some()
} {
self.files.push(self.current_file.take().unwrap());
}
self.possible_old_name = None;
self.possible_new_name = None;
}
fn start_block(&mut self, line: &str) {
self.save_block();
lazy_static! {
static ref RANGE1: Regex =
Regex::new(r#"^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*"#).unwrap();
static ref RANGE2: Regex =
Regex::new(r#"@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*"#)
.unwrap();
}
let captures = RANGE1.captures(line);
match captures {
Some(captures) => {
self.current_file
.as_mut()
.map(|file| file.is_combined = false);
self.old_line = captures.get(1).map(|v| v.as_str().parse().unwrap());
self.new_line = captures.get(2).map(|v| v.as_str().parse().unwrap());
}
_ => {
let captures = RANGE2.captures(line);
match captures {
Some(captures) => {
self.current_file
.as_mut()
.map(|file| file.is_combined = true);
self.old_line = captures.get(1).map(|v| v.as_str().parse().unwrap());
self.old_line_2 = captures.get(2).map(|v| v.as_str().parse().unwrap());
self.new_line = captures.get(3).map(|v| v.as_str().parse().unwrap());
}
_ => {
if line.starts_with(HUNK_HEADER_PREFIX) {
eprintln!("Failed to parse lines, starting in 0!");
}
self.old_line = Some(0);
self.new_line = Some(0);
self.current_file
.as_mut()
.map(|file| file.is_combined = false);
}
}
}
}
let mut block = Block::new();
block.header = Some(line.to_owned());
self.current_block = Some(block);
}
fn save_block(&mut self) {
if let Some(block) = self.current_block.take() {
if let Some(ref mut file) = self.current_file {
file.blocks.push(block);
}
}
}
fn create_line(&mut self, line: &str) {
let mut line = Line::new(line.to_owned());
let add_line_prefixes = self
.current_file
.as_ref()
.map(|v| if !v.is_combined { "+" } else { "++" })
.unwrap();
let delete_line_prefixes = self
.current_file
.as_ref()
.map(|v| if !v.is_combined { "-" } else { "--" })
.unwrap();
if line.content.starts_with(add_line_prefixes) {
self.current_file.as_mut().unwrap().added_lines += 1;
line.line_type = Some(LineType::Inserts);
line.old_number = None;
line.new_number = self.new_line.to_owned();
self.new_line.as_mut().map(|v| *v += 1);
} else if line.content.starts_with(delete_line_prefixes) {
self.current_file.as_mut().unwrap().deleted_lines += 1;
line.line_type = Some(LineType::Deletes);
line.old_number = self.old_line.to_owned();
self.old_line.as_mut().map(|v| *v += 1);
line.new_number = None;
} else {
line.line_type = Some(LineType::Context);
line.old_number = self.old_line.to_owned();
self.old_line.as_mut().map(|v| *v += 1);
line.new_number = self.new_line.to_owned();
self.new_line.as_mut().map(|v| *v += 1);
}
self.current_block.as_mut().unwrap().lines.push(line);
}
}
#[derive(Debug, Serialize)]
pub struct File {
pub old_name: Option<String>,
pub new_name: Option<String>,
pub is_combined: bool,
pub is_git_diff: bool,
pub language: Option<String>,
pub blocks: Vec<Block>,
pub added_lines: usize,
pub deleted_lines: usize,
pub mode: Option<String>,
pub old_mode: Option<Vec<String>>,
pub new_mode: Option<String>,
pub new_file_mode: Option<String>,
pub deleted_file_mode: Option<String>,
pub is_deleted: bool,
pub is_new: bool,
pub is_copy: bool,
pub is_rename: bool,
pub is_binary: bool,
pub unchanged_percentage: Option<usize>,
pub changed_percentage: Option<usize>,
pub checksum_before: Option<Vec<String>>,
pub checksum_after: Option<String>,
}
impl File {
fn new() -> File {
File {
old_name: None,
new_name: None,
is_combined: false,
is_git_diff: false,
language: None,
blocks: Vec::new(),
added_lines: 0,
deleted_lines: 0,
mode: None,
old_mode: None,
new_mode: None,
new_file_mode: None,
deleted_file_mode: None,
is_deleted: false,
is_new: false,
is_copy: false,
is_rename: false,
is_binary: false,
unchanged_percentage: None,
changed_percentage: None,
checksum_before: None,
checksum_after: None,
}
}
}
#[derive(Clone, Debug, Hash, Serialize)]
pub struct Line {
pub content: String,
pub line_type: Option<LineType>,
pub old_number: Option<usize>,
pub new_number: Option<usize>,
}
impl Line {
fn new(line: String) -> Line {
Line {
content: line,
line_type: None,
old_number: None,
new_number: None,
}
}
}
#[derive(Clone, Debug, Hash, PartialEq, Serialize)]
pub enum LineType {
Inserts,
Deletes,
Context,
//Info,
InsertChanges,
DeleteChanges,
}
#[derive(Debug, Serialize)]
pub struct Block {
pub lines: Vec<Line>,
pub header: Option<String>,
}
impl Block {
fn new() -> Block {
Block {
lines: Vec::new(),
header: None,
}
}
}
fn get_extension(filename: &str, language: Option<&str>) -> Option<String> {
let name_split: Vec<String> = filename.split(".").map(|v| v.to_string()).collect();
if name_split.len() > 1 {
return Some(name_split.get(name_split.len() - 1).unwrap().to_owned());
}
language.map(|v| v.to_owned())
}
fn get_src_filename(line: &str, prefix: Option<&str>) -> Option<String> {
get_filename(Some("---"), line, prefix)
}
fn get_dst_filename(line: &str, prefix: Option<&str>) -> Option<String> {
get_filename(Some("\\+\\+\\+"), line, prefix)
}
fn get_filename(
line_prefix: Option<&str>,
line: &str,
extra_prefix: Option<&str>,
) -> Option<String> {
lazy_static! {
static ref PREFIXES: Vec<&'static str> = vec!["a/", "b/", "i/", "w/", "c/", "o/"];
static ref FILENAME_REG: Regex = Regex::new(r#"^"?(.+?)"?$"#).unwrap();
static ref DATE: Regex =
Regex::new(r#"\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$"#).unwrap();
}
//println!("FILENAME: {}", line);
let mut filename = None;
let captures = match line_prefix {
Some(line_prefix) => Regex::new(&format!(r#"^{} "?(.+?)"?$"#, line_prefix))
.unwrap()
.captures(line),
_ => FILENAME_REG.captures(line),
};
if let Some(matches) = captures {
if matches.len() > 0 {
filename = Some(matches.get(1).unwrap().as_str().to_owned());
}
let mut matching_prefixes = PREFIXES
.iter()
.filter(|p| filename.as_ref().unwrap().contains(*p))
.map(|v| v.to_string())
.collect::<Vec<String>>();
if let Some(extra_prefix) = extra_prefix {
if filename.as_ref().unwrap().contains(extra_prefix) {
matching_prefixes.push(extra_prefix.to_owned());
}
}
if let Some(prefix) = matching_prefixes.get(0) {
filename
.as_mut()
.map(|filename| *filename = filename[prefix.len()..].to_string());
}
filename
.as_mut()
.map(|filename| *filename = DATE.replace(filename, "").to_string());
}
//println!("filename out: {:?}", &filename);
filename
}
fn exist_hunk_header(line: &str, lines: &Vec<&str>, index: usize) -> bool {
let mut idx = index;
while idx < lines.len() - 3 {
if line.starts_with("diff") {
return false;
}
if lines.get(idx).unwrap().starts_with(OLD_FILE_NAME_HEADER)
&& lines
.get(idx + 1)
.unwrap()
.starts_with(NEW_FILE_NAME_HEADER)
&& lines.get(idx + 2).unwrap().starts_with(HUNK_HEADER_PREFIX)
{
return true;
}
idx += 1;
}
false
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.