Results 1 to 5 of 5

Thread: LINK: Grafting Compiled Code: The Ultimate in Code Reuse

  1. #1

    LINK: Grafting Compiled Code: The Ultimate in Code Reuse

    Introduction

    This article will demonstrate techniques to incorporate compiled machine code into an existing project using ASM source files. The assembly source file will be created from the compiled machine code. In addition, it will detail the limitation of Imagehlp.dll (single thread safety requirement), and show techniques for converting a compiled STDCALL procedure to a C-CALL assembly language routine.

    Eample one will present a standard C++ console application. The program add two numbers and returns the results. The example will present a few of the basic obstacles to overcome. Sample two will incorporate the graft using compiled machine code of Add() from the first.

    Finally, example three will use machine code from imagehlp.dll to supplement the PE Checksum program. This will remove the requirement of the library dependency from a project and fully demonstrate the techniques.

    http://www.codeproject.com/useritems/CodeGraft.asp

  2. #2
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    Nice articel Jeffrey, but i think that this technique probaly most interesting for people which are not interested to understand what asm code is doing.

    It can be probably used by a newbie who want to rip an algo without understanding what it is doin'.

    Anyway, i read worser articles

    Regards.
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  3. #3
    Administrator dELTA's Avatar
    Join Date
    Oct 2000
    Location
    Ring -1
    Posts
    4,206
    Blog Entries
    5
    No matter if you understand the code or not, these techniques can be very useful at times. Thanks for the link Cthulhu.
    "Give a man a quote from the FAQ, and he'll ignore it. Print the FAQ, shove it up his ass, kick him in the balls, DDoS his ass and kick/ban him, and the point usually gets through eventually."

  4. #4
    You're welcome

  5. #5
    Quote Originally Posted by OHPen View Post
    It can be probably used by a newbie who want to rip an algo without understanding what it is doin'.
    That's an example of a bad way in which this can be used...

    You still have to understand the code, otherwise you'd be unable to figure out the memory references/stack parameters/calling convention/etc.

    Interesting to see a rather low-level article on codeproject.com -- the site is mainly high-level stuff.

Similar Threads

  1. Code Injection: Injecting an Entire C Compiled Application
    By Cthulhu in forum Advanced Reversing and Programming
    Replies: 2
    Last Post: March 18th, 2008, 05:06
  2. LINK: Three Ways to Inject Your Code into Another Process
    By Kayaker in forum Advanced Reversing and Programming
    Replies: 15
    Last Post: June 29th, 2004, 01:54
  3. VB P-Code
    By Spencer in forum The Newbie Forum
    Replies: 14
    Last Post: April 23rd, 2004, 18:53
  4. Need help on P-Code.
    By mr.x in forum The Newbie Forum
    Replies: 7
    Last Post: December 20th, 2003, 01:27
  5. Replies: 10
    Last Post: November 9th, 2002, 04:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •