hook_param_set
Behaviour
Section titled “Behaviour”- Search the hook chain on the hook account for a 32 byte hash indicated by
hread_ptr
- If found: set a parameter:
- With the parameter name indicated by
kread_ptr
and - The parameter value indicated by
read_ptr
- Set a parameter for the hook with the specified value and key, and associate it with a hash.
- Returns a status code indicating the result of the operation.
Definition
Section titled “Definition”int64_t hook_param_set ( uint32_t read_ptr, uint32_t read_len, uint32_t kread_ptr, uint32_t kread_len, uint32_t hread_ptr, uint32_t hread_len);
function hook_param_set( val: ByteArray | HexString, key: ByteArray | HexString, hash: ByteArray | HexString ): number
Example
Section titled “Example”uint8_t pvalue[] = "some parameter value";uint8_t pname[] = "paramname";uint8_t phash[] = { 0x19U, 0xFEU, 0x69U, 0xF1U, 0x53U, 0x66U, 0x4EU, 0x8CU, 0x97U, 0xF4U, 0x4CU, 0x5CU, 0x3CU, 0x65U, 0x63U, 0x79U, 0xC2U, 0xD0U, 0x26U, 0xE7U, 0x90U, 0xEFU, 0x38U, 0xF7U, 0xEDU, 0x73U, 0xE9U, 0xCEU, 0x9CU, 0x9DU, 0xBFU, 0x03U };int64_t result = hook_param_set(pvalue, sizeof(pvalue), pname, sizeof(pname), phash, sizeof(phash));
const pvalue = "some parameter value"const pname = "paramname"const phash = [ 0x19, 0xFE, 0x69, 0xF1, 0x53, 0x66, 0x4E, 0x8C, 0x97, 0xF4, 0x4C, 0x5C, 0x3C, 0x65, 0x63, 0x79, 0xC2, 0xD0, 0x26, 0xE7, 0x90, 0xEF, 0x38, 0xF7, 0xED, 0x73, 0xE9, 0xCE, 0x9C, 0x9D, 0xBF, 0x03 ]const result = hook_param_set(str2hex(pvalue), str2hex(pname), phash)
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
read_ptr | uint32_t | Pointer to parameter value |
read_len | uint32_t | Length of the parameter value |
kread_ptr | uint32_t | Pointer to the parameter name |
kread_len | uint32_t | Length of the parameter name |
hread_ptr | uint32_t | Pointer to hook hash |
hread_len | uint32_t | Length of hook hash (always 32) |
Name | Type | Description |
---|---|---|
val | ByteArray or HexString | The value to set for the parameter. |
key | ByteArray or HexString | The key associated with the parameter. |
hash | ByteArray or HexString | The hash to associate with the parameter. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The length of the parameter value successfully set If negative, an error: OUT_OF_BOUNDS - pointers/lengths specified outside of hook memory. TOO_SMALL - The parameter name can’t be null TOO_BIG - The parameter name is greater than 32 bytes |
Type | Description |
---|---|
number | Returns a status code indicating the result of the operation. |