Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/xpcom/ds/nsIWindowsRegKey.idl
//
/// `interface nsIWindowsRegKey : nsISupports`
///
/// ```text
/// /**
/// * This interface is designed to provide scriptable access to the Windows
/// * registry system ("With Great Power Comes Great Responsibility"). The
/// * interface represents a single key in the registry.
/// *
/// * This interface is highly Win32 specific.
/// */
/// ```
///
// 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 nsIWindowsRegKey {
vtable: &'static nsIWindowsRegKeyVTable,
/// 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
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// 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 nsIWindowsRegKey.
unsafe impl XpCom for nsIWindowsRegKey {
const IID: nsIID = nsID(0x2555b930, 0xd64f, 0x437e,
[0x9b, 0xe7, 0x0a, 0x2c, 0xb2, 0x52, 0xc1, 0xf4]);
}
// 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 nsIWindowsRegKey {
#[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 nsIWindowsRegKey.
// 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 nsIWindowsRegKeyCoerce {
/// Cheaply cast a value of this type from a `nsIWindowsRegKey`.
fn coerce_from(v: &nsIWindowsRegKey) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWindowsRegKeyCoerce for nsIWindowsRegKey {
#[inline]
fn coerce_from(v: &nsIWindowsRegKey) -> &Self {
v
}
}
impl nsIWindowsRegKey {
/// Cast this `nsIWindowsRegKey` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWindowsRegKeyCoerce>(&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 nsIWindowsRegKey {
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> nsIWindowsRegKeyCoerce for T {
#[inline]
fn coerce_from(v: &nsIWindowsRegKey) -> &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 nsIWindowsRegKey
// 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 nsIWindowsRegKeyVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void close (); */
pub Close: unsafe extern "system" fn (this: *const nsIWindowsRegKey) -> ::nserror::nsresult,
/* void open (in unsigned long rootKey, in AString relPath, in unsigned long mode); */
pub Open: unsafe extern "system" fn (this: *const nsIWindowsRegKey, rootKey: u32, relPath: *const ::nsstring::nsAString, mode: u32) -> ::nserror::nsresult,
/* void create (in unsigned long rootKey, in AString relPath, in unsigned long mode); */
pub Create: unsafe extern "system" fn (this: *const nsIWindowsRegKey, rootKey: u32, relPath: *const ::nsstring::nsAString, mode: u32) -> ::nserror::nsresult,
/* nsIWindowsRegKey openChild (in AString relPath, in unsigned long mode); */
pub OpenChild: unsafe extern "system" fn (this: *const nsIWindowsRegKey, relPath: *const ::nsstring::nsAString, mode: u32, _retval: *mut *const nsIWindowsRegKey) -> ::nserror::nsresult,
/* nsIWindowsRegKey createChild (in AString relPath, in unsigned long mode); */
pub CreateChild: unsafe extern "system" fn (this: *const nsIWindowsRegKey, relPath: *const ::nsstring::nsAString, mode: u32, _retval: *mut *const nsIWindowsRegKey) -> ::nserror::nsresult,
/* readonly attribute unsigned long childCount; */
pub GetChildCount: unsafe extern "system" fn (this: *const nsIWindowsRegKey, aChildCount: *mut u32) -> ::nserror::nsresult,
/* AString getChildName (in unsigned long index); */
pub GetChildName: unsafe extern "system" fn (this: *const nsIWindowsRegKey, index: u32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* boolean hasChild (in AString name); */
pub HasChild: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult,
/* readonly attribute unsigned long valueCount; */
pub GetValueCount: unsafe extern "system" fn (this: *const nsIWindowsRegKey, aValueCount: *mut u32) -> ::nserror::nsresult,
/* AString getValueName (in unsigned long index); */
pub GetValueName: unsafe extern "system" fn (this: *const nsIWindowsRegKey, index: u32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* boolean hasValue (in AString name); */
pub HasValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult,
/* void removeChild (in AString relPath); */
pub RemoveChild: unsafe extern "system" fn (this: *const nsIWindowsRegKey, relPath: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void removeValue (in AString name); */
pub RemoveValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* unsigned long getValueType (in AString name); */
pub GetValueType: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult,
/* AString readStringValue (in AString name); */
pub ReadStringValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* unsigned long readIntValue (in AString name); */
pub ReadIntValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult,
/* unsigned long long readInt64Value (in AString name); */
pub ReadInt64Value: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut u64) -> ::nserror::nsresult,
/* ACString readBinaryValue (in AString name); */
pub ReadBinaryValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* void writeStringValue (in AString name, in AString data); */
pub WriteStringValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, data: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void writeIntValue (in AString name, in unsigned long data); */
pub WriteIntValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, data: u32) -> ::nserror::nsresult,
/* void writeInt64Value (in AString name, in unsigned long long data); */
pub WriteInt64Value: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, data: u64) -> ::nserror::nsresult,
/* void writeBinaryValue (in AString name, in ACString data); */
pub WriteBinaryValue: unsafe extern "system" fn (this: *const nsIWindowsRegKey, name: *const ::nsstring::nsAString, data: *const ::nsstring::nsACString) -> ::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 nsIWindowsRegKey {
/// ```text
/// /**
/// * Root keys. The values for these keys correspond to the values from
/// * WinReg.h in the MS Platform SDK. The ROOT_KEY_ prefix corresponds to the
/// * HKEY_ prefix in the MS Platform SDK.
/// *
/// * This interface is not restricted to using only these root keys.
/// */
/// ```
///
pub const ROOT_KEY_CLASSES_ROOT: u32 = 2147483648;
pub const ROOT_KEY_CURRENT_USER: u32 = 2147483649;
pub const ROOT_KEY_LOCAL_MACHINE: u32 = 2147483650;
/// ```text
/// /**
/// * Values for the mode parameter passed to the open and create methods.
/// * The values defined here correspond to the REGSAM values defined in
/// * WinNT.h in the MS Platform SDK, where ACCESS_ is replaced with KEY_.
/// *
/// * This interface is not restricted to using only these access types.
/// */
/// ```
///
pub const ACCESS_BASIC: u32 = 131072;
pub const ACCESS_QUERY_VALUE: u32 = 1;
pub const ACCESS_SET_VALUE: u32 = 2;
pub const ACCESS_CREATE_SUB_KEY: u32 = 4;
pub const ACCESS_ENUMERATE_SUB_KEYS: u32 = 8;
pub const ACCESS_NOTIFY: u32 = 16;
pub const ACCESS_READ: u32 = 131097;
pub const ACCESS_WRITE: u32 = 131078;
pub const ACCESS_ALL: u32 = 131103;
pub const WOW64_32: u32 = 512;
pub const WOW64_64: u32 = 256;
/// ```text
/// /**
/// * Values for the type of a registry value. The numeric values of these
/// * constants are taken directly from WinNT.h in the MS Platform SDK.
/// * The Microsoft documentation should be consulted for the exact meaning of
/// * these value types.
/// *
/// * This interface is somewhat restricted to using only these value types.
/// * There is no method that is directly equivalent to RegQueryValueEx or
/// * RegSetValueEx. In particular, this interface does not support the
/// * REG_MULTI_SZ and REG_EXPAND_SZ value types. It is still possible to
/// * enumerate values that have other types (i.e., getValueType may return a
/// * type not defined below).
/// */
/// ```
///
pub const TYPE_NONE: u32 = 0;
pub const TYPE_STRING: u32 = 1;
pub const TYPE_BINARY: u32 = 3;
pub const TYPE_INT: u32 = 4;
pub const TYPE_INT64: u32 = 11;
/// ```text
/// /**
/// * This method closes the key. If the key is already closed, then this
/// * method does nothing.
/// */
/// ```
///
/// `void close ();`
#[inline]
pub unsafe fn Close(&self, ) -> ::nserror::nsresult {
((*self.vtable).Close)(self, )
}
/// ```text
/// /**
/// * This method opens an existing key. This method fails if the key
/// * does not exist.
/// *
/// * NOTE: On 32-bit Windows, it is valid to pass any HKEY as the rootKey
/// * parameter of this function. However, for compatibility with 64-bit
/// * Windows, that usage should probably be avoided in favor of openChild.
/// *
/// * @param rootKey
/// * A root key defined above or any valid HKEY on 32-bit Windows.
/// * @param relPath
/// * A relative path from the given root key.
/// * @param mode
/// * Access mode, which is a bit-wise OR of the ACCESS_ values defined
/// * above.
/// */
/// ```
///
/// `void open (in unsigned long rootKey, in AString relPath, in unsigned long mode);`
#[inline]
pub unsafe fn Open(&self, rootKey: u32, relPath: *const ::nsstring::nsAString, mode: u32) -> ::nserror::nsresult {
((*self.vtable).Open)(self, rootKey, relPath, mode)
}
/// ```text
/// /**
/// * This method opens an existing key or creates a new key.
/// *
/// * NOTE: On 32-bit Windows, it is valid to pass any HKEY as the rootKey
/// * parameter of this function. However, for compatibility with 64-bit
/// * Windows, that usage should probably be avoided in favor of createChild.
/// *
/// * @param rootKey
/// * A root key defined above or any valid HKEY on 32-bit Windows.
/// * @param relPath
/// * A relative path from the given root key.
/// * @param mode
/// * Access mode, which is a bit-wise OR of the ACCESS_ values defined
/// * above.
/// */
/// ```
///
/// `void create (in unsigned long rootKey, in AString relPath, in unsigned long mode);`
#[inline]
pub unsafe fn Create(&self, rootKey: u32, relPath: *const ::nsstring::nsAString, mode: u32) -> ::nserror::nsresult {
((*self.vtable).Create)(self, rootKey, relPath, mode)
}
/// ```text
/// /**
/// * This method opens a subkey relative to this key. This method fails if the
/// * key does not exist.
/// *
/// * @return nsIWindowsRegKey for the newly opened subkey.
/// */
/// ```
///
/// `nsIWindowsRegKey openChild (in AString relPath, in unsigned long mode);`
#[inline]
pub unsafe fn OpenChild(&self, relPath: *const ::nsstring::nsAString, mode: u32, _retval: *mut *const nsIWindowsRegKey) -> ::nserror::nsresult {
((*self.vtable).OpenChild)(self, relPath, mode, _retval)
}
/// ```text
/// /**
/// * This method opens or creates a subkey relative to this key.
/// *
/// * @return nsIWindowsRegKey for the newly opened or created subkey.
/// */
/// ```
///
/// `nsIWindowsRegKey createChild (in AString relPath, in unsigned long mode);`
#[inline]
pub unsafe fn CreateChild(&self, relPath: *const ::nsstring::nsAString, mode: u32, _retval: *mut *const nsIWindowsRegKey) -> ::nserror::nsresult {
((*self.vtable).CreateChild)(self, relPath, mode, _retval)
}
/// ```text
/// /**
/// * This attribute returns the number of child keys.
/// */
/// ```
///
/// `readonly attribute unsigned long childCount;`
#[inline]
pub unsafe fn GetChildCount(&self, aChildCount: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetChildCount)(self, aChildCount)
}
/// ```text
/// /**
/// * This method returns the name of the n'th child key.
/// *
/// * @param index
/// * The index of the requested child key.
/// */
/// ```
///
/// `AString getChildName (in unsigned long index);`
#[inline]
pub unsafe fn GetChildName(&self, index: u32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetChildName)(self, index, _retval)
}
/// ```text
/// /**
/// * This method checks to see if the key has a child by the given name.
/// *
/// * @param name
/// * The name of the requested child key.
/// */
/// ```
///
/// `boolean hasChild (in AString name);`
#[inline]
pub unsafe fn HasChild(&self, name: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).HasChild)(self, name, _retval)
}
/// ```text
/// /**
/// * This attribute returns the number of values under this key.
/// */
/// ```
///
/// `readonly attribute unsigned long valueCount;`
#[inline]
pub unsafe fn GetValueCount(&self, aValueCount: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetValueCount)(self, aValueCount)
}
/// ```text
/// /**
/// * This method returns the name of the n'th value under this key.
/// *
/// * @param index
/// * The index of the requested value.
/// */
/// ```
///
/// `AString getValueName (in unsigned long index);`
#[inline]
pub unsafe fn GetValueName(&self, index: u32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetValueName)(self, index, _retval)
}
/// ```text
/// /**
/// * This method checks to see if the key has a value by the given name.
/// *
/// * @param name
/// * The name of the requested value.
/// */
/// ```
///
/// `boolean hasValue (in AString name);`
#[inline]
pub unsafe fn HasValue(&self, name: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).HasValue)(self, name, _retval)
}
/// ```text
/// /**
/// * This method removes a child key and all of its values. This method will
/// * fail if the key has any children of its own.
/// *
/// * @param relPath
/// * The relative path from this key to the key to be removed.
/// */
/// ```
///
/// `void removeChild (in AString relPath);`
#[inline]
pub unsafe fn RemoveChild(&self, relPath: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).RemoveChild)(self, relPath)
}
/// ```text
/// /**
/// * This method removes the value with the given name.
/// *
/// * @param name
/// * The name of the value to be removed.
/// */
/// ```
///
/// `void removeValue (in AString name);`
#[inline]
pub unsafe fn RemoveValue(&self, name: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).RemoveValue)(self, name)
}
/// ```text
/// /**
/// * This method returns the type of the value with the given name. The return
/// * value is one of the "TYPE_" constants defined above.
/// *
/// * @param name
/// * The name of the value to query.
/// */
/// ```
///
/// `unsigned long getValueType (in AString name);`
#[inline]
pub unsafe fn GetValueType(&self, name: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetValueType)(self, name, _retval)
}
/// ```text
/// /**
/// * This method reads the string contents of the named value as a Unicode
/// * string.
/// *
/// * @param name
/// * The name of the value to query. This parameter can be the empty
/// * string to request the key's default value.
/// */
/// ```
///
/// `AString readStringValue (in AString name);`
#[inline]
pub unsafe fn ReadStringValue(&self, name: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).ReadStringValue)(self, name, _retval)
}
/// ```text
/// /**
/// * This method reads the integer contents of the named value.
/// *
/// * @param name
/// * The name of the value to query.
/// */
/// ```
///
/// `unsigned long readIntValue (in AString name);`
#[inline]
pub unsafe fn ReadIntValue(&self, name: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult {
((*self.vtable).ReadIntValue)(self, name, _retval)
}
/// ```text
/// /**
/// * This method reads the 64-bit integer contents of the named value.
/// *
/// * @param name
/// * The name of the value to query.
/// */
/// ```
///
/// `unsigned long long readInt64Value (in AString name);`
#[inline]
pub unsafe fn ReadInt64Value(&self, name: *const ::nsstring::nsAString, _retval: *mut u64) -> ::nserror::nsresult {
((*self.vtable).ReadInt64Value)(self, name, _retval)
}
/// ```text
/// /**
/// * This method reads the binary contents of the named value under this key.
/// *
/// * JavaScript callers should take care with the result of this method since
/// * it will be byte-expanded to form a JS string. (The binary data will be
/// * treated as an ISO-Latin-1 character string, which it is not).
/// *
/// * @param name
/// * The name of the value to query.
/// */
/// ```
///
/// `ACString readBinaryValue (in AString name);`
#[inline]
pub unsafe fn ReadBinaryValue(&self, name: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).ReadBinaryValue)(self, name, _retval)
}
/// ```text
/// /**
/// * This method writes the unicode string contents of the named value. The
/// * value will be created if it does not already exist.
/// *
/// * @param name
/// * The name of the value to modify. This parameter can be the empty
/// * string to modify the key's default value.
/// * @param data
/// * The data for the value to modify.
/// */
/// ```
///
/// `void writeStringValue (in AString name, in AString data);`
#[inline]
pub unsafe fn WriteStringValue(&self, name: *const ::nsstring::nsAString, data: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).WriteStringValue)(self, name, data)
}
/// ```text
/// /**
/// * This method writes the integer contents of the named value. The value
/// * will be created if it does not already exist.
/// *
/// * @param name
/// * The name of the value to modify.
/// * @param data
/// * The data for the value to modify.
/// */
/// ```
///
/// `void writeIntValue (in AString name, in unsigned long data);`
#[inline]
pub unsafe fn WriteIntValue(&self, name: *const ::nsstring::nsAString, data: u32) -> ::nserror::nsresult {
((*self.vtable).WriteIntValue)(self, name, data)
}
/// ```text
/// /**
/// * This method writes the 64-bit integer contents of the named value. The
/// * value will be created if it does not already exist.
/// *
/// * @param name
/// * The name of the value to modify.
/// * @param data
/// * The data for the value to modify.
/// */
/// ```
///
/// `void writeInt64Value (in AString name, in unsigned long long data);`
#[inline]
pub unsafe fn WriteInt64Value(&self, name: *const ::nsstring::nsAString, data: u64) -> ::nserror::nsresult {
((*self.vtable).WriteInt64Value)(self, name, data)
}
/// ```text
/// /**
/// * This method writes the binary contents of the named value. The value will
/// * be created if it does not already exist.
/// *
/// * JavaScript callers should take care with the value passed to this method
/// * since it will be truncated from a JS string (unicode) to a ISO-Latin-1
/// * string. (The binary data will be treated as an ISO-Latin-1 character
/// * string, which it is not). So, JavaScript callers should only pass
/// * character values in the range \u0000 to \u00FF, or else data loss will
/// * occur.
/// *
/// * @param name
/// * The name of the value to modify.
/// * @param data
/// * The data for the value to modify.
/// */
/// ```
///
/// `void writeBinaryValue (in AString name, in ACString data);`
#[inline]
pub unsafe fn WriteBinaryValue(&self, name: *const ::nsstring::nsAString, data: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).WriteBinaryValue)(self, name, data)
}
}