For calling __fastcall, I use the first bit of assembly, the TransformStdCallToFastCallPtr part. It just takes a pointer to a __fastcall function and then transforms the stack into __fastcall convention and finally calls the __fastcall function.
The next bit of assembly is the part I actually inject. It takes an __stdcall function and wraps it in a function that turns __fastcall convention into __stdcall before calling the original.
The WrapStdCall function returns a new piece of code each call, since we need to inject it into an assembly, so the address of our hook function needs to be statically in the code.
So to inject I just have some sort of __stdcall function, I pass it to WrapStdCall and then inject the returned function instead. And from inside my hook I use the TransformStdCallToFastCall stuff to call the original using the same delegate definition as I used with the hook.
One problem I can see now that I look at it, is that this is x86 only, since that's what I exclusively work in. I guess we'd need to make something similar for x64 before adding it.