Skip to main content

wslpluginapi_sys/opt/rustwide/workdir/build/
WslPluginApi.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3use windows_sys::core::*;
4use windows_sys::Win32::Foundation::*;
5use windows_sys::Win32::Networking::WinSock::SOCKET;
6#[allow(unused_imports)]
7use windows_sys::Win32::Security::*;
8#[allow(clippy::upper_case_acronyms)]
9type LPCWSTR = PCWSTR;
10#[allow(clippy::upper_case_acronyms)]
11type LPCSTR = PCSTR;
12#[allow(clippy::upper_case_acronyms)]
13type DWORD = u32;
14#[cfg(feature = "hooks-field-names")]
15use struct_field_names_as_array::FieldNamesAsSlice;
16
17#[repr(C)]
18#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
19pub struct WSLVersion {
20    pub Major: u32,
21    pub Minor: u32,
22    pub Revision: u32,
23}
24#[allow(clippy::unnecessary_operation, clippy::identity_op)]
25const _: () = {
26    ["Size of WSLVersion"][::std::mem::size_of::<WSLVersion>() - 12usize];
27    ["Alignment of WSLVersion"][::std::mem::align_of::<WSLVersion>() - 4usize];
28    ["Offset of field: WSLVersion::Major"][::std::mem::offset_of!(WSLVersion, Major) - 0usize];
29    ["Offset of field: WSLVersion::Minor"][::std::mem::offset_of!(WSLVersion, Minor) - 4usize];
30    ["Offset of field: WSLVersion::Revision"]
31        [::std::mem::offset_of!(WSLVersion, Revision) - 8usize];
32};
33pub const WSLUserConfiguration_None: WSLUserConfiguration = 0;
34pub const WSLUserConfiguration_WSLUserConfigurationCustomKernel: WSLUserConfiguration = 1;
35pub const WSLUserConfiguration_WSLUserConfigurationCustomKernelCommandLine: WSLUserConfiguration =
36    2;
37pub type WSLUserConfiguration = ::std::os::raw::c_int;
38#[repr(C)]
39#[derive(Debug, Copy, Clone)]
40pub struct WSLVmCreationSettings {
41    pub CustomConfigurationFlags: WSLUserConfiguration,
42}
43#[allow(clippy::unnecessary_operation, clippy::identity_op)]
44const _: () = {
45    ["Size of WSLVmCreationSettings"][::std::mem::size_of::<WSLVmCreationSettings>() - 4usize];
46    ["Alignment of WSLVmCreationSettings"]
47        [::std::mem::align_of::<WSLVmCreationSettings>() - 4usize];
48    ["Offset of field: WSLVmCreationSettings::CustomConfigurationFlags"]
49        [::std::mem::offset_of!(WSLVmCreationSettings, CustomConfigurationFlags) - 0usize];
50};
51pub type WSLSessionId = DWORD;
52#[repr(C)]
53pub struct WSLSessionInformation {
54    pub SessionId: WSLSessionId,
55    pub UserToken: HANDLE,
56    pub UserSid: PSID,
57}
58#[allow(clippy::unnecessary_operation, clippy::identity_op)]
59const _: () = {
60    ["Size of WSLSessionInformation"][::std::mem::size_of::<WSLSessionInformation>() - 24usize];
61    ["Alignment of WSLSessionInformation"]
62        [::std::mem::align_of::<WSLSessionInformation>() - 8usize];
63    ["Offset of field: WSLSessionInformation::SessionId"]
64        [::std::mem::offset_of!(WSLSessionInformation, SessionId) - 0usize];
65    ["Offset of field: WSLSessionInformation::UserToken"]
66        [::std::mem::offset_of!(WSLSessionInformation, UserToken) - 8usize];
67    ["Offset of field: WSLSessionInformation::UserSid"]
68        [::std::mem::offset_of!(WSLSessionInformation, UserSid) - 16usize];
69};
70#[repr(C)]
71pub struct WSLDistributionInformation {
72    #[doc = " Distribution ID, guaranteed to be the same accross reboots"]
73    pub Id: GUID,
74    pub Name: LPCWSTR,
75    pub PidNamespace: u64,
76    #[doc = " Package family name, or NULL if none"]
77    pub PackageFamilyName: LPCWSTR,
78    #[doc = " Pid of the init process. Introduced in 2.0.5"]
79    pub InitPid: u32,
80    #[doc = " Type of distribution (ubuntu, debian, ...), introduced in TODO"]
81    pub Flavor: LPCWSTR,
82    #[doc = " Distribution version, introduced in TODO"]
83    pub Version: LPCWSTR,
84}
85#[allow(clippy::unnecessary_operation, clippy::identity_op)]
86const _: () = {
87    ["Size of WSLDistributionInformation"]
88        [::std::mem::size_of::<WSLDistributionInformation>() - 64usize];
89    ["Alignment of WSLDistributionInformation"]
90        [::std::mem::align_of::<WSLDistributionInformation>() - 8usize];
91    ["Offset of field: WSLDistributionInformation::Id"]
92        [::std::mem::offset_of!(WSLDistributionInformation, Id) - 0usize];
93    ["Offset of field: WSLDistributionInformation::Name"]
94        [::std::mem::offset_of!(WSLDistributionInformation, Name) - 16usize];
95    ["Offset of field: WSLDistributionInformation::PidNamespace"]
96        [::std::mem::offset_of!(WSLDistributionInformation, PidNamespace) - 24usize];
97    ["Offset of field: WSLDistributionInformation::PackageFamilyName"]
98        [::std::mem::offset_of!(WSLDistributionInformation, PackageFamilyName) - 32usize];
99    ["Offset of field: WSLDistributionInformation::InitPid"]
100        [::std::mem::offset_of!(WSLDistributionInformation, InitPid) - 40usize];
101    ["Offset of field: WSLDistributionInformation::Flavor"]
102        [::std::mem::offset_of!(WSLDistributionInformation, Flavor) - 48usize];
103    ["Offset of field: WSLDistributionInformation::Version"]
104        [::std::mem::offset_of!(WSLDistributionInformation, Version) - 56usize];
105};
106#[repr(C)]
107pub struct WslOfflineDistributionInformation {
108    #[doc = " Distribution ID, guaranteed to be the same accross reboots"]
109    pub Id: GUID,
110    pub Name: LPCWSTR,
111    #[doc = " Package family name, or NULL if none"]
112    pub PackageFamilyName: LPCWSTR,
113    #[doc = " Type of distribution (ubuntu, debian, ...), introduced in TODO"]
114    pub Flavor: LPCWSTR,
115    #[doc = " Distribution version, introduced in TODO"]
116    pub Version: LPCWSTR,
117}
118#[allow(clippy::unnecessary_operation, clippy::identity_op)]
119const _: () = {
120    ["Size of WslOfflineDistributionInformation"]
121        [::std::mem::size_of::<WslOfflineDistributionInformation>() - 48usize];
122    ["Alignment of WslOfflineDistributionInformation"]
123        [::std::mem::align_of::<WslOfflineDistributionInformation>() - 8usize];
124    ["Offset of field: WslOfflineDistributionInformation::Id"]
125        [::std::mem::offset_of!(WslOfflineDistributionInformation, Id) - 0usize];
126    ["Offset of field: WslOfflineDistributionInformation::Name"]
127        [::std::mem::offset_of!(WslOfflineDistributionInformation, Name) - 16usize];
128    ["Offset of field: WslOfflineDistributionInformation::PackageFamilyName"]
129        [::std::mem::offset_of!(WslOfflineDistributionInformation, PackageFamilyName) - 24usize];
130    ["Offset of field: WslOfflineDistributionInformation::Flavor"]
131        [::std::mem::offset_of!(WslOfflineDistributionInformation, Flavor) - 32usize];
132    ["Offset of field: WslOfflineDistributionInformation::Version"]
133        [::std::mem::offset_of!(WslOfflineDistributionInformation, Version) - 40usize];
134};
135#[doc = " Create plan9 mount between Windows & Linux"]
136pub type WSLPluginAPI_MountFolder = ::std::option::Option<
137    unsafe extern "C" fn(
138        Session: WSLSessionId,
139        WindowsPath: LPCWSTR,
140        LinuxPath: LPCWSTR,
141        ReadOnly: BOOL,
142        Name: LPCWSTR,
143    ) -> HRESULT,
144>;
145#[doc = " Execute a program in the root namespace.\n On success, 'Socket' is connected to stdin & stdout (stderr goes to dmesg) // 'Arguments' is expected to be NULL terminated"]
146pub type WSLPluginAPI_ExecuteBinary = ::std::option::Option<
147    unsafe extern "C" fn(
148        Session: WSLSessionId,
149        Path: LPCSTR,
150        Arguments: *mut LPCSTR,
151        Socket: *mut SOCKET,
152    ) -> HRESULT,
153>;
154#[doc = " Execute a program in a user distribution\n On success, 'Socket' is connected to stdin & stdout (stderr goes to dmesg) // 'Arguments' is expected to be NULL terminated"]
155pub type WSLPluginAPI_ExecuteBinaryInDistribution = ::std::option::Option<
156    unsafe extern "C" fn(
157        Session: WSLSessionId,
158        Distribution: *const GUID,
159        Path: LPCSTR,
160        Arguments: *mut LPCSTR,
161        Socket: *mut SOCKET,
162    ) -> HRESULT,
163>;
164#[doc = " Set the error message to display to the user if the VM or distribution creation fails.\n Must be called synchronously in either OnVMStarted() or OnDistributionStarted()."]
165pub type WSLPluginAPI_PluginError =
166    ::std::option::Option<unsafe extern "C" fn(UserMessage: LPCWSTR) -> HRESULT>;
167#[doc = " Called when the VM has started.\n 'Session' and 'UserSettings' are only valid during while the call is in progress."]
168pub type WSLPluginAPI_OnVMStarted = ::std::option::Option<
169    unsafe extern "C" fn(
170        Session: *const WSLSessionInformation,
171        UserSettings: *const WSLVmCreationSettings,
172    ) -> HRESULT,
173>;
174#[doc = " Called when the VM is about to stop.\n 'Session' is only valid during while the call is in progress."]
175pub type WSLPluginAPI_OnVMStopping =
176    ::std::option::Option<unsafe extern "C" fn(Session: *const WSLSessionInformation) -> HRESULT>;
177#[doc = " Called when a distribution has started.\n 'Session' and 'Distribution' is only valid during while the call is in progress."]
178pub type WSLPluginAPI_OnDistributionStarted = ::std::option::Option<
179    unsafe extern "C" fn(
180        Session: *const WSLSessionInformation,
181        Distribution: *const WSLDistributionInformation,
182    ) -> HRESULT,
183>;
184#[doc = " Called when a distribution is about to stop.\n 'Session' and 'Distribution' is only valid during while the call is in progress.\n Note: It's possible that stopping a distribution fails (for instance if a file is in use).\n In this case, it's possible for this notification to be called multiple times for the same distribution."]
185pub type WSLPluginAPI_OnDistributionStopping = ::std::option::Option<
186    unsafe extern "C" fn(
187        Session: *const WSLSessionInformation,
188        Distribution: *const WSLDistributionInformation,
189    ) -> HRESULT,
190>;
191#[doc = " Called when a distribution is registered or unregisteed.\n Returning failure will NOT cause the operation to fail."]
192pub type WSLPluginAPI_OnDistributionRegistered = ::std::option::Option<
193    unsafe extern "C" fn(
194        Session: *const WSLSessionInformation,
195        Distribution: *const WslOfflineDistributionInformation,
196    ) -> HRESULT,
197>;
198#[repr(C)]
199#[derive(Debug, Copy, Clone)]
200#[cfg_attr(feature = "hooks-field-names", derive(FieldNamesAsSlice))]
201pub struct WSLPluginHooksV1 {
202    pub OnVMStarted: WSLPluginAPI_OnVMStarted,
203    pub OnVMStopping: WSLPluginAPI_OnVMStopping,
204    pub OnDistributionStarted: WSLPluginAPI_OnDistributionStarted,
205    pub OnDistributionStopping: WSLPluginAPI_OnDistributionStopping,
206    #[doc = " Introduced in 2.1.2"]
207    pub OnDistributionRegistered: WSLPluginAPI_OnDistributionRegistered,
208    #[doc = " Introduced in 2.1.2"]
209    pub OnDistributionUnregistered: WSLPluginAPI_OnDistributionRegistered,
210}
211#[allow(clippy::unnecessary_operation, clippy::identity_op)]
212const _: () = {
213    ["Size of WSLPluginHooksV1"][::std::mem::size_of::<WSLPluginHooksV1>() - 48usize];
214    ["Alignment of WSLPluginHooksV1"][::std::mem::align_of::<WSLPluginHooksV1>() - 8usize];
215    ["Offset of field: WSLPluginHooksV1::OnVMStarted"]
216        [::std::mem::offset_of!(WSLPluginHooksV1, OnVMStarted) - 0usize];
217    ["Offset of field: WSLPluginHooksV1::OnVMStopping"]
218        [::std::mem::offset_of!(WSLPluginHooksV1, OnVMStopping) - 8usize];
219    ["Offset of field: WSLPluginHooksV1::OnDistributionStarted"]
220        [::std::mem::offset_of!(WSLPluginHooksV1, OnDistributionStarted) - 16usize];
221    ["Offset of field: WSLPluginHooksV1::OnDistributionStopping"]
222        [::std::mem::offset_of!(WSLPluginHooksV1, OnDistributionStopping) - 24usize];
223    ["Offset of field: WSLPluginHooksV1::OnDistributionRegistered"]
224        [::std::mem::offset_of!(WSLPluginHooksV1, OnDistributionRegistered) - 32usize];
225    ["Offset of field: WSLPluginHooksV1::OnDistributionUnregistered"]
226        [::std::mem::offset_of!(WSLPluginHooksV1, OnDistributionUnregistered) - 40usize];
227};
228#[repr(C)]
229#[derive(Debug, Copy, Clone)]
230pub struct WSLPluginAPIV1 {
231    pub Version: WSLVersion,
232    pub MountFolder: WSLPluginAPI_MountFolder,
233    pub ExecuteBinary: WSLPluginAPI_ExecuteBinary,
234    pub PluginError: WSLPluginAPI_PluginError,
235    #[doc = " Introduced in 2.1.2"]
236    pub ExecuteBinaryInDistribution: WSLPluginAPI_ExecuteBinaryInDistribution,
237}
238#[allow(clippy::unnecessary_operation, clippy::identity_op)]
239const _: () = {
240    ["Size of WSLPluginAPIV1"][::std::mem::size_of::<WSLPluginAPIV1>() - 48usize];
241    ["Alignment of WSLPluginAPIV1"][::std::mem::align_of::<WSLPluginAPIV1>() - 8usize];
242    ["Offset of field: WSLPluginAPIV1::Version"]
243        [::std::mem::offset_of!(WSLPluginAPIV1, Version) - 0usize];
244    ["Offset of field: WSLPluginAPIV1::MountFolder"]
245        [::std::mem::offset_of!(WSLPluginAPIV1, MountFolder) - 16usize];
246    ["Offset of field: WSLPluginAPIV1::ExecuteBinary"]
247        [::std::mem::offset_of!(WSLPluginAPIV1, ExecuteBinary) - 24usize];
248    ["Offset of field: WSLPluginAPIV1::PluginError"]
249        [::std::mem::offset_of!(WSLPluginAPIV1, PluginError) - 32usize];
250    ["Offset of field: WSLPluginAPIV1::ExecuteBinaryInDistribution"]
251        [::std::mem::offset_of!(WSLPluginAPIV1, ExecuteBinaryInDistribution) - 40usize];
252};
253pub type WSLPluginAPI_EntryPointV1 = ::std::option::Option<
254    unsafe extern "C" fn(Api: *const WSLPluginAPIV1, Hooks: *mut WSLPluginHooksV1) -> HRESULT,
255>;