1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
// This file was generated by the `windows` crate - do not edit by hand!
#![allow(
    unused_variables,
    non_upper_case_globals,
    non_snake_case,
    unused_unsafe,
    non_camel_case_types,
    dead_code,
    clippy::all
)]
pub mod MobileDeviceManagementRegistration {
    pub const DEVICEREGISTRATIONTYPE_MAM: u32 = 5u32;
    pub const DEVICEREGISTRATIONTYPE_MDM_DEVICEWIDE_WITH_AAD: u32 = 6u32;
    pub const DEVICEREGISTRATIONTYPE_MDM_ONLY: u32 = 0u32;
    pub const DEVICEREGISTRATIONTYPE_MDM_USERSPECIFIC_WITH_AAD: u32 = 13u32;
    pub const DEVICE_ENROLLER_FACILITY_CODE: u32 = 24u32;
    pub unsafe fn DiscoverManagementService<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
    >(
        pszupn: Param0,
    ) -> ::windows::Result<*mut MANAGEMENT_SERVICE_INFO> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn DiscoverManagementService(
                    pszupn: ::windows_win32_foundation::PWSTR,
                    ppmgmtinfo: *mut *mut MANAGEMENT_SERVICE_INFO,
                ) -> ::windows::HRESULT;
            }
            let mut result__: <*mut MANAGEMENT_SERVICE_INFO as ::windows::Abi>::Abi =
                ::std::mem::zeroed();
            DiscoverManagementService(pszupn.into_param().abi(), &mut result__)
                .from_abi::<*mut MANAGEMENT_SERVICE_INFO>(result__)
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn DiscoverManagementServiceEx<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
        Param1: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
    >(
        pszupn: Param0,
        pszdiscoveryservicecandidate: Param1,
    ) -> ::windows::Result<*mut MANAGEMENT_SERVICE_INFO> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn DiscoverManagementServiceEx(
                    pszupn: ::windows_win32_foundation::PWSTR,
                    pszdiscoveryservicecandidate: ::windows_win32_foundation::PWSTR,
                    ppmgmtinfo: *mut *mut MANAGEMENT_SERVICE_INFO,
                ) -> ::windows::HRESULT;
            }
            let mut result__: <*mut MANAGEMENT_SERVICE_INFO as ::windows::Abi>::Abi =
                ::std::mem::zeroed();
            DiscoverManagementServiceEx(
                pszupn.into_param().abi(),
                pszdiscoveryservicecandidate.into_param().abi(),
                &mut result__,
            )
            .from_abi::<*mut MANAGEMENT_SERVICE_INFO>(result__)
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn GetDeviceRegistrationInfo(
        deviceinformationclass: REGISTRATION_INFORMATION_CLASS,
        ppdeviceregistrationinfo: *mut *mut ::std::ffi::c_void,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn GetDeviceRegistrationInfo(
                    deviceinformationclass: REGISTRATION_INFORMATION_CLASS,
                    ppdeviceregistrationinfo: *mut *mut ::std::ffi::c_void,
                ) -> ::windows::HRESULT;
            }
            GetDeviceRegistrationInfo(
                ::std::mem::transmute(deviceinformationclass),
                ::std::mem::transmute(ppdeviceregistrationinfo),
            )
            .ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn GetManagementAppHyperlink(
        cchhyperlink: u32,
        pszhyperlink: ::windows_win32_foundation::PWSTR,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn GetManagementAppHyperlink(
                    cchhyperlink: u32,
                    pszhyperlink: ::windows_win32_foundation::PWSTR,
                ) -> ::windows::HRESULT;
            }
            GetManagementAppHyperlink(
                ::std::mem::transmute(cchhyperlink),
                ::std::mem::transmute(pszhyperlink),
            )
            .ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn IsDeviceRegisteredWithManagement(
        pfisdeviceregisteredwithmanagement: *mut ::windows_win32_foundation::BOOL,
        cchupn: u32,
        pszupn: ::windows_win32_foundation::PWSTR,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn IsDeviceRegisteredWithManagement(
                    pfisdeviceregisteredwithmanagement: *mut ::windows_win32_foundation::BOOL,
                    cchupn: u32,
                    pszupn: ::windows_win32_foundation::PWSTR,
                ) -> ::windows::HRESULT;
            }
            IsDeviceRegisteredWithManagement(
                ::std::mem::transmute(pfisdeviceregisteredwithmanagement),
                ::std::mem::transmute(cchupn),
                ::std::mem::transmute(pszupn),
            )
            .ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn IsManagementRegistrationAllowed(
    ) -> ::windows::Result<::windows_win32_foundation::BOOL> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn IsManagementRegistrationAllowed(
                    pfismanagementregistrationallowed: *mut ::windows_win32_foundation::BOOL,
                ) -> ::windows::HRESULT;
            }
            let mut result__: <::windows_win32_foundation::BOOL as ::windows::Abi>::Abi =
                ::std::mem::zeroed();
            IsManagementRegistrationAllowed(&mut result__)
                .from_abi::<::windows_win32_foundation::BOOL>(result__)
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn IsMdmUxWithoutAadAllowed() -> ::windows::Result<::windows_win32_foundation::BOOL>
    {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn IsMdmUxWithoutAadAllowed(
                    isenrollmentallowed: *mut ::windows_win32_foundation::BOOL,
                ) -> ::windows::HRESULT;
            }
            let mut result__: <::windows_win32_foundation::BOOL as ::windows::Abi>::Abi =
                ::std::mem::zeroed();
            IsMdmUxWithoutAadAllowed(&mut result__)
                .from_abi::<::windows_win32_foundation::BOOL>(result__)
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    #[derive(:: std :: clone :: Clone, :: std :: marker :: Copy)]
    #[repr(C)]
    pub struct MANAGEMENT_REGISTRATION_INFO {
        pub fDeviceRegisteredWithManagement: ::windows_win32_foundation::BOOL,
        pub dwDeviceRegistionKind: u32,
        pub pszUPN: ::windows_win32_foundation::PWSTR,
        pub pszMDMServiceUri: ::windows_win32_foundation::PWSTR,
    }
    impl MANAGEMENT_REGISTRATION_INFO {}
    impl ::std::default::Default for MANAGEMENT_REGISTRATION_INFO {
        fn default() -> Self {
            unsafe { ::std::mem::zeroed() }
        }
    }
    impl ::std::fmt::Debug for MANAGEMENT_REGISTRATION_INFO {
        fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
            fmt.debug_struct("MANAGEMENT_REGISTRATION_INFO")
                .field(
                    "fDeviceRegisteredWithManagement",
                    &self.fDeviceRegisteredWithManagement,
                )
                .field("dwDeviceRegistionKind", &self.dwDeviceRegistionKind)
                .field("pszUPN", &self.pszUPN)
                .field("pszMDMServiceUri", &self.pszMDMServiceUri)
                .finish()
        }
    }
    impl ::std::cmp::PartialEq for MANAGEMENT_REGISTRATION_INFO {
        fn eq(&self, other: &Self) -> bool {
            self.fDeviceRegisteredWithManagement == other.fDeviceRegisteredWithManagement
                && self.dwDeviceRegistionKind == other.dwDeviceRegistionKind
                && self.pszUPN == other.pszUPN
                && self.pszMDMServiceUri == other.pszMDMServiceUri
        }
    }
    impl ::std::cmp::Eq for MANAGEMENT_REGISTRATION_INFO {}
    unsafe impl ::windows::Abi for MANAGEMENT_REGISTRATION_INFO {
        type Abi = Self;
        type DefaultType = Self;
    }
    #[derive(:: std :: clone :: Clone, :: std :: marker :: Copy)]
    #[repr(C)]
    pub struct MANAGEMENT_SERVICE_INFO {
        pub pszMDMServiceUri: ::windows_win32_foundation::PWSTR,
        pub pszAuthenticationUri: ::windows_win32_foundation::PWSTR,
    }
    impl MANAGEMENT_SERVICE_INFO {}
    impl ::std::default::Default for MANAGEMENT_SERVICE_INFO {
        fn default() -> Self {
            unsafe { ::std::mem::zeroed() }
        }
    }
    impl ::std::fmt::Debug for MANAGEMENT_SERVICE_INFO {
        fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
            fmt.debug_struct("MANAGEMENT_SERVICE_INFO")
                .field("pszMDMServiceUri", &self.pszMDMServiceUri)
                .field("pszAuthenticationUri", &self.pszAuthenticationUri)
                .finish()
        }
    }
    impl ::std::cmp::PartialEq for MANAGEMENT_SERVICE_INFO {
        fn eq(&self, other: &Self) -> bool {
            self.pszMDMServiceUri == other.pszMDMServiceUri
                && self.pszAuthenticationUri == other.pszAuthenticationUri
        }
    }
    impl ::std::cmp::Eq for MANAGEMENT_SERVICE_INFO {}
    unsafe impl ::windows::Abi for MANAGEMENT_SERVICE_INFO {
        type Abi = Self;
        type DefaultType = Self;
    }
    pub const MDM_REGISTRATION_FACILITY_CODE: u32 = 25u32;
    pub const MENROLL_E_CERTAUTH_FAILED_TO_FIND_CERT: ::windows::HRESULT =
        ::windows::HRESULT(-2145910744i32 as _);
    pub const MENROLL_E_CERTPOLICY_PRIVATEKEYCREATION_FAILED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910745i32 as _);
    pub const MENROLL_E_CONNECTIVITY: ::windows::HRESULT = ::windows::HRESULT(-2145910768i32 as _);
    pub const MENROLL_E_DEVICECAPREACHED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910765i32 as _);
    pub const MENROLL_E_DEVICENOTSUPPORTED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910764i32 as _);
    pub const MENROLL_E_DEVICE_ALREADY_ENROLLED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910774i32 as _);
    pub const MENROLL_E_DEVICE_AUTHENTICATION_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910782i32 as _);
    pub const MENROLL_E_DEVICE_AUTHORIZATION_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910781i32 as _);
    pub const MENROLL_E_DEVICE_CERTIFCATEREQUEST_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910780i32 as _);
    pub const MENROLL_E_DEVICE_CONFIGMGRSERVER_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910779i32 as _);
    pub const MENROLL_E_DEVICE_INTERNALSERVICE_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910778i32 as _);
    pub const MENROLL_E_DEVICE_INVALIDSECURITY_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910777i32 as _);
    pub const MENROLL_E_DEVICE_MANAGEMENT_BLOCKED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910746i32 as _);
    pub const MENROLL_E_DEVICE_MESSAGE_FORMAT_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910783i32 as _);
    pub const MENROLL_E_DEVICE_NOT_ENROLLED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910773i32 as _);
    pub const MENROLL_E_DEVICE_UNKNOWN_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910776i32 as _);
    pub const MENROLL_E_DISCOVERY_SEC_CERT_DATE_INVALID: ::windows::HRESULT =
        ::windows::HRESULT(-2145910771i32 as _);
    pub const MENROLL_E_EMPTY_MESSAGE: ::windows::HRESULT = ::windows::HRESULT(-2145910743i32 as _);
    pub const MENROLL_E_ENROLLMENTDATAINVALID: ::windows::HRESULT =
        ::windows::HRESULT(-2145910759i32 as _);
    pub const MENROLL_E_ENROLLMENT_IN_PROGRESS: ::windows::HRESULT =
        ::windows::HRESULT(-2145910775i32 as _);
    pub const MENROLL_E_INMAINTENANCE: ::windows::HRESULT = ::windows::HRESULT(-2145910761i32 as _);
    pub const MENROLL_E_INSECUREREDIRECT: ::windows::HRESULT =
        ::windows::HRESULT(-2145910758i32 as _);
    pub const MENROLL_E_INVALIDSSLCERT: ::windows::HRESULT =
        ::windows::HRESULT(-2145910766i32 as _);
    pub const MENROLL_E_MDM_NOT_CONFIGURED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910741i32 as _);
    pub const MENROLL_E_NOTELIGIBLETORENEW: ::windows::HRESULT =
        ::windows::HRESULT(-2145910762i32 as _);
    pub const MENROLL_E_NOTSUPPORTED: ::windows::HRESULT = ::windows::HRESULT(-2145910763i32 as _);
    pub const MENROLL_E_PASSWORD_NEEDED: ::windows::HRESULT =
        ::windows::HRESULT(-2145910770i32 as _);
    pub const MENROLL_E_PLATFORM_LICENSE_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910756i32 as _);
    pub const MENROLL_E_PLATFORM_UNKNOWN_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145910755i32 as _);
    pub const MENROLL_E_PLATFORM_WRONG_STATE: ::windows::HRESULT =
        ::windows::HRESULT(-2145910757i32 as _);
    pub const MENROLL_E_PROV_CSP_APPMGMT: ::windows::HRESULT =
        ::windows::HRESULT(-2145910747i32 as _);
    pub const MENROLL_E_PROV_CSP_CERTSTORE: ::windows::HRESULT =
        ::windows::HRESULT(-2145910754i32 as _);
    pub const MENROLL_E_PROV_CSP_DMCLIENT: ::windows::HRESULT =
        ::windows::HRESULT(-2145910752i32 as _);
    pub const MENROLL_E_PROV_CSP_MISC: ::windows::HRESULT = ::windows::HRESULT(-2145910750i32 as _);
    pub const MENROLL_E_PROV_CSP_PFW: ::windows::HRESULT = ::windows::HRESULT(-2145910751i32 as _);
    pub const MENROLL_E_PROV_CSP_W7: ::windows::HRESULT = ::windows::HRESULT(-2145910753i32 as _);
    pub const MENROLL_E_PROV_SSLCERTNOTFOUND: ::windows::HRESULT =
        ::windows::HRESULT(-2145910748i32 as _);
    pub const MENROLL_E_PROV_UNKNOWN: ::windows::HRESULT = ::windows::HRESULT(-2145910749i32 as _);
    pub const MENROLL_E_USERLICENSE: ::windows::HRESULT = ::windows::HRESULT(-2145910760i32 as _);
    pub const MENROLL_E_USER_CANCELED: ::windows::HRESULT = ::windows::HRESULT(-2145910742i32 as _);
    pub const MENROLL_E_WAB_ERROR: ::windows::HRESULT = ::windows::HRESULT(-2145910769i32 as _);
    pub const MENROLL_S_ENROLLMENT_SUSPENDED: ::windows::HRESULT =
        ::windows::HRESULT(1572881i32 as _);
    pub const MREGISTER_E_DEVICE_ALREADY_REGISTERED: ::windows::HRESULT =
        ::windows::HRESULT(-2145845238i32 as _);
    pub const MREGISTER_E_DEVICE_AUTHENTICATION_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845246i32 as _);
    pub const MREGISTER_E_DEVICE_AUTHORIZATION_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845245i32 as _);
    pub const MREGISTER_E_DEVICE_CERTIFCATEREQUEST_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845244i32 as _);
    pub const MREGISTER_E_DEVICE_CONFIGMGRSERVER_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845243i32 as _);
    pub const MREGISTER_E_DEVICE_INTERNALSERVICE_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845242i32 as _);
    pub const MREGISTER_E_DEVICE_INVALIDSECURITY_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845241i32 as _);
    pub const MREGISTER_E_DEVICE_MESSAGE_FORMAT_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845247i32 as _);
    pub const MREGISTER_E_DEVICE_NOT_AD_REGISTERED_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845235i32 as _);
    pub const MREGISTER_E_DEVICE_NOT_REGISTERED: ::windows::HRESULT =
        ::windows::HRESULT(-2145845237i32 as _);
    pub const MREGISTER_E_DEVICE_UNKNOWN_ERROR: ::windows::HRESULT =
        ::windows::HRESULT(-2145845240i32 as _);
    pub const MREGISTER_E_DISCOVERY_FAILED: ::windows::HRESULT =
        ::windows::HRESULT(-2145845234i32 as _);
    pub const MREGISTER_E_DISCOVERY_REDIRECTED: ::windows::HRESULT =
        ::windows::HRESULT(-2145845236i32 as _);
    pub const MREGISTER_E_REGISTRATION_IN_PROGRESS: ::windows::HRESULT =
        ::windows::HRESULT(-2145845239i32 as _);
    #[derive(
        :: std :: cmp :: PartialEq,
        :: std :: cmp :: Eq,
        :: std :: marker :: Copy,
        :: std :: clone :: Clone,
        :: std :: default :: Default,
        :: std :: fmt :: Debug,
    )]
    #[repr(transparent)]
    pub struct REGISTRATION_INFORMATION_CLASS(pub i32);
    pub const DeviceRegistrationBasicInfo: REGISTRATION_INFORMATION_CLASS =
        REGISTRATION_INFORMATION_CLASS(1i32);
    pub const MaxDeviceInfoClass: REGISTRATION_INFORMATION_CLASS =
        REGISTRATION_INFORMATION_CLASS(2i32);
    impl ::std::convert::From<i32> for REGISTRATION_INFORMATION_CLASS {
        fn from(value: i32) -> Self {
            Self(value)
        }
    }
    unsafe impl ::windows::Abi for REGISTRATION_INFORMATION_CLASS {
        type Abi = Self;
        type DefaultType = Self;
    }
    pub unsafe fn RegisterDeviceWithManagement<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
        Param1: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
        Param2: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
    >(
        pszupn: Param0,
        ppszmdmserviceuri: Param1,
        ppzsaccesstoken: Param2,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn RegisterDeviceWithManagement(
                    pszupn: ::windows_win32_foundation::PWSTR,
                    ppszmdmserviceuri: ::windows_win32_foundation::PWSTR,
                    ppzsaccesstoken: ::windows_win32_foundation::PWSTR,
                ) -> ::windows::HRESULT;
            }
            RegisterDeviceWithManagement(
                pszupn.into_param().abi(),
                ppszmdmserviceuri.into_param().abi(),
                ppzsaccesstoken.into_param().abi(),
            )
            .ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn RegisterDeviceWithManagementUsingAADCredentials<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::HANDLE>,
    >(
        usertoken: Param0,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn RegisterDeviceWithManagementUsingAADCredentials(
                    usertoken: ::windows_win32_foundation::HANDLE,
                ) -> ::windows::HRESULT;
            }
            RegisterDeviceWithManagementUsingAADCredentials(usertoken.into_param().abi()).ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn RegisterDeviceWithManagementUsingAADDeviceCredentials() -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn RegisterDeviceWithManagementUsingAADDeviceCredentials() -> ::windows::HRESULT;
            }
            RegisterDeviceWithManagementUsingAADDeviceCredentials().ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn SetManagedExternally<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::BOOL>,
    >(
        ismanagedexternally: Param0,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn SetManagedExternally(
                    ismanagedexternally: ::windows_win32_foundation::BOOL,
                ) -> ::windows::HRESULT;
            }
            SetManagedExternally(ismanagedexternally.into_param().abi()).ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
    pub unsafe fn UnregisterDeviceWithManagement<
        'a,
        Param0: ::windows::IntoParam<'a, ::windows_win32_foundation::PWSTR>,
    >(
        enrollmentid: Param0,
    ) -> ::windows::Result<()> {
        #[cfg(windows)]
        {
            #[link(name = "mdmregistration")]
            extern "system" {
                fn UnregisterDeviceWithManagement(
                    enrollmentid: ::windows_win32_foundation::PWSTR,
                ) -> ::windows::HRESULT;
            }
            UnregisterDeviceWithManagement(enrollmentid.into_param().abi()).ok()
        }
        #[cfg(not(windows))]
        unimplemented!("Unsupported target OS");
    }
}