title: Hooking __thiscall without using __fastcall
body: <p>Say you need to hook/detour a function that is the <code>__thiscall</code> type on x86 Windows and in order to do that, you need to pass a void* to the shim function. Yes this is technically "horrible abuse" of C++, but this is function hooking, not an exercise in coding a portable application.</p>
  
  <p>For example, say you need to hook a function such as this:</p>
  
  <pre><code>void __thiscall SomeClass::MemberFunction(int b) { this-&gt;somevar = b; }
  </code></pre>
  
  <p>Obviously it's well known that you can just create a <code>__fastcall</code> function that uses an extra arg to dispose of EDX, but that's a bit... lame.</p>
  
  <p>So the question is: <strong>What trickery can you think of to be able to convert the type of a non-static C++ class member function to a void* variable?</strong></p>