This interface is intended to main a global error code.
All other hook interfaces implement this interface so you can use this interface directly in other interfaces.
Delphi syntax:
IErrorCodeHook = interface function GetErrorCode: Cardinal; stdcall; function GetErrorMessage(AMessage: PChar; AMessageLen: Integer): Integer; stdcall; end;C++ syntax:
class ICodeHookError: public IUnknown {
public:
virtual UINT _stdcall GetErrorCode() = 0;
virtual int _stdcall GetErrorMessage(char * Message, int MessageLen) = 0;
};
Function:
Retrieve the last error code.
Delphi syntax:
C++ syntax:
Params
GetErrorCode
Retrieve the last error code.
Delphi syntax:
function GetErrorCode: Cardinal; stdcall;
C++ syntax:
virtual UINT calltype GetErrorCode() = 0;
Params
- This function has no parameters.
- The last error code.
- There are constants defined for error code.
HEC_NONE: No error occured.
HEC_FUNCTION_TOO_SMALL: The target function is too small to be hooked. That's to say, a 'ret' or 'iret' instruction is met in the first serveral instructions of the target.
HEC_UNKNOWN_INSTRUCTION: An instruction can not be recognized by current disassembly engine.
HEC_ADDRESS_CANNOT_WRITE: The destination address is read only and can't be written.
HEC_INVALID_HANDLE: The handle passed in as a parameter is invalid.
HEC_INVALID_CC: The calling convention passed in as a parameter is invalid.
HEC_TOO_MANY_EXTRA_PARAMS: The extra parameters exceed the maximum count. The maximum count is MAX_EXTRA_PARAM_COUNT.
HEC_EXTEND_INFO_UNAVAILABLE: Can't find extend information. That usually means you require advanced mode operation on raw mode hooking.
Function:
Retrieve the last error message.
Delphi syntax:
C++ syntax:
Params
GetErrorMessage
Retrieve the last error message.
Delphi syntax:
function GetErrorMessage(AMessage: PChar; AMessageLen: Integer): Integer; stdcall;
C++ syntax:
virtual int calltype GetErrorMessage(char * Message, int MessageLen) = 0;
Params
- AMessage
- Pointer to the buffer to retrieve the message.
- AMessageLen
- The buffer length.
- The byte count that copied to the buffer. If the buffer is too small, the message will be truncated.