IOsInfo2#

Fully qualified name: omni::platforminfo::IOsInfo2

Defined in omni/platforminfo/IOsInfo2.h

class IOsInfo2 : public omni::core::Generated<omni::platforminfo::IOsInfo2_abi>#

Extended interface to collect and retrieve more information about the operating system.

This inherits from omni::platforminfo::IOsInfo and also provides all of its functionality.

Public Functions

inline uint64_t getMachineId(
const char *extraData = nullptr,
MachineIdFlags flags = fMachineIdFlagDefault,
) noexcept#

Generates a repeatable machine ID with the current algorithm.

See also

See omni::platforminfo::IOsInfo2::getMachineIdEx() for more information on the usage of this function.

Parameters:
  • extraData[in] A caller provided null terminated string containing extra information to include in the machine ID calculation. This can be used to make the generated machine ID more unique to the specific user or device. This may be nullptr if no extra information is needed.

  • flags[in] Flags to control how the machine ID is generated. In most cases this should only pass in the omni::platforminfo::fMachineIdFlagDefault flag. Note that using different flags will also change the value of the generated machine ID.

Returns:

A 64-bit integer representing the generated machine ID on success. Returns 0 if the requested version number is out of range of what the current version of the plugin can provide.

inline bool isCompatibilityModeEnabled() noexcept#

[Windows] Tests whether this process is running under compatibility mode.

Remark

Windows 10 and up allow a way for apps to run in ‘compatibility mode’. This causes many of the OS version functions to return values that represent an older version of windows (ie: Win8.1 and earlier) instead of the actual version information. This can allow some apps that don’t fully support Win10 and up to start properly.

Returns:

true if this process is running in compatibility mode for an older version of Windows. Returns false otherwise. Returns false on all non-Windows platforms.

inline uint64_t getMachineIdEx(
const char *extraData,
omni::platforminfo::MachineIdFlags flags,
omni::platforminfo::MachineIdVersion version,
) noexcept#

Generates a repeatable machine ID.

Remark

This generates a machine ID value that can be used to describe or identify the calling machine in an anonymous way. The returned machine ID will be a hash of the names of various hardware components and OS version information, plus the provided extra data. Even if the current user’s personal information is included in this hash through the extraData string, it will not be recoverable since both the remainder and order of the information included in the hash will be implementation specific and not fully known externally.

Note

When generated without using any of the flags that make the machine ID unique, the generated value can be safely cached for a given extraData value since future attempts to generate it with the same value will yield the same result.

Note

The value of the generated machine ID will change from one run to the next on the same machine if certain hardware is changed (ie: new CPU, memory upgrade, new graphics adapter, etc) or the OS is upgraded. This is expected behavior.

Parameters:
  • extraData[in] A caller provided null terminated string containing extra information to include in the machine ID calculation. This can be used to make the generated machine ID more unique to the specific user or device. This may be nullptr if no extra information is needed.

  • flags[in] Flags to control how the machine ID is generated. In most cases this should only pass in the omni::platforminfo::fMachineIdFlagDefault flag. Note that using different flags will also change the value of the generated machine ID.

  • version[in] The version of the machine ID to generate. This should be omni::platforminfo::kMachineIdCurrent in most cases. Though note that the generated machine ID may change from one version to the next. If this version number is out of the range of what is supported by the current plugin version, a machine ID of 0 will be returned instead.

Returns:

A 64-bit integer representing the generated machine ID on success. Returns 0 if the requested version number is out of range of what the current version of the plugin can provide.

inline omni::platforminfo::Architecture getArchitecture() noexcept#

Retrieves the processor architecture for this platform.

Thread Safety

This call is thread safe.

Returns:

An architecture name. This will never be omni::platforminfo::Architecture::eUnknown.

inline omni::platforminfo::Os getOs() noexcept#

Retrieves an identifier for the current platform.

Thread Safety

This call is thread safe.

Returns:

An operating system name. This will never be omni::platforminfo::Os::eUnknown.

