<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to ShellServiceFunctions</title><link>https://sourceforge.net/p/uisdk/wiki/ShellServiceFunctions/</link><description>Recent changes to ShellServiceFunctions</description><atom:link href="https://sourceforge.net/p/uisdk/wiki/ShellServiceFunctions/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 16 Jul 2013 01:50:44 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/uisdk/wiki/ShellServiceFunctions/feed" rel="self" type="application/rss+xml"/><item><title>ShellServiceFunctions modified by &lt;REDACTED&gt;</title><link>https://sourceforge.net/p/uisdk/wiki/ShellServiceFunctions/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="shell-process-and-service-functions"&gt;Shell, Process and Service functions&lt;/h1&gt;
&lt;p&gt;&lt;b&gt;wbc.launchAppEx&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Launch a new application, command line utility, etc. in a new process.&lt;/li&gt;
&lt;li&gt;Threading: foreground/immediate, with background timeout listener.&lt;/li&gt;
&lt;li&gt;Function: wbc.launchAppEx(fileSpec, arguments, callback, isHidden, timeout)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;fileSpec: String. Full path and file name of executable to be launched.&lt;/li&gt;
&lt;li&gt;arguments: String. Command line arguments to pass to the executable being launched.&lt;/li&gt;
&lt;li&gt;callback: Optional. Bound JS function to be called on timeout, when the process terminates, or when wbc.closeThread() is called on the listening thread.&lt;/li&gt;
&lt;li&gt;isHidden: Optional. If true, the process will be launched hidden.&lt;/li&gt;
&lt;li&gt;timeout: Optional. Number of milliseconds to wait for process termination. If specified the callback will be called after this amount of time, even if the process is still running.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;OK/INVALID (bad arguments)/ERROR (invalid path, unable to create process. etc).&lt;/li&gt;
&lt;li&gt;If a callback was specified, the thread ID of the listening thread.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;A simpler version of this function is available: launchApp(fileSpec, arguments).&lt;/li&gt;
&lt;li&gt;Optional arguments must be set to 'null' if not required.&lt;/li&gt;
&lt;li&gt;If the callback parameter is set, the callback will return an evt object with the following properties. &lt;ul&gt;
&lt;li&gt;string func: internal function name ('uisdk_LaunchApp')&lt;/li&gt;
&lt;li&gt;int threadId: the thread ID of the listening thread.&lt;/li&gt;
&lt;li&gt;string status: the thread status (can be either 'OK' - the thread was finished successfully, and 'ERROR' - the thread was terminated by the uisdk_CloseThread function)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;string appPath: the full path to the executable&lt;/li&gt;
&lt;li&gt;string parameters: the command line arguments of the new process, if any&lt;/li&gt;
&lt;li&gt;int timeout: the timeout value&lt;/li&gt;
&lt;li&gt;bool isTimedOut: 'true' if the callback was called as a result of timeout elapsed, and 'false' - otherwise&lt;/li&gt;
&lt;li&gt;int processId: the process ID of the target process&lt;/li&gt;
&lt;li&gt;int exitCode: the exit code of the target process. In case the process is still running, the exit code is equal to 259 - a special exit code meaning that the process is not finished yet.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.launchConsoleApp&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Launch a command line application in 'interactive mode'&lt;/li&gt;
&lt;li&gt;Threading: Foreground/immediate with background listener.&lt;/li&gt;
&lt;li&gt;Function: wbc.launchConsoleApp(fileSpec, args, callback)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;fileSpec: The path to the process to be launched.&lt;/li&gt;
&lt;li&gt;args: Command line arguments with which to launch the process.&lt;/li&gt;
&lt;li&gt;callback: Bound JS function receiving an evt object. This object has the following properties: &lt;/li&gt;
&lt;li&gt;string func - equal to 'uisdk_LaunchConsoleApp'&lt;/li&gt;
&lt;li&gt;integer threadId - the WBC thread ID&lt;/li&gt;
&lt;li&gt;string appPath - the full path to the executable (the one that was passed to the original uisdk_LaunchApp function)&lt;/li&gt;
&lt;li&gt;string parameters - the parameters that was passed to the original uisdk_LaunchApp&lt;/li&gt;
&lt;li&gt;string status - the thread status. Can be one of the following: &lt;br /&gt;
        * 'OK' - the thread was finished successfully (i.e. - console process finished)&lt;ul&gt;
