MappGetHookInfo()函数

Synopsis

Get information about a hooked event.

Format

long MappGetHookInfo(EventId, InfoType, UserVarPtr)

MIL_ID EventId; Event identifier received from the hook-handler function
long InfoType; Type of information to get
void *UserVarPtr; Storage location for the information

Description

This function retrieves information about the event that caused the hook-handler function to be called. This function should only be called within the scope of a hook-handler function call (see MappHookFunction).

The EventId parameter specifies the event identifier received from the hook-handler function.

The InfoType parameter specifies the type of information to get.

If the hook handler was called with an M_ERROR_CURRENT HookType, supported values for InfoType are:

InfoType Description
M_CURRENT Error code.
M_CURRENT_SUB_NB Number of error subcodes.
M_CURRENT_SUB_1 Error subcode 1.
M_CURRENT_SUB_2 Error subcode 2.
M_CURRENT_SUB_3 Error subcode 3.
M_CURRENT_FCT Function code that caused an error.
M_MESSAGE+M_CURRENT Error message.
M_MESSAGE+M_CURRENT_SUB_1 Error submessage 1.
M_MESSAGE+M_CURRENT_SUB_2 Error submessage 2.
M_MESSAGE+M_CURRENT_SUB_3 Error submessage 3.
M_MESSAGE+M_CURRENT_FCT Name of the function that caused an error.

If the hook-handler function was called with an M_ERROR_GLOBAL HookType, supported values for InfoType are:

InfoType Description
M_GLOBAL Error code.
M_GLOBAL_SUB_NB Number of error subcodes.
M_GLOBAL_SUB_1 Error subcode 1.
M_GLOBAL_SUB_2 Error subcode 2.
M_GLOBAL_SUB_3 Error subcode 3.
M_GLOBAL_FCT Function code that caused an error.
M_MESSAGE+M_GLOBAL Error message.
M_MESSAGE+M_GLOBAL_SUB_1 Error submessage 1.
M_MESSAGE+M_GLOBAL_SUB_2 Error submessage 2.
M_MESSAGE+M_GLOBAL_SUB_3 Error submessage 3.
M_MESSAGE+M_GLOBAL_FCT Function name that caused an error.

If the hook-handler function was called with an M_TRACE_START or M_TRACE_END HookType, supported values for InfoType are:

InfoType Description
M_CURRENT_FCT Code of the function that just started or ended.
M_MESSAGE+M_CURRENT_FCT Name of the function that just started or ended.
M_PARAM_NB Number of parameters associated to the function call.
M_PARAM_TYPE+n. Data type of the nth parameter. This can be: M_TYPE_LONG, M_TYPE_SHORT, M_TYPE_CHAR, M_TYPE_DOUBLE, M_TYPE_PTR, M_TYPE_MIL_ID, or M_TYPE_STRING (The pointer to a string is invalid after exiting the hook function. For future use, copy and save it.)
M_PARAM_VALUE+n Value of the nth parameter.

If the hook handler was called with an M_MODIFIED_BUFFER HookType , supported values for InfoType are:

InfoType Description
M_MODIFIED_BUFFER+M_BUFFER_ID MIL identifier of the modified buffer.
M_MODIFIED_BUFFER+M_REGION_OFFSET_X X offset, of the modified region in the buffer, as a long value.
M_MODIFIED_BUFFER+M_REGION_OFFSET_Y Y offset, of the modified region in the buffer, as a long value.
M_MODIFIED_BUFFER+M_REGION_SIZE_X Width, of the modified region in the buffer, as a long value.
M_MODIFIED_BUFFER+M_REGION_SIZE_Y Height, of the modified region in the buffer, as a long value.

The UserVarPtr parameter specifies the address of the variable in which the requested information is to be written.

UserVarPtr should be a pointer to a long when getting error codes, subcodes, number of subcodes, function codes and parameter types. It should be a pointer to a string when getting error messages, submessages, and function names. The string must be at least M_ERROR_MESSAGE_SIZE characters in size. When getting parameter values, UserVarPtr should be a pointer to the type specified by the returned value of an M_PARAM_TYPE+n request in a previous call to this function.

Returned value

The returned value is M_NULL if successful; on error, no regular MIL errors are logged.

See also

MappHookFunction