inline omni::platforminfo::OsVersion getOsVersion() noexcept#

Retrieves the OS version information.

Thread Safety

This call is thread safe.

Returns:

The operating system version numbers. These will be retrieved from the system as directly as possible. If possible, these will not be parsed from a string version of the operating system’s name.

inline omni::platforminfo::CompositorInfo getCompositorInfo(
) noexcept#

Retrieves the name and version information for the system compositor.

Thread Safety

This call is thread safe.

Returns:

An object describing the active compositor.

inline const char *getPrettyName() noexcept#

Retrieves the friendly printable name of the operating system.

Thread Safety

This call is thread safe.

Returns:

A string describing the operating system. This is retrieved from the system and does not necessarily follow any specific formatting. This may or may not contain specific version information. This string is intended for display to users.

inline const char *getName() noexcept#

Retrieves the name of the operating system.

Thread Safety

This call is thread safe.

Returns:

A string describing the operating system. This is retrieved from the system if possible and does not necessarily follow any specific formatting. This may include different information than the ‘pretty’ name (though still identifying the same operating system version). This string is more intended for logging or parsing purposes than display to the user.

inline const char *getDistroName() noexcept#

Retrieves the operating system distribution name.

Thread Safety

This call is thread safe.

Returns:

The operating system distribution name. For Windows 10 and up, this often contains the build’s version name (ie: v1909). For Linux, this contains the distro name (ie: “Ubuntu”, “Gentoo”, etc).

inline const char *getCodeName() noexcept#

Retrieves the operating system’s build code name.

Thread Safety

This call is thread safe.

Returns:

The code name of the operating system’s current version. For Windows 10 and up, this is the Microsoft internal code name for each release (ie: “RedStone 5”, “21H2”, etc). If possible it will be retrieved from the system. If not available, a best guess will be made based on the build version number. For Linux, this will be the build name of the current installed version (ie: “Bionic”, “Xenial”, etc).

inline const char *getKernelVersion() noexcept#

Retrieves the operating system’s kernel version as a string.

Returns:

A string containing the OS’s kernel version information. There is no standard layout for a kernel version across platforms so this isn’t split up into a struct of numeric values. For example, Linux kernel versions often contain major-minor-hotfix-build_number-string components whereas Mac OS is typically just major-minor-hotfix. Windows kernel versions are also often four values. This is strictly for informational purposes. Splitting this up into numerical components is left as an exercise for the caller if needed.

inline void *cast(omni::core::TypeId id) noexcept#

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void acquire() noexcept#

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept#

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

Protected Functions

virtual bool isCompatibilityModeEnabled_abi() noexcept = 0#

[Windows] Tests whether this process is running under compatibility mode.

Remark

Windows 10 and up allow a way for apps to run in ‘compatibility mode’. This causes many of the OS version functions to return values that represent an older version of windows (ie: Win8.1 and earlier) instead of the actual version information. This can allow some apps that don’t fully support Win10 and up to start properly.

Returns:

true if this process is running in compatibility mode for an older version of Windows. Returns false otherwise. Returns false on all non-Windows platforms.

virtual uint64_t getMachineIdEx_abi(
const char *extraData,
MachineIdFlags flags,
MachineIdVersion version,
) noexcept = 0#

Generates a repeatable machine ID.

Remark

This generates a machine ID value that can be used to describe or identify the calling machine in an anonymous way. The returned machine ID will be a hash of the names of various hardware components and OS version information, plus the provided extra data. Even if the current user’s personal information is included in this hash through the extraData string, it will not be recoverable since both the remainder and order of the information included in the hash will be implementation specific and not fully known externally.

Note

When generated without using any of the flags that make the machine ID unique, the generated value can be safely cached for a given extraData value since future attempts to generate it with the same value will yield the same result.

Note

The value of the generated machine ID will change from one run to the next on the same machine if certain hardware is changed (ie: new CPU, memory upgrade, new graphics adapter, etc) or the OS is upgraded. This is expected behavior.