&lt;li&gt;'ERROR' - the thread was terminated by the uisdk_CloseThread, or an internal error occured while processing the STDOUT outputs from the process (the 'errorDesc' field of the callback object may contain the details about the error&lt;/li&gt;
&lt;li&gt;'BUSY' - the process is working, and the 'stdOut' field of the callback object contains the textual data printed by the console application to STDOUT or STDERR.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;string errorDesc - the error description (in case the status 'ERROR)&lt;/li&gt;
&lt;li&gt;int processId - the process ID of the target process&lt;/li&gt;
&lt;li&gt;int exitCode - the exit code of the target process. In case the process is still running, the exit code is equal to 259 - a special exit code meaning that the process is not finished yet.&lt;/li&gt;
&lt;li&gt;string stdOut - the next portion of the data that was printed by the console to STDOUT or STDERR streams (current only if status remains'BUSY')&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;ERROR/INVALID&lt;/li&gt;
&lt;li&gt;Thread ID of monitoring thread.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;In conjunction with writeStdIn, this function can be used to control and interact with many command line programs.&lt;/li&gt;
&lt;li&gt;For example, an FTP shell, some terminal programs, ping, traceroute, etc..&lt;/li&gt;
&lt;li&gt;This includes programs that prompt (deterministically) for user input, by writing the response to STDIN via writeStdIn&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.writeStdIn&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Companion function to launchConsoleApp that writes to STDIN for the specified process.&lt;/li&gt;
&lt;li&gt;Threading: Foreground/immediate.&lt;/li&gt;
&lt;li&gt;Function: wbc.writeStdIn(threadId, inputText)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;threadId: The thread id returned by launchConsoleApp when the process was launched.&lt;/li&gt;
&lt;li&gt;inputText: Text to send to the console input (for example to send Y+ENTER, pass 'Y\r\n');&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;OK/ERROR/INVALID&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes: None&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.listServices&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Retrieves a list of services currently detected on the system.&lt;/li&gt;
&lt;li&gt;Threading: foreground/blocking&lt;/li&gt;
&lt;li&gt;Function: wbc.listServices()&lt;/li&gt;
&lt;li&gt;Arguments: None&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;ERROR/NOPLUGIN&lt;/li&gt;
&lt;li&gt;If successful, returns an array of objects, each representing a service and having the following properties: &lt;/li&gt;
&lt;li&gt;string serviceName: internal service name&lt;/li&gt;
&lt;li&gt;string displayName: the display name of the service.&lt;/li&gt;
&lt;li&gt;int processId: service PID&lt;/li&gt;
&lt;li&gt;string state: the current state of the service. This can be one of the following string values: &lt;ul&gt;
&lt;li&gt;"STOPPED": the service is not running&lt;/li&gt;
&lt;li&gt;"START_PENDING": the service is starting&lt;/li&gt;
&lt;li&gt;"STOP_PENDING": the service is stopping&lt;/li&gt;
&lt;li&gt;"RUNNING": the service is running&lt;/li&gt;
&lt;li&gt;"CONTINUE_PENDING": the service continue is pending&lt;/li&gt;
&lt;li&gt;"PAUSE_PENDING": the service pause is pending&lt;/li&gt;
&lt;li&gt;"PAUSED": the service is paused&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes &lt;ul&gt;
&lt;li&gt;The ServiceManager.dll plugin must be loaded in order for this function to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.queryServiceConfig&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Query the configuration of a specific service.&lt;/li&gt;
&lt;li&gt;Threading: foreground/blocking&lt;/li&gt;
&lt;li&gt;Function: wbc.queryServiceConfig(serviceName)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;serviceName: The internal name of the service.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;NOPLUGIN: ServiceManager.dll plugin was not loaded.&lt;/li&gt;
&lt;li&gt;INVALID/ERROR_ACCESS_DENIED/ERROR&lt;/li&gt;
&lt;li&gt;If successful, returns an object with the following properties: &lt;ul&gt;
&lt;li&gt;string displayName: the display name of the service &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;string startType: specifies when to start the service. This parameter can be one of the following string values: &lt;ul&gt;
&lt;li&gt;"AUTO_START": a service started automatically by the service control manager during system startup&lt;/li&gt;
&lt;li&gt;"DEMAND_START": a service started by the service control manager when a process calls the uisdk_ServiceStart function&lt;/li&gt;
&lt;li&gt;"DISABLED": a service that cannot be started. Attempts to start the service result in the error returned&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;string binaryPathName: the fully qualified path to the service binary file&lt;/li&gt;
&lt;li&gt;string errorControl: the severity and startup behavior of a service failure. Can be one of the following string values: &lt;ul&gt;
&lt;li&gt;"IGNORE": the startup program logs the error but continues the startup operation&lt;/li&gt;
&lt;li&gt;NORMAL": the startup program logs the error and puts up a message box pop-up but continues the startup operation&lt;/li&gt;
&lt;li&gt;"SEVERE": the startup program logs the error. If the last-known-good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known-good configuration&lt;/li&gt;
&lt;li&gt;"CRITICAL": the startup program logs the error, if possible. If the last-known-good configuration is being started, the startup operation fails. Otherwise, the system is restarted with the last-known good configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;The ServiceManager.dll plugin must be loaded in order for this function to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.queryServiceStatus&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Queries the current operational status of the specified service.&lt;/li&gt;
&lt;li&gt;Threading: foreground/blocking.&lt;/li&gt;
&lt;li&gt;Function: wbc.queryServiceStatus(serviceName)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;serviceName: internal name of the service.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;NOPLUGIN/ERROR/ERROR_ACCESS_DENIED/INVALID&lt;/li&gt;
&lt;li&gt;If successful, returns the status string, which can be one of the following: &lt;/li&gt;
&lt;li&gt;"STOPPED": the service is not running&lt;/li&gt;
&lt;li&gt;"START_PENDING": the service is starting&lt;/li&gt;
&lt;li&gt;"STOP_PENDING": the service is stopping&lt;/li&gt;
&lt;li&gt;"RUNNING": the service is running&lt;/li&gt;
&lt;li&gt;"CONTINUE_PENDING": the service continue is pending&lt;/li&gt;
&lt;li&gt;"PAUSE_PENDING": the service pause is pending&lt;/li&gt;
&lt;li&gt;"PAUSED": the service is paused&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;The ServiceManager.dll plugin must be loaded in order for this function to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.startService&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Starts a specific service&lt;/li&gt;
&lt;li&gt;Threading: Background threaded&lt;/li&gt;
&lt;li&gt;Function: wbc.startService(serviceName, callback, timeout)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;serviceName: Internal name of the service to be started.&lt;/li&gt;
&lt;li&gt;timeout: wait timeout in millseconds. Callback will be invoked if the service is started or the timeout duration has elapsed without it starting.&lt;/li&gt;
&lt;li&gt;callback: bound JS function, receiving an object that will have the following properties: &lt;ul&gt;
&lt;li&gt;string func: internal function name ('uisdk_ServiceStart')&lt;/li&gt;
&lt;li&gt;string status: the status of the start operation. Can be one of the following string values: &lt;ul&gt;
&lt;li&gt;"STOPPED": the service is not running&lt;/li&gt;
&lt;li&gt;"RUNNING": the service is running&lt;/li&gt;
&lt;li&gt;"PAUSED": the service is paused&lt;/li&gt;
&lt;li&gt;"TIMEOUT": service start was not completed within the specified timeout value&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;ERROR/INVALID/NOPLUGIN/ERROR_ACCESS_DENIED&lt;/li&gt;
&lt;li&gt;OK.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;If the service is already running, OK is returned, and the callback never completes.&lt;/li&gt;
&lt;li&gt;If the service is not already running, OK is also returned, and the callback will fire on timeout or service startup completion.&lt;/li&gt;
&lt;li&gt;Because of the above ambiguity, care should be taken to query the service status with queryServiceStatus before calling this function.&lt;/li&gt;
&lt;li&gt;This function requires the ServiceManager.dll plugin loaded in order to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;wbc.stopService&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Description: Stops a specific service&lt;/li&gt;
&lt;li&gt;Threading: Background threaded with callback&lt;/li&gt;
&lt;li&gt;Function: wbc.stopService(serviceName, callback, timeout)&lt;/li&gt;
&lt;li&gt;Arguments:&lt;ul&gt;
&lt;li&gt;serviceName: Internal name of the service to be started.&lt;/li&gt;
&lt;li&gt;timeout: wait timeout in millseconds. Callback will be invoked if the service is started or the timeout duration has elapsed without it starting.&lt;/li&gt;
&lt;li&gt;callback: bound JS function, receiving an object that will have the following properties: &lt;ul&gt;
&lt;li&gt;string func: internal function name ('uisdk_ServiceStop')&lt;/li&gt;
&lt;li&gt;string status: the status of the start operation. Can be one of the following string values: &lt;ul&gt;
&lt;li&gt;"STOPPED": the service is not running&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;"RUNNING": the service is running&lt;/li&gt;
&lt;li&gt;"PAUSED": the service is paused&lt;/li&gt;
&lt;li&gt;"TIMEOUT": service start was not completed within the specified timeout value&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Returns:&lt;ul&gt;
&lt;li&gt;ERROR/INVALID/NOPLUGIN/ERROR_ACCESS_DENIED&lt;/li&gt;
&lt;li&gt;OK.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes:&lt;ul&gt;
&lt;li&gt;If the service is already stopped, OK is returned, and the callback never completes.&lt;/li&gt;
&lt;li&gt;If the service is not already stopped , OK is also returned, and the callback will fire on timeout or service stop completion.&lt;/li&gt;
&lt;li&gt;Because of the above ambiguity, care should be taken to query the service status with queryServiceStatus before calling this function.&lt;/li&gt;
&lt;li&gt;This function requires the ServiceManager.dll plugin loaded in order to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><pubDate>Tue, 16 Jul 2013 01:50:44 -0000</pubDate><guid>https://sourceforge.net36d0753cc145cd4c0f38d071d0c6378187c96f07</guid></item></channel></rss>