Results 1 to 7 of 7

Thread: Help with assembly code

  1. #1
    callan300
    Guest

    Help with assembly code

    Hello,

    Could someone tell what this function does? line by line would be great. I am learning and need help.

    Thanks.

    SomeFunction:
    fld dword [esp+0x18]
    fcomp dword [0x100080e4]
    fnstsw ax
    test ah,0x40
    jz 0x1000113c
    mov eax,[esp+0x4]
    mov ecx,[esp+0xc]
    cmp eax,ecx
    jl 0x10001136
    test eax,eax
    jng 0x10001136
    mov eax,[esp+0x8]
    mov ecx,[esp+0x14]
    sub eax,ecx
    mov ecx,[esp+0x10]
    lea eax,[eax+ecx-0x1]
    ret 0x18
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2
    Go read the Intel manuals and figure it out yourself.

    No way for any of us to make sense of it with the jump targets missing.

  3. #3
    callan300
    Guest
    what are jump targets?
    I will put them in the post if you can tell me what it is
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  4. #4
    Quote Originally Posted by callan300 View Post
    Hello,

    Could someone tell what this function does? line by line would be great. I am learning and need help.

    Thanks.

    SomeFunction:
    fld dword [esp+0x18]
    fcomp dword [0x100080e4]
    fnstsw ax
    test ah,0x40
    jz 0x1000113c
    ret 0x18
    I would recommend you first study floating point code.
    That's what the first line is.

    Use the altavista advanced search and put in something like
    fpu instructions in the "only words" box.

    Show what work you have done too.

  5. #5
    callan300
    Guest
    This is a very vasic question, but I really need to know before I go into a lot of trouble.
    Is is all all possible to figure out what the Assembly code is doing so the the function can be re-written?
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  6. #6

    sage

    INTEL MANUALS, go READ them.

    And to answer your question, yes it's possible with the use of a brain and some knowledge you are currently lacking.

  7. #7
    callan300: YES! I ripped the "verification code" out of an that was used for verifying you license key, and through a couple of steps, rewrote the whole thing in C. But as LLXX says, you WILL need to understand asm to be able to do this. Because YOU have to become the processor, in that you look at the instruction, and execute it in your head. (Or single step it in a debugger), and then watch what effect it has on the registers. Once you understand what the instructions do individually, you can start to get an idea of what's going on. Just remember, there are C instructions that generate quite a few ASM instructions.

    Some of the multiply, or divide operations especially, they can result in: Loading a value into a register, shifting it left or right, then adding or subtracting the original value, etc. It seems complicated, but they you realize "Hey, that's just taking that 1st number, and multiplying it by 9!".

Similar Threads

  1. Replies: 8
    Last Post: May 5th, 2011, 08:53
  2. extract runtime assembly code ?
    By mansourweb in forum Malware Analysis and Unpacking Forum
    Replies: 0
    Last Post: May 13th, 2010, 04:48
  3. I don't know anything about assembly instructions
    By nicromonicon in forum The Newbie Forum
    Replies: 16
    Last Post: February 28th, 2005, 21:08
  4. bad assembly analysis
    By Necr0Potenc3 in forum Bugs
    Replies: 3
    Last Post: February 10th, 2005, 05:06
  5. .NET assembly problems
    By crassy in forum Advanced Reversing and Programming
    Replies: 16
    Last Post: August 12th, 2004, 10:06

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
  •