Parameters:
  • extraData[in] A caller provided null terminated string containing extra information to include in the machine ID calculation. This can be used to make the generated machine ID more unique to the specific user or device. This may be nullptr if no extra information is needed.

  • flags[in] Flags to control how the machine ID is generated. In most cases this should only pass in the omni::platforminfo::fMachineIdFlagDefault flag. Note that using different flags will also change the value of the generated machine ID.

  • version[in] The version of the machine ID to generate. This should be omni::platforminfo::kMachineIdCurrent in most cases. Though note that the generated machine ID may change from one version to the next. If this version number is out of the range of what is supported by the current plugin version, a machine ID of 0 will be returned instead.

Returns:

A 64-bit integer representing the generated machine ID on success. Returns 0 if the requested version number is out of range of what the current version of the plugin can provide.

virtual Architecture getArchitecture_abi() noexcept = 0#

Retrieves the processor architecture for this platform.

Thread Safety

This call is thread safe.

Returns:

An architecture name. This will never be omni::platforminfo::Architecture::eUnknown.

virtual Os getOs_abi() noexcept = 0#

Retrieves an identifier for the current platform.

Thread Safety

This call is thread safe.

Returns:

An operating system name. This will never be omni::platforminfo::Os::eUnknown.

virtual OsVersion getOsVersion_abi() noexcept = 0#

Retrieves the OS version information.

Thread Safety

This call is thread safe.

Returns:

The operating system version numbers. These will be retrieved from the system as directly as possible. If possible, these will not be parsed from a string version of the operating system’s name.

virtual CompositorInfo getCompositorInfo_abi() noexcept = 0#

Retrieves the name and version information for the system compositor.

Thread Safety

This call is thread safe.

Returns:

An object describing the active compositor.

virtual const char *getPrettyName_abi() noexcept = 0#

Retrieves the friendly printable name of the operating system.

Thread Safety

This call is thread safe.

Returns:

A string describing the operating system. This is retrieved from the system and does not necessarily follow any specific formatting. This may or may not contain specific version information. This string is intended for display to users.

virtual const char *getName_abi() noexcept = 0#

Retrieves the name of the operating system.

Thread Safety

This call is thread safe.

Returns:

A string describing the operating system. This is retrieved from the system if possible and does not necessarily follow any specific formatting. This may include different information than the ‘pretty’ name (though still identifying the same operating system version). This string is more intended for logging or parsing purposes than display to the user.

virtual const char *getDistroName_abi() noexcept = 0#

Retrieves the operating system distribution name.

Thread Safety

This call is thread safe.

Returns:

The operating system distribution name. For Windows 10 and up, this often contains the build’s version name (ie: v1909). For Linux, this contains the distro name (ie: “Ubuntu”, “Gentoo”, etc).

virtual const char *getCodeName_abi() noexcept = 0#

Retrieves the operating system’s build code name.

Thread Safety

This call is thread safe.

Returns:

The code name of the operating system’s current version. For Windows 10 and up, this is the Microsoft internal code name for each release (ie: “RedStone 5”, “21H2”, etc). If possible it will be retrieved from the system. If not available, a best guess will be made based on the build version number. For Linux, this will be the build name of the current installed version (ie: “Bionic”, “Xenial”, etc).

virtual const char *getKernelVersion_abi() noexcept = 0#

Retrieves the operating system’s kernel version as a string.

Returns:

A string containing the OS’s kernel version information. There is no standard layout for a kernel version across platforms so this isn’t split up into a struct of numeric values. For example, Linux kernel versions often contain major-minor-hotfix-build_number-string components whereas Mac OS is typically just major-minor-hotfix. Windows kernel versions are also often four values. This is strictly for informational purposes. Splitting this up into numerical components is left as an exercise for the caller if needed.

virtual void *cast_abi(TypeId id) noexcept = 0#

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

virtual void acquire_abi() noexcept = 0#

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

virtual void release_abi() noexcept = 0#

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.