home *** CD-ROM | disk | FTP | other *** search
/ PC Administrator / spravce.iso / RunModule / src / Thunk.h < prev   
Encoding:
C/C++ Source or Header  |  2001-09-13  |  2.1 KB  |  48 lines

  1. ////////////////////////
  2. // Thunk WndProc pointer
  3. ////////////////////////
  4. // Created: 12/29/2000 {m/d/y}
  5. // Written by: Anish Mistry http://am-productions.yi.org/
  6. /*
  7. Copyright 2001 Anish Mistry. All rights reserved.
  8.  
  9. Redistribution and use in source and binary forms, with or without modification,
  10. are permitted provided that the following conditions are met:
  11.  
  12.    1. Redistributions of source code must retain the above copyright notice, 
  13.    this list of conditions and the following disclaimer.
  14.    2. Redistributions in binary form must reproduce the above copyright notice,
  15.    this list of conditions and the following disclaimer in the documentation 
  16.    and/or other materials provided with the distribution.
  17.  
  18. THIS SOFTWARE IS PROVIDED BY ANISH MISTRY ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  19. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
  20. AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 
  21. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  22. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  23. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  25. TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  
  28. The views and conclusions contained in the software and documentation are those
  29. of the authors and should not be interpreted as representing official policies,
  30. either expressed or implied, of Anish Mistry or AM Productions.
  31.  
  32. * Variation of the FreeBSD License. http://www.freebsd.org/copyright/freebsd-license.html
  33. */
  34.  
  35. typedef unsigned char ThunkData[9];
  36.  
  37. #ifndef _THUNK_INIT_
  38. #define _THUNK_INIT_
  39. void inline ThunkInit(ThunkData t, void * This)
  40. // ThunkInit created by Feng Yuan http://www.fengyuan.com/
  41. {// begin ThunkInit
  42.     t[0] = 0xB9; // mov ecx, 
  43.     *((DWORD *)(t+1)) = (DWORD) This; // this
  44.     *((DWORD *)(t+5)) = 0x20FF018B; // mov eax, [ecx] 
  45.     // jmp [eax]
  46. }// end ThunkInit
  47. #endif
  48.