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
#![allow(non_camel_case_types, non_snake_case)]
use crate::co;
use crate::decl::*;
use crate::macros::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::taskschd::vts::*;
com_interface! { ITaskFolder: "8cfac062-a080-4c15-9a88-aa7c2af80dfc";
/// [`ITaskFolder`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nn-taskschd-itaskfolder)
/// COM interface.
///
/// Automatically calls
/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
}
impl oleaut_IDispatch for ITaskFolder {}
impl taskschd_ITaskFolder for ITaskFolder {}
/// This trait is enabled with the `taskschd` feature, and provides methods for
/// [`ITaskFolder`](crate::ITaskFolder).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait taskschd_ITaskFolder: oleaut_IDispatch {
/// [`ITaskFolder::DeleteTask`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itaskfolder-deletetask)
/// method.
fn DeleteTask(&self, name: &str) -> HrResult<()> {
HrRet(unsafe {
(vt::<ITaskFolderVT>(self).DeleteTask)(
self.ptr(),
BSTR::SysAllocString(name)?.as_ptr(),
0,
)
})
.to_hrresult()
}
fn_com_bstr_get! { get_Name: ITaskFolderVT;
/// [`ITaskFolder::get_Name`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itaskfolder-get_name)
/// method.
}
fn_com_bstr_get! { get_Path: ITaskFolderVT;
/// [`ITaskFolder::get_Path`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itaskfolder-get_path)
/// method.
}
/// [`ITaskFolder::GetTask`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itaskfolder-gettask)
/// method.
fn GetTask(&self, path: &str) -> HrResult<IRegisteredTask> {
let mut queried = unsafe { IRegisteredTask::null() };
HrRet(unsafe {
(vt::<ITaskFolderVT>(self).GetTask)(
self.ptr(),
BSTR::SysAllocString(path)?.as_ptr(),
queried.as_mut(),
)
})
.to_hrresult()
.map(|_| queried)
}
/// [`ITaskFolder::RegisterTaskDefinition`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itaskfolder-registertaskdefinition)
/// method.
fn RegisterTaskDefinition(
&self,
path: Option<&str>,
definition: &impl taskschd_ITaskDefinition,
flags: co::TASK_CREATION,
user_id: Option<&str>,
password: Option<&str>,
logon_type: co::TASK_LOGON,
sddl: Option<VARIANT>,
) -> HrResult<IRegisteredTask> {
let mut queried = unsafe { IRegisteredTask::null() };
HrRet(unsafe {
(vt::<ITaskFolderVT>(self).RegisterTaskDefinition)(
self.ptr(),
BSTR::SysAllocString(path.unwrap_or_default())?.as_ptr(),
definition.ptr(),
flags.raw() as _,
Variant::from_opt_str(user_id).to_raw()?,
Variant::from_opt_str(password).to_raw()?,
logon_type.raw(),
sddl.unwrap_or_default(),
queried.as_mut(),
)
})
.to_hrresult()
.map(|_| queried)
}
}