10.2.4 SPTHTerminate (forcibly terminate script execution)
- Purpose
-
Forcibly terminates script execution.
- Prototype declaration
BOOL APIENTRY SPTHTerminate ( HANDLE hScript, LPCSTR lpszFileName, UINT uProcessID, DWORD dwOption );
- Arguments
-
- hScript
-
Specify the script control handle returned by the SPTHOpen function.
- lpszFileName
-
Specify the full path of the script file.
This value must be the full path from the computer specified in the SPTHOpen function.
If you specify uProcessID, you can omit this value (specify NULL).
- uProcessID
-
Specify the process ID of the script file.
If you specify lpszFileName, you can omit this value (specify 0).
- dwOption
-
Specify 0 or the following value:
Value
Meaning
SPTH_TERM_CHILD
Executable files called by the script from the Exec or NetExec command are also terminated. If the executable files do not terminate within three minutes after the request, the TerminateProcess function of the Win32 API forcibly terminates them.
SPTH_DQ_FILENAME
If the value specified in IpszFileName includes spaces and is enclosed by double quotation marks, the spaces are identified as part of the file name. If the value is not enclosed by double quotation marks, the string after the last space is identified as the file name.
- Description
-
The SPTHTerminate function returns TRUE on successful execution, or FALSE if an error occurs. To get extended error information, use the GetLastError function.
This function ends normally (returns TRUE) even if there is no process to be terminated (the process has already terminated).
If this function ends normally, you can tell whether the process was actually terminated by referencing the return value of the GetLastError function.
If the return value is NO_ERROR, the process was forcibly terminated. Any other return value means that termination processing was not performed.
- Note
-
Although you can omit either lpszFileName or uProcessID, both arguments should be specified whenever possible to identify the process to be terminated with greater certainty.
You must specify uProcessID to terminate a script process activated concurrently from multiple programs.
The return value is set in the following registry when you forcibly terminate script execution using the SPTHTerminate function. The default exit code is 17.
- Registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Hitachi\JP1/Script\SPTX\ExitCode
- Value name
Terminate
- Value data type
REG_DWORD
- Value
-
Return value of the script process
- When the setting takes effect
-
The setting takes effect the next time the script file is executed.
- Supplement
-
SPTHTerminate is used to forcibly terminate a script from JP1/AJS. For details, see 2.7.2(6) Forcibly terminating JP1/Script from JP1/AJS.
- JP1/Script version
-
Supported from JP1/Script 05-00.