I've seen a very intersting method of writing ASM code into a Code Cave, you'll declare a naked function and put your code as Inlane ASM in ther, after this lines of code you add another function to calculate the lenght of your naked function. Then You allocate enough memory to store your function change the Page Protection stuff for your function so you can read it's memory and write the hole function into the code cave with WriteProcessMemory (or what it's named didn't use it for ages inprocess ftw :>), if you want to call WoW Functions you should add the update current manager function if you don't want to highjack a wow thread.
Credit's for this Idea go to a guy named Yesar from ***********.de GuildWars section ^^