summaryrefslogtreecommitdiff
path: root/src/win32.rs
blob: 65995a35a2d7dd05335b1cc02762d818fb6a7aa0 (plain)
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
use core::ffi::c_void;
use windows_sys::core::{GUID, PCWSTR};

#[allow(non_snake_case)]
#[allow(non_camel_case_types)]
#[repr(C)]
pub struct SL_LICENSING_STATUS {
    pub SkuId: GUID,
    pub eStatus: i32,
    pub dwGraceTime: u32,
    pub dwTotalGraceDays: u32,
    pub hrReason: i32,
    pub qwValidityExpiration: u64,
}

#[cfg_attr(
    target_arch = "x86",
    link(name = "sppcs", kind = "raw-dylib", import_name_type = "undecorated")
)]
#[cfg_attr(not(target_arch = "x86"), link(name = "sppcs", kind = "raw-dylib"))]
extern "system" {
    pub fn SLGetLicensingStatusInformation(
        hslc: *const c_void,
        pappid: *const GUID,
        pproductskuid: *const GUID,
        pwszrightname: PCWSTR,
        pnstatuscount: *mut u32,
        pplicensingstatus: *mut *mut SL_LICENSING_STATUS,
    ) -> i32;
}

#[cfg_attr(
    target_arch = "x86",
    link(name = "sppcs", kind = "raw-dylib", import_name_type = "undecorated")
)]
#[cfg_attr(not(target_arch = "x86"), link(name = "sppcs", kind = "raw-dylib"))]
extern "system" {
    pub fn SLGetProductSkuInformation(
        hslc: *const c_void,
        pproductskuid: *const GUID,
        pwszvaluename: PCWSTR,
        pedatatype: *mut u32,
        pcbvalue: *mut u32,
        ppbvalue: *mut *mut u8,
    ) -> i32;
}

#[cfg_attr(
    target_arch = "x86",
    link(
        name = "KERNEL32",
        kind = "raw-dylib",
        import_name_type = "undecorated"
    )
)]
#[cfg_attr(not(target_arch = "x86"), link(name = "KERNEL32", kind = "raw-dylib"))]
extern "system" {
    pub fn LocalFree(hmem: *mut c_void) -> *mut c_void;
}

#[cfg_attr(
    target_arch = "x86",
    link(name = "SHLWAPI", kind = "raw-dylib", import_name_type = "undecorated")
)]
#[cfg_attr(not(target_arch = "x86"), link(name = "SHLWAPI", kind = "raw-dylib"))]
extern "system" {
    pub fn StrStrNIW(
        pszfirst: ::windows_sys::core::PCWSTR,
        pszsrch: ::windows_sys::core::PCWSTR,
        cchmax: u32,
    ) -> ::windows_sys::core::PWSTR;
}