Retrieves error message text associated with an error code from this extender.
wntLastErrMsg(error-code)
(i) error-code: an error code value belonging to this extender, or a special request [negative] request number. See below.
(s) Either an error message string value or some other special string value. See below.
Error-code
The error-code value can be an error code belonging to this extender, or it can be a special negative numeric value. Valid error codes can be obtained when a function in this extender generates an error in a script and the LastError() function is used to obtain the error code. Under normal circumstances, WinBatch scripts do not have error handling enabled and both the numeric error code as well as the error message text are displayed in a dialog box before the script terminates. However, if error handling is enabled then only the error code value can be obtained with the LastError() function. To allow the error message text to be retrieved [so that it can be written out to a log file, etc…], pass the error code value in to this function.
If a negative number is passed in for the error-code parameter value, then this function will behave in a special manner. The following negative numbers are valid for use with this function:
Value |
Meaning |
1 |
Return a TAB delimited list of resource names that could not be properly processed by one of the wnt[Access|Audit][Add|Del|Mod]() or wntOwnerSet() functions. The list is stored in the extender until it is retrieved with this function or until one of the previously mentioned functions is called again [at which time the list is dropped]. |
; Load Appropriate Extender AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')
; In this example we will give the group "Everyone" full control ; access to the folder "C:\TEMP". This example is intended to ; be executed on a Win2K system, and the permissions that are ; being assigned are inheritable by all of the folders and files ; under the folder "C:\TEMP". Assuming that the account used ; to run the script lacks the necessary permissions to make this ; change, an error that gets trapped will occur in the script. We ; then use wntLastErrMsg() to get some information about what ; went wrong. ; ; The flags value is "96", so a progress dialog box will be displayed ; to show what particular folder or file is being processed at any ; given time. Also, an artificial time delay of 1.0 seconds has been ; requested to allow the progress dialog box's contents to be read ; by the user. This example script works best of there are a few ; subfolders directly under "C:\TEMP" so that the progress dialog ; box is displayed for a few seconds while attempts are made to ; modify the security on each of the subfolders. ErrorMode(@OFF) Result = wntAccessAdd("","C:\TEMP","Everybody",300,"Dir2K:Full",96) RC = LastError() ErrorMode(@CANCEL) If ((RC) || (!Result)) FailedResourceList = wntLastErrMsg(-1) ErrMsgText = wntLastErrMsg(RC) MsgText = StrCat("wntAccessAdd() Result = ",Result,", LastError() Result = ",RC) MsgText = StrCat(MsgText,@CRLF,@CRLF,"Error message text:",@CRLF) MsgText = StrCat(MsgText,@CRLF,ErrMsgText,@CRLF) MsgText = StrCat(MsgText,@CRLF,"Resources not processed:",@CRLF) MsgText = StrCat(MsgText,@CRLF,StrReplace(FailedResourceList,@TAB,@CRLF)) Message("Test wntAccessAdd() – Failed",MsgText) EndIf Exit