Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

ServiceManagementModuleMBS.AllJobDictionaries(domain as string) as Dictionary()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Returns the job description dictionaries for all jobs in the given domain.
Notes:
domain: The desired domain (e.g. kSMDomainSystemLaunchd).

Returns a new array containing all job dictionaries, or empty array if an error occurred. Must be released by the caller.
Available in OS X v10.6 and later.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.CreateAuthorization as AuthorizationMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Creates an authorization for Job operations.
Notes: Creates an authorization with kSMRightBlessPrivilegedHelper and flags InteractionAllowed, PreAuthorize and ExtendRights.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.JobBless(domain as string, executableLabel as string, auth as AuthorizationMBS, byref error as Variant) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Submits the executable for the given label as a launchd job.
Notes:
domain: The job's domain. Only kSMDomainSystemLaunchd is supported.
executableLabel: The label of the privileged executable to install. This label must be one of the keys found in the SMPrivilegedExecutables dictionary in the application's Info.plist.
auth: An authorization reference containing the kSMRightBlessPrivilegedHelper right.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the executable tool, or nil if successful. It is the responsibility of the application to release the error reference.

Returns true if the job was successfully submitted, otherwise false.

JobBless submits the executable for the given label as a launchd job. This function obviates the need for a setuid helper invoked via AuthorizationExecuteWithPrivileges in order to install a launchd plist.

If the job is already installed, success is returned.

In order to use this function the following requirements must be met:

  • The calling application and target executable tool must both be signed.
  • The calling application's Info.plist must include a "SMPrivilegedExecutables" dictionary of strings. Each string is a textual representation of a code signing requirement used to determine whether the application owns the privileged tool once installed (i.e. in order for subsequent versions to update the installed version).

Each key of SMPrivilegedExecutables is a reverse-DNS label for the helper tool (must be globally unique).

  • The helper tool must have an embedded Info.plist containing an "SMAuthorizedClients" array of strings. Each string is a textual representation of a code signing requirement describing a client which is allowed to add and remove the tool.
  • The helper tool must have an embedded launchd plist. The only required key in this plist is the Label key. When the launchd plist is extracted and written to disk, the key for ProgramArguments will be set to an array of 1 element pointing to a standard location. You cannot specify your own program arguments, so do not rely on custom command line arguments being passed to your tool. Pass any parameters via IPC.
  • The helper tool must reside in the Contents/Library/LaunchServices directory inside the application bundle, and its name must be its launchd job label. So if your launchd job label is "com.apple.Mail.helper", this must be the name of the tool in your application bundle.

Available in OS X v10.6 and later.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.JobDictionary(domain as string, jobLabel as string) as Dictionary
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Returns the job description dictionary for the given job label.
Notes:
domain: The job's domain (e.g. kSMDomainSystemLaunchd).
jobLabel: The label identifier for the job to copy.

Return a new dictionary describing the job, or nil if the job could not be found.
Available in OS X v10.6 and later.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.JobRemove(domain as string, jobLabel as string, auth as AuthorizationMBS, wait as boolean, byref error as CFErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Removes the job with the given label from the specified domain.
Notes:
domain: The job's domain (e.g. kSMDomainSystemLaunchd).
jobLabel: The label for the job to remove.
auth: An AuthorizationRef containing the kSMRightModifySystemDaemons right if the given domain is kSMDomainSystemLaunchd.
wait: Pass true to block until the process for the given job has exited.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the job dictionary, or nil if no error occurred. It is the responsibility of the application to release the error reference.

Returns true if the job was removed successfully, otherwise false.

JobSubmit removes the job specified by label from the domain. If the job is currently running, it will conditionally block until the running process has exited.
Available in OS X v10.6 and later.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.JobSubmit(domain as string, job as Dictionary, auth as AuthorizationMBS, byref error as CFErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Submits the given job to the specified domain.
Notes:
domain: The job's domain (e.g. kSMDomainSystemLaunchd).
job: A dictionary describing a job.
auth: An AuthorizationRef containing the kSMRightModifySystemDaemons right if the given domain is kSMDomainSystemLaunchd.
Error: An output reference to a CFErrorMBS describing the specific error encountered while submitting the job dictionary, or NULL if no error occurred. It is the responsibility of the application to release the error reference.

Returns true if the job was submitted successfully, otherwise false.

JobSubmit submits the given job to the specified domain.
Available in OS X v10.6 and later.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.kSMDomainSystemLaunchd as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: System-level launchd domain.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.kSMDomainUserLaunchd as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: User-level launchd domain.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.kSMInfoKeyAuthorizedClients as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Authorized clients property list key.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.kSMInfoKeyPrivilegedExecutables as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 14.2 Yes No No Yes, macOS only No
Function: Privileged executables property list key.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.LoginItemRunning(identifier as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 12.3 Yes No No Yes, macOS only No
Function: Checks whether a login item is running.
Notes: Actually checks if there is a record for your helper, so if it crashed, this returns still true.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.LoginItemSetEnabled(identifier as string, enabled as boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 12.3 Yes No No Yes, macOS only No
Function: Enable a helper application located in the main application bundle's Contents/Library/LoginItems directory.
Notes:
identifier: The bundle identifier of the helper application bundle.
enabled: The Boolean enabled state of the helper application. This value is effective only for the currently logged in user. If true, the helper application will be started immediately (and upon subsequent logins) and kept running. If false, the helper application will no longer be kept running.

Returns true if the requested change has taken effect.

Feedback, Comments & Corrections

ServiceManagementModuleMBS.RegisterHelperApp(name as string, Update as boolean = false) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Login Items MBS MacCF Plugin 12.3 Yes No No Yes, macOS only No
Function: Registers a helper application in the Launch Services database.
Notes:
The app must exist with given name inside the bundle in Library/LoginItems folder.

Update: A Boolean value specifying whether Launch Services should update existing information registered for the application, if any. If this parameter is false, the application will not be registered if it has already been registered previously and its current modification date has not changed from when it was last registered; if the parameter is true, the application's registered information will be updated even if its modification date has not changed.

Returns true on success and false on failure.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCF Plugin.

The biggest plugin in space...




Links
MBS Xojo Plugins