Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/components/taskscheduler/nsIWinTaskSchedulerService.idl
//
/// `interface nsIWinTaskSchedulerService : nsISupports`
///
/// ```text
/// /**
/// * An interface for Windows Task Scheduler 2.0.
/// * Documentation for the underlying APIs can be found at
/// */
/// ```
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsIWinTaskSchedulerService {
vtable: &'static nsIWinTaskSchedulerServiceVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIWinTaskSchedulerService.
unsafe impl XpCom for nsIWinTaskSchedulerService {
const IID: nsIID = nsID(0xa8d36901, 0x0b6a, 0x46c3,
[0xa2, 0x14, 0xa9, 0xe1, 0xd5, 0xd6, 0x04, 0x7a]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIWinTaskSchedulerService {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsIWinTaskSchedulerService.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIWinTaskSchedulerServiceCoerce {
/// Cheaply cast a value of this type from a `nsIWinTaskSchedulerService`.
fn coerce_from(v: &nsIWinTaskSchedulerService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWinTaskSchedulerServiceCoerce for nsIWinTaskSchedulerService {
#[inline]
fn coerce_from(v: &nsIWinTaskSchedulerService) -> &Self {
v
}
}
impl nsIWinTaskSchedulerService {
/// Cast this `nsIWinTaskSchedulerService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWinTaskSchedulerServiceCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIWinTaskSchedulerService {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIWinTaskSchedulerServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsIWinTaskSchedulerService) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIWinTaskSchedulerService
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIWinTaskSchedulerServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void registerTask (in wstring aFolderName, in wstring aTaskName, in wstring aDefinitionXML, [optional] in boolean aUpdateExisting); */
pub RegisterTask: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aFolderName: *const u16, aTaskName: *const u16, aDefinitionXML: *const u16, aUpdateExisting: bool) -> ::nserror::nsresult,
/* long validateTaskDefinition (in wstring aDefinitionXML); */
pub ValidateTaskDefinition: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aDefinitionXML: *const u16, _retval: *mut i32) -> ::nserror::nsresult,
/* AString getTaskXML (in wstring aFolderName, in wstring aTaskName); */
pub GetTaskXML: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aFolderName: *const u16, aTaskName: *const u16, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* AString getCurrentUserSid (); */
pub GetCurrentUserSid: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* void deleteTask (in wstring aFolderName, in wstring aTaskName); */
pub DeleteTask: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aFolderName: *const u16, aTaskName: *const u16) -> ::nserror::nsresult,
/* Array<AString> getFolderTasks (in wstring aFolderName); */
pub GetFolderTasks: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aFolderName: *const u16, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult,
/* void createFolder (in wstring aParentFolderName, in wstring aSubFolderName); */
pub CreateFolder: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aParentFolderName: *const u16, aSubFolderName: *const u16) -> ::nserror::nsresult,
/* void deleteFolder (in wstring aParentFolderName, in wstring aSubFolderName); */
pub DeleteFolder: unsafe extern "system" fn (this: *const nsIWinTaskSchedulerService, aParentFolderName: *const u16, aSubFolderName: *const u16) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIWinTaskSchedulerService {
/// ```text
/// /**
/// * Register (create) a task from an XML definition.
/// * The task will be created so that it only runs as the current user
/// * (TASK_LOGON_INTERACTIVE_TOKEN).
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the folder does not exist.
/// * @throws NS_ERROR_FILE_ALREADY_EXISTS if the task already existed and aUpdateExisting is false.
/// *
/// * @param aFolderName Full name of the folder in which to create the task, starting with "\".
/// *
/// * @param aTaskName Name of the task.
/// *
/// * @param aDefinitionXML XML definition of the task. This is passed directly to Task Scheduler,
/// * see the schema at
/// *
/// * @param aUpdateExisting Whether to update an existing task with the same name, default false.
/// */
/// ```
///
/// `void registerTask (in wstring aFolderName, in wstring aTaskName, in wstring aDefinitionXML, [optional] in boolean aUpdateExisting);`
#[inline]
pub unsafe fn RegisterTask(&self, aFolderName: *const u16, aTaskName: *const u16, aDefinitionXML: *const u16, aUpdateExisting: bool) -> ::nserror::nsresult {
((*self.vtable).RegisterTask)(self, aFolderName, aTaskName, aDefinitionXML, aUpdateExisting)
}
/// ```text
/// /**
/// * Validate the XML task definition with Task Scheduler without creating a task, for testing.
/// * Doesn't throw if only the final ITaskFolder::RegisterTask() fails.
/// *
/// * @param aDefinitionXML Definition to validate.
/// * @return HRESULT from ITaskFolder::RegisterTask()
/// * Success should be S_OK (0). XML validation failure could be one of
/// * SCHED_E_UNEXPECTED_NODE, SCHED_E_NAMESPACE, SCHED_E_INVALIDVALUE,
/// * SCHED_E_MISSINGNODE, SCHED_E_MALFORMEDXML, but there may be others.
/// */
/// ```
///
/// `long validateTaskDefinition (in wstring aDefinitionXML);`
#[inline]
pub unsafe fn ValidateTaskDefinition(&self, aDefinitionXML: *const u16, _retval: *mut i32) -> ::nserror::nsresult {
((*self.vtable).ValidateTaskDefinition)(self, aDefinitionXML, _retval)
}
/// ```text
/// /**
/// * Get the registration information for a task.
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the folder or task do not exist.
/// *
/// * @param aFolderName Full name of the folder containing the task, starting with "\".
/// * @param aTaskName Name of the task to read.
/// * @return Registration information for the task, as XML text.
/// */
/// ```
///
/// `AString getTaskXML (in wstring aFolderName, in wstring aTaskName);`
#[inline]
pub unsafe fn GetTaskXML(&self, aFolderName: *const u16, aTaskName: *const u16, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetTaskXML)(self, aFolderName, aTaskName, _retval)
}
/// ```text
/// /**
/// * Gets the sid of the current user.
/// *
/// * @throws NS_ERROR_NOT_IMPLEMENTED If called on a non-Windows OS.
/// * @throws NS_ERROR_FAILURE If the user token cannot be found.
/// * @throws NS_ERROR_ABORT If converting the sid to a string fails.
/// *
/// * @returns The sid of the current user.
/// */
/// ```
///
/// `AString getCurrentUserSid ();`
#[inline]
pub unsafe fn GetCurrentUserSid(&self, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetCurrentUserSid)(self, _retval)
}
/// ```text
/// /**
/// * Delete a task.
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the folder or task do not exist.
/// *
/// * @param aFolderName Full name of the folder containing the task, starting with "\".
/// * @param aTaskName Name of the task to delete.
/// */
/// ```
///
/// `void deleteTask (in wstring aFolderName, in wstring aTaskName);`
#[inline]
pub unsafe fn DeleteTask(&self, aFolderName: *const u16, aTaskName: *const u16) -> ::nserror::nsresult {
((*self.vtable).DeleteTask)(self, aFolderName, aTaskName)
}
/// ```text
/// /**
/// * List the names of all tasks in a task folder.
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the folder doesn't exist.
/// *
/// * @param aFolderName The full name of the task folder to enumerate, starting with "\".
/// *
/// * @return An array with the names of the tasks found.
/// */
/// ```
///
/// `Array<AString> getFolderTasks (in wstring aFolderName);`
#[inline]
pub unsafe fn GetFolderTasks(&self, aFolderName: *const u16, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult {
((*self.vtable).GetFolderTasks)(self, aFolderName, _retval)
}
/// ```text
/// /**
/// * Create a new task subfolder under a given parent folder.
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the parent folder does not exist.
/// * @throws NS_ERROR_FILE_ALREADY_EXISTS if the subfolder already exists.
/// *
/// * @param aParentFolderName Immediate parent for the new folder, starting with "\".
/// * @param aSubFolderName Name of the new folder to create.
/// */
/// ```
///
/// `void createFolder (in wstring aParentFolderName, in wstring aSubFolderName);`
#[inline]
pub unsafe fn CreateFolder(&self, aParentFolderName: *const u16, aSubFolderName: *const u16) -> ::nserror::nsresult {
((*self.vtable).CreateFolder)(self, aParentFolderName, aSubFolderName)
}
/// ```text
/// /**
/// * Delete a folder.
/// *
/// * @throws NS_ERROR_FILE_NOT_FOUND if the parent folder does not exist.
/// * @throws NS_ERROR_FILE_DIR_NOT_EMPTY if the folder was not empty.
/// *
/// * @param aParentFolderName Immediate parent of the folder to delete, starting with "\".
/// * @param aSubFolderName Name of the folder to delete.
/// */
/// ```
///
/// `void deleteFolder (in wstring aParentFolderName, in wstring aSubFolderName);`
#[inline]
pub unsafe fn DeleteFolder(&self, aParentFolderName: *const u16, aSubFolderName: *const u16) -> ::nserror::nsresult {
((*self.vtable).DeleteFolder)(self, aParentFolderName, aSubFolderName)
}
}