Thread Tools Display Modes
03/09/16, 04:59 PM   #1
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
[outdated] ZO_PostHook and ZO_PostHookHandler

Would be nice to have a pair of companions for ZO_PreHook and ZO_PreHookHandler which perform their hook function after the original function.

Without these, manually performing a post-hook such as:
Lua Code:
  1. local oldUpdateList = PLAYER_INVENTORY.UpdateList
  2. PLAYER_INVENTORY.UpdateList = function(PLAYER_INVENTORY, inventoryType, updateEvenIfHidden)
  3.     oldUpdateList(PLAYER_INVENTORY, inventoryType, updateEvenIfHidden)
  4.     myUpdateList()
  5. end

is prone to cause insecure calls to functions which demand a secure context such as "UseItem" and "PickupInventoryItem"; as is the case in this example since those may be called through the keybind strip which is set up in the (now insecure) call to oldUpdateList.

Thanks.

Last edited by Randactyl : 03/09/16 at 05:04 PM.
 
03/11/16, 08:37 AM   #2
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
So to be clear you're looking for a post hook that can call secure code first and then follow on with insecure code in the same call chain?
 
03/11/16, 03:55 PM   #3
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
That's correct.
 
03/14/16, 05:08 AM   #4
QuadroTony
Banned
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 828
connected with this?

when trying to E container



only reloadui helps
 
03/14/16, 03:28 PM   #5
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Would it be possible to allow the PreHook and PostHook function to return arguments from the hook function?
Right now it does only accept a return true which prevents the original from running.

Something like this: (untested)
Lua Code:
  1. local newFn = function(...)
  2.   local ret = {hookFunction(...)}
  3.   if(not ret[1]) then
  4.     return existingFn(...)
  5.   else
  6.     table.remove(ret, 1)
  7.     return unpack(ret)
  8.   end
  9. end

It would also be cool if the post hook function could receive the return values from the hooked function.
e.g.: (untested)
Lua Code:
  1. local newFn = function(...)
  2.   local ret1 = {existingFn(...)}
  3.   local ret2 = {hookFunction(ret1, ...)}
  4.   if(ret2[1]) then
  5.     table.remove(ret2, 1)
  6.     return unpack(ret2)
  7.   end
  8.   return unpack(ret1)
  9. end
 

ESOUI » Developer Discussions » Wish List » [outdated] ZO_PostHook and ZO_PostHookHandler


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off