#![allow(
non_snake_case,
non_camel_case_types,
non_upper_case_globals,
dead_code
)]
#![allow(clippy::all)]
pub const WSLC_E_BASE: u32 = 1536;
pub const WSLC_SESSION_OPTIONS_SIZE: u32 = 72;
pub const WSLC_SESSION_OPTIONS_ALIGNMENT: u32 = 8;
pub const WSLC_CONTAINER_OPTIONS_SIZE: u32 = 104;
pub const WSLC_CONTAINER_OPTIONS_ALIGNMENT: u32 = 8;
pub const WSLC_CONTAINER_PROCESS_OPTIONS_SIZE: u32 = 72;
pub const WSLC_CONTAINER_PROCESS_OPTIONS_ALIGNMENT: u32 = 8;
pub const WSLC_CONTAINER_ID_BUFFER_SIZE: u32 = 65;
pub const WSLC_IMAGE_NAME_LENGTH: u32 = 256;
pub type wchar_t = ::std::os::raw::c_ushort;
pub type USHORT = ::std::os::raw::c_ushort;
pub type BOOL = ::std::os::raw::c_int;
pub type BYTE = ::std::os::raw::c_uchar;
pub type INT32 = ::std::os::raw::c_int;
pub type PINT32 = *mut ::std::os::raw::c_int;
pub type PVOID = *mut ::std::os::raw::c_void;
pub type CHAR = ::std::os::raw::c_char;
pub type WCHAR = wchar_t;
pub type PWSTR = *mut WCHAR;
pub type PCWSTR = *const WCHAR;
pub type PSTR = *mut CHAR;
pub type PCSTR = *const CHAR;
pub type HANDLE = *mut ::std::os::raw::c_void;
pub type HRESULT = ::std::os::raw::c_long;
pub type ADDRESS_FAMILY = USHORT;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sockaddr_storage {
pub ss_family: ADDRESS_FAMILY,
pub __ss_pad1: [CHAR; 6usize],
pub __ss_align: ::std::os::raw::c_longlong,
pub __ss_pad2: [CHAR; 112usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of sockaddr_storage"][::std::mem::size_of::<sockaddr_storage>() - 128usize];
["Alignment of sockaddr_storage"][::std::mem::align_of::<sockaddr_storage>() - 8usize];
["Offset of field: sockaddr_storage::ss_family"]
[::std::mem::offset_of!(sockaddr_storage, ss_family) - 0usize];
["Offset of field: sockaddr_storage::__ss_pad1"]
[::std::mem::offset_of!(sockaddr_storage, __ss_pad1) - 2usize];
["Offset of field: sockaddr_storage::__ss_align"]
[::std::mem::offset_of!(sockaddr_storage, __ss_align) - 8usize];
["Offset of field: sockaddr_storage::__ss_pad2"]
[::std::mem::offset_of!(sockaddr_storage, __ss_pad2) - 16usize];
};
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct WslcSessionSettings {
pub _opaque: [BYTE; 72usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcSessionSettings"][::std::mem::size_of::<WslcSessionSettings>() - 72usize];
["Alignment of WslcSessionSettings"][::std::mem::align_of::<WslcSessionSettings>() - 8usize];
["Offset of field: WslcSessionSettings::_opaque"]
[::std::mem::offset_of!(WslcSessionSettings, _opaque) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcSession__ {
pub unused: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcSession__"][::std::mem::size_of::<WslcSession__>() - 4usize];
["Alignment of WslcSession__"][::std::mem::align_of::<WslcSession__>() - 4usize];
["Offset of field: WslcSession__::unused"]
[::std::mem::offset_of!(WslcSession__, unused) - 0usize];
};
pub type WslcSession = *mut WslcSession__;
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct WslcContainerSettings {
pub _opaque: [BYTE; 104usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcContainerSettings"][::std::mem::size_of::<WslcContainerSettings>() - 104usize];
["Alignment of WslcContainerSettings"]
[::std::mem::align_of::<WslcContainerSettings>() - 8usize];
["Offset of field: WslcContainerSettings::_opaque"]
[::std::mem::offset_of!(WslcContainerSettings, _opaque) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcContainer__ {
pub unused: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcContainer__"][::std::mem::size_of::<WslcContainer__>() - 4usize];
["Alignment of WslcContainer__"][::std::mem::align_of::<WslcContainer__>() - 4usize];
["Offset of field: WslcContainer__::unused"]
[::std::mem::offset_of!(WslcContainer__, unused) - 0usize];
};
pub type WslcContainer = *mut WslcContainer__;
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct WslcProcessSettings {
pub _opaque: [BYTE; 72usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcProcessSettings"][::std::mem::size_of::<WslcProcessSettings>() - 72usize];
["Alignment of WslcProcessSettings"][::std::mem::align_of::<WslcProcessSettings>() - 8usize];
["Offset of field: WslcProcessSettings::_opaque"]
[::std::mem::offset_of!(WslcProcessSettings, _opaque) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcProcess__ {
pub unused: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcProcess__"][::std::mem::size_of::<WslcProcess__>() - 4usize];
["Alignment of WslcProcess__"][::std::mem::align_of::<WslcProcess__>() - 4usize];
["Offset of field: WslcProcess__::unused"]
[::std::mem::offset_of!(WslcProcess__, unused) - 0usize];
};
pub type WslcProcess = *mut WslcProcess__;
impl WslcContainerNetworkingMode {
pub const WSLC_CONTAINER_NETWORKING_MODE_NONE: WslcContainerNetworkingMode =
WslcContainerNetworkingMode(0);
pub const WSLC_CONTAINER_NETWORKING_MODE_BRIDGED: WslcContainerNetworkingMode =
WslcContainerNetworkingMode(1);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcContainerNetworkingMode(pub ::std::os::raw::c_int);
impl WslcVhdType {
pub const WSLC_VHD_TYPE_DYNAMIC: WslcVhdType = WslcVhdType(0);
pub const WSLC_VHD_TYPE_FIXED: WslcVhdType = WslcVhdType(1);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcVhdType(pub ::std::os::raw::c_int);
impl WslcVhdRequirementsFlags {
pub const WSLC_VHD_REQ_FLAG_NONE: WslcVhdRequirementsFlags = WslcVhdRequirementsFlags(0);
pub const WSLC_VHD_REQ_FLAG_OWNER: WslcVhdRequirementsFlags = WslcVhdRequirementsFlags(1);
}
impl ::std::ops::BitOr<WslcVhdRequirementsFlags> for WslcVhdRequirementsFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcVhdRequirementsFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcVhdRequirementsFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcVhdRequirementsFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcVhdRequirementsFlags> for WslcVhdRequirementsFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcVhdRequirementsFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcVhdRequirementsFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcVhdRequirementsFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcVhdRequirementsFlags(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcVhdRequirements {
pub name: PCSTR,
pub sizeBytes: u64,
pub type_: WslcVhdType,
pub flags: WslcVhdRequirementsFlags,
pub uid: u32,
pub gid: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcVhdRequirements"][::std::mem::size_of::<WslcVhdRequirements>() - 32usize];
["Alignment of WslcVhdRequirements"][::std::mem::align_of::<WslcVhdRequirements>() - 8usize];
["Offset of field: WslcVhdRequirements::name"]
[::std::mem::offset_of!(WslcVhdRequirements, name) - 0usize];
["Offset of field: WslcVhdRequirements::sizeBytes"]
[::std::mem::offset_of!(WslcVhdRequirements, sizeBytes) - 8usize];
["Offset of field: WslcVhdRequirements::type_"]
[::std::mem::offset_of!(WslcVhdRequirements, type_) - 16usize];
["Offset of field: WslcVhdRequirements::flags"]
[::std::mem::offset_of!(WslcVhdRequirements, flags) - 20usize];
["Offset of field: WslcVhdRequirements::uid"]
[::std::mem::offset_of!(WslcVhdRequirements, uid) - 24usize];
["Offset of field: WslcVhdRequirements::gid"]
[::std::mem::offset_of!(WslcVhdRequirements, gid) - 28usize];
};
impl WslcSessionFeatureFlags {
pub const WSLC_SESSION_FEATURE_FLAG_NONE: WslcSessionFeatureFlags = WslcSessionFeatureFlags(0);
pub const WSLC_SESSION_FEATURE_FLAG_ENABLE_GPU: WslcSessionFeatureFlags =
WslcSessionFeatureFlags(4);
}
impl ::std::ops::BitOr<WslcSessionFeatureFlags> for WslcSessionFeatureFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcSessionFeatureFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcSessionFeatureFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcSessionFeatureFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcSessionFeatureFlags> for WslcSessionFeatureFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcSessionFeatureFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcSessionFeatureFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcSessionFeatureFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcSessionFeatureFlags(pub ::std::os::raw::c_int);
impl WslcSessionTerminationReason {
pub const WSLC_SESSION_TERMINATION_REASON_UNKNOWN: WslcSessionTerminationReason =
WslcSessionTerminationReason(0);
pub const WSLC_SESSION_TERMINATION_REASON_SHUTDOWN: WslcSessionTerminationReason =
WslcSessionTerminationReason(1);
pub const WSLC_SESSION_TERMINATION_REASON_CRASHED: WslcSessionTerminationReason =
WslcSessionTerminationReason(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcSessionTerminationReason(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcSessionCrashDumpInfo {
pub dumpPath: PCWSTR,
pub processName: PCSTR,
pub pid: u32,
pub signal: u32,
pub timestamp: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcSessionCrashDumpInfo"]
[::std::mem::size_of::<WslcSessionCrashDumpInfo>() - 32usize];
["Alignment of WslcSessionCrashDumpInfo"]
[::std::mem::align_of::<WslcSessionCrashDumpInfo>() - 8usize];
["Offset of field: WslcSessionCrashDumpInfo::dumpPath"]
[::std::mem::offset_of!(WslcSessionCrashDumpInfo, dumpPath) - 0usize];
["Offset of field: WslcSessionCrashDumpInfo::processName"]
[::std::mem::offset_of!(WslcSessionCrashDumpInfo, processName) - 8usize];
["Offset of field: WslcSessionCrashDumpInfo::pid"]
[::std::mem::offset_of!(WslcSessionCrashDumpInfo, pid) - 16usize];
["Offset of field: WslcSessionCrashDumpInfo::signal"]
[::std::mem::offset_of!(WslcSessionCrashDumpInfo, signal) - 20usize];
["Offset of field: WslcSessionCrashDumpInfo::timestamp"]
[::std::mem::offset_of!(WslcSessionCrashDumpInfo, timestamp) - 24usize];
};
pub type WslcSessionCrashDumpCallback = ::std::option::Option<
unsafe extern "C" fn(info: *const WslcSessionCrashDumpInfo, context: PVOID),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcCrashDumpSubscription__ {
pub unused: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcCrashDumpSubscription__"]
[::std::mem::size_of::<WslcCrashDumpSubscription__>() - 4usize];
["Alignment of WslcCrashDumpSubscription__"]
[::std::mem::align_of::<WslcCrashDumpSubscription__>() - 4usize];
["Offset of field: WslcCrashDumpSubscription__::unused"]
[::std::mem::offset_of!(WslcCrashDumpSubscription__, unused) - 0usize];
};
pub type WslcCrashDumpSubscription = *mut WslcCrashDumpSubscription__;
impl WslcPortProtocol {
pub const WSLC_PORT_PROTOCOL_TCP: WslcPortProtocol = WslcPortProtocol(0);
pub const WSLC_PORT_PROTOCOL_UDP: WslcPortProtocol = WslcPortProtocol(1);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcPortProtocol(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcContainerPortMapping {
pub windowsPort: u16,
pub containerPort: u16,
pub protocol: WslcPortProtocol,
pub windowsAddress: *mut sockaddr_storage,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcContainerPortMapping"]
[::std::mem::size_of::<WslcContainerPortMapping>() - 16usize];
["Alignment of WslcContainerPortMapping"]
[::std::mem::align_of::<WslcContainerPortMapping>() - 8usize];
["Offset of field: WslcContainerPortMapping::windowsPort"]
[::std::mem::offset_of!(WslcContainerPortMapping, windowsPort) - 0usize];
["Offset of field: WslcContainerPortMapping::containerPort"]
[::std::mem::offset_of!(WslcContainerPortMapping, containerPort) - 2usize];
["Offset of field: WslcContainerPortMapping::protocol"]
[::std::mem::offset_of!(WslcContainerPortMapping, protocol) - 4usize];
["Offset of field: WslcContainerPortMapping::windowsAddress"]
[::std::mem::offset_of!(WslcContainerPortMapping, windowsAddress) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcContainerVolume {
pub windowsPath: PCWSTR,
pub containerPath: PCSTR,
pub readOnly: BOOL,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcContainerVolume"][::std::mem::size_of::<WslcContainerVolume>() - 24usize];
["Alignment of WslcContainerVolume"][::std::mem::align_of::<WslcContainerVolume>() - 8usize];
["Offset of field: WslcContainerVolume::windowsPath"]
[::std::mem::offset_of!(WslcContainerVolume, windowsPath) - 0usize];
["Offset of field: WslcContainerVolume::containerPath"]
[::std::mem::offset_of!(WslcContainerVolume, containerPath) - 8usize];
["Offset of field: WslcContainerVolume::readOnly"]
[::std::mem::offset_of!(WslcContainerVolume, readOnly) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcContainerNamedVolume {
pub name: PCSTR,
pub containerPath: PCSTR,
pub readOnly: BOOL,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcContainerNamedVolume"]
[::std::mem::size_of::<WslcContainerNamedVolume>() - 24usize];
["Alignment of WslcContainerNamedVolume"]
[::std::mem::align_of::<WslcContainerNamedVolume>() - 8usize];
["Offset of field: WslcContainerNamedVolume::name"]
[::std::mem::offset_of!(WslcContainerNamedVolume, name) - 0usize];
["Offset of field: WslcContainerNamedVolume::containerPath"]
[::std::mem::offset_of!(WslcContainerNamedVolume, containerPath) - 8usize];
["Offset of field: WslcContainerNamedVolume::readOnly"]
[::std::mem::offset_of!(WslcContainerNamedVolume, readOnly) - 16usize];
};
impl WslcContainerFlags {
pub const WSLC_CONTAINER_FLAG_NONE: WslcContainerFlags = WslcContainerFlags(0);
pub const WSLC_CONTAINER_FLAG_AUTO_REMOVE: WslcContainerFlags = WslcContainerFlags(1);
pub const WSLC_CONTAINER_FLAG_ENABLE_GPU: WslcContainerFlags = WslcContainerFlags(2);
pub const WSLC_CONTAINER_FLAG_PRIVILEGED: WslcContainerFlags = WslcContainerFlags(4);
}
impl ::std::ops::BitOr<WslcContainerFlags> for WslcContainerFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcContainerFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcContainerFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcContainerFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcContainerFlags> for WslcContainerFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcContainerFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcContainerFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcContainerFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcContainerFlags(pub ::std::os::raw::c_int);
impl WslcContainerStartFlags {
pub const WSLC_CONTAINER_START_FLAG_NONE: WslcContainerStartFlags = WslcContainerStartFlags(0);
pub const WSLC_CONTAINER_START_FLAG_ATTACH: WslcContainerStartFlags =
WslcContainerStartFlags(1);
}
impl ::std::ops::BitOr<WslcContainerStartFlags> for WslcContainerStartFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcContainerStartFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcContainerStartFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcContainerStartFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcContainerStartFlags> for WslcContainerStartFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcContainerStartFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcContainerStartFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcContainerStartFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcContainerStartFlags(pub ::std::os::raw::c_int);
impl WslcContainerState {
pub const WSLC_CONTAINER_STATE_INVALID: WslcContainerState = WslcContainerState(0);
pub const WSLC_CONTAINER_STATE_CREATED: WslcContainerState = WslcContainerState(1);
pub const WSLC_CONTAINER_STATE_RUNNING: WslcContainerState = WslcContainerState(2);
pub const WSLC_CONTAINER_STATE_EXITED: WslcContainerState = WslcContainerState(3);
pub const WSLC_CONTAINER_STATE_DELETED: WslcContainerState = WslcContainerState(4);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcContainerState(pub ::std::os::raw::c_int);
impl WslcSignal {
pub const WSLC_SIGNAL_NONE: WslcSignal = WslcSignal(0);
pub const WSLC_SIGNAL_SIGHUP: WslcSignal = WslcSignal(1);
pub const WSLC_SIGNAL_SIGINT: WslcSignal = WslcSignal(2);
pub const WSLC_SIGNAL_SIGQUIT: WslcSignal = WslcSignal(3);
pub const WSLC_SIGNAL_SIGKILL: WslcSignal = WslcSignal(9);
pub const WSLC_SIGNAL_SIGTERM: WslcSignal = WslcSignal(15);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcSignal(pub ::std::os::raw::c_int);
impl WslcDeleteContainerFlags {
pub const WSLC_DELETE_CONTAINER_FLAG_NONE: WslcDeleteContainerFlags =
WslcDeleteContainerFlags(0);
pub const WSLC_DELETE_CONTAINER_FLAG_FORCE: WslcDeleteContainerFlags =
WslcDeleteContainerFlags(1);
}
impl ::std::ops::BitOr<WslcDeleteContainerFlags> for WslcDeleteContainerFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcDeleteContainerFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcDeleteContainerFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcDeleteContainerFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcDeleteContainerFlags> for WslcDeleteContainerFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcDeleteContainerFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcDeleteContainerFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcDeleteContainerFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcDeleteContainerFlags(pub ::std::os::raw::c_int);
impl WslcProcessIOHandle {
pub const WSLC_PROCESS_IO_HANDLE_STDIN: WslcProcessIOHandle = WslcProcessIOHandle(0);
pub const WSLC_PROCESS_IO_HANDLE_STDOUT: WslcProcessIOHandle = WslcProcessIOHandle(1);
pub const WSLC_PROCESS_IO_HANDLE_STDERR: WslcProcessIOHandle = WslcProcessIOHandle(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcProcessIOHandle(pub ::std::os::raw::c_int);
pub type WslcStdIOCallback = ::std::option::Option<
unsafe extern "C" fn(
ioHandle: WslcProcessIOHandle,
data: *const BYTE,
dataBytes: u32,
context: PVOID,
),
>;
pub type WslcProcessExitCallback =
::std::option::Option<unsafe extern "C" fn(exitCode: INT32, context: PVOID)>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcProcessCallbacks {
pub onStdOut: WslcStdIOCallback,
pub onStdErr: WslcStdIOCallback,
pub onExit: WslcProcessExitCallback,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcProcessCallbacks"][::std::mem::size_of::<WslcProcessCallbacks>() - 24usize];
["Alignment of WslcProcessCallbacks"][::std::mem::align_of::<WslcProcessCallbacks>() - 8usize];
["Offset of field: WslcProcessCallbacks::onStdOut"]
[::std::mem::offset_of!(WslcProcessCallbacks, onStdOut) - 0usize];
["Offset of field: WslcProcessCallbacks::onStdErr"]
[::std::mem::offset_of!(WslcProcessCallbacks, onStdErr) - 8usize];
["Offset of field: WslcProcessCallbacks::onExit"]
[::std::mem::offset_of!(WslcProcessCallbacks, onExit) - 16usize];
};
impl WslcProcessState {
pub const WSLC_PROCESS_STATE_UNKNOWN: WslcProcessState = WslcProcessState(0);
pub const WSLC_PROCESS_STATE_RUNNING: WslcProcessState = WslcProcessState(1);
pub const WSLC_PROCESS_STATE_EXITED: WslcProcessState = WslcProcessState(2);
pub const WSLC_PROCESS_STATE_SIGNALLED: WslcProcessState = WslcProcessState(3);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcProcessState(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcImageProgressDetail {
pub currentBytes: u64,
pub totalBytes: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcImageProgressDetail"][::std::mem::size_of::<WslcImageProgressDetail>() - 16usize];
["Alignment of WslcImageProgressDetail"]
[::std::mem::align_of::<WslcImageProgressDetail>() - 8usize];
["Offset of field: WslcImageProgressDetail::currentBytes"]
[::std::mem::offset_of!(WslcImageProgressDetail, currentBytes) - 0usize];
["Offset of field: WslcImageProgressDetail::totalBytes"]
[::std::mem::offset_of!(WslcImageProgressDetail, totalBytes) - 8usize];
};
impl WslcImageProgressStatus {
pub const WSLC_IMAGE_PROGRESS_STATUS_UNKNOWN: WslcImageProgressStatus =
WslcImageProgressStatus(0);
pub const WSLC_IMAGE_PROGRESS_STATUS_PULLING: WslcImageProgressStatus =
WslcImageProgressStatus(1);
pub const WSLC_IMAGE_PROGRESS_STATUS_WAITING: WslcImageProgressStatus =
WslcImageProgressStatus(2);
pub const WSLC_IMAGE_PROGRESS_STATUS_DOWNLOADING: WslcImageProgressStatus =
WslcImageProgressStatus(3);
pub const WSLC_IMAGE_PROGRESS_STATUS_VERIFYING: WslcImageProgressStatus =
WslcImageProgressStatus(4);
pub const WSLC_IMAGE_PROGRESS_STATUS_EXTRACTING: WslcImageProgressStatus =
WslcImageProgressStatus(5);
pub const WSLC_IMAGE_PROGRESS_STATUS_COMPLETE: WslcImageProgressStatus =
WslcImageProgressStatus(6);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcImageProgressStatus(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcImageProgressMessage {
pub id: PCSTR,
pub status: WslcImageProgressStatus,
pub detail: WslcImageProgressDetail,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcImageProgressMessage"]
[::std::mem::size_of::<WslcImageProgressMessage>() - 32usize];
["Alignment of WslcImageProgressMessage"]
[::std::mem::align_of::<WslcImageProgressMessage>() - 8usize];
["Offset of field: WslcImageProgressMessage::id"]
[::std::mem::offset_of!(WslcImageProgressMessage, id) - 0usize];
["Offset of field: WslcImageProgressMessage::status"]
[::std::mem::offset_of!(WslcImageProgressMessage, status) - 8usize];
["Offset of field: WslcImageProgressMessage::detail"]
[::std::mem::offset_of!(WslcImageProgressMessage, detail) - 16usize];
};
pub type WslcContainerImageProgressCallback = ::std::option::Option<
unsafe extern "C" fn(progress: *const WslcImageProgressMessage, context: PVOID) -> HRESULT,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcPullImageOptions {
pub uri: PCSTR,
pub progressCallback: WslcContainerImageProgressCallback,
pub progressCallbackContext: PVOID,
pub registryAuth: PCSTR,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcPullImageOptions"][::std::mem::size_of::<WslcPullImageOptions>() - 32usize];
["Alignment of WslcPullImageOptions"][::std::mem::align_of::<WslcPullImageOptions>() - 8usize];
["Offset of field: WslcPullImageOptions::uri"]
[::std::mem::offset_of!(WslcPullImageOptions, uri) - 0usize];
["Offset of field: WslcPullImageOptions::progressCallback"]
[::std::mem::offset_of!(WslcPullImageOptions, progressCallback) - 8usize];
["Offset of field: WslcPullImageOptions::progressCallbackContext"]
[::std::mem::offset_of!(WslcPullImageOptions, progressCallbackContext) - 16usize];
["Offset of field: WslcPullImageOptions::registryAuth"]
[::std::mem::offset_of!(WslcPullImageOptions, registryAuth) - 24usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcImportImageOptions {
pub progressCallback: WslcContainerImageProgressCallback,
pub progressCallbackContext: PVOID,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcImportImageOptions"][::std::mem::size_of::<WslcImportImageOptions>() - 16usize];
["Alignment of WslcImportImageOptions"]
[::std::mem::align_of::<WslcImportImageOptions>() - 8usize];
["Offset of field: WslcImportImageOptions::progressCallback"]
[::std::mem::offset_of!(WslcImportImageOptions, progressCallback) - 0usize];
["Offset of field: WslcImportImageOptions::progressCallbackContext"]
[::std::mem::offset_of!(WslcImportImageOptions, progressCallbackContext) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcLoadImageOptions {
pub progressCallback: WslcContainerImageProgressCallback,
pub progressCallbackContext: PVOID,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcLoadImageOptions"][::std::mem::size_of::<WslcLoadImageOptions>() - 16usize];
["Alignment of WslcLoadImageOptions"][::std::mem::align_of::<WslcLoadImageOptions>() - 8usize];
["Offset of field: WslcLoadImageOptions::progressCallback"]
[::std::mem::offset_of!(WslcLoadImageOptions, progressCallback) - 0usize];
["Offset of field: WslcLoadImageOptions::progressCallbackContext"]
[::std::mem::offset_of!(WslcLoadImageOptions, progressCallbackContext) - 8usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcImageInfo {
pub name: [CHAR; 256usize],
pub sha256: [u8; 32usize],
pub sizeBytes: i64,
pub createdUnixTime: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcImageInfo"][::std::mem::size_of::<WslcImageInfo>() - 304usize];
["Alignment of WslcImageInfo"][::std::mem::align_of::<WslcImageInfo>() - 8usize];
["Offset of field: WslcImageInfo::name"][::std::mem::offset_of!(WslcImageInfo, name) - 0usize];
["Offset of field: WslcImageInfo::sha256"]
[::std::mem::offset_of!(WslcImageInfo, sha256) - 256usize];
["Offset of field: WslcImageInfo::sizeBytes"]
[::std::mem::offset_of!(WslcImageInfo, sizeBytes) - 288usize];
["Offset of field: WslcImageInfo::createdUnixTime"]
[::std::mem::offset_of!(WslcImageInfo, createdUnixTime) - 296usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcTagImageOptions {
pub image: PCSTR,
pub repo: PCSTR,
pub tag: PCSTR,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcTagImageOptions"][::std::mem::size_of::<WslcTagImageOptions>() - 24usize];
["Alignment of WslcTagImageOptions"][::std::mem::align_of::<WslcTagImageOptions>() - 8usize];
["Offset of field: WslcTagImageOptions::image"]
[::std::mem::offset_of!(WslcTagImageOptions, image) - 0usize];
["Offset of field: WslcTagImageOptions::repo"]
[::std::mem::offset_of!(WslcTagImageOptions, repo) - 8usize];
["Offset of field: WslcTagImageOptions::tag"]
[::std::mem::offset_of!(WslcTagImageOptions, tag) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcPushImageOptions {
pub image: PCSTR,
pub registryAuth: PCSTR,
pub progressCallback: WslcContainerImageProgressCallback,
pub progressCallbackContext: PVOID,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcPushImageOptions"][::std::mem::size_of::<WslcPushImageOptions>() - 32usize];
["Alignment of WslcPushImageOptions"][::std::mem::align_of::<WslcPushImageOptions>() - 8usize];
["Offset of field: WslcPushImageOptions::image"]
[::std::mem::offset_of!(WslcPushImageOptions, image) - 0usize];
["Offset of field: WslcPushImageOptions::registryAuth"]
[::std::mem::offset_of!(WslcPushImageOptions, registryAuth) - 8usize];
["Offset of field: WslcPushImageOptions::progressCallback"]
[::std::mem::offset_of!(WslcPushImageOptions, progressCallback) - 16usize];
["Offset of field: WslcPushImageOptions::progressCallbackContext"]
[::std::mem::offset_of!(WslcPushImageOptions, progressCallbackContext) - 24usize];
};
pub const WslcIdentityTokenType_WSLC_IDENTITY_TOKEN_TYPE_UNKNOWN: WslcIdentityTokenType = 0;
pub const WslcIdentityTokenType_WSLC_IDENTITY_TOKEN_TYPE_TOKEN: WslcIdentityTokenType = 1;
pub const WslcIdentityTokenType_WSLC_IDENTITY_TOKEN_TYPE_CREDENTIALS: WslcIdentityTokenType = 2;
pub type WslcIdentityTokenType = ::std::os::raw::c_int;
impl WslcComponentFlags {
pub const WSLC_COMPONENT_FLAG_NONE: WslcComponentFlags = WslcComponentFlags(0);
pub const WSLC_COMPONENT_FLAG_VIRTUAL_MACHINE_PLATFORM: WslcComponentFlags =
WslcComponentFlags(1);
pub const WSLC_COMPONENT_FLAG_WSL_PACKAGE: WslcComponentFlags = WslcComponentFlags(2);
pub const WSLC_COMPONENT_FLAG_SDK_NEEDS_UPDATE: WslcComponentFlags = WslcComponentFlags(4);
}
impl ::std::ops::BitOr<WslcComponentFlags> for WslcComponentFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
WslcComponentFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for WslcComponentFlags {
#[inline]
fn bitor_assign(&mut self, rhs: WslcComponentFlags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<WslcComponentFlags> for WslcComponentFlags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
WslcComponentFlags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for WslcComponentFlags {
#[inline]
fn bitand_assign(&mut self, rhs: WslcComponentFlags) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WslcComponentFlags(pub ::std::os::raw::c_int);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WslcVersion {
pub major: u32,
pub minor: u32,
pub revision: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of WslcVersion"][::std::mem::size_of::<WslcVersion>() - 12usize];
["Alignment of WslcVersion"][::std::mem::align_of::<WslcVersion>() - 4usize];
["Offset of field: WslcVersion::major"][::std::mem::offset_of!(WslcVersion, major) - 0usize];
["Offset of field: WslcVersion::minor"][::std::mem::offset_of!(WslcVersion, minor) - 4usize];
["Offset of field: WslcVersion::revision"]
[::std::mem::offset_of!(WslcVersion, revision) - 8usize];
};
pub type WslcInstallCallback = ::std::option::Option<
unsafe extern "C" fn(
component: WslcComponentFlags,
progressSteps: u32,
totalSteps: u32,
context: PVOID,
),
>;
pub const WslcInstallOptions_WSLC_INSTALL_OPTION_NONE: WslcInstallOptions = 0;
pub const WslcInstallOptions_WSLC_INSTALL_OPTION_REPAIR: WslcInstallOptions = 1;
pub type WslcInstallOptions = ::std::os::raw::c_int;
pub struct WslcSdk {
__library: ::libloading::Library,
pub WslcInitSessionSettings: Result<
unsafe extern "C" fn(
name: PCWSTR,
storagePath: PCWSTR,
sessionSettings: *mut WslcSessionSettings,
) -> HRESULT,
::libloading::Error,
>,
pub WslcCreateSession: Result<
unsafe extern "C" fn(
sessionSettings: *mut WslcSessionSettings,
session: *mut WslcSession,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetSessionSettingsCpuCount: Result<
unsafe extern "C" fn(sessionSettings: *mut WslcSessionSettings, cpuCount: u32) -> HRESULT,
::libloading::Error,
>,
pub WslcSetSessionSettingsMemory: Result<
unsafe extern "C" fn(sessionSettings: *mut WslcSessionSettings, memoryMB: u32) -> HRESULT,
::libloading::Error,
>,
pub WslcSetSessionSettingsTimeout: Result<
unsafe extern "C" fn(sessionSettings: *mut WslcSessionSettings, timeoutMS: u32) -> HRESULT,
::libloading::Error,
>,
pub WslcSetSessionSettingsVhd: Result<
unsafe extern "C" fn(
sessionSettings: *mut WslcSessionSettings,
vhdRequirements: *const WslcVhdRequirements,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetSessionSettingsFeatureFlags: Result<
unsafe extern "C" fn(
sessionSettings: *mut WslcSessionSettings,
flags: WslcSessionFeatureFlags,
) -> HRESULT,
::libloading::Error,
>,
pub WslcGetSessionTerminationEvent: Result<
unsafe extern "C" fn(session: WslcSession, terminationEvent: *mut HANDLE) -> HRESULT,
::libloading::Error,
>,
pub WslcGetSessionTerminationReason: Result<
unsafe extern "C" fn(
session: WslcSession,
reason: *mut WslcSessionTerminationReason,
) -> HRESULT,
::libloading::Error,
>,
pub WslcTerminateSession:
Result<unsafe extern "C" fn(session: WslcSession) -> HRESULT, ::libloading::Error>,
pub WslcReleaseSession:
Result<unsafe extern "C" fn(session: WslcSession) -> HRESULT, ::libloading::Error>,
pub WslcRegisterSessionCrashDumpCallback: Result<
unsafe extern "C" fn(
session: WslcSession,
crashDumpCallback: WslcSessionCrashDumpCallback,
crashDumpContext: PVOID,
subscription: *mut WslcCrashDumpSubscription,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcReleaseCrashDumpSubscription: Result<
unsafe extern "C" fn(subscription: WslcCrashDumpSubscription) -> HRESULT,
::libloading::Error,
>,
pub WslcInitContainerSettings: Result<
unsafe extern "C" fn(
imageName: PCSTR,
containerSettings: *mut WslcContainerSettings,
) -> HRESULT,
::libloading::Error,
>,
pub WslcCreateContainer: Result<
unsafe extern "C" fn(
session: WslcSession,
containerSettings: *const WslcContainerSettings,
container: *mut WslcContainer,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcOpenContainer: Result<
unsafe extern "C" fn(
session: WslcSession,
nameOrId: PCSTR,
container: *mut WslcContainer,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcStartContainer: Result<
unsafe extern "C" fn(
container: WslcContainer,
flags: WslcContainerStartFlags,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsName: Result<
unsafe extern "C" fn(containerSettings: *mut WslcContainerSettings, name: PCSTR) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsInitProcess: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
initProcess: *mut WslcProcessSettings,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsNetworkingMode: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
networkingMode: WslcContainerNetworkingMode,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsHostName: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
hostName: PCSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsDomainName: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
domainName: PCSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsFlags: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
flags: WslcContainerFlags,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsPortMappings: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
portMappings: *const WslcContainerPortMapping,
portMappingCount: u32,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsVolumes: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
volumes: *const WslcContainerVolume,
volumeCount: u32,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerSettingsNamedVolumes: Result<
unsafe extern "C" fn(
containerSettings: *mut WslcContainerSettings,
namedVolumes: *const WslcContainerNamedVolume,
namedVolumeCount: u32,
) -> HRESULT,
::libloading::Error,
>,
pub WslcCreateContainerProcess: Result<
unsafe extern "C" fn(
container: WslcContainer,
newProcessSettings: *mut WslcProcessSettings,
newProcess: *mut WslcProcess,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcReleaseContainer:
Result<unsafe extern "C" fn(container: WslcContainer) -> HRESULT, ::libloading::Error>,
pub WslcGetContainerID: Result<
unsafe extern "C" fn(container: WslcContainer, containerID: *mut CHAR) -> HRESULT,
::libloading::Error,
>,
pub WslcGetContainerInitProcess: Result<
unsafe extern "C" fn(container: WslcContainer, initProcess: *mut WslcProcess) -> HRESULT,
::libloading::Error,
>,
pub WslcInspectContainer: Result<
unsafe extern "C" fn(container: WslcContainer, inspectData: *mut PSTR) -> HRESULT,
::libloading::Error,
>,
pub WslcGetContainerState: Result<
unsafe extern "C" fn(container: WslcContainer, state: *mut WslcContainerState) -> HRESULT,
::libloading::Error,
>,
pub WslcStopContainer: Result<
unsafe extern "C" fn(
container: WslcContainer,
signal: WslcSignal,
timeoutSeconds: u32,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcDeleteContainer: Result<
unsafe extern "C" fn(
container: WslcContainer,
flags: WslcDeleteContainerFlags,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcInitProcessSettings: Result<
unsafe extern "C" fn(processSettings: *mut WslcProcessSettings) -> HRESULT,
::libloading::Error,
>,
pub WslcSetProcessSettingsWorkingDirectory: Result<
unsafe extern "C" fn(
processSettings: *mut WslcProcessSettings,
workingDirectory: PCSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetProcessSettingsCmdLine: Result<
unsafe extern "C" fn(
processSettings: *mut WslcProcessSettings,
argv: *const PCSTR,
argc: usize,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetProcessSettingsEnvVariables: Result<
unsafe extern "C" fn(
processSettings: *mut WslcProcessSettings,
key_value: *const PCSTR,
argc: usize,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetProcessSettingsCallbacks: Result<
unsafe extern "C" fn(
processSettings: *mut WslcProcessSettings,
callbacks: *const WslcProcessCallbacks,
context: PVOID,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSetContainerInitProcessIOCallbacks: Result<
unsafe extern "C" fn(
container: WslcContainer,
callbacks: *const WslcProcessCallbacks,
context: PVOID,
) -> HRESULT,
::libloading::Error,
>,
pub WslcGetProcessPid: Result<
unsafe extern "C" fn(process: WslcProcess, pid: *mut u32) -> HRESULT,
::libloading::Error,
>,
pub WslcGetProcessExitEvent: Result<
unsafe extern "C" fn(process: WslcProcess, exitEvent: *mut HANDLE) -> HRESULT,
::libloading::Error,
>,
pub WslcGetProcessState: Result<
unsafe extern "C" fn(process: WslcProcess, state: *mut WslcProcessState) -> HRESULT,
::libloading::Error,
>,
pub WslcGetProcessExitCode: Result<
unsafe extern "C" fn(process: WslcProcess, exitCode: PINT32) -> HRESULT,
::libloading::Error,
>,
pub WslcSignalProcess: Result<
unsafe extern "C" fn(process: WslcProcess, signal: WslcSignal) -> HRESULT,
::libloading::Error,
>,
pub WslcGetProcessIOHandle: Result<
unsafe extern "C" fn(
process: WslcProcess,
ioHandle: WslcProcessIOHandle,
handle: *mut HANDLE,
) -> HRESULT,
::libloading::Error,
>,
pub WslcReleaseProcess:
Result<unsafe extern "C" fn(process: WslcProcess) -> HRESULT, ::libloading::Error>,
pub WslcPullSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
options: *const WslcPullImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcImportSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
imageName: PCSTR,
imageContent: HANDLE,
imageContentBytes: u64,
options: *const WslcImportImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcImportSessionImageFromFile: Result<
unsafe extern "C" fn(
session: WslcSession,
imageName: PCSTR,
path: PCWSTR,
options: *const WslcImportImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcLoadSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
imageContent: HANDLE,
imageContentBytes: u64,
options: *const WslcLoadImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcLoadSessionImageFromFile: Result<
unsafe extern "C" fn(
session: WslcSession,
path: PCWSTR,
options: *const WslcLoadImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcDeleteSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
nameOrID: PCSTR,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcTagSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
options: *const WslcTagImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcPushSessionImage: Result<
unsafe extern "C" fn(
session: WslcSession,
options: *const WslcPushImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcSessionAuthenticate: Result<
unsafe extern "C" fn(
session: WslcSession,
serverAddress: PCSTR,
username: PCSTR,
password: PCSTR,
identityToken: *mut PSTR,
tokenType: *mut WslcIdentityTokenType,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcListSessionImages: Result<
unsafe extern "C" fn(
session: WslcSession,
images: *mut *mut WslcImageInfo,
count: *mut u32,
) -> HRESULT,
::libloading::Error,
>,
pub WslcCreateSessionVhdVolume: Result<
unsafe extern "C" fn(
session: WslcSession,
options: *const WslcVhdRequirements,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcDeleteSessionVhdVolume: Result<
unsafe extern "C" fn(
session: WslcSession,
name: PCSTR,
errorMessage: *mut PWSTR,
) -> HRESULT,
::libloading::Error,
>,
pub WslcGetMissingComponents: Result<
unsafe extern "C" fn(missingComponents: *mut WslcComponentFlags) -> HRESULT,
::libloading::Error,
>,
pub WslcGetVersion:
Result<unsafe extern "C" fn(version: *mut WslcVersion) -> HRESULT, ::libloading::Error>,
pub WslcInstallWithDependencies: Result<
unsafe extern "C" fn(
components: WslcComponentFlags,
options: WslcInstallOptions,
progressCallback: WslcInstallCallback,
context: PVOID,
) -> HRESULT,
::libloading::Error,
>,
}
impl WslcSdk {
pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
where
P: AsRef<::std::ffi::OsStr>,
{
let library = ::libloading::Library::new(path)?;
Self::from_library(library)
}
pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
where
L: Into<::libloading::Library>,
{
let __library = library.into();
let WslcInitSessionSettings = __library.get(b"WslcInitSessionSettings\0").map(|sym| *sym);
let WslcCreateSession = __library.get(b"WslcCreateSession\0").map(|sym| *sym);
let WslcSetSessionSettingsCpuCount = __library
.get(b"WslcSetSessionSettingsCpuCount\0")
.map(|sym| *sym);
let WslcSetSessionSettingsMemory = __library
.get(b"WslcSetSessionSettingsMemory\0")
.map(|sym| *sym);
let WslcSetSessionSettingsTimeout = __library
.get(b"WslcSetSessionSettingsTimeout\0")
.map(|sym| *sym);
let WslcSetSessionSettingsVhd = __library
.get(b"WslcSetSessionSettingsVhd\0")
.map(|sym| *sym);
let WslcSetSessionSettingsFeatureFlags = __library
.get(b"WslcSetSessionSettingsFeatureFlags\0")
.map(|sym| *sym);
let WslcGetSessionTerminationEvent = __library
.get(b"WslcGetSessionTerminationEvent\0")
.map(|sym| *sym);
let WslcGetSessionTerminationReason = __library
.get(b"WslcGetSessionTerminationReason\0")
.map(|sym| *sym);
let WslcTerminateSession = __library.get(b"WslcTerminateSession\0").map(|sym| *sym);
let WslcReleaseSession = __library.get(b"WslcReleaseSession\0").map(|sym| *sym);
let WslcRegisterSessionCrashDumpCallback = __library
.get(b"WslcRegisterSessionCrashDumpCallback\0")
.map(|sym| *sym);
let WslcReleaseCrashDumpSubscription = __library
.get(b"WslcReleaseCrashDumpSubscription\0")
.map(|sym| *sym);
let WslcInitContainerSettings = __library
.get(b"WslcInitContainerSettings\0")
.map(|sym| *sym);
let WslcCreateContainer = __library.get(b"WslcCreateContainer\0").map(|sym| *sym);
let WslcOpenContainer = __library.get(b"WslcOpenContainer\0").map(|sym| *sym);
let WslcStartContainer = __library.get(b"WslcStartContainer\0").map(|sym| *sym);
let WslcSetContainerSettingsName = __library
.get(b"WslcSetContainerSettingsName\0")
.map(|sym| *sym);
let WslcSetContainerSettingsInitProcess = __library
.get(b"WslcSetContainerSettingsInitProcess\0")
.map(|sym| *sym);
let WslcSetContainerSettingsNetworkingMode = __library
.get(b"WslcSetContainerSettingsNetworkingMode\0")
.map(|sym| *sym);
let WslcSetContainerSettingsHostName = __library
.get(b"WslcSetContainerSettingsHostName\0")
.map(|sym| *sym);
let WslcSetContainerSettingsDomainName = __library
.get(b"WslcSetContainerSettingsDomainName\0")
.map(|sym| *sym);
let WslcSetContainerSettingsFlags = __library
.get(b"WslcSetContainerSettingsFlags\0")
.map(|sym| *sym);
let WslcSetContainerSettingsPortMappings = __library
.get(b"WslcSetContainerSettingsPortMappings\0")
.map(|sym| *sym);
let WslcSetContainerSettingsVolumes = __library
.get(b"WslcSetContainerSettingsVolumes\0")
.map(|sym| *sym);
let WslcSetContainerSettingsNamedVolumes = __library
.get(b"WslcSetContainerSettingsNamedVolumes\0")
.map(|sym| *sym);
let WslcCreateContainerProcess = __library
.get(b"WslcCreateContainerProcess\0")
.map(|sym| *sym);
let WslcReleaseContainer = __library.get(b"WslcReleaseContainer\0").map(|sym| *sym);
let WslcGetContainerID = __library.get(b"WslcGetContainerID\0").map(|sym| *sym);
let WslcGetContainerInitProcess = __library
.get(b"WslcGetContainerInitProcess\0")
.map(|sym| *sym);
let WslcInspectContainer = __library.get(b"WslcInspectContainer\0").map(|sym| *sym);
let WslcGetContainerState = __library.get(b"WslcGetContainerState\0").map(|sym| *sym);
let WslcStopContainer = __library.get(b"WslcStopContainer\0").map(|sym| *sym);
let WslcDeleteContainer = __library.get(b"WslcDeleteContainer\0").map(|sym| *sym);
let WslcInitProcessSettings = __library.get(b"WslcInitProcessSettings\0").map(|sym| *sym);
let WslcSetProcessSettingsWorkingDirectory = __library
.get(b"WslcSetProcessSettingsWorkingDirectory\0")
.map(|sym| *sym);
let WslcSetProcessSettingsCmdLine = __library
.get(b"WslcSetProcessSettingsCmdLine\0")
.map(|sym| *sym);
let WslcSetProcessSettingsEnvVariables = __library
.get(b"WslcSetProcessSettingsEnvVariables\0")
.map(|sym| *sym);
let WslcSetProcessSettingsCallbacks = __library
.get(b"WslcSetProcessSettingsCallbacks\0")
.map(|sym| *sym);
let WslcSetContainerInitProcessIOCallbacks = __library
.get(b"WslcSetContainerInitProcessIOCallbacks\0")
.map(|sym| *sym);
let WslcGetProcessPid = __library.get(b"WslcGetProcessPid\0").map(|sym| *sym);
let WslcGetProcessExitEvent = __library.get(b"WslcGetProcessExitEvent\0").map(|sym| *sym);
let WslcGetProcessState = __library.get(b"WslcGetProcessState\0").map(|sym| *sym);
let WslcGetProcessExitCode = __library.get(b"WslcGetProcessExitCode\0").map(|sym| *sym);
let WslcSignalProcess = __library.get(b"WslcSignalProcess\0").map(|sym| *sym);
let WslcGetProcessIOHandle = __library.get(b"WslcGetProcessIOHandle\0").map(|sym| *sym);
let WslcReleaseProcess = __library.get(b"WslcReleaseProcess\0").map(|sym| *sym);
let WslcPullSessionImage = __library.get(b"WslcPullSessionImage\0").map(|sym| *sym);
let WslcImportSessionImage = __library.get(b"WslcImportSessionImage\0").map(|sym| *sym);
let WslcImportSessionImageFromFile = __library
.get(b"WslcImportSessionImageFromFile\0")
.map(|sym| *sym);
let WslcLoadSessionImage = __library.get(b"WslcLoadSessionImage\0").map(|sym| *sym);
let WslcLoadSessionImageFromFile = __library
.get(b"WslcLoadSessionImageFromFile\0")
.map(|sym| *sym);
let WslcDeleteSessionImage = __library.get(b"WslcDeleteSessionImage\0").map(|sym| *sym);
let WslcTagSessionImage = __library.get(b"WslcTagSessionImage\0").map(|sym| *sym);
let WslcPushSessionImage = __library.get(b"WslcPushSessionImage\0").map(|sym| *sym);
let WslcSessionAuthenticate = __library.get(b"WslcSessionAuthenticate\0").map(|sym| *sym);
let WslcListSessionImages = __library.get(b"WslcListSessionImages\0").map(|sym| *sym);
let WslcCreateSessionVhdVolume = __library
.get(b"WslcCreateSessionVhdVolume\0")
.map(|sym| *sym);
let WslcDeleteSessionVhdVolume = __library
.get(b"WslcDeleteSessionVhdVolume\0")
.map(|sym| *sym);
let WslcGetMissingComponents = __library.get(b"WslcGetMissingComponents\0").map(|sym| *sym);
let WslcGetVersion = __library.get(b"WslcGetVersion\0").map(|sym| *sym);
let WslcInstallWithDependencies = __library
.get(b"WslcInstallWithDependencies\0")
.map(|sym| *sym);
Ok(WslcSdk {
__library,
WslcInitSessionSettings,
WslcCreateSession,
WslcSetSessionSettingsCpuCount,
WslcSetSessionSettingsMemory,
WslcSetSessionSettingsTimeout,
WslcSetSessionSettingsVhd,
WslcSetSessionSettingsFeatureFlags,
WslcGetSessionTerminationEvent,
WslcGetSessionTerminationReason,
WslcTerminateSession,
WslcReleaseSession,
WslcRegisterSessionCrashDumpCallback,
WslcReleaseCrashDumpSubscription,
WslcInitContainerSettings,
WslcCreateContainer,
WslcOpenContainer,
WslcStartContainer,
WslcSetContainerSettingsName,
WslcSetContainerSettingsInitProcess,
WslcSetContainerSettingsNetworkingMode,
WslcSetContainerSettingsHostName,
WslcSetContainerSettingsDomainName,
WslcSetContainerSettingsFlags,
WslcSetContainerSettingsPortMappings,
WslcSetContainerSettingsVolumes,
WslcSetContainerSettingsNamedVolumes,
WslcCreateContainerProcess,
WslcReleaseContainer,
WslcGetContainerID,
WslcGetContainerInitProcess,
WslcInspectContainer,
WslcGetContainerState,
WslcStopContainer,
WslcDeleteContainer,
WslcInitProcessSettings,
WslcSetProcessSettingsWorkingDirectory,
WslcSetProcessSettingsCmdLine,
WslcSetProcessSettingsEnvVariables,
WslcSetProcessSettingsCallbacks,
WslcSetContainerInitProcessIOCallbacks,
WslcGetProcessPid,
WslcGetProcessExitEvent,
WslcGetProcessState,
WslcGetProcessExitCode,
WslcSignalProcess,
WslcGetProcessIOHandle,
WslcReleaseProcess,
WslcPullSessionImage,
WslcImportSessionImage,
WslcImportSessionImageFromFile,
WslcLoadSessionImage,
WslcLoadSessionImageFromFile,
WslcDeleteSessionImage,
WslcTagSessionImage,
WslcPushSessionImage,
WslcSessionAuthenticate,
WslcListSessionImages,
WslcCreateSessionVhdVolume,
WslcDeleteSessionVhdVolume,
WslcGetMissingComponents,
WslcGetVersion,
WslcInstallWithDependencies,
})
}
pub unsafe fn WslcInitSessionSettings(
&self,
name: PCWSTR,
storagePath: PCWSTR,
sessionSettings: *mut WslcSessionSettings,
) -> HRESULT {
(self
.WslcInitSessionSettings
.as_ref()
.expect("Expected function, got error."))(name, storagePath, sessionSettings)
}
pub unsafe fn WslcCreateSession(
&self,
sessionSettings: *mut WslcSessionSettings,
session: *mut WslcSession,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcCreateSession
.as_ref()
.expect("Expected function, got error."))(sessionSettings, session, errorMessage)
}
pub unsafe fn WslcSetSessionSettingsCpuCount(
&self,
sessionSettings: *mut WslcSessionSettings,
cpuCount: u32,
) -> HRESULT {
(self
.WslcSetSessionSettingsCpuCount
.as_ref()
.expect("Expected function, got error."))(sessionSettings, cpuCount)
}
pub unsafe fn WslcSetSessionSettingsMemory(
&self,
sessionSettings: *mut WslcSessionSettings,
memoryMB: u32,
) -> HRESULT {
(self
.WslcSetSessionSettingsMemory
.as_ref()
.expect("Expected function, got error."))(sessionSettings, memoryMB)
}
pub unsafe fn WslcSetSessionSettingsTimeout(
&self,
sessionSettings: *mut WslcSessionSettings,
timeoutMS: u32,
) -> HRESULT {
(self
.WslcSetSessionSettingsTimeout
.as_ref()
.expect("Expected function, got error."))(sessionSettings, timeoutMS)
}
pub unsafe fn WslcSetSessionSettingsVhd(
&self,
sessionSettings: *mut WslcSessionSettings,
vhdRequirements: *const WslcVhdRequirements,
) -> HRESULT {
(self
.WslcSetSessionSettingsVhd
.as_ref()
.expect("Expected function, got error."))(sessionSettings, vhdRequirements)
}
pub unsafe fn WslcSetSessionSettingsFeatureFlags(
&self,
sessionSettings: *mut WslcSessionSettings,
flags: WslcSessionFeatureFlags,
) -> HRESULT {
(self
.WslcSetSessionSettingsFeatureFlags
.as_ref()
.expect("Expected function, got error."))(sessionSettings, flags)
}
pub unsafe fn WslcGetSessionTerminationEvent(
&self,
session: WslcSession,
terminationEvent: *mut HANDLE,
) -> HRESULT {
(self
.WslcGetSessionTerminationEvent
.as_ref()
.expect("Expected function, got error."))(session, terminationEvent)
}
pub unsafe fn WslcGetSessionTerminationReason(
&self,
session: WslcSession,
reason: *mut WslcSessionTerminationReason,
) -> HRESULT {
(self
.WslcGetSessionTerminationReason
.as_ref()
.expect("Expected function, got error."))(session, reason)
}
pub unsafe fn WslcTerminateSession(&self, session: WslcSession) -> HRESULT {
(self
.WslcTerminateSession
.as_ref()
.expect("Expected function, got error."))(session)
}
pub unsafe fn WslcReleaseSession(&self, session: WslcSession) -> HRESULT {
(self
.WslcReleaseSession
.as_ref()
.expect("Expected function, got error."))(session)
}
pub unsafe fn WslcRegisterSessionCrashDumpCallback(
&self,
session: WslcSession,
crashDumpCallback: WslcSessionCrashDumpCallback,
crashDumpContext: PVOID,
subscription: *mut WslcCrashDumpSubscription,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcRegisterSessionCrashDumpCallback
.as_ref()
.expect("Expected function, got error."))(
session,
crashDumpCallback,
crashDumpContext,
subscription,
errorMessage,
)
}
pub unsafe fn WslcReleaseCrashDumpSubscription(
&self,
subscription: WslcCrashDumpSubscription,
) -> HRESULT {
(self
.WslcReleaseCrashDumpSubscription
.as_ref()
.expect("Expected function, got error."))(subscription)
}
pub unsafe fn WslcInitContainerSettings(
&self,
imageName: PCSTR,
containerSettings: *mut WslcContainerSettings,
) -> HRESULT {
(self
.WslcInitContainerSettings
.as_ref()
.expect("Expected function, got error."))(imageName, containerSettings)
}
pub unsafe fn WslcCreateContainer(
&self,
session: WslcSession,
containerSettings: *const WslcContainerSettings,
container: *mut WslcContainer,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcCreateContainer
.as_ref()
.expect("Expected function, got error."))(
session,
containerSettings,
container,
errorMessage,
)
}
pub unsafe fn WslcOpenContainer(
&self,
session: WslcSession,
nameOrId: PCSTR,
container: *mut WslcContainer,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcOpenContainer
.as_ref()
.expect("Expected function, got error."))(
session, nameOrId, container, errorMessage
)
}
pub unsafe fn WslcStartContainer(
&self,
container: WslcContainer,
flags: WslcContainerStartFlags,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcStartContainer
.as_ref()
.expect("Expected function, got error."))(container, flags, errorMessage)
}
pub unsafe fn WslcSetContainerSettingsName(
&self,
containerSettings: *mut WslcContainerSettings,
name: PCSTR,
) -> HRESULT {
(self
.WslcSetContainerSettingsName
.as_ref()
.expect("Expected function, got error."))(containerSettings, name)
}
pub unsafe fn WslcSetContainerSettingsInitProcess(
&self,
containerSettings: *mut WslcContainerSettings,
initProcess: *mut WslcProcessSettings,
) -> HRESULT {
(self
.WslcSetContainerSettingsInitProcess
.as_ref()
.expect("Expected function, got error."))(containerSettings, initProcess)
}
pub unsafe fn WslcSetContainerSettingsNetworkingMode(
&self,
containerSettings: *mut WslcContainerSettings,
networkingMode: WslcContainerNetworkingMode,
) -> HRESULT {
(self
.WslcSetContainerSettingsNetworkingMode
.as_ref()
.expect("Expected function, got error."))(containerSettings, networkingMode)
}
pub unsafe fn WslcSetContainerSettingsHostName(
&self,
containerSettings: *mut WslcContainerSettings,
hostName: PCSTR,
) -> HRESULT {
(self
.WslcSetContainerSettingsHostName
.as_ref()
.expect("Expected function, got error."))(containerSettings, hostName)
}
pub unsafe fn WslcSetContainerSettingsDomainName(
&self,
containerSettings: *mut WslcContainerSettings,
domainName: PCSTR,
) -> HRESULT {
(self
.WslcSetContainerSettingsDomainName
.as_ref()
.expect("Expected function, got error."))(containerSettings, domainName)
}
pub unsafe fn WslcSetContainerSettingsFlags(
&self,
containerSettings: *mut WslcContainerSettings,
flags: WslcContainerFlags,
) -> HRESULT {
(self
.WslcSetContainerSettingsFlags
.as_ref()
.expect("Expected function, got error."))(containerSettings, flags)
}
pub unsafe fn WslcSetContainerSettingsPortMappings(
&self,
containerSettings: *mut WslcContainerSettings,
portMappings: *const WslcContainerPortMapping,
portMappingCount: u32,
) -> HRESULT {
(self
.WslcSetContainerSettingsPortMappings
.as_ref()
.expect("Expected function, got error."))(
containerSettings,
portMappings,
portMappingCount,
)
}
pub unsafe fn WslcSetContainerSettingsVolumes(
&self,
containerSettings: *mut WslcContainerSettings,
volumes: *const WslcContainerVolume,
volumeCount: u32,
) -> HRESULT {
(self
.WslcSetContainerSettingsVolumes
.as_ref()
.expect("Expected function, got error."))(
containerSettings, volumes, volumeCount
)
}
pub unsafe fn WslcSetContainerSettingsNamedVolumes(
&self,
containerSettings: *mut WslcContainerSettings,
namedVolumes: *const WslcContainerNamedVolume,
namedVolumeCount: u32,
) -> HRESULT {
(self
.WslcSetContainerSettingsNamedVolumes
.as_ref()
.expect("Expected function, got error."))(
containerSettings,
namedVolumes,
namedVolumeCount,
)
}
pub unsafe fn WslcCreateContainerProcess(
&self,
container: WslcContainer,
newProcessSettings: *mut WslcProcessSettings,
newProcess: *mut WslcProcess,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcCreateContainerProcess
.as_ref()
.expect("Expected function, got error."))(
container,
newProcessSettings,
newProcess,
errorMessage,
)
}
pub unsafe fn WslcReleaseContainer(&self, container: WslcContainer) -> HRESULT {
(self
.WslcReleaseContainer
.as_ref()
.expect("Expected function, got error."))(container)
}
pub unsafe fn WslcGetContainerID(
&self,
container: WslcContainer,
containerID: *mut CHAR,
) -> HRESULT {
(self
.WslcGetContainerID
.as_ref()
.expect("Expected function, got error."))(container, containerID)
}
pub unsafe fn WslcGetContainerInitProcess(
&self,
container: WslcContainer,
initProcess: *mut WslcProcess,
) -> HRESULT {
(self
.WslcGetContainerInitProcess
.as_ref()
.expect("Expected function, got error."))(container, initProcess)
}
pub unsafe fn WslcInspectContainer(
&self,
container: WslcContainer,
inspectData: *mut PSTR,
) -> HRESULT {
(self
.WslcInspectContainer
.as_ref()
.expect("Expected function, got error."))(container, inspectData)
}
pub unsafe fn WslcGetContainerState(
&self,
container: WslcContainer,
state: *mut WslcContainerState,
) -> HRESULT {
(self
.WslcGetContainerState
.as_ref()
.expect("Expected function, got error."))(container, state)
}
pub unsafe fn WslcStopContainer(
&self,
container: WslcContainer,
signal: WslcSignal,
timeoutSeconds: u32,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcStopContainer
.as_ref()
.expect("Expected function, got error."))(
container,
signal,
timeoutSeconds,
errorMessage,
)
}
pub unsafe fn WslcDeleteContainer(
&self,
container: WslcContainer,
flags: WslcDeleteContainerFlags,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcDeleteContainer
.as_ref()
.expect("Expected function, got error."))(container, flags, errorMessage)
}
pub unsafe fn WslcInitProcessSettings(
&self,
processSettings: *mut WslcProcessSettings,
) -> HRESULT {
(self
.WslcInitProcessSettings
.as_ref()
.expect("Expected function, got error."))(processSettings)
}
pub unsafe fn WslcSetProcessSettingsWorkingDirectory(
&self,
processSettings: *mut WslcProcessSettings,
workingDirectory: PCSTR,
) -> HRESULT {
(self
.WslcSetProcessSettingsWorkingDirectory
.as_ref()
.expect("Expected function, got error."))(processSettings, workingDirectory)
}
pub unsafe fn WslcSetProcessSettingsCmdLine(
&self,
processSettings: *mut WslcProcessSettings,
argv: *const PCSTR,
argc: usize,
) -> HRESULT {
(self
.WslcSetProcessSettingsCmdLine
.as_ref()
.expect("Expected function, got error."))(processSettings, argv, argc)
}
pub unsafe fn WslcSetProcessSettingsEnvVariables(
&self,
processSettings: *mut WslcProcessSettings,
key_value: *const PCSTR,
argc: usize,
) -> HRESULT {
(self
.WslcSetProcessSettingsEnvVariables
.as_ref()
.expect("Expected function, got error."))(processSettings, key_value, argc)
}
pub unsafe fn WslcSetProcessSettingsCallbacks(
&self,
processSettings: *mut WslcProcessSettings,
callbacks: *const WslcProcessCallbacks,
context: PVOID,
) -> HRESULT {
(self
.WslcSetProcessSettingsCallbacks
.as_ref()
.expect("Expected function, got error."))(processSettings, callbacks, context)
}
pub unsafe fn WslcSetContainerInitProcessIOCallbacks(
&self,
container: WslcContainer,
callbacks: *const WslcProcessCallbacks,
context: PVOID,
) -> HRESULT {
(self
.WslcSetContainerInitProcessIOCallbacks
.as_ref()
.expect("Expected function, got error."))(container, callbacks, context)
}
pub unsafe fn WslcGetProcessPid(&self, process: WslcProcess, pid: *mut u32) -> HRESULT {
(self
.WslcGetProcessPid
.as_ref()
.expect("Expected function, got error."))(process, pid)
}
pub unsafe fn WslcGetProcessExitEvent(
&self,
process: WslcProcess,
exitEvent: *mut HANDLE,
) -> HRESULT {
(self
.WslcGetProcessExitEvent
.as_ref()
.expect("Expected function, got error."))(process, exitEvent)
}
pub unsafe fn WslcGetProcessState(
&self,
process: WslcProcess,
state: *mut WslcProcessState,
) -> HRESULT {
(self
.WslcGetProcessState
.as_ref()
.expect("Expected function, got error."))(process, state)
}
pub unsafe fn WslcGetProcessExitCode(&self, process: WslcProcess, exitCode: PINT32) -> HRESULT {
(self
.WslcGetProcessExitCode
.as_ref()
.expect("Expected function, got error."))(process, exitCode)
}
pub unsafe fn WslcSignalProcess(&self, process: WslcProcess, signal: WslcSignal) -> HRESULT {
(self
.WslcSignalProcess
.as_ref()
.expect("Expected function, got error."))(process, signal)
}
pub unsafe fn WslcGetProcessIOHandle(
&self,
process: WslcProcess,
ioHandle: WslcProcessIOHandle,
handle: *mut HANDLE,
) -> HRESULT {
(self
.WslcGetProcessIOHandle
.as_ref()
.expect("Expected function, got error."))(process, ioHandle, handle)
}
pub unsafe fn WslcReleaseProcess(&self, process: WslcProcess) -> HRESULT {
(self
.WslcReleaseProcess
.as_ref()
.expect("Expected function, got error."))(process)
}
pub unsafe fn WslcPullSessionImage(
&self,
session: WslcSession,
options: *const WslcPullImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcPullSessionImage
.as_ref()
.expect("Expected function, got error."))(session, options, errorMessage)
}
pub unsafe fn WslcImportSessionImage(
&self,
session: WslcSession,
imageName: PCSTR,
imageContent: HANDLE,
imageContentBytes: u64,
options: *const WslcImportImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcImportSessionImage
.as_ref()
.expect("Expected function, got error."))(
session,
imageName,
imageContent,
imageContentBytes,
options,
errorMessage,
)
}
pub unsafe fn WslcImportSessionImageFromFile(
&self,
session: WslcSession,
imageName: PCSTR,
path: PCWSTR,
options: *const WslcImportImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcImportSessionImageFromFile
.as_ref()
.expect("Expected function, got error."))(
session,
imageName,
path,
options,
errorMessage,
)
}
pub unsafe fn WslcLoadSessionImage(
&self,
session: WslcSession,
imageContent: HANDLE,
imageContentBytes: u64,
options: *const WslcLoadImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcLoadSessionImage
.as_ref()
.expect("Expected function, got error."))(
session,
imageContent,
imageContentBytes,
options,
errorMessage,
)
}
pub unsafe fn WslcLoadSessionImageFromFile(
&self,
session: WslcSession,
path: PCWSTR,
options: *const WslcLoadImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcLoadSessionImageFromFile
.as_ref()
.expect("Expected function, got error."))(session, path, options, errorMessage)
}
pub unsafe fn WslcDeleteSessionImage(
&self,
session: WslcSession,
nameOrID: PCSTR,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcDeleteSessionImage
.as_ref()
.expect("Expected function, got error."))(session, nameOrID, errorMessage)
}
pub unsafe fn WslcTagSessionImage(
&self,
session: WslcSession,
options: *const WslcTagImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcTagSessionImage
.as_ref()
.expect("Expected function, got error."))(session, options, errorMessage)
}
pub unsafe fn WslcPushSessionImage(
&self,
session: WslcSession,
options: *const WslcPushImageOptions,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcPushSessionImage
.as_ref()
.expect("Expected function, got error."))(session, options, errorMessage)
}
pub unsafe fn WslcSessionAuthenticate(
&self,
session: WslcSession,
serverAddress: PCSTR,
username: PCSTR,
password: PCSTR,
identityToken: *mut PSTR,
tokenType: *mut WslcIdentityTokenType,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcSessionAuthenticate
.as_ref()
.expect("Expected function, got error."))(
session,
serverAddress,
username,
password,
identityToken,
tokenType,
errorMessage,
)
}
pub unsafe fn WslcListSessionImages(
&self,
session: WslcSession,
images: *mut *mut WslcImageInfo,
count: *mut u32,
) -> HRESULT {
(self
.WslcListSessionImages
.as_ref()
.expect("Expected function, got error."))(session, images, count)
}
pub unsafe fn WslcCreateSessionVhdVolume(
&self,
session: WslcSession,
options: *const WslcVhdRequirements,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcCreateSessionVhdVolume
.as_ref()
.expect("Expected function, got error."))(session, options, errorMessage)
}
pub unsafe fn WslcDeleteSessionVhdVolume(
&self,
session: WslcSession,
name: PCSTR,
errorMessage: *mut PWSTR,
) -> HRESULT {
(self
.WslcDeleteSessionVhdVolume
.as_ref()
.expect("Expected function, got error."))(session, name, errorMessage)
}
pub unsafe fn WslcGetMissingComponents(
&self,
missingComponents: *mut WslcComponentFlags,
) -> HRESULT {
(self
.WslcGetMissingComponents
.as_ref()
.expect("Expected function, got error."))(missingComponents)
}
pub unsafe fn WslcGetVersion(&self, version: *mut WslcVersion) -> HRESULT {
(self
.WslcGetVersion
.as_ref()
.expect("Expected function, got error."))(version)
}
pub unsafe fn WslcInstallWithDependencies(
&self,
components: WslcComponentFlags,
options: WslcInstallOptions,
progressCallback: WslcInstallCallback,
context: PVOID,
) -> HRESULT {
(self
.WslcInstallWithDependencies
.as_ref()
.expect("Expected function, got error."))(
components,
options,
progressCallback,
context,
)
}
}